diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 906b808f..3159a30b 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -740,7 +740,33 @@ export default function App() { const sandboxSessionIdRef = useRef(sandboxSession?.id ?? ""); const sandboxActiveAssistantTurnIdRef = useRef(""); const sandboxUploadRunRef = useRef(0); + const sandboxPreviewUrlsRef = useRef>(new Set()); sandboxSessionIdRef.current = sandboxSession?.id ?? ""; + useEffect(() => () => { + for (const previewUrl of sandboxPreviewUrlsRef.current) { + URL.revokeObjectURL(previewUrl); + } + sandboxPreviewUrlsRef.current.clear(); + }, []); + + function createSandboxPreviewUrl(file: File) { + const previewUrl = URL.createObjectURL(file); + sandboxPreviewUrlsRef.current.add(previewUrl); + return previewUrl; + } + + function releaseSandboxPreviewUrl(previewUrl?: string) { + if (!previewUrl || !sandboxPreviewUrlsRef.current.delete(previewUrl)) return; + URL.revokeObjectURL(previewUrl); + } + + function releaseAllSandboxPreviews() { + for (const previewUrl of sandboxPreviewUrlsRef.current) { + URL.revokeObjectURL(previewUrl); + } + sandboxPreviewUrlsRef.current.clear(); + } + // Turns are stored PER SESSION, so a background stream can keep updating its // own session's transcript while you view another one — no cross-session // leak, no data loss, and no re-fetch when you switch back (its entry is @@ -953,6 +979,7 @@ export default function App() { }, onSnapshot: (snapshot) => { const activeSessionId = sandboxSessionIdRef.current; + releaseAllSandboxPreviews(); setSandboxTurns(sandboxSnapshotTurns(snapshot)); setSandboxSession((current) => current?.id === activeSessionId @@ -2286,6 +2313,7 @@ export default function App() { setSkillCreating(false); discardDraftAttachments(attachments); setAttachments([]); + releaseAllSandboxPreviews(); setSandboxTurns([]); setSandboxSession(nextSession); setCreateView(null); @@ -2330,6 +2358,7 @@ export default function App() { setPendingTurns([]); setInput(""); setInvocation(emptyInvocation()); + releaseAllSandboxPreviews(); setSandboxTurns([]); setSandboxSession(connected); setSandboxAgentDetailTarget(null); @@ -2375,8 +2404,8 @@ export default function App() { sandboxSessionIdRef.current = ""; sandboxActiveAssistantTurnIdRef.current = ""; setSandboxBusy(false); + releaseAllSandboxPreviews(); setSandboxTurns([]); - releaseAttachmentPreviews(attachments); setAttachments([]); setInput(""); setError(""); @@ -2564,7 +2593,7 @@ export default function App() { name: file.name, sizeBytes: file.size, status: "uploading", - previewUrl: URL.createObjectURL(file), + previewUrl: createSandboxPreviewUrl(file), }; return { file, attachment }; }); @@ -2636,9 +2665,9 @@ export default function App() { if (sandboxUploadRunRef.current === uploadRun) { setSandboxUploadBusy(false); } else { - releaseAttachmentPreviews( - drafts.map(({ attachment }) => attachment), - ); + for (const { attachment } of drafts) { + releaseSandboxPreviewUrl(attachment.previewUrl); + } } } } @@ -2646,7 +2675,7 @@ export default function App() { function removeSandboxAttachment(id: string) { const removed = attachments.find((item) => item.id === id); if (!removed) return; - releaseAttachmentPreviews([removed]); + releaseSandboxPreviewUrl(removed.previewUrl); setAttachments((current) => current.filter((item) => item.id !== id)); } @@ -2690,6 +2719,7 @@ export default function App() { mimeType: attachment.mimeType, name: attachment.name, sizeBytes: attachment.sizeBytes, + previewUrl: attachment.previewUrl, })), }); } @@ -2808,14 +2838,11 @@ export default function App() { } return next; }); - releaseAttachmentPreviews(messageAttachments); } catch (messageError) { if ((messageError as Error)?.name === "AbortError") { - releaseAttachmentPreviews(messageAttachments); return; } if (sandboxMessageAbortRef.current !== controller) { - releaseAttachmentPreviews(messageAttachments); return; } setSandboxTurns((current) => diff --git a/frontend/src/blocks.ts b/frontend/src/blocks.ts index dba358f1..f356acd6 100644 --- a/frontend/src/blocks.ts +++ b/frontend/src/blocks.ts @@ -45,6 +45,7 @@ export interface AttachmentView { uri?: string; name?: string; sizeBytes?: number; + previewUrl?: string; } export type Block = diff --git a/frontend/src/ui/Media.tsx b/frontend/src/ui/Media.tsx index 3da386c9..d95d28ce 100644 --- a/frontend/src/ui/Media.tsx +++ b/frontend/src/ui/Media.tsx @@ -87,7 +87,7 @@ export function MediaGroup({ appName, items, compact = false, onRemove }: MediaG type="button" className="media-card-main" disabled={disabled} - onClick={() => setOpen(item)} + onClick={kind === "image" ? undefined : () => setOpen(item)} aria-label={`预览 ${item.name ?? "附件"}`} > {kind === "image" && source ? ( diff --git a/frontend/tests/mediaPreview.test.mjs b/frontend/tests/mediaPreview.test.mjs new file mode 100644 index 00000000..1fadf183 --- /dev/null +++ b/frontend/tests/mediaPreview.test.mjs @@ -0,0 +1,19 @@ +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import test from "node:test"; + +const mediaSource = readFileSync( + new URL("../src/ui/Media.tsx", import.meta.url), + "utf8", +); + +test("image attachments open only the shared photo viewer", () => { + assert.match( + mediaSource, + /onClick=\{kind === "image" \? undefined : \(\) => setOpen\(item\)\}/, + ); + assert.match( + mediaSource, + /kind === "image" && !disabled[\s\S]*?\{previewButton\}<\/PhotoView>/, + ); +}); diff --git a/frontend/tests/sandboxCodexControls.test.mjs b/frontend/tests/sandboxCodexControls.test.mjs index 49c506ea..0bce05c4 100644 --- a/frontend/tests/sandboxCodexControls.test.mjs +++ b/frontend/tests/sandboxCodexControls.test.mjs @@ -57,6 +57,17 @@ test("Codex token usage and approvals are presented per assistant turn", () => { assert.match(controlsSource, /保存权限/); }); +test("Codex image attachments keep their preview until the transcript is cleared", () => { + assert.match(blocksSource, /previewUrl\?: string/); + assert.match( + appSource, + /files: readyAttachments\.map[\s\S]*?previewUrl: attachment\.previewUrl/, + ); + assert.match(appSource, /sandboxPreviewUrlsRef/); + assert.match(appSource, /releaseAllSandboxPreviews\(\)/); + assert.doesNotMatch(appSource, /releaseAttachmentPreviews\(messageAttachments\)/); +}); + test("sandbox dialogs provide explicit loading error and keyboard states", () => { assert.match(controlsSource, /role="dialog"/); assert.match(controlsSource, /if \(event\.key === "Escape"\)/); diff --git a/veadk/webui/assets/CodeEditor-BVx0KMNT.js b/veadk/webui/assets/CodeEditor-CCfFnG8t.js similarity index 99% rename from veadk/webui/assets/CodeEditor-BVx0KMNT.js rename to veadk/webui/assets/CodeEditor-CCfFnG8t.js index af322202..023a6c83 100644 --- a/veadk/webui/assets/CodeEditor-BVx0KMNT.js +++ b/veadk/webui/assets/CodeEditor-CCfFnG8t.js @@ -1,4 +1,4 @@ -import{L as xe,D as sf}from"./index-C-FfUod_.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{L as xe,D as sf}from"./index-Bgo3gdBa.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-CVrkjs41.js b/veadk/webui/assets/MarkdownPromptEditor-CL92_Aob.js similarity index 99% rename from veadk/webui/assets/MarkdownPromptEditor-CVrkjs41.js rename to veadk/webui/assets/MarkdownPromptEditor-CL92_Aob.js index 01a59940..d8b6f8ef 100644 --- a/veadk/webui/assets/MarkdownPromptEditor-CVrkjs41.js +++ b/veadk/webui/assets/MarkdownPromptEditor-CL92_Aob.js @@ -1,4 +1,4 @@ -var px=Object.defineProperty;var mx=(t,e,n)=>e in t?px(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var L=(t,e,n)=>mx(t,typeof e!="symbol"?e+"":e,n);import{s as Cd,t as yx,o as xx,q as Cc,J as _x,a0 as vx,C as Cx,L as E,D as R,a as Ze,W as xt,U as Ln,f as $e,p as bx,_ as sn,K as Or,i as Wl,$ as wx,P as Ru,Z as Fu,h as Sx,k as Ex,Y as Fp,X as bc,I as Tx,c as kx,j as Hp,m as Vp,b as Nx,T as Mx,l as Ox,R as N,n as bd,d as wd,V as rt,H as pn,Q as xs,N as $a,M as Ax,e as Sd,E as nn,G as ol,r as Hu,F as gr,S as Jn,O as jt,g as ni,u as Lx,y as Px,w as $x,x as Ix,v as Dx,B as Rx,z as Fx,A as Hx}from"./index-C-FfUod_.js";const Vx={}.hasOwnProperty;function Bp(t,e){let n=-1,r;if(e.extensions)for(;++ne in t?px(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var L=(t,e,n)=>mx(t,typeof e!="symbol"?e+"":e,n);import{s as Cd,t as yx,o as xx,q as Cc,J as _x,a0 as vx,C as Cx,L as E,D as R,a as Ze,W as xt,U as Ln,f as $e,p as bx,_ as sn,K as Or,i as Wl,$ as wx,P as Ru,Z as Fu,h as Sx,k as Ex,Y as Fp,X as bc,I as Tx,c as kx,j as Hp,m as Vp,b as Nx,T as Mx,l as Ox,R as N,n as bd,d as wd,V as rt,H as pn,Q as xs,N as $a,M as Ax,e as Sd,E as nn,G as ol,r as Hu,F as gr,S as Jn,O as jt,g as ni,u as Lx,y as Px,w as $x,x as Ix,v as Dx,B as Rx,z as Fx,A as Hx}from"./index-Bgo3gdBa.js";const Vx={}.hasOwnProperty;function Bp(t,e){let n=-1,r;if(e.extensions)for(;++ni.map(i=>d[i]); -var XG=Object.defineProperty;var EC=e=>{throw TypeError(e)};var QG=(e,t,n)=>t in e?XG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var vC=(e,t,n)=>QG(e,typeof t!="symbol"?t+"":t,n),wC=(e,t,n)=>t.has(e)||EC("Cannot "+n);var ji=(e,t,n)=>(wC(e,t,"read from private field"),n?n.call(e):t.get(e)),SC=(e,t,n)=>t.has(e)?EC("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),RE=(e,t,n,s)=>(wC(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n);function ZG(e,t){for(var n=0;ns[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"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=n(i);fetch(i.href,r)}})();var Nl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Df(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var AD={exports:{}},Nx={};/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownPromptEditor-CL92_Aob.js","assets/MarkdownPromptEditor-ZH9qtki0.css"])))=>i.map(i=>d[i]); +var eK=Object.defineProperty;var _C=e=>{throw TypeError(e)};var tK=(e,t,n)=>t in e?eK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var NC=(e,t,n)=>tK(e,typeof t!="symbol"?t+"":t,n),TC=(e,t,n)=>t.has(e)||_C("Cannot "+n);var Ii=(e,t,n)=>(TC(e,t,"read from private field"),n?n.call(e):t.get(e)),kC=(e,t,n)=>t.has(e)?_C("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),LE=(e,t,n,s)=>(TC(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n);function nK(e,t){for(var n=0;ns[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"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=n(i);fetch(i.href,r)}})();var Il=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var RD={exports:{}},kx={};/** * @license React * react-jsx-runtime.production.js * @@ -7,7 +7,7 @@ var XG=Object.defineProperty;var EC=e=>{throw TypeError(e)};var QG=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var JG=Symbol.for("react.transitional.element"),eK=Symbol.for("react.fragment");function CD(e,t,n){var s=null;if(n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),"key"in t){n={};for(var i in t)i!=="key"&&(n[i]=t[i])}else n=t;return t=n.ref,{$$typeof:JG,type:e,key:s,ref:t!==void 0?t:null,props:n}}Nx.Fragment=eK;Nx.jsx=CD;Nx.jsxs=CD;AD.exports=Nx;var o=AD.exports,ID={exports:{}},jt={};/** + */var sK=Symbol.for("react.transitional.element"),iK=Symbol.for("react.fragment");function OD(e,t,n){var s=null;if(n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),"key"in t){n={};for(var i in t)i!=="key"&&(n[i]=t[i])}else n=t;return t=n.ref,{$$typeof:sK,type:e,key:s,ref:t!==void 0?t:null,props:n}}kx.Fragment=iK;kx.jsx=OD;kx.jsxs=OD;RD.exports=kx;var o=RD.exports,MD={exports:{}},Mt={};/** * @license React * react.production.js * @@ -15,7 +15,7 @@ var XG=Object.defineProperty;var EC=e=>{throw TypeError(e)};var QG=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var zN=Symbol.for("react.transitional.element"),tK=Symbol.for("react.portal"),nK=Symbol.for("react.fragment"),sK=Symbol.for("react.strict_mode"),iK=Symbol.for("react.profiler"),rK=Symbol.for("react.consumer"),aK=Symbol.for("react.context"),oK=Symbol.for("react.forward_ref"),lK=Symbol.for("react.suspense"),cK=Symbol.for("react.memo"),jD=Symbol.for("react.lazy"),uK=Symbol.for("react.activity"),_C=Symbol.iterator;function dK(e){return e===null||typeof e!="object"?null:(e=_C&&e[_C]||e["@@iterator"],typeof e=="function"?e:null)}var RD={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},OD=Object.assign,MD={};function Pf(e,t,n){this.props=e,this.context=t,this.refs=MD,this.updater=n||RD}Pf.prototype.isReactComponent={};Pf.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("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")};Pf.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function LD(){}LD.prototype=Pf.prototype;function VN(e,t,n){this.props=e,this.context=t,this.refs=MD,this.updater=n||RD}var GN=VN.prototype=new LD;GN.constructor=VN;OD(GN,Pf.prototype);GN.isPureReactComponent=!0;var NC=Array.isArray;function Xw(){}var rs={H:null,A:null,T:null,S:null},DD=Object.prototype.hasOwnProperty;function KN(e,t,n){var s=n.ref;return{$$typeof:zN,type:e,key:t,ref:s!==void 0?s:null,props:n}}function fK(e,t){return KN(e.type,t,e.props)}function qN(e){return typeof e=="object"&&e!==null&&e.$$typeof===zN}function hK(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var TC=/\/+/g;function OE(e,t){return typeof e=="object"&&e!==null&&e.key!=null?hK(""+e.key):t.toString(36)}function pK(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Xw,Xw):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function nd(e,t,n,s,i){var r=typeof e;(r==="undefined"||r==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(r){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case zN:case tK:a=!0;break;case jD:return a=e._init,nd(a(e._payload),t,n,s,i)}}if(a)return i=i(e),a=s===""?"."+OE(e,0):s,NC(i)?(n="",a!=null&&(n=a.replace(TC,"$&/")+"/"),nd(i,t,n,"",function(u){return u})):i!=null&&(qN(i)&&(i=fK(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(TC,"$&/")+"/")+a)),t.push(i)),1;a=0;var l=s===""?".":s+":";if(NC(e))for(var c=0;c{throw TypeError(e)};var QG=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(e){function t(A,O){var P=A.length;A.push(O);e:for(;0>>1,R=A[$];if(0>>1;$i(U,P))tei(K,U)?(A[$]=K,A[te]=P,$=te):(A[$]=U,A[J]=P,$=J);else if(tei(K,P))A[$]=K,A[te]=P,$=te;else break e}}return O}function i(A,O){var P=A.sortIndex-O.sortIndex;return P!==0?P:A.id-O.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;e.unstable_now=function(){return r.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,m=!1,b=!1,v=!1,y=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function w(A){for(var O=n(u);O!==null;){if(O.callback===null)s(u);else if(O.startTime<=A)s(u),O.sortIndex=O.expirationTime,t(c,O);else break;O=n(u)}}function _(A){if(b=!1,w(A),!m)if(n(c)!==null)m=!0,S||(S=!0,L());else{var O=n(u);O!==null&&F(_,O.startTime-A)}}var S=!1,k=-1,T=5,C=-1;function I(){return v?!0:!(e.unstable_now()-CA&&I());){var $=f.callback;if(typeof $=="function"){f.callback=null,h=f.priorityLevel;var R=$(f.expirationTime<=A);if(A=e.unstable_now(),typeof R=="function"){f.callback=R,w(A),O=!0;break t}f===n(c)&&s(c),w(A)}else s(c);f=n(c)}if(f!==null)O=!0;else{var Y=n(u);Y!==null&&F(_,Y.startTime-A),O=!1}}break e}finally{f=null,h=P,p=!1}O=void 0}}finally{O?L():S=!1}}}var L;if(typeof E=="function")L=function(){E(j)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,D=z.port2;z.port1.onmessage=j,L=function(){D.postMessage(null)}}else L=function(){y(j,0)};function F(A,O){k=y(function(){A(e.unstable_now())},O)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(A){A.callback=null},e.unstable_forceFrameRate=function(A){0>A||125$?(A.sortIndex=P,t(u,A),n(c)===null&&A===n(u)&&(b?(x(k),k=-1):b=!0,F(_,P-$))):(A.sortIndex=R,t(c,A),m||p||(m=!0,S||(S=!0,L()))),A},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(A){var O=h;return function(){var P=h;h=O;try{return A.apply(this,arguments)}finally{h=P}}}})(UD);BD.exports=UD;var bK=BD.exports,FD={exports:{}},Wi={};/** + */(function(e){function t(A,M){var P=A.length;A.push(M);e:for(;0>>1,R=A[H];if(0>>1;Hi(U,P))tei(K,U)?(A[H]=K,A[te]=P,H=te):(A[H]=U,A[J]=P,H=J);else if(tei(K,P))A[H]=K,A[te]=P,H=te;else break e}}return M}function i(A,M){var P=A.sortIndex-M.sortIndex;return P!==0?P:A.id-M.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;e.unstable_now=function(){return r.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,m=!1,b=!1,v=!1,y=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function w(A){for(var M=n(u);M!==null;){if(M.callback===null)s(u);else if(M.startTime<=A)s(u),M.sortIndex=M.expirationTime,t(c,M);else break;M=n(u)}}function _(A){if(b=!1,w(A),!m)if(n(c)!==null)m=!0,S||(S=!0,L());else{var M=n(u);M!==null&&F(_,M.startTime-A)}}var S=!1,k=-1,T=5,C=-1;function I(){return v?!0:!(e.unstable_now()-CA&&I());){var H=f.callback;if(typeof H=="function"){f.callback=null,h=f.priorityLevel;var R=H(f.expirationTime<=A);if(A=e.unstable_now(),typeof R=="function"){f.callback=R,w(A),M=!0;break t}f===n(c)&&s(c),w(A)}else s(c);f=n(c)}if(f!==null)M=!0;else{var Y=n(u);Y!==null&&F(_,Y.startTime-A),M=!1}}break e}finally{f=null,h=P,p=!1}M=void 0}}finally{M?L():S=!1}}}var L;if(typeof E=="function")L=function(){E(j)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,D=z.port2;z.port1.onmessage=j,L=function(){D.postMessage(null)}}else L=function(){y(j,0)};function F(A,M){k=y(function(){A(e.unstable_now())},M)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(A){A.callback=null},e.unstable_forceFrameRate=function(A){0>A||125H?(A.sortIndex=P,t(u,A),n(c)===null&&A===n(u)&&(b?(x(k),k=-1):b=!0,F(_,P-H))):(A.sortIndex=R,t(c,A),m||p||(m=!0,S||(S=!0,L()))),A},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(A){var M=h;return function(){var P=h;h=M;try{return A.apply(this,arguments)}finally{h=P}}}})(zD);HD.exports=zD;var vK=HD.exports,VD={exports:{}},Yi={};/** * @license React * react-dom.production.js * @@ -31,7 +31,7 @@ var XG=Object.defineProperty;var EC=e=>{throw TypeError(e)};var QG=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var yK=g;function $D(e){var t="https://react.dev/errors/"+e;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(HD)}catch(e){console.error(e)}}HD(),FD.exports=Wi;var hi=FD.exports;/** + */var wK=g;function GD(e){var t="https://react.dev/errors/"+e;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(KD)}catch(e){console.error(e)}}KD(),VD.exports=Yi;var hi=VD.exports;/** * @license React * react-dom-client.production.js * @@ -39,15 +39,15 @@ var XG=Object.defineProperty;var EC=e=>{throw TypeError(e)};var QG=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var ri=bK,zD=g,vK=hi;function Ae(e){var t="https://react.dev/errors/"+e;if(1hd||(e.current=nS[hd],nS[hd]=null,hd--)}function qn(e,t){hd++,nS[hd]=e.current,e.current=t}var Ja=ro(null),tm=ro(null),Ol=ro(null),ty=ro(null);function ny(e,t){switch(qn(Ol,t),qn(tm,e),qn(Ja,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?LI(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=LI(t),e=m6(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}fi(Ja),qn(Ja,e)}function tf(){fi(Ja),fi(tm),fi(Ol)}function sS(e){e.memoizedState!==null&&qn(ty,e);var t=Ja.current,n=m6(t,e.type);t!==n&&(qn(tm,e),qn(Ja,n))}function sy(e){tm.current===e&&(fi(Ja),fi(tm)),ty.current===e&&(fi(ty),fm._currentValue=Fc)}var ME,IC;function wc(e){if(ME===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);ME=t&&t[1]||"",IC=-1md||(e.current=aS[md],aS[md]=null,md--)}function Vn(e,t){md++,aS[md]=e.current,e.current=t}var Ja=ro(null),em=ro(null),Bl=ro(null),sy=ro(null);function iy(e,t){switch(Vn(Bl,t),Vn(em,e),Vn(Ja,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?UI(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=UI(t),e=x6(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}fi(Ja),Vn(Ja,e)}function sf(){fi(Ja),fi(em),fi(Bl)}function oS(e){e.memoizedState!==null&&Vn(sy,e);var t=Ja.current,n=x6(t,e.type);t!==n&&(Vn(em,e),Vn(Ja,n))}function ry(e){em.current===e&&(fi(Ja),fi(em)),sy.current===e&&(fi(sy),dm._currentValue=$c)}var PE,MC;function Sc(e){if(PE===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);PE=t&&t[1]||"",MC=-1)":-1i||c[s]!==u[i]){var d=` -`+c[s].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),d}while(1<=s&&0<=i);break}}}finally{LE=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?wc(n):""}function TK(e,t){switch(e.tag){case 26:case 27:case 5:return wc(e.type);case 16:return wc("Lazy");case 13:return e.child!==t&&t!==null?wc("Suspense Fallback"):wc("Suspense");case 19:return wc("SuspenseList");case 0:case 15:return DE(e.type,!1);case 11:return DE(e.type.render,!1);case 1:return DE(e.type,!0);case 31:return wc("Activity");default:return""}}function jC(e){try{var t="",n=null;do t+=TK(e,n),n=e,e=e.return;while(e);return t}catch(s){return` +`+c[s].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),d}while(1<=s&&0<=i);break}}}finally{BE=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Sc(n):""}function IK(e,t){switch(e.tag){case 26:case 27:case 5:return Sc(e.type);case 16:return Sc("Lazy");case 13:return e.child!==t&&t!==null?Sc("Suspense Fallback"):Sc("Suspense");case 19:return Sc("SuspenseList");case 0:case 15:return UE(e.type,!1);case 11:return UE(e.type.render,!1);case 1:return UE(e.type,!0);case 31:return Sc("Activity");default:return""}}function LC(e){try{var t="",n=null;do t+=IK(e,n),n=e,e=e.return;while(e);return t}catch(s){return` Error generating stack: `+s.message+` -`+s.stack}}var iS=Object.prototype.hasOwnProperty,XN=ri.unstable_scheduleCallback,PE=ri.unstable_cancelCallback,kK=ri.unstable_shouldYield,AK=ri.unstable_requestPaint,_r=ri.unstable_now,CK=ri.unstable_getCurrentPriorityLevel,XD=ri.unstable_ImmediatePriority,QD=ri.unstable_UserBlockingPriority,iy=ri.unstable_NormalPriority,IK=ri.unstable_LowPriority,ZD=ri.unstable_IdlePriority,jK=ri.log,RK=ri.unstable_setDisableYieldValue,Wm=null,Nr=null;function Tl(e){if(typeof jK=="function"&&RK(e),Nr&&typeof Nr.setStrictMode=="function")try{Nr.setStrictMode(Wm,e)}catch{}}var Tr=Math.clz32?Math.clz32:LK,OK=Math.log,MK=Math.LN2;function LK(e){return e>>>=0,e===0?32:31-(OK(e)/MK|0)|0}var u0=256,d0=262144,f0=4194304;function Sc(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ax(e,t,n){var s=e.pendingLanes;if(s===0)return 0;var i=0,r=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var l=s&134217727;return l!==0?(s=l&~r,s!==0?i=Sc(s):(a&=l,a!==0?i=Sc(a):n||(n=l&~e,n!==0&&(i=Sc(n))))):(l=s&~r,l!==0?i=Sc(l):a!==0?i=Sc(a):n||(n=s&~e,n!==0&&(i=Sc(n)))),i===0?0:t!==0&&t!==i&&!(t&r)&&(r=i&-i,n=t&-t,r>=n||r===32&&(n&4194048)!==0)?t:i}function Xm(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function DK(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function JD(){var e=f0;return f0<<=1,!(f0&62914560)&&(f0=4194304),e}function BE(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Qm(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function PK(e,t,n,s,i,r){var a=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var l=e.entanglements,c=e.expirationTimes,u=e.hiddenUpdates;for(n=a&~n;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var zK=/[\n"\\]/g;function Xr(e){return e.replace(zK,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function oS(e,t,n,s,i,r,a,l){e.name="",a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.type=a:e.removeAttribute("type"),t!=null?a==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Vr(t)):e.value!==""+Vr(t)&&(e.value=""+Vr(t)):a!=="submit"&&a!=="reset"||e.removeAttribute("value"),t!=null?lS(e,a,Vr(t)):n!=null?lS(e,a,Vr(n)):s!=null&&e.removeAttribute("value"),i==null&&r!=null&&(e.defaultChecked=!!r),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.name=""+Vr(l):e.removeAttribute("name")}function l5(e,t,n,s,i,r,a,l){if(r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(e.type=r),t!=null||n!=null){if(!(r!=="submit"&&r!=="reset"||t!=null)){aS(e);return}n=n!=null?""+Vr(n):"",t=t!=null?""+Vr(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}s=s??i,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=l?e.checked:!!s,e.defaultChecked=!!s,a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"&&(e.name=a),aS(e)}function lS(e,t,n){t==="number"&&ry(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function $d(e,t,n,s){if(e=e.options,t){t={};for(var i=0;i"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),uS=!1;if(zo)try{var jh={};Object.defineProperty(jh,"passive",{get:function(){uS=!0}}),window.addEventListener("test",jh,jh),window.removeEventListener("test",jh,jh)}catch{uS=!1}var kl=null,nT=null,pb=null;function h5(){if(pb)return pb;var e,t=nT,n=t.length,s,i="value"in kl?kl.value:kl.textContent,r=i.length;for(e=0;e=Ep),HC=" ",zC=!1;function m5(e,t){switch(e){case"keyup":return bq.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function g5(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var gd=!1;function xq(e,t){switch(e){case"compositionend":return g5(t);case"keypress":return t.which!==32?null:(zC=!0,HC);case"textInput":return e=t.data,e===HC&&zC?null:e;default:return null}}function Eq(e,t){if(gd)return e==="compositionend"||!iT&&m5(e,t)?(e=h5(),pb=nT=kl=null,gd=!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=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=YC(n)}}function E5(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?E5(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function v5(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ry(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ry(e.document)}return t}function rT(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")}var Aq=zo&&"documentMode"in document&&11>=document.documentMode,bd=null,dS=null,wp=null,fS=!1;function XC(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;fS||bd==null||bd!==ry(s)||(s=bd,"selectionStart"in s&&rT(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),wp&&im(wp,s)||(wp=s,s=Sy(dS,"onSelect"),0>=a,i-=a,Wa=1<<32-Tr(t)+i|n<T?(C=k,k=null):C=k.sibling;var I=h(y,k,E[T],w);if(I===null){k===null&&(k=C);break}e&&k&&I.alternate===null&&t(y,k),x=r(I,x,T),S===null?_=I:S.sibling=I,S=I,k=C}if(T===E.length)return n(y,k),Jt&&To(y,T),_;if(k===null){for(;TT?(C=k,k=null):C=k.sibling;var j=h(y,k,I.value,w);if(j===null){k===null&&(k=C);break}e&&k&&j.alternate===null&&t(y,k),x=r(j,x,T),S===null?_=j:S.sibling=j,S=j,k=C}if(I.done)return n(y,k),Jt&&To(y,T),_;if(k===null){for(;!I.done;T++,I=E.next())I=f(y,I.value,w),I!==null&&(x=r(I,x,T),S===null?_=I:S.sibling=I,S=I);return Jt&&To(y,T),_}for(k=s(k);!I.done;T++,I=E.next())I=p(k,y,T,I.value,w),I!==null&&(e&&I.alternate!==null&&k.delete(I.key===null?T:I.key),x=r(I,x,T),S===null?_=I:S.sibling=I,S=I);return e&&k.forEach(function(L){return t(y,L)}),Jt&&To(y,T),_}function v(y,x,E,w){if(typeof E=="object"&&E!==null&&E.type===fd&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case c0:e:{for(var _=E.key;x!==null;){if(x.key===_){if(_=E.type,_===fd){if(x.tag===7){n(y,x.sibling),w=i(x,E.props.children),w.return=y,y=w;break e}}else if(x.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===gl&&_c(_)===x.type){n(y,x.sibling),w=i(x,E.props),Oh(w,E),w.return=y,y=w;break e}n(y,x);break}else t(y,x);x=x.sibling}E.type===fd?(w=$c(E.props.children,y.mode,w,E.key),w.return=y,y=w):(w=gb(E.type,E.key,E.props,null,y.mode,w),Oh(w,E),w.return=y,y=w)}return a(y);case ep:e:{for(_=E.key;x!==null;){if(x.key===_)if(x.tag===4&&x.stateNode.containerInfo===E.containerInfo&&x.stateNode.implementation===E.implementation){n(y,x.sibling),w=i(x,E.children||[]),w.return=y,y=w;break e}else{n(y,x);break}else t(y,x);x=x.sibling}w=qE(E,y.mode,w),w.return=y,y=w}return a(y);case gl:return E=_c(E),v(y,x,E,w)}if(tp(E))return m(y,x,E,w);if(Ih(E)){if(_=Ih(E),typeof _!="function")throw Error(Ae(150));return E=_.call(E),b(y,x,E,w)}if(typeof E.then=="function")return v(y,x,g0(E),w);if(E.$$typeof===Co)return v(y,x,m0(y,E),w);b0(y,E)}return typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint"?(E=""+E,x!==null&&x.tag===6?(n(y,x.sibling),w=i(x,E),w.return=y,y=w):(n(y,x),w=KE(E,y.mode,w),w.return=y,y=w),a(y)):n(y,x)}return function(y,x,E,w){try{om=0;var _=v(y,x,E,w);return Vd=null,_}catch(k){if(k===Hf||k===Mx)throw k;var S=Er(29,k,null,y.mode);return S.lanes=w,S.return=y,S}finally{}}}var nu=D5(!0),P5=D5(!1),bl=!1;function pT(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function xS(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ll(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Dl(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,fn&2){var i=s.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),s.pending=t,t=oy(e),A5(e,null,n),t}return Ox(e,s,t,n),oy(e)}function _p(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,t5(e,n)}}function WE(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var i=null,r=null;if(n=n.firstBaseUpdate,n!==null){do{var a={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};r===null?i=r=a:r=r.next=a,n=n.next}while(n!==null);r===null?i=r=t:r=r.next=t}else i=r=t;n={baseState:s.baseState,firstBaseUpdate:i,lastBaseUpdate:r,shared:s.shared,callbacks:s.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var ES=!1;function Np(){if(ES){var e=zd;if(e!==null)throw e}}function Tp(e,t,n,s){ES=!1;var i=e.updateQueue;bl=!1;var r=i.firstBaseUpdate,a=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,a===null?r=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==a&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(r!==null){var f=i.baseState;a=0,d=u=c=null,l=r;do{var h=l.lane&-536870913,p=h!==l.lane;if(p?(Xt&h)===h:(s&h)===h){h!==0&&h===rf&&(ES=!0),d!==null&&(d=d.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var m=e,b=l;h=t;var v=n;switch(b.tag){case 1:if(m=b.payload,typeof m=="function"){f=m.call(v,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(v,f,h):m,h==null)break e;f=os({},f,h);break e;case 2:bl=!0}}h=l.callback,h!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[h]:p.push(h))}else p={lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,a|=h;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;p=l,l=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,r===null&&(i.shared.lanes=0),Yl|=a,e.lanes=a,e.memoizedState=f}}function B5(e,t){if(typeof e!="function")throw Error(Ae(191,e));e.call(t)}function U5(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;er?r:8;var a=Et.T,l={};Et.T=l,kT(e,!1,t,n);try{var c=i(),u=Et.S;if(u!==null&&u(l,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=Pq(c,s);kp(e,t,d,kr(e))}else kp(e,t,s,kr(e))}catch(f){kp(e,t,{then:function(){},status:"rejected",reason:f},kr())}finally{hn.p=r,a!==null&&l.types!==null&&(a.types=l.types),Et.T=a}}function zq(){}function NS(e,t,n,s){if(e.tag!==5)throw Error(Ae(476));var i=u4(e).queue;c4(e,i,t,Fc,n===null?zq:function(){return d4(e),n(s)})}function u4(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Fc,baseState:Fc,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Go,lastRenderedState:Fc},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Go,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function d4(e){var t=u4(e);t.next===null&&(t=e.alternate.memoizedState),kp(e,t.next.queue,{},kr())}function TT(){return Si(fm)}function f4(){return Fs().memoizedState}function h4(){return Fs().memoizedState}function Vq(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=kr();e=Ll(n);var s=Dl(t,e,n);s!==null&&(or(s,t,n),_p(s,t,n)),t={cache:dT()},e.payload=t;return}t=t.return}}function Gq(e,t,n){var s=kr();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Bx(e)?m4(t,n):(n=oT(e,t,n,s),n!==null&&(or(n,e,s),g4(n,t,s)))}function p4(e,t,n){var s=kr();kp(e,t,n,s)}function kp(e,t,n,s){var i={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Bx(e))m4(t,i);else{var r=e.alternate;if(e.lanes===0&&(r===null||r.lanes===0)&&(r=t.lastRenderedReducer,r!==null))try{var a=t.lastRenderedState,l=r(a,n);if(i.hasEagerState=!0,i.eagerState=l,Ir(l,a))return Ox(e,t,i,0),Fn===null&&Rx(),!1}catch{}finally{}if(n=oT(e,t,i,s),n!==null)return or(n,e,s),g4(n,t,s),!0}return!1}function kT(e,t,n,s){if(s={lane:2,revertLane:DT(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Bx(e)){if(t)throw Error(Ae(479))}else t=oT(e,n,s,2),t!==null&&or(t,e,2)}function Bx(e){var t=e.alternate;return e===Ot||t!==null&&t===Ot}function m4(e,t){Gd=hy=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function g4(e,t,n){if(n&4194048){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,t5(e,n)}}var cm={readContext:Si,use:Dx,useCallback:Cs,useContext:Cs,useEffect:Cs,useImperativeHandle:Cs,useLayoutEffect:Cs,useInsertionEffect:Cs,useMemo:Cs,useReducer:Cs,useRef:Cs,useState:Cs,useDebugValue:Cs,useDeferredValue:Cs,useTransition:Cs,useSyncExternalStore:Cs,useId:Cs,useHostTransitionStatus:Cs,useFormState:Cs,useActionState:Cs,useOptimistic:Cs,useMemoCache:Cs,useCacheRefresh:Cs};cm.useEffectEvent=Cs;var b4={readContext:Si,use:Dx,useCallback:function(e,t){return Hi().memoizedState=[e,t===void 0?null:t],e},useContext:Si,useEffect:dI,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,xb(4194308,4,i4.bind(null,t,e),n)},useLayoutEffect:function(e,t){return xb(4194308,4,e,t)},useInsertionEffect:function(e,t){xb(4,2,e,t)},useMemo:function(e,t){var n=Hi();t=t===void 0?null:t;var s=e();if(su){Tl(!0);try{e()}finally{Tl(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=Hi();if(n!==void 0){var i=n(t);if(su){Tl(!0);try{n(t)}finally{Tl(!1)}}}else i=t;return s.memoizedState=s.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},s.queue=e,e=e.dispatch=Gq.bind(null,Ot,e),[s.memoizedState,e]},useRef:function(e){var t=Hi();return e={current:e},t.memoizedState=e},useState:function(e){e=SS(e);var t=e.queue,n=p4.bind(null,Ot,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:_T,useDeferredValue:function(e,t){var n=Hi();return NT(n,e,t)},useTransition:function(){var e=SS(!1);return e=c4.bind(null,Ot,e.queue,!0,!1),Hi().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=Ot,i=Hi();if(Jt){if(n===void 0)throw Error(Ae(407));n=n()}else{if(n=t(),Fn===null)throw Error(Ae(349));Xt&127||V5(s,t,n)}i.memoizedState=n;var r={value:n,getSnapshot:t};return i.queue=r,dI(K5.bind(null,s,r,e),[e]),s.flags|=2048,of(9,{destroy:void 0},G5.bind(null,s,r,n,t),null),n},useId:function(){var e=Hi(),t=Fn.identifierPrefix;if(Jt){var n=Xa,s=Wa;n=(s&~(1<<32-Tr(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=py++,0<\/script>",r=r.removeChild(r.firstChild);break;case"select":r=typeof s.is=="string"?a.createElement("select",{is:s.is}):a.createElement("select"),s.multiple?r.multiple=!0:s.size&&(r.size=s.size);break;default:r=typeof s.is=="string"?a.createElement(i,{is:s.is}):a.createElement(i)}}r[Ei]=t,r[ur]=s;e:for(a=t.child;a!==null;){if(a.tag===5||a.tag===6)r.appendChild(a.stateNode);else if(a.tag!==4&&a.tag!==27&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}t.stateNode=r;e:switch(Ni(r,i,s),i){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&bo(t)}}return es(t),sv(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&bo(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(Ae(166));if(e=Ol.current,Hu(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,i=vi,i!==null)switch(i.tag){case 27:case 5:s=i.memoizedProps}e[Ei]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||p6(e.nodeValue,n)),e||Kl(t,!0)}else e=_y(e).createTextNode(s),e[Ei]=t,t.stateNode=e}return es(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=Hu(t),n!==null){if(e===null){if(!s)throw Error(Ae(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Ae(557));e[Ei]=t}else eu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;es(t),e=!1}else n=YE(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(xr(t),t):(xr(t),null);if(t.flags&128)throw Error(Ae(558))}return es(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Hu(t),s!==null&&s.dehydrated!==null){if(e===null){if(!i)throw Error(Ae(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Ae(317));i[Ei]=t}else eu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;es(t),i=!1}else i=YE(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(xr(t),t):(xr(t),null)}return xr(t),t.flags&128?(t.lanes=n,t):(n=s!==null,e=e!==null&&e.memoizedState!==null,n&&(s=t.child,i=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(i=s.alternate.memoizedState.cachePool.pool),r=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==i&&(s.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),y0(t,t.updateQueue),es(t),null);case 4:return tf(),e===null&&PT(t.stateNode.containerInfo),es(t),null;case 10:return Do(t.type),es(t),null;case 19:if(fi(Ps),s=t.memoizedState,s===null)return es(t),null;if(i=(t.flags&128)!==0,r=s.rendering,r===null)if(i)Mh(s,!1);else{if(js!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(r=fy(e),r!==null){for(t.flags|=128,Mh(s,!1),e=r.updateQueue,t.updateQueue=e,y0(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)C5(n,e),n=n.sibling;return qn(Ps,Ps.current&1|2),Jt&&To(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&_r()>yy&&(t.flags|=128,i=!0,Mh(s,!1),t.lanes=4194304)}else{if(!i)if(e=fy(r),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,y0(t,e),Mh(s,!0),s.tail===null&&s.tailMode==="hidden"&&!r.alternate&&!Jt)return es(t),null}else 2*_r()-s.renderingStartTime>yy&&n!==536870912&&(t.flags|=128,i=!0,Mh(s,!1),t.lanes=4194304);s.isBackwards?(r.sibling=t.child,t.child=r):(e=s.last,e!==null?e.sibling=r:t.child=r,s.last=r)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=_r(),e.sibling=null,n=Ps.current,qn(Ps,i?n&1|2:n&1),Jt&&To(t,s.treeForkCount),e):(es(t),null);case 22:case 23:return xr(t),mT(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?n&536870912&&!(t.flags&128)&&(es(t),t.subtreeFlags&6&&(t.flags|=8192)):es(t),n=t.updateQueue,n!==null&&y0(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==n&&(t.flags|=2048),e!==null&&fi(Hc),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Do(Ws),es(t),null;case 25:return null;case 30:return null}throw Error(Ae(156,t.tag))}function Xq(e,t){switch(uT(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Do(Ws),tf(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return sy(t),null;case 31:if(t.memoizedState!==null){if(xr(t),t.alternate===null)throw Error(Ae(340));eu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(xr(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ae(340));eu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return fi(Ps),null;case 4:return tf(),null;case 10:return Do(t.type),null;case 22:case 23:return xr(t),mT(),e!==null&&fi(Hc),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Do(Ws),null;case 25:return null;default:return null}}function C4(e,t){switch(uT(t),t.tag){case 3:Do(Ws),tf();break;case 26:case 27:case 5:sy(t);break;case 4:tf();break;case 31:t.memoizedState!==null&&xr(t);break;case 13:xr(t);break;case 19:fi(Ps);break;case 10:Do(t.type);break;case 22:case 23:xr(t),mT(),e!==null&&fi(Hc);break;case 24:Do(Ws)}}function ng(e,t){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var i=s.next;n=i;do{if((n.tag&e)===e){s=void 0;var r=n.create,a=n.inst;s=r(),a.destroy=s}n=n.next}while(n!==i)}}catch(l){Nn(t,t.return,l)}}function ql(e,t,n){try{var s=t.updateQueue,i=s!==null?s.lastEffect:null;if(i!==null){var r=i.next;s=r;do{if((s.tag&e)===e){var a=s.inst,l=a.destroy;if(l!==void 0){a.destroy=void 0,i=t;var c=n,u=l;try{u()}catch(d){Nn(i,c,d)}}}s=s.next}while(s!==r)}}catch(d){Nn(t,t.return,d)}}function I4(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{U5(t,n)}catch(s){Nn(e,e.return,s)}}}function j4(e,t,n){n.props=iu(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){Nn(e,t,s)}}function Ap(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof n=="function"?e.refCleanup=n(s):n.current=s}}catch(i){Nn(e,t,i)}}function Qa(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(i){Nn(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(i){Nn(e,t,i)}else n.current=null}function R4(e){var t=e.type,n=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&s.focus();break e;case"img":n.src?s.src=n.src:n.srcSet&&(s.srcset=n.srcSet)}}catch(i){Nn(e,e.return,i)}}function iv(e,t,n){try{var s=e.stateNode;yY(s,e.type,n,t),s[ur]=t}catch(i){Nn(e,e.return,i)}}function O4(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&nc(e.type)||e.tag===4}function rv(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||O4(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.tag===27&&nc(e.type)||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 IS(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Io));else if(s!==4&&(s===27&&nc(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(IS(e,t,n),e=e.sibling;e!==null;)IS(e,t,n),e=e.sibling}function by(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(s===27&&nc(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(by(e,t,n),e=e.sibling;e!==null;)by(e,t,n),e=e.sibling}function M4(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Ni(t,s,n),t[Ei]=e,t[ur]=n}catch(r){Nn(e,e.return,r)}}var ko=!1,Ys=!1,av=!1,_I=typeof WeakSet=="function"?WeakSet:Set,li=null;function Qq(e,t){if(e=e.containerInfo,PS=Ay,e=v5(e),rT(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var i=s.anchorOffset,r=s.focusNode;s=s.focusOffset;try{n.nodeType,r.nodeType}catch{n=null;break e}var a=0,l=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||i!==0&&f.nodeType!==3||(l=a+i),f!==r||s!==0&&f.nodeType!==3||(c=a+s),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&&(l=a),h===r&&++d===s&&(c=a),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(BS={focusedElem:e,selectionRange:n},Ay=!1,li=t;li!==null;)if(t=li,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,li=e;else for(;li!==null;){switch(t=li,r=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n title"))),Ni(r,s,n),r[Ei]=e,ci(r),s=r;break e;case"link":var a=VI("link","href",i).get(s+(n.href||""));if(a){for(var l=0;lv&&(a=v,v=b,b=a);var y=WC(l,b),x=WC(l,v);if(y&&x&&(p.rangeCount!==1||p.anchorNode!==y.node||p.anchorOffset!==y.offset||p.focusNode!==x.node||p.focusOffset!==x.offset)){var E=f.createRange();E.setStart(y.node,y.offset),p.removeAllRanges(),b>v?(p.addRange(E),p.extend(x.node,x.offset)):(E.setEnd(x.node,x.offset),p.addRange(E))}}}}for(f=[],p=l;p=p.parentNode;)p.nodeType===1&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;ln?32:n,Et.T=null,n=OS,OS=null;var r=Bl,a=Po;if(ii=0,cf=Bl=null,Po=0,fn&6)throw Error(Ae(331));var l=fn;if(fn|=4,G4(r.current),H4(r,r.current,a,n),fn=l,sg(0,!1),Nr&&typeof Nr.onPostCommitFiberRoot=="function")try{Nr.onPostCommitFiberRoot(Wm,r)}catch{}return!0}finally{hn.p=i,Et.T=s,a6(e,t)}}function AI(e,t,n){t=Qr(n,t),t=kS(e.stateNode,t,2),e=Dl(e,t,2),e!==null&&(Qm(e,2),ao(e))}function Nn(e,t,n){if(e.tag===3)AI(e,e,n);else for(;t!==null;){if(t.tag===3){AI(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Pl===null||!Pl.has(s))){e=Qr(n,e),n=w4(2),s=Dl(t,n,2),s!==null&&(S4(n,s,t,e),Qm(s,2),ao(s));break}}t=t.return}}function lv(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new eY;var i=new Set;s.set(t,i)}else i=s.get(t),i===void 0&&(i=new Set,s.set(t,i));i.has(n)||(OT=!0,i.add(n),e=rY.bind(null,e,t,n),t.then(e,e))}function rY(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Fn===e&&(Xt&n)===n&&(js===4||js===3&&(Xt&62914560)===Xt&&300>_r()-Ux?!(fn&2)&&uf(e,0):MT|=n,lf===Xt&&(lf=0)),ao(e)}function l6(e,t){t===0&&(t=JD()),e=Eu(e,t),e!==null&&(Qm(e,t),ao(e))}function aY(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),l6(e,n)}function oY(e,t){var n=0;switch(e.tag){case 31:case 13:var s=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(Ae(314))}s!==null&&s.delete(t),l6(e,n)}function lY(e,t){return XN(e,t)}var vy=null,id=null,LS=!1,wy=!1,cv=!1,Il=0;function ao(e){e!==id&&e.next===null&&(id===null?vy=id=e:id=id.next=e),wy=!0,LS||(LS=!0,uY())}function sg(e,t){if(!cv&&wy){cv=!0;do for(var n=!1,s=vy;s!==null;){if(e!==0){var i=s.pendingLanes;if(i===0)var r=0;else{var a=s.suspendedLanes,l=s.pingedLanes;r=(1<<31-Tr(42|e)+1)-1,r&=i&~(a&~l),r=r&201326741?r&201326741|1:r?r|2:0}r!==0&&(n=!0,CI(s,r))}else r=Xt,r=Ax(s,s===Fn?r:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),!(r&3)||Xm(s,r)||(n=!0,CI(s,r));s=s.next}while(n);cv=!1}}function cY(){c6()}function c6(){wy=LS=!1;var e=0;Il!==0&&EY()&&(e=Il);for(var t=_r(),n=null,s=vy;s!==null;){var i=s.next,r=u6(s,t);r===0?(s.next=null,n===null?vy=i:n.next=i,i===null&&(id=n)):(n=s,(e!==0||r&3)&&(wy=!0)),s=i}ii!==0&&ii!==5||sg(e),Il!==0&&(Il=0)}function u6(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,i=e.expirationTimes,r=e.pendingLanes&-62914561;0l)break;var d=c.transferSize,f=c.initiatorType;d&&MI(f)&&(c=c.responseEnd,a+=d*(c"u"?null:document;function x6(e,t,n){var s=Vf;if(s&&typeof t=="string"&&t){var i=Xr(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),$I.has(i)||($I.add(i),e={rel:e,crossOrigin:n,href:t},s.querySelector(i)===null&&(t=s.createElement("link"),Ni(t,"link",e),ci(t),s.head.appendChild(t)))}}function CY(e){Zo.D(e),x6("dns-prefetch",e,null)}function IY(e,t){Zo.C(e,t),x6("preconnect",e,t)}function jY(e,t,n){Zo.L(e,t,n);var s=Vf;if(s&&e&&t){var i='link[rel="preload"][as="'+Xr(t)+'"]';t==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+Xr(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+Xr(n.imageSizes)+'"]')):i+='[href="'+Xr(e)+'"]';var r=i;switch(t){case"style":r=df(e);break;case"script":r=Gf(e)}ia.has(r)||(e=os({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ia.set(r,e),s.querySelector(i)!==null||t==="style"&&s.querySelector(ig(r))||t==="script"&&s.querySelector(rg(r))||(t=s.createElement("link"),Ni(t,"link",e),ci(t),s.head.appendChild(t)))}}function RY(e,t){Zo.m(e,t);var n=Vf;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+Xr(s)+'"][href="'+Xr(e)+'"]',r=i;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=Gf(e)}if(!ia.has(r)&&(e=os({rel:"modulepreload",href:e},t),ia.set(r,e),n.querySelector(i)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(rg(r)))return}s=n.createElement("link"),Ni(s,"link",e),ci(s),n.head.appendChild(s)}}}function OY(e,t,n){Zo.S(e,t,n);var s=Vf;if(s&&e){var i=Fd(s).hoistableStyles,r=df(e);t=t||"default";var a=i.get(r);if(!a){var l={loading:0,preload:null};if(a=s.querySelector(ig(r)))l.loading=5;else{e=os({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ia.get(r))&&BT(e,n);var c=a=s.createElement("link");ci(c),Ni(c,"link",e),c._p=new Promise(function(u,d){c.onload=u,c.onerror=d}),c.addEventListener("load",function(){l.loading|=1}),c.addEventListener("error",function(){l.loading|=2}),l.loading|=4,Sb(a,t,s)}a={type:"stylesheet",instance:a,count:1,state:l},i.set(r,a)}}}function MY(e,t){Zo.X(e,t);var n=Vf;if(n&&e){var s=Fd(n).hoistableScripts,i=Gf(e),r=s.get(i);r||(r=n.querySelector(rg(i)),r||(e=os({src:e,async:!0},t),(t=ia.get(i))&&UT(e,t),r=n.createElement("script"),ci(r),Ni(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},s.set(i,r))}}function LY(e,t){Zo.M(e,t);var n=Vf;if(n&&e){var s=Fd(n).hoistableScripts,i=Gf(e),r=s.get(i);r||(r=n.querySelector(rg(i)),r||(e=os({src:e,async:!0,type:"module"},t),(t=ia.get(i))&&UT(e,t),r=n.createElement("script"),ci(r),Ni(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},s.set(i,r))}}function HI(e,t,n,s){var i=(i=Ol.current)?Ny(i):null;if(!i)throw Error(Ae(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=df(n.href),n=Fd(i).hoistableStyles,s=n.get(t),s||(s={type:"style",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=df(n.href);var r=Fd(i).hoistableStyles,a=r.get(e);if(a||(i=i.ownerDocument||i,a={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},r.set(e,a),(r=i.querySelector(ig(e)))&&!r._p&&(a.instance=r,a.state.loading=5),ia.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ia.set(e,n),r||DY(i,e,n,a.state))),t&&s===null)throw Error(Ae(528,""));return a}if(t&&s!==null)throw Error(Ae(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Gf(n),n=Fd(i).hoistableScripts,s=n.get(t),s||(s={type:"script",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(Ae(444,e))}}function df(e){return'href="'+Xr(e)+'"'}function ig(e){return'link[rel="stylesheet"]['+e+"]"}function E6(e){return os({},e,{"data-precedence":e.precedence,precedence:null})}function DY(e,t,n,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),Ni(t,"link",n),ci(t),e.head.appendChild(t))}function Gf(e){return'[src="'+Xr(e)+'"]'}function rg(e){return"script[async]"+e}function zI(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Xr(n.href)+'"]');if(s)return t.instance=s,ci(s),s;var i=os({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),ci(s),Ni(s,"style",i),Sb(s,n.precedence,e),t.instance=s;case"stylesheet":i=df(n.href);var r=e.querySelector(ig(i));if(r)return t.state.loading|=4,t.instance=r,ci(r),r;s=E6(n),(i=ia.get(i))&&BT(s,i),r=(e.ownerDocument||e).createElement("link"),ci(r);var a=r;return a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),Ni(r,"link",s),t.state.loading|=4,Sb(r,n.precedence,e),t.instance=r;case"script":return r=Gf(n.src),(i=e.querySelector(rg(r)))?(t.instance=i,ci(i),i):(s=n,(i=ia.get(r))&&(s=os({},n),UT(s,i)),e=e.ownerDocument||e,i=e.createElement("script"),ci(i),Ni(i,"link",s),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(Ae(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(s=t.instance,t.state.loading|=4,Sb(s,n.precedence,e));return t.instance}function Sb(e,t,n){for(var s=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=s.length?s[s.length-1]:null,r=i,a=0;a title"):null)}function PY(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function v6(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function BY(e,t,n,s){if(n.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var i=df(s.href),r=t.querySelector(ig(i));if(r){t=r._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ty.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=r,ci(r);return}r=t.ownerDocument||t,s=E6(s),(i=ia.get(i))&&BT(s,i),r=r.createElement("link"),ci(r);var a=r;a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),Ni(r,"link",s),n.instance=r}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Ty.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var mv=0;function UY(e,t){return e.stylesheets&&e.count===0&&Nb(e,e.stylesheets),0mv?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(i)}}:null}function Ty(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Nb(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ky=null;function Nb(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ky=new Map,t.forEach(FY,e),ky=null,Ty.call(e))}function FY(e,t){if(!(t.state.loading&4)){var n=ky.get(e);if(n)var s=n.get(null);else{n=new Map,ky.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),r=0;r"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(C6)}catch(e){console.error(e)}}C6(),PD.exports=Tx;var YY=PD.exports;const WY=Df(YY),VT=g.createContext({});function Vx(e){const t=g.useRef(null);return t.current===null&&(t.current=e()),t.current}const Gx=g.createContext(null),mm=g.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class XY extends g.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const s=this.props.sizeRef.current;s.height=n.offsetHeight||0,s.width=n.offsetWidth||0,s.top=n.offsetTop,s.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function QY({children:e,isPresent:t}){const n=g.useId(),s=g.useRef(null),i=g.useRef({width:0,height:0,top:0,left:0}),{nonce:r}=g.useContext(mm);return g.useInsertionEffect(()=>{const{width:a,height:l,top:c,left:u}=i.current;if(t||!s.current||!a||!l)return;s.current.dataset.motionPopId=n;const d=document.createElement("style");return r&&(d.nonce=r),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` +`+s.stack}}var lS=Object.prototype.hasOwnProperty,eT=ai.unstable_scheduleCallback,FE=ai.unstable_cancelCallback,jK=ai.unstable_shouldYield,RK=ai.unstable_requestPaint,_r=ai.unstable_now,OK=ai.unstable_getCurrentPriorityLevel,e5=ai.unstable_ImmediatePriority,t5=ai.unstable_UserBlockingPriority,ay=ai.unstable_NormalPriority,MK=ai.unstable_LowPriority,n5=ai.unstable_IdlePriority,LK=ai.log,DK=ai.unstable_setDisableYieldValue,Ym=null,Nr=null;function jl(e){if(typeof LK=="function"&&DK(e),Nr&&typeof Nr.setStrictMode=="function")try{Nr.setStrictMode(Ym,e)}catch{}}var Tr=Math.clz32?Math.clz32:UK,PK=Math.log,BK=Math.LN2;function UK(e){return e>>>=0,e===0?32:31-(PK(e)/BK|0)|0}var f0=256,h0=262144,p0=4194304;function _c(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ix(e,t,n){var s=e.pendingLanes;if(s===0)return 0;var i=0,r=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var l=s&134217727;return l!==0?(s=l&~r,s!==0?i=_c(s):(a&=l,a!==0?i=_c(a):n||(n=l&~e,n!==0&&(i=_c(n))))):(l=s&~r,l!==0?i=_c(l):a!==0?i=_c(a):n||(n=s&~e,n!==0&&(i=_c(n)))),i===0?0:t!==0&&t!==i&&!(t&r)&&(r=i&-i,n=t&-t,r>=n||r===32&&(n&4194048)!==0)?t:i}function Wm(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function FK(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function s5(){var e=p0;return p0<<=1,!(p0&62914560)&&(p0=4194304),e}function $E(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Xm(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function $K(e,t,n,s,i,r){var a=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var l=e.entanglements,c=e.expirationTimes,u=e.hiddenUpdates;for(n=a&~n;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var qK=/[\n"\\]/g;function qr(e){return e.replace(qK,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function dS(e,t,n,s,i,r,a,l){e.name="",a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.type=a:e.removeAttribute("type"),t!=null?a==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+$r(t)):e.value!==""+$r(t)&&(e.value=""+$r(t)):a!=="submit"&&a!=="reset"||e.removeAttribute("value"),t!=null?fS(e,a,$r(t)):n!=null?fS(e,a,$r(n)):s!=null&&e.removeAttribute("value"),i==null&&r!=null&&(e.defaultChecked=!!r),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.name=""+$r(l):e.removeAttribute("name")}function f5(e,t,n,s,i,r,a,l){if(r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(e.type=r),t!=null||n!=null){if(!(r!=="submit"&&r!=="reset"||t!=null)){uS(e);return}n=n!=null?""+$r(n):"",t=t!=null?""+$r(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}s=s??i,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=l?e.checked:!!s,e.defaultChecked=!!s,a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"&&(e.name=a),uS(e)}function fS(e,t,n){t==="number"&&oy(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function zd(e,t,n,s){if(e=e.options,t){t={};for(var i=0;i"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),pS=!1;if(Yo)try{var Ih={};Object.defineProperty(Ih,"passive",{get:function(){pS=!0}}),window.addEventListener("test",Ih,Ih),window.removeEventListener("test",Ih,Ih)}catch{pS=!1}var Rl=null,aT=null,gb=null;function b5(){if(gb)return gb;var e,t=aT,n=t.length,s,i="value"in Rl?Rl.value:Rl.textContent,r=i.length;for(e=0;e=xp),KC=" ",qC=!1;function x5(e,t){switch(e){case"keyup":return vq.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function E5(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var yd=!1;function Sq(e,t){switch(e){case"compositionend":return E5(t);case"keypress":return t.which!==32?null:(qC=!0,KC);case"textInput":return e=t.data,e===KC&&qC?null:e;default:return null}}function _q(e,t){if(yd)return e==="compositionend"||!lT&&x5(e,t)?(e=b5(),gb=aT=Rl=null,yd=!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=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ZC(n)}}function _5(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_5(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function N5(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=oy(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=oy(e.document)}return t}function cT(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")}var Rq=Yo&&"documentMode"in document&&11>=document.documentMode,xd=null,mS=null,vp=null,gS=!1;function eI(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;gS||xd==null||xd!==oy(s)||(s=xd,"selectionStart"in s&&cT(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),vp&&sm(vp,s)||(vp=s,s=Ny(mS,"onSelect"),0>=a,i-=a,Wa=1<<32-Tr(t)+i|n<T?(C=k,k=null):C=k.sibling;var I=h(y,k,E[T],w);if(I===null){k===null&&(k=C);break}e&&k&&I.alternate===null&&t(y,k),x=r(I,x,T),S===null?_=I:S.sibling=I,S=I,k=C}if(T===E.length)return n(y,k),tn&&jo(y,T),_;if(k===null){for(;TT?(C=k,k=null):C=k.sibling;var j=h(y,k,I.value,w);if(j===null){k===null&&(k=C);break}e&&k&&j.alternate===null&&t(y,k),x=r(j,x,T),S===null?_=j:S.sibling=j,S=j,k=C}if(I.done)return n(y,k),tn&&jo(y,T),_;if(k===null){for(;!I.done;T++,I=E.next())I=f(y,I.value,w),I!==null&&(x=r(I,x,T),S===null?_=I:S.sibling=I,S=I);return tn&&jo(y,T),_}for(k=s(k);!I.done;T++,I=E.next())I=p(k,y,T,I.value,w),I!==null&&(e&&I.alternate!==null&&k.delete(I.key===null?T:I.key),x=r(I,x,T),S===null?_=I:S.sibling=I,S=I);return e&&k.forEach(function(L){return t(y,L)}),tn&&jo(y,T),_}function v(y,x,E,w){if(typeof E=="object"&&E!==null&&E.type===pd&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case d0:e:{for(var _=E.key;x!==null;){if(x.key===_){if(_=E.type,_===pd){if(x.tag===7){n(y,x.sibling),w=i(x,E.props.children),w.return=y,y=w;break e}}else if(x.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===vl&&Nc(_)===x.type){n(y,x.sibling),w=i(x,E.props),Rh(w,E),w.return=y,y=w;break e}n(y,x);break}else t(y,x);x=x.sibling}E.type===pd?(w=Hc(E.props.children,y.mode,w,E.key),w.return=y,y=w):(w=yb(E.type,E.key,E.props,null,y.mode,w),Rh(w,E),w.return=y,y=w)}return a(y);case Jh:e:{for(_=E.key;x!==null;){if(x.key===_)if(x.tag===4&&x.stateNode.containerInfo===E.containerInfo&&x.stateNode.implementation===E.implementation){n(y,x.sibling),w=i(x,E.children||[]),w.return=y,y=w;break e}else{n(y,x);break}else t(y,x);x=x.sibling}w=XE(E,y.mode,w),w.return=y,y=w}return a(y);case vl:return E=Nc(E),v(y,x,E,w)}if(ep(E))return m(y,x,E,w);if(Ch(E)){if(_=Ch(E),typeof _!="function")throw Error(ke(150));return E=_.call(E),b(y,x,E,w)}if(typeof E.then=="function")return v(y,x,y0(E),w);if(E.$$typeof===Mo)return v(y,x,b0(y,E),w);x0(y,E)}return typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint"?(E=""+E,x!==null&&x.tag===6?(n(y,x.sibling),w=i(x,E),w.return=y,y=w):(n(y,x),w=WE(E,y.mode,w),w.return=y,y=w),a(y)):n(y,x)}return function(y,x,E,w){try{am=0;var _=v(y,x,E,w);return Kd=null,_}catch(k){if(k===Vf||k===Dx)throw k;var S=Er(29,k,null,y.mode);return S.lanes=w,S.return=y,S}finally{}}}var su=F5(!0),$5=F5(!1),wl=!1;function yT(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function SS(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Fl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function $l(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,on&2){var i=s.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),s.pending=t,t=cy(e),R5(e,null,n),t}return Lx(e,s,t,n),cy(e)}function Sp(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,r5(e,n)}}function ZE(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var i=null,r=null;if(n=n.firstBaseUpdate,n!==null){do{var a={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};r===null?i=r=a:r=r.next=a,n=n.next}while(n!==null);r===null?i=r=t:r=r.next=t}else i=r=t;n={baseState:s.baseState,firstBaseUpdate:i,lastBaseUpdate:r,shared:s.shared,callbacks:s.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var _S=!1;function _p(){if(_S){var e=Gd;if(e!==null)throw e}}function Np(e,t,n,s){_S=!1;var i=e.updateQueue;wl=!1;var r=i.firstBaseUpdate,a=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,a===null?r=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==a&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(r!==null){var f=i.baseState;a=0,d=u=c=null,l=r;do{var h=l.lane&-536870913,p=h!==l.lane;if(p?(Jt&h)===h:(s&h)===h){h!==0&&h===of&&(_S=!0),d!==null&&(d=d.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var m=e,b=l;h=t;var v=n;switch(b.tag){case 1:if(m=b.payload,typeof m=="function"){f=m.call(v,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(v,f,h):m,h==null)break e;f=ns({},f,h);break e;case 2:wl=!0}}h=l.callback,h!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[h]:p.push(h))}else p={lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,a|=h;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;p=l,l=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,r===null&&(i.shared.lanes=0),Jl|=a,e.lanes=a,e.memoizedState=f}}function H5(e,t){if(typeof e!="function")throw Error(ke(191,e));e.call(t)}function z5(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;er?r:8;var a=St.T,l={};St.T=l,jT(e,!1,t,n);try{var c=i(),u=St.S;if(u!==null&&u(l,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=$q(c,s);Tp(e,t,d,kr(e))}else Tp(e,t,s,kr(e))}catch(f){Tp(e,t,{then:function(){},status:"rejected",reason:f},kr())}finally{ln.p=r,a!==null&&l.types!==null&&(a.types=l.types),St.T=a}}function qq(){}function CS(e,t,n,s){if(e.tag!==5)throw Error(ke(476));var i=p4(e).queue;h4(e,i,t,$c,n===null?qq:function(){return m4(e),n(s)})}function p4(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:$c,baseState:$c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xo,lastRenderedState:$c},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function m4(e){var t=p4(e);t.next===null&&(t=e.alternate.memoizedState),Tp(e,t.next.queue,{},kr())}function IT(){return Si(dm)}function g4(){return Bs().memoizedState}function b4(){return Bs().memoizedState}function Yq(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=kr();e=Fl(n);var s=$l(t,e,n);s!==null&&(ar(s,t,n),Sp(s,t,n)),t={cache:mT()},e.payload=t;return}t=t.return}}function Wq(e,t,n){var s=kr();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Fx(e)?x4(t,n):(n=dT(e,t,n,s),n!==null&&(ar(n,e,s),E4(n,t,s)))}function y4(e,t,n){var s=kr();Tp(e,t,n,s)}function Tp(e,t,n,s){var i={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Fx(e))x4(t,i);else{var r=e.alternate;if(e.lanes===0&&(r===null||r.lanes===0)&&(r=t.lastRenderedReducer,r!==null))try{var a=t.lastRenderedState,l=r(a,n);if(i.hasEagerState=!0,i.eagerState=l,Ir(l,a))return Lx(e,t,i,0),Bn===null&&Mx(),!1}catch{}finally{}if(n=dT(e,t,i,s),n!==null)return ar(n,e,s),E4(n,t,s),!0}return!1}function jT(e,t,n,s){if(s={lane:2,revertLane:FT(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Fx(e)){if(t)throw Error(ke(479))}else t=dT(e,n,s,2),t!==null&&ar(t,e,2)}function Fx(e){var t=e.alternate;return e===Dt||t!==null&&t===Dt}function x4(e,t){qd=my=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function E4(e,t,n){if(n&4194048){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,r5(e,n)}}var lm={readContext:Si,use:Bx,useCallback:As,useContext:As,useEffect:As,useImperativeHandle:As,useLayoutEffect:As,useInsertionEffect:As,useMemo:As,useReducer:As,useRef:As,useState:As,useDebugValue:As,useDeferredValue:As,useTransition:As,useSyncExternalStore:As,useId:As,useHostTransitionStatus:As,useFormState:As,useActionState:As,useOptimistic:As,useMemoCache:As,useCacheRefresh:As};lm.useEffectEvent=As;var v4={readContext:Si,use:Bx,useCallback:function(e,t){return $i().memoizedState=[e,t===void 0?null:t],e},useContext:Si,useEffect:mI,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,vb(4194308,4,l4.bind(null,t,e),n)},useLayoutEffect:function(e,t){return vb(4194308,4,e,t)},useInsertionEffect:function(e,t){vb(4,2,e,t)},useMemo:function(e,t){var n=$i();t=t===void 0?null:t;var s=e();if(iu){jl(!0);try{e()}finally{jl(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=$i();if(n!==void 0){var i=n(t);if(iu){jl(!0);try{n(t)}finally{jl(!1)}}}else i=t;return s.memoizedState=s.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},s.queue=e,e=e.dispatch=Wq.bind(null,Dt,e),[s.memoizedState,e]},useRef:function(e){var t=$i();return e={current:e},t.memoizedState=e},useState:function(e){e=kS(e);var t=e.queue,n=y4.bind(null,Dt,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:AT,useDeferredValue:function(e,t){var n=$i();return CT(n,e,t)},useTransition:function(){var e=kS(!1);return e=h4.bind(null,Dt,e.queue,!0,!1),$i().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=Dt,i=$i();if(tn){if(n===void 0)throw Error(ke(407));n=n()}else{if(n=t(),Bn===null)throw Error(ke(349));Jt&127||Y5(s,t,n)}i.memoizedState=n;var r={value:n,getSnapshot:t};return i.queue=r,mI(X5.bind(null,s,r,e),[e]),s.flags|=2048,cf(9,{destroy:void 0},W5.bind(null,s,r,n,t),null),n},useId:function(){var e=$i(),t=Bn.identifierPrefix;if(tn){var n=Xa,s=Wa;n=(s&~(1<<32-Tr(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=gy++,0<\/script>",r=r.removeChild(r.firstChild);break;case"select":r=typeof s.is=="string"?a.createElement("select",{is:s.is}):a.createElement("select"),s.multiple?r.multiple=!0:s.size&&(r.size=s.size);break;default:r=typeof s.is=="string"?a.createElement(i,{is:s.is}):a.createElement(i)}}r[Ei]=t,r[cr]=s;e:for(a=t.child;a!==null;){if(a.tag===5||a.tag===6)r.appendChild(a.stateNode);else if(a.tag!==4&&a.tag!==27&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}t.stateNode=r;e:switch(Ni(r,i,s),i){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&So(t)}}return Wn(t),av(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&So(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(ke(166));if(e=Bl.current,Vu(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,i=vi,i!==null)switch(i.tag){case 27:case 5:s=i.memoizedProps}e[Ei]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||y6(e.nodeValue,n)),e||Ql(t,!0)}else e=Ty(e).createTextNode(s),e[Ei]=t,t.stateNode=e}return Wn(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=Vu(t),n!==null){if(e===null){if(!s)throw Error(ke(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ke(557));e[Ei]=t}else tu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Wn(t),e=!1}else n=QE(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(xr(t),t):(xr(t),null);if(t.flags&128)throw Error(ke(558))}return Wn(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Vu(t),s!==null&&s.dehydrated!==null){if(e===null){if(!i)throw Error(ke(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ke(317));i[Ei]=t}else tu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Wn(t),i=!1}else i=QE(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(xr(t),t):(xr(t),null)}return xr(t),t.flags&128?(t.lanes=n,t):(n=s!==null,e=e!==null&&e.memoizedState!==null,n&&(s=t.child,i=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(i=s.alternate.memoizedState.cachePool.pool),r=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==i&&(s.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),E0(t,t.updateQueue),Wn(t),null);case 4:return sf(),e===null&&$T(t.stateNode.containerInfo),Wn(t),null;case 10:return $o(t.type),Wn(t),null;case 19:if(fi(Ls),s=t.memoizedState,s===null)return Wn(t),null;if(i=(t.flags&128)!==0,r=s.rendering,r===null)if(i)Oh(s,!1);else{if(Is!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(r=py(e),r!==null){for(t.flags|=128,Oh(s,!1),e=r.updateQueue,t.updateQueue=e,E0(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)O5(n,e),n=n.sibling;return Vn(Ls,Ls.current&1|2),tn&&jo(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&_r()>Ey&&(t.flags|=128,i=!0,Oh(s,!1),t.lanes=4194304)}else{if(!i)if(e=py(r),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,E0(t,e),Oh(s,!0),s.tail===null&&s.tailMode==="hidden"&&!r.alternate&&!tn)return Wn(t),null}else 2*_r()-s.renderingStartTime>Ey&&n!==536870912&&(t.flags|=128,i=!0,Oh(s,!1),t.lanes=4194304);s.isBackwards?(r.sibling=t.child,t.child=r):(e=s.last,e!==null?e.sibling=r:t.child=r,s.last=r)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=_r(),e.sibling=null,n=Ls.current,Vn(Ls,i?n&1|2:n&1),tn&&jo(t,s.treeForkCount),e):(Wn(t),null);case 22:case 23:return xr(t),xT(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?n&536870912&&!(t.flags&128)&&(Wn(t),t.subtreeFlags&6&&(t.flags|=8192)):Wn(t),n=t.updateQueue,n!==null&&E0(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==n&&(t.flags|=2048),e!==null&&fi(zc),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),$o(Ws),Wn(t),null;case 25:return null;case 30:return null}throw Error(ke(156,t.tag))}function eY(e,t){switch(pT(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return $o(Ws),sf(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ry(t),null;case 31:if(t.memoizedState!==null){if(xr(t),t.alternate===null)throw Error(ke(340));tu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(xr(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ke(340));tu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return fi(Ls),null;case 4:return sf(),null;case 10:return $o(t.type),null;case 22:case 23:return xr(t),xT(),e!==null&&fi(zc),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return $o(Ws),null;case 25:return null;default:return null}}function O4(e,t){switch(pT(t),t.tag){case 3:$o(Ws),sf();break;case 26:case 27:case 5:ry(t);break;case 4:sf();break;case 31:t.memoizedState!==null&&xr(t);break;case 13:xr(t);break;case 19:fi(Ls);break;case 10:$o(t.type);break;case 22:case 23:xr(t),xT(),e!==null&&fi(zc);break;case 24:$o(Ws)}}function tg(e,t){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var i=s.next;n=i;do{if((n.tag&e)===e){s=void 0;var r=n.create,a=n.inst;s=r(),a.destroy=s}n=n.next}while(n!==i)}}catch(l){wn(t,t.return,l)}}function Zl(e,t,n){try{var s=t.updateQueue,i=s!==null?s.lastEffect:null;if(i!==null){var r=i.next;s=r;do{if((s.tag&e)===e){var a=s.inst,l=a.destroy;if(l!==void 0){a.destroy=void 0,i=t;var c=n,u=l;try{u()}catch(d){wn(i,c,d)}}}s=s.next}while(s!==r)}}catch(d){wn(t,t.return,d)}}function M4(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{z5(t,n)}catch(s){wn(e,e.return,s)}}}function L4(e,t,n){n.props=ru(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){wn(e,t,s)}}function kp(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof n=="function"?e.refCleanup=n(s):n.current=s}}catch(i){wn(e,t,i)}}function Qa(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(i){wn(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(i){wn(e,t,i)}else n.current=null}function D4(e){var t=e.type,n=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&s.focus();break e;case"img":n.src?s.src=n.src:n.srcSet&&(s.srcset=n.srcSet)}}catch(i){wn(e,e.return,i)}}function ov(e,t,n){try{var s=e.stateNode;wY(s,e.type,n,t),s[cr]=t}catch(i){wn(e,e.return,i)}}function P4(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&oc(e.type)||e.tag===4}function lv(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||P4(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.tag===27&&oc(e.type)||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 MS(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Lo));else if(s!==4&&(s===27&&oc(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(MS(e,t,n),e=e.sibling;e!==null;)MS(e,t,n),e=e.sibling}function xy(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(s===27&&oc(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(xy(e,t,n),e=e.sibling;e!==null;)xy(e,t,n),e=e.sibling}function B4(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Ni(t,s,n),t[Ei]=e,t[cr]=n}catch(r){wn(e,e.return,r)}}var Ro=!1,Ys=!1,cv=!1,AI=typeof WeakSet=="function"?WeakSet:Set,li=null;function tY(e,t){if(e=e.containerInfo,$S=Iy,e=N5(e),cT(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var i=s.anchorOffset,r=s.focusNode;s=s.focusOffset;try{n.nodeType,r.nodeType}catch{n=null;break e}var a=0,l=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||i!==0&&f.nodeType!==3||(l=a+i),f!==r||s!==0&&f.nodeType!==3||(c=a+s),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&&(l=a),h===r&&++d===s&&(c=a),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(HS={focusedElem:e,selectionRange:n},Iy=!1,li=t;li!==null;)if(t=li,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,li=e;else for(;li!==null;){switch(t=li,r=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n title"))),Ni(r,s,n),r[Ei]=e,ci(r),s=r;break e;case"link":var a=YI("link","href",i).get(s+(n.href||""));if(a){for(var l=0;lv&&(a=v,v=b,b=a);var y=JC(l,b),x=JC(l,v);if(y&&x&&(p.rangeCount!==1||p.anchorNode!==y.node||p.anchorOffset!==y.offset||p.focusNode!==x.node||p.focusOffset!==x.offset)){var E=f.createRange();E.setStart(y.node,y.offset),p.removeAllRanges(),b>v?(p.addRange(E),p.extend(x.node,x.offset)):(E.setEnd(x.node,x.offset),p.addRange(E))}}}}for(f=[],p=l;p=p.parentNode;)p.nodeType===1&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;ln?32:n,St.T=null,n=PS,PS=null;var r=zl,a=Ho;if(ri=0,df=zl=null,Ho=0,on&6)throw Error(ke(331));var l=on;if(on|=4,W4(r.current),K4(r,r.current,a,n),on=l,ng(0,!1),Nr&&typeof Nr.onPostCommitFiberRoot=="function")try{Nr.onPostCommitFiberRoot(Ym,r)}catch{}return!0}finally{ln.p=i,St.T=s,u6(e,t)}}function RI(e,t,n){t=Yr(n,t),t=jS(e.stateNode,t,2),e=$l(e,t,2),e!==null&&(Xm(e,2),ao(e))}function wn(e,t,n){if(e.tag===3)RI(e,e,n);else for(;t!==null;){if(t.tag===3){RI(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Hl===null||!Hl.has(s))){e=Yr(n,e),n=T4(2),s=$l(t,n,2),s!==null&&(k4(n,s,t,e),Xm(s,2),ao(s));break}}t=t.return}}function dv(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new iY;var i=new Set;s.set(t,i)}else i=s.get(t),i===void 0&&(i=new Set,s.set(t,i));i.has(n)||(PT=!0,i.add(n),e=cY.bind(null,e,t,n),t.then(e,e))}function cY(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Bn===e&&(Jt&n)===n&&(Is===4||Is===3&&(Jt&62914560)===Jt&&300>_r()-$x?!(on&2)&&ff(e,0):BT|=n,uf===Jt&&(uf=0)),ao(e)}function f6(e,t){t===0&&(t=s5()),e=vu(e,t),e!==null&&(Xm(e,t),ao(e))}function uY(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),f6(e,n)}function dY(e,t){var n=0;switch(e.tag){case 31:case 13:var s=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(ke(314))}s!==null&&s.delete(t),f6(e,n)}function fY(e,t){return eT(e,t)}var Sy=null,ad=null,US=!1,_y=!1,fv=!1,Ll=0;function ao(e){e!==ad&&e.next===null&&(ad===null?Sy=ad=e:ad=ad.next=e),_y=!0,US||(US=!0,pY())}function ng(e,t){if(!fv&&_y){fv=!0;do for(var n=!1,s=Sy;s!==null;){if(e!==0){var i=s.pendingLanes;if(i===0)var r=0;else{var a=s.suspendedLanes,l=s.pingedLanes;r=(1<<31-Tr(42|e)+1)-1,r&=i&~(a&~l),r=r&201326741?r&201326741|1:r?r|2:0}r!==0&&(n=!0,OI(s,r))}else r=Jt,r=Ix(s,s===Bn?r:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),!(r&3)||Wm(s,r)||(n=!0,OI(s,r));s=s.next}while(n);fv=!1}}function hY(){h6()}function h6(){_y=US=!1;var e=0;Ll!==0&&_Y()&&(e=Ll);for(var t=_r(),n=null,s=Sy;s!==null;){var i=s.next,r=p6(s,t);r===0?(s.next=null,n===null?Sy=i:n.next=i,i===null&&(ad=n)):(n=s,(e!==0||r&3)&&(_y=!0)),s=i}ri!==0&&ri!==5||ng(e),Ll!==0&&(Ll=0)}function p6(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,i=e.expirationTimes,r=e.pendingLanes&-62914561;0l)break;var d=c.transferSize,f=c.initiatorType;d&&BI(f)&&(c=c.responseEnd,a+=d*(c"u"?null:document;function S6(e,t,n){var s=Kf;if(s&&typeof t=="string"&&t){var i=qr(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),GI.has(i)||(GI.add(i),e={rel:e,crossOrigin:n,href:t},s.querySelector(i)===null&&(t=s.createElement("link"),Ni(t,"link",e),ci(t),s.head.appendChild(t)))}}function OY(e){sl.D(e),S6("dns-prefetch",e,null)}function MY(e,t){sl.C(e,t),S6("preconnect",e,t)}function LY(e,t,n){sl.L(e,t,n);var s=Kf;if(s&&e&&t){var i='link[rel="preload"][as="'+qr(t)+'"]';t==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+qr(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+qr(n.imageSizes)+'"]')):i+='[href="'+qr(e)+'"]';var r=i;switch(t){case"style":r=hf(e);break;case"script":r=qf(e)}ta.has(r)||(e=ns({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ta.set(r,e),s.querySelector(i)!==null||t==="style"&&s.querySelector(sg(r))||t==="script"&&s.querySelector(ig(r))||(t=s.createElement("link"),Ni(t,"link",e),ci(t),s.head.appendChild(t)))}}function DY(e,t){sl.m(e,t);var n=Kf;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+qr(s)+'"][href="'+qr(e)+'"]',r=i;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=qf(e)}if(!ta.has(r)&&(e=ns({rel:"modulepreload",href:e},t),ta.set(r,e),n.querySelector(i)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(ig(r)))return}s=n.createElement("link"),Ni(s,"link",e),ci(s),n.head.appendChild(s)}}}function PY(e,t,n){sl.S(e,t,n);var s=Kf;if(s&&e){var i=Hd(s).hoistableStyles,r=hf(e);t=t||"default";var a=i.get(r);if(!a){var l={loading:0,preload:null};if(a=s.querySelector(sg(r)))l.loading=5;else{e=ns({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ta.get(r))&&HT(e,n);var c=a=s.createElement("link");ci(c),Ni(c,"link",e),c._p=new Promise(function(u,d){c.onload=u,c.onerror=d}),c.addEventListener("load",function(){l.loading|=1}),c.addEventListener("error",function(){l.loading|=2}),l.loading|=4,Nb(a,t,s)}a={type:"stylesheet",instance:a,count:1,state:l},i.set(r,a)}}}function BY(e,t){sl.X(e,t);var n=Kf;if(n&&e){var s=Hd(n).hoistableScripts,i=qf(e),r=s.get(i);r||(r=n.querySelector(ig(i)),r||(e=ns({src:e,async:!0},t),(t=ta.get(i))&&zT(e,t),r=n.createElement("script"),ci(r),Ni(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},s.set(i,r))}}function UY(e,t){sl.M(e,t);var n=Kf;if(n&&e){var s=Hd(n).hoistableScripts,i=qf(e),r=s.get(i);r||(r=n.querySelector(ig(i)),r||(e=ns({src:e,async:!0,type:"module"},t),(t=ta.get(i))&&zT(e,t),r=n.createElement("script"),ci(r),Ni(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},s.set(i,r))}}function KI(e,t,n,s){var i=(i=Bl.current)?ky(i):null;if(!i)throw Error(ke(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=hf(n.href),n=Hd(i).hoistableStyles,s=n.get(t),s||(s={type:"style",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=hf(n.href);var r=Hd(i).hoistableStyles,a=r.get(e);if(a||(i=i.ownerDocument||i,a={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},r.set(e,a),(r=i.querySelector(sg(e)))&&!r._p&&(a.instance=r,a.state.loading=5),ta.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ta.set(e,n),r||FY(i,e,n,a.state))),t&&s===null)throw Error(ke(528,""));return a}if(t&&s!==null)throw Error(ke(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=qf(n),n=Hd(i).hoistableScripts,s=n.get(t),s||(s={type:"script",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(ke(444,e))}}function hf(e){return'href="'+qr(e)+'"'}function sg(e){return'link[rel="stylesheet"]['+e+"]"}function _6(e){return ns({},e,{"data-precedence":e.precedence,precedence:null})}function FY(e,t,n,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),Ni(t,"link",n),ci(t),e.head.appendChild(t))}function qf(e){return'[src="'+qr(e)+'"]'}function ig(e){return"script[async]"+e}function qI(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+qr(n.href)+'"]');if(s)return t.instance=s,ci(s),s;var i=ns({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),ci(s),Ni(s,"style",i),Nb(s,n.precedence,e),t.instance=s;case"stylesheet":i=hf(n.href);var r=e.querySelector(sg(i));if(r)return t.state.loading|=4,t.instance=r,ci(r),r;s=_6(n),(i=ta.get(i))&&HT(s,i),r=(e.ownerDocument||e).createElement("link"),ci(r);var a=r;return a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),Ni(r,"link",s),t.state.loading|=4,Nb(r,n.precedence,e),t.instance=r;case"script":return r=qf(n.src),(i=e.querySelector(ig(r)))?(t.instance=i,ci(i),i):(s=n,(i=ta.get(r))&&(s=ns({},n),zT(s,i)),e=e.ownerDocument||e,i=e.createElement("script"),ci(i),Ni(i,"link",s),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(ke(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(s=t.instance,t.state.loading|=4,Nb(s,n.precedence,e));return t.instance}function Nb(e,t,n){for(var s=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=s.length?s[s.length-1]:null,r=i,a=0;a title"):null)}function $Y(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function N6(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function HY(e,t,n,s){if(n.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var i=hf(s.href),r=t.querySelector(sg(i));if(r){t=r._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ay.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=r,ci(r);return}r=t.ownerDocument||t,s=_6(s),(i=ta.get(i))&&HT(s,i),r=r.createElement("link"),ci(r);var a=r;a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),Ni(r,"link",s),n.instance=r}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Ay.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var yv=0;function zY(e,t){return e.stylesheets&&e.count===0&&kb(e,e.stylesheets),0yv?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(i)}}:null}function Ay(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)kb(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Cy=null;function kb(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Cy=new Map,t.forEach(VY,e),Cy=null,Ay.call(e))}function VY(e,t){if(!(t.state.loading&4)){var n=Cy.get(e);if(n)var s=n.get(null);else{n=new Map,Cy.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),r=0;r"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(O6)}catch(e){console.error(e)}}O6(),$D.exports=Ax;var ZY=$D.exports;const JY=Bf(ZY),YT=g.createContext({});function Kx(e){const t=g.useRef(null);return t.current===null&&(t.current=e()),t.current}const qx=g.createContext(null),pm=g.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class eW extends g.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const s=this.props.sizeRef.current;s.height=n.offsetHeight||0,s.width=n.offsetWidth||0,s.top=n.offsetTop,s.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function tW({children:e,isPresent:t}){const n=g.useId(),s=g.useRef(null),i=g.useRef({width:0,height:0,top:0,left:0}),{nonce:r}=g.useContext(pm);return g.useInsertionEffect(()=>{const{width:a,height:l,top:c,left:u}=i.current;if(t||!s.current||!a||!l)return;s.current.dataset.motionPopId=n;const d=document.createElement("style");return r&&(d.nonce=r),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` [data-motion-pop-id="${n}"] { position: absolute !important; width: ${a}px !important; @@ -55,452 +55,452 @@ Error generating stack: `+s.message+` top: ${c}px !important; left: ${u}px !important; } - `),()=>{document.head.removeChild(d)}},[t]),o.jsx(XY,{isPresent:t,childRef:s,sizeRef:i,children:g.cloneElement(e,{ref:s})})}const ZY=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:i,presenceAffectsLayout:r,mode:a})=>{const l=Vx(JY),c=g.useId(),u=g.useCallback(f=>{l.set(f,!0);for(const h of l.values())if(!h)return;s&&s()},[l,s]),d=g.useMemo(()=>({id:c,initial:t,isPresent:n,custom:i,onExitComplete:u,register:f=>(l.set(f,!1),()=>l.delete(f))}),r?[Math.random(),u]:[n,u]);return g.useMemo(()=>{l.forEach((f,h)=>l.set(h,!1))},[n]),g.useEffect(()=>{!n&&!l.size&&s&&s()},[n]),a==="popLayout"&&(e=o.jsx(QY,{isPresent:n,children:e})),o.jsx(Gx.Provider,{value:d,children:e})};function JY(){return new Map}function I6(e=!0){const t=g.useContext(Gx);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:i}=t,r=g.useId();g.useEffect(()=>{e&&i(r)},[e]);const a=g.useCallback(()=>e&&s&&s(r),[r,s,e]);return!n&&s?[!1,a]:[!0]}const _0=e=>e.key||"";function ZI(e){const t=[];return g.Children.forEach(e,n=>{g.isValidElement(n)&&t.push(n)}),t}const GT=typeof window<"u",j6=GT?g.useLayoutEffect:g.useEffect,Ro=({children:e,custom:t,initial:n=!0,onExitComplete:s,presenceAffectsLayout:i=!0,mode:r="sync",propagate:a=!1})=>{const[l,c]=I6(a),u=g.useMemo(()=>ZI(e),[e]),d=a&&!l?[]:u.map(_0),f=g.useRef(!0),h=g.useRef(u),p=Vx(()=>new Map),[m,b]=g.useState(u),[v,y]=g.useState(u);j6(()=>{f.current=!1,h.current=u;for(let w=0;w{const _=_0(w),S=a&&!l?!1:u===v||d.includes(_),k=()=>{if(p.has(_))p.set(_,!0);else return;let T=!0;p.forEach(C=>{C||(T=!1)}),T&&(E==null||E(),y(h.current),a&&(c==null||c()),s&&s())};return o.jsx(ZY,{isPresent:S,initial:!f.current||n?void 0:!1,custom:S?void 0:t,presenceAffectsLayout:i,mode:r,onExitComplete:S?void 0:k,children:w},_)})})},Ar=e=>e;let R6=Ar;const eW={useManualTiming:!1};function tW(e){let t=new Set,n=new Set,s=!1,i=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(u){r.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,f=!1)=>{const p=f&&s?t:n;return d&&r.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),r.delete(u)},process:u=>{if(a=u,s){i=!0;return}s=!0,[t,n]=[n,t],t.forEach(l),t.clear(),s=!1,i&&(i=!1,c.process(u))}};return c}const N0=["read","resolveKeyframes","update","preRender","render","postRender"],nW=40;function O6(e,t){let n=!1,s=!0;const i={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,a=N0.reduce((y,x)=>(y[x]=tW(r),y),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=a,p=()=>{const y=performance.now();n=!1,i.delta=s?1e3/60:Math.max(Math.min(y-i.timestamp,nW),1),i.timestamp=y,i.isProcessing=!0,l.process(i),c.process(i),u.process(i),d.process(i),f.process(i),h.process(i),i.isProcessing=!1,n&&t&&(s=!1,e(p))},m=()=>{n=!0,s=!0,i.isProcessing||e(p)};return{schedule:N0.reduce((y,x)=>{const E=a[x];return y[x]=(w,_=!1,S=!1)=>(n||m(),E.schedule(w,_,S)),y},{}),cancel:y=>{for(let x=0;xJI[e].some(n=>!!t[n])};function sW(e){for(const t in e)hf[t]={...hf[t],...e[t]}}const iW=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 Iy(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||iW.has(e)}let L6=e=>!Iy(e);function D6(e){e&&(L6=t=>t.startsWith("on")?!Iy(t):e(t))}try{D6(require("@emotion/is-prop-valid").default)}catch{}function rW(e,t,n){const s={};for(const i in e)i==="values"&&typeof e.values=="object"||(L6(i)||n===!0&&Iy(i)||!t&&!Iy(i)||e.draggable&&i.startsWith("onDrag"))&&(s[i]=e[i]);return s}function aW({children:e,isValidProp:t,...n}){t&&D6(t),n={...g.useContext(mm),...n},n.isStatic=Vx(()=>n.isStatic);const s=g.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return o.jsx(mm.Provider,{value:s,children:e})}function oW(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...s)=>e(...s);return new Proxy(n,{get:(s,i)=>i==="create"?e:(t.has(i)||t.set(i,e(i)),t.get(i))})}const Kx=g.createContext({});function gm(e){return typeof e=="string"||Array.isArray(e)}function qx(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const KT=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],qT=["initial",...KT];function Yx(e){return qx(e.animate)||qT.some(t=>gm(e[t]))}function P6(e){return!!(Yx(e)||e.variants)}function lW(e,t){if(Yx(e)){const{initial:n,animate:s}=e;return{initial:n===!1||gm(n)?n:void 0,animate:gm(s)?s:void 0}}return e.inherit!==!1?t:{}}function cW(e){const{initial:t,animate:n}=lW(e,g.useContext(Kx));return g.useMemo(()=>({initial:t,animate:n}),[ej(t),ej(n)])}function ej(e){return Array.isArray(e)?e.join(" "):e}const uW=Symbol.for("motionComponentSymbol");function _d(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function dW(e,t,n){return g.useCallback(s=>{s&&e.onMount&&e.onMount(s),t&&(s?t.mount(s):t.unmount()),n&&(typeof n=="function"?n(s):_d(n)&&(n.current=s))},[t])}const YT=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),fW="framerAppearId",B6="data-"+YT(fW),{schedule:WT}=O6(queueMicrotask,!1),U6=g.createContext({});function hW(e,t,n,s,i){var r,a;const{visualElement:l}=g.useContext(Kx),c=g.useContext(M6),u=g.useContext(Gx),d=g.useContext(mm).reducedMotion,f=g.useRef(null);s=s||c.renderer,!f.current&&s&&(f.current=s(e,{visualState:t,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,p=g.useContext(U6);h&&!h.projection&&i&&(h.type==="html"||h.type==="svg")&&pW(f.current,n,i,p);const m=g.useRef(!1);g.useInsertionEffect(()=>{h&&m.current&&h.update(n,u)});const b=n[B6],v=g.useRef(!!b&&!(!((r=window.MotionHandoffIsComplete)===null||r===void 0)&&r.call(window,b))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,b)));return j6(()=>{h&&(m.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),WT.render(h.render),v.current&&h.animationState&&h.animationState.animateChanges())}),g.useEffect(()=>{h&&(!v.current&&h.animationState&&h.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,b)}),v.current=!1))}),h}function pW(e,t,n,s){const{layoutId:i,layout:r,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:F6(e.parent)),e.projection.setOptions({layoutId:i,layout:r,alwaysMeasureLayout:!!a||l&&_d(l),visualElement:e,animationType:typeof r=="string"?r:"both",initialPromotionConfig:s,layoutScroll:c,layoutRoot:u})}function F6(e){if(e)return e.options.allowProjection!==!1?e.projection:F6(e.parent)}function mW({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:s,Component:i}){var r,a;e&&sW(e);function l(u,d){let f;const h={...g.useContext(mm),...u,layoutId:gW(u)},{isStatic:p}=h,m=cW(u),b=s(u,p);if(!p&>){bW();const v=yW(h);f=v.MeasureLayout,m.visualElement=hW(i,b,h,t,v.ProjectionNode)}return o.jsxs(Kx.Provider,{value:m,children:[f&&m.visualElement?o.jsx(f,{visualElement:m.visualElement,...h}):null,n(i,u,dW(b,m.visualElement,d),b,p,m.visualElement)]})}l.displayName=`motion.${typeof i=="string"?i:`create(${(a=(r=i.displayName)!==null&&r!==void 0?r:i.name)!==null&&a!==void 0?a:""})`}`;const c=g.forwardRef(l);return c[uW]=i,c}function gW({layoutId:e}){const t=g.useContext(VT).id;return t&&e!==void 0?t+"-"+e:e}function bW(e,t){g.useContext(M6).strict}function yW(e){const{drag:t,layout:n}=hf;if(!t&&!n)return{};const s={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}const xW=["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 XT(e){return typeof e!="string"||e.includes("-")?!1:!!(xW.indexOf(e)>-1||/[A-Z]/u.test(e))}function tj(e){const t=[{},{}];return e==null||e.values.forEach((n,s)=>{t[0][s]=n.get(),t[1][s]=n.getVelocity()}),t}function QT(e,t,n,s){if(typeof t=="function"){const[i,r]=tj(s);t=t(n!==void 0?n:e.custom,i,r)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,r]=tj(s);t=t(n!==void 0?n:e.custom,i,r)}return t}const KS=e=>Array.isArray(e),EW=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),vW=e=>KS(e)?e[e.length-1]||0:e,Oi=e=>!!(e&&e.getVelocity);function kb(e){const t=Oi(e)?e.get():e;return EW(t)?t.toValue():t}function wW({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},s,i,r){const a={latestValues:SW(s,i,r,e),renderState:t()};return n&&(a.onMount=l=>n({props:s,current:l,...a}),a.onUpdate=l=>n(l)),a}const $6=e=>(t,n)=>{const s=g.useContext(Kx),i=g.useContext(Gx),r=()=>wW(e,t,s,i);return n?r():Vx(r)};function SW(e,t,n,s){const i={},r=s(e,{});for(const h in r)i[h]=kb(r[h]);let{initial:a,animate:l}=e;const c=Yx(e),u=P6(e);t&&u&&!c&&e.inherit!==!1&&(a===void 0&&(a=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const f=d?l:a;if(f&&typeof f!="boolean"&&!qx(f)){const h=Array.isArray(f)?f:[f];for(let p=0;pt=>typeof t=="string"&&t.startsWith(e),z6=H6("--"),_W=H6("var(--"),ZT=e=>_W(e)?NW.test(e.split("/*")[0].trim()):!1,NW=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,V6=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Yo=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},bm={...qf,transform:e=>Yo(0,1,e)},T0={...qf,default:1},ag=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),hl=ag("deg"),eo=ag("%"),gt=ag("px"),TW=ag("vh"),kW=ag("vw"),nj={...eo,parse:e=>eo.parse(e)/100,transform:e=>eo.transform(e*100)},AW={borderWidth:gt,borderTopWidth:gt,borderRightWidth:gt,borderBottomWidth:gt,borderLeftWidth:gt,borderRadius:gt,radius:gt,borderTopLeftRadius:gt,borderTopRightRadius:gt,borderBottomRightRadius:gt,borderBottomLeftRadius:gt,width:gt,maxWidth:gt,height:gt,maxHeight:gt,top:gt,right:gt,bottom:gt,left:gt,padding:gt,paddingTop:gt,paddingRight:gt,paddingBottom:gt,paddingLeft:gt,margin:gt,marginTop:gt,marginRight:gt,marginBottom:gt,marginLeft:gt,backgroundPositionX:gt,backgroundPositionY:gt},CW={rotate:hl,rotateX:hl,rotateY:hl,rotateZ:hl,scale:T0,scaleX:T0,scaleY:T0,scaleZ:T0,skew:hl,skewX:hl,skewY:hl,distance:gt,translateX:gt,translateY:gt,translateZ:gt,x:gt,y:gt,z:gt,perspective:gt,transformPerspective:gt,opacity:bm,originX:nj,originY:nj,originZ:gt},sj={...qf,transform:Math.round},JT={...AW,...CW,zIndex:sj,size:gt,fillOpacity:bm,strokeOpacity:bm,numOctaves:sj},IW={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},jW=Kf.length;function RW(e,t,n){let s="",i=!0;for(let r=0;r({style:{},transform:{},transformOrigin:{},vars:{}}),G6=()=>({...nk(),attrs:{}}),sk=e=>typeof e=="string"&&e.toLowerCase()==="svg";function K6(e,{style:t,vars:n},s,i){Object.assign(e.style,t,i&&i.getProjectionStyles(s));for(const r in n)e.style.setProperty(r,n[r])}const q6=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 Y6(e,t,n,s){K6(e,t,void 0,s);for(const i in t.attrs)e.setAttribute(q6.has(i)?i:YT(i),t.attrs[i])}const jy={};function PW(e){Object.assign(jy,e)}function W6(e,{layout:t,layoutId:n}){return wu.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!jy[e]||e==="opacity")}function ik(e,t,n){var s;const{style:i}=e,r={};for(const a in i)(Oi(i[a])||t.style&&Oi(t.style[a])||W6(a,e)||((s=n==null?void 0:n.getValue(a))===null||s===void 0?void 0:s.liveStyle)!==void 0)&&(r[a]=i[a]);return r}function X6(e,t,n){const s=ik(e,t,n);for(const i in e)if(Oi(e[i])||Oi(t[i])){const r=Kf.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;s[r]=e[i]}return s}function BW(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 rj=["x","y","width","height","cx","cy","r"],UW={useVisualState:$6({scrapeMotionValuesFromProps:X6,createRenderState:G6,onUpdate:({props:e,prevProps:t,current:n,renderState:s,latestValues:i})=>{if(!n)return;let r=!!e.drag;if(!r){for(const l in i)if(wu.has(l)){r=!0;break}}if(!r)return;let a=!t;if(t)for(let l=0;l{BW(n,s),as.render(()=>{tk(s,i,sk(n.tagName),e.transformTemplate),Y6(n,s)})})}})},FW={useVisualState:$6({scrapeMotionValuesFromProps:ik,createRenderState:nk})};function Q6(e,t,n){for(const s in t)!Oi(t[s])&&!W6(s,n)&&(e[s]=t[s])}function $W({transformTemplate:e},t){return g.useMemo(()=>{const n=nk();return ek(n,t,e),Object.assign({},n.vars,n.style)},[t])}function HW(e,t){const n=e.style||{},s={};return Q6(s,n,e),Object.assign(s,$W(e,t)),s}function zW(e,t){const n={},s=HW(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.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=s,n}function VW(e,t,n,s){const i=g.useMemo(()=>{const r=G6();return tk(r,t,sk(s),e.transformTemplate),{...r.attrs,style:{...r.style}}},[t]);if(e.style){const r={};Q6(r,e.style,e),i.style={...r,...i.style}}return i}function GW(e=!1){return(n,s,i,{latestValues:r},a)=>{const c=(XT(n)?VW:zW)(s,r,a,n),u=rW(s,typeof n=="string",e),d=n!==g.Fragment?{...u,...c,ref:i}:{},{children:f}=s,h=g.useMemo(()=>Oi(f)?f.get():f,[f]);return g.createElement(n,{...d,children:h})}}function KW(e,t){return function(s,{forwardMotionProps:i}={forwardMotionProps:!1}){const a={...XT(s)?UW:FW,preloadedFeatures:e,useRender:GW(i),createVisualElement:t,Component:s};return mW(a)}}function Z6(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let s=0;s(Ab===void 0&&to.set(yi.isProcessing||eW.useManualTiming?yi.timestamp:performance.now()),Ab),set:e=>{Ab=e,queueMicrotask(qW)}};function ak(e,t){e.indexOf(t)===-1&&e.push(t)}function ok(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class lk{constructor(){this.subscriptions=[]}add(t){return ak(this.subscriptions,t),()=>ok(this.subscriptions,t)}notify(t,n,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,s);else for(let r=0;r!isNaN(parseFloat(e));class WW{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(s,i=!0)=>{const r=to.now();this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),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=to.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=YW(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 lk);const s=this.events[t].add(n);return t==="change"?()=>{s(),as.read(()=>{this.events.change.getSize()||this.stop()})}:s}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,s){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}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=to.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>aj)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,aj);return eP(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 ym(e,t){return new WW(e,t)}function XW(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,ym(n))}function QW(e,t){const n=Wx(e,t);let{transitionEnd:s={},transition:i={},...r}=n||{};r={...r,...s};for(const a in r){const l=vW(r[a]);XW(e,a,l)}}function ZW(e){return!!(Oi(e)&&e.add)}function qS(e,t){const n=e.getValue("willChange");if(ZW(n))return n.add(t)}function tP(e){return e.props[B6]}function ck(e){let t;return()=>(t===void 0&&(t=e()),t)}const JW=ck(()=>window.ScrollTimeline!==void 0);class eX{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 s=0;s{if(JW()&&i.attachTimeline)return i.attachTimeline(t);if(typeof n=="function")return n(i)});return()=>{s.forEach((i,r)=>{i&&i(),this.animations[r].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 tX extends eX{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const Bo=e=>e*1e3,Uo=e=>e/1e3;function uk(e){return typeof e=="function"}function oj(e,t){e.timeline=t,e.onfinish=null}const dk=e=>Array.isArray(e)&&typeof e[0]=="number",nX={linearEasing:void 0};function sX(e,t){const n=ck(e);return()=>{var s;return(s=nX[t])!==null&&s!==void 0?s:n()}}const Ry=sX(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),pf=(e,t,n)=>{const s=t-e;return s===0?1:(n-e)/s},nP=(e,t,n=10)=>{let s="";const i=Math.max(Math.round(t/n),2);for(let r=0;r`cubic-bezier(${e}, ${t}, ${n}, ${s})`,YS={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:rp([0,.65,.55,1]),circOut:rp([.55,0,1,.45]),backIn:rp([.31,.01,.66,-.59]),backOut:rp([.33,1.53,.69,.99])};function iP(e,t){if(e)return typeof e=="function"&&Ry()?nP(e,t):dk(e)?rp(e):Array.isArray(e)?e.map(n=>iP(n,t)||YS.easeOut):YS[e]}const rP=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,iX=1e-7,rX=12;function aX(e,t,n,s,i){let r,a,l=0;do a=t+(n-t)/2,r=rP(a,s,i)-e,r>0?n=a:t=a;while(Math.abs(r)>iX&&++laX(r,0,1,e,n);return r=>r===0||r===1?r:rP(i(r),t,s)}const aP=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,oP=e=>t=>1-e(1-t),lP=og(.33,1.53,.69,.99),fk=oP(lP),cP=aP(fk),uP=e=>(e*=2)<1?.5*fk(e):.5*(2-Math.pow(2,-10*(e-1))),hk=e=>1-Math.sin(Math.acos(e)),dP=oP(hk),fP=aP(hk),hP=e=>/^0[^.\s]+$/u.test(e);function oX(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||hP(e):!0}const Op=e=>Math.round(e*1e5)/1e5,pk=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function lX(e){return e==null}const cX=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,mk=(e,t)=>n=>!!(typeof n=="string"&&cX.test(n)&&n.startsWith(e)||t&&!lX(n)&&Object.prototype.hasOwnProperty.call(n,t)),pP=(e,t,n)=>s=>{if(typeof s!="string")return s;const[i,r,a,l]=s.match(pk);return{[e]:parseFloat(i),[t]:parseFloat(r),[n]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},uX=e=>Yo(0,255,e),bv={...qf,transform:e=>Math.round(uX(e))},Lc={test:mk("rgb","red"),parse:pP("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:s=1})=>"rgba("+bv.transform(e)+", "+bv.transform(t)+", "+bv.transform(n)+", "+Op(bm.transform(s))+")"};function dX(e){let t="",n="",s="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),s=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),s=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,s+=s,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}}const WS={test:mk("#"),parse:dX,transform:Lc.transform},Nd={test:mk("hsl","hue"),parse:pP("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:s=1})=>"hsla("+Math.round(e)+", "+eo.transform(Op(t))+", "+eo.transform(Op(n))+", "+Op(bm.transform(s))+")"},Ri={test:e=>Lc.test(e)||WS.test(e)||Nd.test(e),parse:e=>Lc.test(e)?Lc.parse(e):Nd.test(e)?Nd.parse(e):WS.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Lc.transform(e):Nd.transform(e)},fX=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function hX(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(pk))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(fX))===null||n===void 0?void 0:n.length)||0)>0}const mP="number",gP="color",pX="var",mX="var(",lj="${}",gX=/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 xm(e){const t=e.toString(),n=[],s={color:[],number:[],var:[]},i=[];let r=0;const l=t.replace(gX,c=>(Ri.test(c)?(s.color.push(r),i.push(gP),n.push(Ri.parse(c))):c.startsWith(mX)?(s.var.push(r),i.push(pX),n.push(c)):(s.number.push(r),i.push(mP),n.push(parseFloat(c))),++r,lj)).split(lj);return{values:n,split:l,indexes:s,types:i}}function bP(e){return xm(e).values}function yP(e){const{split:t,types:n}=xm(e),s=t.length;return i=>{let r="";for(let a=0;atypeof e=="number"?0:e;function yX(e){const t=bP(e);return yP(e)(t.map(bX))}const Xl={test:hX,parse:bP,createTransformer:yP,getAnimatableNone:yX},xX=new Set(["brightness","contrast","saturate","opacity"]);function EX(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[s]=n.match(pk)||[];if(!s)return e;const i=n.replace(s,"");let r=xX.has(t)?1:0;return s!==n&&(r*=100),t+"("+r+i+")"}const vX=/\b([a-z-]*)\(.*?\)/gu,XS={...Xl,getAnimatableNone:e=>{const t=e.match(vX);return t?t.map(EX).join(" "):e}},wX={...JT,color:Ri,backgroundColor:Ri,outlineColor:Ri,fill:Ri,stroke:Ri,borderColor:Ri,borderTopColor:Ri,borderRightColor:Ri,borderBottomColor:Ri,borderLeftColor:Ri,filter:XS,WebkitFilter:XS},gk=e=>wX[e];function xP(e,t){let n=gk(e);return n!==XS&&(n=Xl),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const SX=new Set(["auto","none","0"]);function _X(e,t,n){let s=0,i;for(;se===qf||e===gt,uj=(e,t)=>parseFloat(e.split(", ")[t]),dj=(e,t)=>(n,{transform:s})=>{if(s==="none"||!s)return 0;const i=s.match(/^matrix3d\((.+)\)$/u);if(i)return uj(i[1],t);{const r=s.match(/^matrix\((.+)\)$/u);return r?uj(r[1],e):0}},NX=new Set(["x","y","z"]),TX=Kf.filter(e=>!NX.has(e));function kX(e){const t=[];return TX.forEach(n=>{const s=e.getValue(n);s!==void 0&&(t.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),t}const mf={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:dj(4,13),y:dj(5,14)};mf.translateX=mf.x;mf.translateY=mf.y;const Gc=new Set;let QS=!1,ZS=!1;function EP(){if(ZS){const e=Array.from(Gc).filter(s=>s.needsMeasurement),t=new Set(e.map(s=>s.element)),n=new Map;t.forEach(s=>{const i=kX(s);i.length&&(n.set(s,i),s.render())}),e.forEach(s=>s.measureInitialState()),t.forEach(s=>{s.render();const i=n.get(s);i&&i.forEach(([r,a])=>{var l;(l=s.getValue(r))===null||l===void 0||l.set(a)})}),e.forEach(s=>s.measureEndState()),e.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}ZS=!1,QS=!1,Gc.forEach(e=>e.complete()),Gc.clear()}function vP(){Gc.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(ZS=!0)})}function AX(){vP(),EP()}class bk{constructor(t,n,s,i,r,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=s,this.motionValue=i,this.element=r,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Gc.add(this),QS||(QS=!0,as.read(vP),as.resolveKeyframes(EP))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:s,motionValue:i}=this;for(let r=0;r/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),CX=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function IX(e){const t=CX.exec(e);if(!t)return[,];const[,n,s,i]=t;return[`--${n??s}`,i]}function SP(e,t,n=1){const[s,i]=IX(e);if(!s)return;const r=window.getComputedStyle(t).getPropertyValue(s);if(r){const a=r.trim();return wP(a)?parseFloat(a):a}return ZT(i)?SP(i,t,n+1):i}const _P=e=>t=>t.test(e),jX={test:e=>e==="auto",parse:e=>e},NP=[qf,gt,eo,hl,kW,TW,jX],fj=e=>NP.find(_P(e));class TP extends bk{constructor(t,n,s,i,r){super(t,n,s,i,r,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const hj=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Xl.test(e)||e==="0")&&!e.startsWith("url("));function RX(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function Xx(e,{repeat:t,repeatType:n="loop"},s){const i=e.filter(MX),r=t&&n!=="loop"&&t%2===1?0:i.length-1;return!r||s===void 0?i[r]:s}const LX=40;class kP{constructor({autoplay:t=!0,delay:n=0,type:s="keyframes",repeat:i=0,repeatDelay:r=0,repeatType:a="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=to.now(),this.options={autoplay:t,delay:n,type:s,repeat:i,repeatDelay:r,repeatType:a,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>LX?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&AX(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=to.now(),this.hasAttemptedResolve=!0;const{name:s,type:i,velocity:r,delay:a,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!OX(t,s,i,r))if(a)this.options.duration=0;else{c&&c(Xx(t,this.options,n)),l&&l(),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 JS=2e4;function AP(e){let t=0;const n=50;let s=e.next(t);for(;!s.done&&t=JS?1/0:t}const vs=(e,t,n)=>e+(t-e)*n;function yv(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 DX({hue:e,saturation:t,lightness:n,alpha:s}){e/=360,t/=100,n/=100;let i=0,r=0,a=0;if(!t)i=r=a=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;i=yv(c,l,e+1/3),r=yv(c,l,e),a=yv(c,l,e-1/3)}return{red:Math.round(i*255),green:Math.round(r*255),blue:Math.round(a*255),alpha:s}}function Oy(e,t){return n=>n>0?t:e}const xv=(e,t,n)=>{const s=e*e,i=n*(t*t-s)+s;return i<0?0:Math.sqrt(i)},PX=[WS,Lc,Nd],BX=e=>PX.find(t=>t.test(e));function pj(e){const t=BX(e);if(!t)return!1;let n=t.parse(e);return t===Nd&&(n=DX(n)),n}const mj=(e,t)=>{const n=pj(e),s=pj(t);if(!n||!s)return Oy(e,t);const i={...n};return r=>(i.red=xv(n.red,s.red,r),i.green=xv(n.green,s.green,r),i.blue=xv(n.blue,s.blue,r),i.alpha=vs(n.alpha,s.alpha,r),Lc.transform(i))},UX=(e,t)=>n=>t(e(n)),lg=(...e)=>e.reduce(UX),e_=new Set(["none","hidden"]);function FX(e,t){return e_.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function $X(e,t){return n=>vs(e,t,n)}function yk(e){return typeof e=="number"?$X:typeof e=="string"?ZT(e)?Oy:Ri.test(e)?mj:VX:Array.isArray(e)?CP:typeof e=="object"?Ri.test(e)?mj:HX:Oy}function CP(e,t){const n=[...e],s=n.length,i=e.map((r,a)=>yk(r)(r,t[a]));return r=>{for(let a=0;a{for(const r in s)n[r]=s[r](i);return n}}function zX(e,t){var n;const s=[],i={color:0,var:0,number:0};for(let r=0;r{const n=Xl.createTransformer(t),s=xm(e),i=xm(t);return s.indexes.var.length===i.indexes.var.length&&s.indexes.color.length===i.indexes.color.length&&s.indexes.number.length>=i.indexes.number.length?e_.has(e)&&!i.values.length||e_.has(t)&&!s.values.length?FX(e,t):lg(CP(zX(s,i),i.values),n):Oy(e,t)};function IP(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?vs(e,t,n):yk(e)(e,t)}const GX=5;function jP(e,t,n){const s=Math.max(t-GX,0);return eP(n-e(s),t-s)}const Is={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},Ev=.001;function KX({duration:e=Is.duration,bounce:t=Is.bounce,velocity:n=Is.velocity,mass:s=Is.mass}){let i,r,a=1-t;a=Yo(Is.minDamping,Is.maxDamping,a),e=Yo(Is.minDuration,Is.maxDuration,Uo(e)),a<1?(i=u=>{const d=u*a,f=d*e,h=d-n,p=t_(u,a),m=Math.exp(-f);return Ev-h/p*m},r=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=t_(Math.pow(u,2),a);return(-i(u)+Ev>0?-1:1)*((h-p)*m)/b}):(i=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-Ev+d*f},r=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=YX(i,r,l);if(e=Bo(e),isNaN(c))return{stiffness:Is.stiffness,damping:Is.damping,duration:e};{const u=Math.pow(c,2)*s;return{stiffness:u,damping:a*2*Math.sqrt(s*u),duration:e}}}const qX=12;function YX(e,t,n){let s=n;for(let i=1;ie[n]!==void 0)}function QX(e){let t={velocity:Is.velocity,stiffness:Is.stiffness,damping:Is.damping,mass:Is.mass,isResolvedFromDuration:!1,...e};if(!gj(e,XX)&&gj(e,WX))if(e.visualDuration){const n=e.visualDuration,s=2*Math.PI/(n*1.2),i=s*s,r=2*Yo(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Is.mass,stiffness:i,damping:r}}else{const n=KX(e);t={...t,...n,mass:Is.mass},t.isResolvedFromDuration=!0}return t}function RP(e=Is.visualDuration,t=Is.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:s,restDelta:i}=n;const r=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],l={done:!1,value:r},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:p}=QX({...n,velocity:-Uo(n.velocity||0)}),m=h||0,b=u/(2*Math.sqrt(c*d)),v=a-r,y=Uo(Math.sqrt(c/d)),x=Math.abs(v)<5;s||(s=x?Is.restSpeed.granular:Is.restSpeed.default),i||(i=x?Is.restDelta.granular:Is.restDelta.default);let E;if(b<1){const _=t_(y,b);E=S=>{const k=Math.exp(-b*y*S);return a-k*((m+b*y*v)/_*Math.sin(_*S)+v*Math.cos(_*S))}}else if(b===1)E=_=>a-Math.exp(-y*_)*(v+(m+y*v)*_);else{const _=y*Math.sqrt(b*b-1);E=S=>{const k=Math.exp(-b*y*S),T=Math.min(_*S,300);return a-k*((m+b*y*v)*Math.sinh(T)+_*v*Math.cosh(T))/_}}const w={calculatedDuration:p&&f||null,next:_=>{const S=E(_);if(p)l.done=_>=f;else{let k=0;b<1&&(k=_===0?Bo(m):jP(E,_,S));const T=Math.abs(k)<=s,C=Math.abs(a-S)<=i;l.done=T&&C}return l.value=l.done?a:S,l},toString:()=>{const _=Math.min(AP(w),JS),S=nP(k=>w.next(_*k).value,_,30);return _+"ms "+S}};return w}function bj({keyframes:e,velocity:t=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:r=500,modifyTarget:a,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},p=T=>l!==void 0&&Tc,m=T=>l===void 0?c:c===void 0||Math.abs(l-T)-b*Math.exp(-T/s),E=T=>y+x(T),w=T=>{const C=x(T),I=E(T);h.done=Math.abs(C)<=u,h.value=h.done?y:I};let _,S;const k=T=>{p(h.value)&&(_=T,S=RP({keyframes:[h.value,m(h.value)],velocity:jP(E,T,h.value),damping:i,stiffness:r,restDelta:u,restSpeed:d}))};return k(0),{calculatedDuration:null,next:T=>{let C=!1;return!S&&_===void 0&&(C=!0,w(T),k(T)),_!==void 0&&T>=_?S.next(T-_):(!C&&w(T),h)}}}const ZX=og(.42,0,1,1),JX=og(0,0,.58,1),OP=og(.42,0,.58,1),eQ=e=>Array.isArray(e)&&typeof e[0]!="number",tQ={linear:Ar,easeIn:ZX,easeInOut:OP,easeOut:JX,circIn:hk,circInOut:fP,circOut:dP,backIn:fk,backInOut:cP,backOut:lP,anticipate:uP},yj=e=>{if(dk(e)){R6(e.length===4);const[t,n,s,i]=e;return og(t,n,s,i)}else if(typeof e=="string")return tQ[e];return e};function nQ(e,t,n){const s=[],i=n||IP,r=e.length-1;for(let a=0;at[0];if(r===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[r-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=nQ(t,s,i),c=l.length,u=d=>{if(a&&d1)for(;fu(Yo(e[0],e[r-1],d)):u}function iQ(e,t){const n=e[e.length-1];for(let s=1;s<=t;s++){const i=pf(0,t,s);e.push(vs(n,1,i))}}function rQ(e){const t=[0];return iQ(t,e.length-1),t}function aQ(e,t){return e.map(n=>n*t)}function oQ(e,t){return e.map(()=>t||OP).splice(0,e.length-1)}function My({duration:e=300,keyframes:t,times:n,ease:s="easeInOut"}){const i=eQ(s)?s.map(yj):yj(s),r={done:!1,value:t[0]},a=aQ(n&&n.length===t.length?n:rQ(t),e),l=sQ(a,t,{ease:Array.isArray(i)?i:oQ(t,i)});return{calculatedDuration:e,next:c=>(r.value=l(c),r.done=c>=e,r)}}const lQ=e=>{const t=({timestamp:n})=>e(n);return{start:()=>as.update(t,!0),stop:()=>Wl(t),now:()=>yi.isProcessing?yi.timestamp:to.now()}},cQ={decay:bj,inertia:bj,tween:My,keyframes:My,spring:RP},uQ=e=>e/100;class xk extends kP{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:c}=this.options;c&&c()};const{name:n,motionValue:s,element:i,keyframes:r}=this.options,a=(i==null?void 0:i.KeyframeResolver)||bk,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new a(r,l,n,s,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:s=0,repeatDelay:i=0,repeatType:r,velocity:a=0}=this.options,l=uk(n)?n:cQ[n]||My;let c,u;l!==My&&typeof t[0]!="number"&&(c=lg(uQ,IP(t[0],t[1])),t=[0,100]);const d=l({...this.options,keyframes:t});r==="mirror"&&(u=l({...this.options,keyframes:[...t].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=AP(d));const{calculatedDuration:f}=d,h=f+i,p=h*(s+1)-i;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,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:s}=this;if(!s){const{keyframes:T}=this.options;return{done:!0,value:T[T.length-1]}}const{finalKeyframe:i,generator:r,mirroredGenerator:a,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=s;if(this.startTime===null)return r.next(0);const{delay:h,repeat:p,repeatType:m,repeatDelay:b,onUpdate:v}=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 y=this.currentTime-h*(this.speed>=0?1:-1),x=this.speed>=0?y<0:y>d;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let E=this.currentTime,w=r;if(p){const T=Math.min(this.currentTime,d)/f;let C=Math.floor(T),I=T%1;!I&&T>=1&&(I=1),I===1&&C--,C=Math.min(C,p+1),!!(C%2)&&(m==="reverse"?(I=1-I,b&&(I-=b/f)):m==="mirror"&&(w=a)),E=Yo(0,1,I)*f}const _=x?{done:!1,value:c[0]}:w.next(E);l&&(_.value=l(_.value));let{done:S}=_;!x&&u!==null&&(S=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&S);return k&&i!==void 0&&(_.value=Xx(c,this.options,i)),v&&v(_.value),k&&this.finish(),_}get duration(){const{resolved:t}=this;return t?Uo(t.calculatedDuration):0}get time(){return Uo(this.currentTime)}set time(t){t=Bo(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=Uo(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=lQ,onPlay:n,startTime:s}=this.options;this.driver||(this.driver=t(r=>this.tick(r))),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=s??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 dQ=new Set(["opacity","clipPath","filter","transform"]);function fQ(e,t,n,{delay:s=0,duration:i=300,repeat:r=0,repeatType:a="loop",ease:l="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=iP(l,i);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:s,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:r+1,direction:a==="reverse"?"alternate":"normal"})}const hQ=ck(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Ly=10,pQ=2e4;function mQ(e){return uk(e.type)||e.type==="spring"||!sP(e.ease)}function gQ(e,t){const n=new xk({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:e[0]};const i=[];let r=0;for(;!s.done&&rthis.onKeyframesResolved(a,l),n,s,i),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:s=300,times:i,ease:r,type:a,motionValue:l,name:c,startTime:u}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof r=="string"&&Ry()&&bQ(r)&&(r=MP[r]),mQ(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:m,...b}=this.options,v=gQ(t,b);t=v.keyframes,t.length===1&&(t[1]=t[0]),s=v.duration,i=v.times,r=v.ease,a="keyframes"}const d=fQ(l.owner.current,c,t,{...this.options,duration:s,times:i,ease:r});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(oj(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;l.set(Xx(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:s,times:i,type:a,ease:r,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return Uo(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return Uo(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:s}=n;s.currentTime=Bo(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:s}=n;s.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 Ar;const{animation:s}=n;oj(s,t)}return Ar}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:s,duration:i,type:r,ease:a,times:l}=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 xk({...p,keyframes:s,duration:i,type:r,ease:a,times:l,isGenerator:!0}),b=Bo(this.time);u.setWithVelocity(m.sample(b-Ly).value,m.sample(b).value,Ly)}const{onStop:c}=this.options;c&&c(),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:s,repeatDelay:i,repeatType:r,damping:a,type:l}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return hQ()&&s&&dQ.has(s)&&!c&&!u&&!i&&r!=="mirror"&&a!==0&&l!=="inertia"}}const yQ={type:"spring",stiffness:500,damping:25,restSpeed:10},xQ=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),EQ={type:"keyframes",duration:.8},vQ={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},wQ=(e,{keyframes:t})=>t.length>2?EQ:wu.has(e)?e.startsWith("scale")?xQ(t[1]):yQ:vQ;function SQ({when:e,delay:t,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:r,repeatType:a,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const Ek=(e,t,n,s={},i,r)=>a=>{const l=rk(s,e)||{},c=l.delay||s.delay||0;let{elapsed:u=0}=s;u=u-Bo(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:h=>{t.set(h),l.onUpdate&&l.onUpdate(h)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:r?void 0:i};SQ(l)||(d={...d,...wQ(e,d)}),d.duration&&(d.duration=Bo(d.duration)),d.repeatDelay&&(d.repeatDelay=Bo(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&&!r&&t.get()!==void 0){const h=Xx(d.keyframes,l);if(h!==void 0)return as.update(()=>{d.onUpdate(h),d.onComplete()}),new tX([])}return!r&&xj.supports(d)?new xj(d):new xk(d)};function _Q({protectedKeys:e,needsAnimating:t},n){const s=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,s}function LP(e,t,{delay:n=0,transitionOverride:s,type:i}={}){var r;let{transition:a=e.getDefaultTransition(),transitionEnd:l,...c}=t;s&&(a=s);const u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(const f in c){const h=e.getValue(f,(r=e.latestValues[f])!==null&&r!==void 0?r:null),p=c[f];if(p===void 0||d&&_Q(d,f))continue;const m={delay:n,...rk(a||{},f)};let b=!1;if(window.MotionHandoffAnimation){const y=tP(e);if(y){const x=window.MotionHandoffAnimation(y,f,as);x!==null&&(m.startTime=x,b=!0)}}qS(e,f),h.start(Ek(f,h,p,e.shouldReduceMotion&&J6.has(f)?{type:!1}:m,e,b));const v=h.animation;v&&u.push(v)}return l&&Promise.all(u).then(()=>{as.update(()=>{l&&QW(e,l)})}),u}function n_(e,t,n={}){var s;const i=Wx(e,t,n.type==="exit"?(s=e.presenceContext)===null||s===void 0?void 0:s.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(r=n.transitionOverride);const a=i?()=>Promise.all(LP(e,i,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=r;return NQ(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:c}=r;if(c){const[u,d]=c==="beforeChildren"?[a,l]:[l,a];return u().then(()=>d())}else return Promise.all([a(),l(n.delay)])}function NQ(e,t,n=0,s=0,i=1,r){const a=[],l=(e.variantChildren.size-1)*s,c=i===1?(u=0)=>u*s:(u=0)=>l-u*s;return Array.from(e.variantChildren).sort(TQ).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(n_(u,t,{...r,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function TQ(e,t){return e.sortNodePosition(t)}function kQ(e,t,n={}){e.notify("AnimationStart",t);let s;if(Array.isArray(t)){const i=t.map(r=>n_(e,r,n));s=Promise.all(i)}else if(typeof t=="string")s=n_(e,t,n);else{const i=typeof t=="function"?Wx(e,t,n.custom):t;s=Promise.all(LP(e,i,n))}return s.then(()=>{e.notify("AnimationComplete",t)})}const AQ=qT.length;function DP(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?DP(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:s})=>kQ(e,n,s)))}function RQ(e){let t=jQ(e),n=Ej(),s=!0;const i=c=>(u,d)=>{var f;const h=Wx(e,d,c==="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 r(c){t=c(e)}function a(c){const{props:u}=e,d=DP(e.parent)||{},f=[],h=new Set;let p={},m=1/0;for(let v=0;vm&&w,C=!1;const I=Array.isArray(E)?E:[E];let j=I.reduce(i(y),{});_===!1&&(j={});const{prevResolvedValues:L={}}=x,z={...L,...j},D=O=>{T=!0,h.has(O)&&(C=!0,h.delete(O)),x.needsAnimating[O]=!0;const P=e.getValue(O);P&&(P.liveStyle=!1)};for(const O in z){const P=j[O],$=L[O];if(p.hasOwnProperty(O))continue;let R=!1;KS(P)&&KS($)?R=!Z6(P,$):R=P!==$,R?P!=null?D(O):h.add(O):P!==void 0&&h.has(O)?D(O):x.protectedKeys[O]=!0}x.prevProp=E,x.prevResolvedValues=j,x.isActive&&(p={...p,...j}),s&&e.blockInitialAnimation&&(T=!1),T&&(!(S&&k)||C)&&f.push(...I.map(O=>({animation:O,options:{type:y}})))}if(h.size){const v={};h.forEach(y=>{const x=e.getBaseTarget(y),E=e.getValue(y);E&&(E.liveStyle=!0),v[y]=x??null}),f.push({animation:v})}let b=!!f.length;return s&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(b=!1),s=!1,b?t(f):Promise.resolve()}function l(c,u){var d;if(n[c].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(c,u)}),n[c].isActive=u;const f=a(c);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:l,setAnimateFunction:r,getState:()=>n,reset:()=>{n=Ej(),s=!0}}}function OQ(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Z6(t,e):!1}function yc(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Ej(){return{animate:yc(!0),whileInView:yc(),whileHover:yc(),whileTap:yc(),whileDrag:yc(),whileFocus:yc(),exit:yc()}}class sc{constructor(t){this.isMounted=!1,this.node=t}update(){}}class MQ extends sc{constructor(t){super(t),t.animationState||(t.animationState=RQ(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();qx(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 LQ=0;class DQ extends sc{constructor(){super(...arguments),this.id=LQ++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)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 PQ={animation:{Feature:MQ},exit:{Feature:DQ}},ga={x:!1,y:!1};function PP(){return ga.x||ga.y}function BQ(e){return e==="x"||e==="y"?ga[e]?null:(ga[e]=!0,()=>{ga[e]=!1}):ga.x||ga.y?null:(ga.x=ga.y=!0,()=>{ga.x=ga.y=!1})}const vk=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function Em(e,t,n,s={passive:!0}){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n)}function cg(e){return{point:{x:e.pageX,y:e.pageY}}}const UQ=e=>t=>vk(t)&&e(t,cg(t));function Mp(e,t,n,s){return Em(e,t,UQ(n),s)}const vj=(e,t)=>Math.abs(e-t);function FQ(e,t){const n=vj(e.x,t.x),s=vj(e.y,t.y);return Math.sqrt(n**2+s**2)}class BP{constructor(t,n,{transformPagePoint:s,contextWindow:i,dragSnapToOrigin:r=!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=wv(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=FQ(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:m}=f,{timestamp:b}=yi;this.history.push({...m,timestamp:b});const{onStart:v,onMove:y}=this.handlers;h||(v&&v(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=vv(h,this.transformPagePoint),as.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 v=wv(f.type==="pointercancel"?this.lastMoveEventInfo:vv(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,v),m&&m(f,v)},!vk(t))return;this.dragSnapToOrigin=r,this.handlers=n,this.transformPagePoint=s,this.contextWindow=i||window;const a=cg(t),l=vv(a,this.transformPagePoint),{point:c}=l,{timestamp:u}=yi;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,wv(l,this.history)),this.removeListeners=lg(Mp(this.contextWindow,"pointermove",this.handlePointerMove),Mp(this.contextWindow,"pointerup",this.handlePointerUp),Mp(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Wl(this.updatePoint)}}function vv(e,t){return t?{point:t(e.point)}:e}function wj(e,t){return{x:e.x-t.x,y:e.y-t.y}}function wv({point:e},t){return{point:e,delta:wj(e,UP(t)),offset:wj(e,$Q(t)),velocity:HQ(t,.1)}}function $Q(e){return e[0]}function UP(e){return e[e.length-1]}function HQ(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,s=null;const i=UP(e);for(;n>=0&&(s=e[n],!(i.timestamp-s.timestamp>Bo(t)));)n--;if(!s)return{x:0,y:0};const r=Uo(i.timestamp-s.timestamp);if(r===0)return{x:0,y:0};const a={x:(i.x-s.x)/r,y:(i.y-s.y)/r};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const FP=1e-4,zQ=1-FP,VQ=1+FP,$P=.01,GQ=0-$P,KQ=0+$P;function Rr(e){return e.max-e.min}function qQ(e,t,n){return Math.abs(e-t)<=n}function Sj(e,t,n,s=.5){e.origin=s,e.originPoint=vs(t.min,t.max,e.origin),e.scale=Rr(n)/Rr(t),e.translate=vs(n.min,n.max,e.origin)-e.originPoint,(e.scale>=zQ&&e.scale<=VQ||isNaN(e.scale))&&(e.scale=1),(e.translate>=GQ&&e.translate<=KQ||isNaN(e.translate))&&(e.translate=0)}function Lp(e,t,n,s){Sj(e.x,t.x,n.x,s?s.originX:void 0),Sj(e.y,t.y,n.y,s?s.originY:void 0)}function _j(e,t,n){e.min=n.min+t.min,e.max=e.min+Rr(t)}function YQ(e,t,n){_j(e.x,t.x,n.x),_j(e.y,t.y,n.y)}function Nj(e,t,n){e.min=t.min-n.min,e.max=e.min+Rr(t)}function Dp(e,t,n){Nj(e.x,t.x,n.x),Nj(e.y,t.y,n.y)}function WQ(e,{min:t,max:n},s){return t!==void 0&&en&&(e=s?vs(n,e,s.max):Math.min(e,n)),e}function Tj(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 XQ(e,{top:t,left:n,bottom:s,right:i}){return{x:Tj(e.x,n,i),y:Tj(e.y,t,s)}}function kj(e,t){let n=t.min-e.min,s=t.max-e.max;return t.max-t.mins?n=pf(t.min,t.max-s,e.min):s>i&&(n=pf(e.min,e.max-i,t.min)),Yo(0,1,n)}function JQ(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 s_=.35;function eZ(e=s_){return e===!1?e=0:e===!0&&(e=s_),{x:Aj(e,"left","right"),y:Aj(e,"top","bottom")}}function Aj(e,t,n){return{min:Cj(e,t),max:Cj(e,n)}}function Cj(e,t){return typeof e=="number"?e:e[t]||0}const Ij=()=>({translate:0,scale:1,origin:0,originPoint:0}),Td=()=>({x:Ij(),y:Ij()}),jj=()=>({min:0,max:0}),Ds=()=>({x:jj(),y:jj()});function Hr(e){return[e("x"),e("y")]}function HP({top:e,left:t,right:n,bottom:s}){return{x:{min:t,max:n},y:{min:e,max:s}}}function tZ({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function nZ(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function Sv(e){return e===void 0||e===1}function i_({scale:e,scaleX:t,scaleY:n}){return!Sv(e)||!Sv(t)||!Sv(n)}function Tc(e){return i_(e)||zP(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function zP(e){return Rj(e.x)||Rj(e.y)}function Rj(e){return e&&e!=="0%"}function Dy(e,t,n){const s=e-n,i=t*s;return n+i}function Oj(e,t,n,s,i){return i!==void 0&&(e=Dy(e,i,s)),Dy(e,n,s)+t}function r_(e,t=0,n=1,s,i){e.min=Oj(e.min,t,n,s,i),e.max=Oj(e.max,t,n,s,i)}function VP(e,{x:t,y:n}){r_(e.x,t.translate,t.scale,t.originPoint),r_(e.y,n.translate,n.scale,n.originPoint)}const Mj=.999999999999,Lj=1.0000000000001;function sZ(e,t,n,s=!1){const i=n.length;if(!i)return;t.x=t.y=1;let r,a;for(let l=0;lMj&&(t.x=1),t.yMj&&(t.y=1)}function kd(e,t){e.min=e.min+t,e.max=e.max+t}function Dj(e,t,n,s,i=.5){const r=vs(e.min,e.max,i);r_(e,t,n,r,s)}function Ad(e,t){Dj(e.x,t.x,t.scaleX,t.scale,t.originX),Dj(e.y,t.y,t.scaleY,t.scale,t.originY)}function GP(e,t){return HP(nZ(e.getBoundingClientRect(),t))}function iZ(e,t,n){const s=GP(e,n),{scroll:i}=t;return i&&(kd(s.x,i.offset.x),kd(s.y,i.offset.y)),s}const KP=({current:e})=>e?e.ownerDocument.defaultView:null,rZ=new WeakMap;class aZ{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=Ds(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(cg(d).point)},r=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:m}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=BQ(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),Hr(v=>{let y=this.getAxisMotionValue(v).get()||0;if(eo.test(y)){const{projection:x}=this.visualElement;if(x&&x.layout){const E=x.layout.layoutBox[v];E&&(y=Rr(E)*(parseFloat(y)/100))}}this.originPoint[v]=y}),m&&as.postRender(()=>m(d,f)),qS(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:v}=f;if(p&&this.currentDirection===null){this.currentDirection=oZ(v),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",f.point,v),this.updateAxis("y",f.point,v),this.visualElement.render(),b&&b(d,f)},l=(d,f)=>this.stop(d,f),c=()=>Hr(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 BP(t,{onSessionStart:i,onStart:r,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:KP(this.visualElement)})}stop(t,n){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:r}=this.getProps();r&&as.postRender(()=>r(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:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,s){const{drag:i}=this.getProps();if(!s||!k0(t,i,this.currentDirection))return;const r=this.getAxisMotionValue(t);let a=this.originPoint[t]+s[t];this.constraints&&this.constraints[t]&&(a=WQ(a,this.constraints[t],this.elastic[t])),r.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:s}=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,r=this.constraints;n&&_d(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&i?this.constraints=XQ(i.layoutBox,n):this.constraints=!1,this.elastic=eZ(s),r!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Hr(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=JQ(i.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!_d(t))return!1;const s=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const r=iZ(s,i.root,this.visualElement.getTransformPagePoint());let a=QQ(i.layout.layoutBox,r);if(n){const l=n(tZ(a));this.hasMutatedConstraints=!!l,l&&(a=HP(l))}return a}startAnimation(t){const{drag:n,dragMomentum:s,dragElastic:i,dragTransition:r,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Hr(d=>{if(!k0(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const h=i?200:1e6,p=i?40:1e7,m={type:"inertia",velocity:s?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...r,...f};return this.startAxisValueAnimation(d,m)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const s=this.getAxisMotionValue(t);return qS(this.visualElement,t),s.start(Ek(t,s,0,n,this.visualElement,!1))}stopAnimation(){Hr(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Hr(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()}`,s=this.visualElement.getProps(),i=s[n];return i||this.visualElement.getValue(t,(s.initial?s.initial[t]:void 0)||0)}snapToCursor(t){Hr(n=>{const{drag:s}=this.getProps();if(!k0(n,s,this.currentDirection))return;const{projection:i}=this.visualElement,r=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:l}=i.layout.layoutBox[n];r.set(t[n]-vs(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!_d(n)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Hr(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();i[a]=ZQ({min:c,max:c},this.constraints[a])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),Hr(a=>{if(!k0(a,t,null))return;const l=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];l.set(vs(c,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;rZ.set(this.visualElement,this);const t=this.visualElement.current,n=Mp(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();_d(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,r=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),as.read(s);const a=Em(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Hr(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{a(),n(),r(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:r=!1,dragElastic:a=s_,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:s,dragPropagation:i,dragConstraints:r,dragElastic:a,dragMomentum:l}}}function k0(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function oZ(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class lZ extends sc{constructor(t){super(t),this.removeGroupControls=Ar,this.removeListeners=Ar,this.controls=new aZ(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ar}unmount(){this.removeGroupControls(),this.removeListeners()}}const Pj=e=>(t,n)=>{e&&as.postRender(()=>e(t,n))};class cZ extends sc{constructor(){super(...arguments),this.removePointerDownListener=Ar}onPointerDown(t){this.session=new BP(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:KP(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:Pj(t),onStart:Pj(n),onMove:s,onEnd:(r,a)=>{delete this.session,i&&as.postRender(()=>i(r,a))}}}mount(){this.removePointerDownListener=Mp(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 Cb={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Bj(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Ph={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(gt.test(e))e=parseFloat(e);else return e;const n=Bj(e,t.target.x),s=Bj(e,t.target.y);return`${n}% ${s}%`}},uZ={correct:(e,{treeScale:t,projectionDelta:n})=>{const s=e,i=Xl.parse(e);if(i.length>5)return s;const r=Xl.createTransformer(e),a=typeof i[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;i[0+a]/=l,i[1+a]/=c;const u=vs(l,c,.5);return typeof i[2+a]=="number"&&(i[2+a]/=u),typeof i[3+a]=="number"&&(i[3+a]/=u),r(i)}};class dZ extends g.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s,layoutId:i}=this.props,{projection:r}=t;PW(fZ),r&&(n.group&&n.group.add(r),s&&s.register&&i&&s.register(r),r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),Cb.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:s,drag:i,isPresent:r}=this.props,a=s.projection;return a&&(a.isPresent=r,i||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==r&&(r?a.promote():a.relegate()||as.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),WT.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),s&&s.deregister&&s.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function qP(e){const[t,n]=I6(),s=g.useContext(VT);return o.jsx(dZ,{...e,layoutGroup:s,switchLayoutGroup:g.useContext(U6),isPresent:t,safeToRemove:n})}const fZ={borderRadius:{...Ph,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ph,borderTopRightRadius:Ph,borderBottomLeftRadius:Ph,borderBottomRightRadius:Ph,boxShadow:uZ};function hZ(e,t,n){const s=Oi(e)?e:ym(e);return s.start(Ek("",s,t,n)),s.animation}function pZ(e){return e instanceof SVGElement&&e.tagName!=="svg"}const mZ=(e,t)=>e.depth-t.depth;class gZ{constructor(){this.children=[],this.isDirty=!1}add(t){ak(this.children,t),this.isDirty=!0}remove(t){ok(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(mZ),this.isDirty=!1,this.children.forEach(t)}}function bZ(e,t){const n=to.now(),s=({timestamp:i})=>{const r=i-n;r>=t&&(Wl(s),e(r-t))};return as.read(s,!0),()=>Wl(s)}const YP=["TopLeft","TopRight","BottomLeft","BottomRight"],yZ=YP.length,Uj=e=>typeof e=="string"?parseFloat(e):e,Fj=e=>typeof e=="number"||gt.test(e);function xZ(e,t,n,s,i,r){i?(e.opacity=vs(0,n.opacity!==void 0?n.opacity:1,EZ(s)),e.opacityExit=vs(t.opacity!==void 0?t.opacity:1,0,vZ(s))):r&&(e.opacity=vs(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,s));for(let a=0;ast?1:n(pf(e,t,s))}function Hj(e,t){e.min=t.min,e.max=t.max}function $r(e,t){Hj(e.x,t.x),Hj(e.y,t.y)}function zj(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Vj(e,t,n,s,i){return e-=t,e=Dy(e,1/n,s),i!==void 0&&(e=Dy(e,1/i,s)),e}function wZ(e,t=0,n=1,s=.5,i,r=e,a=e){if(eo.test(t)&&(t=parseFloat(t),t=vs(a.min,a.max,t/100)-a.min),typeof t!="number")return;let l=vs(r.min,r.max,s);e===r&&(l-=t),e.min=Vj(e.min,t,n,l,i),e.max=Vj(e.max,t,n,l,i)}function Gj(e,t,[n,s,i],r,a){wZ(e,t[n],t[s],t[i],t.scale,r,a)}const SZ=["x","scaleX","originX"],_Z=["y","scaleY","originY"];function Kj(e,t,n,s){Gj(e.x,t,SZ,n?n.x:void 0,s?s.x:void 0),Gj(e.y,t,_Z,n?n.y:void 0,s?s.y:void 0)}function qj(e){return e.translate===0&&e.scale===1}function XP(e){return qj(e.x)&&qj(e.y)}function Yj(e,t){return e.min===t.min&&e.max===t.max}function NZ(e,t){return Yj(e.x,t.x)&&Yj(e.y,t.y)}function Wj(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function QP(e,t){return Wj(e.x,t.x)&&Wj(e.y,t.y)}function Xj(e){return Rr(e.x)/Rr(e.y)}function Qj(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class TZ{constructor(){this.members=[]}add(t){ak(this.members,t),t.scheduleRender()}remove(t){if(ok(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 s;for(let i=n;i>=0;i--){const r=this.members[i];if(r.isPresent!==!1){s=r;break}}return s?(this.promote(s),!0):!1}promote(t,n){const s=this.lead;if(t!==s&&(this.prevLead=s,this.lead=t,t.show(),s)){s.instance&&s.scheduleRender(),t.scheduleRender(),t.resumeFrom=s,n&&(t.resumeFrom.preserveOpacity=!0),s.snapshot&&(t.snapshot=s.snapshot,t.snapshot.latestValues=s.animationValues||s.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:s}=t;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function kZ(e,t,n){let s="";const i=e.x.translate/t.x,r=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((i||r||a)&&(s=`translate3d(${i}px, ${r}px, ${a}px) `),(t.x!==1||t.y!==1)&&(s+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:m}=n;u&&(s=`perspective(${u}px) ${s}`),d&&(s+=`rotate(${d}deg) `),f&&(s+=`rotateX(${f}deg) `),h&&(s+=`rotateY(${h}deg) `),p&&(s+=`skewX(${p}deg) `),m&&(s+=`skewY(${m}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(s+=`scale(${l}, ${c})`),s||"none"}const kc={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},ap=typeof window<"u"&&window.MotionDebug!==void 0,_v=["","X","Y","Z"],AZ={visibility:"hidden"},Zj=1e3;let CZ=0;function Nv(e,t,n,s){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),s&&(s[e]=0))}function ZP(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=tP(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",as,!(i||r))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&ZP(s)}function JP({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(a={},l=t==null?void 0:t()){this.id=CZ++,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,ap&&(kc.totalNodes=kc.resolvedTargetDeltas=kc.recalculatedProjection=0),this.nodes.forEach(RZ),this.nodes.forEach(PZ),this.nodes.forEach(BZ),this.nodes.forEach(OZ),ap&&window.MotionDebug.record(kc)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;cthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=bZ(h,250),Cb.hasAnimatedSinceResize&&(Cb.hasAnimatedSinceResize=!1,this.nodes.forEach(eR))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||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()||zZ,{onLayoutAnimationStart:v,onLayoutAnimationComplete:y}=d.getProps(),x=!this.targetLayout||!QP(this.targetLayout,m)||p,E=!h&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||E||h&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,E);const w={...rk(b,"layout"),onPlay:v,onComplete:y};(d.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else h||eR(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,Wl(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(UZ),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&&ZP(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 c=0;c{const _=w/1e3;tR(f.x,a.x,_),tR(f.y,a.y,_),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Dp(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),$Z(this.relativeTarget,this.relativeTargetOrigin,h,_),E&&NZ(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=Ds()),$r(E,this.relativeTarget)),b&&(this.animationValues=d,xZ(d,u,this.latestValues,_,x,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=_},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&&(Wl(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=as.update(()=>{Cb.hasAnimatedSinceResize=!0,this.currentAnimation=hZ(0,Zj,{...a,onUpdate:l=>{this.mixTargetDelta(l),a.onUpdate&&a.onUpdate(l)},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(Zj),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=a;if(!(!l||!c||!u)){if(this!==a&&this.layout&&u&&eB(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||Ds();const f=Rr(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const h=Rr(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+h}$r(l,c),Ad(l,d),Lp(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new TZ),this.sharedNodes.get(a).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:l}=this.options;return l?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:l}=this.options;return l?(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:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let l=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&Nv("z",a,u,this.animationValues);for(let d=0;d<_v.length;d++)Nv(`rotate${_v[d]}`,a,u,this.animationValues),Nv(`skew${_v[d]}`,a,u,this.animationValues);a.render();for(const d in u)a.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);a.scheduleRender()}getProjectionStyles(a){var l,c;if(!this.instance||this.isSVG)return;if(!this.isVisible)return AZ;const u={visibility:""},d=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=kb(a==null?void 0:a.pointerEvents)||"",u.transform=d?d(this.latestValues,""):"none",u;const f=this.getLead();if(!this.projectionDelta||!this.layout||!f.target){const b={};return this.options.layoutId&&(b.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,b.pointerEvents=kb(a==null?void 0:a.pointerEvents)||""),this.hasProjected&&!Tc(this.latestValues)&&(b.transform=d?d({},""):"none",this.hasProjected=!1),b}const h=f.animationValues||f.latestValues;this.applyTransformsToTarget(),u.transform=kZ(this.projectionDeltaWithTransform,this.treeScale,h),d&&(u.transform=d(h,u.transform));const{x:p,y:m}=this.projectionDelta;u.transformOrigin=`${p.origin*100}% ${m.origin*100}% 0`,f.animationValues?u.opacity=f===this?(c=(l=h.opacity)!==null&&l!==void 0?l:this.latestValues.opacity)!==null&&c!==void 0?c:1:this.preserveOpacity?this.latestValues.opacity:h.opacityExit:u.opacity=f===this?h.opacity!==void 0?h.opacity:"":h.opacityExit!==void 0?h.opacityExit:0;for(const b in jy){if(h[b]===void 0)continue;const{correct:v,applyTo:y}=jy[b],x=u.transform==="none"?h[b]:v(h[b],f);if(y){const E=y.length;for(let w=0;w{var l;return(l=a.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(Jj),this.root.sharedNodes.clear()}}}function IZ(e){e.updateLayout()}function jZ(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:s,measuredBox:i}=e.layout,{animationType:r}=e.options,a=n.source!==e.layout.source;r==="size"?Hr(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=Rr(h);h.min=s[f].min,h.max=h.min+p}):eB(r,n.layoutBox,s)&&Hr(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=Rr(s[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const l=Td();Lp(l,s,n.layoutBox);const c=Td();a?Lp(c,e.applyTransform(i,!0),n.measuredBox):Lp(c,s,n.layoutBox);const u=!XP(l);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=Ds();Dp(m,n.layoutBox,h.layoutBox);const b=Ds();Dp(b,s,p.layoutBox),QP(m,b)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=b,e.relativeTargetOrigin=m,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function RZ(e){ap&&kc.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 OZ(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function MZ(e){e.clearSnapshot()}function Jj(e){e.clearMeasurements()}function LZ(e){e.isLayoutDirty=!1}function DZ(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function eR(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function PZ(e){e.resolveTargetDelta()}function BZ(e){e.calcProjection()}function UZ(e){e.resetSkewAndRotation()}function FZ(e){e.removeLeadSnapshot()}function tR(e,t,n){e.translate=vs(t.translate,0,n),e.scale=vs(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function nR(e,t,n,s){e.min=vs(t.min,n.min,s),e.max=vs(t.max,n.max,s)}function $Z(e,t,n,s){nR(e.x,t.x,n.x,s),nR(e.y,t.y,n.y,s)}function HZ(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const zZ={duration:.45,ease:[.4,0,.1,1]},sR=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),iR=sR("applewebkit/")&&!sR("chrome/")?Math.round:Ar;function rR(e){e.min=iR(e.min),e.max=iR(e.max)}function VZ(e){rR(e.x),rR(e.y)}function eB(e,t,n){return e==="position"||e==="preserve-aspect"&&!qQ(Xj(t),Xj(n),.2)}function GZ(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const KZ=JP({attachResizeListener:(e,t)=>Em(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Tv={current:void 0},tB=JP({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Tv.current){const e=new KZ({});e.mount(window),e.setOptions({layoutScroll:!0}),Tv.current=e}return Tv.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),qZ={pan:{Feature:cZ},drag:{Feature:lZ,ProjectionNode:tB,MeasureLayout:qP}};function YZ(e,t,n){var s;if(e instanceof Element)return[e];if(typeof e=="string"){let i=document;const r=(s=void 0)!==null&&s!==void 0?s:i.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e)}function nB(e,t){const n=YZ(e),s=new AbortController,i={passive:!0,...t,signal:s.signal};return[n,i,()=>s.abort()]}function aR(e){return t=>{t.pointerType==="touch"||PP()||e(t)}}function WZ(e,t,n={}){const[s,i,r]=nB(e,n),a=aR(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const d=aR(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,i)});return s.forEach(l=>{l.addEventListener("pointerenter",a,i)}),r}function oR(e,t,n){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,r=s[i];r&&as.postRender(()=>r(t,cg(t)))}class XZ extends sc{mount(){const{current:t}=this.node;t&&(this.unmount=WZ(t,n=>(oR(this.node,n,"Start"),s=>oR(this.node,s,"End"))))}unmount(){}}class QZ extends sc{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=lg(Em(this.node.current,"focus",()=>this.onFocus()),Em(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const sB=(e,t)=>t?e===t?!0:sB(e,t.parentElement):!1,ZZ=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function JZ(e){return ZZ.has(e.tagName)||e.tabIndex!==-1}const op=new WeakSet;function lR(e){return t=>{t.key==="Enter"&&e(t)}}function kv(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const eJ=(e,t)=>{const n=e.currentTarget;if(!n)return;const s=lR(()=>{if(op.has(n))return;kv(n,"down");const i=lR(()=>{kv(n,"up")}),r=()=>kv(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",r,t)});n.addEventListener("keydown",s,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),t)};function cR(e){return vk(e)&&!PP()}function tJ(e,t,n={}){const[s,i,r]=nB(e,n),a=l=>{const c=l.currentTarget;if(!cR(l)||op.has(c))return;op.add(c);const u=t(l),d=(p,m)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!cR(p)||!op.has(c))&&(op.delete(c),typeof u=="function"&&u(p,{success:m}))},f=p=>{d(p,n.useGlobalTarget||sB(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",h,i)};return s.forEach(l=>{!JZ(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",a,i),l.addEventListener("focus",u=>eJ(u,i),i)}),r}function uR(e,t,n){const{props:s}=e;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),r=s[i];r&&as.postRender(()=>r(t,cg(t)))}class nJ extends sc{mount(){const{current:t}=this.node;t&&(this.unmount=tJ(t,n=>(uR(this.node,n,"Start"),(s,{success:i})=>uR(this.node,s,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const a_=new WeakMap,Av=new WeakMap,sJ=e=>{const t=a_.get(e.target);t&&t(e)},iJ=e=>{e.forEach(sJ)};function rJ({root:e,...t}){const n=e||document;Av.has(n)||Av.set(n,{});const s=Av.get(n),i=JSON.stringify(t);return s[i]||(s[i]=new IntersectionObserver(iJ,{root:e,...t})),s[i]}function aJ(e,t,n){const s=rJ(t);return a_.set(e,n),s.observe(e),()=>{a_.delete(e),s.unobserve(e)}}const oJ={some:0,all:1};class lJ extends sc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:r}=t,a={root:n?n.current:void 0,rootMargin:s,threshold:typeof i=="number"?i:oJ[i]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,r&&!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(c)};return aJ(this.node.current,a,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(cJ(t,n))&&this.startObserver()}unmount(){}}function cJ({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const uJ={inView:{Feature:lJ},tap:{Feature:nJ},focus:{Feature:QZ},hover:{Feature:XZ}},dJ={layout:{ProjectionNode:tB,MeasureLayout:qP}},o_={current:null},iB={current:!1};function fJ(){if(iB.current=!0,!!GT)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>o_.current=e.matches;e.addListener(t),t()}else o_.current=!1}const hJ=[...NP,Ri,Xl],pJ=e=>hJ.find(_P(e)),dR=new WeakMap;function mJ(e,t,n){for(const s in t){const i=t[s],r=n[s];if(Oi(i))e.addValue(s,i);else if(Oi(r))e.addValue(s,ym(i,{owner:e}));else if(r!==i)if(e.hasValue(s)){const a=e.getValue(s);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=e.getStaticValue(s);e.addValue(s,ym(a!==void 0?a:i,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const fR=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class gJ{scrapeMotionValuesFromProps(t,n,s){return{}}constructor({parent:t,props:n,presenceContext:s,reducedMotionConfig:i,blockInitialAnimation:r,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=bk,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=to.now();this.renderScheduledAtthis.bindToMotionValue(s,n)),iB.current||fJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:o_.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){dR.delete(this.current),this.projection&&this.projection.unmount(),Wl(this.notifyUpdate),Wl(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 s=wu.has(t),i=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&as.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0)}),r=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),r(),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 hf){const n=hf[t];if(!n)continue;const{isEnabled:s,Feature:i}=n;if(!this.features[t]&&i&&s(this.props)&&(this.features[t]=new i(this)),this.features[t]){const r=this.features[t];r.isMounted?r.update():(r.mount(),r.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ds()}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 s=0;sn.variantChildren.delete(t)}addValue(t,n){const s=this.values.get(t);n!==s&&(s&&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 s=this.values.get(t);return s===void 0&&n!==void 0&&(s=ym(n===null?void 0:n,{owner:this}),this.addValue(t,s)),s}readValue(t,n){var s;let i=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(s=this.getBaseTargetFromProps(this.props,t))!==null&&s!==void 0?s:this.readValueFromInstance(this.current,t,this.options);return i!=null&&(typeof i=="string"&&(wP(i)||hP(i))?i=parseFloat(i):!pJ(i)&&Xl.test(n)&&(i=xP(t,n)),this.setBaseTarget(t,Oi(i)?i.get():i)),Oi(i)?i.get():i}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:s}=this.props;let i;if(typeof s=="string"||typeof s=="object"){const a=QT(this.props,s,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(i=a[t])}if(s&&i!==void 0)return i;const r=this.getBaseTargetFromProps(this.props,t);return r!==void 0&&!Oi(r)?r:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new lk),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class rB extends gJ{constructor(){super(...arguments),this.KeyframeResolver=TP}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:s}){delete n[t],delete s[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Oi(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function bJ(e){return window.getComputedStyle(e)}class yJ extends rB{constructor(){super(...arguments),this.type="html",this.renderInstance=K6}readValueFromInstance(t,n){if(wu.has(n)){const s=gk(n);return s&&s.default||0}else{const s=bJ(t),i=(z6(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return GP(t,n)}build(t,n,s){ek(t,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,n,s){return ik(t,n,s)}}class xJ extends rB{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ds}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(wu.has(n)){const s=gk(n);return s&&s.default||0}return n=q6.has(n)?n:YT(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,s){return X6(t,n,s)}build(t,n,s){tk(t,n,this.isSVGTag,s.transformTemplate)}renderInstance(t,n,s,i){Y6(t,n,s,i)}mount(t){this.isSVGTag=sk(t.tagName),super.mount(t)}}const EJ=(e,t)=>XT(e)?new xJ(t):new yJ(t,{allowProjection:e!==g.Fragment}),vJ=KW({...PQ,...uJ,...qZ,...dJ},EJ),is=oW(vJ);function si(){return si=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?g.useEffect:g.useLayoutEffect;function rd(e,t,n){var s=g.useRef(t);s.current=t,g.useEffect(function(){function i(r){s.current(r)}return e&&window.addEventListener(e,i,n),function(){e&&window.removeEventListener(e,i)}},[e])}var wJ=["container"];function SJ(e){var t=e.container,n=t===void 0?document.body:t,s=Qx(e,wJ);return hi.createPortal(Bt.createElement("div",si({},s)),n)}function _J(e){return Bt.createElement("svg",si({width:"44",height:"44",viewBox:"0 0 768 768"},e),Bt.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 NJ(e){return Bt.createElement("svg",si({width:"44",height:"44",viewBox:"0 0 768 768"},e),Bt.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 TJ(e){return Bt.createElement("svg",si({width:"44",height:"44",viewBox:"0 0 768 768"},e),Bt.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function kJ(){return g.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function pR(e){var t=e.touches[0],n=t.clientX,s=t.clientY;if(e.touches.length>=2){var i=e.touches[1],r=i.clientX,a=i.clientY;return[(n+r)/2,(s+a)/2,Math.sqrt(Math.pow(r-n,2)+Math.pow(a-s,2))]}return[n,s,0]}var yl=function(e,t,n,s){var i,r=n*t,a=(r-s)/2,l=e;return r<=s?(i=1,l=0):e>0&&a-e<=0?(i=2,l=a):e<0&&a+e<=0&&(i=3,l=-a),[i,l]};function Cv(e,t,n,s,i,r,a,l,c,u){a===void 0&&(a=innerWidth/2),l===void 0&&(l=innerHeight/2),c===void 0&&(c=0),u===void 0&&(u=0);var d=yl(e,r,n,innerWidth)[0],f=yl(t,r,s,innerHeight),h=innerWidth/2,p=innerHeight/2;return{x:a-r/i*(a-(h+e))-h+(s/n>=3&&n*r===innerWidth?0:d?c/2:c),y:l-r/i*(l-(p+t))-p+(f[0]?u/2:u),lastCX:a,lastCY:l}}function u_(e,t,n){var s=e%180!=0;return s?[n,t,s]:[t,n,s]}function Iv(e,t,n){var s=u_(n,innerWidth,innerHeight),i=s[0],r=s[1],a=0,l=i,c=r,u=e/t*r,d=t/e*i;return e=r?l=u:e>=i&&ti/r?c=d:t/e>=3&&!s[2]?a=((c=d)-r)/2:l=u,{width:l,height:c,x:0,y:a,pause:!0}}function C0(e,t){var n=t.leading,s=n!==void 0&&n,i=t.maxWait,r=t.wait,a=r===void 0?i||0:r,l=g.useRef(e);l.current=e;var c=g.useRef(0),u=g.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=g.useCallback(function(){var h=[].slice.call(arguments),p=Date.now();function m(){c.current=p,d(),l.current.apply(null,h)}var b=c.current,v=p-b;if(b===0&&(s&&m(),c.current=p),i!==void 0){if(v>i)return void m()}else v=1&&r&&r())};d()}function d(){c=requestAnimationFrame(u)}}var CJ={T:0,L:0,W:0,H:0,FIT:void 0},oB=function(){var e=g.useRef(!1);return g.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},IJ=["className"];function jJ(e){var t=e.className,n=t===void 0?"":t,s=Qx(e,IJ);return Bt.createElement("div",si({className:"PhotoView__Spinner "+n},s),Bt.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},Bt.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"}),Bt.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var RJ=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function OJ(e){var t=e.src,n=e.loaded,s=e.broken,i=e.className,r=e.onPhotoLoad,a=e.loadingElement,l=e.brokenElement,c=Qx(e,RJ),u=oB();return t&&!s?Bt.createElement(Bt.Fragment,null,Bt.createElement("img",si({className:"PhotoView__Photo"+(i?" "+i:""),src:t,onLoad:function(d){var f=d.target;u.current&&r({loaded:!0,naturalWidth:f.naturalWidth,naturalHeight:f.naturalHeight})},onError:function(){u.current&&r({broken:!0})},draggable:!1,alt:""},c)),!n&&(a?Bt.createElement("span",{className:"PhotoView__icon"},a):Bt.createElement(jJ,{className:"PhotoView__icon"}))):l?Bt.createElement("span",{className:"PhotoView__icon"},typeof l=="function"?l({src:t}):l):null}var MJ={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 LJ(e){var t=e.item,n=t.src,s=t.render,i=t.width,r=i===void 0?0:i,a=t.height,l=a===void 0?0:a,c=t.originRef,u=e.visible,d=e.speed,f=e.easing,h=e.wrapClassName,p=e.className,m=e.style,b=e.loadingElement,v=e.brokenElement,y=e.onPhotoTap,x=e.onMaskTap,E=e.onReachMove,w=e.onReachUp,_=e.onPhotoResize,S=e.isActive,k=e.expose,T=Py(MJ),C=T[0],I=T[1],j=g.useRef(0),L=oB(),z=C.naturalWidth,D=z===void 0?r:z,F=C.naturalHeight,A=F===void 0?l:F,O=C.width,P=O===void 0?r:O,$=C.height,R=$===void 0?l:$,Y=C.loaded,J=Y===void 0?!n:Y,U=C.broken,te=C.x,K=C.y,V=C.touched,W=C.stopRaf,q=C.maskTouched,ue=C.rotate,me=C.scale,Se=C.CX,de=C.CY,ge=C.lastX,Me=C.lastY,ve=C.lastCX,re=C.lastCY,ke=C.lastScale,we=C.touchTime,Je=C.touchLength,Le=C.pause,Ve=C.reach,_e=Kc({onScale:function(ye){return He(A0(ye))},onRotate:function(ye){ue!==ye&&(k({rotate:ye}),I(si({rotate:ye},Iv(D,A,ye))))}});function He(ye,Ze,xt){me!==ye&&(k({scale:ye}),I(si({scale:ye},Cv(te,K,P,R,me,ye,Ze,xt),ye<=1&&{x:0,y:0})))}var Pe=C0(function(ye,Ze,xt){if(xt===void 0&&(xt=0),(V||q)&&S){var rn=u_(ue,P,R),Hn=rn[0],ut=rn[1];if(xt===0&&j.current===0){var pt=Math.abs(ye-Se)<=20,gn=Math.abs(Ze-de)<=20;if(pt&&gn)return void I({lastCX:ye,lastCY:Ze});j.current=pt?Ze>de?3:2:1}var en,St=ye-ve,an=Ze-re;if(xt===0){var ls=yl(St+ge,me,Hn,innerWidth)[0],Rs=yl(an+Me,me,ut,innerHeight);en=function(Wn,bn,yn,Xn){return bn&&Wn===1||Xn==="x"?"x":yn&&Wn>1||Xn==="y"?"y":void 0}(j.current,ls,Rs[0],Ve),en!==void 0&&E(en,ye,Ze,me)}if(en==="x"||q)return void I({reach:"x"});var Rn=A0(me+(xt-Je)/100/2*me,D/P,.2);k({scale:Rn}),I(si({touchLength:xt,reach:en,scale:Rn},Cv(te,K,P,R,me,Rn,ye,Ze,St,an)))}},{maxWait:8});function qe(ye){return!W&&!V&&(L.current&&I(si({},ye,{pause:u})),L.current)}var Z,ae,ne,be,Fe,Ke,bt,dt,cn=(Fe=function(ye){return qe({x:ye})},Ke=function(ye){return qe({y:ye})},bt=function(ye){return L.current&&(k({scale:ye}),I({scale:ye})),!V&&L.current},dt=Kc({X:function(ye){return Fe(ye)},Y:function(ye){return Ke(ye)},S:function(ye){return bt(ye)}}),function(ye,Ze,xt,rn,Hn,ut,pt,gn,en,St,an){var ls=u_(St,Hn,ut),Rs=ls[0],Rn=ls[1],Wn=yl(ye,gn,Rs,innerWidth),bn=Wn[0],yn=Wn[1],Xn=yl(Ze,gn,Rn,innerHeight),zs=Xn[0],pi=Xn[1],bs=Date.now()-an;if(bs>=200||gn!==pt||Math.abs(en-pt)>1){var Js=Cv(ye,Ze,Hn,ut,pt,gn),On=Js.x,cs=Js.y,Qn=bn?yn:On!==ye?On:null,us=zs?pi:cs!==Ze?cs:null;return Qn!==null&&Oc(ye,Qn,dt.X),us!==null&&Oc(Ze,us,dt.Y),void(gn!==pt&&Oc(pt,gn,dt.S))}var Os=(ye-xt)/bs,Ms=(Ze-rn)/bs,Ss=Math.sqrt(Math.pow(Os,2)+Math.pow(Ms,2)),_s=!1,un=!1;(function(on,dn){var ce,Ie=on,Ue=0,nt=0,at=function(De){ce||(ce=De);var xn=De-ce,Zn=Math.sign(on),ki=-.001*Zn,zn=Math.sign(-Ie)*Math.pow(Ie,2)*2e-4,Ht=Ie*xn+(ki+zn)*Math.pow(xn,2)/2;Ue+=Ht,ce=De,Zn*(Ie+=(ki+zn)*xn)<=0?_t():dn(Ue)?We():_t()};function We(){nt=requestAnimationFrame(at)}function _t(){cancelAnimationFrame(nt)}We()})(Ss,function(on){var dn=ye+on*(Os/Ss),ce=Ze+on*(Ms/Ss),Ie=yl(dn,pt,Rs,innerWidth),Ue=Ie[0],nt=Ie[1],at=yl(ce,pt,Rn,innerHeight),We=at[0],_t=at[1];if(Ue&&!_s&&(_s=!0,bn?Oc(dn,nt,dt.X):mR(nt,dn+(dn-nt),dt.X)),We&&!un&&(un=!0,zs?Oc(ce,_t,dt.Y):mR(_t,ce+(ce-_t),dt.Y)),_s&&un)return!1;var De=_s||dt.X(nt),xn=un||dt.Y(_t);return De&&xn})}),Ut=(Z=y,ae=function(ye,Ze){Ve||He(me!==1?1:Math.max(2,D/P),ye,Ze)},ne=g.useRef(0),be=C0(function(){ne.current=0,Z.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var ye=[].slice.call(arguments);ne.current+=1,be.apply(void 0,ye),ne.current>=2&&(be.cancel(),ne.current=0,ae.apply(void 0,ye))});function wt(ye,Ze){if(j.current=0,(V||q)&&S){I({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var xt=A0(me,D/P);if(cn(te,K,ge,Me,P,R,me,xt,ke,ue,we),w(ye,Ze),Se===ye&&de===Ze){if(V)return void Ut(ye,Ze);q&&x(ye,Ze)}}}function $t(ye,Ze,xt){xt===void 0&&(xt=0),I({touched:!0,CX:ye,CY:Ze,lastCX:ye,lastCY:Ze,lastX:te,lastY:K,lastScale:me,touchLength:xt,touchTime:Date.now()})}function Ge(ye){I({maskTouched:!0,CX:ye.clientX,CY:ye.clientY,lastX:te,lastY:K})}rd(_o?void 0:"mousemove",function(ye){ye.preventDefault(),Pe(ye.clientX,ye.clientY)}),rd(_o?void 0:"mouseup",function(ye){wt(ye.clientX,ye.clientY)}),rd(_o?"touchmove":void 0,function(ye){ye.preventDefault();var Ze=pR(ye);Pe.apply(void 0,Ze)},{passive:!1}),rd(_o?"touchend":void 0,function(ye){var Ze=ye.changedTouches[0];wt(Ze.clientX,Ze.clientY)},{passive:!1}),rd("resize",C0(function(){J&&!V&&(I(Iv(D,A,ue)),_())},{maxWait:8})),c_(function(){S&&k(si({scale:me,rotate:ue},_e))},[S]);var Yt=function(ye,Ze,xt,rn,Hn,ut,pt,gn,en,St){var an=function(On,cs,Qn,us,Os){var Ms=g.useRef(!1),Ss=Py({lead:!0,scale:Qn}),_s=Ss[0],un=_s.lead,on=_s.scale,dn=Ss[1],ce=C0(function(Ie){try{return Os(!0),dn({lead:!1,scale:Ie}),Promise.resolve()}catch(Ue){return Promise.reject(Ue)}},{wait:us});return c_(function(){Ms.current?(Os(!1),dn({lead:!0}),ce(Qn)):Ms.current=!0},[Qn]),un?[On*on,cs*on,Qn/on]:[On*Qn,cs*Qn,1]}(ut,pt,gn,en,St),ls=an[0],Rs=an[1],Rn=an[2],Wn=function(On,cs,Qn,us,Os){var Ms=g.useState(CJ),Ss=Ms[0],_s=Ms[1],un=g.useState(0),on=un[0],dn=un[1],ce=g.useRef(),Ie=Kc({OK:function(){return On&&dn(4)}});function Ue(nt){Os(!1),dn(nt)}return g.useEffect(function(){if(ce.current||(ce.current=Date.now()),Qn){if(function(nt,at){var We=nt&&nt.current;if(We&&We.nodeType===1){var _t=We.getBoundingClientRect();at({T:_t.top,L:_t.left,W:_t.width,H:_t.height,FIT:We.tagName==="IMG"?getComputedStyle(We).objectFit:void 0})}}(cs,_s),On)return Date.now()-ce.current<250?(dn(1),requestAnimationFrame(function(){dn(2),requestAnimationFrame(function(){return Ue(3)})}),void setTimeout(Ie.OK,us)):void dn(4);Ue(5)}},[On,Qn]),[on,Ss]}(ye,Ze,xt,en,St),bn=Wn[0],yn=Wn[1],Xn=yn.W,zs=yn.FIT,pi=innerWidth/2,bs=innerHeight/2,Js=bn<3||bn>4;return[Js?Xn?yn.L:pi:rn+(pi-ut*gn/2),Js?Xn?yn.T:bs:Hn+(bs-pt*gn/2),ls,Js&&zs?ls*(yn.H/Xn):Rs,bn===0?Rn:Js?Xn/(ut*gn)||.01:Rn,Js?zs?1:0:1,bn,zs]}(u,c,J,te,K,P,R,me,d,function(ye){return I({pause:ye})}),it=Yt[4],ct=Yt[6],Qe="transform "+d+"ms "+f,vt={className:p,onMouseDown:_o?void 0:function(ye){ye.stopPropagation(),ye.button===0&&$t(ye.clientX,ye.clientY,0)},onTouchStart:_o?function(ye){ye.stopPropagation(),$t.apply(void 0,pR(ye))}:void 0,onWheel:function(ye){if(!Ve){var Ze=A0(me-ye.deltaY/100/2,D/P);I({stopRaf:!0}),He(Ze,ye.clientX,ye.clientY)}},style:{width:Yt[2]+"px",height:Yt[3]+"px",opacity:Yt[5],objectFit:ct===4?void 0:Yt[7],transform:ue?"rotate("+ue+"deg)":void 0,transition:ct>2?Qe+", opacity "+d+"ms ease, height "+(ct<4?d/2:ct>4?d:0)+"ms "+f:void 0}};return Bt.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:m,onMouseDown:!_o&&S?Ge:void 0,onTouchStart:_o&&S?function(ye){return Ge(ye.touches[0])}:void 0},Bt.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+it+", 0, 0, "+it+", "+Yt[0]+", "+Yt[1]+")",transition:V||Le?void 0:Qe,willChange:S?"transform":void 0}},n?Bt.createElement(OJ,si({src:n,loaded:J,broken:U},vt,{onPhotoLoad:function(ye){I(si({},ye,ye.loaded&&Iv(ye.naturalWidth||0,ye.naturalHeight||0,ue)))},loadingElement:b,brokenElement:v})):s&&s({attrs:vt,scale:it,rotate:ue})))}var gR={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 DJ(e){var t=e.loop,n=t===void 0?3:t,s=e.speed,i=e.easing,r=e.photoClosable,a=e.maskClosable,l=a===void 0||a,c=e.maskOpacity,u=c===void 0?1:c,d=e.pullClosable,f=d===void 0||d,h=e.bannerVisible,p=h===void 0||h,m=e.overlayRender,b=e.toolbarRender,v=e.className,y=e.maskClassName,x=e.photoClassName,E=e.photoWrapClassName,w=e.loadingElement,_=e.brokenElement,S=e.images,k=e.index,T=k===void 0?0:k,C=e.onIndexChange,I=e.visible,j=e.onClose,L=e.afterClose,z=e.portalContainer,D=Py(gR),F=D[0],A=D[1],O=g.useState(0),P=O[0],$=O[1],R=F.x,Y=F.touched,J=F.pause,U=F.lastCX,te=F.lastCY,K=F.bg,V=K===void 0?u:K,W=F.lastBg,q=F.overlay,ue=F.minimal,me=F.scale,Se=F.rotate,de=F.onScale,ge=F.onRotate,Me=e.hasOwnProperty("index"),ve=Me?T:P,re=Me?C:$,ke=g.useRef(ve),we=S.length,Je=S[ve],Le=typeof n=="boolean"?n:we>n,Ve=function(it,ct){var Qe=g.useReducer(function(xt){return!xt},!1)[1],vt=g.useRef(0),ye=function(xt){var rn=g.useRef(xt);function Hn(ut){rn.current=ut}return g.useMemo(function(){(function(ut){it?(ut(it),vt.current=1):vt.current=2})(Hn)},[xt]),[rn.current,Hn]}(it),Ze=ye[1];return[ye[0],vt.current,function(){Qe(),vt.current===2&&(Ze(!1),ct&&ct()),vt.current=0}]}(I,L),_e=Ve[0],He=Ve[1],Pe=Ve[2];c_(function(){if(_e)return A({pause:!0,x:ve*-(innerWidth+Vu)}),void(ke.current=ve);A(gR)},[_e]);var qe=Kc({close:function(it){ge&&ge(0),A({overlay:!0,lastBg:V}),j(it)},changeIndex:function(it,ct){ct===void 0&&(ct=!1);var Qe=Le?ke.current+(it-ve):it,vt=we-1,ye=l_(Qe,0,vt),Ze=Le?Qe:ye,xt=innerWidth+Vu;A({touched:!1,lastCX:void 0,lastCY:void 0,x:-xt*Ze,pause:ct}),ke.current=Ze,re&&re(Le?it<0?vt:it>vt?0:it:ye)}}),Z=qe.close,ae=qe.changeIndex;function ne(it){return it?Z():A({overlay:!q})}function be(){A({x:-(innerWidth+Vu)*ve,lastCX:void 0,lastCY:void 0,pause:!0}),ke.current=ve}function Fe(it,ct,Qe,vt){it==="x"?function(ye){if(U!==void 0){var Ze=ye-U,xt=Ze;!Le&&(ve===0&&Ze>0||ve===we-1&&Ze<0)&&(xt=Ze/2),A({touched:!0,lastCX:U,x:-(innerWidth+Vu)*ke.current+xt,pause:!1})}else A({touched:!0,lastCX:ye,x:R,pause:!1})}(ct):it==="y"&&function(ye,Ze){if(te!==void 0){var xt=u===null?null:l_(u,.01,u-Math.abs(ye-te)/100/4);A({touched:!0,lastCY:te,bg:Ze===1?xt:u,minimal:Ze===1})}else A({touched:!0,lastCY:ye,bg:V,minimal:!0})}(Qe,vt)}function Ke(it,ct){var Qe=it-(U??it),vt=ct-(te??ct),ye=!1;if(Qe<-40)ae(ve+1);else if(Qe>40)ae(ve-1);else{var Ze=-(innerWidth+Vu)*ke.current;Math.abs(vt)>100&&ue&&f&&(ye=!0,Z()),A({touched:!1,x:Ze,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!ye||q})}}rd("keydown",function(it){if(I)switch(it.key){case"ArrowLeft":ae(ve-1,!0);break;case"ArrowRight":ae(ve+1,!0);break;case"Escape":Z()}});var bt=function(it,ct,Qe){return g.useMemo(function(){var vt=it.length;return Qe?it.concat(it).concat(it).slice(vt+ct-1,vt+ct+2):it.slice(Math.max(ct-1,0),Math.min(ct+2,vt+1))},[it,ct,Qe])}(S,ve,Le);if(!_e)return null;var dt=q&&!He,cn=I?V:W,Ut=de&&ge&&{images:S,index:ve,visible:I,onClose:Z,onIndexChange:ae,overlayVisible:dt,overlay:Je&&Je.overlay,scale:me,rotate:Se,onScale:de,onRotate:ge},wt=s?s(He):400,$t=i?i(He):hR,Ge=s?s(3):600,Yt=i?i(3):hR;return Bt.createElement(SJ,{className:"PhotoView-Portal"+(dt?"":" PhotoView-Slider__clean")+(I?"":" PhotoView-Slider__willClose")+(v?" "+v:""),role:"dialog",onClick:function(it){return it.stopPropagation()},container:z},I&&Bt.createElement(kJ,null),Bt.createElement("div",{className:"PhotoView-Slider__Backdrop"+(y?" "+y:"")+(He===1?" PhotoView-Slider__fadeIn":He===2?" PhotoView-Slider__fadeOut":""),style:{background:cn?"rgba(0, 0, 0, "+cn+")":void 0,transitionTimingFunction:$t,transitionDuration:(Y?0:wt)+"ms",animationDuration:wt+"ms"},onAnimationEnd:Pe}),p&&Bt.createElement("div",{className:"PhotoView-Slider__BannerWrap"},Bt.createElement("div",{className:"PhotoView-Slider__Counter"},ve+1," / ",we),Bt.createElement("div",{className:"PhotoView-Slider__BannerRight"},b&&Ut&&b(Ut),Bt.createElement(_J,{className:"PhotoView-Slider__toolbarIcon",onClick:Z}))),bt.map(function(it,ct){var Qe=Le||ve!==0?ke.current-1+ct:ve+ct;return Bt.createElement(LJ,{key:Le?it.key+"/"+it.src+"/"+Qe:it.key,item:it,speed:wt,easing:$t,visible:I,onReachMove:Fe,onReachUp:Ke,onPhotoTap:function(){return ne(r)},onMaskTap:function(){return ne(l)},wrapClassName:E,className:x,style:{left:(innerWidth+Vu)*Qe+"px",transform:"translate3d("+R+"px, 0px, 0)",transition:Y||J?void 0:"transform "+Ge+"ms "+Yt},loadingElement:w,brokenElement:_,onPhotoResize:be,isActive:ke.current===Qe,expose:A})}),!_o&&p&&Bt.createElement(Bt.Fragment,null,(Le||ve!==0)&&Bt.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return ae(ve-1,!0)}},Bt.createElement(NJ,null)),(Le||ve+1-1){var y=u.slice();return y.splice(v,1,b),void l({images:y})}l(function(x){return{images:x.images.concat(b)}})},remove:function(b){l(function(v){var y=v.images.filter(function(x){return x.key!==b});return{images:y,index:Math.min(y.length-1,f)}})},show:function(b){var v=u.findIndex(function(y){return y.key===b});l({visible:!0,index:v}),s&&s(!0,v,a)}}),p=Kc({close:function(){l({visible:!1}),s&&s(!1,f,a)},changeIndex:function(b){l({index:b}),n&&n(b,a)}}),m=g.useMemo(function(){return si({},a,h)},[a,h]);return Bt.createElement(aB.Provider,{value:m},t,Bt.createElement(DJ,si({images:u,visible:d,index:f,onIndexChange:p.changeIndex,onClose:p.close},i)))}var lB=function(e){var t,n,s=e.src,i=e.render,r=e.overlay,a=e.width,l=e.height,c=e.triggers,u=c===void 0?["onClick"]:c,d=e.children,f=g.useContext(aB),h=(t=function(){return f.nextId()},(n=g.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),p=g.useRef(null);g.useImperativeHandle(d==null?void 0:d.ref,function(){return p.current}),g.useEffect(function(){return function(){f.remove(h)}},[]);var m=Kc({render:function(v){return i&&i(v)},show:function(v,y){f.show(h),function(x,E){if(d){var w=d.props[x];w&&w(E)}}(v,y)}}),b=g.useMemo(function(){var v={};return u.forEach(function(y){v[y]=m.show.bind(null,y)}),v},[]);return g.useEffect(function(){f.update({key:h,src:s,originRef:p,render:m.render,overlay:r,width:a,height:l})},[s]),d?g.Children.only(g.cloneElement(d,si({},b,{ref:p}))):null};/** + `),()=>{document.head.removeChild(d)}},[t]),o.jsx(eW,{isPresent:t,childRef:s,sizeRef:i,children:g.cloneElement(e,{ref:s})})}const nW=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:i,presenceAffectsLayout:r,mode:a})=>{const l=Kx(sW),c=g.useId(),u=g.useCallback(f=>{l.set(f,!0);for(const h of l.values())if(!h)return;s&&s()},[l,s]),d=g.useMemo(()=>({id:c,initial:t,isPresent:n,custom:i,onExitComplete:u,register:f=>(l.set(f,!1),()=>l.delete(f))}),r?[Math.random(),u]:[n,u]);return g.useMemo(()=>{l.forEach((f,h)=>l.set(h,!1))},[n]),g.useEffect(()=>{!n&&!l.size&&s&&s()},[n]),a==="popLayout"&&(e=o.jsx(tW,{isPresent:n,children:e})),o.jsx(qx.Provider,{value:d,children:e})};function sW(){return new Map}function M6(e=!0){const t=g.useContext(qx);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:i}=t,r=g.useId();g.useEffect(()=>{e&&i(r)},[e]);const a=g.useCallback(()=>e&&s&&s(r),[r,s,e]);return!n&&s?[!1,a]:[!0]}const T0=e=>e.key||"";function nj(e){const t=[];return g.Children.forEach(e,n=>{g.isValidElement(n)&&t.push(n)}),t}const WT=typeof window<"u",L6=WT?g.useLayoutEffect:g.useEffect,Po=({children:e,custom:t,initial:n=!0,onExitComplete:s,presenceAffectsLayout:i=!0,mode:r="sync",propagate:a=!1})=>{const[l,c]=M6(a),u=g.useMemo(()=>nj(e),[e]),d=a&&!l?[]:u.map(T0),f=g.useRef(!0),h=g.useRef(u),p=Kx(()=>new Map),[m,b]=g.useState(u),[v,y]=g.useState(u);L6(()=>{f.current=!1,h.current=u;for(let w=0;w{const _=T0(w),S=a&&!l?!1:u===v||d.includes(_),k=()=>{if(p.has(_))p.set(_,!0);else return;let T=!0;p.forEach(C=>{C||(T=!1)}),T&&(E==null||E(),y(h.current),a&&(c==null||c()),s&&s())};return o.jsx(nW,{isPresent:S,initial:!f.current||n?void 0:!1,custom:S?void 0:t,presenceAffectsLayout:i,mode:r,onExitComplete:S?void 0:k,children:w},_)})})},Ar=e=>e;let D6=Ar;const iW={useManualTiming:!1};function rW(e){let t=new Set,n=new Set,s=!1,i=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(u){r.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,f=!1)=>{const p=f&&s?t:n;return d&&r.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),r.delete(u)},process:u=>{if(a=u,s){i=!0;return}s=!0,[t,n]=[n,t],t.forEach(l),t.clear(),s=!1,i&&(i=!1,c.process(u))}};return c}const k0=["read","resolveKeyframes","update","preRender","render","postRender"],aW=40;function P6(e,t){let n=!1,s=!0;const i={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,a=k0.reduce((y,x)=>(y[x]=rW(r),y),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=a,p=()=>{const y=performance.now();n=!1,i.delta=s?1e3/60:Math.max(Math.min(y-i.timestamp,aW),1),i.timestamp=y,i.isProcessing=!0,l.process(i),c.process(i),u.process(i),d.process(i),f.process(i),h.process(i),i.isProcessing=!1,n&&t&&(s=!1,e(p))},m=()=>{n=!0,s=!0,i.isProcessing||e(p)};return{schedule:k0.reduce((y,x)=>{const E=a[x];return y[x]=(w,_=!1,S=!1)=>(n||m(),E.schedule(w,_,S)),y},{}),cancel:y=>{for(let x=0;xsj[e].some(n=>!!t[n])};function oW(e){for(const t in e)mf[t]={...mf[t],...e[t]}}const lW=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 Ry(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||lW.has(e)}let U6=e=>!Ry(e);function F6(e){e&&(U6=t=>t.startsWith("on")?!Ry(t):e(t))}try{F6(require("@emotion/is-prop-valid").default)}catch{}function cW(e,t,n){const s={};for(const i in e)i==="values"&&typeof e.values=="object"||(U6(i)||n===!0&&Ry(i)||!t&&!Ry(i)||e.draggable&&i.startsWith("onDrag"))&&(s[i]=e[i]);return s}function uW({children:e,isValidProp:t,...n}){t&&F6(t),n={...g.useContext(pm),...n},n.isStatic=Kx(()=>n.isStatic);const s=g.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return o.jsx(pm.Provider,{value:s,children:e})}function dW(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...s)=>e(...s);return new Proxy(n,{get:(s,i)=>i==="create"?e:(t.has(i)||t.set(i,e(i)),t.get(i))})}const Yx=g.createContext({});function mm(e){return typeof e=="string"||Array.isArray(e)}function Wx(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const XT=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],QT=["initial",...XT];function Xx(e){return Wx(e.animate)||QT.some(t=>mm(e[t]))}function $6(e){return!!(Xx(e)||e.variants)}function fW(e,t){if(Xx(e)){const{initial:n,animate:s}=e;return{initial:n===!1||mm(n)?n:void 0,animate:mm(s)?s:void 0}}return e.inherit!==!1?t:{}}function hW(e){const{initial:t,animate:n}=fW(e,g.useContext(Yx));return g.useMemo(()=>({initial:t,animate:n}),[ij(t),ij(n)])}function ij(e){return Array.isArray(e)?e.join(" "):e}const pW=Symbol.for("motionComponentSymbol");function Td(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function mW(e,t,n){return g.useCallback(s=>{s&&e.onMount&&e.onMount(s),t&&(s?t.mount(s):t.unmount()),n&&(typeof n=="function"?n(s):Td(n)&&(n.current=s))},[t])}const ZT=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),gW="framerAppearId",H6="data-"+ZT(gW),{schedule:JT}=P6(queueMicrotask,!1),z6=g.createContext({});function bW(e,t,n,s,i){var r,a;const{visualElement:l}=g.useContext(Yx),c=g.useContext(B6),u=g.useContext(qx),d=g.useContext(pm).reducedMotion,f=g.useRef(null);s=s||c.renderer,!f.current&&s&&(f.current=s(e,{visualState:t,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,p=g.useContext(z6);h&&!h.projection&&i&&(h.type==="html"||h.type==="svg")&&yW(f.current,n,i,p);const m=g.useRef(!1);g.useInsertionEffect(()=>{h&&m.current&&h.update(n,u)});const b=n[H6],v=g.useRef(!!b&&!(!((r=window.MotionHandoffIsComplete)===null||r===void 0)&&r.call(window,b))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,b)));return L6(()=>{h&&(m.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),JT.render(h.render),v.current&&h.animationState&&h.animationState.animateChanges())}),g.useEffect(()=>{h&&(!v.current&&h.animationState&&h.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,b)}),v.current=!1))}),h}function yW(e,t,n,s){const{layoutId:i,layout:r,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:V6(e.parent)),e.projection.setOptions({layoutId:i,layout:r,alwaysMeasureLayout:!!a||l&&Td(l),visualElement:e,animationType:typeof r=="string"?r:"both",initialPromotionConfig:s,layoutScroll:c,layoutRoot:u})}function V6(e){if(e)return e.options.allowProjection!==!1?e.projection:V6(e.parent)}function xW({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:s,Component:i}){var r,a;e&&oW(e);function l(u,d){let f;const h={...g.useContext(pm),...u,layoutId:EW(u)},{isStatic:p}=h,m=hW(u),b=s(u,p);if(!p&&WT){vW();const v=wW(h);f=v.MeasureLayout,m.visualElement=bW(i,b,h,t,v.ProjectionNode)}return o.jsxs(Yx.Provider,{value:m,children:[f&&m.visualElement?o.jsx(f,{visualElement:m.visualElement,...h}):null,n(i,u,mW(b,m.visualElement,d),b,p,m.visualElement)]})}l.displayName=`motion.${typeof i=="string"?i:`create(${(a=(r=i.displayName)!==null&&r!==void 0?r:i.name)!==null&&a!==void 0?a:""})`}`;const c=g.forwardRef(l);return c[pW]=i,c}function EW({layoutId:e}){const t=g.useContext(YT).id;return t&&e!==void 0?t+"-"+e:e}function vW(e,t){g.useContext(B6).strict}function wW(e){const{drag:t,layout:n}=mf;if(!t&&!n)return{};const s={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}const SW=["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 ek(e){return typeof e!="string"||e.includes("-")?!1:!!(SW.indexOf(e)>-1||/[A-Z]/u.test(e))}function rj(e){const t=[{},{}];return e==null||e.values.forEach((n,s)=>{t[0][s]=n.get(),t[1][s]=n.getVelocity()}),t}function tk(e,t,n,s){if(typeof t=="function"){const[i,r]=rj(s);t=t(n!==void 0?n:e.custom,i,r)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,r]=rj(s);t=t(n!==void 0?n:e.custom,i,r)}return t}const XS=e=>Array.isArray(e),_W=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),NW=e=>XS(e)?e[e.length-1]||0:e,Ri=e=>!!(e&&e.getVelocity);function Cb(e){const t=Ri(e)?e.get():e;return _W(t)?t.toValue():t}function TW({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},s,i,r){const a={latestValues:kW(s,i,r,e),renderState:t()};return n&&(a.onMount=l=>n({props:s,current:l,...a}),a.onUpdate=l=>n(l)),a}const G6=e=>(t,n)=>{const s=g.useContext(Yx),i=g.useContext(qx),r=()=>TW(e,t,s,i);return n?r():Kx(r)};function kW(e,t,n,s){const i={},r=s(e,{});for(const h in r)i[h]=Cb(r[h]);let{initial:a,animate:l}=e;const c=Xx(e),u=$6(e);t&&u&&!c&&e.inherit!==!1&&(a===void 0&&(a=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const f=d?l:a;if(f&&typeof f!="boolean"&&!Wx(f)){const h=Array.isArray(f)?f:[f];for(let p=0;pt=>typeof t=="string"&&t.startsWith(e),q6=K6("--"),AW=K6("var(--"),nk=e=>AW(e)?CW.test(e.split("/*")[0].trim()):!1,CW=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Y6=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Jo=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},gm={...Wf,transform:e=>Jo(0,1,e)},A0={...Wf,default:1},rg=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),yl=rg("deg"),eo=rg("%"),yt=rg("px"),IW=rg("vh"),jW=rg("vw"),aj={...eo,parse:e=>eo.parse(e)/100,transform:e=>eo.transform(e*100)},RW={borderWidth:yt,borderTopWidth:yt,borderRightWidth:yt,borderBottomWidth:yt,borderLeftWidth:yt,borderRadius:yt,radius:yt,borderTopLeftRadius:yt,borderTopRightRadius:yt,borderBottomRightRadius:yt,borderBottomLeftRadius:yt,width:yt,maxWidth:yt,height:yt,maxHeight:yt,top:yt,right:yt,bottom:yt,left:yt,padding:yt,paddingTop:yt,paddingRight:yt,paddingBottom:yt,paddingLeft:yt,margin:yt,marginTop:yt,marginRight:yt,marginBottom:yt,marginLeft:yt,backgroundPositionX:yt,backgroundPositionY:yt},OW={rotate:yl,rotateX:yl,rotateY:yl,rotateZ:yl,scale:A0,scaleX:A0,scaleY:A0,scaleZ:A0,skew:yl,skewX:yl,skewY:yl,distance:yt,translateX:yt,translateY:yt,translateZ:yt,x:yt,y:yt,z:yt,perspective:yt,transformPerspective:yt,opacity:gm,originX:aj,originY:aj,originZ:yt},oj={...Wf,transform:Math.round},sk={...RW,...OW,zIndex:oj,size:yt,fillOpacity:gm,strokeOpacity:gm,numOctaves:oj},MW={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},LW=Yf.length;function DW(e,t,n){let s="",i=!0;for(let r=0;r({style:{},transform:{},transformOrigin:{},vars:{}}),W6=()=>({...ak(),attrs:{}}),ok=e=>typeof e=="string"&&e.toLowerCase()==="svg";function X6(e,{style:t,vars:n},s,i){Object.assign(e.style,t,i&&i.getProjectionStyles(s));for(const r in n)e.style.setProperty(r,n[r])}const Q6=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 Z6(e,t,n,s){X6(e,t,void 0,s);for(const i in t.attrs)e.setAttribute(Q6.has(i)?i:ZT(i),t.attrs[i])}const Oy={};function $W(e){Object.assign(Oy,e)}function J6(e,{layout:t,layoutId:n}){return Su.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Oy[e]||e==="opacity")}function lk(e,t,n){var s;const{style:i}=e,r={};for(const a in i)(Ri(i[a])||t.style&&Ri(t.style[a])||J6(a,e)||((s=n==null?void 0:n.getValue(a))===null||s===void 0?void 0:s.liveStyle)!==void 0)&&(r[a]=i[a]);return r}function eP(e,t,n){const s=lk(e,t,n);for(const i in e)if(Ri(e[i])||Ri(t[i])){const r=Yf.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;s[r]=e[i]}return s}function HW(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 cj=["x","y","width","height","cx","cy","r"],zW={useVisualState:G6({scrapeMotionValuesFromProps:eP,createRenderState:W6,onUpdate:({props:e,prevProps:t,current:n,renderState:s,latestValues:i})=>{if(!n)return;let r=!!e.drag;if(!r){for(const l in i)if(Su.has(l)){r=!0;break}}if(!r)return;let a=!t;if(t)for(let l=0;l{HW(n,s),ts.render(()=>{rk(s,i,ok(n.tagName),e.transformTemplate),Z6(n,s)})})}})},VW={useVisualState:G6({scrapeMotionValuesFromProps:lk,createRenderState:ak})};function tP(e,t,n){for(const s in t)!Ri(t[s])&&!J6(s,n)&&(e[s]=t[s])}function GW({transformTemplate:e},t){return g.useMemo(()=>{const n=ak();return ik(n,t,e),Object.assign({},n.vars,n.style)},[t])}function KW(e,t){const n=e.style||{},s={};return tP(s,n,e),Object.assign(s,GW(e,t)),s}function qW(e,t){const n={},s=KW(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.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=s,n}function YW(e,t,n,s){const i=g.useMemo(()=>{const r=W6();return rk(r,t,ok(s),e.transformTemplate),{...r.attrs,style:{...r.style}}},[t]);if(e.style){const r={};tP(r,e.style,e),i.style={...r,...i.style}}return i}function WW(e=!1){return(n,s,i,{latestValues:r},a)=>{const c=(ek(n)?YW:qW)(s,r,a,n),u=cW(s,typeof n=="string",e),d=n!==g.Fragment?{...u,...c,ref:i}:{},{children:f}=s,h=g.useMemo(()=>Ri(f)?f.get():f,[f]);return g.createElement(n,{...d,children:h})}}function XW(e,t){return function(s,{forwardMotionProps:i}={forwardMotionProps:!1}){const a={...ek(s)?zW:VW,preloadedFeatures:e,useRender:WW(i),createVisualElement:t,Component:s};return xW(a)}}function nP(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let s=0;s(Ib===void 0&&to.set(yi.isProcessing||iW.useManualTiming?yi.timestamp:performance.now()),Ib),set:e=>{Ib=e,queueMicrotask(QW)}};function uk(e,t){e.indexOf(t)===-1&&e.push(t)}function dk(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class fk{constructor(){this.subscriptions=[]}add(t){return uk(this.subscriptions,t),()=>dk(this.subscriptions,t)}notify(t,n,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,s);else for(let r=0;r!isNaN(parseFloat(e));class JW{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(s,i=!0)=>{const r=to.now();this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),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=to.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=ZW(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 fk);const s=this.events[t].add(n);return t==="change"?()=>{s(),ts.read(()=>{this.events.change.getSize()||this.stop()})}:s}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,s){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}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=to.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>uj)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,uj);return iP(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 bm(e,t){return new JW(e,t)}function eX(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,bm(n))}function tX(e,t){const n=Qx(e,t);let{transitionEnd:s={},transition:i={},...r}=n||{};r={...r,...s};for(const a in r){const l=NW(r[a]);eX(e,a,l)}}function nX(e){return!!(Ri(e)&&e.add)}function QS(e,t){const n=e.getValue("willChange");if(nX(n))return n.add(t)}function rP(e){return e.props[H6]}function hk(e){let t;return()=>(t===void 0&&(t=e()),t)}const sX=hk(()=>window.ScrollTimeline!==void 0);class iX{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 s=0;s{if(sX()&&i.attachTimeline)return i.attachTimeline(t);if(typeof n=="function")return n(i)});return()=>{s.forEach((i,r)=>{i&&i(),this.animations[r].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 rX extends iX{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const zo=e=>e*1e3,Vo=e=>e/1e3;function pk(e){return typeof e=="function"}function dj(e,t){e.timeline=t,e.onfinish=null}const mk=e=>Array.isArray(e)&&typeof e[0]=="number",aX={linearEasing:void 0};function oX(e,t){const n=hk(e);return()=>{var s;return(s=aX[t])!==null&&s!==void 0?s:n()}}const My=oX(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),gf=(e,t,n)=>{const s=t-e;return s===0?1:(n-e)/s},aP=(e,t,n=10)=>{let s="";const i=Math.max(Math.round(t/n),2);for(let r=0;r`cubic-bezier(${e}, ${t}, ${n}, ${s})`,ZS={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ip([0,.65,.55,1]),circOut:ip([.55,0,1,.45]),backIn:ip([.31,.01,.66,-.59]),backOut:ip([.33,1.53,.69,.99])};function lP(e,t){if(e)return typeof e=="function"&&My()?aP(e,t):mk(e)?ip(e):Array.isArray(e)?e.map(n=>lP(n,t)||ZS.easeOut):ZS[e]}const cP=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,lX=1e-7,cX=12;function uX(e,t,n,s,i){let r,a,l=0;do a=t+(n-t)/2,r=cP(a,s,i)-e,r>0?n=a:t=a;while(Math.abs(r)>lX&&++luX(r,0,1,e,n);return r=>r===0||r===1?r:cP(i(r),t,s)}const uP=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,dP=e=>t=>1-e(1-t),fP=ag(.33,1.53,.69,.99),gk=dP(fP),hP=uP(gk),pP=e=>(e*=2)<1?.5*gk(e):.5*(2-Math.pow(2,-10*(e-1))),bk=e=>1-Math.sin(Math.acos(e)),mP=dP(bk),gP=uP(bk),bP=e=>/^0[^.\s]+$/u.test(e);function dX(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||bP(e):!0}const Rp=e=>Math.round(e*1e5)/1e5,yk=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function fX(e){return e==null}const hX=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,xk=(e,t)=>n=>!!(typeof n=="string"&&hX.test(n)&&n.startsWith(e)||t&&!fX(n)&&Object.prototype.hasOwnProperty.call(n,t)),yP=(e,t,n)=>s=>{if(typeof s!="string")return s;const[i,r,a,l]=s.match(yk);return{[e]:parseFloat(i),[t]:parseFloat(r),[n]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},pX=e=>Jo(0,255,e),Ev={...Wf,transform:e=>Math.round(pX(e))},Dc={test:xk("rgb","red"),parse:yP("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:s=1})=>"rgba("+Ev.transform(e)+", "+Ev.transform(t)+", "+Ev.transform(n)+", "+Rp(gm.transform(s))+")"};function mX(e){let t="",n="",s="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),s=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),s=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,s+=s,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}}const JS={test:xk("#"),parse:mX,transform:Dc.transform},kd={test:xk("hsl","hue"),parse:yP("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:s=1})=>"hsla("+Math.round(e)+", "+eo.transform(Rp(t))+", "+eo.transform(Rp(n))+", "+Rp(gm.transform(s))+")"},ji={test:e=>Dc.test(e)||JS.test(e)||kd.test(e),parse:e=>Dc.test(e)?Dc.parse(e):kd.test(e)?kd.parse(e):JS.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Dc.transform(e):kd.transform(e)},gX=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function bX(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(yk))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(gX))===null||n===void 0?void 0:n.length)||0)>0}const xP="number",EP="color",yX="var",xX="var(",fj="${}",EX=/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 ym(e){const t=e.toString(),n=[],s={color:[],number:[],var:[]},i=[];let r=0;const l=t.replace(EX,c=>(ji.test(c)?(s.color.push(r),i.push(EP),n.push(ji.parse(c))):c.startsWith(xX)?(s.var.push(r),i.push(yX),n.push(c)):(s.number.push(r),i.push(xP),n.push(parseFloat(c))),++r,fj)).split(fj);return{values:n,split:l,indexes:s,types:i}}function vP(e){return ym(e).values}function wP(e){const{split:t,types:n}=ym(e),s=t.length;return i=>{let r="";for(let a=0;atypeof e=="number"?0:e;function wX(e){const t=vP(e);return wP(e)(t.map(vX))}const tc={test:bX,parse:vP,createTransformer:wP,getAnimatableNone:wX},SX=new Set(["brightness","contrast","saturate","opacity"]);function _X(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[s]=n.match(yk)||[];if(!s)return e;const i=n.replace(s,"");let r=SX.has(t)?1:0;return s!==n&&(r*=100),t+"("+r+i+")"}const NX=/\b([a-z-]*)\(.*?\)/gu,e_={...tc,getAnimatableNone:e=>{const t=e.match(NX);return t?t.map(_X).join(" "):e}},TX={...sk,color:ji,backgroundColor:ji,outlineColor:ji,fill:ji,stroke:ji,borderColor:ji,borderTopColor:ji,borderRightColor:ji,borderBottomColor:ji,borderLeftColor:ji,filter:e_,WebkitFilter:e_},Ek=e=>TX[e];function SP(e,t){let n=Ek(e);return n!==e_&&(n=tc),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const kX=new Set(["auto","none","0"]);function AX(e,t,n){let s=0,i;for(;se===Wf||e===yt,pj=(e,t)=>parseFloat(e.split(", ")[t]),mj=(e,t)=>(n,{transform:s})=>{if(s==="none"||!s)return 0;const i=s.match(/^matrix3d\((.+)\)$/u);if(i)return pj(i[1],t);{const r=s.match(/^matrix\((.+)\)$/u);return r?pj(r[1],e):0}},CX=new Set(["x","y","z"]),IX=Yf.filter(e=>!CX.has(e));function jX(e){const t=[];return IX.forEach(n=>{const s=e.getValue(n);s!==void 0&&(t.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),t}const bf={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:mj(4,13),y:mj(5,14)};bf.translateX=bf.x;bf.translateY=bf.y;const Kc=new Set;let t_=!1,n_=!1;function _P(){if(n_){const e=Array.from(Kc).filter(s=>s.needsMeasurement),t=new Set(e.map(s=>s.element)),n=new Map;t.forEach(s=>{const i=jX(s);i.length&&(n.set(s,i),s.render())}),e.forEach(s=>s.measureInitialState()),t.forEach(s=>{s.render();const i=n.get(s);i&&i.forEach(([r,a])=>{var l;(l=s.getValue(r))===null||l===void 0||l.set(a)})}),e.forEach(s=>s.measureEndState()),e.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}n_=!1,t_=!1,Kc.forEach(e=>e.complete()),Kc.clear()}function NP(){Kc.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(n_=!0)})}function RX(){NP(),_P()}class vk{constructor(t,n,s,i,r,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=s,this.motionValue=i,this.element=r,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Kc.add(this),t_||(t_=!0,ts.read(NP),ts.resolveKeyframes(_P))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:s,motionValue:i}=this;for(let r=0;r/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),OX=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function MX(e){const t=OX.exec(e);if(!t)return[,];const[,n,s,i]=t;return[`--${n??s}`,i]}function kP(e,t,n=1){const[s,i]=MX(e);if(!s)return;const r=window.getComputedStyle(t).getPropertyValue(s);if(r){const a=r.trim();return TP(a)?parseFloat(a):a}return nk(i)?kP(i,t,n+1):i}const AP=e=>t=>t.test(e),LX={test:e=>e==="auto",parse:e=>e},CP=[Wf,yt,eo,yl,jW,IW,LX],gj=e=>CP.find(AP(e));class IP extends vk{constructor(t,n,s,i,r){super(t,n,s,i,r,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const bj=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(tc.test(e)||e==="0")&&!e.startsWith("url("));function DX(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function Zx(e,{repeat:t,repeatType:n="loop"},s){const i=e.filter(BX),r=t&&n!=="loop"&&t%2===1?0:i.length-1;return!r||s===void 0?i[r]:s}const UX=40;class jP{constructor({autoplay:t=!0,delay:n=0,type:s="keyframes",repeat:i=0,repeatDelay:r=0,repeatType:a="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=to.now(),this.options={autoplay:t,delay:n,type:s,repeat:i,repeatDelay:r,repeatType:a,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>UX?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&RX(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=to.now(),this.hasAttemptedResolve=!0;const{name:s,type:i,velocity:r,delay:a,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!PX(t,s,i,r))if(a)this.options.duration=0;else{c&&c(Zx(t,this.options,n)),l&&l(),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 s_=2e4;function RP(e){let t=0;const n=50;let s=e.next(t);for(;!s.done&&t=s_?1/0:t}const ws=(e,t,n)=>e+(t-e)*n;function vv(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 FX({hue:e,saturation:t,lightness:n,alpha:s}){e/=360,t/=100,n/=100;let i=0,r=0,a=0;if(!t)i=r=a=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;i=vv(c,l,e+1/3),r=vv(c,l,e),a=vv(c,l,e-1/3)}return{red:Math.round(i*255),green:Math.round(r*255),blue:Math.round(a*255),alpha:s}}function Ly(e,t){return n=>n>0?t:e}const wv=(e,t,n)=>{const s=e*e,i=n*(t*t-s)+s;return i<0?0:Math.sqrt(i)},$X=[JS,Dc,kd],HX=e=>$X.find(t=>t.test(e));function yj(e){const t=HX(e);if(!t)return!1;let n=t.parse(e);return t===kd&&(n=FX(n)),n}const xj=(e,t)=>{const n=yj(e),s=yj(t);if(!n||!s)return Ly(e,t);const i={...n};return r=>(i.red=wv(n.red,s.red,r),i.green=wv(n.green,s.green,r),i.blue=wv(n.blue,s.blue,r),i.alpha=ws(n.alpha,s.alpha,r),Dc.transform(i))},zX=(e,t)=>n=>t(e(n)),og=(...e)=>e.reduce(zX),i_=new Set(["none","hidden"]);function VX(e,t){return i_.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function GX(e,t){return n=>ws(e,t,n)}function wk(e){return typeof e=="number"?GX:typeof e=="string"?nk(e)?Ly:ji.test(e)?xj:YX:Array.isArray(e)?OP:typeof e=="object"?ji.test(e)?xj:KX:Ly}function OP(e,t){const n=[...e],s=n.length,i=e.map((r,a)=>wk(r)(r,t[a]));return r=>{for(let a=0;a{for(const r in s)n[r]=s[r](i);return n}}function qX(e,t){var n;const s=[],i={color:0,var:0,number:0};for(let r=0;r{const n=tc.createTransformer(t),s=ym(e),i=ym(t);return s.indexes.var.length===i.indexes.var.length&&s.indexes.color.length===i.indexes.color.length&&s.indexes.number.length>=i.indexes.number.length?i_.has(e)&&!i.values.length||i_.has(t)&&!s.values.length?VX(e,t):og(OP(qX(s,i),i.values),n):Ly(e,t)};function MP(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?ws(e,t,n):wk(e)(e,t)}const WX=5;function LP(e,t,n){const s=Math.max(t-WX,0);return iP(n-e(s),t-s)}const Cs={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},Sv=.001;function XX({duration:e=Cs.duration,bounce:t=Cs.bounce,velocity:n=Cs.velocity,mass:s=Cs.mass}){let i,r,a=1-t;a=Jo(Cs.minDamping,Cs.maxDamping,a),e=Jo(Cs.minDuration,Cs.maxDuration,Vo(e)),a<1?(i=u=>{const d=u*a,f=d*e,h=d-n,p=r_(u,a),m=Math.exp(-f);return Sv-h/p*m},r=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=r_(Math.pow(u,2),a);return(-i(u)+Sv>0?-1:1)*((h-p)*m)/b}):(i=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-Sv+d*f},r=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=ZX(i,r,l);if(e=zo(e),isNaN(c))return{stiffness:Cs.stiffness,damping:Cs.damping,duration:e};{const u=Math.pow(c,2)*s;return{stiffness:u,damping:a*2*Math.sqrt(s*u),duration:e}}}const QX=12;function ZX(e,t,n){let s=n;for(let i=1;ie[n]!==void 0)}function tQ(e){let t={velocity:Cs.velocity,stiffness:Cs.stiffness,damping:Cs.damping,mass:Cs.mass,isResolvedFromDuration:!1,...e};if(!Ej(e,eQ)&&Ej(e,JX))if(e.visualDuration){const n=e.visualDuration,s=2*Math.PI/(n*1.2),i=s*s,r=2*Jo(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Cs.mass,stiffness:i,damping:r}}else{const n=XX(e);t={...t,...n,mass:Cs.mass},t.isResolvedFromDuration=!0}return t}function DP(e=Cs.visualDuration,t=Cs.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:s,restDelta:i}=n;const r=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],l={done:!1,value:r},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:p}=tQ({...n,velocity:-Vo(n.velocity||0)}),m=h||0,b=u/(2*Math.sqrt(c*d)),v=a-r,y=Vo(Math.sqrt(c/d)),x=Math.abs(v)<5;s||(s=x?Cs.restSpeed.granular:Cs.restSpeed.default),i||(i=x?Cs.restDelta.granular:Cs.restDelta.default);let E;if(b<1){const _=r_(y,b);E=S=>{const k=Math.exp(-b*y*S);return a-k*((m+b*y*v)/_*Math.sin(_*S)+v*Math.cos(_*S))}}else if(b===1)E=_=>a-Math.exp(-y*_)*(v+(m+y*v)*_);else{const _=y*Math.sqrt(b*b-1);E=S=>{const k=Math.exp(-b*y*S),T=Math.min(_*S,300);return a-k*((m+b*y*v)*Math.sinh(T)+_*v*Math.cosh(T))/_}}const w={calculatedDuration:p&&f||null,next:_=>{const S=E(_);if(p)l.done=_>=f;else{let k=0;b<1&&(k=_===0?zo(m):LP(E,_,S));const T=Math.abs(k)<=s,C=Math.abs(a-S)<=i;l.done=T&&C}return l.value=l.done?a:S,l},toString:()=>{const _=Math.min(RP(w),s_),S=aP(k=>w.next(_*k).value,_,30);return _+"ms "+S}};return w}function vj({keyframes:e,velocity:t=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:r=500,modifyTarget:a,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},p=T=>l!==void 0&&Tc,m=T=>l===void 0?c:c===void 0||Math.abs(l-T)-b*Math.exp(-T/s),E=T=>y+x(T),w=T=>{const C=x(T),I=E(T);h.done=Math.abs(C)<=u,h.value=h.done?y:I};let _,S;const k=T=>{p(h.value)&&(_=T,S=DP({keyframes:[h.value,m(h.value)],velocity:LP(E,T,h.value),damping:i,stiffness:r,restDelta:u,restSpeed:d}))};return k(0),{calculatedDuration:null,next:T=>{let C=!1;return!S&&_===void 0&&(C=!0,w(T),k(T)),_!==void 0&&T>=_?S.next(T-_):(!C&&w(T),h)}}}const nQ=ag(.42,0,1,1),sQ=ag(0,0,.58,1),PP=ag(.42,0,.58,1),iQ=e=>Array.isArray(e)&&typeof e[0]!="number",rQ={linear:Ar,easeIn:nQ,easeInOut:PP,easeOut:sQ,circIn:bk,circInOut:gP,circOut:mP,backIn:gk,backInOut:hP,backOut:fP,anticipate:pP},wj=e=>{if(mk(e)){D6(e.length===4);const[t,n,s,i]=e;return ag(t,n,s,i)}else if(typeof e=="string")return rQ[e];return e};function aQ(e,t,n){const s=[],i=n||MP,r=e.length-1;for(let a=0;at[0];if(r===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[r-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=aQ(t,s,i),c=l.length,u=d=>{if(a&&d1)for(;fu(Jo(e[0],e[r-1],d)):u}function lQ(e,t){const n=e[e.length-1];for(let s=1;s<=t;s++){const i=gf(0,t,s);e.push(ws(n,1,i))}}function cQ(e){const t=[0];return lQ(t,e.length-1),t}function uQ(e,t){return e.map(n=>n*t)}function dQ(e,t){return e.map(()=>t||PP).splice(0,e.length-1)}function Dy({duration:e=300,keyframes:t,times:n,ease:s="easeInOut"}){const i=iQ(s)?s.map(wj):wj(s),r={done:!1,value:t[0]},a=uQ(n&&n.length===t.length?n:cQ(t),e),l=oQ(a,t,{ease:Array.isArray(i)?i:dQ(t,i)});return{calculatedDuration:e,next:c=>(r.value=l(c),r.done=c>=e,r)}}const fQ=e=>{const t=({timestamp:n})=>e(n);return{start:()=>ts.update(t,!0),stop:()=>ec(t),now:()=>yi.isProcessing?yi.timestamp:to.now()}},hQ={decay:vj,inertia:vj,tween:Dy,keyframes:Dy,spring:DP},pQ=e=>e/100;class Sk extends jP{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:c}=this.options;c&&c()};const{name:n,motionValue:s,element:i,keyframes:r}=this.options,a=(i==null?void 0:i.KeyframeResolver)||vk,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new a(r,l,n,s,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:s=0,repeatDelay:i=0,repeatType:r,velocity:a=0}=this.options,l=pk(n)?n:hQ[n]||Dy;let c,u;l!==Dy&&typeof t[0]!="number"&&(c=og(pQ,MP(t[0],t[1])),t=[0,100]);const d=l({...this.options,keyframes:t});r==="mirror"&&(u=l({...this.options,keyframes:[...t].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=RP(d));const{calculatedDuration:f}=d,h=f+i,p=h*(s+1)-i;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,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:s}=this;if(!s){const{keyframes:T}=this.options;return{done:!0,value:T[T.length-1]}}const{finalKeyframe:i,generator:r,mirroredGenerator:a,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=s;if(this.startTime===null)return r.next(0);const{delay:h,repeat:p,repeatType:m,repeatDelay:b,onUpdate:v}=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 y=this.currentTime-h*(this.speed>=0?1:-1),x=this.speed>=0?y<0:y>d;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let E=this.currentTime,w=r;if(p){const T=Math.min(this.currentTime,d)/f;let C=Math.floor(T),I=T%1;!I&&T>=1&&(I=1),I===1&&C--,C=Math.min(C,p+1),!!(C%2)&&(m==="reverse"?(I=1-I,b&&(I-=b/f)):m==="mirror"&&(w=a)),E=Jo(0,1,I)*f}const _=x?{done:!1,value:c[0]}:w.next(E);l&&(_.value=l(_.value));let{done:S}=_;!x&&u!==null&&(S=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&S);return k&&i!==void 0&&(_.value=Zx(c,this.options,i)),v&&v(_.value),k&&this.finish(),_}get duration(){const{resolved:t}=this;return t?Vo(t.calculatedDuration):0}get time(){return Vo(this.currentTime)}set time(t){t=zo(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=Vo(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=fQ,onPlay:n,startTime:s}=this.options;this.driver||(this.driver=t(r=>this.tick(r))),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=s??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 mQ=new Set(["opacity","clipPath","filter","transform"]);function gQ(e,t,n,{delay:s=0,duration:i=300,repeat:r=0,repeatType:a="loop",ease:l="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=lP(l,i);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:s,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:r+1,direction:a==="reverse"?"alternate":"normal"})}const bQ=hk(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Py=10,yQ=2e4;function xQ(e){return pk(e.type)||e.type==="spring"||!oP(e.ease)}function EQ(e,t){const n=new Sk({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:e[0]};const i=[];let r=0;for(;!s.done&&rthis.onKeyframesResolved(a,l),n,s,i),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:s=300,times:i,ease:r,type:a,motionValue:l,name:c,startTime:u}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof r=="string"&&My()&&vQ(r)&&(r=BP[r]),xQ(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:m,...b}=this.options,v=EQ(t,b);t=v.keyframes,t.length===1&&(t[1]=t[0]),s=v.duration,i=v.times,r=v.ease,a="keyframes"}const d=gQ(l.owner.current,c,t,{...this.options,duration:s,times:i,ease:r});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(dj(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;l.set(Zx(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:s,times:i,type:a,ease:r,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return Vo(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return Vo(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:s}=n;s.currentTime=zo(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:s}=n;s.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 Ar;const{animation:s}=n;dj(s,t)}return Ar}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:s,duration:i,type:r,ease:a,times:l}=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 Sk({...p,keyframes:s,duration:i,type:r,ease:a,times:l,isGenerator:!0}),b=zo(this.time);u.setWithVelocity(m.sample(b-Py).value,m.sample(b).value,Py)}const{onStop:c}=this.options;c&&c(),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:s,repeatDelay:i,repeatType:r,damping:a,type:l}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return bQ()&&s&&mQ.has(s)&&!c&&!u&&!i&&r!=="mirror"&&a!==0&&l!=="inertia"}}const wQ={type:"spring",stiffness:500,damping:25,restSpeed:10},SQ=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),_Q={type:"keyframes",duration:.8},NQ={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},TQ=(e,{keyframes:t})=>t.length>2?_Q:Su.has(e)?e.startsWith("scale")?SQ(t[1]):wQ:NQ;function kQ({when:e,delay:t,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:r,repeatType:a,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const _k=(e,t,n,s={},i,r)=>a=>{const l=ck(s,e)||{},c=l.delay||s.delay||0;let{elapsed:u=0}=s;u=u-zo(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:h=>{t.set(h),l.onUpdate&&l.onUpdate(h)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:r?void 0:i};kQ(l)||(d={...d,...TQ(e,d)}),d.duration&&(d.duration=zo(d.duration)),d.repeatDelay&&(d.repeatDelay=zo(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&&!r&&t.get()!==void 0){const h=Zx(d.keyframes,l);if(h!==void 0)return ts.update(()=>{d.onUpdate(h),d.onComplete()}),new rX([])}return!r&&Sj.supports(d)?new Sj(d):new Sk(d)};function AQ({protectedKeys:e,needsAnimating:t},n){const s=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,s}function UP(e,t,{delay:n=0,transitionOverride:s,type:i}={}){var r;let{transition:a=e.getDefaultTransition(),transitionEnd:l,...c}=t;s&&(a=s);const u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(const f in c){const h=e.getValue(f,(r=e.latestValues[f])!==null&&r!==void 0?r:null),p=c[f];if(p===void 0||d&&AQ(d,f))continue;const m={delay:n,...ck(a||{},f)};let b=!1;if(window.MotionHandoffAnimation){const y=rP(e);if(y){const x=window.MotionHandoffAnimation(y,f,ts);x!==null&&(m.startTime=x,b=!0)}}QS(e,f),h.start(_k(f,h,p,e.shouldReduceMotion&&sP.has(f)?{type:!1}:m,e,b));const v=h.animation;v&&u.push(v)}return l&&Promise.all(u).then(()=>{ts.update(()=>{l&&tX(e,l)})}),u}function a_(e,t,n={}){var s;const i=Qx(e,t,n.type==="exit"?(s=e.presenceContext)===null||s===void 0?void 0:s.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(r=n.transitionOverride);const a=i?()=>Promise.all(UP(e,i,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=r;return CQ(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:c}=r;if(c){const[u,d]=c==="beforeChildren"?[a,l]:[l,a];return u().then(()=>d())}else return Promise.all([a(),l(n.delay)])}function CQ(e,t,n=0,s=0,i=1,r){const a=[],l=(e.variantChildren.size-1)*s,c=i===1?(u=0)=>u*s:(u=0)=>l-u*s;return Array.from(e.variantChildren).sort(IQ).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(a_(u,t,{...r,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function IQ(e,t){return e.sortNodePosition(t)}function jQ(e,t,n={}){e.notify("AnimationStart",t);let s;if(Array.isArray(t)){const i=t.map(r=>a_(e,r,n));s=Promise.all(i)}else if(typeof t=="string")s=a_(e,t,n);else{const i=typeof t=="function"?Qx(e,t,n.custom):t;s=Promise.all(UP(e,i,n))}return s.then(()=>{e.notify("AnimationComplete",t)})}const RQ=QT.length;function FP(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?FP(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:s})=>jQ(e,n,s)))}function DQ(e){let t=LQ(e),n=_j(),s=!0;const i=c=>(u,d)=>{var f;const h=Qx(e,d,c==="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 r(c){t=c(e)}function a(c){const{props:u}=e,d=FP(e.parent)||{},f=[],h=new Set;let p={},m=1/0;for(let v=0;vm&&w,C=!1;const I=Array.isArray(E)?E:[E];let j=I.reduce(i(y),{});_===!1&&(j={});const{prevResolvedValues:L={}}=x,z={...L,...j},D=M=>{T=!0,h.has(M)&&(C=!0,h.delete(M)),x.needsAnimating[M]=!0;const P=e.getValue(M);P&&(P.liveStyle=!1)};for(const M in z){const P=j[M],H=L[M];if(p.hasOwnProperty(M))continue;let R=!1;XS(P)&&XS(H)?R=!nP(P,H):R=P!==H,R?P!=null?D(M):h.add(M):P!==void 0&&h.has(M)?D(M):x.protectedKeys[M]=!0}x.prevProp=E,x.prevResolvedValues=j,x.isActive&&(p={...p,...j}),s&&e.blockInitialAnimation&&(T=!1),T&&(!(S&&k)||C)&&f.push(...I.map(M=>({animation:M,options:{type:y}})))}if(h.size){const v={};h.forEach(y=>{const x=e.getBaseTarget(y),E=e.getValue(y);E&&(E.liveStyle=!0),v[y]=x??null}),f.push({animation:v})}let b=!!f.length;return s&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(b=!1),s=!1,b?t(f):Promise.resolve()}function l(c,u){var d;if(n[c].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(c,u)}),n[c].isActive=u;const f=a(c);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:l,setAnimateFunction:r,getState:()=>n,reset:()=>{n=_j(),s=!0}}}function PQ(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!nP(t,e):!1}function xc(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function _j(){return{animate:xc(!0),whileInView:xc(),whileHover:xc(),whileTap:xc(),whileDrag:xc(),whileFocus:xc(),exit:xc()}}class lc{constructor(t){this.isMounted=!1,this.node=t}update(){}}class BQ extends lc{constructor(t){super(t),t.animationState||(t.animationState=DQ(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Wx(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 UQ=0;class FQ extends lc{constructor(){super(...arguments),this.id=UQ++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)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 $Q={animation:{Feature:BQ},exit:{Feature:FQ}},ma={x:!1,y:!1};function $P(){return ma.x||ma.y}function HQ(e){return e==="x"||e==="y"?ma[e]?null:(ma[e]=!0,()=>{ma[e]=!1}):ma.x||ma.y?null:(ma.x=ma.y=!0,()=>{ma.x=ma.y=!1})}const Nk=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function xm(e,t,n,s={passive:!0}){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n)}function lg(e){return{point:{x:e.pageX,y:e.pageY}}}const zQ=e=>t=>Nk(t)&&e(t,lg(t));function Op(e,t,n,s){return xm(e,t,zQ(n),s)}const Nj=(e,t)=>Math.abs(e-t);function VQ(e,t){const n=Nj(e.x,t.x),s=Nj(e.y,t.y);return Math.sqrt(n**2+s**2)}class HP{constructor(t,n,{transformPagePoint:s,contextWindow:i,dragSnapToOrigin:r=!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=Nv(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=VQ(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:m}=f,{timestamp:b}=yi;this.history.push({...m,timestamp:b});const{onStart:v,onMove:y}=this.handlers;h||(v&&v(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=_v(h,this.transformPagePoint),ts.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 v=Nv(f.type==="pointercancel"?this.lastMoveEventInfo:_v(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,v),m&&m(f,v)},!Nk(t))return;this.dragSnapToOrigin=r,this.handlers=n,this.transformPagePoint=s,this.contextWindow=i||window;const a=lg(t),l=_v(a,this.transformPagePoint),{point:c}=l,{timestamp:u}=yi;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,Nv(l,this.history)),this.removeListeners=og(Op(this.contextWindow,"pointermove",this.handlePointerMove),Op(this.contextWindow,"pointerup",this.handlePointerUp),Op(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),ec(this.updatePoint)}}function _v(e,t){return t?{point:t(e.point)}:e}function Tj(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Nv({point:e},t){return{point:e,delta:Tj(e,zP(t)),offset:Tj(e,GQ(t)),velocity:KQ(t,.1)}}function GQ(e){return e[0]}function zP(e){return e[e.length-1]}function KQ(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,s=null;const i=zP(e);for(;n>=0&&(s=e[n],!(i.timestamp-s.timestamp>zo(t)));)n--;if(!s)return{x:0,y:0};const r=Vo(i.timestamp-s.timestamp);if(r===0)return{x:0,y:0};const a={x:(i.x-s.x)/r,y:(i.y-s.y)/r};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const VP=1e-4,qQ=1-VP,YQ=1+VP,GP=.01,WQ=0-GP,XQ=0+GP;function Rr(e){return e.max-e.min}function QQ(e,t,n){return Math.abs(e-t)<=n}function kj(e,t,n,s=.5){e.origin=s,e.originPoint=ws(t.min,t.max,e.origin),e.scale=Rr(n)/Rr(t),e.translate=ws(n.min,n.max,e.origin)-e.originPoint,(e.scale>=qQ&&e.scale<=YQ||isNaN(e.scale))&&(e.scale=1),(e.translate>=WQ&&e.translate<=XQ||isNaN(e.translate))&&(e.translate=0)}function Mp(e,t,n,s){kj(e.x,t.x,n.x,s?s.originX:void 0),kj(e.y,t.y,n.y,s?s.originY:void 0)}function Aj(e,t,n){e.min=n.min+t.min,e.max=e.min+Rr(t)}function ZQ(e,t,n){Aj(e.x,t.x,n.x),Aj(e.y,t.y,n.y)}function Cj(e,t,n){e.min=t.min-n.min,e.max=e.min+Rr(t)}function Lp(e,t,n){Cj(e.x,t.x,n.x),Cj(e.y,t.y,n.y)}function JQ(e,{min:t,max:n},s){return t!==void 0&&en&&(e=s?ws(n,e,s.max):Math.min(e,n)),e}function Ij(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 eZ(e,{top:t,left:n,bottom:s,right:i}){return{x:Ij(e.x,n,i),y:Ij(e.y,t,s)}}function jj(e,t){let n=t.min-e.min,s=t.max-e.max;return t.max-t.mins?n=gf(t.min,t.max-s,e.min):s>i&&(n=gf(e.min,e.max-i,t.min)),Jo(0,1,n)}function sZ(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 o_=.35;function iZ(e=o_){return e===!1?e=0:e===!0&&(e=o_),{x:Rj(e,"left","right"),y:Rj(e,"top","bottom")}}function Rj(e,t,n){return{min:Oj(e,t),max:Oj(e,n)}}function Oj(e,t){return typeof e=="number"?e:e[t]||0}const Mj=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ad=()=>({x:Mj(),y:Mj()}),Lj=()=>({min:0,max:0}),Ms=()=>({x:Lj(),y:Lj()});function Ur(e){return[e("x"),e("y")]}function KP({top:e,left:t,right:n,bottom:s}){return{x:{min:t,max:n},y:{min:e,max:s}}}function rZ({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function aZ(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function Tv(e){return e===void 0||e===1}function l_({scale:e,scaleX:t,scaleY:n}){return!Tv(e)||!Tv(t)||!Tv(n)}function kc(e){return l_(e)||qP(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function qP(e){return Dj(e.x)||Dj(e.y)}function Dj(e){return e&&e!=="0%"}function By(e,t,n){const s=e-n,i=t*s;return n+i}function Pj(e,t,n,s,i){return i!==void 0&&(e=By(e,i,s)),By(e,n,s)+t}function c_(e,t=0,n=1,s,i){e.min=Pj(e.min,t,n,s,i),e.max=Pj(e.max,t,n,s,i)}function YP(e,{x:t,y:n}){c_(e.x,t.translate,t.scale,t.originPoint),c_(e.y,n.translate,n.scale,n.originPoint)}const Bj=.999999999999,Uj=1.0000000000001;function oZ(e,t,n,s=!1){const i=n.length;if(!i)return;t.x=t.y=1;let r,a;for(let l=0;lBj&&(t.x=1),t.yBj&&(t.y=1)}function Cd(e,t){e.min=e.min+t,e.max=e.max+t}function Fj(e,t,n,s,i=.5){const r=ws(e.min,e.max,i);c_(e,t,n,r,s)}function Id(e,t){Fj(e.x,t.x,t.scaleX,t.scale,t.originX),Fj(e.y,t.y,t.scaleY,t.scale,t.originY)}function WP(e,t){return KP(aZ(e.getBoundingClientRect(),t))}function lZ(e,t,n){const s=WP(e,n),{scroll:i}=t;return i&&(Cd(s.x,i.offset.x),Cd(s.y,i.offset.y)),s}const XP=({current:e})=>e?e.ownerDocument.defaultView:null,cZ=new WeakMap;class uZ{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=Ms(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(lg(d).point)},r=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:m}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=HQ(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),Ur(v=>{let y=this.getAxisMotionValue(v).get()||0;if(eo.test(y)){const{projection:x}=this.visualElement;if(x&&x.layout){const E=x.layout.layoutBox[v];E&&(y=Rr(E)*(parseFloat(y)/100))}}this.originPoint[v]=y}),m&&ts.postRender(()=>m(d,f)),QS(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:v}=f;if(p&&this.currentDirection===null){this.currentDirection=dZ(v),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",f.point,v),this.updateAxis("y",f.point,v),this.visualElement.render(),b&&b(d,f)},l=(d,f)=>this.stop(d,f),c=()=>Ur(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 HP(t,{onSessionStart:i,onStart:r,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:XP(this.visualElement)})}stop(t,n){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:r}=this.getProps();r&&ts.postRender(()=>r(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:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,s){const{drag:i}=this.getProps();if(!s||!C0(t,i,this.currentDirection))return;const r=this.getAxisMotionValue(t);let a=this.originPoint[t]+s[t];this.constraints&&this.constraints[t]&&(a=JQ(a,this.constraints[t],this.elastic[t])),r.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:s}=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,r=this.constraints;n&&Td(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&i?this.constraints=eZ(i.layoutBox,n):this.constraints=!1,this.elastic=iZ(s),r!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Ur(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=sZ(i.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Td(t))return!1;const s=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const r=lZ(s,i.root,this.visualElement.getTransformPagePoint());let a=tZ(i.layout.layoutBox,r);if(n){const l=n(rZ(a));this.hasMutatedConstraints=!!l,l&&(a=KP(l))}return a}startAnimation(t){const{drag:n,dragMomentum:s,dragElastic:i,dragTransition:r,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Ur(d=>{if(!C0(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const h=i?200:1e6,p=i?40:1e7,m={type:"inertia",velocity:s?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...r,...f};return this.startAxisValueAnimation(d,m)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const s=this.getAxisMotionValue(t);return QS(this.visualElement,t),s.start(_k(t,s,0,n,this.visualElement,!1))}stopAnimation(){Ur(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Ur(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()}`,s=this.visualElement.getProps(),i=s[n];return i||this.visualElement.getValue(t,(s.initial?s.initial[t]:void 0)||0)}snapToCursor(t){Ur(n=>{const{drag:s}=this.getProps();if(!C0(n,s,this.currentDirection))return;const{projection:i}=this.visualElement,r=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:l}=i.layout.layoutBox[n];r.set(t[n]-ws(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!Td(n)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Ur(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();i[a]=nZ({min:c,max:c},this.constraints[a])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),Ur(a=>{if(!C0(a,t,null))return;const l=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];l.set(ws(c,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;cZ.set(this.visualElement,this);const t=this.visualElement.current,n=Op(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();Td(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,r=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),ts.read(s);const a=xm(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Ur(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{a(),n(),r(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:r=!1,dragElastic:a=o_,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:s,dragPropagation:i,dragConstraints:r,dragElastic:a,dragMomentum:l}}}function C0(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function dZ(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class fZ extends lc{constructor(t){super(t),this.removeGroupControls=Ar,this.removeListeners=Ar,this.controls=new uZ(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ar}unmount(){this.removeGroupControls(),this.removeListeners()}}const $j=e=>(t,n)=>{e&&ts.postRender(()=>e(t,n))};class hZ extends lc{constructor(){super(...arguments),this.removePointerDownListener=Ar}onPointerDown(t){this.session=new HP(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:XP(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:$j(t),onStart:$j(n),onMove:s,onEnd:(r,a)=>{delete this.session,i&&ts.postRender(()=>i(r,a))}}}mount(){this.removePointerDownListener=Op(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 jb={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Hj(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Dh={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(yt.test(e))e=parseFloat(e);else return e;const n=Hj(e,t.target.x),s=Hj(e,t.target.y);return`${n}% ${s}%`}},pZ={correct:(e,{treeScale:t,projectionDelta:n})=>{const s=e,i=tc.parse(e);if(i.length>5)return s;const r=tc.createTransformer(e),a=typeof i[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;i[0+a]/=l,i[1+a]/=c;const u=ws(l,c,.5);return typeof i[2+a]=="number"&&(i[2+a]/=u),typeof i[3+a]=="number"&&(i[3+a]/=u),r(i)}};class mZ extends g.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s,layoutId:i}=this.props,{projection:r}=t;$W(gZ),r&&(n.group&&n.group.add(r),s&&s.register&&i&&s.register(r),r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),jb.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:s,drag:i,isPresent:r}=this.props,a=s.projection;return a&&(a.isPresent=r,i||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==r&&(r?a.promote():a.relegate()||ts.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),JT.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),s&&s.deregister&&s.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function QP(e){const[t,n]=M6(),s=g.useContext(YT);return o.jsx(mZ,{...e,layoutGroup:s,switchLayoutGroup:g.useContext(z6),isPresent:t,safeToRemove:n})}const gZ={borderRadius:{...Dh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Dh,borderTopRightRadius:Dh,borderBottomLeftRadius:Dh,borderBottomRightRadius:Dh,boxShadow:pZ};function bZ(e,t,n){const s=Ri(e)?e:bm(e);return s.start(_k("",s,t,n)),s.animation}function yZ(e){return e instanceof SVGElement&&e.tagName!=="svg"}const xZ=(e,t)=>e.depth-t.depth;class EZ{constructor(){this.children=[],this.isDirty=!1}add(t){uk(this.children,t),this.isDirty=!0}remove(t){dk(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(xZ),this.isDirty=!1,this.children.forEach(t)}}function vZ(e,t){const n=to.now(),s=({timestamp:i})=>{const r=i-n;r>=t&&(ec(s),e(r-t))};return ts.read(s,!0),()=>ec(s)}const ZP=["TopLeft","TopRight","BottomLeft","BottomRight"],wZ=ZP.length,zj=e=>typeof e=="string"?parseFloat(e):e,Vj=e=>typeof e=="number"||yt.test(e);function SZ(e,t,n,s,i,r){i?(e.opacity=ws(0,n.opacity!==void 0?n.opacity:1,_Z(s)),e.opacityExit=ws(t.opacity!==void 0?t.opacity:1,0,NZ(s))):r&&(e.opacity=ws(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,s));for(let a=0;ast?1:n(gf(e,t,s))}function Kj(e,t){e.min=t.min,e.max=t.max}function Br(e,t){Kj(e.x,t.x),Kj(e.y,t.y)}function qj(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Yj(e,t,n,s,i){return e-=t,e=By(e,1/n,s),i!==void 0&&(e=By(e,1/i,s)),e}function TZ(e,t=0,n=1,s=.5,i,r=e,a=e){if(eo.test(t)&&(t=parseFloat(t),t=ws(a.min,a.max,t/100)-a.min),typeof t!="number")return;let l=ws(r.min,r.max,s);e===r&&(l-=t),e.min=Yj(e.min,t,n,l,i),e.max=Yj(e.max,t,n,l,i)}function Wj(e,t,[n,s,i],r,a){TZ(e,t[n],t[s],t[i],t.scale,r,a)}const kZ=["x","scaleX","originX"],AZ=["y","scaleY","originY"];function Xj(e,t,n,s){Wj(e.x,t,kZ,n?n.x:void 0,s?s.x:void 0),Wj(e.y,t,AZ,n?n.y:void 0,s?s.y:void 0)}function Qj(e){return e.translate===0&&e.scale===1}function eB(e){return Qj(e.x)&&Qj(e.y)}function Zj(e,t){return e.min===t.min&&e.max===t.max}function CZ(e,t){return Zj(e.x,t.x)&&Zj(e.y,t.y)}function Jj(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function tB(e,t){return Jj(e.x,t.x)&&Jj(e.y,t.y)}function eR(e){return Rr(e.x)/Rr(e.y)}function tR(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class IZ{constructor(){this.members=[]}add(t){uk(this.members,t),t.scheduleRender()}remove(t){if(dk(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 s;for(let i=n;i>=0;i--){const r=this.members[i];if(r.isPresent!==!1){s=r;break}}return s?(this.promote(s),!0):!1}promote(t,n){const s=this.lead;if(t!==s&&(this.prevLead=s,this.lead=t,t.show(),s)){s.instance&&s.scheduleRender(),t.scheduleRender(),t.resumeFrom=s,n&&(t.resumeFrom.preserveOpacity=!0),s.snapshot&&(t.snapshot=s.snapshot,t.snapshot.latestValues=s.animationValues||s.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:s}=t;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function jZ(e,t,n){let s="";const i=e.x.translate/t.x,r=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((i||r||a)&&(s=`translate3d(${i}px, ${r}px, ${a}px) `),(t.x!==1||t.y!==1)&&(s+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:m}=n;u&&(s=`perspective(${u}px) ${s}`),d&&(s+=`rotate(${d}deg) `),f&&(s+=`rotateX(${f}deg) `),h&&(s+=`rotateY(${h}deg) `),p&&(s+=`skewX(${p}deg) `),m&&(s+=`skewY(${m}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(s+=`scale(${l}, ${c})`),s||"none"}const Ac={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},rp=typeof window<"u"&&window.MotionDebug!==void 0,kv=["","X","Y","Z"],RZ={visibility:"hidden"},nR=1e3;let OZ=0;function Av(e,t,n,s){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),s&&(s[e]=0))}function nB(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=rP(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ts,!(i||r))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&nB(s)}function sB({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(a={},l=t==null?void 0:t()){this.id=OZ++,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,rp&&(Ac.totalNodes=Ac.resolvedTargetDeltas=Ac.recalculatedProjection=0),this.nodes.forEach(DZ),this.nodes.forEach($Z),this.nodes.forEach(HZ),this.nodes.forEach(PZ),rp&&window.MotionDebug.record(Ac)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;cthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=vZ(h,250),jb.hasAnimatedSinceResize&&(jb.hasAnimatedSinceResize=!1,this.nodes.forEach(iR))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||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()||qZ,{onLayoutAnimationStart:v,onLayoutAnimationComplete:y}=d.getProps(),x=!this.targetLayout||!tB(this.targetLayout,m)||p,E=!h&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||E||h&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,E);const w={...ck(b,"layout"),onPlay:v,onComplete:y};(d.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else h||iR(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,ec(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(zZ),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&&nB(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 c=0;c{const _=w/1e3;rR(f.x,a.x,_),rR(f.y,a.y,_),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Lp(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),GZ(this.relativeTarget,this.relativeTargetOrigin,h,_),E&&CZ(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=Ms()),Br(E,this.relativeTarget)),b&&(this.animationValues=d,SZ(d,u,this.latestValues,_,x,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=_},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&&(ec(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ts.update(()=>{jb.hasAnimatedSinceResize=!0,this.currentAnimation=bZ(0,nR,{...a,onUpdate:l=>{this.mixTargetDelta(l),a.onUpdate&&a.onUpdate(l)},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(nR),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=a;if(!(!l||!c||!u)){if(this!==a&&this.layout&&u&&iB(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||Ms();const f=Rr(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const h=Rr(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+h}Br(l,c),Id(l,d),Mp(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new IZ),this.sharedNodes.get(a).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:l}=this.options;return l?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:l}=this.options;return l?(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:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let l=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&Av("z",a,u,this.animationValues);for(let d=0;d{var l;return(l=a.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(sR),this.root.sharedNodes.clear()}}}function MZ(e){e.updateLayout()}function LZ(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:s,measuredBox:i}=e.layout,{animationType:r}=e.options,a=n.source!==e.layout.source;r==="size"?Ur(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=Rr(h);h.min=s[f].min,h.max=h.min+p}):iB(r,n.layoutBox,s)&&Ur(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=Rr(s[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const l=Ad();Mp(l,s,n.layoutBox);const c=Ad();a?Mp(c,e.applyTransform(i,!0),n.measuredBox):Mp(c,s,n.layoutBox);const u=!eB(l);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=Ms();Lp(m,n.layoutBox,h.layoutBox);const b=Ms();Lp(b,s,p.layoutBox),tB(m,b)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=b,e.relativeTargetOrigin=m,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function DZ(e){rp&&Ac.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 PZ(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function BZ(e){e.clearSnapshot()}function sR(e){e.clearMeasurements()}function UZ(e){e.isLayoutDirty=!1}function FZ(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function iR(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function $Z(e){e.resolveTargetDelta()}function HZ(e){e.calcProjection()}function zZ(e){e.resetSkewAndRotation()}function VZ(e){e.removeLeadSnapshot()}function rR(e,t,n){e.translate=ws(t.translate,0,n),e.scale=ws(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function aR(e,t,n,s){e.min=ws(t.min,n.min,s),e.max=ws(t.max,n.max,s)}function GZ(e,t,n,s){aR(e.x,t.x,n.x,s),aR(e.y,t.y,n.y,s)}function KZ(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const qZ={duration:.45,ease:[.4,0,.1,1]},oR=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),lR=oR("applewebkit/")&&!oR("chrome/")?Math.round:Ar;function cR(e){e.min=lR(e.min),e.max=lR(e.max)}function YZ(e){cR(e.x),cR(e.y)}function iB(e,t,n){return e==="position"||e==="preserve-aspect"&&!QQ(eR(t),eR(n),.2)}function WZ(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const XZ=sB({attachResizeListener:(e,t)=>xm(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Cv={current:void 0},rB=sB({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Cv.current){const e=new XZ({});e.mount(window),e.setOptions({layoutScroll:!0}),Cv.current=e}return Cv.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),QZ={pan:{Feature:hZ},drag:{Feature:fZ,ProjectionNode:rB,MeasureLayout:QP}};function ZZ(e,t,n){var s;if(e instanceof Element)return[e];if(typeof e=="string"){let i=document;const r=(s=void 0)!==null&&s!==void 0?s:i.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e)}function aB(e,t){const n=ZZ(e),s=new AbortController,i={passive:!0,...t,signal:s.signal};return[n,i,()=>s.abort()]}function uR(e){return t=>{t.pointerType==="touch"||$P()||e(t)}}function JZ(e,t,n={}){const[s,i,r]=aB(e,n),a=uR(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const d=uR(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,i)});return s.forEach(l=>{l.addEventListener("pointerenter",a,i)}),r}function dR(e,t,n){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,r=s[i];r&&ts.postRender(()=>r(t,lg(t)))}class eJ extends lc{mount(){const{current:t}=this.node;t&&(this.unmount=JZ(t,n=>(dR(this.node,n,"Start"),s=>dR(this.node,s,"End"))))}unmount(){}}class tJ extends lc{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=og(xm(this.node.current,"focus",()=>this.onFocus()),xm(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const oB=(e,t)=>t?e===t?!0:oB(e,t.parentElement):!1,nJ=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function sJ(e){return nJ.has(e.tagName)||e.tabIndex!==-1}const ap=new WeakSet;function fR(e){return t=>{t.key==="Enter"&&e(t)}}function Iv(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const iJ=(e,t)=>{const n=e.currentTarget;if(!n)return;const s=fR(()=>{if(ap.has(n))return;Iv(n,"down");const i=fR(()=>{Iv(n,"up")}),r=()=>Iv(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",r,t)});n.addEventListener("keydown",s,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),t)};function hR(e){return Nk(e)&&!$P()}function rJ(e,t,n={}){const[s,i,r]=aB(e,n),a=l=>{const c=l.currentTarget;if(!hR(l)||ap.has(c))return;ap.add(c);const u=t(l),d=(p,m)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!hR(p)||!ap.has(c))&&(ap.delete(c),typeof u=="function"&&u(p,{success:m}))},f=p=>{d(p,n.useGlobalTarget||oB(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",h,i)};return s.forEach(l=>{!sJ(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",a,i),l.addEventListener("focus",u=>iJ(u,i),i)}),r}function pR(e,t,n){const{props:s}=e;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),r=s[i];r&&ts.postRender(()=>r(t,lg(t)))}class aJ extends lc{mount(){const{current:t}=this.node;t&&(this.unmount=rJ(t,n=>(pR(this.node,n,"Start"),(s,{success:i})=>pR(this.node,s,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const u_=new WeakMap,jv=new WeakMap,oJ=e=>{const t=u_.get(e.target);t&&t(e)},lJ=e=>{e.forEach(oJ)};function cJ({root:e,...t}){const n=e||document;jv.has(n)||jv.set(n,{});const s=jv.get(n),i=JSON.stringify(t);return s[i]||(s[i]=new IntersectionObserver(lJ,{root:e,...t})),s[i]}function uJ(e,t,n){const s=cJ(t);return u_.set(e,n),s.observe(e),()=>{u_.delete(e),s.unobserve(e)}}const dJ={some:0,all:1};class fJ extends lc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:r}=t,a={root:n?n.current:void 0,rootMargin:s,threshold:typeof i=="number"?i:dJ[i]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,r&&!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(c)};return uJ(this.node.current,a,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(hJ(t,n))&&this.startObserver()}unmount(){}}function hJ({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const pJ={inView:{Feature:fJ},tap:{Feature:aJ},focus:{Feature:tJ},hover:{Feature:eJ}},mJ={layout:{ProjectionNode:rB,MeasureLayout:QP}},d_={current:null},lB={current:!1};function gJ(){if(lB.current=!0,!!WT)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>d_.current=e.matches;e.addListener(t),t()}else d_.current=!1}const bJ=[...CP,ji,tc],yJ=e=>bJ.find(AP(e)),mR=new WeakMap;function xJ(e,t,n){for(const s in t){const i=t[s],r=n[s];if(Ri(i))e.addValue(s,i);else if(Ri(r))e.addValue(s,bm(i,{owner:e}));else if(r!==i)if(e.hasValue(s)){const a=e.getValue(s);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=e.getStaticValue(s);e.addValue(s,bm(a!==void 0?a:i,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const gR=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class EJ{scrapeMotionValuesFromProps(t,n,s){return{}}constructor({parent:t,props:n,presenceContext:s,reducedMotionConfig:i,blockInitialAnimation:r,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=vk,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=to.now();this.renderScheduledAtthis.bindToMotionValue(s,n)),lB.current||gJ(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:d_.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){mR.delete(this.current),this.projection&&this.projection.unmount(),ec(this.notifyUpdate),ec(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 s=Su.has(t),i=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&ts.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0)}),r=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),r(),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 mf){const n=mf[t];if(!n)continue;const{isEnabled:s,Feature:i}=n;if(!this.features[t]&&i&&s(this.props)&&(this.features[t]=new i(this)),this.features[t]){const r=this.features[t];r.isMounted?r.update():(r.mount(),r.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ms()}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 s=0;sn.variantChildren.delete(t)}addValue(t,n){const s=this.values.get(t);n!==s&&(s&&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 s=this.values.get(t);return s===void 0&&n!==void 0&&(s=bm(n===null?void 0:n,{owner:this}),this.addValue(t,s)),s}readValue(t,n){var s;let i=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(s=this.getBaseTargetFromProps(this.props,t))!==null&&s!==void 0?s:this.readValueFromInstance(this.current,t,this.options);return i!=null&&(typeof i=="string"&&(TP(i)||bP(i))?i=parseFloat(i):!yJ(i)&&tc.test(n)&&(i=SP(t,n)),this.setBaseTarget(t,Ri(i)?i.get():i)),Ri(i)?i.get():i}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:s}=this.props;let i;if(typeof s=="string"||typeof s=="object"){const a=tk(this.props,s,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(i=a[t])}if(s&&i!==void 0)return i;const r=this.getBaseTargetFromProps(this.props,t);return r!==void 0&&!Ri(r)?r:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new fk),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class cB extends EJ{constructor(){super(...arguments),this.KeyframeResolver=IP}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:s}){delete n[t],delete s[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Ri(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function vJ(e){return window.getComputedStyle(e)}class wJ extends cB{constructor(){super(...arguments),this.type="html",this.renderInstance=X6}readValueFromInstance(t,n){if(Su.has(n)){const s=Ek(n);return s&&s.default||0}else{const s=vJ(t),i=(q6(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return WP(t,n)}build(t,n,s){ik(t,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,n,s){return lk(t,n,s)}}class SJ extends cB{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ms}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Su.has(n)){const s=Ek(n);return s&&s.default||0}return n=Q6.has(n)?n:ZT(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,s){return eP(t,n,s)}build(t,n,s){rk(t,n,this.isSVGTag,s.transformTemplate)}renderInstance(t,n,s,i){Z6(t,n,s,i)}mount(t){this.isSVGTag=ok(t.tagName),super.mount(t)}}const _J=(e,t)=>ek(e)?new SJ(t):new wJ(t,{allowProjection:e!==g.Fragment}),NJ=XW({...$Q,...pJ,...QZ,...mJ},_J),Jn=dW(NJ);function ii(){return ii=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?g.useEffect:g.useLayoutEffect;function od(e,t,n){var s=g.useRef(t);s.current=t,g.useEffect(function(){function i(r){s.current(r)}return e&&window.addEventListener(e,i,n),function(){e&&window.removeEventListener(e,i)}},[e])}var TJ=["container"];function kJ(e){var t=e.container,n=t===void 0?document.body:t,s=Jx(e,TJ);return hi.createPortal(Ft.createElement("div",ii({},s)),n)}function AJ(e){return Ft.createElement("svg",ii({width:"44",height:"44",viewBox:"0 0 768 768"},e),Ft.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 CJ(e){return Ft.createElement("svg",ii({width:"44",height:"44",viewBox:"0 0 768 768"},e),Ft.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 IJ(e){return Ft.createElement("svg",ii({width:"44",height:"44",viewBox:"0 0 768 768"},e),Ft.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function jJ(){return g.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function yR(e){var t=e.touches[0],n=t.clientX,s=t.clientY;if(e.touches.length>=2){var i=e.touches[1],r=i.clientX,a=i.clientY;return[(n+r)/2,(s+a)/2,Math.sqrt(Math.pow(r-n,2)+Math.pow(a-s,2))]}return[n,s,0]}var Sl=function(e,t,n,s){var i,r=n*t,a=(r-s)/2,l=e;return r<=s?(i=1,l=0):e>0&&a-e<=0?(i=2,l=a):e<0&&a+e<=0&&(i=3,l=-a),[i,l]};function Rv(e,t,n,s,i,r,a,l,c,u){a===void 0&&(a=innerWidth/2),l===void 0&&(l=innerHeight/2),c===void 0&&(c=0),u===void 0&&(u=0);var d=Sl(e,r,n,innerWidth)[0],f=Sl(t,r,s,innerHeight),h=innerWidth/2,p=innerHeight/2;return{x:a-r/i*(a-(h+e))-h+(s/n>=3&&n*r===innerWidth?0:d?c/2:c),y:l-r/i*(l-(p+t))-p+(f[0]?u/2:u),lastCX:a,lastCY:l}}function p_(e,t,n){var s=e%180!=0;return s?[n,t,s]:[t,n,s]}function Ov(e,t,n){var s=p_(n,innerWidth,innerHeight),i=s[0],r=s[1],a=0,l=i,c=r,u=e/t*r,d=t/e*i;return e=r?l=u:e>=i&&ti/r?c=d:t/e>=3&&!s[2]?a=((c=d)-r)/2:l=u,{width:l,height:c,x:0,y:a,pause:!0}}function j0(e,t){var n=t.leading,s=n!==void 0&&n,i=t.maxWait,r=t.wait,a=r===void 0?i||0:r,l=g.useRef(e);l.current=e;var c=g.useRef(0),u=g.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=g.useCallback(function(){var h=[].slice.call(arguments),p=Date.now();function m(){c.current=p,d(),l.current.apply(null,h)}var b=c.current,v=p-b;if(b===0&&(s&&m(),c.current=p),i!==void 0){if(v>i)return void m()}else v=1&&r&&r())};d()}function d(){c=requestAnimationFrame(u)}}var OJ={T:0,L:0,W:0,H:0,FIT:void 0},dB=function(){var e=g.useRef(!1);return g.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},MJ=["className"];function LJ(e){var t=e.className,n=t===void 0?"":t,s=Jx(e,MJ);return Ft.createElement("div",ii({className:"PhotoView__Spinner "+n},s),Ft.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},Ft.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"}),Ft.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var DJ=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function PJ(e){var t=e.src,n=e.loaded,s=e.broken,i=e.className,r=e.onPhotoLoad,a=e.loadingElement,l=e.brokenElement,c=Jx(e,DJ),u=dB();return t&&!s?Ft.createElement(Ft.Fragment,null,Ft.createElement("img",ii({className:"PhotoView__Photo"+(i?" "+i:""),src:t,onLoad:function(d){var f=d.target;u.current&&r({loaded:!0,naturalWidth:f.naturalWidth,naturalHeight:f.naturalHeight})},onError:function(){u.current&&r({broken:!0})},draggable:!1,alt:""},c)),!n&&(a?Ft.createElement("span",{className:"PhotoView__icon"},a):Ft.createElement(LJ,{className:"PhotoView__icon"}))):l?Ft.createElement("span",{className:"PhotoView__icon"},typeof l=="function"?l({src:t}):l):null}var BJ={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 UJ(e){var t=e.item,n=t.src,s=t.render,i=t.width,r=i===void 0?0:i,a=t.height,l=a===void 0?0:a,c=t.originRef,u=e.visible,d=e.speed,f=e.easing,h=e.wrapClassName,p=e.className,m=e.style,b=e.loadingElement,v=e.brokenElement,y=e.onPhotoTap,x=e.onMaskTap,E=e.onReachMove,w=e.onReachUp,_=e.onPhotoResize,S=e.isActive,k=e.expose,T=Uy(BJ),C=T[0],I=T[1],j=g.useRef(0),L=dB(),z=C.naturalWidth,D=z===void 0?r:z,F=C.naturalHeight,A=F===void 0?l:F,M=C.width,P=M===void 0?r:M,H=C.height,R=H===void 0?l:H,Y=C.loaded,J=Y===void 0?!n:Y,U=C.broken,te=C.x,K=C.y,V=C.touched,W=C.stopRaf,q=C.maskTouched,ue=C.rotate,pe=C.scale,we=C.CX,de=C.CY,ge=C.lastX,Le=C.lastY,Ee=C.lastCX,ie=C.lastCY,Ne=C.lastScale,ve=C.touchTime,Qe=C.touchLength,De=C.pause,Ke=C.reach,Se=qc({onScale:function(me){return He(I0(me))},onRotate:function(me){ue!==me&&(k({rotate:me}),I(ii({rotate:me},Ov(D,A,me))))}});function He(me,We,bt){pe!==me&&(k({scale:me}),I(ii({scale:me},Rv(te,K,P,R,pe,me,We,bt),me<=1&&{x:0,y:0})))}var Be=j0(function(me,We,bt){if(bt===void 0&&(bt=0),(V||q)&&S){var an=p_(ue,P,R),Kn=an[0],xt=an[1];if(bt===0&&j.current===0){var $t=Math.abs(me-we)<=20,hn=Math.abs(We-de)<=20;if($t&&hn)return void I({lastCX:me,lastCY:We});j.current=$t?We>de?3:2:1}var cn,Pt=me-Ee,jt=We-ie;if(bt===0){var Sn=Sl(Pt+ge,pe,Kn,innerWidth)[0],pn=Sl(jt+Le,pe,xt,innerHeight);cn=function(Fn,hs,ps,Rn){return hs&&Fn===1||Rn==="x"?"x":ps&&Fn>1||Rn==="y"?"y":void 0}(j.current,Sn,pn[0],Ke),cn!==void 0&&E(cn,me,We,pe)}if(cn==="x"||q)return void I({reach:"x"});var zt=I0(pe+(bt-Qe)/100/2*pe,D/P,.2);k({scale:zt}),I(ii({touchLength:bt,reach:cn,scale:zt},Rv(te,K,P,R,pe,zt,me,We,Pt,jt)))}},{maxWait:8});function qe(me){return!W&&!V&&(L.current&&I(ii({},me,{pause:u})),L.current)}var Z,ae,ne,xe,Fe,at,It,ft,fn=(Fe=function(me){return qe({x:me})},at=function(me){return qe({y:me})},It=function(me){return L.current&&(k({scale:me}),I({scale:me})),!V&&L.current},ft=qc({X:function(me){return Fe(me)},Y:function(me){return at(me)},S:function(me){return It(me)}}),function(me,We,bt,an,Kn,xt,$t,hn,cn,Pt,jt){var Sn=p_(Pt,Kn,xt),pn=Sn[0],zt=Sn[1],Fn=Sl(me,hn,pn,innerWidth),hs=Fn[0],ps=Fn[1],Rn=Sl(We,hn,zt,innerHeight),$s=Rn[0],ms=Rn[1],$n=Date.now()-jt;if($n>=200||hn!==$t||Math.abs(cn-$t)>1){var Hs=Rv(me,We,Kn,xt,$t,hn),Hn=Hs.x,js=Hs.y,_n=hs?ps:Hn!==me?Hn:null,ss=$s?ms:js!==We?js:null;return _n!==null&&Mc(me,_n,ft.X),ss!==null&&Mc(We,ss,ft.Y),void(hn!==$t&&Mc($t,hn,ft.S))}var is=(me-bt)/$n,_s=(We-an)/$n,gs=Math.sqrt(Math.pow(is,2)+Math.pow(_s,2)),zs=!1,bs=!1;(function(On,Nn){var ce,Ae=On,Re=0,Je=0,st=function(Mn){ce||(ce=Mn);var Tn=Mn-ce,qt=Math.sign(On),pi=-.001*qt,Pe=Math.sign(-Ae)*Math.pow(Ae,2)*2e-4,Vt=Ae*Tn+(pi+Pe)*Math.pow(Tn,2)/2;Re+=Vt,ce=Mn,qt*(Ae+=(pi+Pe)*Tn)<=0?kt():Nn(Re)?ot():kt()};function ot(){Je=requestAnimationFrame(st)}function kt(){cancelAnimationFrame(Je)}ot()})(gs,function(On){var Nn=me+On*(is/gs),ce=We+On*(_s/gs),Ae=Sl(Nn,$t,pn,innerWidth),Re=Ae[0],Je=Ae[1],st=Sl(ce,$t,zt,innerHeight),ot=st[0],kt=st[1];if(Re&&!zs&&(zs=!0,hs?Mc(Nn,Je,ft.X):xR(Je,Nn+(Nn-Je),ft.X)),ot&&!bs&&(bs=!0,$s?Mc(ce,kt,ft.Y):xR(kt,ce+(ce-kt),ft.Y)),zs&&bs)return!1;var Mn=zs||ft.X(Je),Tn=bs||ft.Y(kt);return Mn&&Tn})}),Et=(Z=y,ae=function(me,We){Ke||He(pe!==1?1:Math.max(2,D/P),me,We)},ne=g.useRef(0),xe=j0(function(){ne.current=0,Z.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var me=[].slice.call(arguments);ne.current+=1,xe.apply(void 0,me),ne.current>=2&&(xe.cancel(),ne.current=0,ae.apply(void 0,me))});function Nt(me,We){if(j.current=0,(V||q)&&S){I({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var bt=I0(pe,D/P);if(fn(te,K,ge,Le,P,R,pe,bt,Ne,ue,ve),w(me,We),we===me&&de===We){if(V)return void Et(me,We);q&&x(me,We)}}}function Qt(me,We,bt){bt===void 0&&(bt=0),I({touched:!0,CX:me,CY:We,lastCX:me,lastCY:We,lastX:te,lastY:K,lastScale:pe,touchLength:bt,touchTime:Date.now()})}function Ve(me){I({maskTouched:!0,CX:me.clientX,CY:me.clientY,lastX:te,lastY:K})}od(Co?void 0:"mousemove",function(me){me.preventDefault(),Be(me.clientX,me.clientY)}),od(Co?void 0:"mouseup",function(me){Nt(me.clientX,me.clientY)}),od(Co?"touchmove":void 0,function(me){me.preventDefault();var We=yR(me);Be.apply(void 0,We)},{passive:!1}),od(Co?"touchend":void 0,function(me){var We=me.changedTouches[0];Nt(We.clientX,We.clientY)},{passive:!1}),od("resize",j0(function(){J&&!V&&(I(Ov(D,A,ue)),_())},{maxWait:8})),h_(function(){S&&k(ii({scale:pe,rotate:ue},Se))},[S]);var Tt=function(me,We,bt,an,Kn,xt,$t,hn,cn,Pt){var jt=function(Hn,js,_n,ss,is){var _s=g.useRef(!1),gs=Uy({lead:!0,scale:_n}),zs=gs[0],bs=zs.lead,On=zs.scale,Nn=gs[1],ce=j0(function(Ae){try{return is(!0),Nn({lead:!1,scale:Ae}),Promise.resolve()}catch(Re){return Promise.reject(Re)}},{wait:ss});return h_(function(){_s.current?(is(!1),Nn({lead:!0}),ce(_n)):_s.current=!0},[_n]),bs?[Hn*On,js*On,_n/On]:[Hn*_n,js*_n,1]}(xt,$t,hn,cn,Pt),Sn=jt[0],pn=jt[1],zt=jt[2],Fn=function(Hn,js,_n,ss,is){var _s=g.useState(OJ),gs=_s[0],zs=_s[1],bs=g.useState(0),On=bs[0],Nn=bs[1],ce=g.useRef(),Ae=qc({OK:function(){return Hn&&Nn(4)}});function Re(Je){is(!1),Nn(Je)}return g.useEffect(function(){if(ce.current||(ce.current=Date.now()),_n){if(function(Je,st){var ot=Je&&Je.current;if(ot&&ot.nodeType===1){var kt=ot.getBoundingClientRect();st({T:kt.top,L:kt.left,W:kt.width,H:kt.height,FIT:ot.tagName==="IMG"?getComputedStyle(ot).objectFit:void 0})}}(js,zs),Hn)return Date.now()-ce.current<250?(Nn(1),requestAnimationFrame(function(){Nn(2),requestAnimationFrame(function(){return Re(3)})}),void setTimeout(Ae.OK,ss)):void Nn(4);Re(5)}},[Hn,_n]),[On,gs]}(me,We,bt,cn,Pt),hs=Fn[0],ps=Fn[1],Rn=ps.W,$s=ps.FIT,ms=innerWidth/2,$n=innerHeight/2,Hs=hs<3||hs>4;return[Hs?Rn?ps.L:ms:an+(ms-xt*hn/2),Hs?Rn?ps.T:$n:Kn+($n-$t*hn/2),Sn,Hs&&$s?Sn*(ps.H/Rn):pn,hs===0?zt:Hs?Rn/(xt*hn)||.01:zt,Hs?$s?1:0:1,hs,$s]}(u,c,J,te,K,P,R,pe,d,function(me){return I({pause:me})}),rt=Tt[4],ut=Tt[6],Ze="transform "+d+"ms "+f,_t={className:p,onMouseDown:Co?void 0:function(me){me.stopPropagation(),me.button===0&&Qt(me.clientX,me.clientY,0)},onTouchStart:Co?function(me){me.stopPropagation(),Qt.apply(void 0,yR(me))}:void 0,onWheel:function(me){if(!Ke){var We=I0(pe-me.deltaY/100/2,D/P);I({stopRaf:!0}),He(We,me.clientX,me.clientY)}},style:{width:Tt[2]+"px",height:Tt[3]+"px",opacity:Tt[5],objectFit:ut===4?void 0:Tt[7],transform:ue?"rotate("+ue+"deg)":void 0,transition:ut>2?Ze+", opacity "+d+"ms ease, height "+(ut<4?d/2:ut>4?d:0)+"ms "+f:void 0}};return Ft.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:m,onMouseDown:!Co&&S?Ve:void 0,onTouchStart:Co&&S?function(me){return Ve(me.touches[0])}:void 0},Ft.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+rt+", 0, 0, "+rt+", "+Tt[0]+", "+Tt[1]+")",transition:V||De?void 0:Ze,willChange:S?"transform":void 0}},n?Ft.createElement(PJ,ii({src:n,loaded:J,broken:U},_t,{onPhotoLoad:function(me){I(ii({},me,me.loaded&&Ov(me.naturalWidth||0,me.naturalHeight||0,ue)))},loadingElement:b,brokenElement:v})):s&&s({attrs:_t,scale:rt,rotate:ue})))}var ER={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 FJ(e){var t=e.loop,n=t===void 0?3:t,s=e.speed,i=e.easing,r=e.photoClosable,a=e.maskClosable,l=a===void 0||a,c=e.maskOpacity,u=c===void 0?1:c,d=e.pullClosable,f=d===void 0||d,h=e.bannerVisible,p=h===void 0||h,m=e.overlayRender,b=e.toolbarRender,v=e.className,y=e.maskClassName,x=e.photoClassName,E=e.photoWrapClassName,w=e.loadingElement,_=e.brokenElement,S=e.images,k=e.index,T=k===void 0?0:k,C=e.onIndexChange,I=e.visible,j=e.onClose,L=e.afterClose,z=e.portalContainer,D=Uy(ER),F=D[0],A=D[1],M=g.useState(0),P=M[0],H=M[1],R=F.x,Y=F.touched,J=F.pause,U=F.lastCX,te=F.lastCY,K=F.bg,V=K===void 0?u:K,W=F.lastBg,q=F.overlay,ue=F.minimal,pe=F.scale,we=F.rotate,de=F.onScale,ge=F.onRotate,Le=e.hasOwnProperty("index"),Ee=Le?T:P,ie=Le?C:H,Ne=g.useRef(Ee),ve=S.length,Qe=S[Ee],De=typeof n=="boolean"?n:ve>n,Ke=function(rt,ut){var Ze=g.useReducer(function(bt){return!bt},!1)[1],_t=g.useRef(0),me=function(bt){var an=g.useRef(bt);function Kn(xt){an.current=xt}return g.useMemo(function(){(function(xt){rt?(xt(rt),_t.current=1):_t.current=2})(Kn)},[bt]),[an.current,Kn]}(rt),We=me[1];return[me[0],_t.current,function(){Ze(),_t.current===2&&(We(!1),ut&&ut()),_t.current=0}]}(I,L),Se=Ke[0],He=Ke[1],Be=Ke[2];h_(function(){if(Se)return A({pause:!0,x:Ee*-(innerWidth+Ku)}),void(Ne.current=Ee);A(ER)},[Se]);var qe=qc({close:function(rt){ge&&ge(0),A({overlay:!0,lastBg:V}),j(rt)},changeIndex:function(rt,ut){ut===void 0&&(ut=!1);var Ze=De?Ne.current+(rt-Ee):rt,_t=ve-1,me=f_(Ze,0,_t),We=De?Ze:me,bt=innerWidth+Ku;A({touched:!1,lastCX:void 0,lastCY:void 0,x:-bt*We,pause:ut}),Ne.current=We,ie&&ie(De?rt<0?_t:rt>_t?0:rt:me)}}),Z=qe.close,ae=qe.changeIndex;function ne(rt){return rt?Z():A({overlay:!q})}function xe(){A({x:-(innerWidth+Ku)*Ee,lastCX:void 0,lastCY:void 0,pause:!0}),Ne.current=Ee}function Fe(rt,ut,Ze,_t){rt==="x"?function(me){if(U!==void 0){var We=me-U,bt=We;!De&&(Ee===0&&We>0||Ee===ve-1&&We<0)&&(bt=We/2),A({touched:!0,lastCX:U,x:-(innerWidth+Ku)*Ne.current+bt,pause:!1})}else A({touched:!0,lastCX:me,x:R,pause:!1})}(ut):rt==="y"&&function(me,We){if(te!==void 0){var bt=u===null?null:f_(u,.01,u-Math.abs(me-te)/100/4);A({touched:!0,lastCY:te,bg:We===1?bt:u,minimal:We===1})}else A({touched:!0,lastCY:me,bg:V,minimal:!0})}(Ze,_t)}function at(rt,ut){var Ze=rt-(U??rt),_t=ut-(te??ut),me=!1;if(Ze<-40)ae(Ee+1);else if(Ze>40)ae(Ee-1);else{var We=-(innerWidth+Ku)*Ne.current;Math.abs(_t)>100&&ue&&f&&(me=!0,Z()),A({touched:!1,x:We,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!me||q})}}od("keydown",function(rt){if(I)switch(rt.key){case"ArrowLeft":ae(Ee-1,!0);break;case"ArrowRight":ae(Ee+1,!0);break;case"Escape":Z()}});var It=function(rt,ut,Ze){return g.useMemo(function(){var _t=rt.length;return Ze?rt.concat(rt).concat(rt).slice(_t+ut-1,_t+ut+2):rt.slice(Math.max(ut-1,0),Math.min(ut+2,_t+1))},[rt,ut,Ze])}(S,Ee,De);if(!Se)return null;var ft=q&&!He,fn=I?V:W,Et=de&&ge&&{images:S,index:Ee,visible:I,onClose:Z,onIndexChange:ae,overlayVisible:ft,overlay:Qe&&Qe.overlay,scale:pe,rotate:we,onScale:de,onRotate:ge},Nt=s?s(He):400,Qt=i?i(He):bR,Ve=s?s(3):600,Tt=i?i(3):bR;return Ft.createElement(kJ,{className:"PhotoView-Portal"+(ft?"":" PhotoView-Slider__clean")+(I?"":" PhotoView-Slider__willClose")+(v?" "+v:""),role:"dialog",onClick:function(rt){return rt.stopPropagation()},container:z},I&&Ft.createElement(jJ,null),Ft.createElement("div",{className:"PhotoView-Slider__Backdrop"+(y?" "+y:"")+(He===1?" PhotoView-Slider__fadeIn":He===2?" PhotoView-Slider__fadeOut":""),style:{background:fn?"rgba(0, 0, 0, "+fn+")":void 0,transitionTimingFunction:Qt,transitionDuration:(Y?0:Nt)+"ms",animationDuration:Nt+"ms"},onAnimationEnd:Be}),p&&Ft.createElement("div",{className:"PhotoView-Slider__BannerWrap"},Ft.createElement("div",{className:"PhotoView-Slider__Counter"},Ee+1," / ",ve),Ft.createElement("div",{className:"PhotoView-Slider__BannerRight"},b&&Et&&b(Et),Ft.createElement(AJ,{className:"PhotoView-Slider__toolbarIcon",onClick:Z}))),It.map(function(rt,ut){var Ze=De||Ee!==0?Ne.current-1+ut:Ee+ut;return Ft.createElement(UJ,{key:De?rt.key+"/"+rt.src+"/"+Ze:rt.key,item:rt,speed:Nt,easing:Qt,visible:I,onReachMove:Fe,onReachUp:at,onPhotoTap:function(){return ne(r)},onMaskTap:function(){return ne(l)},wrapClassName:E,className:x,style:{left:(innerWidth+Ku)*Ze+"px",transform:"translate3d("+R+"px, 0px, 0)",transition:Y||J?void 0:"transform "+Ve+"ms "+Tt},loadingElement:w,brokenElement:_,onPhotoResize:xe,isActive:Ne.current===Ze,expose:A})}),!Co&&p&&Ft.createElement(Ft.Fragment,null,(De||Ee!==0)&&Ft.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return ae(Ee-1,!0)}},Ft.createElement(CJ,null)),(De||Ee+1-1){var y=u.slice();return y.splice(v,1,b),void l({images:y})}l(function(x){return{images:x.images.concat(b)}})},remove:function(b){l(function(v){var y=v.images.filter(function(x){return x.key!==b});return{images:y,index:Math.min(y.length-1,f)}})},show:function(b){var v=u.findIndex(function(y){return y.key===b});l({visible:!0,index:v}),s&&s(!0,v,a)}}),p=qc({close:function(){l({visible:!1}),s&&s(!1,f,a)},changeIndex:function(b){l({index:b}),n&&n(b,a)}}),m=g.useMemo(function(){return ii({},a,h)},[a,h]);return Ft.createElement(uB.Provider,{value:m},t,Ft.createElement(FJ,ii({images:u,visible:d,index:f,onIndexChange:p.changeIndex,onClose:p.close},i)))}var fB=function(e){var t,n,s=e.src,i=e.render,r=e.overlay,a=e.width,l=e.height,c=e.triggers,u=c===void 0?["onClick"]:c,d=e.children,f=g.useContext(uB),h=(t=function(){return f.nextId()},(n=g.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),p=g.useRef(null);g.useImperativeHandle(d==null?void 0:d.ref,function(){return p.current}),g.useEffect(function(){return function(){f.remove(h)}},[]);var m=qc({render:function(v){return i&&i(v)},show:function(v,y){f.show(h),function(x,E){if(d){var w=d.props[x];w&&w(E)}}(v,y)}}),b=g.useMemo(function(){var v={};return u.forEach(function(y){v[y]=m.show.bind(null,y)}),v},[]);return g.useEffect(function(){f.update({key:h,src:s,originRef:p,render:m.render,overlay:r,width:a,height:l})},[s]),d?g.Children.only(g.cloneElement(d,ii({},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 FJ=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),cB=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();/** + */const VJ=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),hB=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.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 $J={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"};/** + */var GJ={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 HJ=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:i="",children:r,iconNode:a,...l},c)=>g.createElement("svg",{ref:c,...$J,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:cB("lucide",i),...l},[...a.map(([u,d])=>g.createElement(u,d)),...Array.isArray(r)?r:[r]]));/** + */const KJ=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:i="",children:r,iconNode:a,...l},c)=>g.createElement("svg",{ref:c,...GJ,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:hB("lucide",i),...l},[...a.map(([u,d])=>g.createElement(u,d)),...Array.isArray(r)?r:[r]]));/** * @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=(e,t)=>{const n=g.forwardRef(({className:s,...i},r)=>g.createElement(HJ,{ref:r,iconNode:t,className:cB(`lucide-${FJ(e)}`,s),...i}));return n.displayName=`${e}`,n};/** + */const Ge=(e,t)=>{const n=g.forwardRef(({className:s,...i},r)=>g.createElement(KJ,{ref:r,iconNode:t,className:hB(`lucide-${VJ(e)}`,s),...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 zJ=ze("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"}]]);/** + */const qJ=Ge("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 wk=ze("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + */const Tk=Ge("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 uB=ze("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"}]]);/** + */const pB=Ge("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 Pp=ze("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + */const Dp=Ge("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 dB=ze("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** + */const mB=Ge("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 fB=ze("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"}]]);/** + */const gB=Ge("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 VJ=ze("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"}]]);/** + */const YJ=Ge("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 ru=ze("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"}]]);/** + */const au=Ge("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 GJ=ze("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"}]]);/** + */const WJ=Ge("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 KJ=ze("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"}]]);/** + */const XJ=Ge("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 qJ=ze("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"}]]);/** + */const QJ=Ge("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 Ra=ze("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + */const ja=Ge("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 hB=ze("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const bB=Ge("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 Ql=ze("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const nc=Ge("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 Sk=ze("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"}]]);/** + */const kk=Ge("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 YJ=ze("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const ZJ=Ge("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 bR=ze("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"}]]);/** + */const vR=Ge("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 WJ=ze("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** + */const JJ=Ge("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 _k=ze("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"}]]);/** + */const Ak=Ge("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 Zx=ze("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"}]]);/** + */const e1=Ge("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 XJ=ze("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** + */const eee=Ge("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** * @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 QJ=ze("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"}]]);/** + */const tee=Ge("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 Ib=ze("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"}]]);/** + */const Rb=Ge("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 Jx=ze("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"}]]);/** + */const t1=Ge("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 ZJ=ze("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"}]]);/** + */const nee=Ge("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 vm=ze("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"}]]);/** + */const Em=Ge("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 JJ=ze("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"}]]);/** + */const see=Ge("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 yR=ze("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"}]]);/** + */const wR=Ge("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 eee=ze("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"}]]);/** + */const iee=Ge("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 tee=ze("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"}]]);/** + */const ree=Ge("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 Nk=ze("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"}]]);/** + */const Ck=Ge("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 nee=ze("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"}]]);/** + */const aee=Ge("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 pB=ze("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"}]]);/** + */const yB=Ge("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 see=ze("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"}]]);/** + */const oee=Ge("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 iee=ze("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** + */const lee=Ge("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** * @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 ree=ze("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"}]]);/** + */const cee=Ge("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 Tk=ze("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"}]]);/** + */const Ik=Ge("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 mB=ze("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"}]]);/** + */const xB=Ge("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 aee=ze("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"}]]);/** + */const uee=Ge("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 oee=ze("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"}]]);/** + */const dee=Ge("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 e1=ze("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"}]]);/** + */const n1=Ge("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 lee=ze("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"}]]);/** + */const fee=Ge("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 cee=ze("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"}]]);/** + */const hee=Ge("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 kk=ze("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"}]]);/** + */const jk=Ge("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 ic=ze("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + */const cc=Ge("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 uee=ze("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"}]]);/** + */const pee=Ge("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 gB=ze("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"}]]);/** + */const EB=Ge("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 dee=ze("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"}]]);/** + */const mee=Ge("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 bB=ze("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"}]]);/** + */const vB=Ge("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 mn=ze("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + */const dn=Ge("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 fee=ze("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"}]]);/** + */const gee=Ge("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 hee=ze("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"}]]);/** + */const bee=Ge("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 qc=ze("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"}]]);/** + */const Yc=Ge("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 pee=ze("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** + */const yee=Ge("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** * @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 yB=ze("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"}]]);/** + */const wB=Ge("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 mee=ze("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"}]]);/** + */const xee=Ge("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 gee=ze("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"}]]);/** + */const Eee=Ge("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 bee=ze("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"}]]);/** + */const vee=Ge("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 yee=ze("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** + */const wee=Ge("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** * @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 xee=ze("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"}]]);/** + */const See=Ge("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 Eee=ze("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"}]]);/** + */const _ee=Ge("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 vee=ze("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"}]]);/** + */const Nee=Ge("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 wee=ze("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"}]]);/** + */const Tee=Ge("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 See=ze("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** + */const kee=Ge("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 _i=ze("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + */const _i=Ge("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 _ee=ze("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"}]]);/** + */const Aee=Ge("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 Ak=ze("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"}]]);/** + */const Rk=Ge("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 Nee=ze("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"}]]);/** + */const Cee=Ge("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 Tee=ze("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"}]]);/** + */const Iee=Ge("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 By=ze("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const Fy=Ge("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 kee=ze("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"}]]);/** + */const jee=Ge("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 Aee=ze("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"}]]);/** + */const Ree=Ge("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 xR=ze("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"}]]);/** + */const SR=Ge("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 au=ze("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"}]]);/** + */const ou=Ge("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 Cee=ze("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"}]]);/** + */const Oee=Ge("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 Zl=ze("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"}]]);/** + */const sc=Ge("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 Iee=ze("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"}]]);/** + */const Mee=Ge("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 jee=ze("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"}]]);/** + */const Lee=Ge("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 Ree=ze("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"}]]);/** + */const Dee=Ge("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 Oee=ze("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"}]]);/** + */const Pee=Ge("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 Mee=ze("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"}]]);/** + */const Bee=Ge("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 xB=ze("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"}]]);/** + */const SB=Ge("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=ze("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),ER="veadk_auth_qs";let Bh=null;function Lee(){if(Bh!==null)return Bh;const t=new URLSearchParams(window.location.search).toString();return t?(sessionStorage.setItem(ER,t),Bh=t):Bh=sessionStorage.getItem(ER)??"",window.location.search&&window.history.replaceState(null,"",window.location.pathname+window.location.hash),Bh}function Cn(e){const t=Lee();if(!t)return e;const n=new URL(e,window.location.origin);return new URLSearchParams(t).forEach((s,i)=>{n.searchParams.has(i)||n.searchParams.set(i,s)}),/^https?:\/\//i.test(e)?n.toString():n.pathname+n.search+n.hash}const rc=3e4,ug=12e4,Ck=1e4;function Un(e,t=rc){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const Uy="veadk_local_user",Fy="veadk_local_user_tab",Dee=/^[A-Za-z0-9]{1,16}$/;function EB(){try{const e=sessionStorage.getItem(Fy);if(e)return e;const t=localStorage.getItem(Uy);return t&&sessionStorage.setItem(Fy,t),t}catch{try{return localStorage.getItem(Uy)}catch{return null}}}function vR(e){try{sessionStorage.setItem(Fy,e)}catch{}try{localStorage.setItem(Uy,e)}catch{}}function Pee(){try{sessionStorage.removeItem(Fy)}catch{}try{localStorage.removeItem(Uy)}catch{}}function t1(e){const t=new Headers(e),n=EB();return n&&t.set("X-VeADK-Local-User",n),t}async function vB(){let e;try{e=await fetch("/web/auth-config",{headers:{Accept:"application/json"},signal:Un(void 0,Ck)})}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 Bee(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function Uee(){const e=window.location.pathname+window.location.search+window.location.hash,t=window.open("about:blank","_blank","popup,width=520,height=720");if(!t)return null;try{t.opener=null,t.location.replace(`/oauth2/login?redirect=${encodeURIComponent(e)}`)}catch{return t.close(),null}return t}async function Fee(){const[e,t]=await Promise.all([d_(),vB()]);return e.status==="unauthenticated"&&t.length>0}function $ee(){window.location.assign("/oauth2/logout")}async function d_(){let e;try{e=await fetch("/oauth2/userinfo",{headers:{Accept:"application/json"},signal:Un(void 0,Ck)})}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=EB();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function Hee(e){return e?String(e.name??e.preferred_username??e.email??e.sub??""):""}function zee(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const f_="veadk:authentication-required";let Bp=null,lp=null;function Vee(e){if(!e.redirected||!e.url)return!1;try{const t=new URL(e.url);return t.pathname.includes("/authorize")||t.pathname.includes("/oauth2/login")||t.hostname.includes(".userpool.auth.")}catch{return!1}}function Gee(e){Bp||(Bp=new Promise(n=>{lp=n}),window.dispatchEvent(new Event(f_)));const t=Bp;return e?e.aborted?Promise.reject(e.reason??new Error("Request aborted")):new Promise((n,s)=>{const i=()=>s(e.reason??new Error("Request aborted"));e.addEventListener("abort",i,{once:!0}),t.then(()=>{e.removeEventListener("abort",i),n()},r=>{e.removeEventListener("abort",i),s(r)})}):t}function Kee(){return Bp!==null}function qee(){lp==null||lp(),lp=null,Bp=null}async function n1(e,t){var s;const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{const i=((s=e.headers.get("content-type"))==null?void 0:s.split(";",1)[0])||"Content-Type 缺失",r=n.trim().slice(0,2e3),a=r?` -响应:${r}`:"";throw new Error(`${t}:服务端返回非 JSON 响应(HTTP ${e.status},${i})${a}`)}}const Yee=/\brun_sse\s*failed\s*:\s*404\b/i,Wee=/session not found/i,Xee=/(?:^|[::\s])not found\s*$/i,Qee=/Expecting (?:'[^']+'|\w+)(?: delimiter)?: line \d+ column \d+ \(char \d+\)/i,wR="提示:会话已不存在。使用 in-memory 或 SQLite 短期记忆时,多实例、进程重启或滚动发布都可能导致会话丢失;建议改用基于数据库的持久化短期记忆存储。",SR="提示:该 Runtime 未提供会话能力运行接口,可能是 Runtime 版本与当前 Studio 不兼容。",_R="提示:模型生成的工具参数格式不完整,请重新发送一次。";function I0(e){const t=String(e);return Qee.test(t)?t.includes(_R)?t:`${t} + */const Ti=Ge("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),_R="veadk_auth_qs";let Ph=null;function Uee(){if(Ph!==null)return Ph;const t=new URLSearchParams(window.location.search).toString();return t?(sessionStorage.setItem(_R,t),Ph=t):Ph=sessionStorage.getItem(_R)??"",window.location.search&&window.history.replaceState(null,"",window.location.pathname+window.location.hash),Ph}function Cn(e){const t=Uee();if(!t)return e;const n=new URL(e,window.location.origin);return new URLSearchParams(t).forEach((s,i)=>{n.searchParams.has(i)||n.searchParams.set(i,s)}),/^https?:\/\//i.test(e)?n.toString():n.pathname+n.search+n.hash}const uc=3e4,cg=12e4,Ok=1e4;function Pn(e,t=uc){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const $y="veadk_local_user",Hy="veadk_local_user_tab",Fee=/^[A-Za-z0-9]{1,16}$/;function _B(){try{const e=sessionStorage.getItem(Hy);if(e)return e;const t=localStorage.getItem($y);return t&&sessionStorage.setItem(Hy,t),t}catch{try{return localStorage.getItem($y)}catch{return null}}}function NR(e){try{sessionStorage.setItem(Hy,e)}catch{}try{localStorage.setItem($y,e)}catch{}}function $ee(){try{sessionStorage.removeItem(Hy)}catch{}try{localStorage.removeItem($y)}catch{}}function s1(e){const t=new Headers(e),n=_B();return n&&t.set("X-VeADK-Local-User",n),t}async function NB(){let e;try{e=await fetch("/web/auth-config",{headers:{Accept:"application/json"},signal:Pn(void 0,Ok)})}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 Hee(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function zee(){const e=window.location.pathname+window.location.search+window.location.hash,t=window.open("about:blank","_blank","popup,width=520,height=720");if(!t)return null;try{t.opener=null,t.location.replace(`/oauth2/login?redirect=${encodeURIComponent(e)}`)}catch{return t.close(),null}return t}async function Vee(){const[e,t]=await Promise.all([m_(),NB()]);return e.status==="unauthenticated"&&t.length>0}function Gee(){window.location.assign("/oauth2/logout")}async function m_(){let e;try{e=await fetch("/oauth2/userinfo",{headers:{Accept:"application/json"},signal:Pn(void 0,Ok)})}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=_B();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function Kee(e){return e?String(e.name??e.preferred_username??e.email??e.sub??""):""}function qee(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const g_="veadk:authentication-required";let Pp=null,op=null;function Yee(e){if(!e.redirected||!e.url)return!1;try{const t=new URL(e.url);return t.pathname.includes("/authorize")||t.pathname.includes("/oauth2/login")||t.hostname.includes(".userpool.auth.")}catch{return!1}}function Wee(e){Pp||(Pp=new Promise(n=>{op=n}),window.dispatchEvent(new Event(g_)));const t=Pp;return e?e.aborted?Promise.reject(e.reason??new Error("Request aborted")):new Promise((n,s)=>{const i=()=>s(e.reason??new Error("Request aborted"));e.addEventListener("abort",i,{once:!0}),t.then(()=>{e.removeEventListener("abort",i),n()},r=>{e.removeEventListener("abort",i),s(r)})}):t}function Xee(){return Pp!==null}function Qee(){op==null||op(),op=null,Pp=null}async function i1(e,t){var s;const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{const i=((s=e.headers.get("content-type"))==null?void 0:s.split(";",1)[0])||"Content-Type 缺失",r=n.trim().slice(0,2e3),a=r?` +响应:${r}`:"";throw new Error(`${t}:服务端返回非 JSON 响应(HTTP ${e.status},${i})${a}`)}}const Zee=/\brun_sse\s*failed\s*:\s*404\b/i,Jee=/session not found/i,ete=/(?:^|[::\s])not found\s*$/i,tte=/Expecting (?:'[^']+'|\w+)(?: delimiter)?: line \d+ column \d+ \(char \d+\)/i,TR="提示:会话已不存在。使用 in-memory 或 SQLite 短期记忆时,多实例、进程重启或滚动发布都可能导致会话丢失;建议改用基于数据库的持久化短期记忆存储。",kR="提示:该 Runtime 未提供会话能力运行接口,可能是 Runtime 版本与当前 Studio 不兼容。",AR="提示:模型生成的工具参数格式不完整,请重新发送一次。";function R0(e){const t=String(e);return tte.test(t)?t.includes(AR)?t:`${t} -${_R}`:Yee.test(t)?Wee.test(t)?t.includes(wR)?t:`${t} +${AR}`:Zee.test(t)?Jee.test(t)?t.includes(TR)?t:`${t} -${wR}`:Xee.test(t)?t.includes(SR)?t:`${t} +${TR}`:ete.test(t)?t.includes(kR)?t:`${t} -${SR}`:t:t}async function*Ik(e){if(!e.body)throw new Error("Response has no body");const t=e.body.getReader(),n=new TextDecoder;let s="";try{for(;;){const{done:i,value:r}=await t.read();if(i)break;s+=n.decode(r,{stream:!0});let a=s.match(/\r?\n\r?\n/);for(;(a==null?void 0:a.index)!==void 0;){const l=s.slice(0,a.index);s=s.slice(a.index+a[0].length);const c=l.split(/\r?\n/).filter(u=>u.startsWith("data:")).map(u=>u.slice(5).trimStart()).join(` -`);if(c)try{yield JSON.parse(c)}catch{c!=="[DONE]"&&c!=="ping"&&console.debug(`parseSSE: dropping unparseable frame (${c.length} chars):`,c.slice(0,200))}a=s.match(/\r?\n\r?\n/)}}}finally{try{await t.cancel()}catch{}finally{t.releaseLock()}}}const Zee=255,Jee=/[\p{L}\p{M}\p{N}\p{P}\p{Zs}]/u;function ete(e){const t=e.normalize("NFKC").replace(/\s+/gu," ").trim(),n=new TextEncoder;let s=0,i="";for(const r of t){if(!Jee.test(r))continue;const a=n.encode(r).byteLength;if(s+a>Zee)break;i+=r,s+=a}return i.replace(/ +/g," ").trimEnd()}const jk="veadk.messageFeedback.v1";function Rk(e,t,n,s){return[e,t,n,s].join(":")}function Ok(){if(typeof window>"u")return{};try{const e=JSON.parse(localStorage.getItem(jk)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function tte(e,t,n){if(typeof window>"u")return;const s=Ok();s[e]={...s[e]??{},[`veadk_feedback:${t}`]:n},localStorage.setItem(jk,JSON.stringify(s))}function wB(e){if(typeof window>"u")return;const t=Rk(e.runtimeId,e.appName,e.userId,e.sessionId),n=Ok(),s=n[t];if(s){for(const i of e.eventIds)delete s[`veadk_feedback:${i}`];Object.keys(s).length===0?delete n[t]:n[t]=s,localStorage.setItem(jk,JSON.stringify(n))}}const jb="",Mk=new Map;function SB(e,t){Mk.set(e,t)}function _B(){Mk.clear()}function Qs(e){const t=Mk.get(e);return t?{app:t.app,ep:{base:t.base,apiKey:t.apiKey,runtimeId:t.runtimeId,region:t.region}}:{app:e,ep:{}}}async function ht(e,t={},n={},s=rc){const i=!!n.runtimeId&&String(t.method??"GET").toUpperCase()==="DELETE",r={...t,...i?{method:"POST"}:{},headers:t1(t.headers)},a=()=>{const u={...r,signal:Un(t.signal,s)};if(n.runtimeId){const d=new URLSearchParams;n.region&&d.set("region",n.region),n.retryProbe&&d.set("probe_retry","connect"),i&&d.set("_method","DELETE");const f=d.toString()?`${e.includes("?")?"&":"?"}${d.toString()}`:"";return fetch(Cn(`${jb}/web/runtime-proxy/${n.runtimeId}${e}${f}`),u)}if(n.base){const d=new Headers(u.headers);return d.set("X-AgentKit-Base",n.base),n.apiKey&&d.set("X-AgentKit-Key",n.apiKey),fetch(Cn(`${jb}/agentkit-proxy${e}`),{...u,headers:d})}return fetch(Cn(`${jb}${e}`),u)},l=async u=>{if(Vee(u))return!0;if(u.status!==401)return!1;try{return await Fee()}catch{return!1}};let c=await a();for(;await l(c);)await Gee(t.signal),c=await a();return c}function NB(e,t={},n=rc){return ht(e,t,{},n)}function nte(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>{var n;if(t&&typeof t=="object"&&"msg"in t){const s=Array.isArray(t.loc)?(n=t.loc)==null?void 0:n.join("."):"",i=String(t.msg??"");return s?`${s}: ${i}`:i}return String(t)}).filter(Boolean).join(` -`):e&&typeof e=="object"?JSON.stringify(e):""}async function Vt(e,t){const n=await e.text().catch(()=>"");if(!n)return`${t} (${e.status})`;try{const s=JSON.parse(n);return nte(s.detail??s.error)||n||`${t} (${e.status})`}catch{return n||`${t} (${e.status})`}}async function TB(){const e=await ht("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class Yf extends Error{constructor(){super("当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。"),this.name="RuntimeAccessDeniedError"}}class Sr extends Error{constructor(t,n=!1){super(t),this.unsupported=n,this.name="RuntimeProbeError"}}const kB="Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime。请使用已绑定相同 VPC 的 Studio 访问,或改用公网 / 公网+VPC 部署。",AB="Runtime 已部署成功,但 Studio 暂时无法连接服务。网关域名可能仍在生效,或当前网络/DNS 无法访问该 Runtime,请稍后在智能体管理页重试连接。",ste=["cn-beijing","cn-shanghai"],ite=3e4,s1=5*60*1e3,CB=60*1e3,Rb=new Map,Ac=new Map,Cc=new Map,xa=new Map;function IB(e,t){return`${t}:${e}`}function Wf(e){const t=e||"cn-beijing";return[t,...ste.filter(n=>n!==t)]}function Xf(...e){return e.map(t=>String(t??"")).join("")}function Qf(e,t,n){const s=e.get(t);return s!=null&&s.value&&Date.now()-s.updatedAt<=n?s.value:null}function Lk(e,t,n){return e.set(t,{value:n,updatedAt:Date.now()}),n}async function jB(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function i1(e,t,n){const s=await ht("/list-apps",{},n??{base:e,apiKey:t}),i=n!=null&&n.runtimeId?await jB(s):"";if(n!=null&&n.runtimeId&&i==="runtime_access_denied")throw new Yf;if(n!=null&&n.runtimeId&&i==="runtime_private_endpoint_unreachable")throw new Sr(kB);if(n!=null&&n.runtimeId&&["runtime_proxy_connect_error","runtime_proxy_timeout","runtime_json_connect_error","runtime_json_timeout"].includes(i))throw new Sr(AB);if(n!=null&&n.runtimeId&&s.status===404)throw new Sr("该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",!0);if(n!=null&&n.runtimeId&&(s.status===401||s.status===403))throw new Sr("Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。");if(!s.ok)throw new Error(await Vt(s,"读取 Agent 列表失败"));const r=await s.json();return n!=null&&n.runtimeId&&Rb.set(IB(n.runtimeId,n.region??""),{apps:r,expiresAt:Date.now()+ite}),r}async function $y(e,t){const{app:n,ep:s}=Qs(e),i=await ht(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},s);if(!i.ok){const a=`创建会话失败 (${i.status})`,l=await Vt(i,"创建会话失败");throw new Error(l===a?a:`${a}:${l}`)}return(await i.json()).id}async function Dk(e,t){const{app:n,ep:s}=Qs(e),i=await ht(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{},s);if(!i.ok)throw new Error(`list sessions failed: ${i.status}`);return i.json()}async function Hy(e,t,n){const{app:s,ep:i}=Qs(e),r=await ht(`/apps/${s}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}`,{},i);if(!r.ok){const l=await Vt(r,"读取会话失败");throw new Error(`get session failed: ${r.status}:${l}`)}const a=await r.json();if(i.runtimeId){const l=Rk(i.runtimeId,s,t,n);a.state={...Ok()[l]??{},...a.state??{}}}return a}async function RB(e){const{app:t,ep:n}=Qs(e.appName);if(!n.runtimeId)throw new Error("只有连接到 AgentKit Runtime 的会话支持反馈回流");if(!n.region)throw new Error("Runtime 缺少地域信息,无法提交反馈");const s=await ht("/web/evaluation/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:n.runtimeId,region:n.region,appName:t,userId:e.userId,sessionId:e.sessionId,eventId:e.eventId,rating:e.rating,comment:e.comment??""})},{},ug);if(!s.ok)throw new Error(await Vt(s,"提交反馈失败"));const i=await s.json(),r=Rk(n.runtimeId,t,e.userId,e.sessionId);return tte(r,e.eventId,i),i}async function r1(e,t={}){const n=Xf(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),s=Qf(xa,n,CB);if(!t.force&&s)return s;const i=xa.get(n);if(!t.force&&(i!=null&&i.promise))return i.promise;let r=null;const a=(async()=>{for(const l of Wf(e.region)){const c=new URLSearchParams({runtimeId:e.runtimeId,region:l,appName:e.appName,page_size:String(e.pageSize??100)}),u=await ht(`/web/evaluation/feedback-cases?${c.toString()}`);if(u.ok)return Lk(xa,n,await u.json());r=new Error(await Vt(u,"读取评测集失败"))}throw r??new Error("读取评测集失败")})();xa.set(n,{...i,promise:a,updatedAt:(i==null?void 0:i.updatedAt)??0});try{return await a}finally{const l=xa.get(n);(l==null?void 0:l.promise)===a&&xa.set(n,{value:l.value,updatedAt:l.updatedAt})}}async function OB(e){let t=null;for(const n of Wf(e.region)){const s=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName,userId:e.userId}),i=await ht(`/web/evaluation/statuses?${s.toString()}`);if(i.ok)return i.json();t=new Error(await Vt(i,"读取自动评测状态失败"))}throw t??new Error("读取自动评测状态失败")}async function MB(e){let t=null;for(const n of Wf(e.region)){const s=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName}),i=await ht(`/web/evaluation/optimizations?${s.toString()}`);if(i.ok)return i.json();t=new Error(await Vt(i,"读取优化项失败"))}throw t??new Error("读取优化项失败")}function LB(e){return Qf(xa,Xf(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),CB)}function h_(e){r1(e).catch(()=>{})}function DB(e){r1(e,{force:!0}).catch(()=>{})}function PB(e,t){return["good","bad"].map(n=>{const s=e.find(i=>i.kind===n);return{kind:n,evaluationSetId:(s==null?void 0:s.evaluationSetId)??null,evaluationSetName:(s==null?void 0:s.evaluationSetName)??null,workspaceId:(s==null?void 0:s.workspaceId)??null,itemCount:t.filter(i=>i.kind===n).length}})}function Ob(e){for(const[t,n]of xa.entries()){const s=n.value;if(!s||s.runtimeId!==e.runtimeId||s.agentName!==e.appName)continue;const i=s.items.filter(a=>a.sessionId!==e.sessionId||a.messageId!==e.messageId),r=e.rating?[{id:`local:${e.runtimeId}:${e.sessionId}:${e.messageId}`,itemKey:`local:${e.messageId}`,kind:e.rating,input:e.input,output:e.output,referenceOutput:e.referenceOutput??e.output,comment:"",agentName:e.appName,sessionId:e.sessionId,messageId:e.messageId,runtimeId:e.runtimeId,invocationId:e.invocationId??"",userId:e.userId,createdAt:e.createdAt??new Date().toISOString(),evaluationSetId:"",evaluationSetName:"",workspaceId:""},...i]:i;xa.set(t,{value:{...s,sets:PB(s.sets,r),items:r},updatedAt:Date.now(),promise:n.promise})}}async function BB(e){let t=null;for(const n of Wf(e.region)){const s=await ht("/web/evaluation/feedback-cases/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e.runtimeId,region:n,appName:e.appName,itemIds:e.itemIds})},{},ug);if(s.ok){const i=await s.json(),r=new Set(e.itemIds);for(const[a,l]of xa.entries()){const c=l.value;if(!c||c.runtimeId!==e.runtimeId||c.agentName!==e.appName)continue;const u=c.items.filter(d=>!r.has(d.id));xa.set(a,{value:{...c,sets:PB(c.sets,u),items:u},updatedAt:Date.now()})}return i}t=new Error(await Vt(s,"删除评测案例失败"))}throw t??new Error("删除评测案例失败")}async function p_(e,t,n){const{app:s,ep:i}=Qs(e),r=await ht(`/apps/${s}/users/${encodeURIComponent(t)}/sessions/${n}`,{method:"DELETE"},i);if(!r.ok&&r.status!==404)throw new Error(`delete session failed: ${r.status}`)}function rte(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"="),s=window.atob(n),i=new Uint8Array(s.length);for(let r=0;rURL.revokeObjectURL(l),0)}async function FB(e,t,n,s,i){const{app:r,ep:a}=Qs(e),l=i==null?"":`?version=${encodeURIComponent(i)}`,c=`/apps/${encodeURIComponent(r)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/artifacts/${encodeURIComponent(s)}${l}`,u=await ht(c,{},a,ug);if(!u.ok)throw new Error(await Vt(u,"下载文件失败"));const d=await u.json(),f=d.inlineData??d.inline_data;if(!(f!=null&&f.data))throw new Error("文件内容不可用");const h=rte(f.data),p=h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength);return{blob:new Blob([p],{type:f.mimeType??f.mime_type??"application/octet-stream"}),downloadName:f.displayName??f.display_name??s}}async function $B(e,t,n,s,i){const{blob:r}=await FB(e,t,n,s,i);return URL.createObjectURL(r)}async function ate(e){const t=await ht("/web/media/capabilities");if(!t.ok)throw new Error(await Vt(t,"media capabilities failed"));return t.json()}async function HB(e,t,n,s){const{app:i}=Qs(e),r=new FormData;r.set("app_name",i),r.set("user_id",t),r.set("session_id",n),r.set("file",s);const a=await ht("/web/media",{method:"POST",body:r},{},ug);if(!a.ok)throw new Error(await Vt(a,"文件上传失败"));return{...await a.json(),status:"ready"}}async function m_(e,t,n){const{app:s}=Qs(e),i=`/web/media/${encodeURIComponent(s)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}/delete`,r=await ht(i,{method:"POST"});if(!r.ok&&r.status!==404)throw new Error(await Vt(r,"media cleanup failed"))}function zB(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((s,i)=>![1,3,5].includes(i)).join("/")}`}catch{return}}async function Mb(e,t){const n=zB(t);if(!n)throw new Error("Invalid VeADK media URI");const s=await ht(`${n}/delete`,{method:"POST"});if(!s.ok&&s.status!==404)throw new Error(await Vt(s,"media cleanup failed"))}function VB(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=zB(t);if(!n)return t;const s=`${n}/content`;return Cn(`${jb}${s}`)}async function zy(e,t,n){const{app:s,ep:i}=Qs(e);let r;if(i.runtimeId){const c=new URLSearchParams({runtimeId:i.runtimeId,sessionId:t,region:i.region??"cn-beijing"});if(n&&c.set("endTimeMs",String(Math.round(n))),r=await ht(`/web/runtime-trace?${c.toString()}`),r.status===404)throw new Error("该 Agent 暂未开启链路观测,请到控制台打开后使用。")}else r=await ht(`/dev/apps/${encodeURIComponent(s)}/debug/trace/session/${encodeURIComponent(t)}`,{},i);if(!r.ok)throw new Error(await Vt(r,"加载调用链路失败"));const a=r.headers.get("content-type")??"";if(!a.includes("application/json")){const c=a.split(";",1)[0]||"Content-Type 缺失";throw new Error(`trace failed: 服务端返回了非 JSON 响应(${c}),请检查 Studio API 代理配置`)}const l=await r.json();if(!Array.isArray(l))throw new Error("trace failed: 返回格式无效");return l}async function g_(e){const t=await ht("/web/issue-feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await Vt(t,"问题反馈上报失败"));if((await t.json()).submitted!==!0)throw new Error("问题反馈上报失败:服务端未确认提交结果");return{submitted:!0}}function Pk(e){const t=n=>({id:String(n.id??""),kind:n.kind==="skill"?"skill":"tool",name:String(n.name??""),custom:n.custom===!0,description:typeof n.description=="string"?n.description:void 0,skillSourceId:typeof n.skill_source_id=="string"?n.skill_source_id:void 0,version:typeof n.version=="string"?n.version:void 0});return{schemaVersion:Number(e.schema_version??1),revision:Number(e.revision??0),tools:Array.isArray(e.tools)?e.tools.map(n=>t(n)):[],skills:Array.isArray(e.skills)?e.skills.map(n=>t(n)):[]}}function Bk(e,t,n){return`/harness/apps/${encodeURIComponent(e)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/capabilities`}async function b_(e,t,n){const{app:s,ep:i}=Qs(e),r=await ht(Bk(s,t,n),{},i);if(!r.ok)throw new Error(await Vt(r,"读取会话能力失败"));return Pk(await r.json())}async function Uk(e){const{ep:t}=Qs(e),n=await ht("/harness/capabilities/tools",{},t);if(!n.ok)throw new Error(await Vt(n,"读取内置工具失败"));return((await n.json()).tools??[]).map(i=>{var r;return((r=i.name)==null?void 0:r.trim())??""}).filter(Boolean)}async function ote(e){const{ep:t}=Qs(e),n=await ht("/harness/skills/spaces?region=all",{},t);if(!n.ok)throw new Error(await Vt(n,"读取 Skill Space 失败"));return(await n.json()).items??[]}async function lte(e,t,n){const{ep:s}=Qs(e),i=new URLSearchParams({region:n||"cn-beijing"}),r=`/harness/skills/spaces/${encodeURIComponent(t)}/skills?${i.toString()}`,a=await ht(r,{},s);if(!a.ok)throw new Error(await Vt(a,"读取 Skill 列表失败"));return(await a.json()).items??[]}async function GB(e,t,n=1,s=20){const{ep:i}=Qs(e),r=new URLSearchParams({query:t,page_number:String(n),page_size:String(s)}),a=await ht(`/harness/skills/findskill?${r.toString()}`,{},i);if(!a.ok)throw new Error(await Vt(a,"搜索 Skill Hub 失败"));const l=await a.json();return{items:l.items??[],totalCount:Number(l.totalCount??0)}}async function y_(e,t,n,s,i){const{app:r,ep:a}=Qs(e),l=await ht(Bk(r,t,n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:s.kind,name:s.name,skill_source_id:s.skillSourceId,description:s.description,version:s.version,expected_revision:i})},a);if(!l.ok)throw new Error(await Vt(l,"添加会话能力失败"));return Pk(await l.json())}async function KB(e,t,n,s,i){const{app:r,ep:a}=Qs(e),l=`${Bk(r,t,n)}/${encodeURIComponent(s)}?expected_revision=${i}`,c=await ht(l,{method:"DELETE"},a);if(!c.ok)throw new Error(await Vt(c,"移除会话能力失败"));return Pk(await c.json())}async function qB(e,t,n=!0){const s=await ht(`/web/agent-info/${e}`,{},t);if(!s.ok)throw new Error(`agent-info failed: ${s.status}`);const i=await s.json();if(n&&!i.draft)try{const r=await ht(`/web/agent-draft/${e}`,{},t);if(r.ok){const a=await r.json();i.draft=a.draft}}catch{}return{appName:e,name:i.name??e,description:i.description??"",type:i.type,model:i.model??"",tools:i.tools??[],skillsPreviewSupported:Array.isArray(i.skills),skills:i.skills??[],subAgents:i.subAgents??[],components:i.components??[],searchSources:i.searchSources??[],graph:i.graph,draft:i.draft}}async function Fk(e){const{app:t,ep:n}=Qs(e);return qB(t,n,!1)}async function cte(e,t,n){let s=null;for(const i of Wf(t)){const r={runtimeId:e,region:i};try{const a=IB(e,i),l=Rb.get(a);l&&l.expiresAt<=Date.now()&&Rb.delete(a);const c=Rb.get(a),u=n||(c==null?void 0:c.apps[0])||(await i1("","",r))[0];if(!u)throw new Error("该 Runtime 未提供可预览的 Agent。");return qB(u,r)}catch(a){if(a instanceof Yf||a instanceof Sr&&!a.unsupported)throw a;s=a instanceof Error?a:new Error(String(a))}}throw s??new Error("该 Runtime 未提供可预览的 Agent。")}async function Vy(e,t,n={},s={}){const i=typeof n=="string"?n:void 0,r=typeof n=="string"?s:n,a=Xf(e,t||"cn-beijing",i??""),l=Qf(Ac,a,s1);if(!r.force&&l)return l;const c=Ac.get(a);if(!r.force&&(c!=null&&c.promise))return c.promise;const u=cte(e,t,i).then(d=>Lk(Ac,a,d));Ac.set(a,{...c,promise:u,updatedAt:(c==null?void 0:c.updatedAt)??0});try{return await u}finally{const d=Ac.get(a);(d==null?void 0:d.promise)===u&&Ac.set(a,{value:d.value,updatedAt:d.updatedAt})}}function YB(e,t,n=""){return Qf(Ac,Xf(e,t||"cn-beijing",n),s1)}function WB(e,t,n=""){Vy(e,t,n).catch(()=>{})}async function XB(e,t,n,s){const{app:i,ep:r}=Qs(e),a=new URLSearchParams({source:t,app_name:i,q:n,user_id:s}),l=await ht(`/web/search?${a.toString()}`,{},r);if(!l.ok)throw new Error(await Vt(l,"Agent 检索失败"));return l.json()}async function QB(e,t){const{app:n}=Qs(e),s=await ht(`/web/search?source=web&app_name=${encodeURIComponent(n)}&q=${encodeURIComponent(t)}`);if(!s.ok)throw new Error(`web search failed: ${s.status}`);return s.json()}async function*wm({appName:e,userId:t,sessionId:n,text:s,attachments:i=[],invocation:r,functionResponses:a=[],signal:l,sessionCapabilities:c=!1}){const{app:u,ep:d}=Qs(e),f=i.flatMap(b=>b.status&&b.status!=="ready"?[]:b.uri?[{fileData:{mimeType:b.mimeType,fileUri:b.uri,displayName:b.name},partMetadata:{veadkMedia:{id:b.id,uri:b.uri,name:b.name,mimeType:b.mimeType,sizeBytes:b.sizeBytes}}}]:b.data?[{inlineData:{mimeType:b.mimeType,data:b.data,displayName:b.name}}]:[]),h=r&&(r.skills.length>0||r.targetAgent)?r:void 0,p=[...f,...a.map(b=>({functionResponse:{id:b.id,name:b.name,response:b.response}})),...s.trim()?[{text:s}]:[]];if(h&&p.length>0){const b=p[0],v=b.partMetadata;p[0]={...b,partMetadata:{...v,veadkInvocation:h}}}const m=await ht(c?"/harness/run_sse":"/run_sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:u,user_id:t,session_id:n,new_message:{role:"user",parts:p},streaming:!0,custom_metadata:h?{veadkInvocation:h}:void 0}),signal:l},d,0);if(!m.ok){const b=await Vt(m,"运行会话失败");throw new Error(I0(`run_sse failed: ${m.status}:${b}`))}for await(const b of Ik(m)){const v=b;typeof v.error=="string"&&(v.error=I0(v.error)),typeof v.errorMessage=="string"&&(v.errorMessage=I0(v.errorMessage)),typeof v.error_message=="string"&&(v.error_message=I0(v.error_message)),yield v}}async function ZB(e){const t=await ht("/web/identity/user-pools",{signal:e});if(!t.ok)throw new Error(await Vt(t,"加载用户池失败"));const n=await t.json();if(!Array.isArray(n.items))throw new Error("用户池列表响应格式无效");return n.items.map(s=>{if(!s||typeof s!="object"||typeof s.uid!="string"||typeof s.name!="string"||typeof s.domain!="string"||typeof s.region!="string"||typeof s.isCurrent!="boolean")throw new Error("用户池列表响应格式无效");return s})}const Up=new Map;async function dg(e,t,n,s){var u,d,f;const i=s==null?void 0:s.taskId,r=i?new AbortController:void 0;i&&r&&Up.set(i,r);const a=()=>{i&&Up.get(i)===r&&Up.delete(i)};let l;try{(u=s==null?void 0:s.onStage)==null||u.call(s,{level:"info",phase:"upload",message:"正在上传代码包",pct:0}),l=await ht("/web/deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},signal:r==null?void 0:r.signal,body:JSON.stringify({name:e,files:t,config:n,taskId:i,runtimeId:s==null?void 0:s.runtimeId,appName:s==null?void 0:s.appName,sessionStorage:s==null?void 0:s.sessionStorage,minInstance:s==null?void 0:s.minInstance,maxInstance:s==null?void 0:s.maxInstance,createEvaluationSets:s==null?void 0:s.createEvaluationSets,description:ete((s==null?void 0:s.description)??""),authentication:s==null?void 0:s.authentication,im:s==null?void 0:s.im,envs:s==null?void 0:s.envs})},{},0),(d=s==null?void 0:s.onStage)==null||d.call(s,{level:"success",phase:"upload",message:"代码包上传完成",pct:100})}catch(h){throw a(),h}if(!l.ok){const h=await Vt(l,"部署失败");throw a(),new Error(h)}let c=null;try{for await(const h of Ik(l)){const p=h;if(p&&p.done){c=p;break}p&&p.message&&((f=s==null?void 0:s.onStage)==null||f.call(s,p))}}catch(h){throw a(),h}if(a(),!c)throw new Error("部署失败:连接中断");if(!c.success)throw new Error(c.error||"部署失败");if(!c.agentName)throw new Error("部署失败:返回缺少 Agent 名称");if(!c.runtimeId&&!c.url)throw new Error("部署失败:返回缺少 AgentKit 连接信息");return{apikey:c.apikey??"",url:c.url??"",agentName:c.agentName,runtimeId:c.runtimeId,consoleUrl:c.consoleUrl,region:c.region,version:c.version,warnings:c.warnings,feishuChannel:c.feishuChannel}}async function JB(e){var n;const t=await ht("/web/cancel-deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:e})});if(!t.ok){const s=await t.text().catch(()=>"");throw new Error(s||`取消部署失败 (${t.status})`)}(n=Up.get(e))==null||n.abort(),Up.delete(e)}async function ute(e="cn-beijing"){const t=await ht(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`加载失败 (${t.status})`);return(await t.json()).runtimes??[]}const Sm={title:"AgentKit Studio",logoUrl:""},Lb={enabled:!1},jv={studio:!1,version:"",branding:Sm,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local",telemetry:Lb};function dte(e){if(!e||typeof e!="object")return Lb;const t=e;if(!t.enabled)return Lb;const n=t.apmplus;if(!n||typeof n.aid!="number"||!Number.isFinite(n.aid)||typeof n.token!="string"||!n.token)return Lb;const s=t.studio??{};return{enabled:!0,provider:t.provider==="apmplus"?"apmplus":void 0,apmplus:{aid:n.aid,token:n.token,domain:typeof n.domain=="string"&&n.domain?n.domain:"apmplus.volces.com",env:typeof n.env=="string"&&n.env?n.env:"production"},studio:{deployId:typeof s.deployId=="string"?s.deployId:"",userPoolId:typeof s.userPoolId=="string"?s.userPoolId:"",applicationId:typeof s.applicationId=="string"?s.applicationId:"",functionId:typeof s.functionId=="string"?s.functionId:"",region:typeof s.region=="string"?s.region:"",project:typeof s.project=="string"?s.project:"",version:typeof s.version=="string"?s.version:""}}}async function e8(){var e,t;try{const n=await ht("/web/ui-config");if(!n.ok)return jv;const s=await n.json(),i=typeof((e=s.branding)==null?void 0:e.logoUrl)=="string"?s.branding.logoUrl:Sm.logoUrl;return{studio:s.studio??!1,version:typeof s.version=="string"?s.version:"",branding:{title:typeof((t=s.branding)==null?void 0:t.title)=="string"?s.branding.title:Sm.title,logoUrl:i?Cn(i):""},features:{...jv.features,...s.features??{}},defaultView:s.defaultView??"chat",agentsSource:s.agentsSource==="cloud"?"cloud":"local",telemetry:dte(s.telemetry)}}catch{return jv}}const t8={role:"user",telemetry:{userId:""},capabilities:{createAgents:!1,manageAgents:!1,runtimeScope:"mine"}};async function n8(){var n,s,i,r;const e=await ht("/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.telemetry)==null?void 0:n.userId)!="string"||typeof((s=t.capabilities)==null?void 0:s.createAgents)!="boolean"||typeof((i=t.capabilities)==null?void 0:i.manageAgents)!="boolean"||!["all","mine"].includes((r=t.capabilities)==null?void 0:r.runtimeScope))throw new Error("权限服务返回了无法解析的响应");return t}async function s8(e,t){const n=new URLSearchParams;e&&n.set("targetVersion",e),t&&n.set("startedAt",String(t));const s=n.size?`?${n.toString()}`:"",i=await ht(`/web/studio-update${s}`);if(!i.ok)throw new Error(`检查 Studio 更新失败 (${i.status})`);return await i.json()}async function i8(e){const t=await ht("/web/studio-update",{method:"POST",headers:{"Content-Type":"application/json","X-VeADK-Studio-Update":"1"},body:JSON.stringify({version:e})},{},ug);if(!t.ok){let n="";try{const s=await t.json();n=typeof s.detail=="string"?s.detail:""}catch{n=""}throw new Error(n||`提交 Studio 更新失败 (${t.status})`)}return await t.json()}async function a1(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 ht(`/web/runtimes?${t.toString()}`);if(!n.ok){const i=await Vt(n,"加载 Runtime 失败"),r=`加载 Runtime 失败(HTTP ${n.status})`;throw new Error(i===`加载 Runtime 失败 (${n.status})`?r:`${r}:${i}`)}const s=await n.json();return{runtimes:s.runtimes??[],nextToken:s.nextToken??""}}async function $k(e,t,n={}){try{const s={runtimeId:e,region:t};return n.retryProbe&&(s.retryProbe=!0),await i1("","",s)}catch(s){if(s instanceof Yf||s instanceof Sr)throw s;return null}}async function r8(e,t,n={}){const s={runtimeId:e,region:t};n.retryProbe&&(s.retryProbe=!0);const i=await ht("/.well-known/agent-card.json",{},s),r=await jB(i);if(r==="runtime_access_denied")throw new Yf;if(r==="runtime_private_endpoint_unreachable")throw new Sr(kB);if(["runtime_proxy_connect_error","runtime_proxy_timeout"].includes(r))throw new Sr(AB);if(i.status===404)return null;if(i.status===401||i.status===403)throw new Sr("Runtime 服务拒绝了 A2A 探测请求,请检查 Runtime 的鉴权配置。");if(!i.ok)throw new Error(await Vt(i,"读取 A2A Agent Card 失败"));const a=await i.json().catch(()=>null),l=typeof(a==null?void 0:a.url)=="string"?a.url.trim():"";return l?{name:typeof(a==null?void 0:a.name)=="string"?a.name:"",description:typeof(a==null?void 0:a.description)=="string"?a.description:"",endpoint:l}:null}async function a8(e,t){const n=new URLSearchParams({runtimeId:e,region:t}),s=await ht(`/web/runtime-api-key/reveal?${n.toString()}`,{method:"POST",cache:"no-store"});if(!s.ok)throw new Error(await Vt(s,"读取 Runtime API Key 失败"));const i=await s.json();if(typeof i.apiKey!="string"||!i.apiKey)throw new Error("Runtime 未返回可用的 API Key");return i.apiKey}async function o8(e,t){const n=await ht("/web/delete-runtime",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e,region:t})});if(!n.ok){const s=await n.text().catch(()=>"");throw new Error(s||`删除失败 (${n.status})`)}}async function l8({runtimeId:e,region:t,signal:n}){const s=new URLSearchParams({runtimeId:e,region:t}),i=await ht(`/web/runtime-update-capability?${s.toString()}`,{signal:n});if(!i.ok)throw new Error(await Vt(i,"检查 Runtime 更新能力失败"));return await i.json()}async function fte(e,t){let n=null;for(const s of Wf(t)){const i=await ht(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(s)}`);if(i.ok)return i.json();n=new Error(await Vt(i,"加载 Runtime 详情失败"))}throw n??new Error("加载 Runtime 详情失败")}async function Hk(e,t="cn-beijing",n={}){const s=Xf(e,t||"cn-beijing"),i=Qf(Cc,s,s1);if(!n.force&&i)return i;const r=Cc.get(s);if(!n.force&&(r!=null&&r.promise))return r.promise;const a=fte(e,t).then(l=>Lk(Cc,s,l));Cc.set(s,{...r,promise:a,updatedAt:(r==null?void 0:r.updatedAt)??0});try{return await a}finally{const l=Cc.get(s);(l==null?void 0:l.promise)===a&&Cc.set(s,{value:l.value,updatedAt:l.updatedAt})}}function c8(e,t="cn-beijing"){return Qf(Cc,Xf(e,t||"cn-beijing"),s1)}function u8(e,t="cn-beijing"){Hk(e,t).catch(()=>{})}async function o1(e){const t=await ht("/web/generated-agent-projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await Vt(t,"生成项目失败"));return t.json()}const hte=19e4;async function d8(e){const t=await ht("/web/generated-agent-drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requirement:e})},{},hte);if(!t.ok)throw new Error(await Vt(t,"生成 Agent 配置失败"));return n1(t,"生成 Agent 配置失败")}async function f8(e,t){const n=await ht("/web/generated-agent-test-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,runtimeId:t==null?void 0:t.runtimeId,runtimeRegion:t==null?void 0:t.region})});if(!n.ok)throw new Error(await Vt(n,"创建调试运行失败"));return n1(n,"创建调试运行失败")}async function h8(e,t){const n=await ht(`/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 Vt(n,"创建调试会话失败"));return(await n1(n,"创建调试会话失败")).id}async function p8(e,t){const n=await ht(`/web/generated-agent-test-runs/${encodeURIComponent(e)}/trace/session/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await Vt(n,"加载调试调用链路失败"));const s=await n1(n,"加载调试调用链路失败");if(!Array.isArray(s))throw new Error("加载调试调用链路失败:返回格式无效");return s}async function*m8({runId:e,userId:t,sessionId:n,text:s,signal:i}){const r=s.trim()?[{text:s}]:[],a=await ht(`/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:r},streaming:!0}),signal:i},{},0);if(!a.ok)throw new Error(await Vt(a,"调试运行失败"));for await(const l of Ik(a))yield l}async function ad(e){const t=await ht(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await Vt(t,"清理调试运行失败"))}const pte=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:Sm,DEFAULT_STUDIO_ACCESS:t8,RuntimeAccessDeniedError:Yf,RuntimeProbeError:Sr,addSessionCapability:y_,cancelAgentkitDeployment:JB,clearMessageFeedbackCache:wB,clearRemoteApps:_B,componentSearch:XB,createGeneratedAgentTestRun:f8,createGeneratedAgentTestSession:h8,createSession:$y,deleteAgentFeedbackCases:BB,deleteGeneratedAgentTestRun:ad,deleteMedia:Mb,deleteRuntime:o8,deleteSession:p_,deleteSessionMedia:m_,deployAgentkitProject:dg,downloadArtifact:UB,fetchRemoteApps:i1,generateAgentDraftFromRequirement:d8,generateAgentProject:o1,getAgentFeedbackCases:r1,getAgentInfo:Fk,getAgentOptimizations:MB,getAutomaticEvaluationStatuses:OB,getCachedAgentFeedbackCases:LB,getCachedRuntimeAgentInfo:YB,getCachedRuntimeDetail:c8,getGeneratedAgentTestTrace:p8,getMediaCapabilities:ate,getMyRuntimes:ute,getRuntimeAgentInfo:Vy,getRuntimeDetail:Hk,getRuntimeUpdateCapability:l8,getRuntimes:a1,getSession:Hy,getSessionCapabilities:b_,getSessionTrace:zy,getStudioAccess:n8,getStudioUpdateStatus:s8,getUiConfig:e8,listApps:TB,listIdentityUserPools:ZB,listSessionBuiltinTools:Uk,listSessionSkillSpaces:ote,listSessionSkillsInSpace:lte,listSessions:Dk,mediaContentUrl:VB,prefetchAgentFeedbackCases:h_,prefetchRuntimeAgentInfo:WB,prefetchRuntimeDetail:u8,previewArtifact:$B,probeRuntimeA2a:r8,probeRuntimeApps:$k,refreshAgentFeedbackCases:DB,registerRemoteApp:SB,removeSessionCapability:KB,revealRuntimeApiKey:a8,runGeneratedAgentTestSSE:m8,runSSE:wm,searchSessionPublicSkills:GB,startStudioUpdate:i8,studioFetch:NB,submitIssueFeedback:g_,submitMessageFeedback:RB,uploadMedia:HB,upsertCachedAgentFeedbackCase:Ob,webSearch:QB},Symbol.toStringTag,{value:"Module"}));function NR(e){return e.blocks.flatMap(t=>t.kind==="tool"?[{name:t.name,args:t.args,response:t.response,done:t.done}]:[])}function mte(e){const t=e.attributes;return String(t["invocation.id"]??t["gen_ai.invocation.id"]??t["gcp.vertex.agent.invocation_id"]??"")}function gte(e,t){if(!t)return e;const n=new Set(e.filter(i=>mte(i)===t).map(i=>i.trace_id)),s=e.filter(i=>n.has(i.trace_id));return s.length>0?s:e}function Rv(e){return!!(e&&[...e.tools,...e.skills].some(t=>t.custom))}const bte="send_a2ui_json_to_client",yte="validated_a2ui_json",x_="adk_request_credential",TR="transfer_to_agent";function xte(e){var s,i,r,a;const t=e,n=((s=t==null?void 0:t.exchangedAuthCredential)==null?void 0:s.oauth2)??((i=t==null?void 0:t.exchanged_auth_credential)==null?void 0:i.oauth2)??((r=t==null?void 0:t.rawAuthCredential)==null?void 0:r.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 Sa(){return{blocks:[],liveStart:0}}const kR=e=>e.functionCall??e.function_call,E_=e=>e.functionResponse??e.function_response;function Ete(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function vte(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function g8(e){const t=[];for(const[n,s]of e.entries()){const i=s.partMetadata??s.part_metadata,r=i==null?void 0:i.veadkTransport;if((r==null?void 0:r.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 l=s.inlineData??s.inline_data;if(l&&l.data){t.push({id:`inline-${n}-${l.displayName??l.display_name??"media"}`,mimeType:l.mimeType??l.mime_type,data:vte(l.data),name:l.displayName??l.display_name});continue}const c=s.fileData??s.file_data,u=(c==null?void 0:c.fileUri)??(c==null?void 0:c.file_uri);c&&u&&t.push({id:u,mimeType:c.mimeType??c.mime_type,uri:u,name:c.displayName??c.display_name})}return t}function v_(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 wte=new Set(["llm","sequential","parallel","loop","a2a"]);function Ste(e){var t;for(const n of e){const s=(t=n.partMetadata??n.part_metadata)==null?void 0:t.veadkInvocation;if(!s||typeof s!="object")continue;const i=s,r=Array.isArray(i.skills)?i.skills.flatMap(c=>{if(!c||typeof c!="object")return[];const u=c;return typeof u.name=="string"?[{name:u.name,description:typeof u.description=="string"?u.description:""}]:[]}):[];let a;const l=i.targetAgent;if(l&&typeof l=="object"){const c=l,u=c.type;typeof c.name=="string"&&typeof u=="string"&&wte.has(u)&&Array.isArray(c.path)&&(a={name:c.name,description:typeof c.description=="string"?c.description:"",type:u,path:c.path.filter(d=>typeof d=="string")})}if(r.length>0||a)return{skills:r,targetAgent:a}}}function _te(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 Nte(e,t){if(!t.length)return;const n=e[e.length-1];if((n==null?void 0:n.kind)==="artifact"){for(const s of t)n.files.some(i=>i.filename===s.filename&&i.version===s.version)||n.files.push(s);return}e.push({kind:"artifact",files:t})}function AR(e,t,n){const s=e[e.length-1];s&&s.kind===t?s.text+=n:e.push(t==="thinking"?{kind:t,text:n,done:!1}:{kind:t,text:n})}function j0(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function gf(e,t){var l,c,u,d,f,h;const n=e.blocks.map(p=>({...p}));let s=e.liveStart;const i=((l=t.content)==null?void 0:l.parts)??[],r=i.some(p=>kR(p)||E_(p));if(t.partial&&!r){for(const p of i){const m=v_(p);typeof m=="string"&&m&&AR(n,p.thought?"thinking":"text",m)}return{blocks:n,liveStart:s}}n.length=s;for(const p of i){const m=kR(p),b=E_(p),v=g8([p]),y=v_(p);if(typeof y=="string"&&y)AR(n,p.thought?"thinking":"text",y);else if(v.length)j0(n),_te(n,v);else if(m)if(j0(n),m.name===TR){const x=Ete(m.args)||((c=t.actions)==null?void 0:c.transferToAgent)||((u=t.actions)==null?void 0:u.transfer_to_agent)||"未知 Agent";n.push({kind:"agent-transfer",agentName:x,done:!1})}else if(m.name===x_){const x=m.args??{},E=x.authConfig??x.auth_config??x,_=String(x.functionCallId??x.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:m.id??"",label:_,authUri:xte(E),authConfig:E,done:!1})}else n.push({kind:"tool",name:m.name??"",args:m.args,done:!1});else if(b){if(j0(n),b.name===TR)for(let x=n.length-1;x>=0;x--){const E=n[x];if(E.kind==="agent-transfer"&&!E.done){E.done=!0;break}}if(b.name===x_)for(let x=n.length-1;x>=0;x--){const E=n[x];if(E.kind==="auth"&&!E.done){E.done=!0;break}}for(let x=n.length-1;x>=0;x--){const E=n[x];if(E.kind==="tool"&&!E.done&&E.name===b.name){E.done=!0,E.response=b.response;break}}if(b.name===bte){const x=((d=b.response)==null?void 0:d[yte])??[];if(x.length){const E=n[n.length-1];E&&E.kind==="a2ui"?E.messages.push(...x):n.push({kind:"a2ui",messages:x})}}}}const a=((f=t.actions)==null?void 0:f.artifactDelta)??((h=t.actions)==null?void 0:h.artifact_delta);return a&&Nte(n,Object.entries(a).map(([p,m])=>({filename:p,version:m}))),j0(n),s=n.length,{blocks:n,liveStart:s}}function Tte(e,t={}){var i,r;const n=[];let s=Sa();for(const a of e)if(a.author==="user"){const c=((i=a.content)==null?void 0:i.parts)??[];if(c.some(p=>{var m;return((m=E_(p))==null?void 0:m.name)===x_})){for(let p=n.length-1;p>=0;p--)if(n[p].role==="assistant"){for(let m=n[p].blocks.length-1;m>=0;m--){const b=n[p].blocks[m];if(b.kind==="auth"){b.done=!0;break}}break}}const u=c.map(v_).filter(p=>!!p).join(""),d=g8(c),f=Ste(c);if(!u&&!d.length&&!f){s=Sa();continue}const h=[];f&&h.push({kind:"invocation",value:f}),d.length&&h.push({kind:"attachment",files:d}),u&&h.push({kind:"text",text:u}),n.push({role:"user",blocks:h,meta:{ts:a.timestamp}}),s=Sa()}else{const c=a.author??"";let u=n[n.length-1];(!u||u.role!=="assistant"||c&&((r=u.meta)==null?void 0:r.author)!==c)&&(u={role:"assistant",blocks:[],meta:{author:c||void 0}},n.push(u),s=Sa()),s=gf(s,a),u.blocks=s.blocks;const d=a.usageMetadata??a.usage_metadata,f=u.meta??(u.meta={});c&&(f.author=c),d!=null&&d.totalTokenCount&&(f.tokens=d.totalTokenCount),a.timestamp&&(f.ts=a.timestamp),a.id&&(f.eventId=a.id);const h=a.invocationId??a.invocation_id;h&&(f.invocationId=h)}for(const a of n){const l=a.meta,c=l==null?void 0:l.eventId;if(!c)continue;const u=t[`veadk_feedback:${c}`];if(!u||typeof u!="object")continue;const d=u;d.rating!=="good"&&d.rating!=="bad"||(l.feedback=u)}return n}function kte(e){var t,n;for(const s of e??[])if(s.author==="user"||((t=s.content)==null?void 0:t.role)==="user"){const i=(((n=s.content)==null?void 0:n.parts)??[]).map(r=>r.text).find(Boolean);if(i)return i}return"新会话"}const Ate=50,CR=48;function Cte(e){return(e.events??[]).flatMap(t=>{var i,r;const s=(((i=t.content)==null?void 0:i.parts)??[]).map(a=>typeof a.text=="string"?a.text:"").filter(Boolean).join("");return s?[{text:s,role:t.author??((r=t.content)==null?void 0:r.role)??"",ts:t.timestamp}]:[]})}function Ite(e){var t,n;for(const s of e.events??[])if(s.author==="user"||((t=s.content)==null?void 0:t.role)==="user"){const i=(((n=s.content)==null?void 0:n.parts)??[]).map(r=>r.text).find(Boolean);if(i)return i}return"未命名会话"}function jte(e,t,n){const s=Math.max(0,t-CR),i=Math.min(e.length,t+n+CR);return(s>0?"…":"")+e.slice(s,i).trim()+(i{var c;if((c=l.events)!=null&&c.length)return l;try{return await Hy(t,e,l.id)}catch{return l}})),a=[];for(const l of r)for(const{text:c,role:u,ts:d}of Cte(l)){const f=c.toLowerCase().indexOf(s);if(f!==-1){a.push({type:"session",appId:t,sessionId:l.id,title:Ite(l),snippet:jte(c,f,s.length),role:u,ts:d??l.lastUpdateTime});break}}return a.sort((l,c)=>(c.ts??0)-(l.ts??0)),a.slice(0,Ate)}async function Ote(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await QB(e,t.trim())}catch(a){const l=String(a);return{results:[],note:l.includes("404")?"网络搜索接口未就绪(后端未启用 /web/search)。":`网络搜索失败:${l}`}}const{mounted:s,results:i,error:r}=n;return s?r?{results:[],note:r}:{results:i.map((a,l)=>({type:"web",index:l,title:a.title,url:a.url,siteName:a.siteName,summary:a.summary}))}:{results:[],note:"当前 Agent 未挂载 web_search 工具。"}}async function Mte(e,t,n,s){if(!t||!s.trim())return{results:[]};const i=await XB(t,e,s.trim(),n);if(!i.mounted)return{results:[],note:e==="knowledge"?"该 Agent 未挂载知识库。":"该 Agent 未挂载长期记忆。"};if(i.error)return{results:[],note:i.error};const r=i.sourceName??(e==="knowledge"?"知识库":"长期记忆");return{results:i.results.map((a,l)=>e==="knowledge"?{type:"knowledge",index:l,content:a.content,sourceName:r,sourceType:i.sourceType}:{type:"memory",index:l,content:a.content,sourceName:r,sourceType:i.sourceType,author:a.author,ts:a.timestamp})}}async function Lte(e,t,n){return e==="session"?{results:await Rte(n.userId,n.appId,t)}:e==="web"?Ote(n.appId,t):Mte(e,n.appId,n.userId,t)}function b8({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M16.4 10.7a5.7 5.7 0 1 1-1.67-4.03"}),o.jsx("path",{d:"M15.25 15.25 19.6 19.6"})]})}function Dte({open:e}){return o.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:o.jsx("path",{d:"m3.25 4.75 2.75 2.5 2.75-2.5"})})}function Pte({active:e=!1,onClick:t}){return o.jsxs("button",{className:`new-chat${e?" is-active":""}`,onClick:t,"aria-label":"搜索","aria-current":e?"page":void 0,title:"搜索",children:[o.jsx(b8,{}),o.jsx("span",{className:"sidebar-nav-label",children:"搜索"})]})}function Bte(e,t,n){const s=!!e,i=new Set((t==null?void 0:t.searchSources)??[]),r=a=>s?n?"正在检测 Agent 能力":`当前 Agent 未挂载${a}`:"请选择 Agent";return[{id:"session",label:"会话",ready:s,unavailableLabel:"请选择 Agent"},{id:"web",label:"网络",ready:s&&i.has("web"),description:"通过 web_search 工具检索",unavailableLabel:r(" web_search 工具")},{id:"knowledge",label:"知识库",ready:s&&i.has("knowledge"),unavailableLabel:r("知识库")},{id:"memory",label:"长期记忆",ready:s&&i.has("memory"),unavailableLabel:r("长期记忆")}]}function Gy(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 IR(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 Ute({userId:e,appId:t,agentInfo:n,capabilitiesLoading:s,agentLabel:i,onOpenSession:r}){var F,A;const[a,l]=g.useState("session"),[c,u]=g.useState(""),[d,f]=g.useState([]),[h,p]=g.useState(),[m,b]=g.useState(!1),[v,y]=g.useState(!1),[x,E]=g.useState(!1),w=g.useRef(0),_=g.useRef(null),S=Bte(t,n,s),k=S.find(O=>O.id===a),T=a==="knowledge"?(F=n==null?void 0:n.components)==null?void 0:F.find(O=>O.source==="knowledgebase"||O.kind==="knowledgebase"):a==="memory"?(A=n==null?void 0:n.components)==null?void 0:A.find(O=>O.source==="long_term_memory"||O.kind==="memory"):void 0;g.useEffect(()=>{w.current+=1,l("session"),f([]),p(void 0),y(!1),b(!1),E(!1)},[t]),g.useEffect(()=>{if(!x)return;function O(P){var $;($=_.current)!=null&&$.contains(P.target)||E(!1)}return document.addEventListener("pointerdown",O),()=>document.removeEventListener("pointerdown",O)},[x]);async function C(O,P){var J;const $=O.trim();if(!$||!((J=S.find(U=>U.id===P))!=null&&J.ready))return;const R=++w.current;b(!0),y(!0);let Y;try{Y=await Lte(P,$,{userId:e,appId:t})}catch(U){const te=U instanceof Error?U.message:String(U);Y={results:[],note:`搜索失败:${te}`}}R===w.current&&(f(Y.results),p(Y.note),b(!1))}function I(O){w.current+=1,u(O),f([]),p(void 0),y(!1),b(!1)}function j(O){w.current+=1,l(O),E(!1),f([]),p(void 0),y(!1),b(!1)}const L=!!(k!=null&&k.ready),z=t?a==="web"?"在网络中检索":a==="knowledge"?`在 ${(T==null?void 0:T.name)??"当前 Agent 的知识库"} 中检索`:a==="memory"?`在 ${(T==null?void 0:T.name)??"当前用户的长期记忆"} 中检索`:"在当前 Agent 的会话中检索":"请先选择 Agent",D=T!=null&&T.backend?Gy(T.backend):"";return o.jsxs("div",{className:"search",children:[o.jsxs("div",{className:"search-box",children:[o.jsxs("div",{className:"search-source-picker-wrap",ref:_,children:[o.jsxs("button",{className:"search-source-picker",type:"button","aria-label":`搜索类型:${(k==null?void 0:k.label)??"未选择"}`,"aria-haspopup":"listbox","aria-expanded":x,onClick:()=>E(O=>!O),children:[o.jsx("span",{children:(k==null?void 0:k.label)??"搜索类型"}),D&&o.jsx("small",{children:D}),o.jsx(Dte,{open:x})]}),x&&o.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":"选择搜索类型",children:S.map(O=>{var R,Y;const P=O.id==="knowledge"?(R=n==null?void 0:n.components)==null?void 0:R.find(J=>J.source==="knowledgebase"||J.kind==="knowledgebase"):O.id==="memory"?(Y=n==null?void 0:n.components)==null?void 0:Y.find(J=>J.source==="long_term_memory"||J.kind==="memory"):void 0,$=P?[P.name,P.backend?Gy(P.backend):""].filter(Boolean).join(" · "):O.ready?O.description:O.unavailableLabel;return o.jsxs("button",{type:"button",role:"option","aria-selected":a===O.id,disabled:!O.ready,onClick:()=>j(O.id),children:[o.jsx("span",{children:O.label}),$&&o.jsx("small",{children:$})]},O.id)})})]}),o.jsx("span",{className:"search-box-divider","aria-hidden":!0}),o.jsx("input",{className:"search-input",value:c,onChange:O=>I(O.target.value),onKeyDown:O=>{O.key==="Enter"&&(O.preventDefault(),C(c,a))},placeholder:z,disabled:!L,autoFocus:!0}),o.jsx("button",{className:"search-go",onClick:()=>void C(c,a),disabled:!c.trim()||m,"aria-label":"搜索",children:m?o.jsx(mn,{className:"icon spin"}):o.jsx(b8,{className:"icon"})})]}),o.jsx("div",{className:"search-results",children:L?v?m?null:h?o.jsx("div",{className:"search-empty",children:h}):d.length===0&&v?o.jsxs("div",{className:"search-empty",children:["未找到匹配「",c.trim(),"」的结果。"]}):d.map((O,P)=>o.jsx(Fte,{result:O,agentLabel:i,onOpen:r},P)):o.jsx("div",{className:"search-empty",children:a==="web"?"输入关键词后回车或点击按钮,通过 web_search 工具检索。":a==="knowledge"?"输入问题,检索当前 Agent 挂载的知识库。":a==="memory"?"输入线索,检索当前用户跨会话保存的长期记忆。":"输入关键词后回车或点击按钮,搜索当前 Agent 的会话。"}):o.jsx("div",{className:"search-empty",children:t?s?"正在读取当前 Agent 的检索能力…":(k==null?void 0:k.unavailableLabel)??"当前 Agent 未挂载该数据源":"选择一个 Agent 后,即可检索会话、网络及其挂载的数据源。"})})]})}function Fte({result:e,agentLabel:t,onOpen:n}){switch(e.type){case"session":return o.jsxs("button",{className:"search-result",onClick:()=>n(e.appId,e.sessionId),children:[o.jsx(yB,{className:"search-result-icon"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:e.title}),o.jsxs("span",{className:"search-result-meta",children:[t(e.appId),e.ts?` · ${IR(e.ts)}`:""]})]}),o.jsx("div",{className:"search-result-snippet",children:e.snippet})]})]});case"web":return o.jsxs("a",{className:"search-result",href:e.url||void 0,target:"_blank",rel:"noreferrer noopener",children:[o.jsx(e1,{className:"search-result-icon"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:e.title||e.url}),o.jsxs("span",{className:"search-result-meta",children:[e.siteName,e.url&&o.jsx(vm,{className:"search-result-ext"})]})]}),e.summary&&o.jsx("div",{className:"search-result-snippet",children:e.summary})]})]});case"knowledge":return o.jsxs("div",{className:"search-result search-result-static",children:[o.jsx(jR,{source:"knowledge"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsxs("span",{className:"search-result-title",children:["知识片段 ",e.index+1]}),o.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${Gy(e.sourceType)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});case"memory":return o.jsxs("div",{className:"search-result search-result-static",children:[o.jsx(jR,{source:"memory"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsxs("span",{className:"search-result-title",children:["记忆片段 ",e.index+1]}),o.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${Gy(e.sourceType)}`:"",e.ts?` · ${IR(e.ts)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function jR({source:e,className:t="search-result-icon"}){return e==="knowledge"?o.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.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"}),o.jsx("path",{d:"M8.25 9h7.5M8.25 12.25h6"})]}):o.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 0 7.5 7.5"}),o.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"})]})}function Yc({className:e="icon"}){return o.jsxs("svg",{className:`${e} sidebar-agent-face`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"4.25",y:"5.25",width:"15.5",height:"13.5",rx:"4.75"}),o.jsx("path",{className:"sidebar-agent-face__eye",d:"M8.5 10.7v2"}),o.jsx("path",{className:"sidebar-agent-face__eye",d:"M15.5 10.7v2"})]})}function $te({filled:e=!1,...t}){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[o.jsx("rect",{x:"3.5",y:"9.3",width:"4.5",height:"10.2",rx:"1.5"}),o.jsx("path",{d:"M8 10.2 11.3 4.8c.5-.8 1.7-.45 1.7.5v3.8h4.2a2.1 2.1 0 0 1 2.04 2.6l-1.4 5.75A2.1 2.1 0 0 1 15.8 19H8"})]})}function Hte({filled:e=!1,...t}){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"4.5",height:"10.2",rx:"1.5"}),o.jsx("path",{d:"M8 13.8 11.3 19.2c.5.8 1.7.45 1.7-.5v-3.8h4.2a2.1 2.1 0 0 0 2.04-2.6l-1.4-5.75A2.1 2.1 0 0 0 15.8 5H8"})]})}function y8(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M5.25 4.25h9.5a2.5 2.5 0 0 1 2.5 2.5v3.5"}),o.jsx("path",{d:"M13.25 17.75h-8a2.5 2.5 0 0 1-2.5-2.5v-8a3 3 0 0 1 3-3"}),o.jsx("path",{d:"M7 8.25h5.5M7 11.75h3.25"}),o.jsx("path",{d:"m13.35 16.65.42-2.16 4.76-4.76a1.35 1.35 0 0 1 1.91 1.91l-4.76 4.76-2.33.25Z"}),o.jsx("path",{d:"m17.65 10.6 1.9 1.9"})]})}const zk="/assets/logo-DCsNZy-k.svg",RR="(max-width: 860px)";function zte(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"7",cy:"7",r:"2.25"}),o.jsx("circle",{cx:"17",cy:"7",r:"2.25"}),o.jsx("circle",{cx:"7",cy:"17",r:"2.25"}),o.jsx("circle",{cx:"17",cy:"17",r:"2.25"})]})}function Vte(e){let t=2166136261;for(const s of e)t^=s.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 Gte={admin:"管理员",developer:"开发者",user:"普通用户"};function OR({role:e}){const t=Gte[e];return o.jsx("span",{className:`studio-role-badge studio-role-badge--${e}`,title:t,children:t})}function Kte({version:e,onClose:t}){return g.useEffect(()=>{const n=s=>{s.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),hi.createPortal(o.jsx("div",{className:"confirm-scrim",onMouseDown:t,children:o.jsxs("section",{className:"confirm-box system-info-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"system-info-title",onMouseDown:n=>n.stopPropagation(),children:[o.jsxs("header",{className:"system-info-head",children:[o.jsx("h2",{id:"system-info-title",children:"系统信息"}),o.jsx("button",{type:"button",className:"icon-btn",onClick:t,"aria-label":"关闭系统信息",autoFocus:!0,children:o.jsx(Ti,{className:"icon","aria-hidden":"true"})})]}),o.jsx("dl",{className:"system-info-meta",children:o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:e||"—"})]})})]})}),document.body)}function qte({access:e,userInfo:t,version:n,onLogout:s}){const[i,r]=g.useState(!1),[a,l]=g.useState(!1),[c,u]=g.useState("");if(!t)return null;const d=Hee(t),f=typeof t.email=="string"?t.email:"",h=(d||"U").slice(0,1).toUpperCase(),p=Vte(d||f||h),m=zee(t),b=m===c?"":m;return o.jsxs("div",{className:"sidebar-user",children:[o.jsxs("button",{className:"sidebar-user-btn",onClick:()=>r(v=>!v),title:f?`${d} -${f}`:d,children:[o.jsxs("span",{className:`account-avatar${b?" has-image":""}`,style:p,children:[h,b?o.jsx("img",{className:"account-avatar-image",src:b,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(b)}):null]}),o.jsxs("span",{className:"sidebar-user-identity",children:[o.jsxs("span",{className:"sidebar-user-primary",children:[o.jsx("span",{className:"sidebar-user-name",children:d}),o.jsx(OR,{role:e.role})]}),f&&f!==d&&o.jsx("span",{className:"sidebar-user-email",children:f})]})]}),i&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>r(!1)}),o.jsxs("div",{className:"account-pop sidebar-user-pop",children:[o.jsxs("div",{className:"account-head",children:[o.jsxs("span",{className:`account-avatar account-avatar--lg${b?" has-image":""}`,style:p,children:[h,b?o.jsx("img",{className:"account-avatar-image",src:b,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(b)}):null]}),o.jsxs("div",{className:"account-id",children:[o.jsxs("div",{className:"account-name-row",children:[o.jsx("div",{className:"account-name",children:d}),o.jsx(OR,{role:e.role})]}),f&&f!==d&&o.jsx("div",{className:"account-sub",children:f})]})]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{r(!1),l(!0)},children:[o.jsx(ic,{className:"icon"})," 系统信息"]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{r(!1),s()},children:[o.jsx(hee,{className:"icon"})," 退出登录"]})]})]}),a?o.jsx(Kte,{version:n,onClose:()=>l(!1)}):null]})}function Yte({branding:e,sessions:t,currentSessionId:n,activePage:s,features:i,access:r,streamingSids:a,evaluatingSids:l,onNewChat:c,onSearch:u,onQuickCreate:d,onSkillCenter:f,onAddAgent:h,onMyAgents:p,onApplications:m,onIssueFeedback:b,onPickSession:v,onDeleteSession:y,userInfo:x,version:E,onLogout:w}){const _=z=>(i==null?void 0:i[z])!==!1,[S,k]=g.useState(null),T=g.useRef(typeof window<"u"&&window.matchMedia(RR).matches),[C,I]=g.useState(T.current),j=[...t].sort((z,D)=>(D.lastUpdateTime??0)-(z.lastUpdateTime??0)),L=()=>{T.current=!1,I(z=>!z),k(null)};return g.useEffect(()=>{const z=window.matchMedia(RR),D=F=>{F.matches?I(A=>A||(T.current=!0,!0)):T.current&&(T.current=!1,I(!1))};return z.addEventListener("change",D),()=>z.removeEventListener("change",D)},[]),o.jsxs("aside",{className:`sidebar ${C?"is-collapsed":""}`,children:[o.jsxs("div",{className:"sidebar-top",children:[o.jsxs("div",{className:"sidebar-brand-row",children:[o.jsxs("button",{type:"button",className:"brand",onClick:c,"aria-label":"返回首页",title:"返回首页",children:[o.jsx("img",{className:"brand-logo",src:e.logoUrl||zk,width:20,height:20,alt:"","aria-hidden":!0}),o.jsx("span",{className:"brand-title",children:e.title})]}),o.jsx("button",{type:"button",className:"sidebar-collapse-toggle",onClick:L,"aria-label":C?"展开侧边栏":"收起侧边栏",title:C?"展开侧边栏":"收起侧边栏",children:C?o.jsx(vee,{className:"icon"}):o.jsx(Eee,{className:"icon"})})]}),_("newChat")&&o.jsxs("button",{className:`new-chat new-chat--conversation${s==="new-chat"?" is-active":""}`,onClick:c,"aria-label":"新会话","aria-current":s==="new-chat"?"page":void 0,title:"新会话",children:[o.jsx(_i,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"新会话"})]}),o.jsxs("button",{className:`new-chat new-chat--agents${s==="agents"?" is-active":""}`,onClick:p,"aria-label":"智能体","aria-current":s==="agents"?"page":void 0,title:"智能体",children:[o.jsx(Yc,{}),o.jsx("span",{className:"sidebar-nav-label",children:"智能体"})]}),_("search")&&o.jsx(Pte,{active:s==="search",onClick:u}),o.jsxs("button",{className:`new-chat new-chat--applications${s==="applications"?" is-active":""}`,onClick:m,"aria-label":"自动化","aria-current":s==="applications"?"page":void 0,title:"自动化",children:[o.jsx(zte,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"自动化"}),o.jsx("span",{className:"sidebar-beta-badge",children:"Beta"})]})]}),_("history")&&o.jsxs("div",{className:"sidebar-history",children:[o.jsxs("div",{className:"history-head",children:[o.jsx("span",{children:"历史会话"}),_("newChat")&&o.jsx("button",{type:"button",className:"history-new-chat",onClick:c,"aria-label":"新建会话",title:"新建会话",children:o.jsx(_i,{className:"icon"})})]}),o.jsxs("div",{className:"history-list",children:[j.length===0&&o.jsx("div",{className:"history-empty",children:"暂无会话"}),j.map(z=>{const D=kte(z.events),F=(a==null?void 0:a.has(z.id))===!0,A=!F&&(l==null?void 0:l.has(z.id))===!0;return o.jsxs("div",{className:`history-item ${z.id===n?"active":""}`,children:[o.jsxs("button",{className:"history-item-btn",onClick:()=>v(z.id),"aria-current":z.id===n?"page":void 0,title:D,children:[F&&o.jsx("span",{className:"history-streaming",title:"正在生成…","aria-label":"正在生成"}),o.jsx("span",{className:"history-title",children:D}),A&&o.jsxs("span",{className:"history-evaluating-status",title:"正在自动评测",children:[o.jsx("span",{className:"history-evaluating","aria-hidden":"true"}),"评测中"]})]}),o.jsx("button",{className:"history-more",title:"更多",onClick:()=>k(O=>O===z.id?null:z.id),children:o.jsx(ZJ,{className:"icon"})}),S===z.id&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>k(null)}),o.jsx("div",{className:"history-menu",children:o.jsxs("button",{className:"menu-item menu-item--danger",onClick:()=>{k(null),y(z.id)},children:[o.jsx(Zl,{className:"icon"})," 删除"]})})]})]},z.id)})]})]}),o.jsxs("div",{className:"sidebar-footer",children:[o.jsxs("button",{type:"button",className:`sidebar-feedback${s==="feedback"?" is-active":""}`,onClick:b,"aria-label":"问题反馈","aria-current":s==="feedback"?"page":void 0,title:"问题反馈",children:[o.jsx(y8,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"问题反馈"})]}),o.jsx(qte,{access:r,userInfo:x,version:E,onLogout:w})]})]})}function Zs(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n{}};function l1(){for(var e=0,t=arguments.length,n={},s;e=0&&(s=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}Db.prototype=l1.prototype={constructor:Db,on:function(e,t){var n=this._,s=Xte(e+"",n),i,r=-1,a=s.length;if(arguments.length<2){for(;++r0)for(var n=new Array(i),s=0,i,r;s=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),LR.hasOwnProperty(t)?{space:LR[t],local:e}:e}function Zte(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===w_&&t.documentElement.namespaceURI===w_?t.createElement(e):t.createElementNS(n,e)}}function Jte(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function x8(e){var t=c1(e);return(t.local?Jte:Zte)(t)}function ene(){}function Vk(e){return e==null?ene:function(){return this.querySelector(e)}}function tne(e){typeof e!="function"&&(e=Vk(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i=E&&(E=x+1);!(_=v[E])&&++E=0;)(a=s[i])&&(r&&a.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(a,r),r=a);return this}function Tne(e){e||(e=kne);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,s=n.length,i=new Array(s),r=0;rt?1:e>=t?0:NaN}function Ane(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Cne(){return Array.from(this)}function Ine(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?$ne:typeof t=="function"?zne:Hne)(e,t,n??"")):bf(this.node(),e)}function bf(e,t){return e.style.getPropertyValue(t)||_8(e).getComputedStyle(e,null).getPropertyValue(t)}function Gne(e){return function(){delete this[e]}}function Kne(e,t){return function(){this[e]=t}}function qne(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Yne(e,t){return arguments.length>1?this.each((t==null?Gne:typeof t=="function"?qne:Kne)(e,t)):this.node()[e]}function N8(e){return e.trim().split(/^|\s+/)}function Gk(e){return e.classList||new T8(e)}function T8(e){this._node=e,this._names=N8(e.getAttribute("class")||"")}T8.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 k8(e,t){for(var n=Gk(e),s=-1,i=t.length;++s=0&&(n=t.slice(s+1),t=t.slice(0,s)),{type:t,name:n}})}function wse(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,i=t.length,r;n()=>e;function S_(e,{sourceEvent:t,subject:n,target:s,identifier:i,active:r,x:a,y:l,dx:c,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:s,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}S_.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Rse(e){return!e.ctrlKey&&!e.button}function Ose(){return this.parentNode}function Mse(e,t){return t??{x:e.x,y:e.y}}function Lse(){return navigator.maxTouchPoints||"ontouchstart"in this}function O8(){var e=Rse,t=Ose,n=Mse,s=Lse,i={},r=l1("start","drag","end"),a=0,l,c,u,d,f=0;function h(w){w.on("mousedown.drag",p).filter(s).on("touchstart.drag",v).on("touchmove.drag",y,jse).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(w,_){if(!(d||!e.call(this,w,_))){var S=E(this,t.call(this,w,_),w,_,"mouse");S&&(vr(w.view).on("mousemove.drag",m,_m).on("mouseup.drag",b,_m),j8(w.view),Ov(w),u=!1,l=w.clientX,c=w.clientY,S("start",w))}}function m(w){if(qd(w),!u){var _=w.clientX-l,S=w.clientY-c;u=_*_+S*S>f}i.mouse("drag",w)}function b(w){vr(w.view).on("mousemove.drag mouseup.drag",null),R8(w.view,u),qd(w),i.mouse("end",w)}function v(w,_){if(e.call(this,w,_)){var S=w.changedTouches,k=t.call(this,w,_),T=S.length,C,I;for(C=0;C>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?O0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?O0(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=Pse.exec(e))?new ar(t[1],t[2],t[3],1):(t=Bse.exec(e))?new ar(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Use.exec(e))?O0(t[1],t[2],t[3],t[4]):(t=Fse.exec(e))?O0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=$se.exec(e))?HR(t[1],t[2]/100,t[3]/100,1):(t=Hse.exec(e))?HR(t[1],t[2]/100,t[3]/100,t[4]):DR.hasOwnProperty(e)?UR(DR[e]):e==="transparent"?new ar(NaN,NaN,NaN,0):null}function UR(e){return new ar(e>>16&255,e>>8&255,e&255,1)}function O0(e,t,n,s){return s<=0&&(e=t=n=NaN),new ar(e,t,n,s)}function Gse(e){return e instanceof hg||(e=ou(e)),e?(e=e.rgb(),new ar(e.r,e.g,e.b,e.opacity)):new ar}function __(e,t,n,s){return arguments.length===1?Gse(e):new ar(e,t,n,s??1)}function ar(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}Kk(ar,__,M8(hg,{brighter(e){return e=e==null?qy:Math.pow(qy,e),new ar(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Nm:Math.pow(Nm,e),new ar(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ar(Wc(this.r),Wc(this.g),Wc(this.b),Yy(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:FR,formatHex:FR,formatHex8:Kse,formatRgb:$R,toString:$R}));function FR(){return`#${Dc(this.r)}${Dc(this.g)}${Dc(this.b)}`}function Kse(){return`#${Dc(this.r)}${Dc(this.g)}${Dc(this.b)}${Dc((isNaN(this.opacity)?1:this.opacity)*255)}`}function $R(){const e=Yy(this.opacity);return`${e===1?"rgb(":"rgba("}${Wc(this.r)}, ${Wc(this.g)}, ${Wc(this.b)}${e===1?")":`, ${e})`}`}function Yy(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Wc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Dc(e){return e=Wc(e),(e<16?"0":"")+e.toString(16)}function HR(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new wa(e,t,n,s)}function L8(e){if(e instanceof wa)return new wa(e.h,e.s,e.l,e.opacity);if(e instanceof hg||(e=ou(e)),!e)return new wa;if(e instanceof wa)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,i=Math.min(t,n,s),r=Math.max(t,n,s),a=NaN,l=r-i,c=(r+i)/2;return l?(t===r?a=(n-s)/l+(n0&&c<1?0:a,new wa(a,l,c,e.opacity)}function qse(e,t,n,s){return arguments.length===1?L8(e):new wa(e,t,n,s??1)}function wa(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}Kk(wa,qse,M8(hg,{brighter(e){return e=e==null?qy:Math.pow(qy,e),new wa(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Nm:Math.pow(Nm,e),new wa(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,s=n+(n<.5?n:1-n)*t,i=2*n-s;return new ar(Mv(e>=240?e-240:e+120,i,s),Mv(e,i,s),Mv(e<120?e+240:e-120,i,s),this.opacity)},clamp(){return new wa(zR(this.h),M0(this.s),M0(this.l),Yy(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=Yy(this.opacity);return`${e===1?"hsl(":"hsla("}${zR(this.h)}, ${M0(this.s)*100}%, ${M0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function zR(e){return e=(e||0)%360,e<0?e+360:e}function M0(e){return Math.max(0,Math.min(1,e||0))}function Mv(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 qk=e=>()=>e;function Yse(e,t){return function(n){return e+n*t}}function Wse(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function Xse(e){return(e=+e)==1?D8:function(t,n){return n-t?Wse(t,n,e):qk(isNaN(t)?n:t)}}function D8(e,t){var n=t-e;return n?Yse(e,n):qk(isNaN(e)?t:e)}const Wy=function e(t){var n=Xse(t);function s(i,r){var a=n((i=__(i)).r,(r=__(r)).r),l=n(i.g,r.g),c=n(i.b,r.b),u=D8(i.opacity,r.opacity);return function(d){return i.r=a(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return s.gamma=e,s}(1);function Qse(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,s=t.slice(),i;return function(r){for(i=0;in&&(r=t.slice(n,r),l[a]?l[a]+=r:l[++a]=r),(s=s[0])===(i=i[0])?l[a]?l[a]+=i:l[++a]=i:(l[++a]=null,c.push({i:a,x:qa(s,i)})),n=Lv.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(i(f)+"rotate(",null,s)-2,x:qa(u,d)})):d&&f.push(i(f)+"rotate("+d+s)}function l(u,d,f,h){u!==d?h.push({i:f.push(i(f)+"skewX(",null,s)-2,x:qa(u,d)}):d&&f.push(i(f)+"skewX("+d+s)}function c(u,d,f,h,p,m){if(u!==f||d!==h){var b=p.push(i(p)+"scale(",null,",",null,")");m.push({i:b-4,x:qa(u,f)},{i:b-2,x:qa(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),r(u.translateX,u.translateY,d.translateX,d.translateY,f,h),a(u.rotate,d.rotate,f,h),l(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var m=-1,b=h.length,v;++m=0&&e._call.call(void 0,t),e=e._next;--yf}function KR(){lu=(Qy=km.now())+u1,yf=cp=0;try{fie()}finally{yf=0,pie(),lu=0}}function hie(){var e=km.now(),t=e-Qy;t>F8&&(u1-=t,Qy=e)}function pie(){for(var e,t=Xy,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Xy=n);up=e,k_(s)}function k_(e){if(!yf){cp&&(cp=clearTimeout(cp));var t=e-lu;t>24?(e<1/0&&(cp=setTimeout(KR,e-km.now()-u1)),Uh&&(Uh=clearInterval(Uh))):(Uh||(Qy=km.now(),Uh=setInterval(hie,F8)),yf=1,$8(KR))}}function qR(e,t,n){var s=new Zy;return t=t==null?0:+t,s.restart(i=>{s.stop(),e(i+t)},t,n),s}var mie=l1("start","end","cancel","interrupt"),gie=[],z8=0,YR=1,A_=2,Bb=3,WR=4,C_=5,Ub=6;function d1(e,t,n,s,i,r){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;bie(e,n,{name:t,index:s,group:i,on:mie,tween:gie,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:z8})}function Wk(e,t){var n=Oa(e,t);if(n.state>z8)throw new Error("too late; already scheduled");return n}function oo(e,t){var n=Oa(e,t);if(n.state>Bb)throw new Error("too late; already running");return n}function Oa(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function bie(e,t,n){var s=e.__transition,i;s[t]=n,n.timer=H8(r,0,n.time);function r(u){n.state=YR,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!==YR)return c();for(d in s)if(p=s[d],p.name===n.name){if(p.state===Bb)return qR(a);p.state===WR?(p.state=Ub,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete s[d]):+dA_&&s.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function qie(e,t,n){var s,i,r=Kie(t)?Wk:oo;return function(){var a=r(this,e),l=a.on;l!==s&&(i=(s=l).copy()).on(t,n),a.on=i}}function Yie(e,t){var n=this._id;return arguments.length<2?Oa(this.node(),n).on.on(e):this.each(qie(n,e,t))}function Wie(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Xie(){return this.on("end.remove",Wie(this._id))}function Qie(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Vk(e));for(var s=this._groups,i=s.length,r=new Array(i),a=0;a()=>e;function wre(e,{sourceEvent:t,target:n,transform:s,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:s,enumerable:!0,configurable:!0},_:{value:i}})}function Oo(e,t,n){this.k=e,this.x=t,this.y=n}Oo.prototype={constructor:Oo,scale:function(e){return e===1?this:new Oo(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Oo(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 f1=new Oo(1,0,0);q8.prototype=Oo.prototype;function q8(e){for(;!e.__zoom;)if(!(e=e.parentNode))return f1;return e.__zoom}function Dv(e){e.stopImmediatePropagation()}function Fh(e){e.preventDefault(),e.stopImmediatePropagation()}function Sre(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function _re(){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 XR(){return this.__zoom||f1}function Nre(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Tre(){return navigator.maxTouchPoints||"ontouchstart"in this}function kre(e,t,n){var s=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],r=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i),a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a))}function Y8(){var e=Sre,t=_re,n=kre,s=Nre,i=Tre,r=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Pb,u=l1("start","zoom","end"),d,f,h,p=500,m=150,b=0,v=10;function y(D){D.property("__zoom",XR).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",I).filter(i).on("touchstart.zoom",j).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(D,F,A,O){var P=D.selection?D.selection():D;P.property("__zoom",XR),D!==P?_(D,F,A,O):P.interrupt().each(function(){S(this,arguments).event(O).start().zoom(null,typeof F=="function"?F.apply(this,arguments):F).end()})},y.scaleBy=function(D,F,A,O){y.scaleTo(D,function(){var P=this.__zoom.k,$=typeof F=="function"?F.apply(this,arguments):F;return P*$},A,O)},y.scaleTo=function(D,F,A,O){y.transform(D,function(){var P=t.apply(this,arguments),$=this.__zoom,R=A==null?w(P):typeof A=="function"?A.apply(this,arguments):A,Y=$.invert(R),J=typeof F=="function"?F.apply(this,arguments):F;return n(E(x($,J),R,Y),P,a)},A,O)},y.translateBy=function(D,F,A,O){y.transform(D,function(){return n(this.__zoom.translate(typeof F=="function"?F.apply(this,arguments):F,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),a)},null,O)},y.translateTo=function(D,F,A,O,P){y.transform(D,function(){var $=t.apply(this,arguments),R=this.__zoom,Y=O==null?w($):typeof O=="function"?O.apply(this,arguments):O;return n(f1.translate(Y[0],Y[1]).scale(R.k).translate(typeof F=="function"?-F.apply(this,arguments):-F,typeof A=="function"?-A.apply(this,arguments):-A),$,a)},O,P)};function x(D,F){return F=Math.max(r[0],Math.min(r[1],F)),F===D.k?D:new Oo(F,D.x,D.y)}function E(D,F,A){var O=F[0]-A[0]*D.k,P=F[1]-A[1]*D.k;return O===D.x&&P===D.y?D:new Oo(D.k,O,P)}function w(D){return[(+D[0][0]+ +D[1][0])/2,(+D[0][1]+ +D[1][1])/2]}function _(D,F,A,O){D.on("start.zoom",function(){S(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(O).end()}).tween("zoom",function(){var P=this,$=arguments,R=S(P,$).event(O),Y=t.apply(P,$),J=A==null?w(Y):typeof A=="function"?A.apply(P,$):A,U=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),te=P.__zoom,K=typeof F=="function"?F.apply(P,$):F,V=c(te.invert(J).concat(U/te.k),K.invert(J).concat(U/K.k));return function(W){if(W===1)W=K;else{var q=V(W),ue=U/q[2];W=new Oo(ue,J[0]-q[0]*ue,J[1]-q[1]*ue)}R.zoom(null,W)}})}function S(D,F,A){return!A&&D.__zooming||new k(D,F)}function k(D,F){this.that=D,this.args=F,this.active=0,this.sourceEvent=null,this.extent=t.apply(D,F),this.taps=0}k.prototype={event:function(D){return D&&(this.sourceEvent=D),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(D,F){return this.mouse&&D!=="mouse"&&(this.mouse[1]=F.invert(this.mouse[0])),this.touch0&&D!=="touch"&&(this.touch0[1]=F.invert(this.touch0[0])),this.touch1&&D!=="touch"&&(this.touch1[1]=F.invert(this.touch1[0])),this.that.__zoom=F,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(D){var F=vr(this.that).datum();u.call(D,this.that,new wre(D,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),F)}};function T(D,...F){if(!e.apply(this,arguments))return;var A=S(this,F).event(D),O=this.__zoom,P=Math.max(r[0],Math.min(r[1],O.k*Math.pow(2,s.apply(this,arguments)))),$=ya(D);if(A.wheel)(A.mouse[0][0]!==$[0]||A.mouse[0][1]!==$[1])&&(A.mouse[1]=O.invert(A.mouse[0]=$)),clearTimeout(A.wheel);else{if(O.k===P)return;A.mouse=[$,O.invert($)],Fb(this),A.start()}Fh(D),A.wheel=setTimeout(R,m),A.zoom("mouse",n(E(x(O,P),A.mouse[0],A.mouse[1]),A.extent,a));function R(){A.wheel=null,A.end()}}function C(D,...F){if(h||!e.apply(this,arguments))return;var A=D.currentTarget,O=S(this,F,!0).event(D),P=vr(D.view).on("mousemove.zoom",J,!0).on("mouseup.zoom",U,!0),$=ya(D,A),R=D.clientX,Y=D.clientY;j8(D.view),Dv(D),O.mouse=[$,this.__zoom.invert($)],Fb(this),O.start();function J(te){if(Fh(te),!O.moved){var K=te.clientX-R,V=te.clientY-Y;O.moved=K*K+V*V>b}O.event(te).zoom("mouse",n(E(O.that.__zoom,O.mouse[0]=ya(te,A),O.mouse[1]),O.extent,a))}function U(te){P.on("mousemove.zoom mouseup.zoom",null),R8(te.view,O.moved),Fh(te),O.event(te).end()}}function I(D,...F){if(e.apply(this,arguments)){var A=this.__zoom,O=ya(D.changedTouches?D.changedTouches[0]:D,this),P=A.invert(O),$=A.k*(D.shiftKey?.5:2),R=n(E(x(A,$),O,P),t.apply(this,F),a);Fh(D),l>0?vr(this).transition().duration(l).call(_,R,O,D):vr(this).call(y.transform,R,O,D)}}function j(D,...F){if(e.apply(this,arguments)){var A=D.touches,O=A.length,P=S(this,F,D.changedTouches.length===O).event(D),$,R,Y,J;for(Dv(D),R=0;R`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:s})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:s}", 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.`},Am=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],W8=["Enter"," ","Escape"],X8={"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 xf;(function(e){e.Strict="strict",e.Loose="loose"})(xf||(xf={}));var Xc;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Xc||(Xc={}));var Cm;(function(e){e.Partial="partial",e.Full="full"})(Cm||(Cm={}));const Q8={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var _l;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(_l||(_l={}));var Ef;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ef||(Ef={}));var Xe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Xe||(Xe={}));const QR={[Xe.Left]:Xe.Right,[Xe.Right]:Xe.Left,[Xe.Top]:Xe.Bottom,[Xe.Bottom]:Xe.Top};function Z8(e){return e===null?null:e?"valid":"invalid"}const J8=e=>"id"in e&&"source"in e&&"target"in e,Are=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Qk=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),pg=(e,t=[0,0])=>{const{width:n,height:s}=Jo(e),i=e.origin??t,r=n*i[0],a=s*i[1];return{x:e.position.x-r,y:e.position.y-a}},Cre=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,i)=>{const r=typeof i=="string";let a=!t.nodeLookup&&!r?i:void 0;t.nodeLookup&&(a=r?t.nodeLookup.get(i):Qk(i)?i:t.nodeLookup.get(i.id));const l=a?Jy(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return h1(s,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return p1(n)},mg=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},s=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=h1(n,Jy(i)),s=!0)}),s?p1(n):{x:0,y:0,width:0,height:0}},Zk=(e,t,[n,s,i]=[0,0,1],r=!1,a=!1)=>{const l={...Zf(t,[n,s,i]),width:t.width/i,height:t.height/i},c=[];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=Im(l,wf(u)),v=(p??0)*(m??0),y=r&&b>0;(!u.internals.handleBounds||y||b>=v||u.dragging)&&c.push(u)}return c},Ire=(e,t)=>{const n=new Set;return e.forEach(s=>{n.add(s.id)}),t.filter(s=>n.has(s.source)||n.has(s.target))};function jre(e,t){const n=new Map,s=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)&&(!s||s.has(i.id))&&n.set(i.id,i)}),n}async function Rre({nodes:e,width:t,height:n,panZoom:s,minZoom:i,maxZoom:r},a){if(e.size===0)return!0;const l=jre(e,a),c=mg(l),u=eA(c,t,n,(a==null?void 0:a.minZoom)??i,(a==null?void 0:a.maxZoom)??r,(a==null?void 0:a.padding)??.1);return await s.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 e9({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:s=[0,0],nodeExtent:i,onError:r}){const a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},d=a.origin??s;let f=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!l)r==null||r("005",Ia.error005());else{const p=l.measured.width,m=l.measured.height;p&&m&&(f=[[c,u],[c+p,u+m]])}else l&&uu(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const h=uu(f)?cu(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(r==null||r("015",Ia.error015())),{position:{x:h.x-c+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}async function Ore({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:s,onBeforeDelete:i}){const r=new Set(e.map(h=>h.id)),a=[];for(const h of n){if(h.deletable===!1)continue;const p=r.has(h.id),m=!p&&h.parentId&&a.find(b=>b.id===h.parentId);(p||m)&&a.push(h)}const l=new Set(t.map(h=>h.id)),c=s.filter(h=>h.deletable!==!1),d=Ire(a,c);for(const h of c)l.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 vf=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),cu=(e={x:0,y:0},t,n)=>({x:vf(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:vf(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function t9(e,t,n){const{width:s,height:i}=Jo(n),{x:r,y:a}=n.internals.positionAbsolute;return cu(e,[[r,a],[r+s,a+i]],t)}const ZR=(e,t,n)=>en?-vf(Math.abs(e-n),1,t)/t:0,Jk=(e,t,n=15,s=40)=>{const i=ZR(e.x,s,t.width-s)*n,r=ZR(e.y,s,t.height-s)*n;return[i,r]},h1=(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)}),I_=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),p1=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),wf=(e,t=[0,0])=>{var i,r;const{x:n,y:s}=Qk(e)?e.internals.positionAbsolute:pg(e,t);return{x:n,y:s,width:((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0,height:((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0}},Jy=(e,t=[0,0])=>{var i,r;const{x:n,y:s}=Qk(e)?e.internals.positionAbsolute:pg(e,t);return{x:n,y:s,x2:n+(((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0),y2:s+(((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0)}},n9=(e,t)=>p1(h1(I_(e),I_(t))),Im=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},JR=e=>_a(e.width)&&_a(e.height)&&_a(e.x)&&_a(e.y),_a=e=>!isNaN(e)&&isFinite(e),s9=(e,t)=>(n,s)=>{},gg=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Zf=({x:e,y:t},[n,s,i],r=!1,a=[1,1])=>{const l={x:(e-n)/i,y:(t-s)/i};return r?gg(l,a):l},Sf=({x:e,y:t},[n,s,i])=>({x:e*i+n,y:t*i+s});function Gu(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 Mre(e,t,n){if(typeof e=="string"||typeof e=="number"){const s=Gu(e,n),i=Gu(e,t);return{top:s,right:i,bottom:s,left:i,x:i*2,y:s*2}}if(typeof e=="object"){const s=Gu(e.top??e.y??0,n),i=Gu(e.bottom??e.y??0,n),r=Gu(e.left??e.x??0,t),a=Gu(e.right??e.x??0,t);return{top:s,right:a,bottom:i,left:r,x:r+a,y:s+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Lre(e,t,n,s,i,r){const{x:a,y:l}=Sf(e,[t,n,s]),{x:c,y:u}=Sf({x:e.x+e.width,y:e.y+e.height},[t,n,s]),d=i-c,f=r-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}const eA=(e,t,n,s,i,r)=>{const a=Mre(r,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),d=vf(u,s,i),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,m=n/2-h*d,b=Lre(e,p,m,d,t,n),v={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-v.left+v.right,y:m-v.top+v.bottom,zoom:d}},jm=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function uu(e){return e!=null&&e!=="parent"}function Jo(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 tA(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 i9(e,t={width:0,height:0},n,s,i){const r={...e},a=s.get(n);if(a){const l=a.origin||i;r.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],r.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return r}function eO(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Dre(){let e,t;return{promise:new Promise((s,i)=>{e=s,t=i}),resolve:e,reject:t}}function Pre(e){return{...X8,...e||{}}}function $p(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:s,containerBounds:i}){const{x:r,y:a}=Na(e),l=Zf({x:r-((i==null?void 0:i.left)??0),y:a-((i==null?void 0:i.top)??0)},s),{x:c,y:u}=n?gg(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const nA=e=>({width:e.offsetWidth,height:e.offsetHeight}),r9=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Bre=["INPUT","SELECT","TEXTAREA"];function a9(e){var s,i;const t=((i=(s=e.composedPath)==null?void 0:s.call(e))==null?void 0:i[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Bre.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const o9=e=>"clientX"in e,Na=(e,t)=>{var r,a;const n=o9(e),s=n?e.clientX:(r=e.touches)==null?void 0:r[0].clientX,i=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},tO=(e,t,n,s,i)=>{const r=t.querySelectorAll(`.${e}`);return!r||!r.length?null:Array.from(r).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/s,y:(l.top-n.top)/s,...nA(a)}})};function l9({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:i,sourceControlY:r,targetControlX:a,targetControlY:l}){const c=e*.125+i*.375+a*.375+n*.125,u=t*.125+r*.375+l*.375+s*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function P0(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function nO({pos:e,x1:t,y1:n,x2:s,y2:i,c:r}){switch(e){case Xe.Left:return[t-P0(t-s,r),n];case Xe.Right:return[t+P0(s-t,r),n];case Xe.Top:return[t,n-P0(n-i,r)];case Xe.Bottom:return[t,n+P0(i-n,r)]}}function c9({sourceX:e,sourceY:t,sourcePosition:n=Xe.Bottom,targetX:s,targetY:i,targetPosition:r=Xe.Top,curvature:a=.25}){const[l,c]=nO({pos:n,x1:e,y1:t,x2:s,y2:i,c:a}),[u,d]=nO({pos:r,x1:s,y1:i,x2:e,y2:t,c:a}),[f,h,p,m]=l9({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${l},${c} ${u},${d} ${s},${i}`,f,h,p,m]}function u9({sourceX:e,sourceY:t,targetX:n,targetY:s}){const i=Math.abs(n-e)/2,r=n0}const $re=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`xy-edge__${e}${t||""}-${n}${s||""}`,Hre=(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)),zre=(e,t,n={})=>{var r;if(!e.source||!e.target)return(r=n.onError)==null||r.call(n,"006",Ia.error006()),t;const s=n.getEdgeId||$re;let i;return J8(e)?i={...e}:i={...e,id:s(e)},Hre(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function d9({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[i,r,a,l]=u9({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,i,r,a,l]}const sO={[Xe.Left]:{x:-1,y:0},[Xe.Right]:{x:1,y:0},[Xe.Top]:{x:0,y:-1},[Xe.Bottom]:{x:0,y:1}},Vre=({source:e,sourcePosition:t=Xe.Bottom,target:n})=>t===Xe.Left||t===Xe.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Gre({source:e,sourcePosition:t=Xe.Bottom,target:n,targetPosition:s=Xe.Top,center:i,offset:r,stepPosition:a}){const l=sO[t],c=sO[s],u={x:e.x+l.x*r,y:e.y+l.y*r},d={x:n.x+c.x*r,y:n.y+c.y*r},f=Vre({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let m=[],b,v;const y={x:0,y:0},x={x:0,y:0},[,,E,w]=u9({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(b=i.x??u.x+(d.x-u.x)*a,v=i.y??(u.y+d.y)/2):(b=i.x??(u.x+d.x)/2,v=i.y??u.y+(d.y-u.y)*a);const T=[{x:b,y:u.y},{x:b,y:d.y}],C=[{x:u.x,y:v},{x:d.x,y:v}];l[h]===p?m=h==="x"?T:C:m=h==="x"?C:T}else{const T=[{x:u.x,y:d.y}],C=[{x:d.x,y:u.y}];if(h==="x"?m=l.x===p?C:T:m=l.y===p?T:C,t===s){const D=Math.abs(e[h]-n[h]);if(D<=r){const F=Math.min(r-1,r-D);l[h]===p?y[h]=(u[h]>e[h]?-1:1)*F:x[h]=(d[h]>n[h]?-1:1)*F}}if(t!==s){const D=h==="x"?"y":"x",F=l[h]===c[D],A=u[D]>d[D],O=u[D]=z?(b=(I.x+j.x)/2,v=m[0].y):(b=m[0].x,v=(I.y+j.y)/2)}const _={x:u.x+y.x,y:u.y+y.y},S={x:d.x+x.x,y:d.y+x.y};return[[e,..._.x!==m[0].x||_.y!==m[0].y?[_]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],b,v,E,w]}function Kre(e,t,n,s){const i=Math.min(iO(e,t)/2,iO(t,n)/2,s),{x:r,y:a}=t;if(e.x===r&&r===n.x||e.y===a&&a===n.y)return`L${r} ${a}`;if(e.y===a){const u=e.xn.id===t):e[0])||null}function j_(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`:""}function Yre(e,{id:t,defaultColor:n,defaultMarkerStart:s,defaultMarkerEnd:i}){const r=new Set;return e.reduce((a,l)=>([l.markerStart||s,l.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const u=j_(c,t);r.has(u)||(a.push({id:u,color:c.color||n,...c}),r.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const f9=1e3,Wre=10,sA={nodeOrigin:[0,0],nodeExtent:Am,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Xre={...sA,checkEquality:!0};function iA(e,t){const n={...e};for(const s in t)t[s]!==void 0&&(n[s]=t[s]);return n}function Qre(e,t,n){const s=iA(sA,n);for(const i of e.values())if(i.parentId)aA(i,e,t,s);else{const r=pg(i,s.nodeOrigin),a=uu(i.extent)?i.extent:s.nodeExtent,l=cu(r,a,Jo(i));i.internals.positionAbsolute=l}}function Zre(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],s=[];for(const i of e.handles){const r={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(r):i.type==="target"&&s.push(r)}return{source:n,target:s}}function rA(e){return e==="manual"}function R_(e,t,n,s={}){var d,f;const i=iA(Xre,s),r={i:0},a=new Map(t),l=i!=null&&i.elevateNodesOnSelect&&!rA(i.zIndexMode)?f9:0;let c=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=pg(h,i.nodeOrigin),b=uu(h.extent)?h.extent:i.nodeExtent,v=cu(m,b,Jo(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:v,handleBounds:Zre(h,p),z:h9(h,l,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&&(c=!1),h.parentId&&aA(p,t,n,s,r),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function Jre(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 aA(e,t,n,s,i){const{elevateNodesOnSelect:r,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=iA(sA,s),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}Jre(e,n),i&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++i.i,d.internals.z=d.internals.z+i.i*Wre),i&&d.internals.rootParentIndex!==void 0&&(i.i=d.internals.rootParentIndex);const f=r&&!rA(c)?f9:0,{x:h,y:p,z:m}=eae(e,d,a,l,f,c),{positionAbsolute:b}=e.internals,v=h!==b.x||p!==b.y;(v||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:h,y:p}:b,z:m}})}function h9(e,t,n){const s=_a(e.zIndex)?e.zIndex:0;return rA(n)?s:s+(e.selected?t:0)}function eae(e,t,n,s,i,r){const{x:a,y:l}=t.internals.positionAbsolute,c=Jo(e),u=pg(e,n),d=uu(e.extent)?cu(u,e.extent,c):u;let f=cu({x:a+d.x,y:l+d.y},s,c);e.extent==="parent"&&(f=t9(f,c,t));const h=h9(e,i,r),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function oA(e,t,n,s=[0,0]){var a;const i=[],r=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((a=r.get(l.parentId))==null?void 0:a.expandedRect)??wf(c),d=n9(u,l.rect);r.set(l.parentId,{expandedRect:d,parent:c})}return r.size>0&&r.forEach(({expandedRect:l,parent:c},u)=>{var E;const d=c.internals.positionAbsolute,f=Jo(c),h=c.origin??s,p=l.x0||m>0||y||x)&&(i.push({id:u,type:"position",position:{x:c.position.x-p+y,y:c.position.y-m+x}}),(E=n.get(u))==null||E.forEach(w=>{e.some(_=>_.id===w.id)||i.push({id:w.id,type:"position",position:{x:w.position.x+p,y:w.position.y+m}})})),(f.width0){const p=oA(h,t,n,i);u.push(...p)}return{changes:u,updatedInternals:c}}async function nae({delta:e,panZoom:t,transform:n,translateExtent:s,width:i,height:r}){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,r]],s);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function lO(e,t,n,s,i,r){let a=i;const l=s.get(a)||new Map;s.set(a,l.set(n,t)),a=`${i}-${e}`;const c=s.get(a)||new Map;if(s.set(a,c.set(n,t)),r){a=`${i}-${e}-${r}`;const u=s.get(a)||new Map;s.set(a,u.set(n,t))}}function p9(e,t,n){e.clear(),t.clear();for(const s of n){const{source:i,target:r,sourceHandle:a=null,targetHandle:l=null}=s,c={edgeId:s.id,source:i,target:r,sourceHandle:a,targetHandle:l},u=`${i}-${a}--${r}-${l}`,d=`${r}-${l}--${i}-${a}`;lO("source",c,d,e,i,a),lO("target",c,u,e,r,l),t.set(s.id,s)}}function m9(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:m9(n,t):!1}function cO(e,t,n){var i;let s=e;do{if((i=s==null?void 0:s.matches)!=null&&i.call(s,t))return!0;if(s===n)return!1;s=s==null?void 0:s.parentElement}while(s);return!1}function sae(e,t,n,s){const i=new Map;for(const[r,a]of e)if((a.selected||a.id===s)&&(!a.parentId||!m9(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const l=e.get(r);l&&i.set(r,{id:r,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return i}function Pv({nodeId:e,dragItems:t,nodeLookup:n,dragging:s=!0}){var a,l,c;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:s})}if(!e)return[i[0],i];const r=(l=n.get(e))==null?void 0:l.internals.userNode;return[r?{...r,position:((c=t.get(e))==null?void 0:c.position)||r.position,dragging:s}:i[0],i]}function iae({dragItems:e,snapGrid:t,x:n,y:s}){const i=e.values().next().value;if(!i)return null;const r={x:n-i.distance.x,y:s-i.distance.y},a=gg(r,t);return{x:a.x-r.x,y:a.y-r.y}}function rae({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:s,onDragStop:i}){let r={x:null,y:null},a=0,l=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,m=!1,b=null;function v({noDragClassName:x,handleSelector:E,domNode:w,isSelectable:_,nodeId:S,nodeClickDistance:k=0}){h=vr(w);function T({x:L,y:z}){const{nodeLookup:D,nodeExtent:F,snapGrid:A,snapToGrid:O,nodeOrigin:P,onNodeDrag:$,onSelectionDrag:R,onError:Y,updateNodePositions:J}=t();r={x:L,y:z};let U=!1;const te=l.size>1,K=te&&F?I_(mg(l)):null,V=te&&O?iae({dragItems:l,snapGrid:A,x:L,y:z}):null;for(const[W,q]of l){if(!D.has(W))continue;let ue={x:L-q.distance.x,y:z-q.distance.y};O&&(ue=V?{x:Math.round(ue.x+V.x),y:Math.round(ue.y+V.y)}:gg(ue,A));let me=null;if(te&&F&&!q.extent&&K){const{positionAbsolute:ge}=q.internals,Me=ge.x-K.x+F[0][0],ve=ge.x+q.measured.width-K.x2+F[1][0],re=ge.y-K.y+F[0][1],ke=ge.y+q.measured.height-K.y2+F[1][1];me=[[Me,re],[ve,ke]]}const{position:Se,positionAbsolute:de}=e9({nodeId:W,nextPosition:ue,nodeLookup:D,nodeExtent:me||F,nodeOrigin:P,onError:Y});U=U||q.position.x!==Se.x||q.position.y!==Se.y,q.position=Se,q.internals.positionAbsolute=de}if(m=m||U,!!U&&(J(l,!0),b&&(s||$||!S&&R))){const[W,q]=Pv({nodeId:S,dragItems:l,nodeLookup:D});s==null||s(b,l,W,q),$==null||$(b,W,q),S||R==null||R(b,q)}}async function C(){if(!d)return;const{transform:L,panBy:z,autoPanSpeed:D,autoPanOnNodeDrag:F}=t();if(!F){c=!1,cancelAnimationFrame(a);return}const[A,O]=Jk(u,d,D);(A!==0||O!==0)&&(r.x=(r.x??0)-A/L[2],r.y=(r.y??0)-O/L[2],await z({x:A,y:O})&&T(r)),a=requestAnimationFrame(C)}function I(L){var te;const{nodeLookup:z,multiSelectionActive:D,nodesDraggable:F,transform:A,snapGrid:O,snapToGrid:P,selectNodesOnDrag:$,onNodeDragStart:R,onSelectionDragStart:Y,unselectNodesAndEdges:J}=t();f=!0,(!$||!_)&&!D&&S&&((te=z.get(S))!=null&&te.selected||J()),_&&$&&S&&(e==null||e(S));const U=$p(L.sourceEvent,{transform:A,snapGrid:O,snapToGrid:P,containerBounds:d});if(r=U,l=sae(z,F,U,S),l.size>0&&(n||R||!S&&Y)){const[K,V]=Pv({nodeId:S,dragItems:l,nodeLookup:z});n==null||n(L.sourceEvent,l,K,V),R==null||R(L.sourceEvent,K,V),S||Y==null||Y(L.sourceEvent,V)}}const j=O8().clickDistance(k).on("start",L=>{const{domNode:z,nodeDragThreshold:D,transform:F,snapGrid:A,snapToGrid:O}=t();d=(z==null?void 0:z.getBoundingClientRect())||null,p=!1,m=!1,b=L.sourceEvent,D===0&&I(L),r=$p(L.sourceEvent,{transform:F,snapGrid:A,snapToGrid:O,containerBounds:d}),u=Na(L.sourceEvent,d)}).on("drag",L=>{const{autoPanOnNodeDrag:z,transform:D,snapGrid:F,snapToGrid:A,nodeDragThreshold:O,nodeLookup:P}=t(),$=$p(L.sourceEvent,{transform:D,snapGrid:F,snapToGrid:A,containerBounds:d});if(b=L.sourceEvent,(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1||S&&!P.has(S))&&(p=!0),!p){if(!c&&z&&f&&(c=!0,C()),!f){const R=Na(L.sourceEvent,d),Y=R.x-u.x,J=R.y-u.y;Math.sqrt(Y*Y+J*J)>O&&I(L)}(r.x!==$.xSnapped||r.y!==$.ySnapped)&&l&&f&&(u=Na(L.sourceEvent,d),T($))}}).on("end",L=>{if(!f||p){p&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),l.size>0){const{nodeLookup:z,updateNodePositions:D,onNodeDragStop:F,onSelectionDragStop:A}=t();if(m&&(D(l,!1),m=!1),i||F||!S&&A){const[O,P]=Pv({nodeId:S,dragItems:l,nodeLookup:z,dragging:!1});i==null||i(L.sourceEvent,l,O,P),F==null||F(L.sourceEvent,O,P),S||A==null||A(L.sourceEvent,P)}}}).filter(L=>{const z=L.target;return!L.button&&(!x||!cO(z,`.${x}`,w))&&(!E||cO(z,E,w))});h.call(j)}function y(){h==null||h.on(".drag",null)}return{update:v,destroy:y}}function aae(e,t,n){const s=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const r of t.values())Im(i,wf(r))>0&&s.push(r);return s}const oae=250;function lae(e,t,n,s){var l,c;let i=[],r=1/0;const a=aae(e,n,t+oae);for(const u of a){const d=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(s.nodeId===f.nodeId&&s.type===f.type&&s.id===f.id)continue;const{x:h,y:p}=du(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=s.type==="source"?"target":"source";return i.find(d=>d.type===u)??i[0]}return i[0]}function g9(e,t,n,s,i,r=!1){var u,d,f;const a=s.get(e);if(!a)return null;const l=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)??[]],c=(n?l==null?void 0:l.find(h=>h.id===n):l==null?void 0:l[0])??null;return c&&r?{...c,...du(a,c,c.position,!0)}:c}function b9(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function cae(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const y9=()=>!0;function uae(e,{connectionMode:t,connectionRadius:n,handleId:s,nodeId:i,edgeUpdaterType:r,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:m,onConnect:b,onConnectEnd:v,isValidConnection:y=y9,onReconnectEnd:x,updateConnection:E,getTransform:w,getFromHandle:_,autoPanSpeed:S,dragThreshold:k=1,handleDomNode:T}){const C=r9(e.target);let I=0,j;const{x:L,y:z}=Na(e),D=b9(r,T),F=l==null?void 0:l.getBoundingClientRect();let A=!1;if(!F||!D)return;const O=g9(i,D,s,c,t);if(!O)return;let P=Na(e,F),$=!1,R=null,Y=!1,J=null;function U(){if(!d||!F)return;const[Se,de]=Jk(P,F,S);h({x:Se,y:de}),I=requestAnimationFrame(U)}const te={...O,nodeId:i,type:D,position:O.position},K=c.get(i);let W={inProgress:!0,isValid:null,from:du(K,te,Xe.Left,!0),fromHandle:te,fromPosition:te.position,fromNode:K,to:P,toHandle:null,toPosition:QR[te.position],toNode:null,pointer:P};function q(){A=!0,E(W),m==null||m(e,{nodeId:i,handleId:s,handleType:D})}k===0&&q();function ue(Se){if(!A){const{x:ke,y:we}=Na(Se),Je=ke-L,Le=we-z;if(!(Je*Je+Le*Le>k*k))return;q()}if(!_()||!te){me(Se);return}const de=w();P=Na(Se,F),j=lae(Zf(P,de,!1,[1,1]),n,c,te),$||(U(),$=!0);const ge=x9(Se,{handle:j,connectionMode:t,fromNodeId:i,fromHandleId:s,fromType:a?"target":"source",isValidConnection:y,doc:C,lib:u,flowId:f,nodeLookup:c});J=ge.handleDomNode,R=ge.connection,Y=cae(!!j,ge.isValid);const Me=c.get(i),ve=Me?du(Me,te,Xe.Left,!0):W.from,re={...W,from:ve,isValid:Y,to:ge.toHandle&&Y?Sf({x:ge.toHandle.x,y:ge.toHandle.y},de):P,toHandle:ge.toHandle,toPosition:Y&&ge.toHandle?ge.toHandle.position:QR[te.position],toNode:ge.toHandle?c.get(ge.toHandle.nodeId):null,pointer:P};E(re),W=re}function me(Se){if(!("touches"in Se&&Se.touches.length>0)){if(A){(j||J)&&R&&Y&&(b==null||b(R));const{inProgress:de,...ge}=W,Me={...ge,toPosition:W.toHandle?W.toPosition:null};v==null||v(Se,Me),r&&(x==null||x(Se,Me))}p(),cancelAnimationFrame(I),$=!1,Y=!1,R=null,J=null,C.removeEventListener("mousemove",ue),C.removeEventListener("mouseup",me),C.removeEventListener("touchmove",ue),C.removeEventListener("touchend",me)}}C.addEventListener("mousemove",ue),C.addEventListener("mouseup",me),C.addEventListener("touchmove",ue),C.addEventListener("touchend",me)}function x9(e,{handle:t,connectionMode:n,fromNodeId:s,fromHandleId:i,fromType:r,doc:a,lib:l,flowId:c,isValidConnection:u=y9,nodeLookup:d}){const f=r==="target",h=t?a.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:p,y:m}=Na(e),b=a.elementFromPoint(p,m),v=b!=null&&b.classList.contains(`${l}-flow__handle`)?b:h,y={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const x=b9(void 0,v),E=v.getAttribute("data-nodeid"),w=v.getAttribute("data-handleid"),_=v.classList.contains("connectable"),S=v.classList.contains("connectableend");if(!E||!x)return y;const k={source:f?E:s,sourceHandle:f?w:i,target:f?s:E,targetHandle:f?i:w};y.connection=k;const C=_&&S&&(n===xf.Strict?f&&x==="source"||!f&&x==="target":E!==s||w!==i);y.isValid=C&&u(k),y.toHandle=g9(E,x,w,d,n,!0)}return y}const O_={onPointerDown:uae,isValid:x9};function dae({domNode:e,panZoom:t,getTransform:n,getViewScale:s}){const i=vr(e);function r({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const m=E=>{if(E.sourceEvent.type!=="wheel"||!t)return;const w=n(),_=E.sourceEvent.ctrlKey&&jm()?10:1,S=-E.sourceEvent.deltaY*(E.sourceEvent.deltaMode===1?.05:E.sourceEvent.deltaMode?1:.002)*d,k=w[2]*Math.pow(2,S*_);t.scaleTo(k)};let b=[0,0];const v=E=>{(E.sourceEvent.type==="mousedown"||E.sourceEvent.type==="touchstart")&&(b=[E.sourceEvent.clientX??E.sourceEvent.touches[0].clientX,E.sourceEvent.clientY??E.sourceEvent.touches[0].clientY])},y=E=>{const w=n();if(E.sourceEvent.type!=="mousemove"&&E.sourceEvent.type!=="touchmove"||!t)return;const _=[E.sourceEvent.clientX??E.sourceEvent.touches[0].clientX,E.sourceEvent.clientY??E.sourceEvent.touches[0].clientY],S=[_[0]-b[0],_[1]-b[1]];b=_;const k=s()*Math.max(w[2],Math.log(w[2]))*(p?-1:1),T={x:w[0]-S[0]*k,y:w[1]-S[1]*k},C=[[0,0],[c,u]];t.setViewportConstrained({x:T.x,y:T.y,zoom:w[2]},C,l)},x=Y8().on("start",v).on("zoom",f?y:null).on("zoom.wheel",h?m:null);i.call(x,{})}function a(){i.on("zoom",null)}return{update:r,destroy:a,pointer:ya}}const m1=e=>({x:e.x,y:e.y,zoom:e.k}),Bv=({x:e,y:t,zoom:n})=>f1.translate(e,t).scale(n),Cd=(e,t)=>e.target.closest(`.${t}`),E9=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),fae=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Uv=(e,t=0,n=fae,s=()=>{})=>{const i=typeof t=="number"&&t>0;return i||s(),i?e.transition().duration(t).ease(n).on("end",s):e},v9=e=>{const t=e.ctrlKey&&jm()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function hae({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:s,panOnScrollMode:i,panOnScrollSpeed:r,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Cd(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const v=ya(d),y=v9(d),x=f*Math.pow(2,y);s.scaleTo(n,x,v,d);return}const h=d.deltaMode===1?20:1;let p=i===Xc.Vertical?0:d.deltaX*h,m=i===Xc.Horizontal?0:d.deltaY*h;!jm()&&d.shiftKey&&i!==Xc.Vertical&&(p=d.deltaY*h,m=0),s.translateBy(n,-(p/f)*r,-(m/f)*r,{internal:!0});const b=m1(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(d,b))}}function pae({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(s,i){const r=s.type==="wheel",a=!t&&r&&!s.ctrlKey,l=Cd(s,e);if(s.ctrlKey&&r&&l&&s.preventDefault(),a||l)return null;s.preventDefault(),n.call(this,s,i)}}function mae({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return s=>{var r,a,l;if((r=s.sourceEvent)!=null&&r.internal)return;const i=m1(s.transform);e.mouseButton=((a=s.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((l=s.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(s.sourceEvent,i))}}function gae({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:s,onPanZoom:i}){return r=>{var a,l;e.usedRightMouseButton=!!(n&&E9(t,e.mouseButton??0)),(a=r.sourceEvent)!=null&&a.sync||s([r.transform.x,r.transform.y,r.transform.k]),i&&!((l=r.sourceEvent)!=null&&l.internal)&&(i==null||i(r.sourceEvent,m1(r.transform)))}}function bae({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:s,onPanZoomEnd:i,onPaneContextMenu:r}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,r&&E9(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&r(a.sourceEvent),e.usedRightMouseButton=!1,s(!1),i)){const c=m1(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(a.sourceEvent,c)},n?150:0)}}}function yae({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:s,panOnScroll:i,zoomOnDoubleClick:r,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var v;const h=e||t,p=n&&f.ctrlKey,m=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Cd(f,`${u}-flow__node`)||Cd(f,`${u}-flow__edge`)))return!0;if(!s&&!h&&!i&&!r&&!n||a||d&&!m||Cd(f,l)&&m||Cd(f,c)&&(!m||i&&m&&!e)||!n&&f.ctrlKey&&m)return!1;if(!n&&f.type==="touchstart"&&((v=f.touches)==null?void 0:v.length)>1)return f.preventDefault(),!1;if(!h&&!i&&!p&&m||!s&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(s)&&!s.includes(f.button)&&f.type==="mousedown")return!1;const b=Array.isArray(s)&&s.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||m)&&b}}function xae({domNode:e,minZoom:t,maxZoom:n,translateExtent:s,viewport:i,onPanZoom:r,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=Y8().scaleExtent([t,n]).translateExtent(s),h=vr(e).call(f);x({x:i.x,y:i.y,zoom:vf(i.zoom,t,n)},[[0,0],[d.width,d.height]],s);const p=h.on("wheel.zoom"),m=h.on("dblclick.zoom");f.wheelDelta(v9);async function b(j,L){return h?new Promise(z=>{f==null||f.interpolate((L==null?void 0:L.interpolate)==="linear"?Fp:Pb).transform(Uv(h,L==null?void 0:L.duration,L==null?void 0:L.ease,()=>z(!0)),j)}):!1}function v({noWheelClassName:j,noPanClassName:L,onPaneContextMenu:z,userSelectionActive:D,panOnScroll:F,panOnDrag:A,panOnScrollMode:O,panOnScrollSpeed:P,preventScrolling:$,zoomOnPinch:R,zoomOnScroll:Y,zoomOnDoubleClick:J,zoomActivationKeyPressed:U,lib:te,onTransformChange:K,connectionInProgress:V,paneClickDistance:W,selectionOnDrag:q}){D&&!u.isZoomingOrPanning&&y();const ue=F&&!U&&!D;f.clickDistance(q?1/0:!_a(W)||W<0?0:W);const me=ue?hae({zoomPanValues:u,noWheelClassName:j,d3Selection:h,d3Zoom:f,panOnScrollMode:O,panOnScrollSpeed:P,zoomOnPinch:R,onPanZoomStart:a,onPanZoom:r,onPanZoomEnd:l}):pae({noWheelClassName:j,preventScrolling:$,d3ZoomHandler:p});h.on("wheel.zoom",me,{passive:!1});const Se=mae({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",Se);const de=gae({zoomPanValues:u,panOnDrag:A,onPaneContextMenu:!!z,onPanZoom:r,onTransformChange:K});f.on("zoom",de);const ge=bae({zoomPanValues:u,panOnDrag:A,panOnScroll:F,onPaneContextMenu:z,onPanZoomEnd:l,onDraggingChange:c});f.on("end",ge);const Me=yae({zoomActivationKeyPressed:U,panOnDrag:A,zoomOnScroll:Y,panOnScroll:F,zoomOnDoubleClick:J,zoomOnPinch:R,userSelectionActive:D,noPanClassName:L,noWheelClassName:j,lib:te,connectionInProgress:V});f.filter(Me),J?h.on("dblclick.zoom",m):h.on("dblclick.zoom",null)}function y(){f.on("zoom",null)}async function x(j,L,z){const D=Bv(j),F=f==null?void 0:f.constrain()(D,L,z);return F&&await b(F),F}async function E(j,L){const z=Bv(j);return await b(z,L),z}function w(j){if(h){const L=Bv(j),z=h.property("__zoom");(z.k!==j.zoom||z.x!==j.x||z.y!==j.y)&&(f==null||f.transform(h,L,null,{sync:!0}))}}function _(){const j=h?q8(h.node()):{x:0,y:0,k:1};return{x:j.x,y:j.y,zoom:j.k}}async function S(j,L){return h?new Promise(z=>{f==null||f.interpolate((L==null?void 0:L.interpolate)==="linear"?Fp:Pb).scaleTo(Uv(h,L==null?void 0:L.duration,L==null?void 0:L.ease,()=>z(!0)),j)}):!1}async function k(j,L){return h?new Promise(z=>{f==null||f.interpolate((L==null?void 0:L.interpolate)==="linear"?Fp:Pb).scaleBy(Uv(h,L==null?void 0:L.duration,L==null?void 0:L.ease,()=>z(!0)),j)}):!1}function T(j){f==null||f.scaleExtent(j)}function C(j){f==null||f.translateExtent(j)}function I(j){const L=!_a(j)||j<0?0:j;f==null||f.clickDistance(L)}return{update:v,destroy:y,setViewport:E,setViewportConstrained:x,getViewport:_,scaleTo:S,scaleBy:k,setScaleExtent:T,setTranslateExtent:C,syncViewport:w,setClickDistance:I}}var _f;(function(e){e.Line="line",e.Handle="handle"})(_f||(_f={}));function Eae({width:e,prevWidth:t,height:n,prevHeight:s,affectsX:i,affectsY:r}){const a=e-t,l=n-s,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&i&&(c[0]=c[0]*-1),l&&r&&(c[1]=c[1]*-1),c}function uO(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),s=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:s,affectsY:i}}function cl(e,t){return Math.max(0,t-e)}function ul(e,t){return Math.max(0,e-t)}function B0(e,t,n){return Math.max(0,t-e,e-n)}function dO(e,t){return e?!t:t}function vae(e,t,n,s,i,r,a,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:m}=n,{minWidth:b,maxWidth:v,minHeight:y,maxHeight:x}=s,{x:E,y:w,width:_,height:S,aspectRatio:k}=e;let T=Math.floor(d?p-e.pointerX:0),C=Math.floor(f?m-e.pointerY:0);const I=_+(c?-T:T),j=S+(u?-C:C),L=-r[0]*_,z=-r[1]*S;let D=B0(I,b,v),F=B0(j,y,x);if(a){let P=0,$=0;c&&T<0?P=cl(E+T+L,a[0][0]):!c&&T>0&&(P=ul(E+I+L,a[1][0])),u&&C<0?$=cl(w+C+z,a[0][1]):!u&&C>0&&($=ul(w+j+z,a[1][1])),D=Math.max(D,P),F=Math.max(F,$)}if(l){let P=0,$=0;c&&T>0?P=ul(E+T,l[0][0]):!c&&T<0&&(P=cl(E+I,l[1][0])),u&&C>0?$=ul(w+C,l[0][1]):!u&&C<0&&($=cl(w+j,l[1][1])),D=Math.max(D,P),F=Math.max(F,$)}if(i){if(d){const P=B0(I/k,y,x)*k;if(D=Math.max(D,P),a){let $=0;!c&&!u||c&&!u&&h?$=ul(w+z+I/k,a[1][1])*k:$=cl(w+z+(c?T:-T)/k,a[0][1])*k,D=Math.max(D,$)}if(l){let $=0;!c&&!u||c&&!u&&h?$=cl(w+I/k,l[1][1])*k:$=ul(w+(c?T:-T)/k,l[0][1])*k,D=Math.max(D,$)}}if(f){const P=B0(j*k,b,v)/k;if(F=Math.max(F,P),a){let $=0;!c&&!u||u&&!c&&h?$=ul(E+j*k+L,a[1][0])/k:$=cl(E+(u?C:-C)*k+L,a[0][0])/k,F=Math.max(F,$)}if(l){let $=0;!c&&!u||u&&!c&&h?$=cl(E+j*k,l[1][0])/k:$=ul(E+(u?C:-C)*k,l[0][0])/k,F=Math.max(F,$)}}}C=C+(C<0?F:-F),T=T+(T<0?D:-D),i&&(h?I>j*k?C=(dO(c,u)?-T:T)/k:T=(dO(c,u)?-C:C)*k:d?(C=T/k,u=c):(T=C*k,c=u));const A=c?E+T:E,O=u?w+C:w;return{width:_+(c?-T:T),height:S+(u?-C:C),x:r[0]*T*(c?-1:1)+A,y:r[1]*C*(u?-1:1)+O}}const w9={width:0,height:0,x:0,y:0},wae={...w9,pointerX:0,pointerY:0,aspectRatio:1};function Sae(e,t,n){const s=t.position.x+e.position.x,i=t.position.y+e.position.y,r=e.measured.width??0,a=e.measured.height??0,l=n[0]*r,c=n[1]*a;return[[s-l,i-c],[s+r-l,i+a-c]]}function _ae({domNode:e,nodeId:t,getStoreItems:n,onChange:s,onEnd:i}){const r=vr(e);let a={controlDirection:uO("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:m,onResizeEnd:b,shouldResize:v}){let y={...w9},x={...wae};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:uO(u)};let E,w=null,_=[],S,k,T,C=!1;const I=O8().on("start",j=>{const{nodeLookup:L,transform:z,snapGrid:D,snapToGrid:F,nodeOrigin:A,paneDomNode:O}=n();if(E=L.get(t),!E)return;w=(O==null?void 0:O.getBoundingClientRect())??null;const{xSnapped:P,ySnapped:$}=$p(j.sourceEvent,{transform:z,snapGrid:D,snapToGrid:F,containerBounds:w});y={width:E.measured.width??0,height:E.measured.height??0,x:E.position.x??0,y:E.position.y??0},x={...y,pointerX:P,pointerY:$,aspectRatio:y.width/y.height},S=void 0,k=uu(E.extent)?E.extent:void 0,E.parentId&&(E.extent==="parent"||E.expandParent)&&(S=L.get(E.parentId)),S&&E.extent==="parent"&&(k=[[0,0],[S.measured.width,S.measured.height]]),_=[],T=void 0;for(const[R,Y]of L)if(Y.parentId===t&&(_.push({id:R,position:{...Y.position},extent:Y.extent}),Y.extent==="parent"||Y.expandParent)){const J=Sae(Y,E,Y.origin??A);T?T=[[Math.min(J[0][0],T[0][0]),Math.min(J[0][1],T[0][1])],[Math.max(J[1][0],T[1][0]),Math.max(J[1][1],T[1][1])]]:T=J}p==null||p(j,{...y})}).on("drag",j=>{const{transform:L,snapGrid:z,snapToGrid:D,nodeOrigin:F}=n(),A=$p(j.sourceEvent,{transform:L,snapGrid:z,snapToGrid:D,containerBounds:w}),O=[];if(!E)return;const{x:P,y:$,width:R,height:Y}=y,J={},U=E.origin??F,{width:te,height:K,x:V,y:W}=vae(x,a.controlDirection,A,a.boundaries,a.keepAspectRatio,U,k,T),q=te!==R,ue=K!==Y,me=V!==P&&q,Se=W!==$&&ue;if(!me&&!Se&&!q&&!ue)return;if((me||Se||U[0]===1||U[1]===1)&&(J.x=me?V:y.x,J.y=Se?W:y.y,y.x=J.x,y.y=J.y,_.length>0)){const ve=V-P,re=W-$;for(const ke of _)ke.position={x:ke.position.x-ve+U[0]*(te-R),y:ke.position.y-re+U[1]*(K-Y)},O.push(ke)}if((q||ue)&&(J.width=q&&(!a.resizeDirection||a.resizeDirection==="horizontal")?te:y.width,J.height=ue&&(!a.resizeDirection||a.resizeDirection==="vertical")?K:y.height,y.width=J.width,y.height=J.height),S&&E.expandParent){const ve=U[0]*(J.width??0);J.x&&J.x{C&&(b==null||b(j,{...y}),i==null||i({...y}),C=!1)});r.call(I)}function c(){r.on(".drag",null)}return{update:l,destroy:c}}var S9={exports:{}},_9={},N9={exports:{}},T9={};/** +${kR}`:t:t}async function*Mk(e){if(!e.body)throw new Error("Response has no body");const t=e.body.getReader(),n=new TextDecoder;let s="";try{for(;;){const{done:i,value:r}=await t.read();if(i)break;s+=n.decode(r,{stream:!0});let a=s.match(/\r?\n\r?\n/);for(;(a==null?void 0:a.index)!==void 0;){const l=s.slice(0,a.index);s=s.slice(a.index+a[0].length);const c=l.split(/\r?\n/).filter(u=>u.startsWith("data:")).map(u=>u.slice(5).trimStart()).join(` +`);if(c)try{yield JSON.parse(c)}catch{c!=="[DONE]"&&c!=="ping"&&console.debug(`parseSSE: dropping unparseable frame (${c.length} chars):`,c.slice(0,200))}a=s.match(/\r?\n\r?\n/)}}}finally{try{await t.cancel()}catch{}finally{t.releaseLock()}}}const nte=255,ste=/[\p{L}\p{M}\p{N}\p{P}\p{Zs}]/u;function ite(e){const t=e.normalize("NFKC").replace(/\s+/gu," ").trim(),n=new TextEncoder;let s=0,i="";for(const r of t){if(!ste.test(r))continue;const a=n.encode(r).byteLength;if(s+a>nte)break;i+=r,s+=a}return i.replace(/ +/g," ").trimEnd()}const Lk="veadk.messageFeedback.v1";function Dk(e,t,n,s){return[e,t,n,s].join(":")}function Pk(){if(typeof window>"u")return{};try{const e=JSON.parse(localStorage.getItem(Lk)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function rte(e,t,n){if(typeof window>"u")return;const s=Pk();s[e]={...s[e]??{},[`veadk_feedback:${t}`]:n},localStorage.setItem(Lk,JSON.stringify(s))}function TB(e){if(typeof window>"u")return;const t=Dk(e.runtimeId,e.appName,e.userId,e.sessionId),n=Pk(),s=n[t];if(s){for(const i of e.eventIds)delete s[`veadk_feedback:${i}`];Object.keys(s).length===0?delete n[t]:n[t]=s,localStorage.setItem(Lk,JSON.stringify(n))}}const Ob="",Bk=new Map;function kB(e,t){Bk.set(e,t)}function AB(){Bk.clear()}function Qs(e){const t=Bk.get(e);return t?{app:t.app,ep:{base:t.base,apiKey:t.apiKey,runtimeId:t.runtimeId,region:t.region}}:{app:e,ep:{}}}async function pt(e,t={},n={},s=uc){const i=!!n.runtimeId&&String(t.method??"GET").toUpperCase()==="DELETE",r={...t,...i?{method:"POST"}:{},headers:s1(t.headers)},a=()=>{const u={...r,signal:Pn(t.signal,s)};if(n.runtimeId){const d=new URLSearchParams;n.region&&d.set("region",n.region),n.retryProbe&&d.set("probe_retry","connect"),i&&d.set("_method","DELETE");const f=d.toString()?`${e.includes("?")?"&":"?"}${d.toString()}`:"";return fetch(Cn(`${Ob}/web/runtime-proxy/${n.runtimeId}${e}${f}`),u)}if(n.base){const d=new Headers(u.headers);return d.set("X-AgentKit-Base",n.base),n.apiKey&&d.set("X-AgentKit-Key",n.apiKey),fetch(Cn(`${Ob}/agentkit-proxy${e}`),{...u,headers:d})}return fetch(Cn(`${Ob}${e}`),u)},l=async u=>{if(Yee(u))return!0;if(u.status!==401)return!1;try{return await Vee()}catch{return!1}};let c=await a();for(;await l(c);)await Wee(t.signal),c=await a();return c}function CB(e,t={},n=uc){return pt(e,t,{},n)}function ate(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>{var n;if(t&&typeof t=="object"&&"msg"in t){const s=Array.isArray(t.loc)?(n=t.loc)==null?void 0:n.join("."):"",i=String(t.msg??"");return s?`${s}: ${i}`:i}return String(t)}).filter(Boolean).join(` +`):e&&typeof e=="object"?JSON.stringify(e):""}async function Kt(e,t){const n=await e.text().catch(()=>"");if(!n)return`${t} (${e.status})`;try{const s=JSON.parse(n);return ate(s.detail??s.error)||n||`${t} (${e.status})`}catch{return n||`${t} (${e.status})`}}async function IB(){const e=await pt("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class Xf extends Error{constructor(){super("当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。"),this.name="RuntimeAccessDeniedError"}}class Sr extends Error{constructor(t,n=!1){super(t),this.unsupported=n,this.name="RuntimeProbeError"}}const jB="Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime。请使用已绑定相同 VPC 的 Studio 访问,或改用公网 / 公网+VPC 部署。",RB="Runtime 已部署成功,但 Studio 暂时无法连接服务。网关域名可能仍在生效,或当前网络/DNS 无法访问该 Runtime,请稍后在智能体管理页重试连接。",ote=["cn-beijing","cn-shanghai"],lte=3e4,r1=5*60*1e3,OB=60*1e3,Mb=new Map,Cc=new Map,Ic=new Map,ya=new Map;function MB(e,t){return`${t}:${e}`}function Qf(e){const t=e||"cn-beijing";return[t,...ote.filter(n=>n!==t)]}function Zf(...e){return e.map(t=>String(t??"")).join("")}function Jf(e,t,n){const s=e.get(t);return s!=null&&s.value&&Date.now()-s.updatedAt<=n?s.value:null}function Uk(e,t,n){return e.set(t,{value:n,updatedAt:Date.now()}),n}async function LB(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function a1(e,t,n){const s=await pt("/list-apps",{},n??{base:e,apiKey:t}),i=n!=null&&n.runtimeId?await LB(s):"";if(n!=null&&n.runtimeId&&i==="runtime_access_denied")throw new Xf;if(n!=null&&n.runtimeId&&i==="runtime_private_endpoint_unreachable")throw new Sr(jB);if(n!=null&&n.runtimeId&&["runtime_proxy_connect_error","runtime_proxy_timeout","runtime_json_connect_error","runtime_json_timeout"].includes(i))throw new Sr(RB);if(n!=null&&n.runtimeId&&s.status===404)throw new Sr("该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",!0);if(n!=null&&n.runtimeId&&(s.status===401||s.status===403))throw new Sr("Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。");if(!s.ok)throw new Error(await Kt(s,"读取 Agent 列表失败"));const r=await s.json();return n!=null&&n.runtimeId&&Mb.set(MB(n.runtimeId,n.region??""),{apps:r,expiresAt:Date.now()+lte}),r}async function zy(e,t){const{app:n,ep:s}=Qs(e),i=await pt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},s);if(!i.ok){const a=`创建会话失败 (${i.status})`,l=await Kt(i,"创建会话失败");throw new Error(l===a?a:`${a}:${l}`)}return(await i.json()).id}async function Fk(e,t){const{app:n,ep:s}=Qs(e),i=await pt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{},s);if(!i.ok)throw new Error(`list sessions failed: ${i.status}`);return i.json()}async function Vy(e,t,n){const{app:s,ep:i}=Qs(e),r=await pt(`/apps/${s}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}`,{},i);if(!r.ok){const l=await Kt(r,"读取会话失败");throw new Error(`get session failed: ${r.status}:${l}`)}const a=await r.json();if(i.runtimeId){const l=Dk(i.runtimeId,s,t,n);a.state={...Pk()[l]??{},...a.state??{}}}return a}async function DB(e){const{app:t,ep:n}=Qs(e.appName);if(!n.runtimeId)throw new Error("只有连接到 AgentKit Runtime 的会话支持反馈回流");if(!n.region)throw new Error("Runtime 缺少地域信息,无法提交反馈");const s=await pt("/web/evaluation/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:n.runtimeId,region:n.region,appName:t,userId:e.userId,sessionId:e.sessionId,eventId:e.eventId,rating:e.rating,comment:e.comment??""})},{},cg);if(!s.ok)throw new Error(await Kt(s,"提交反馈失败"));const i=await s.json(),r=Dk(n.runtimeId,t,e.userId,e.sessionId);return rte(r,e.eventId,i),i}async function o1(e,t={}){const n=Zf(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),s=Jf(ya,n,OB);if(!t.force&&s)return s;const i=ya.get(n);if(!t.force&&(i!=null&&i.promise))return i.promise;let r=null;const a=(async()=>{for(const l of Qf(e.region)){const c=new URLSearchParams({runtimeId:e.runtimeId,region:l,appName:e.appName,page_size:String(e.pageSize??100)}),u=await pt(`/web/evaluation/feedback-cases?${c.toString()}`);if(u.ok)return Uk(ya,n,await u.json());r=new Error(await Kt(u,"读取评测集失败"))}throw r??new Error("读取评测集失败")})();ya.set(n,{...i,promise:a,updatedAt:(i==null?void 0:i.updatedAt)??0});try{return await a}finally{const l=ya.get(n);(l==null?void 0:l.promise)===a&&ya.set(n,{value:l.value,updatedAt:l.updatedAt})}}async function PB(e){let t=null;for(const n of Qf(e.region)){const s=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName,userId:e.userId}),i=await pt(`/web/evaluation/statuses?${s.toString()}`);if(i.ok)return i.json();t=new Error(await Kt(i,"读取自动评测状态失败"))}throw t??new Error("读取自动评测状态失败")}async function BB(e){let t=null;for(const n of Qf(e.region)){const s=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName}),i=await pt(`/web/evaluation/optimizations?${s.toString()}`);if(i.ok)return i.json();t=new Error(await Kt(i,"读取优化项失败"))}throw t??new Error("读取优化项失败")}function UB(e){return Jf(ya,Zf(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),OB)}function b_(e){o1(e).catch(()=>{})}function FB(e){o1(e,{force:!0}).catch(()=>{})}function $B(e,t){return["good","bad"].map(n=>{const s=e.find(i=>i.kind===n);return{kind:n,evaluationSetId:(s==null?void 0:s.evaluationSetId)??null,evaluationSetName:(s==null?void 0:s.evaluationSetName)??null,workspaceId:(s==null?void 0:s.workspaceId)??null,itemCount:t.filter(i=>i.kind===n).length}})}function Lb(e){for(const[t,n]of ya.entries()){const s=n.value;if(!s||s.runtimeId!==e.runtimeId||s.agentName!==e.appName)continue;const i=s.items.filter(a=>a.sessionId!==e.sessionId||a.messageId!==e.messageId),r=e.rating?[{id:`local:${e.runtimeId}:${e.sessionId}:${e.messageId}`,itemKey:`local:${e.messageId}`,kind:e.rating,input:e.input,output:e.output,referenceOutput:e.referenceOutput??e.output,comment:"",agentName:e.appName,sessionId:e.sessionId,messageId:e.messageId,runtimeId:e.runtimeId,invocationId:e.invocationId??"",userId:e.userId,createdAt:e.createdAt??new Date().toISOString(),evaluationSetId:"",evaluationSetName:"",workspaceId:""},...i]:i;ya.set(t,{value:{...s,sets:$B(s.sets,r),items:r},updatedAt:Date.now(),promise:n.promise})}}async function HB(e){let t=null;for(const n of Qf(e.region)){const s=await pt("/web/evaluation/feedback-cases/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e.runtimeId,region:n,appName:e.appName,itemIds:e.itemIds})},{},cg);if(s.ok){const i=await s.json(),r=new Set(e.itemIds);for(const[a,l]of ya.entries()){const c=l.value;if(!c||c.runtimeId!==e.runtimeId||c.agentName!==e.appName)continue;const u=c.items.filter(d=>!r.has(d.id));ya.set(a,{value:{...c,sets:$B(c.sets,u),items:u},updatedAt:Date.now()})}return i}t=new Error(await Kt(s,"删除评测案例失败"))}throw t??new Error("删除评测案例失败")}async function y_(e,t,n){const{app:s,ep:i}=Qs(e),r=await pt(`/apps/${s}/users/${encodeURIComponent(t)}/sessions/${n}`,{method:"DELETE"},i);if(!r.ok&&r.status!==404)throw new Error(`delete session failed: ${r.status}`)}function cte(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"="),s=window.atob(n),i=new Uint8Array(s.length);for(let r=0;rURL.revokeObjectURL(l),0)}async function VB(e,t,n,s,i){const{app:r,ep:a}=Qs(e),l=i==null?"":`?version=${encodeURIComponent(i)}`,c=`/apps/${encodeURIComponent(r)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/artifacts/${encodeURIComponent(s)}${l}`,u=await pt(c,{},a,cg);if(!u.ok)throw new Error(await Kt(u,"下载文件失败"));const d=await u.json(),f=d.inlineData??d.inline_data;if(!(f!=null&&f.data))throw new Error("文件内容不可用");const h=cte(f.data),p=h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength);return{blob:new Blob([p],{type:f.mimeType??f.mime_type??"application/octet-stream"}),downloadName:f.displayName??f.display_name??s}}async function GB(e,t,n,s,i){const{blob:r}=await VB(e,t,n,s,i);return URL.createObjectURL(r)}async function ute(e){const t=await pt("/web/media/capabilities");if(!t.ok)throw new Error(await Kt(t,"media capabilities failed"));return t.json()}async function KB(e,t,n,s){const{app:i}=Qs(e),r=new FormData;r.set("app_name",i),r.set("user_id",t),r.set("session_id",n),r.set("file",s);const a=await pt("/web/media",{method:"POST",body:r},{},cg);if(!a.ok)throw new Error(await Kt(a,"文件上传失败"));return{...await a.json(),status:"ready"}}async function x_(e,t,n){const{app:s}=Qs(e),i=`/web/media/${encodeURIComponent(s)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}/delete`,r=await pt(i,{method:"POST"});if(!r.ok&&r.status!==404)throw new Error(await Kt(r,"media cleanup failed"))}function qB(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((s,i)=>![1,3,5].includes(i)).join("/")}`}catch{return}}async function Db(e,t){const n=qB(t);if(!n)throw new Error("Invalid VeADK media URI");const s=await pt(`${n}/delete`,{method:"POST"});if(!s.ok&&s.status!==404)throw new Error(await Kt(s,"media cleanup failed"))}function YB(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=qB(t);if(!n)return t;const s=`${n}/content`;return Cn(`${Ob}${s}`)}async function Gy(e,t,n){const{app:s,ep:i}=Qs(e);let r;if(i.runtimeId){const c=new URLSearchParams({runtimeId:i.runtimeId,sessionId:t,region:i.region??"cn-beijing"});if(n&&c.set("endTimeMs",String(Math.round(n))),r=await pt(`/web/runtime-trace?${c.toString()}`),r.status===404)throw new Error("该 Agent 暂未开启链路观测,请到控制台打开后使用。")}else r=await pt(`/dev/apps/${encodeURIComponent(s)}/debug/trace/session/${encodeURIComponent(t)}`,{},i);if(!r.ok)throw new Error(await Kt(r,"加载调用链路失败"));const a=r.headers.get("content-type")??"";if(!a.includes("application/json")){const c=a.split(";",1)[0]||"Content-Type 缺失";throw new Error(`trace failed: 服务端返回了非 JSON 响应(${c}),请检查 Studio API 代理配置`)}const l=await r.json();if(!Array.isArray(l))throw new Error("trace failed: 返回格式无效");return l}async function E_(e){const t=await pt("/web/issue-feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await Kt(t,"问题反馈上报失败"));if((await t.json()).submitted!==!0)throw new Error("问题反馈上报失败:服务端未确认提交结果");return{submitted:!0}}function $k(e){const t=n=>({id:String(n.id??""),kind:n.kind==="skill"?"skill":"tool",name:String(n.name??""),custom:n.custom===!0,description:typeof n.description=="string"?n.description:void 0,skillSourceId:typeof n.skill_source_id=="string"?n.skill_source_id:void 0,version:typeof n.version=="string"?n.version:void 0});return{schemaVersion:Number(e.schema_version??1),revision:Number(e.revision??0),tools:Array.isArray(e.tools)?e.tools.map(n=>t(n)):[],skills:Array.isArray(e.skills)?e.skills.map(n=>t(n)):[]}}function Hk(e,t,n){return`/harness/apps/${encodeURIComponent(e)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/capabilities`}async function v_(e,t,n){const{app:s,ep:i}=Qs(e),r=await pt(Hk(s,t,n),{},i);if(!r.ok)throw new Error(await Kt(r,"读取会话能力失败"));return $k(await r.json())}async function zk(e){const{ep:t}=Qs(e),n=await pt("/harness/capabilities/tools",{},t);if(!n.ok)throw new Error(await Kt(n,"读取内置工具失败"));return((await n.json()).tools??[]).map(i=>{var r;return((r=i.name)==null?void 0:r.trim())??""}).filter(Boolean)}async function dte(e){const{ep:t}=Qs(e),n=await pt("/harness/skills/spaces?region=all",{},t);if(!n.ok)throw new Error(await Kt(n,"读取 Skill Space 失败"));return(await n.json()).items??[]}async function fte(e,t,n){const{ep:s}=Qs(e),i=new URLSearchParams({region:n||"cn-beijing"}),r=`/harness/skills/spaces/${encodeURIComponent(t)}/skills?${i.toString()}`,a=await pt(r,{},s);if(!a.ok)throw new Error(await Kt(a,"读取 Skill 列表失败"));return(await a.json()).items??[]}async function WB(e,t,n=1,s=20){const{ep:i}=Qs(e),r=new URLSearchParams({query:t,page_number:String(n),page_size:String(s)}),a=await pt(`/harness/skills/findskill?${r.toString()}`,{},i);if(!a.ok)throw new Error(await Kt(a,"搜索 Skill Hub 失败"));const l=await a.json();return{items:l.items??[],totalCount:Number(l.totalCount??0)}}async function w_(e,t,n,s,i){const{app:r,ep:a}=Qs(e),l=await pt(Hk(r,t,n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:s.kind,name:s.name,skill_source_id:s.skillSourceId,description:s.description,version:s.version,expected_revision:i})},a);if(!l.ok)throw new Error(await Kt(l,"添加会话能力失败"));return $k(await l.json())}async function XB(e,t,n,s,i){const{app:r,ep:a}=Qs(e),l=`${Hk(r,t,n)}/${encodeURIComponent(s)}?expected_revision=${i}`,c=await pt(l,{method:"DELETE"},a);if(!c.ok)throw new Error(await Kt(c,"移除会话能力失败"));return $k(await c.json())}async function QB(e,t,n=!0){const s=await pt(`/web/agent-info/${e}`,{},t);if(!s.ok)throw new Error(`agent-info failed: ${s.status}`);const i=await s.json();if(n&&!i.draft)try{const r=await pt(`/web/agent-draft/${e}`,{},t);if(r.ok){const a=await r.json();i.draft=a.draft}}catch{}return{appName:e,name:i.name??e,description:i.description??"",type:i.type,model:i.model??"",tools:i.tools??[],skillsPreviewSupported:Array.isArray(i.skills),skills:i.skills??[],subAgents:i.subAgents??[],components:i.components??[],searchSources:i.searchSources??[],graph:i.graph,draft:i.draft}}async function Vk(e){const{app:t,ep:n}=Qs(e);return QB(t,n,!1)}async function hte(e,t,n){let s=null;for(const i of Qf(t)){const r={runtimeId:e,region:i};try{const a=MB(e,i),l=Mb.get(a);l&&l.expiresAt<=Date.now()&&Mb.delete(a);const c=Mb.get(a),u=n||(c==null?void 0:c.apps[0])||(await a1("","",r))[0];if(!u)throw new Error("该 Runtime 未提供可预览的 Agent。");return QB(u,r)}catch(a){if(a instanceof Xf||a instanceof Sr&&!a.unsupported)throw a;s=a instanceof Error?a:new Error(String(a))}}throw s??new Error("该 Runtime 未提供可预览的 Agent。")}async function Ky(e,t,n={},s={}){const i=typeof n=="string"?n:void 0,r=typeof n=="string"?s:n,a=Zf(e,t||"cn-beijing",i??""),l=Jf(Cc,a,r1);if(!r.force&&l)return l;const c=Cc.get(a);if(!r.force&&(c!=null&&c.promise))return c.promise;const u=hte(e,t,i).then(d=>Uk(Cc,a,d));Cc.set(a,{...c,promise:u,updatedAt:(c==null?void 0:c.updatedAt)??0});try{return await u}finally{const d=Cc.get(a);(d==null?void 0:d.promise)===u&&Cc.set(a,{value:d.value,updatedAt:d.updatedAt})}}function ZB(e,t,n=""){return Jf(Cc,Zf(e,t||"cn-beijing",n),r1)}function JB(e,t,n=""){Ky(e,t,n).catch(()=>{})}async function e8(e,t,n,s){const{app:i,ep:r}=Qs(e),a=new URLSearchParams({source:t,app_name:i,q:n,user_id:s}),l=await pt(`/web/search?${a.toString()}`,{},r);if(!l.ok)throw new Error(await Kt(l,"Agent 检索失败"));return l.json()}async function t8(e,t){const{app:n}=Qs(e),s=await pt(`/web/search?source=web&app_name=${encodeURIComponent(n)}&q=${encodeURIComponent(t)}`);if(!s.ok)throw new Error(`web search failed: ${s.status}`);return s.json()}async function*vm({appName:e,userId:t,sessionId:n,text:s,attachments:i=[],invocation:r,functionResponses:a=[],signal:l,sessionCapabilities:c=!1}){const{app:u,ep:d}=Qs(e),f=i.flatMap(b=>b.status&&b.status!=="ready"?[]:b.uri?[{fileData:{mimeType:b.mimeType,fileUri:b.uri,displayName:b.name},partMetadata:{veadkMedia:{id:b.id,uri:b.uri,name:b.name,mimeType:b.mimeType,sizeBytes:b.sizeBytes}}}]:b.data?[{inlineData:{mimeType:b.mimeType,data:b.data,displayName:b.name}}]:[]),h=r&&(r.skills.length>0||r.targetAgent)?r:void 0,p=[...f,...a.map(b=>({functionResponse:{id:b.id,name:b.name,response:b.response}})),...s.trim()?[{text:s}]:[]];if(h&&p.length>0){const b=p[0],v=b.partMetadata;p[0]={...b,partMetadata:{...v,veadkInvocation:h}}}const m=await pt(c?"/harness/run_sse":"/run_sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:u,user_id:t,session_id:n,new_message:{role:"user",parts:p},streaming:!0,custom_metadata:h?{veadkInvocation:h}:void 0}),signal:l},d,0);if(!m.ok){const b=await Kt(m,"运行会话失败");throw new Error(R0(`run_sse failed: ${m.status}:${b}`))}for await(const b of Mk(m)){const v=b;typeof v.error=="string"&&(v.error=R0(v.error)),typeof v.errorMessage=="string"&&(v.errorMessage=R0(v.errorMessage)),typeof v.error_message=="string"&&(v.error_message=R0(v.error_message)),yield v}}async function n8(e){const t=await pt("/web/identity/user-pools",{signal:e});if(!t.ok)throw new Error(await Kt(t,"加载用户池失败"));const n=await t.json();if(!Array.isArray(n.items))throw new Error("用户池列表响应格式无效");return n.items.map(s=>{if(!s||typeof s!="object"||typeof s.uid!="string"||typeof s.name!="string"||typeof s.domain!="string"||typeof s.region!="string"||typeof s.isCurrent!="boolean")throw new Error("用户池列表响应格式无效");return s})}const Bp=new Map;async function ug(e,t,n,s){var u,d,f;const i=s==null?void 0:s.taskId,r=i?new AbortController:void 0;i&&r&&Bp.set(i,r);const a=()=>{i&&Bp.get(i)===r&&Bp.delete(i)};let l;try{(u=s==null?void 0:s.onStage)==null||u.call(s,{level:"info",phase:"upload",message:"正在上传代码包",pct:0}),l=await pt("/web/deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},signal:r==null?void 0:r.signal,body:JSON.stringify({name:e,files:t,config:n,taskId:i,runtimeId:s==null?void 0:s.runtimeId,appName:s==null?void 0:s.appName,sessionStorage:s==null?void 0:s.sessionStorage,minInstance:s==null?void 0:s.minInstance,maxInstance:s==null?void 0:s.maxInstance,createEvaluationSets:s==null?void 0:s.createEvaluationSets,description:ite((s==null?void 0:s.description)??""),authentication:s==null?void 0:s.authentication,im:s==null?void 0:s.im,envs:s==null?void 0:s.envs})},{},0),(d=s==null?void 0:s.onStage)==null||d.call(s,{level:"success",phase:"upload",message:"代码包上传完成",pct:100})}catch(h){throw a(),h}if(!l.ok){const h=await Kt(l,"部署失败");throw a(),new Error(h)}let c=null;try{for await(const h of Mk(l)){const p=h;if(p&&p.done){c=p;break}p&&p.message&&((f=s==null?void 0:s.onStage)==null||f.call(s,p))}}catch(h){throw a(),h}if(a(),!c)throw new Error("部署失败:连接中断");if(!c.success)throw new Error(c.error||"部署失败");if(!c.agentName)throw new Error("部署失败:返回缺少 Agent 名称");if(!c.runtimeId&&!c.url)throw new Error("部署失败:返回缺少 AgentKit 连接信息");return{apikey:c.apikey??"",url:c.url??"",agentName:c.agentName,runtimeId:c.runtimeId,consoleUrl:c.consoleUrl,region:c.region,version:c.version,warnings:c.warnings,feishuChannel:c.feishuChannel}}async function s8(e){var n;const t=await pt("/web/cancel-deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:e})});if(!t.ok){const s=await t.text().catch(()=>"");throw new Error(s||`取消部署失败 (${t.status})`)}(n=Bp.get(e))==null||n.abort(),Bp.delete(e)}async function pte(e="cn-beijing"){const t=await pt(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`加载失败 (${t.status})`);return(await t.json()).runtimes??[]}const wm={title:"AgentKit Studio",logoUrl:""},Pb={enabled:!1},Mv={studio:!1,version:"",branding:wm,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local",telemetry:Pb};function mte(e){if(!e||typeof e!="object")return Pb;const t=e;if(!t.enabled)return Pb;const n=t.apmplus;if(!n||typeof n.aid!="number"||!Number.isFinite(n.aid)||typeof n.token!="string"||!n.token)return Pb;const s=t.studio??{};return{enabled:!0,provider:t.provider==="apmplus"?"apmplus":void 0,apmplus:{aid:n.aid,token:n.token,domain:typeof n.domain=="string"&&n.domain?n.domain:"apmplus.volces.com",env:typeof n.env=="string"&&n.env?n.env:"production"},studio:{deployId:typeof s.deployId=="string"?s.deployId:"",userPoolId:typeof s.userPoolId=="string"?s.userPoolId:"",applicationId:typeof s.applicationId=="string"?s.applicationId:"",functionId:typeof s.functionId=="string"?s.functionId:"",region:typeof s.region=="string"?s.region:"",project:typeof s.project=="string"?s.project:"",version:typeof s.version=="string"?s.version:""}}}async function i8(){var e,t;try{const n=await pt("/web/ui-config");if(!n.ok)return Mv;const s=await n.json(),i=typeof((e=s.branding)==null?void 0:e.logoUrl)=="string"?s.branding.logoUrl:wm.logoUrl;return{studio:s.studio??!1,version:typeof s.version=="string"?s.version:"",branding:{title:typeof((t=s.branding)==null?void 0:t.title)=="string"?s.branding.title:wm.title,logoUrl:i?Cn(i):""},features:{...Mv.features,...s.features??{}},defaultView:s.defaultView??"chat",agentsSource:s.agentsSource==="cloud"?"cloud":"local",telemetry:mte(s.telemetry)}}catch{return Mv}}const r8={role:"user",telemetry:{userId:""},capabilities:{createAgents:!1,manageAgents:!1,runtimeScope:"mine"}};async function a8(){var n,s,i,r;const e=await pt("/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.telemetry)==null?void 0:n.userId)!="string"||typeof((s=t.capabilities)==null?void 0:s.createAgents)!="boolean"||typeof((i=t.capabilities)==null?void 0:i.manageAgents)!="boolean"||!["all","mine"].includes((r=t.capabilities)==null?void 0:r.runtimeScope))throw new Error("权限服务返回了无法解析的响应");return t}async function o8(e,t){const n=new URLSearchParams;e&&n.set("targetVersion",e),t&&n.set("startedAt",String(t));const s=n.size?`?${n.toString()}`:"",i=await pt(`/web/studio-update${s}`);if(!i.ok)throw new Error(`检查 Studio 更新失败 (${i.status})`);return await i.json()}async function l8(e){const t=await pt("/web/studio-update",{method:"POST",headers:{"Content-Type":"application/json","X-VeADK-Studio-Update":"1"},body:JSON.stringify({version:e})},{},cg);if(!t.ok){let n="";try{const s=await t.json();n=typeof s.detail=="string"?s.detail:""}catch{n=""}throw new Error(n||`提交 Studio 更新失败 (${t.status})`)}return await t.json()}async function l1(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 pt(`/web/runtimes?${t.toString()}`);if(!n.ok){const i=await Kt(n,"加载 Runtime 失败"),r=`加载 Runtime 失败(HTTP ${n.status})`;throw new Error(i===`加载 Runtime 失败 (${n.status})`?r:`${r}:${i}`)}const s=await n.json();return{runtimes:s.runtimes??[],nextToken:s.nextToken??""}}async function Gk(e,t,n={}){try{const s={runtimeId:e,region:t};return n.retryProbe&&(s.retryProbe=!0),await a1("","",s)}catch(s){if(s instanceof Xf||s instanceof Sr)throw s;return null}}async function c8(e,t,n={}){const s={runtimeId:e,region:t};n.retryProbe&&(s.retryProbe=!0);const i=await pt("/.well-known/agent-card.json",{},s),r=await LB(i);if(r==="runtime_access_denied")throw new Xf;if(r==="runtime_private_endpoint_unreachable")throw new Sr(jB);if(["runtime_proxy_connect_error","runtime_proxy_timeout"].includes(r))throw new Sr(RB);if(i.status===404)return null;if(i.status===401||i.status===403)throw new Sr("Runtime 服务拒绝了 A2A 探测请求,请检查 Runtime 的鉴权配置。");if(!i.ok)throw new Error(await Kt(i,"读取 A2A Agent Card 失败"));const a=await i.json().catch(()=>null),l=typeof(a==null?void 0:a.url)=="string"?a.url.trim():"";return l?{name:typeof(a==null?void 0:a.name)=="string"?a.name:"",description:typeof(a==null?void 0:a.description)=="string"?a.description:"",endpoint:l}:null}async function u8(e,t){const n=new URLSearchParams({runtimeId:e,region:t}),s=await pt(`/web/runtime-api-key/reveal?${n.toString()}`,{method:"POST",cache:"no-store"});if(!s.ok)throw new Error(await Kt(s,"读取 Runtime API Key 失败"));const i=await s.json();if(typeof i.apiKey!="string"||!i.apiKey)throw new Error("Runtime 未返回可用的 API Key");return i.apiKey}async function d8(e,t){const n=await pt("/web/delete-runtime",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e,region:t})});if(!n.ok){const s=await n.text().catch(()=>"");throw new Error(s||`删除失败 (${n.status})`)}}async function f8({runtimeId:e,region:t,signal:n}){const s=new URLSearchParams({runtimeId:e,region:t}),i=await pt(`/web/runtime-update-capability?${s.toString()}`,{signal:n});if(!i.ok)throw new Error(await Kt(i,"检查 Runtime 更新能力失败"));return await i.json()}async function gte(e,t){let n=null;for(const s of Qf(t)){const i=await pt(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(s)}`);if(i.ok)return i.json();n=new Error(await Kt(i,"加载 Runtime 详情失败"))}throw n??new Error("加载 Runtime 详情失败")}async function Kk(e,t="cn-beijing",n={}){const s=Zf(e,t||"cn-beijing"),i=Jf(Ic,s,r1);if(!n.force&&i)return i;const r=Ic.get(s);if(!n.force&&(r!=null&&r.promise))return r.promise;const a=gte(e,t).then(l=>Uk(Ic,s,l));Ic.set(s,{...r,promise:a,updatedAt:(r==null?void 0:r.updatedAt)??0});try{return await a}finally{const l=Ic.get(s);(l==null?void 0:l.promise)===a&&Ic.set(s,{value:l.value,updatedAt:l.updatedAt})}}function h8(e,t="cn-beijing"){return Jf(Ic,Zf(e,t||"cn-beijing"),r1)}function p8(e,t="cn-beijing"){Kk(e,t).catch(()=>{})}async function c1(e){const t=await pt("/web/generated-agent-projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await Kt(t,"生成项目失败"));return t.json()}const bte=19e4;async function m8(e){const t=await pt("/web/generated-agent-drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requirement:e})},{},bte);if(!t.ok)throw new Error(await Kt(t,"生成 Agent 配置失败"));return i1(t,"生成 Agent 配置失败")}async function g8(e,t){const n=await pt("/web/generated-agent-test-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,runtimeId:t==null?void 0:t.runtimeId,runtimeRegion:t==null?void 0:t.region})});if(!n.ok)throw new Error(await Kt(n,"创建调试运行失败"));return i1(n,"创建调试运行失败")}async function b8(e,t){const n=await pt(`/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 Kt(n,"创建调试会话失败"));return(await i1(n,"创建调试会话失败")).id}async function y8(e,t){const n=await pt(`/web/generated-agent-test-runs/${encodeURIComponent(e)}/trace/session/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await Kt(n,"加载调试调用链路失败"));const s=await i1(n,"加载调试调用链路失败");if(!Array.isArray(s))throw new Error("加载调试调用链路失败:返回格式无效");return s}async function*x8({runId:e,userId:t,sessionId:n,text:s,signal:i}){const r=s.trim()?[{text:s}]:[],a=await pt(`/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:r},streaming:!0}),signal:i},{},0);if(!a.ok)throw new Error(await Kt(a,"调试运行失败"));for await(const l of Mk(a))yield l}async function ld(e){const t=await pt(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await Kt(t,"清理调试运行失败"))}const yte=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:wm,DEFAULT_STUDIO_ACCESS:r8,RuntimeAccessDeniedError:Xf,RuntimeProbeError:Sr,addSessionCapability:w_,cancelAgentkitDeployment:s8,clearMessageFeedbackCache:TB,clearRemoteApps:AB,componentSearch:e8,createGeneratedAgentTestRun:g8,createGeneratedAgentTestSession:b8,createSession:zy,deleteAgentFeedbackCases:HB,deleteGeneratedAgentTestRun:ld,deleteMedia:Db,deleteRuntime:d8,deleteSession:y_,deleteSessionMedia:x_,deployAgentkitProject:ug,downloadArtifact:zB,fetchRemoteApps:a1,generateAgentDraftFromRequirement:m8,generateAgentProject:c1,getAgentFeedbackCases:o1,getAgentInfo:Vk,getAgentOptimizations:BB,getAutomaticEvaluationStatuses:PB,getCachedAgentFeedbackCases:UB,getCachedRuntimeAgentInfo:ZB,getCachedRuntimeDetail:h8,getGeneratedAgentTestTrace:y8,getMediaCapabilities:ute,getMyRuntimes:pte,getRuntimeAgentInfo:Ky,getRuntimeDetail:Kk,getRuntimeUpdateCapability:f8,getRuntimes:l1,getSession:Vy,getSessionCapabilities:v_,getSessionTrace:Gy,getStudioAccess:a8,getStudioUpdateStatus:o8,getUiConfig:i8,listApps:IB,listIdentityUserPools:n8,listSessionBuiltinTools:zk,listSessionSkillSpaces:dte,listSessionSkillsInSpace:fte,listSessions:Fk,mediaContentUrl:YB,prefetchAgentFeedbackCases:b_,prefetchRuntimeAgentInfo:JB,prefetchRuntimeDetail:p8,previewArtifact:GB,probeRuntimeA2a:c8,probeRuntimeApps:Gk,refreshAgentFeedbackCases:FB,registerRemoteApp:kB,removeSessionCapability:XB,revealRuntimeApiKey:u8,runGeneratedAgentTestSSE:x8,runSSE:vm,searchSessionPublicSkills:WB,startStudioUpdate:l8,studioFetch:CB,submitIssueFeedback:E_,submitMessageFeedback:DB,uploadMedia:KB,upsertCachedAgentFeedbackCase:Lb,webSearch:t8},Symbol.toStringTag,{value:"Module"}));function CR(e){return e.blocks.flatMap(t=>t.kind==="tool"?[{name:t.name,args:t.args,response:t.response,done:t.done}]:[])}function xte(e){const t=e.attributes;return String(t["invocation.id"]??t["gen_ai.invocation.id"]??t["gcp.vertex.agent.invocation_id"]??"")}function Ete(e,t){if(!t)return e;const n=new Set(e.filter(i=>xte(i)===t).map(i=>i.trace_id)),s=e.filter(i=>n.has(i.trace_id));return s.length>0?s:e}function Lv(e){return!!(e&&[...e.tools,...e.skills].some(t=>t.custom))}const vte="send_a2ui_json_to_client",wte="validated_a2ui_json",S_="adk_request_credential",IR="transfer_to_agent";function Ste(e){var s,i,r,a;const t=e,n=((s=t==null?void 0:t.exchangedAuthCredential)==null?void 0:s.oauth2)??((i=t==null?void 0:t.exchanged_auth_credential)==null?void 0:i.oauth2)??((r=t==null?void 0:t.rawAuthCredential)==null?void 0:r.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 wa(){return{blocks:[],liveStart:0}}const jR=e=>e.functionCall??e.function_call,__=e=>e.functionResponse??e.function_response;function _te(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function Nte(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function E8(e){const t=[];for(const[n,s]of e.entries()){const i=s.partMetadata??s.part_metadata,r=i==null?void 0:i.veadkTransport;if((r==null?void 0:r.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 l=s.inlineData??s.inline_data;if(l&&l.data){t.push({id:`inline-${n}-${l.displayName??l.display_name??"media"}`,mimeType:l.mimeType??l.mime_type,data:Nte(l.data),name:l.displayName??l.display_name});continue}const c=s.fileData??s.file_data,u=(c==null?void 0:c.fileUri)??(c==null?void 0:c.file_uri);c&&u&&t.push({id:u,mimeType:c.mimeType??c.mime_type,uri:u,name:c.displayName??c.display_name})}return t}function N_(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 Tte=new Set(["llm","sequential","parallel","loop","a2a"]);function kte(e){var t;for(const n of e){const s=(t=n.partMetadata??n.part_metadata)==null?void 0:t.veadkInvocation;if(!s||typeof s!="object")continue;const i=s,r=Array.isArray(i.skills)?i.skills.flatMap(c=>{if(!c||typeof c!="object")return[];const u=c;return typeof u.name=="string"?[{name:u.name,description:typeof u.description=="string"?u.description:""}]:[]}):[];let a;const l=i.targetAgent;if(l&&typeof l=="object"){const c=l,u=c.type;typeof c.name=="string"&&typeof u=="string"&&Tte.has(u)&&Array.isArray(c.path)&&(a={name:c.name,description:typeof c.description=="string"?c.description:"",type:u,path:c.path.filter(d=>typeof d=="string")})}if(r.length>0||a)return{skills:r,targetAgent:a}}}function Ate(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 Cte(e,t){if(!t.length)return;const n=e[e.length-1];if((n==null?void 0:n.kind)==="artifact"){for(const s of t)n.files.some(i=>i.filename===s.filename&&i.version===s.version)||n.files.push(s);return}e.push({kind:"artifact",files:t})}function RR(e,t,n){const s=e[e.length-1];s&&s.kind===t?s.text+=n:e.push(t==="thinking"?{kind:t,text:n,done:!1}:{kind:t,text:n})}function O0(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function yf(e,t){var l,c,u,d,f,h;const n=e.blocks.map(p=>({...p}));let s=e.liveStart;const i=((l=t.content)==null?void 0:l.parts)??[],r=i.some(p=>jR(p)||__(p));if(t.partial&&!r){for(const p of i){const m=N_(p);typeof m=="string"&&m&&RR(n,p.thought?"thinking":"text",m)}return{blocks:n,liveStart:s}}n.length=s;for(const p of i){const m=jR(p),b=__(p),v=E8([p]),y=N_(p);if(typeof y=="string"&&y)RR(n,p.thought?"thinking":"text",y);else if(v.length)O0(n),Ate(n,v);else if(m)if(O0(n),m.name===IR){const x=_te(m.args)||((c=t.actions)==null?void 0:c.transferToAgent)||((u=t.actions)==null?void 0:u.transfer_to_agent)||"未知 Agent";n.push({kind:"agent-transfer",agentName:x,done:!1})}else if(m.name===S_){const x=m.args??{},E=x.authConfig??x.auth_config??x,_=String(x.functionCallId??x.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:m.id??"",label:_,authUri:Ste(E),authConfig:E,done:!1})}else n.push({kind:"tool",name:m.name??"",args:m.args,done:!1});else if(b){if(O0(n),b.name===IR)for(let x=n.length-1;x>=0;x--){const E=n[x];if(E.kind==="agent-transfer"&&!E.done){E.done=!0;break}}if(b.name===S_)for(let x=n.length-1;x>=0;x--){const E=n[x];if(E.kind==="auth"&&!E.done){E.done=!0;break}}for(let x=n.length-1;x>=0;x--){const E=n[x];if(E.kind==="tool"&&!E.done&&E.name===b.name){E.done=!0,E.response=b.response;break}}if(b.name===vte){const x=((d=b.response)==null?void 0:d[wte])??[];if(x.length){const E=n[n.length-1];E&&E.kind==="a2ui"?E.messages.push(...x):n.push({kind:"a2ui",messages:x})}}}}const a=((f=t.actions)==null?void 0:f.artifactDelta)??((h=t.actions)==null?void 0:h.artifact_delta);return a&&Cte(n,Object.entries(a).map(([p,m])=>({filename:p,version:m}))),O0(n),s=n.length,{blocks:n,liveStart:s}}function Ite(e,t={}){var i,r;const n=[];let s=wa();for(const a of e)if(a.author==="user"){const c=((i=a.content)==null?void 0:i.parts)??[];if(c.some(p=>{var m;return((m=__(p))==null?void 0:m.name)===S_})){for(let p=n.length-1;p>=0;p--)if(n[p].role==="assistant"){for(let m=n[p].blocks.length-1;m>=0;m--){const b=n[p].blocks[m];if(b.kind==="auth"){b.done=!0;break}}break}}const u=c.map(N_).filter(p=>!!p).join(""),d=E8(c),f=kte(c);if(!u&&!d.length&&!f){s=wa();continue}const h=[];f&&h.push({kind:"invocation",value:f}),d.length&&h.push({kind:"attachment",files:d}),u&&h.push({kind:"text",text:u}),n.push({role:"user",blocks:h,meta:{ts:a.timestamp}}),s=wa()}else{const c=a.author??"";let u=n[n.length-1];(!u||u.role!=="assistant"||c&&((r=u.meta)==null?void 0:r.author)!==c)&&(u={role:"assistant",blocks:[],meta:{author:c||void 0}},n.push(u),s=wa()),s=yf(s,a),u.blocks=s.blocks;const d=a.usageMetadata??a.usage_metadata,f=u.meta??(u.meta={});c&&(f.author=c),d!=null&&d.totalTokenCount&&(f.tokens=d.totalTokenCount),a.timestamp&&(f.ts=a.timestamp),a.id&&(f.eventId=a.id);const h=a.invocationId??a.invocation_id;h&&(f.invocationId=h)}for(const a of n){const l=a.meta,c=l==null?void 0:l.eventId;if(!c)continue;const u=t[`veadk_feedback:${c}`];if(!u||typeof u!="object")continue;const d=u;d.rating!=="good"&&d.rating!=="bad"||(l.feedback=u)}return n}function jte(e){var t,n;for(const s of e??[])if(s.author==="user"||((t=s.content)==null?void 0:t.role)==="user"){const i=(((n=s.content)==null?void 0:n.parts)??[]).map(r=>r.text).find(Boolean);if(i)return i}return"新会话"}const Rte=50,OR=48;function Ote(e){return(e.events??[]).flatMap(t=>{var i,r;const s=(((i=t.content)==null?void 0:i.parts)??[]).map(a=>typeof a.text=="string"?a.text:"").filter(Boolean).join("");return s?[{text:s,role:t.author??((r=t.content)==null?void 0:r.role)??"",ts:t.timestamp}]:[]})}function Mte(e){var t,n;for(const s of e.events??[])if(s.author==="user"||((t=s.content)==null?void 0:t.role)==="user"){const i=(((n=s.content)==null?void 0:n.parts)??[]).map(r=>r.text).find(Boolean);if(i)return i}return"未命名会话"}function Lte(e,t,n){const s=Math.max(0,t-OR),i=Math.min(e.length,t+n+OR);return(s>0?"…":"")+e.slice(s,i).trim()+(i{var c;if((c=l.events)!=null&&c.length)return l;try{return await Vy(t,e,l.id)}catch{return l}})),a=[];for(const l of r)for(const{text:c,role:u,ts:d}of Ote(l)){const f=c.toLowerCase().indexOf(s);if(f!==-1){a.push({type:"session",appId:t,sessionId:l.id,title:Mte(l),snippet:Lte(c,f,s.length),role:u,ts:d??l.lastUpdateTime});break}}return a.sort((l,c)=>(c.ts??0)-(l.ts??0)),a.slice(0,Rte)}async function Pte(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await t8(e,t.trim())}catch(a){const l=String(a);return{results:[],note:l.includes("404")?"网络搜索接口未就绪(后端未启用 /web/search)。":`网络搜索失败:${l}`}}const{mounted:s,results:i,error:r}=n;return s?r?{results:[],note:r}:{results:i.map((a,l)=>({type:"web",index:l,title:a.title,url:a.url,siteName:a.siteName,summary:a.summary}))}:{results:[],note:"当前 Agent 未挂载 web_search 工具。"}}async function Bte(e,t,n,s){if(!t||!s.trim())return{results:[]};const i=await e8(t,e,s.trim(),n);if(!i.mounted)return{results:[],note:e==="knowledge"?"该 Agent 未挂载知识库。":"该 Agent 未挂载长期记忆。"};if(i.error)return{results:[],note:i.error};const r=i.sourceName??(e==="knowledge"?"知识库":"长期记忆");return{results:i.results.map((a,l)=>e==="knowledge"?{type:"knowledge",index:l,content:a.content,sourceName:r,sourceType:i.sourceType}:{type:"memory",index:l,content:a.content,sourceName:r,sourceType:i.sourceType,author:a.author,ts:a.timestamp})}}async function Ute(e,t,n){return e==="session"?{results:await Dte(n.userId,n.appId,t)}:e==="web"?Pte(n.appId,t):Bte(e,n.appId,n.userId,t)}function v8({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M16.4 10.7a5.7 5.7 0 1 1-1.67-4.03"}),o.jsx("path",{d:"M15.25 15.25 19.6 19.6"})]})}function Fte({open:e}){return o.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:o.jsx("path",{d:"m3.25 4.75 2.75 2.5 2.75-2.5"})})}function $te({active:e=!1,onClick:t}){return o.jsxs("button",{className:`new-chat${e?" is-active":""}`,onClick:t,"aria-label":"搜索","aria-current":e?"page":void 0,title:"搜索",children:[o.jsx(v8,{}),o.jsx("span",{className:"sidebar-nav-label",children:"搜索"})]})}function Hte(e,t,n){const s=!!e,i=new Set((t==null?void 0:t.searchSources)??[]),r=a=>s?n?"正在检测 Agent 能力":`当前 Agent 未挂载${a}`:"请选择 Agent";return[{id:"session",label:"会话",ready:s,unavailableLabel:"请选择 Agent"},{id:"web",label:"网络",ready:s&&i.has("web"),description:"通过 web_search 工具检索",unavailableLabel:r(" web_search 工具")},{id:"knowledge",label:"知识库",ready:s&&i.has("knowledge"),unavailableLabel:r("知识库")},{id:"memory",label:"长期记忆",ready:s&&i.has("memory"),unavailableLabel:r("长期记忆")}]}function qy(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 MR(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 zte({userId:e,appId:t,agentInfo:n,capabilitiesLoading:s,agentLabel:i,onOpenSession:r}){var F,A;const[a,l]=g.useState("session"),[c,u]=g.useState(""),[d,f]=g.useState([]),[h,p]=g.useState(),[m,b]=g.useState(!1),[v,y]=g.useState(!1),[x,E]=g.useState(!1),w=g.useRef(0),_=g.useRef(null),S=Hte(t,n,s),k=S.find(M=>M.id===a),T=a==="knowledge"?(F=n==null?void 0:n.components)==null?void 0:F.find(M=>M.source==="knowledgebase"||M.kind==="knowledgebase"):a==="memory"?(A=n==null?void 0:n.components)==null?void 0:A.find(M=>M.source==="long_term_memory"||M.kind==="memory"):void 0;g.useEffect(()=>{w.current+=1,l("session"),f([]),p(void 0),y(!1),b(!1),E(!1)},[t]),g.useEffect(()=>{if(!x)return;function M(P){var H;(H=_.current)!=null&&H.contains(P.target)||E(!1)}return document.addEventListener("pointerdown",M),()=>document.removeEventListener("pointerdown",M)},[x]);async function C(M,P){var J;const H=M.trim();if(!H||!((J=S.find(U=>U.id===P))!=null&&J.ready))return;const R=++w.current;b(!0),y(!0);let Y;try{Y=await Ute(P,H,{userId:e,appId:t})}catch(U){const te=U instanceof Error?U.message:String(U);Y={results:[],note:`搜索失败:${te}`}}R===w.current&&(f(Y.results),p(Y.note),b(!1))}function I(M){w.current+=1,u(M),f([]),p(void 0),y(!1),b(!1)}function j(M){w.current+=1,l(M),E(!1),f([]),p(void 0),y(!1),b(!1)}const L=!!(k!=null&&k.ready),z=t?a==="web"?"在网络中检索":a==="knowledge"?`在 ${(T==null?void 0:T.name)??"当前 Agent 的知识库"} 中检索`:a==="memory"?`在 ${(T==null?void 0:T.name)??"当前用户的长期记忆"} 中检索`:"在当前 Agent 的会话中检索":"请先选择 Agent",D=T!=null&&T.backend?qy(T.backend):"";return o.jsxs("div",{className:"search",children:[o.jsxs("div",{className:"search-box",children:[o.jsxs("div",{className:"search-source-picker-wrap",ref:_,children:[o.jsxs("button",{className:"search-source-picker",type:"button","aria-label":`搜索类型:${(k==null?void 0:k.label)??"未选择"}`,"aria-haspopup":"listbox","aria-expanded":x,onClick:()=>E(M=>!M),children:[o.jsx("span",{children:(k==null?void 0:k.label)??"搜索类型"}),D&&o.jsx("small",{children:D}),o.jsx(Fte,{open:x})]}),x&&o.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":"选择搜索类型",children:S.map(M=>{var R,Y;const P=M.id==="knowledge"?(R=n==null?void 0:n.components)==null?void 0:R.find(J=>J.source==="knowledgebase"||J.kind==="knowledgebase"):M.id==="memory"?(Y=n==null?void 0:n.components)==null?void 0:Y.find(J=>J.source==="long_term_memory"||J.kind==="memory"):void 0,H=P?[P.name,P.backend?qy(P.backend):""].filter(Boolean).join(" · "):M.ready?M.description:M.unavailableLabel;return o.jsxs("button",{type:"button",role:"option","aria-selected":a===M.id,disabled:!M.ready,onClick:()=>j(M.id),children:[o.jsx("span",{children:M.label}),H&&o.jsx("small",{children:H})]},M.id)})})]}),o.jsx("span",{className:"search-box-divider","aria-hidden":!0}),o.jsx("input",{className:"search-input",value:c,onChange:M=>I(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),C(c,a))},placeholder:z,disabled:!L,autoFocus:!0}),o.jsx("button",{className:"search-go",onClick:()=>void C(c,a),disabled:!c.trim()||m,"aria-label":"搜索",children:m?o.jsx(dn,{className:"icon spin"}):o.jsx(v8,{className:"icon"})})]}),o.jsx("div",{className:"search-results",children:L?v?m?null:h?o.jsx("div",{className:"search-empty",children:h}):d.length===0&&v?o.jsxs("div",{className:"search-empty",children:["未找到匹配「",c.trim(),"」的结果。"]}):d.map((M,P)=>o.jsx(Vte,{result:M,agentLabel:i,onOpen:r},P)):o.jsx("div",{className:"search-empty",children:a==="web"?"输入关键词后回车或点击按钮,通过 web_search 工具检索。":a==="knowledge"?"输入问题,检索当前 Agent 挂载的知识库。":a==="memory"?"输入线索,检索当前用户跨会话保存的长期记忆。":"输入关键词后回车或点击按钮,搜索当前 Agent 的会话。"}):o.jsx("div",{className:"search-empty",children:t?s?"正在读取当前 Agent 的检索能力…":(k==null?void 0:k.unavailableLabel)??"当前 Agent 未挂载该数据源":"选择一个 Agent 后,即可检索会话、网络及其挂载的数据源。"})})]})}function Vte({result:e,agentLabel:t,onOpen:n}){switch(e.type){case"session":return o.jsxs("button",{className:"search-result",onClick:()=>n(e.appId,e.sessionId),children:[o.jsx(wB,{className:"search-result-icon"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:e.title}),o.jsxs("span",{className:"search-result-meta",children:[t(e.appId),e.ts?` · ${MR(e.ts)}`:""]})]}),o.jsx("div",{className:"search-result-snippet",children:e.snippet})]})]});case"web":return o.jsxs("a",{className:"search-result",href:e.url||void 0,target:"_blank",rel:"noreferrer noopener",children:[o.jsx(n1,{className:"search-result-icon"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:e.title||e.url}),o.jsxs("span",{className:"search-result-meta",children:[e.siteName,e.url&&o.jsx(Em,{className:"search-result-ext"})]})]}),e.summary&&o.jsx("div",{className:"search-result-snippet",children:e.summary})]})]});case"knowledge":return o.jsxs("div",{className:"search-result search-result-static",children:[o.jsx(LR,{source:"knowledge"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsxs("span",{className:"search-result-title",children:["知识片段 ",e.index+1]}),o.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${qy(e.sourceType)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});case"memory":return o.jsxs("div",{className:"search-result search-result-static",children:[o.jsx(LR,{source:"memory"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsxs("span",{className:"search-result-title",children:["记忆片段 ",e.index+1]}),o.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${qy(e.sourceType)}`:"",e.ts?` · ${MR(e.ts)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function LR({source:e,className:t="search-result-icon"}){return e==="knowledge"?o.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.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"}),o.jsx("path",{d:"M8.25 9h7.5M8.25 12.25h6"})]}):o.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 0 7.5 7.5"}),o.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"})]})}function Wc({className:e="icon"}){return o.jsxs("svg",{className:`${e} sidebar-agent-face`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"4.25",y:"5.25",width:"15.5",height:"13.5",rx:"4.75"}),o.jsx("path",{className:"sidebar-agent-face__eye",d:"M8.5 10.7v2"}),o.jsx("path",{className:"sidebar-agent-face__eye",d:"M15.5 10.7v2"})]})}function Gte({filled:e=!1,...t}){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[o.jsx("rect",{x:"3.5",y:"9.3",width:"4.5",height:"10.2",rx:"1.5"}),o.jsx("path",{d:"M8 10.2 11.3 4.8c.5-.8 1.7-.45 1.7.5v3.8h4.2a2.1 2.1 0 0 1 2.04 2.6l-1.4 5.75A2.1 2.1 0 0 1 15.8 19H8"})]})}function Kte({filled:e=!1,...t}){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"4.5",height:"10.2",rx:"1.5"}),o.jsx("path",{d:"M8 13.8 11.3 19.2c.5.8 1.7.45 1.7-.5v-3.8h4.2a2.1 2.1 0 0 0 2.04-2.6l-1.4-5.75A2.1 2.1 0 0 0 15.8 5H8"})]})}function w8(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M5.25 4.25h9.5a2.5 2.5 0 0 1 2.5 2.5v3.5"}),o.jsx("path",{d:"M13.25 17.75h-8a2.5 2.5 0 0 1-2.5-2.5v-8a3 3 0 0 1 3-3"}),o.jsx("path",{d:"M7 8.25h5.5M7 11.75h3.25"}),o.jsx("path",{d:"m13.35 16.65.42-2.16 4.76-4.76a1.35 1.35 0 0 1 1.91 1.91l-4.76 4.76-2.33.25Z"}),o.jsx("path",{d:"m17.65 10.6 1.9 1.9"})]})}const qk="/assets/logo-DCsNZy-k.svg",DR="(max-width: 860px)";function qte(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"7",cy:"7",r:"2.25"}),o.jsx("circle",{cx:"17",cy:"7",r:"2.25"}),o.jsx("circle",{cx:"7",cy:"17",r:"2.25"}),o.jsx("circle",{cx:"17",cy:"17",r:"2.25"})]})}function Yte(e){let t=2166136261;for(const s of e)t^=s.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 Wte={admin:"管理员",developer:"开发者",user:"普通用户"};function PR({role:e}){const t=Wte[e];return o.jsx("span",{className:`studio-role-badge studio-role-badge--${e}`,title:t,children:t})}function Xte({version:e,onClose:t}){return g.useEffect(()=>{const n=s=>{s.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),hi.createPortal(o.jsx("div",{className:"confirm-scrim",onMouseDown:t,children:o.jsxs("section",{className:"confirm-box system-info-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"system-info-title",onMouseDown:n=>n.stopPropagation(),children:[o.jsxs("header",{className:"system-info-head",children:[o.jsx("h2",{id:"system-info-title",children:"系统信息"}),o.jsx("button",{type:"button",className:"icon-btn",onClick:t,"aria-label":"关闭系统信息",autoFocus:!0,children:o.jsx(Ti,{className:"icon","aria-hidden":"true"})})]}),o.jsx("dl",{className:"system-info-meta",children:o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:e||"—"})]})})]})}),document.body)}function Qte({access:e,userInfo:t,version:n,onLogout:s}){const[i,r]=g.useState(!1),[a,l]=g.useState(!1),[c,u]=g.useState("");if(!t)return null;const d=Kee(t),f=typeof t.email=="string"?t.email:"",h=(d||"U").slice(0,1).toUpperCase(),p=Yte(d||f||h),m=qee(t),b=m===c?"":m;return o.jsxs("div",{className:"sidebar-user",children:[o.jsxs("button",{className:"sidebar-user-btn",onClick:()=>r(v=>!v),title:f?`${d} +${f}`:d,children:[o.jsxs("span",{className:`account-avatar${b?" has-image":""}`,style:p,children:[h,b?o.jsx("img",{className:"account-avatar-image",src:b,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(b)}):null]}),o.jsxs("span",{className:"sidebar-user-identity",children:[o.jsxs("span",{className:"sidebar-user-primary",children:[o.jsx("span",{className:"sidebar-user-name",children:d}),o.jsx(PR,{role:e.role})]}),f&&f!==d&&o.jsx("span",{className:"sidebar-user-email",children:f})]})]}),i&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>r(!1)}),o.jsxs("div",{className:"account-pop sidebar-user-pop",children:[o.jsxs("div",{className:"account-head",children:[o.jsxs("span",{className:`account-avatar account-avatar--lg${b?" has-image":""}`,style:p,children:[h,b?o.jsx("img",{className:"account-avatar-image",src:b,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(b)}):null]}),o.jsxs("div",{className:"account-id",children:[o.jsxs("div",{className:"account-name-row",children:[o.jsx("div",{className:"account-name",children:d}),o.jsx(PR,{role:e.role})]}),f&&f!==d&&o.jsx("div",{className:"account-sub",children:f})]})]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{r(!1),l(!0)},children:[o.jsx(cc,{className:"icon"})," 系统信息"]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{r(!1),s()},children:[o.jsx(bee,{className:"icon"})," 退出登录"]})]})]}),a?o.jsx(Xte,{version:n,onClose:()=>l(!1)}):null]})}function Zte({branding:e,sessions:t,currentSessionId:n,activePage:s,features:i,access:r,streamingSids:a,evaluatingSids:l,onNewChat:c,onSearch:u,onQuickCreate:d,onSkillCenter:f,onAddAgent:h,onMyAgents:p,onApplications:m,onIssueFeedback:b,onPickSession:v,onDeleteSession:y,userInfo:x,version:E,onLogout:w}){const _=z=>(i==null?void 0:i[z])!==!1,[S,k]=g.useState(null),T=g.useRef(typeof window<"u"&&window.matchMedia(DR).matches),[C,I]=g.useState(T.current),j=[...t].sort((z,D)=>(D.lastUpdateTime??0)-(z.lastUpdateTime??0)),L=()=>{T.current=!1,I(z=>!z),k(null)};return g.useEffect(()=>{const z=window.matchMedia(DR),D=F=>{F.matches?I(A=>A||(T.current=!0,!0)):T.current&&(T.current=!1,I(!1))};return z.addEventListener("change",D),()=>z.removeEventListener("change",D)},[]),o.jsxs("aside",{className:`sidebar ${C?"is-collapsed":""}`,children:[o.jsxs("div",{className:"sidebar-top",children:[o.jsxs("div",{className:"sidebar-brand-row",children:[o.jsxs("button",{type:"button",className:"brand",onClick:c,"aria-label":"返回首页",title:"返回首页",children:[o.jsx("img",{className:"brand-logo",src:e.logoUrl||qk,width:20,height:20,alt:"","aria-hidden":!0}),o.jsx("span",{className:"brand-title",children:e.title})]}),o.jsx("button",{type:"button",className:"sidebar-collapse-toggle",onClick:L,"aria-label":C?"展开侧边栏":"收起侧边栏",title:C?"展开侧边栏":"收起侧边栏",children:C?o.jsx(Nee,{className:"icon"}):o.jsx(_ee,{className:"icon"})})]}),_("newChat")&&o.jsxs("button",{className:`new-chat new-chat--conversation${s==="new-chat"?" is-active":""}`,onClick:c,"aria-label":"新会话","aria-current":s==="new-chat"?"page":void 0,title:"新会话",children:[o.jsx(_i,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"新会话"})]}),o.jsxs("button",{className:`new-chat new-chat--agents${s==="agents"?" is-active":""}`,onClick:p,"aria-label":"智能体","aria-current":s==="agents"?"page":void 0,title:"智能体",children:[o.jsx(Wc,{}),o.jsx("span",{className:"sidebar-nav-label",children:"智能体"})]}),_("search")&&o.jsx($te,{active:s==="search",onClick:u}),o.jsxs("button",{className:`new-chat new-chat--applications${s==="applications"?" is-active":""}`,onClick:m,"aria-label":"自动化","aria-current":s==="applications"?"page":void 0,title:"自动化",children:[o.jsx(qte,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"自动化"}),o.jsx("span",{className:"sidebar-beta-badge",children:"Beta"})]})]}),_("history")&&o.jsxs("div",{className:"sidebar-history",children:[o.jsxs("div",{className:"history-head",children:[o.jsx("span",{children:"历史会话"}),_("newChat")&&o.jsx("button",{type:"button",className:"history-new-chat",onClick:c,"aria-label":"新建会话",title:"新建会话",children:o.jsx(_i,{className:"icon"})})]}),o.jsxs("div",{className:"history-list",children:[j.length===0&&o.jsx("div",{className:"history-empty",children:"暂无会话"}),j.map(z=>{const D=jte(z.events),F=(a==null?void 0:a.has(z.id))===!0,A=!F&&(l==null?void 0:l.has(z.id))===!0;return o.jsxs("div",{className:`history-item ${z.id===n?"active":""}`,children:[o.jsxs("button",{className:"history-item-btn",onClick:()=>v(z.id),"aria-current":z.id===n?"page":void 0,title:D,children:[F&&o.jsx("span",{className:"history-streaming",title:"正在生成…","aria-label":"正在生成"}),o.jsx("span",{className:"history-title",children:D}),A&&o.jsxs("span",{className:"history-evaluating-status",title:"正在自动评测",children:[o.jsx("span",{className:"history-evaluating","aria-hidden":"true"}),"评测中"]})]}),o.jsx("button",{className:"history-more",title:"更多",onClick:()=>k(M=>M===z.id?null:z.id),children:o.jsx(nee,{className:"icon"})}),S===z.id&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>k(null)}),o.jsx("div",{className:"history-menu",children:o.jsxs("button",{className:"menu-item menu-item--danger",onClick:()=>{k(null),y(z.id)},children:[o.jsx(sc,{className:"icon"})," 删除"]})})]})]},z.id)})]})]}),o.jsxs("div",{className:"sidebar-footer",children:[o.jsxs("button",{type:"button",className:`sidebar-feedback${s==="feedback"?" is-active":""}`,onClick:b,"aria-label":"问题反馈","aria-current":s==="feedback"?"page":void 0,title:"问题反馈",children:[o.jsx(w8,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"问题反馈"})]}),o.jsx(Qte,{access:r,userInfo:x,version:E,onLogout:w})]})]})}function Zs(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n{}};function u1(){for(var e=0,t=arguments.length,n={},s;e=0&&(s=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}Bb.prototype=u1.prototype={constructor:Bb,on:function(e,t){var n=this._,s=ene(e+"",n),i,r=-1,a=s.length;if(arguments.length<2){for(;++r0)for(var n=new Array(i),s=0,i,r;s=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),UR.hasOwnProperty(t)?{space:UR[t],local:e}:e}function nne(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===T_&&t.documentElement.namespaceURI===T_?t.createElement(e):t.createElementNS(n,e)}}function sne(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function S8(e){var t=d1(e);return(t.local?sne:nne)(t)}function ine(){}function Yk(e){return e==null?ine:function(){return this.querySelector(e)}}function rne(e){typeof e!="function"&&(e=Yk(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i=E&&(E=x+1);!(_=v[E])&&++E=0;)(a=s[i])&&(r&&a.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(a,r),r=a);return this}function Ine(e){e||(e=jne);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,s=n.length,i=new Array(s),r=0;rt?1:e>=t?0:NaN}function Rne(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function One(){return Array.from(this)}function Mne(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Gne:typeof t=="function"?qne:Kne)(e,t,n??"")):xf(this.node(),e)}function xf(e,t){return e.style.getPropertyValue(t)||A8(e).getComputedStyle(e,null).getPropertyValue(t)}function Wne(e){return function(){delete this[e]}}function Xne(e,t){return function(){this[e]=t}}function Qne(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Zne(e,t){return arguments.length>1?this.each((t==null?Wne:typeof t=="function"?Qne:Xne)(e,t)):this.node()[e]}function C8(e){return e.trim().split(/^|\s+/)}function Wk(e){return e.classList||new I8(e)}function I8(e){this._node=e,this._names=C8(e.getAttribute("class")||"")}I8.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 j8(e,t){for(var n=Wk(e),s=-1,i=t.length;++s=0&&(n=t.slice(s+1),t=t.slice(0,s)),{type:t,name:n}})}function Tse(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,i=t.length,r;n()=>e;function k_(e,{sourceEvent:t,subject:n,target:s,identifier:i,active:r,x:a,y:l,dx:c,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:s,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}k_.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Dse(e){return!e.ctrlKey&&!e.button}function Pse(){return this.parentNode}function Bse(e,t){return t??{x:e.x,y:e.y}}function Use(){return navigator.maxTouchPoints||"ontouchstart"in this}function P8(){var e=Dse,t=Pse,n=Bse,s=Use,i={},r=u1("start","drag","end"),a=0,l,c,u,d,f=0;function h(w){w.on("mousedown.drag",p).filter(s).on("touchstart.drag",v).on("touchmove.drag",y,Lse).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(w,_){if(!(d||!e.call(this,w,_))){var S=E(this,t.call(this,w,_),w,_,"mouse");S&&(vr(w.view).on("mousemove.drag",m,Sm).on("mouseup.drag",b,Sm),L8(w.view),Dv(w),u=!1,l=w.clientX,c=w.clientY,S("start",w))}}function m(w){if(Wd(w),!u){var _=w.clientX-l,S=w.clientY-c;u=_*_+S*S>f}i.mouse("drag",w)}function b(w){vr(w.view).on("mousemove.drag mouseup.drag",null),D8(w.view,u),Wd(w),i.mouse("end",w)}function v(w,_){if(e.call(this,w,_)){var S=w.changedTouches,k=t.call(this,w,_),T=S.length,C,I;for(C=0;C>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?L0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?L0(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=$se.exec(e))?new rr(t[1],t[2],t[3],1):(t=Hse.exec(e))?new rr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=zse.exec(e))?L0(t[1],t[2],t[3],t[4]):(t=Vse.exec(e))?L0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Gse.exec(e))?KR(t[1],t[2]/100,t[3]/100,1):(t=Kse.exec(e))?KR(t[1],t[2]/100,t[3]/100,t[4]):FR.hasOwnProperty(e)?zR(FR[e]):e==="transparent"?new rr(NaN,NaN,NaN,0):null}function zR(e){return new rr(e>>16&255,e>>8&255,e&255,1)}function L0(e,t,n,s){return s<=0&&(e=t=n=NaN),new rr(e,t,n,s)}function Wse(e){return e instanceof fg||(e=lu(e)),e?(e=e.rgb(),new rr(e.r,e.g,e.b,e.opacity)):new rr}function A_(e,t,n,s){return arguments.length===1?Wse(e):new rr(e,t,n,s??1)}function rr(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}Xk(rr,A_,B8(fg,{brighter(e){return e=e==null?Wy:Math.pow(Wy,e),new rr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?_m:Math.pow(_m,e),new rr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new rr(Xc(this.r),Xc(this.g),Xc(this.b),Xy(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:VR,formatHex:VR,formatHex8:Xse,formatRgb:GR,toString:GR}));function VR(){return`#${Pc(this.r)}${Pc(this.g)}${Pc(this.b)}`}function Xse(){return`#${Pc(this.r)}${Pc(this.g)}${Pc(this.b)}${Pc((isNaN(this.opacity)?1:this.opacity)*255)}`}function GR(){const e=Xy(this.opacity);return`${e===1?"rgb(":"rgba("}${Xc(this.r)}, ${Xc(this.g)}, ${Xc(this.b)}${e===1?")":`, ${e})`}`}function Xy(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Xc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Pc(e){return e=Xc(e),(e<16?"0":"")+e.toString(16)}function KR(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new va(e,t,n,s)}function U8(e){if(e instanceof va)return new va(e.h,e.s,e.l,e.opacity);if(e instanceof fg||(e=lu(e)),!e)return new va;if(e instanceof va)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,i=Math.min(t,n,s),r=Math.max(t,n,s),a=NaN,l=r-i,c=(r+i)/2;return l?(t===r?a=(n-s)/l+(n0&&c<1?0:a,new va(a,l,c,e.opacity)}function Qse(e,t,n,s){return arguments.length===1?U8(e):new va(e,t,n,s??1)}function va(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}Xk(va,Qse,B8(fg,{brighter(e){return e=e==null?Wy:Math.pow(Wy,e),new va(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?_m:Math.pow(_m,e),new va(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,s=n+(n<.5?n:1-n)*t,i=2*n-s;return new rr(Pv(e>=240?e-240:e+120,i,s),Pv(e,i,s),Pv(e<120?e+240:e-120,i,s),this.opacity)},clamp(){return new va(qR(this.h),D0(this.s),D0(this.l),Xy(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=Xy(this.opacity);return`${e===1?"hsl(":"hsla("}${qR(this.h)}, ${D0(this.s)*100}%, ${D0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function qR(e){return e=(e||0)%360,e<0?e+360:e}function D0(e){return Math.max(0,Math.min(1,e||0))}function Pv(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 Qk=e=>()=>e;function Zse(e,t){return function(n){return e+n*t}}function Jse(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function eie(e){return(e=+e)==1?F8:function(t,n){return n-t?Jse(t,n,e):Qk(isNaN(t)?n:t)}}function F8(e,t){var n=t-e;return n?Zse(e,n):Qk(isNaN(e)?t:e)}const Qy=function e(t){var n=eie(t);function s(i,r){var a=n((i=A_(i)).r,(r=A_(r)).r),l=n(i.g,r.g),c=n(i.b,r.b),u=F8(i.opacity,r.opacity);return function(d){return i.r=a(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return s.gamma=e,s}(1);function tie(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,s=t.slice(),i;return function(r){for(i=0;in&&(r=t.slice(n,r),l[a]?l[a]+=r:l[++a]=r),(s=s[0])===(i=i[0])?l[a]?l[a]+=i:l[++a]=i:(l[++a]=null,c.push({i:a,x:qa(s,i)})),n=Bv.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(i(f)+"rotate(",null,s)-2,x:qa(u,d)})):d&&f.push(i(f)+"rotate("+d+s)}function l(u,d,f,h){u!==d?h.push({i:f.push(i(f)+"skewX(",null,s)-2,x:qa(u,d)}):d&&f.push(i(f)+"skewX("+d+s)}function c(u,d,f,h,p,m){if(u!==f||d!==h){var b=p.push(i(p)+"scale(",null,",",null,")");m.push({i:b-4,x:qa(u,f)},{i:b-2,x:qa(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),r(u.translateX,u.translateY,d.translateX,d.translateY,f,h),a(u.rotate,d.rotate,f,h),l(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var m=-1,b=h.length,v;++m=0&&e._call.call(void 0,t),e=e._next;--Ef}function XR(){cu=(Jy=Tm.now())+f1,Ef=lp=0;try{gie()}finally{Ef=0,yie(),cu=0}}function bie(){var e=Tm.now(),t=e-Jy;t>V8&&(f1-=t,Jy=e)}function yie(){for(var e,t=Zy,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Zy=n);cp=e,j_(s)}function j_(e){if(!Ef){lp&&(lp=clearTimeout(lp));var t=e-cu;t>24?(e<1/0&&(lp=setTimeout(XR,e-Tm.now()-f1)),Bh&&(Bh=clearInterval(Bh))):(Bh||(Jy=Tm.now(),Bh=setInterval(bie,V8)),Ef=1,G8(XR))}}function QR(e,t,n){var s=new ex;return t=t==null?0:+t,s.restart(i=>{s.stop(),e(i+t)},t,n),s}var xie=u1("start","end","cancel","interrupt"),Eie=[],q8=0,ZR=1,R_=2,Fb=3,JR=4,O_=5,$b=6;function h1(e,t,n,s,i,r){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;vie(e,n,{name:t,index:s,group:i,on:xie,tween:Eie,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:q8})}function Jk(e,t){var n=Ra(e,t);if(n.state>q8)throw new Error("too late; already scheduled");return n}function oo(e,t){var n=Ra(e,t);if(n.state>Fb)throw new Error("too late; already running");return n}function Ra(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function vie(e,t,n){var s=e.__transition,i;s[t]=n,n.timer=K8(r,0,n.time);function r(u){n.state=ZR,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!==ZR)return c();for(d in s)if(p=s[d],p.name===n.name){if(p.state===Fb)return QR(a);p.state===JR?(p.state=$b,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete s[d]):+dR_&&s.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Qie(e,t,n){var s,i,r=Xie(t)?Jk:oo;return function(){var a=r(this,e),l=a.on;l!==s&&(i=(s=l).copy()).on(t,n),a.on=i}}function Zie(e,t){var n=this._id;return arguments.length<2?Ra(this.node(),n).on.on(e):this.each(Qie(n,e,t))}function Jie(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function ere(){return this.on("end.remove",Jie(this._id))}function tre(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Yk(e));for(var s=this._groups,i=s.length,r=new Array(i),a=0;a()=>e;function Tre(e,{sourceEvent:t,target:n,transform:s,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:s,enumerable:!0,configurable:!0},_:{value:i}})}function Bo(e,t,n){this.k=e,this.x=t,this.y=n}Bo.prototype={constructor:Bo,scale:function(e){return e===1?this:new Bo(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Bo(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 p1=new Bo(1,0,0);Q8.prototype=Bo.prototype;function Q8(e){for(;!e.__zoom;)if(!(e=e.parentNode))return p1;return e.__zoom}function Uv(e){e.stopImmediatePropagation()}function Uh(e){e.preventDefault(),e.stopImmediatePropagation()}function kre(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Are(){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 eO(){return this.__zoom||p1}function Cre(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Ire(){return navigator.maxTouchPoints||"ontouchstart"in this}function jre(e,t,n){var s=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],r=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i),a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a))}function Z8(){var e=kre,t=Are,n=jre,s=Cre,i=Ire,r=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Ub,u=u1("start","zoom","end"),d,f,h,p=500,m=150,b=0,v=10;function y(D){D.property("__zoom",eO).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",I).filter(i).on("touchstart.zoom",j).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(D,F,A,M){var P=D.selection?D.selection():D;P.property("__zoom",eO),D!==P?_(D,F,A,M):P.interrupt().each(function(){S(this,arguments).event(M).start().zoom(null,typeof F=="function"?F.apply(this,arguments):F).end()})},y.scaleBy=function(D,F,A,M){y.scaleTo(D,function(){var P=this.__zoom.k,H=typeof F=="function"?F.apply(this,arguments):F;return P*H},A,M)},y.scaleTo=function(D,F,A,M){y.transform(D,function(){var P=t.apply(this,arguments),H=this.__zoom,R=A==null?w(P):typeof A=="function"?A.apply(this,arguments):A,Y=H.invert(R),J=typeof F=="function"?F.apply(this,arguments):F;return n(E(x(H,J),R,Y),P,a)},A,M)},y.translateBy=function(D,F,A,M){y.transform(D,function(){return n(this.__zoom.translate(typeof F=="function"?F.apply(this,arguments):F,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),a)},null,M)},y.translateTo=function(D,F,A,M,P){y.transform(D,function(){var H=t.apply(this,arguments),R=this.__zoom,Y=M==null?w(H):typeof M=="function"?M.apply(this,arguments):M;return n(p1.translate(Y[0],Y[1]).scale(R.k).translate(typeof F=="function"?-F.apply(this,arguments):-F,typeof A=="function"?-A.apply(this,arguments):-A),H,a)},M,P)};function x(D,F){return F=Math.max(r[0],Math.min(r[1],F)),F===D.k?D:new Bo(F,D.x,D.y)}function E(D,F,A){var M=F[0]-A[0]*D.k,P=F[1]-A[1]*D.k;return M===D.x&&P===D.y?D:new Bo(D.k,M,P)}function w(D){return[(+D[0][0]+ +D[1][0])/2,(+D[0][1]+ +D[1][1])/2]}function _(D,F,A,M){D.on("start.zoom",function(){S(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(M).end()}).tween("zoom",function(){var P=this,H=arguments,R=S(P,H).event(M),Y=t.apply(P,H),J=A==null?w(Y):typeof A=="function"?A.apply(P,H):A,U=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),te=P.__zoom,K=typeof F=="function"?F.apply(P,H):F,V=c(te.invert(J).concat(U/te.k),K.invert(J).concat(U/K.k));return function(W){if(W===1)W=K;else{var q=V(W),ue=U/q[2];W=new Bo(ue,J[0]-q[0]*ue,J[1]-q[1]*ue)}R.zoom(null,W)}})}function S(D,F,A){return!A&&D.__zooming||new k(D,F)}function k(D,F){this.that=D,this.args=F,this.active=0,this.sourceEvent=null,this.extent=t.apply(D,F),this.taps=0}k.prototype={event:function(D){return D&&(this.sourceEvent=D),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(D,F){return this.mouse&&D!=="mouse"&&(this.mouse[1]=F.invert(this.mouse[0])),this.touch0&&D!=="touch"&&(this.touch0[1]=F.invert(this.touch0[0])),this.touch1&&D!=="touch"&&(this.touch1[1]=F.invert(this.touch1[0])),this.that.__zoom=F,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(D){var F=vr(this.that).datum();u.call(D,this.that,new Tre(D,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),F)}};function T(D,...F){if(!e.apply(this,arguments))return;var A=S(this,F).event(D),M=this.__zoom,P=Math.max(r[0],Math.min(r[1],M.k*Math.pow(2,s.apply(this,arguments)))),H=ba(D);if(A.wheel)(A.mouse[0][0]!==H[0]||A.mouse[0][1]!==H[1])&&(A.mouse[1]=M.invert(A.mouse[0]=H)),clearTimeout(A.wheel);else{if(M.k===P)return;A.mouse=[H,M.invert(H)],Hb(this),A.start()}Uh(D),A.wheel=setTimeout(R,m),A.zoom("mouse",n(E(x(M,P),A.mouse[0],A.mouse[1]),A.extent,a));function R(){A.wheel=null,A.end()}}function C(D,...F){if(h||!e.apply(this,arguments))return;var A=D.currentTarget,M=S(this,F,!0).event(D),P=vr(D.view).on("mousemove.zoom",J,!0).on("mouseup.zoom",U,!0),H=ba(D,A),R=D.clientX,Y=D.clientY;L8(D.view),Uv(D),M.mouse=[H,this.__zoom.invert(H)],Hb(this),M.start();function J(te){if(Uh(te),!M.moved){var K=te.clientX-R,V=te.clientY-Y;M.moved=K*K+V*V>b}M.event(te).zoom("mouse",n(E(M.that.__zoom,M.mouse[0]=ba(te,A),M.mouse[1]),M.extent,a))}function U(te){P.on("mousemove.zoom mouseup.zoom",null),D8(te.view,M.moved),Uh(te),M.event(te).end()}}function I(D,...F){if(e.apply(this,arguments)){var A=this.__zoom,M=ba(D.changedTouches?D.changedTouches[0]:D,this),P=A.invert(M),H=A.k*(D.shiftKey?.5:2),R=n(E(x(A,H),M,P),t.apply(this,F),a);Uh(D),l>0?vr(this).transition().duration(l).call(_,R,M,D):vr(this).call(y.transform,R,M,D)}}function j(D,...F){if(e.apply(this,arguments)){var A=D.touches,M=A.length,P=S(this,F,D.changedTouches.length===M).event(D),H,R,Y,J;for(Uv(D),R=0;R`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:s})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:s}", 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.`},km=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],J8=["Enter"," ","Escape"],e9={"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 vf;(function(e){e.Strict="strict",e.Loose="loose"})(vf||(vf={}));var Qc;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Qc||(Qc={}));var Am;(function(e){e.Partial="partial",e.Full="full"})(Am||(Am={}));const t9={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Cl;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Cl||(Cl={}));var wf;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(wf||(wf={}));var Xe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Xe||(Xe={}));const tO={[Xe.Left]:Xe.Right,[Xe.Right]:Xe.Left,[Xe.Top]:Xe.Bottom,[Xe.Bottom]:Xe.Top};function n9(e){return e===null?null:e?"valid":"invalid"}const s9=e=>"id"in e&&"source"in e&&"target"in e,Rre=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),tA=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),hg=(e,t=[0,0])=>{const{width:n,height:s}=il(e),i=e.origin??t,r=n*i[0],a=s*i[1];return{x:e.position.x-r,y:e.position.y-a}},Ore=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,i)=>{const r=typeof i=="string";let a=!t.nodeLookup&&!r?i:void 0;t.nodeLookup&&(a=r?t.nodeLookup.get(i):tA(i)?i:t.nodeLookup.get(i.id));const l=a?tx(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return m1(s,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return g1(n)},pg=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},s=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=m1(n,tx(i)),s=!0)}),s?g1(n):{x:0,y:0,width:0,height:0}},nA=(e,t,[n,s,i]=[0,0,1],r=!1,a=!1)=>{const l={...eh(t,[n,s,i]),width:t.width/i,height:t.height/i},c=[];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=Cm(l,_f(u)),v=(p??0)*(m??0),y=r&&b>0;(!u.internals.handleBounds||y||b>=v||u.dragging)&&c.push(u)}return c},Mre=(e,t)=>{const n=new Set;return e.forEach(s=>{n.add(s.id)}),t.filter(s=>n.has(s.source)||n.has(s.target))};function Lre(e,t){const n=new Map,s=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)&&(!s||s.has(i.id))&&n.set(i.id,i)}),n}async function Dre({nodes:e,width:t,height:n,panZoom:s,minZoom:i,maxZoom:r},a){if(e.size===0)return!0;const l=Lre(e,a),c=pg(l),u=iA(c,t,n,(a==null?void 0:a.minZoom)??i,(a==null?void 0:a.maxZoom)??r,(a==null?void 0:a.padding)??.1);return await s.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 i9({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:s=[0,0],nodeExtent:i,onError:r}){const a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},d=a.origin??s;let f=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!l)r==null||r("005",Ca.error005());else{const p=l.measured.width,m=l.measured.height;p&&m&&(f=[[c,u],[c+p,u+m]])}else l&&du(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const h=du(f)?uu(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(r==null||r("015",Ca.error015())),{position:{x:h.x-c+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}async function Pre({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:s,onBeforeDelete:i}){const r=new Set(e.map(h=>h.id)),a=[];for(const h of n){if(h.deletable===!1)continue;const p=r.has(h.id),m=!p&&h.parentId&&a.find(b=>b.id===h.parentId);(p||m)&&a.push(h)}const l=new Set(t.map(h=>h.id)),c=s.filter(h=>h.deletable!==!1),d=Mre(a,c);for(const h of c)l.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 Sf=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),uu=(e={x:0,y:0},t,n)=>({x:Sf(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Sf(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function r9(e,t,n){const{width:s,height:i}=il(n),{x:r,y:a}=n.internals.positionAbsolute;return uu(e,[[r,a],[r+s,a+i]],t)}const nO=(e,t,n)=>en?-Sf(Math.abs(e-n),1,t)/t:0,sA=(e,t,n=15,s=40)=>{const i=nO(e.x,s,t.width-s)*n,r=nO(e.y,s,t.height-s)*n;return[i,r]},m1=(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)}),M_=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),g1=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),_f=(e,t=[0,0])=>{var i,r;const{x:n,y:s}=tA(e)?e.internals.positionAbsolute:hg(e,t);return{x:n,y:s,width:((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0,height:((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0}},tx=(e,t=[0,0])=>{var i,r;const{x:n,y:s}=tA(e)?e.internals.positionAbsolute:hg(e,t);return{x:n,y:s,x2:n+(((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0),y2:s+(((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0)}},a9=(e,t)=>g1(m1(M_(e),M_(t))),Cm=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},sO=e=>Sa(e.width)&&Sa(e.height)&&Sa(e.x)&&Sa(e.y),Sa=e=>!isNaN(e)&&isFinite(e),o9=(e,t)=>(n,s)=>{},mg=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),eh=({x:e,y:t},[n,s,i],r=!1,a=[1,1])=>{const l={x:(e-n)/i,y:(t-s)/i};return r?mg(l,a):l},Nf=({x:e,y:t},[n,s,i])=>({x:e*i+n,y:t*i+s});function qu(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 Bre(e,t,n){if(typeof e=="string"||typeof e=="number"){const s=qu(e,n),i=qu(e,t);return{top:s,right:i,bottom:s,left:i,x:i*2,y:s*2}}if(typeof e=="object"){const s=qu(e.top??e.y??0,n),i=qu(e.bottom??e.y??0,n),r=qu(e.left??e.x??0,t),a=qu(e.right??e.x??0,t);return{top:s,right:a,bottom:i,left:r,x:r+a,y:s+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Ure(e,t,n,s,i,r){const{x:a,y:l}=Nf(e,[t,n,s]),{x:c,y:u}=Nf({x:e.x+e.width,y:e.y+e.height},[t,n,s]),d=i-c,f=r-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}const iA=(e,t,n,s,i,r)=>{const a=Bre(r,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),d=Sf(u,s,i),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,m=n/2-h*d,b=Ure(e,p,m,d,t,n),v={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-v.left+v.right,y:m-v.top+v.bottom,zoom:d}},Im=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function du(e){return e!=null&&e!=="parent"}function il(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 rA(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 l9(e,t={width:0,height:0},n,s,i){const r={...e},a=s.get(n);if(a){const l=a.origin||i;r.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],r.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return r}function iO(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Fre(){let e,t;return{promise:new Promise((s,i)=>{e=s,t=i}),resolve:e,reject:t}}function $re(e){return{...e9,...e||{}}}function Fp(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:s,containerBounds:i}){const{x:r,y:a}=_a(e),l=eh({x:r-((i==null?void 0:i.left)??0),y:a-((i==null?void 0:i.top)??0)},s),{x:c,y:u}=n?mg(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const aA=e=>({width:e.offsetWidth,height:e.offsetHeight}),c9=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Hre=["INPUT","SELECT","TEXTAREA"];function u9(e){var s,i;const t=((i=(s=e.composedPath)==null?void 0:s.call(e))==null?void 0:i[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Hre.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const d9=e=>"clientX"in e,_a=(e,t)=>{var r,a;const n=d9(e),s=n?e.clientX:(r=e.touches)==null?void 0:r[0].clientX,i=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},rO=(e,t,n,s,i)=>{const r=t.querySelectorAll(`.${e}`);return!r||!r.length?null:Array.from(r).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/s,y:(l.top-n.top)/s,...aA(a)}})};function f9({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:i,sourceControlY:r,targetControlX:a,targetControlY:l}){const c=e*.125+i*.375+a*.375+n*.125,u=t*.125+r*.375+l*.375+s*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function U0(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function aO({pos:e,x1:t,y1:n,x2:s,y2:i,c:r}){switch(e){case Xe.Left:return[t-U0(t-s,r),n];case Xe.Right:return[t+U0(s-t,r),n];case Xe.Top:return[t,n-U0(n-i,r)];case Xe.Bottom:return[t,n+U0(i-n,r)]}}function h9({sourceX:e,sourceY:t,sourcePosition:n=Xe.Bottom,targetX:s,targetY:i,targetPosition:r=Xe.Top,curvature:a=.25}){const[l,c]=aO({pos:n,x1:e,y1:t,x2:s,y2:i,c:a}),[u,d]=aO({pos:r,x1:s,y1:i,x2:e,y2:t,c:a}),[f,h,p,m]=f9({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${l},${c} ${u},${d} ${s},${i}`,f,h,p,m]}function p9({sourceX:e,sourceY:t,targetX:n,targetY:s}){const i=Math.abs(n-e)/2,r=n0}const Gre=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`xy-edge__${e}${t||""}-${n}${s||""}`,Kre=(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)),qre=(e,t,n={})=>{var r;if(!e.source||!e.target)return(r=n.onError)==null||r.call(n,"006",Ca.error006()),t;const s=n.getEdgeId||Gre;let i;return s9(e)?i={...e}:i={...e,id:s(e)},Kre(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function m9({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[i,r,a,l]=p9({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,i,r,a,l]}const oO={[Xe.Left]:{x:-1,y:0},[Xe.Right]:{x:1,y:0},[Xe.Top]:{x:0,y:-1},[Xe.Bottom]:{x:0,y:1}},Yre=({source:e,sourcePosition:t=Xe.Bottom,target:n})=>t===Xe.Left||t===Xe.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Wre({source:e,sourcePosition:t=Xe.Bottom,target:n,targetPosition:s=Xe.Top,center:i,offset:r,stepPosition:a}){const l=oO[t],c=oO[s],u={x:e.x+l.x*r,y:e.y+l.y*r},d={x:n.x+c.x*r,y:n.y+c.y*r},f=Yre({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let m=[],b,v;const y={x:0,y:0},x={x:0,y:0},[,,E,w]=p9({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(b=i.x??u.x+(d.x-u.x)*a,v=i.y??(u.y+d.y)/2):(b=i.x??(u.x+d.x)/2,v=i.y??u.y+(d.y-u.y)*a);const T=[{x:b,y:u.y},{x:b,y:d.y}],C=[{x:u.x,y:v},{x:d.x,y:v}];l[h]===p?m=h==="x"?T:C:m=h==="x"?C:T}else{const T=[{x:u.x,y:d.y}],C=[{x:d.x,y:u.y}];if(h==="x"?m=l.x===p?C:T:m=l.y===p?T:C,t===s){const D=Math.abs(e[h]-n[h]);if(D<=r){const F=Math.min(r-1,r-D);l[h]===p?y[h]=(u[h]>e[h]?-1:1)*F:x[h]=(d[h]>n[h]?-1:1)*F}}if(t!==s){const D=h==="x"?"y":"x",F=l[h]===c[D],A=u[D]>d[D],M=u[D]=z?(b=(I.x+j.x)/2,v=m[0].y):(b=m[0].x,v=(I.y+j.y)/2)}const _={x:u.x+y.x,y:u.y+y.y},S={x:d.x+x.x,y:d.y+x.y};return[[e,..._.x!==m[0].x||_.y!==m[0].y?[_]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],b,v,E,w]}function Xre(e,t,n,s){const i=Math.min(lO(e,t)/2,lO(t,n)/2,s),{x:r,y:a}=t;if(e.x===r&&r===n.x||e.y===a&&a===n.y)return`L${r} ${a}`;if(e.y===a){const u=e.xn.id===t):e[0])||null}function L_(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`:""}function Zre(e,{id:t,defaultColor:n,defaultMarkerStart:s,defaultMarkerEnd:i}){const r=new Set;return e.reduce((a,l)=>([l.markerStart||s,l.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const u=L_(c,t);r.has(u)||(a.push({id:u,color:c.color||n,...c}),r.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const g9=1e3,Jre=10,oA={nodeOrigin:[0,0],nodeExtent:km,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},eae={...oA,checkEquality:!0};function lA(e,t){const n={...e};for(const s in t)t[s]!==void 0&&(n[s]=t[s]);return n}function tae(e,t,n){const s=lA(oA,n);for(const i of e.values())if(i.parentId)uA(i,e,t,s);else{const r=hg(i,s.nodeOrigin),a=du(i.extent)?i.extent:s.nodeExtent,l=uu(r,a,il(i));i.internals.positionAbsolute=l}}function nae(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],s=[];for(const i of e.handles){const r={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(r):i.type==="target"&&s.push(r)}return{source:n,target:s}}function cA(e){return e==="manual"}function D_(e,t,n,s={}){var d,f;const i=lA(eae,s),r={i:0},a=new Map(t),l=i!=null&&i.elevateNodesOnSelect&&!cA(i.zIndexMode)?g9:0;let c=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=hg(h,i.nodeOrigin),b=du(h.extent)?h.extent:i.nodeExtent,v=uu(m,b,il(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:v,handleBounds:nae(h,p),z:b9(h,l,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&&(c=!1),h.parentId&&uA(p,t,n,s,r),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function sae(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 uA(e,t,n,s,i){const{elevateNodesOnSelect:r,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=lA(oA,s),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}sae(e,n),i&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++i.i,d.internals.z=d.internals.z+i.i*Jre),i&&d.internals.rootParentIndex!==void 0&&(i.i=d.internals.rootParentIndex);const f=r&&!cA(c)?g9:0,{x:h,y:p,z:m}=iae(e,d,a,l,f,c),{positionAbsolute:b}=e.internals,v=h!==b.x||p!==b.y;(v||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:h,y:p}:b,z:m}})}function b9(e,t,n){const s=Sa(e.zIndex)?e.zIndex:0;return cA(n)?s:s+(e.selected?t:0)}function iae(e,t,n,s,i,r){const{x:a,y:l}=t.internals.positionAbsolute,c=il(e),u=hg(e,n),d=du(e.extent)?uu(u,e.extent,c):u;let f=uu({x:a+d.x,y:l+d.y},s,c);e.extent==="parent"&&(f=r9(f,c,t));const h=b9(e,i,r),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function dA(e,t,n,s=[0,0]){var a;const i=[],r=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((a=r.get(l.parentId))==null?void 0:a.expandedRect)??_f(c),d=a9(u,l.rect);r.set(l.parentId,{expandedRect:d,parent:c})}return r.size>0&&r.forEach(({expandedRect:l,parent:c},u)=>{var E;const d=c.internals.positionAbsolute,f=il(c),h=c.origin??s,p=l.x0||m>0||y||x)&&(i.push({id:u,type:"position",position:{x:c.position.x-p+y,y:c.position.y-m+x}}),(E=n.get(u))==null||E.forEach(w=>{e.some(_=>_.id===w.id)||i.push({id:w.id,type:"position",position:{x:w.position.x+p,y:w.position.y+m}})})),(f.width0){const p=dA(h,t,n,i);u.push(...p)}return{changes:u,updatedInternals:c}}async function aae({delta:e,panZoom:t,transform:n,translateExtent:s,width:i,height:r}){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,r]],s);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function fO(e,t,n,s,i,r){let a=i;const l=s.get(a)||new Map;s.set(a,l.set(n,t)),a=`${i}-${e}`;const c=s.get(a)||new Map;if(s.set(a,c.set(n,t)),r){a=`${i}-${e}-${r}`;const u=s.get(a)||new Map;s.set(a,u.set(n,t))}}function y9(e,t,n){e.clear(),t.clear();for(const s of n){const{source:i,target:r,sourceHandle:a=null,targetHandle:l=null}=s,c={edgeId:s.id,source:i,target:r,sourceHandle:a,targetHandle:l},u=`${i}-${a}--${r}-${l}`,d=`${r}-${l}--${i}-${a}`;fO("source",c,d,e,i,a),fO("target",c,u,e,r,l),t.set(s.id,s)}}function x9(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:x9(n,t):!1}function hO(e,t,n){var i;let s=e;do{if((i=s==null?void 0:s.matches)!=null&&i.call(s,t))return!0;if(s===n)return!1;s=s==null?void 0:s.parentElement}while(s);return!1}function oae(e,t,n,s){const i=new Map;for(const[r,a]of e)if((a.selected||a.id===s)&&(!a.parentId||!x9(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const l=e.get(r);l&&i.set(r,{id:r,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return i}function Fv({nodeId:e,dragItems:t,nodeLookup:n,dragging:s=!0}){var a,l,c;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:s})}if(!e)return[i[0],i];const r=(l=n.get(e))==null?void 0:l.internals.userNode;return[r?{...r,position:((c=t.get(e))==null?void 0:c.position)||r.position,dragging:s}:i[0],i]}function lae({dragItems:e,snapGrid:t,x:n,y:s}){const i=e.values().next().value;if(!i)return null;const r={x:n-i.distance.x,y:s-i.distance.y},a=mg(r,t);return{x:a.x-r.x,y:a.y-r.y}}function cae({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:s,onDragStop:i}){let r={x:null,y:null},a=0,l=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,m=!1,b=null;function v({noDragClassName:x,handleSelector:E,domNode:w,isSelectable:_,nodeId:S,nodeClickDistance:k=0}){h=vr(w);function T({x:L,y:z}){const{nodeLookup:D,nodeExtent:F,snapGrid:A,snapToGrid:M,nodeOrigin:P,onNodeDrag:H,onSelectionDrag:R,onError:Y,updateNodePositions:J}=t();r={x:L,y:z};let U=!1;const te=l.size>1,K=te&&F?M_(pg(l)):null,V=te&&M?lae({dragItems:l,snapGrid:A,x:L,y:z}):null;for(const[W,q]of l){if(!D.has(W))continue;let ue={x:L-q.distance.x,y:z-q.distance.y};M&&(ue=V?{x:Math.round(ue.x+V.x),y:Math.round(ue.y+V.y)}:mg(ue,A));let pe=null;if(te&&F&&!q.extent&&K){const{positionAbsolute:ge}=q.internals,Le=ge.x-K.x+F[0][0],Ee=ge.x+q.measured.width-K.x2+F[1][0],ie=ge.y-K.y+F[0][1],Ne=ge.y+q.measured.height-K.y2+F[1][1];pe=[[Le,ie],[Ee,Ne]]}const{position:we,positionAbsolute:de}=i9({nodeId:W,nextPosition:ue,nodeLookup:D,nodeExtent:pe||F,nodeOrigin:P,onError:Y});U=U||q.position.x!==we.x||q.position.y!==we.y,q.position=we,q.internals.positionAbsolute=de}if(m=m||U,!!U&&(J(l,!0),b&&(s||H||!S&&R))){const[W,q]=Fv({nodeId:S,dragItems:l,nodeLookup:D});s==null||s(b,l,W,q),H==null||H(b,W,q),S||R==null||R(b,q)}}async function C(){if(!d)return;const{transform:L,panBy:z,autoPanSpeed:D,autoPanOnNodeDrag:F}=t();if(!F){c=!1,cancelAnimationFrame(a);return}const[A,M]=sA(u,d,D);(A!==0||M!==0)&&(r.x=(r.x??0)-A/L[2],r.y=(r.y??0)-M/L[2],await z({x:A,y:M})&&T(r)),a=requestAnimationFrame(C)}function I(L){var te;const{nodeLookup:z,multiSelectionActive:D,nodesDraggable:F,transform:A,snapGrid:M,snapToGrid:P,selectNodesOnDrag:H,onNodeDragStart:R,onSelectionDragStart:Y,unselectNodesAndEdges:J}=t();f=!0,(!H||!_)&&!D&&S&&((te=z.get(S))!=null&&te.selected||J()),_&&H&&S&&(e==null||e(S));const U=Fp(L.sourceEvent,{transform:A,snapGrid:M,snapToGrid:P,containerBounds:d});if(r=U,l=oae(z,F,U,S),l.size>0&&(n||R||!S&&Y)){const[K,V]=Fv({nodeId:S,dragItems:l,nodeLookup:z});n==null||n(L.sourceEvent,l,K,V),R==null||R(L.sourceEvent,K,V),S||Y==null||Y(L.sourceEvent,V)}}const j=P8().clickDistance(k).on("start",L=>{const{domNode:z,nodeDragThreshold:D,transform:F,snapGrid:A,snapToGrid:M}=t();d=(z==null?void 0:z.getBoundingClientRect())||null,p=!1,m=!1,b=L.sourceEvent,D===0&&I(L),r=Fp(L.sourceEvent,{transform:F,snapGrid:A,snapToGrid:M,containerBounds:d}),u=_a(L.sourceEvent,d)}).on("drag",L=>{const{autoPanOnNodeDrag:z,transform:D,snapGrid:F,snapToGrid:A,nodeDragThreshold:M,nodeLookup:P}=t(),H=Fp(L.sourceEvent,{transform:D,snapGrid:F,snapToGrid:A,containerBounds:d});if(b=L.sourceEvent,(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1||S&&!P.has(S))&&(p=!0),!p){if(!c&&z&&f&&(c=!0,C()),!f){const R=_a(L.sourceEvent,d),Y=R.x-u.x,J=R.y-u.y;Math.sqrt(Y*Y+J*J)>M&&I(L)}(r.x!==H.xSnapped||r.y!==H.ySnapped)&&l&&f&&(u=_a(L.sourceEvent,d),T(H))}}).on("end",L=>{if(!f||p){p&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),l.size>0){const{nodeLookup:z,updateNodePositions:D,onNodeDragStop:F,onSelectionDragStop:A}=t();if(m&&(D(l,!1),m=!1),i||F||!S&&A){const[M,P]=Fv({nodeId:S,dragItems:l,nodeLookup:z,dragging:!1});i==null||i(L.sourceEvent,l,M,P),F==null||F(L.sourceEvent,M,P),S||A==null||A(L.sourceEvent,P)}}}).filter(L=>{const z=L.target;return!L.button&&(!x||!hO(z,`.${x}`,w))&&(!E||hO(z,E,w))});h.call(j)}function y(){h==null||h.on(".drag",null)}return{update:v,destroy:y}}function uae(e,t,n){const s=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const r of t.values())Cm(i,_f(r))>0&&s.push(r);return s}const dae=250;function fae(e,t,n,s){var l,c;let i=[],r=1/0;const a=uae(e,n,t+dae);for(const u of a){const d=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(s.nodeId===f.nodeId&&s.type===f.type&&s.id===f.id)continue;const{x:h,y:p}=fu(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=s.type==="source"?"target":"source";return i.find(d=>d.type===u)??i[0]}return i[0]}function E9(e,t,n,s,i,r=!1){var u,d,f;const a=s.get(e);if(!a)return null;const l=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)??[]],c=(n?l==null?void 0:l.find(h=>h.id===n):l==null?void 0:l[0])??null;return c&&r?{...c,...fu(a,c,c.position,!0)}:c}function v9(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function hae(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const w9=()=>!0;function pae(e,{connectionMode:t,connectionRadius:n,handleId:s,nodeId:i,edgeUpdaterType:r,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:m,onConnect:b,onConnectEnd:v,isValidConnection:y=w9,onReconnectEnd:x,updateConnection:E,getTransform:w,getFromHandle:_,autoPanSpeed:S,dragThreshold:k=1,handleDomNode:T}){const C=c9(e.target);let I=0,j;const{x:L,y:z}=_a(e),D=v9(r,T),F=l==null?void 0:l.getBoundingClientRect();let A=!1;if(!F||!D)return;const M=E9(i,D,s,c,t);if(!M)return;let P=_a(e,F),H=!1,R=null,Y=!1,J=null;function U(){if(!d||!F)return;const[we,de]=sA(P,F,S);h({x:we,y:de}),I=requestAnimationFrame(U)}const te={...M,nodeId:i,type:D,position:M.position},K=c.get(i);let W={inProgress:!0,isValid:null,from:fu(K,te,Xe.Left,!0),fromHandle:te,fromPosition:te.position,fromNode:K,to:P,toHandle:null,toPosition:tO[te.position],toNode:null,pointer:P};function q(){A=!0,E(W),m==null||m(e,{nodeId:i,handleId:s,handleType:D})}k===0&&q();function ue(we){if(!A){const{x:Ne,y:ve}=_a(we),Qe=Ne-L,De=ve-z;if(!(Qe*Qe+De*De>k*k))return;q()}if(!_()||!te){pe(we);return}const de=w();P=_a(we,F),j=fae(eh(P,de,!1,[1,1]),n,c,te),H||(U(),H=!0);const ge=S9(we,{handle:j,connectionMode:t,fromNodeId:i,fromHandleId:s,fromType:a?"target":"source",isValidConnection:y,doc:C,lib:u,flowId:f,nodeLookup:c});J=ge.handleDomNode,R=ge.connection,Y=hae(!!j,ge.isValid);const Le=c.get(i),Ee=Le?fu(Le,te,Xe.Left,!0):W.from,ie={...W,from:Ee,isValid:Y,to:ge.toHandle&&Y?Nf({x:ge.toHandle.x,y:ge.toHandle.y},de):P,toHandle:ge.toHandle,toPosition:Y&&ge.toHandle?ge.toHandle.position:tO[te.position],toNode:ge.toHandle?c.get(ge.toHandle.nodeId):null,pointer:P};E(ie),W=ie}function pe(we){if(!("touches"in we&&we.touches.length>0)){if(A){(j||J)&&R&&Y&&(b==null||b(R));const{inProgress:de,...ge}=W,Le={...ge,toPosition:W.toHandle?W.toPosition:null};v==null||v(we,Le),r&&(x==null||x(we,Le))}p(),cancelAnimationFrame(I),H=!1,Y=!1,R=null,J=null,C.removeEventListener("mousemove",ue),C.removeEventListener("mouseup",pe),C.removeEventListener("touchmove",ue),C.removeEventListener("touchend",pe)}}C.addEventListener("mousemove",ue),C.addEventListener("mouseup",pe),C.addEventListener("touchmove",ue),C.addEventListener("touchend",pe)}function S9(e,{handle:t,connectionMode:n,fromNodeId:s,fromHandleId:i,fromType:r,doc:a,lib:l,flowId:c,isValidConnection:u=w9,nodeLookup:d}){const f=r==="target",h=t?a.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:p,y:m}=_a(e),b=a.elementFromPoint(p,m),v=b!=null&&b.classList.contains(`${l}-flow__handle`)?b:h,y={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const x=v9(void 0,v),E=v.getAttribute("data-nodeid"),w=v.getAttribute("data-handleid"),_=v.classList.contains("connectable"),S=v.classList.contains("connectableend");if(!E||!x)return y;const k={source:f?E:s,sourceHandle:f?w:i,target:f?s:E,targetHandle:f?i:w};y.connection=k;const C=_&&S&&(n===vf.Strict?f&&x==="source"||!f&&x==="target":E!==s||w!==i);y.isValid=C&&u(k),y.toHandle=E9(E,x,w,d,n,!0)}return y}const P_={onPointerDown:pae,isValid:S9};function mae({domNode:e,panZoom:t,getTransform:n,getViewScale:s}){const i=vr(e);function r({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const m=E=>{if(E.sourceEvent.type!=="wheel"||!t)return;const w=n(),_=E.sourceEvent.ctrlKey&&Im()?10:1,S=-E.sourceEvent.deltaY*(E.sourceEvent.deltaMode===1?.05:E.sourceEvent.deltaMode?1:.002)*d,k=w[2]*Math.pow(2,S*_);t.scaleTo(k)};let b=[0,0];const v=E=>{(E.sourceEvent.type==="mousedown"||E.sourceEvent.type==="touchstart")&&(b=[E.sourceEvent.clientX??E.sourceEvent.touches[0].clientX,E.sourceEvent.clientY??E.sourceEvent.touches[0].clientY])},y=E=>{const w=n();if(E.sourceEvent.type!=="mousemove"&&E.sourceEvent.type!=="touchmove"||!t)return;const _=[E.sourceEvent.clientX??E.sourceEvent.touches[0].clientX,E.sourceEvent.clientY??E.sourceEvent.touches[0].clientY],S=[_[0]-b[0],_[1]-b[1]];b=_;const k=s()*Math.max(w[2],Math.log(w[2]))*(p?-1:1),T={x:w[0]-S[0]*k,y:w[1]-S[1]*k},C=[[0,0],[c,u]];t.setViewportConstrained({x:T.x,y:T.y,zoom:w[2]},C,l)},x=Z8().on("start",v).on("zoom",f?y:null).on("zoom.wheel",h?m:null);i.call(x,{})}function a(){i.on("zoom",null)}return{update:r,destroy:a,pointer:ba}}const b1=e=>({x:e.x,y:e.y,zoom:e.k}),$v=({x:e,y:t,zoom:n})=>p1.translate(e,t).scale(n),jd=(e,t)=>e.target.closest(`.${t}`),_9=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),gae=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Hv=(e,t=0,n=gae,s=()=>{})=>{const i=typeof t=="number"&&t>0;return i||s(),i?e.transition().duration(t).ease(n).on("end",s):e},N9=e=>{const t=e.ctrlKey&&Im()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function bae({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:s,panOnScrollMode:i,panOnScrollSpeed:r,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(jd(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const v=ba(d),y=N9(d),x=f*Math.pow(2,y);s.scaleTo(n,x,v,d);return}const h=d.deltaMode===1?20:1;let p=i===Qc.Vertical?0:d.deltaX*h,m=i===Qc.Horizontal?0:d.deltaY*h;!Im()&&d.shiftKey&&i!==Qc.Vertical&&(p=d.deltaY*h,m=0),s.translateBy(n,-(p/f)*r,-(m/f)*r,{internal:!0});const b=b1(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(d,b))}}function yae({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(s,i){const r=s.type==="wheel",a=!t&&r&&!s.ctrlKey,l=jd(s,e);if(s.ctrlKey&&r&&l&&s.preventDefault(),a||l)return null;s.preventDefault(),n.call(this,s,i)}}function xae({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return s=>{var r,a,l;if((r=s.sourceEvent)!=null&&r.internal)return;const i=b1(s.transform);e.mouseButton=((a=s.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((l=s.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(s.sourceEvent,i))}}function Eae({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:s,onPanZoom:i}){return r=>{var a,l;e.usedRightMouseButton=!!(n&&_9(t,e.mouseButton??0)),(a=r.sourceEvent)!=null&&a.sync||s([r.transform.x,r.transform.y,r.transform.k]),i&&!((l=r.sourceEvent)!=null&&l.internal)&&(i==null||i(r.sourceEvent,b1(r.transform)))}}function vae({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:s,onPanZoomEnd:i,onPaneContextMenu:r}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,r&&_9(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&r(a.sourceEvent),e.usedRightMouseButton=!1,s(!1),i)){const c=b1(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(a.sourceEvent,c)},n?150:0)}}}function wae({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:s,panOnScroll:i,zoomOnDoubleClick:r,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var v;const h=e||t,p=n&&f.ctrlKey,m=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(jd(f,`${u}-flow__node`)||jd(f,`${u}-flow__edge`)))return!0;if(!s&&!h&&!i&&!r&&!n||a||d&&!m||jd(f,l)&&m||jd(f,c)&&(!m||i&&m&&!e)||!n&&f.ctrlKey&&m)return!1;if(!n&&f.type==="touchstart"&&((v=f.touches)==null?void 0:v.length)>1)return f.preventDefault(),!1;if(!h&&!i&&!p&&m||!s&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(s)&&!s.includes(f.button)&&f.type==="mousedown")return!1;const b=Array.isArray(s)&&s.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||m)&&b}}function Sae({domNode:e,minZoom:t,maxZoom:n,translateExtent:s,viewport:i,onPanZoom:r,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=Z8().scaleExtent([t,n]).translateExtent(s),h=vr(e).call(f);x({x:i.x,y:i.y,zoom:Sf(i.zoom,t,n)},[[0,0],[d.width,d.height]],s);const p=h.on("wheel.zoom"),m=h.on("dblclick.zoom");f.wheelDelta(N9);async function b(j,L){return h?new Promise(z=>{f==null||f.interpolate((L==null?void 0:L.interpolate)==="linear"?Up:Ub).transform(Hv(h,L==null?void 0:L.duration,L==null?void 0:L.ease,()=>z(!0)),j)}):!1}function v({noWheelClassName:j,noPanClassName:L,onPaneContextMenu:z,userSelectionActive:D,panOnScroll:F,panOnDrag:A,panOnScrollMode:M,panOnScrollSpeed:P,preventScrolling:H,zoomOnPinch:R,zoomOnScroll:Y,zoomOnDoubleClick:J,zoomActivationKeyPressed:U,lib:te,onTransformChange:K,connectionInProgress:V,paneClickDistance:W,selectionOnDrag:q}){D&&!u.isZoomingOrPanning&&y();const ue=F&&!U&&!D;f.clickDistance(q?1/0:!Sa(W)||W<0?0:W);const pe=ue?bae({zoomPanValues:u,noWheelClassName:j,d3Selection:h,d3Zoom:f,panOnScrollMode:M,panOnScrollSpeed:P,zoomOnPinch:R,onPanZoomStart:a,onPanZoom:r,onPanZoomEnd:l}):yae({noWheelClassName:j,preventScrolling:H,d3ZoomHandler:p});h.on("wheel.zoom",pe,{passive:!1});const we=xae({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",we);const de=Eae({zoomPanValues:u,panOnDrag:A,onPaneContextMenu:!!z,onPanZoom:r,onTransformChange:K});f.on("zoom",de);const ge=vae({zoomPanValues:u,panOnDrag:A,panOnScroll:F,onPaneContextMenu:z,onPanZoomEnd:l,onDraggingChange:c});f.on("end",ge);const Le=wae({zoomActivationKeyPressed:U,panOnDrag:A,zoomOnScroll:Y,panOnScroll:F,zoomOnDoubleClick:J,zoomOnPinch:R,userSelectionActive:D,noPanClassName:L,noWheelClassName:j,lib:te,connectionInProgress:V});f.filter(Le),J?h.on("dblclick.zoom",m):h.on("dblclick.zoom",null)}function y(){f.on("zoom",null)}async function x(j,L,z){const D=$v(j),F=f==null?void 0:f.constrain()(D,L,z);return F&&await b(F),F}async function E(j,L){const z=$v(j);return await b(z,L),z}function w(j){if(h){const L=$v(j),z=h.property("__zoom");(z.k!==j.zoom||z.x!==j.x||z.y!==j.y)&&(f==null||f.transform(h,L,null,{sync:!0}))}}function _(){const j=h?Q8(h.node()):{x:0,y:0,k:1};return{x:j.x,y:j.y,zoom:j.k}}async function S(j,L){return h?new Promise(z=>{f==null||f.interpolate((L==null?void 0:L.interpolate)==="linear"?Up:Ub).scaleTo(Hv(h,L==null?void 0:L.duration,L==null?void 0:L.ease,()=>z(!0)),j)}):!1}async function k(j,L){return h?new Promise(z=>{f==null||f.interpolate((L==null?void 0:L.interpolate)==="linear"?Up:Ub).scaleBy(Hv(h,L==null?void 0:L.duration,L==null?void 0:L.ease,()=>z(!0)),j)}):!1}function T(j){f==null||f.scaleExtent(j)}function C(j){f==null||f.translateExtent(j)}function I(j){const L=!Sa(j)||j<0?0:j;f==null||f.clickDistance(L)}return{update:v,destroy:y,setViewport:E,setViewportConstrained:x,getViewport:_,scaleTo:S,scaleBy:k,setScaleExtent:T,setTranslateExtent:C,syncViewport:w,setClickDistance:I}}var Tf;(function(e){e.Line="line",e.Handle="handle"})(Tf||(Tf={}));function _ae({width:e,prevWidth:t,height:n,prevHeight:s,affectsX:i,affectsY:r}){const a=e-t,l=n-s,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&i&&(c[0]=c[0]*-1),l&&r&&(c[1]=c[1]*-1),c}function pO(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),s=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:s,affectsY:i}}function pl(e,t){return Math.max(0,t-e)}function ml(e,t){return Math.max(0,e-t)}function F0(e,t,n){return Math.max(0,t-e,e-n)}function mO(e,t){return e?!t:t}function Nae(e,t,n,s,i,r,a,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:m}=n,{minWidth:b,maxWidth:v,minHeight:y,maxHeight:x}=s,{x:E,y:w,width:_,height:S,aspectRatio:k}=e;let T=Math.floor(d?p-e.pointerX:0),C=Math.floor(f?m-e.pointerY:0);const I=_+(c?-T:T),j=S+(u?-C:C),L=-r[0]*_,z=-r[1]*S;let D=F0(I,b,v),F=F0(j,y,x);if(a){let P=0,H=0;c&&T<0?P=pl(E+T+L,a[0][0]):!c&&T>0&&(P=ml(E+I+L,a[1][0])),u&&C<0?H=pl(w+C+z,a[0][1]):!u&&C>0&&(H=ml(w+j+z,a[1][1])),D=Math.max(D,P),F=Math.max(F,H)}if(l){let P=0,H=0;c&&T>0?P=ml(E+T,l[0][0]):!c&&T<0&&(P=pl(E+I,l[1][0])),u&&C>0?H=ml(w+C,l[0][1]):!u&&C<0&&(H=pl(w+j,l[1][1])),D=Math.max(D,P),F=Math.max(F,H)}if(i){if(d){const P=F0(I/k,y,x)*k;if(D=Math.max(D,P),a){let H=0;!c&&!u||c&&!u&&h?H=ml(w+z+I/k,a[1][1])*k:H=pl(w+z+(c?T:-T)/k,a[0][1])*k,D=Math.max(D,H)}if(l){let H=0;!c&&!u||c&&!u&&h?H=pl(w+I/k,l[1][1])*k:H=ml(w+(c?T:-T)/k,l[0][1])*k,D=Math.max(D,H)}}if(f){const P=F0(j*k,b,v)/k;if(F=Math.max(F,P),a){let H=0;!c&&!u||u&&!c&&h?H=ml(E+j*k+L,a[1][0])/k:H=pl(E+(u?C:-C)*k+L,a[0][0])/k,F=Math.max(F,H)}if(l){let H=0;!c&&!u||u&&!c&&h?H=pl(E+j*k,l[1][0])/k:H=ml(E+(u?C:-C)*k,l[0][0])/k,F=Math.max(F,H)}}}C=C+(C<0?F:-F),T=T+(T<0?D:-D),i&&(h?I>j*k?C=(mO(c,u)?-T:T)/k:T=(mO(c,u)?-C:C)*k:d?(C=T/k,u=c):(T=C*k,c=u));const A=c?E+T:E,M=u?w+C:w;return{width:_+(c?-T:T),height:S+(u?-C:C),x:r[0]*T*(c?-1:1)+A,y:r[1]*C*(u?-1:1)+M}}const T9={width:0,height:0,x:0,y:0},Tae={...T9,pointerX:0,pointerY:0,aspectRatio:1};function kae(e,t,n){const s=t.position.x+e.position.x,i=t.position.y+e.position.y,r=e.measured.width??0,a=e.measured.height??0,l=n[0]*r,c=n[1]*a;return[[s-l,i-c],[s+r-l,i+a-c]]}function Aae({domNode:e,nodeId:t,getStoreItems:n,onChange:s,onEnd:i}){const r=vr(e);let a={controlDirection:pO("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:m,onResizeEnd:b,shouldResize:v}){let y={...T9},x={...Tae};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:pO(u)};let E,w=null,_=[],S,k,T,C=!1;const I=P8().on("start",j=>{const{nodeLookup:L,transform:z,snapGrid:D,snapToGrid:F,nodeOrigin:A,paneDomNode:M}=n();if(E=L.get(t),!E)return;w=(M==null?void 0:M.getBoundingClientRect())??null;const{xSnapped:P,ySnapped:H}=Fp(j.sourceEvent,{transform:z,snapGrid:D,snapToGrid:F,containerBounds:w});y={width:E.measured.width??0,height:E.measured.height??0,x:E.position.x??0,y:E.position.y??0},x={...y,pointerX:P,pointerY:H,aspectRatio:y.width/y.height},S=void 0,k=du(E.extent)?E.extent:void 0,E.parentId&&(E.extent==="parent"||E.expandParent)&&(S=L.get(E.parentId)),S&&E.extent==="parent"&&(k=[[0,0],[S.measured.width,S.measured.height]]),_=[],T=void 0;for(const[R,Y]of L)if(Y.parentId===t&&(_.push({id:R,position:{...Y.position},extent:Y.extent}),Y.extent==="parent"||Y.expandParent)){const J=kae(Y,E,Y.origin??A);T?T=[[Math.min(J[0][0],T[0][0]),Math.min(J[0][1],T[0][1])],[Math.max(J[1][0],T[1][0]),Math.max(J[1][1],T[1][1])]]:T=J}p==null||p(j,{...y})}).on("drag",j=>{const{transform:L,snapGrid:z,snapToGrid:D,nodeOrigin:F}=n(),A=Fp(j.sourceEvent,{transform:L,snapGrid:z,snapToGrid:D,containerBounds:w}),M=[];if(!E)return;const{x:P,y:H,width:R,height:Y}=y,J={},U=E.origin??F,{width:te,height:K,x:V,y:W}=Nae(x,a.controlDirection,A,a.boundaries,a.keepAspectRatio,U,k,T),q=te!==R,ue=K!==Y,pe=V!==P&&q,we=W!==H&&ue;if(!pe&&!we&&!q&&!ue)return;if((pe||we||U[0]===1||U[1]===1)&&(J.x=pe?V:y.x,J.y=we?W:y.y,y.x=J.x,y.y=J.y,_.length>0)){const Ee=V-P,ie=W-H;for(const Ne of _)Ne.position={x:Ne.position.x-Ee+U[0]*(te-R),y:Ne.position.y-ie+U[1]*(K-Y)},M.push(Ne)}if((q||ue)&&(J.width=q&&(!a.resizeDirection||a.resizeDirection==="horizontal")?te:y.width,J.height=ue&&(!a.resizeDirection||a.resizeDirection==="vertical")?K:y.height,y.width=J.width,y.height=J.height),S&&E.expandParent){const Ee=U[0]*(J.width??0);J.x&&J.x{C&&(b==null||b(j,{...y}),i==null||i({...y}),C=!1)});r.call(I)}function c(){r.on(".drag",null)}return{update:l,destroy:c}}var k9={exports:{}},A9={},C9={exports:{}},I9={};/** * @license React * use-sync-external-store-shim.production.js * @@ -508,7 +508,7 @@ ${f}`:d,children:[o.jsxs("span",{className:`account-avatar${b?" has-image":""}`, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Nf=g;function Nae(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Tae=typeof Object.is=="function"?Object.is:Nae,kae=Nf.useState,Aae=Nf.useEffect,Cae=Nf.useLayoutEffect,Iae=Nf.useDebugValue;function jae(e,t){var n=t(),s=kae({inst:{value:n,getSnapshot:t}}),i=s[0].inst,r=s[1];return Cae(function(){i.value=n,i.getSnapshot=t,Fv(i)&&r({inst:i})},[e,n,t]),Aae(function(){return Fv(i)&&r({inst:i}),e(function(){Fv(i)&&r({inst:i})})},[e]),Iae(n),n}function Fv(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Tae(e,n)}catch{return!0}}function Rae(e,t){return t()}var Oae=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Rae:jae;T9.useSyncExternalStore=Nf.useSyncExternalStore!==void 0?Nf.useSyncExternalStore:Oae;N9.exports=T9;var Mae=N9.exports;/** + */var kf=g;function Cae(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Iae=typeof Object.is=="function"?Object.is:Cae,jae=kf.useState,Rae=kf.useEffect,Oae=kf.useLayoutEffect,Mae=kf.useDebugValue;function Lae(e,t){var n=t(),s=jae({inst:{value:n,getSnapshot:t}}),i=s[0].inst,r=s[1];return Oae(function(){i.value=n,i.getSnapshot=t,zv(i)&&r({inst:i})},[e,n,t]),Rae(function(){return zv(i)&&r({inst:i}),e(function(){zv(i)&&r({inst:i})})},[e]),Mae(n),n}function zv(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Iae(e,n)}catch{return!0}}function Dae(e,t){return t()}var Pae=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Dae:Lae;I9.useSyncExternalStore=kf.useSyncExternalStore!==void 0?kf.useSyncExternalStore:Pae;C9.exports=I9;var Bae=C9.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -516,76 +516,76 @@ ${f}`:d,children:[o.jsxs("span",{className:`account-avatar${b?" has-image":""}`, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var g1=g,Lae=Mae;function Dae(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Pae=typeof Object.is=="function"?Object.is:Dae,Bae=Lae.useSyncExternalStore,Uae=g1.useRef,Fae=g1.useEffect,$ae=g1.useMemo,Hae=g1.useDebugValue;_9.useSyncExternalStoreWithSelector=function(e,t,n,s,i){var r=Uae(null);if(r.current===null){var a={hasValue:!1,value:null};r.current=a}else a=r.current;r=$ae(function(){function c(p){if(!u){if(u=!0,d=p,p=s(p),i!==void 0&&a.hasValue){var m=a.value;if(i(m,p))return f=m}return f=p}if(m=f,Pae(d,p))return m;var b=s(p);return i!==void 0&&i(m,b)?(d=p,m):(d=p,f=b)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,s,i]);var l=Bae(e,r[0],r[1]);return Fae(function(){a.hasValue=!0,a.value=l},[l]),Hae(l),l};S9.exports=_9;var zae=S9.exports;const Vae=Df(zae),Gae={},fO=e=>{let t;const n=new Set,s=(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,c={setState:s,getState:i,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(Gae?"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(s,i,c);return c},Kae=e=>e?fO(e):fO,{useDebugValue:qae}=Bt,{useSyncExternalStoreWithSelector:Yae}=Vae,Wae=e=>e;function k9(e,t=Wae,n){const s=Yae(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return qae(s),s}const hO=(e,t)=>{const n=Kae(e),s=(i,r=t)=>k9(n,i,r);return Object.assign(s,n),s},Xae=(e,t)=>e?hO(e,t):hO;function ms(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[s,i]of e)if(!Object.is(i,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}const b1=g.createContext(null),Qae=b1.Provider,A9=Ia.error001("react");function Qt(e,t){const n=g.useContext(b1);if(n===null)throw new Error(A9);return k9(n,e,t)}function gs(){const e=g.useContext(b1);if(e===null)throw new Error(A9);return g.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const pO={display:"none"},Zae={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},C9="react-flow__node-desc",I9="react-flow__edge-desc",Jae="react-flow__aria-live",eoe=e=>e.ariaLiveMessage,toe=e=>e.ariaLabelConfig;function noe({rfId:e}){const t=Qt(eoe);return o.jsx("div",{id:`${Jae}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Zae,children:t})}function soe({rfId:e,disableKeyboardA11y:t}){const n=Qt(toe);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${C9}-${e}`,style:pO,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${I9}-${e}`,style:pO,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(noe,{rfId:e})]})}const y1=g.forwardRef(({position:e="top-left",children:t,className:n,style:s,...i},r)=>{const a=`${e}`.split("-");return o.jsx("div",{className:Zs(["react-flow__panel",n,...a]),style:s,ref:r,...i,children:t})});y1.displayName="Panel";function ioe({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(y1,{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:o.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const roe=e=>{const t=[],n=[];for(const[,s]of e.nodeLookup)s.selected&&t.push(s.internals.userNode);for(const[,s]of e.edgeLookup)s.selected&&n.push(s);return{selectedNodes:t,selectedEdges:n}},U0=e=>e.id;function aoe(e,t){return ms(e.selectedNodes.map(U0),t.selectedNodes.map(U0))&&ms(e.selectedEdges.map(U0),t.selectedEdges.map(U0))}function ooe({onSelectionChange:e}){const t=gs(),{selectedNodes:n,selectedEdges:s}=Qt(roe,aoe);return g.useEffect(()=>{const i={nodes:n,edges:s};e==null||e(i),t.getState().onSelectionChangeHandlers.forEach(r=>r(i))},[n,s,e]),null}const loe=e=>!!e.onSelectionChangeHandlers;function coe({onSelectionChange:e}){const t=Qt(loe);return e||t?o.jsx(ooe,{onSelectionChange:e}):null}const j9=[0,0],uoe={x:0,y:0,zoom:1},doe=["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"],mO=[...doe,"rfId"],foe=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}),gO={translateExtent:Am,nodeOrigin:j9,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function hoe(e){const{setNodes:t,setEdges:n,setMinZoom:s,setMaxZoom:i,setTranslateExtent:r,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Qt(foe,ms),u=gs();g.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=gO,l()}),[]);const d=g.useRef(gO);return g.useEffect(()=>{for(const f of mO){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?s(h):f==="maxZoom"?i(h):f==="translateExtent"?r(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:Pre(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},mO.map(f=>e[f])),null}function bO(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function poe(e){var s;const[t,n]=g.useState(e==="system"?null:e);return g.useEffect(()=>{if(e!=="system"){n(e);return}const i=bO(),r=()=>n(i!=null&&i.matches?"dark":"light");return r(),i==null||i.addEventListener("change",r),()=>{i==null||i.removeEventListener("change",r)}},[e]),t!==null?t:(s=bO())!=null&&s.matches?"dark":"light"}const yO=typeof document<"u"?document:null;function Rm(e=null,t={target:yO,actInsideInputWithModifier:!0}){const[n,s]=g.useState(!1),i=g.useRef(!1),r=g.useRef(new Set([])),[a,l]=g.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` + */var y1=g,Uae=Bae;function Fae(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var $ae=typeof Object.is=="function"?Object.is:Fae,Hae=Uae.useSyncExternalStore,zae=y1.useRef,Vae=y1.useEffect,Gae=y1.useMemo,Kae=y1.useDebugValue;A9.useSyncExternalStoreWithSelector=function(e,t,n,s,i){var r=zae(null);if(r.current===null){var a={hasValue:!1,value:null};r.current=a}else a=r.current;r=Gae(function(){function c(p){if(!u){if(u=!0,d=p,p=s(p),i!==void 0&&a.hasValue){var m=a.value;if(i(m,p))return f=m}return f=p}if(m=f,$ae(d,p))return m;var b=s(p);return i!==void 0&&i(m,b)?(d=p,m):(d=p,f=b)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,s,i]);var l=Hae(e,r[0],r[1]);return Vae(function(){a.hasValue=!0,a.value=l},[l]),Kae(l),l};k9.exports=A9;var qae=k9.exports;const Yae=Bf(qae),Wae={},gO=e=>{let t;const n=new Set,s=(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,c={setState:s,getState:i,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(Wae?"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(s,i,c);return c},Xae=e=>e?gO(e):gO,{useDebugValue:Qae}=Ft,{useSyncExternalStoreWithSelector:Zae}=Yae,Jae=e=>e;function j9(e,t=Jae,n){const s=Zae(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Qae(s),s}const bO=(e,t)=>{const n=Xae(e),s=(i,r=t)=>j9(n,i,r);return Object.assign(s,n),s},eoe=(e,t)=>e?bO(e,t):bO;function ds(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[s,i]of e)if(!Object.is(i,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}const x1=g.createContext(null),toe=x1.Provider,R9=Ca.error001("react");function en(e,t){const n=g.useContext(x1);if(n===null)throw new Error(R9);return j9(n,e,t)}function fs(){const e=g.useContext(x1);if(e===null)throw new Error(R9);return g.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const yO={display:"none"},noe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},O9="react-flow__node-desc",M9="react-flow__edge-desc",soe="react-flow__aria-live",ioe=e=>e.ariaLiveMessage,roe=e=>e.ariaLabelConfig;function aoe({rfId:e}){const t=en(ioe);return o.jsx("div",{id:`${soe}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:noe,children:t})}function ooe({rfId:e,disableKeyboardA11y:t}){const n=en(roe);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${O9}-${e}`,style:yO,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${M9}-${e}`,style:yO,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(aoe,{rfId:e})]})}const E1=g.forwardRef(({position:e="top-left",children:t,className:n,style:s,...i},r)=>{const a=`${e}`.split("-");return o.jsx("div",{className:Zs(["react-flow__panel",n,...a]),style:s,ref:r,...i,children:t})});E1.displayName="Panel";function loe({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(E1,{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:o.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const coe=e=>{const t=[],n=[];for(const[,s]of e.nodeLookup)s.selected&&t.push(s.internals.userNode);for(const[,s]of e.edgeLookup)s.selected&&n.push(s);return{selectedNodes:t,selectedEdges:n}},$0=e=>e.id;function uoe(e,t){return ds(e.selectedNodes.map($0),t.selectedNodes.map($0))&&ds(e.selectedEdges.map($0),t.selectedEdges.map($0))}function doe({onSelectionChange:e}){const t=fs(),{selectedNodes:n,selectedEdges:s}=en(coe,uoe);return g.useEffect(()=>{const i={nodes:n,edges:s};e==null||e(i),t.getState().onSelectionChangeHandlers.forEach(r=>r(i))},[n,s,e]),null}const foe=e=>!!e.onSelectionChangeHandlers;function hoe({onSelectionChange:e}){const t=en(foe);return e||t?o.jsx(doe,{onSelectionChange:e}):null}const L9=[0,0],poe={x:0,y:0,zoom:1},moe=["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"],xO=[...moe,"rfId"],goe=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}),EO={translateExtent:km,nodeOrigin:L9,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function boe(e){const{setNodes:t,setEdges:n,setMinZoom:s,setMaxZoom:i,setTranslateExtent:r,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=en(goe,ds),u=fs();g.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=EO,l()}),[]);const d=g.useRef(EO);return g.useEffect(()=>{for(const f of xO){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?s(h):f==="maxZoom"?i(h):f==="translateExtent"?r(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:$re(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},xO.map(f=>e[f])),null}function vO(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function yoe(e){var s;const[t,n]=g.useState(e==="system"?null:e);return g.useEffect(()=>{if(e!=="system"){n(e);return}const i=vO(),r=()=>n(i!=null&&i.matches?"dark":"light");return r(),i==null||i.addEventListener("change",r),()=>{i==null||i.removeEventListener("change",r)}},[e]),t!==null?t:(s=vO())!=null&&s.matches?"dark":"light"}const wO=typeof document<"u"?document:null;function jm(e=null,t={target:wO,actInsideInputWithModifier:!0}){const[n,s]=g.useState(!1),i=g.useRef(!1),r=g.useRef(new Set([])),[a,l]=g.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 g.useEffect(()=>{const c=(t==null?void 0:t.target)??yO,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var v,y;if(i.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!i.current||i.current&&!u)&&a9(p))return!1;const b=EO(p.code,l);if(r.current.add(p[b]),xO(a,r.current,!1)){const x=((y=(v=p.composedPath)==null?void 0:v.call(p))==null?void 0:y[0])||p.target,E=(x==null?void 0:x.nodeName)==="BUTTON"||(x==null?void 0:x.nodeName)==="A";t.preventDefault!==!1&&(i.current||!E)&&p.preventDefault(),s(!0)}},f=p=>{const m=EO(p.code,l);xO(a,r.current,!0)?(s(!1),r.current.clear()):r.current.delete(p[m]),p.key==="Meta"&&r.current.clear(),i.current=!1},h=()=>{r.current.clear(),s(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,s]),n}function xO(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(i=>t.has(i)))}function EO(e,t){return t.includes(e)?"code":"key"}const moe=()=>{const e=gs();return g.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:s}=e.getState();return s?s.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[s,i,r],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??s,y:t.y??i,zoom:t.zoom??r},n),!0):!1},getViewport:()=>{const[t,n,s]=e.getState().transform;return{x:t,y:n,zoom:s}},setCenter:async(t,n,s)=>e.getState().setCenter(t,n,s),fitBounds:async(t,n)=>{const{width:s,height:i,minZoom:r,maxZoom:a,panZoom:l}=e.getState(),c=eA(t,s,i,r,a,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(c,{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:s,snapGrid:i,snapToGrid:r,domNode:a}=e.getState();if(!a)return t;const{x:l,y:c}=a.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},d=n.snapGrid??i,f=n.snapToGrid??r;return Zf(u,s,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:s}=e.getState();if(!s)return t;const{x:i,y:r}=s.getBoundingClientRect(),a=Sf(t,n);return{x:a.x+i,y:a.y+r}}}),[])};function R9(e,t){const n=[],s=new Map,i=[];for(const r of e)if(r.type==="add"){i.push(r);continue}else if(r.type==="remove"||r.type==="replace")s.set(r.id,[r]);else{const a=s.get(r.id);a?a.push(r):s.set(r.id,[r])}for(const r of t){const a=s.get(r.id);if(!a){n.push(r);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const l={...r};for(const c of a)goe(c,l);n.push(l)}return i.length&&i.forEach(r=>{r.index!==void 0?n.splice(r.index,0,{...r.item}):n.push({...r.item})}),n}function goe(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 O9(e,t){return R9(e,t)}function M9(e,t){return R9(e,t)}function Ic(e,t){return{id:e,type:"select",selected:t}}function Id(e,t=new Set,n=!1){const s=[];for(const[i,r]of e){const a=t.has(i);!(r.selected===void 0&&!a)&&r.selected!==a&&(n&&(r.selected=a),s.push(Ic(r.id,a)))}return s}function vO({items:e=[],lookup:t}){var i;const n=[],s=new Map(e.map(r=>[r.id,r]));for(const[r,a]of e.entries()){const l=t.get(a.id),c=((i=l==null?void 0:l.internals)==null?void 0:i.userNode)??l;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:r})}for(const[r]of t)s.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function wO(e){return{id:e.id,type:"remove"}}const boe=s9();function L9(e,t,n={}){return zre(e,t,{...n,onError:n.onError??boe})}const SO=e=>Are(e),yoe=e=>J8(e);function D9(e){return g.forwardRef(e)}const xoe=typeof window<"u"?g.useLayoutEffect:g.useEffect;function _O(e){const[t,n]=g.useState(BigInt(0)),[s]=g.useState(()=>Eoe(()=>n(i=>i+BigInt(1))));return xoe(()=>{const i=s.get();i.length&&(e(i),s.reset())},[t]),s}function Eoe(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const P9=g.createContext(null);function voe({children:e}){const t=gs(),n=g.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:m}=t.getState();let b=c;for(const y of l)b=typeof y=="function"?y(b):y;let v=vO({items:b,lookup:h});for(const y of m.values())v=y(v);d&&u(b),v.length>0?f==null||f(v):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:x,setNodes:E}=t.getState();y&&E(x)})},[]),s=_O(n),i=g.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const m of l)p=typeof m=="function"?m(p):m;d?u(p):f&&f(vO({items:p,lookup:h}))},[]),r=_O(i),a=g.useMemo(()=>({nodeQueue:s,edgeQueue:r}),[]);return o.jsx(P9.Provider,{value:a,children:e})}function woe(){const e=g.useContext(P9);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Soe=e=>!!e.panZoom;function x1(){const e=moe(),t=gs(),n=woe(),s=Qt(Soe),i=g.useMemo(()=>{const r=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var y,x;const{nodeLookup:h,nodeOrigin:p}=t.getState(),m=SO(f)?f:h.get(f.id),b=m.parentId?i9(m.position,m.measured,m.parentId,h,p):m.position,v={...m,position:b,width:((y=m.measured)==null?void 0:y.width)??m.width,height:((x=m.measured)==null?void 0:x.height)??m.height};return wf(v)},u=(f,h,p={replace:!1})=>{a(m=>m.map(b=>{if(b.id===f){const v=typeof h=="function"?h(b):h;return p.replace&&SO(v)?v:{...b,...v}}return b}))},d=(f,h,p={replace:!1})=>{l(m=>m.map(b=>{if(b.id===f){const v=typeof h=="function"?h(b):h;return p.replace&&yoe(v)?v:{...b,...v}}return b}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=r(f))==null?void 0:h.internals.userNode},getInternalNode:r,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:l,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,v]=p;return{nodes:f.map(y=>({...y})),edges:h.map(y=>({...y})),viewport:{x:m,y:b,zoom:v}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:m,onNodesDelete:b,onEdgesDelete:v,triggerNodeChanges:y,triggerEdgeChanges:x,onDelete:E,onBeforeDelete:w}=t.getState(),{nodes:_,edges:S}=await Ore({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:m,onBeforeDelete:w}),k=S.length>0,T=_.length>0;if(k){const C=S.map(wO);v==null||v(S),x(C)}if(T){const C=_.map(wO);b==null||b(_),y(C)}return(T||k)&&(E==null||E({nodes:_,edges:S})),{deletedNodes:_,deletedEdges:S}},getIntersectingNodes:(f,h=!0,p)=>{const m=JR(f),b=m?f:c(f),v=p!==void 0;return b?(p||t.getState().nodes).filter(y=>{const x=t.getState().nodeLookup.get(y.id);if(x&&!m&&(y.id===f.id||!x.internals.positionAbsolute))return!1;const E=wf(v?y:x),w=Im(E,b);return h&&w>0||w>=E.width*E.height||w>=b.width*b.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const b=JR(f)?f:c(f);if(!b)return!1;const v=Im(b,h);return p&&v>0||v>=h.width*h.height||v>=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 Cre(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??Dre();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return g.useMemo(()=>({...i,...e,viewportInitialized:s}),[s])}const NO=e=>e.selected,_oe=typeof window<"u"?window:void 0;function Noe({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=gs(),{deleteElements:s}=x1(),i=Rm(e,{actInsideInputWithModifier:!1}),r=Rm(t,{target:_oe});g.useEffect(()=>{if(i){const{edges:a,nodes:l}=n.getState();s({nodes:l.filter(NO),edges:a.filter(NO)}),n.setState({nodesSelectionActive:!1})}},[i]),g.useEffect(()=>{n.setState({multiSelectionActive:r})},[r])}function Toe(e){const t=gs();g.useEffect(()=>{const n=()=>{var i,r,a,l;if(!e.current||!(((r=(i=e.current).checkVisibility)==null?void 0:r.call(i))??!0))return!1;const s=nA(e.current);(s.height===0||s.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Ia.error004())),t.setState({width:s.width||500,height:s.height||500})};if(e.current){n(),window.addEventListener("resize",n);const s=new ResizeObserver(()=>n());return s.observe(e.current),()=>{window.removeEventListener("resize",n),s&&e.current&&s.unobserve(e.current)}}},[])}const E1={position:"absolute",width:"100%",height:"100%",top:0,left:0},koe=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Aoe({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:s=!1,panOnScrollSpeed:i=.5,panOnScrollMode:r=Xc.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:m,noWheelClassName:b,noPanClassName:v,onViewportChange:y,isControlledViewport:x,paneClickDistance:E,selectionOnDrag:w}){const _=gs(),S=g.useRef(null),{userSelectionActive:k,lib:T,connectionInProgress:C}=Qt(koe,ms),I=Rm(h),j=g.useRef();Toe(S);const L=g.useCallback(z=>{y==null||y({x:z[0],y:z[1],zoom:z[2]}),x||_.setState({transform:z})},[y,x]);return g.useEffect(()=>{if(S.current){j.current=xae({domNode:S.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:A=>_.setState(O=>O.paneDragging===A?O:{paneDragging:A}),onPanZoomStart:(A,O)=>{const{onViewportChangeStart:P,onMoveStart:$}=_.getState();$==null||$(A,O),P==null||P(O)},onPanZoom:(A,O)=>{const{onViewportChange:P,onMove:$}=_.getState();$==null||$(A,O),P==null||P(O)},onPanZoomEnd:(A,O)=>{const{onViewportChangeEnd:P,onMoveEnd:$}=_.getState();$==null||$(A,O),P==null||P(O)}});const{x:z,y:D,zoom:F}=j.current.getViewport();return _.setState({panZoom:j.current,transform:[z,D,F],domNode:S.current.closest(".react-flow")}),()=>{var A;(A=j.current)==null||A.destroy()}}},[]),g.useEffect(()=>{var z;(z=j.current)==null||z.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:s,panOnScrollSpeed:i,panOnScrollMode:r,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:I,preventScrolling:p,noPanClassName:v,userSelectionActive:k,noWheelClassName:b,lib:T,onTransformChange:L,connectionInProgress:C,selectionOnDrag:w,paneClickDistance:E})},[e,t,n,s,i,r,a,l,I,p,v,k,b,T,L,C,w,E]),o.jsx("div",{className:"react-flow__renderer",ref:S,style:E1,children:m})}const Coe=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Ioe(){const{userSelectionActive:e,userSelectionRect:t}=Qt(Coe,ms);return e&&t?o.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 $v=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},joe=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Roe({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Cm.Full,panOnDrag:s,autoPanOnSelection:i,paneClickDistance:r,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:m,children:b}){const v=g.useRef(0),y=gs(),{userSelectionActive:x,elementsSelectable:E,dragging:w,connectionInProgress:_,panBy:S,autoPanSpeed:k}=Qt(joe,ms),T=E&&(e||x),C=g.useRef(null),I=g.useRef(),j=g.useRef(new Set),L=g.useRef(new Set),z=g.useRef(!1),D=g.useRef({x:0,y:0}),F=g.useRef(!1),A=q=>{if(z.current||_){z.current=!1;return}u==null||u(q),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},O=q=>{if(Array.isArray(s)&&(s!=null&&s.includes(2))){q.preventDefault();return}d==null||d(q)},P=f?q=>f(q):void 0,$=q=>{z.current&&(q.stopPropagation(),z.current=!1)},R=q=>{var ke,we;const{domNode:ue,transform:me}=y.getState();if(I.current=ue==null?void 0:ue.getBoundingClientRect(),!I.current)return;const Se=q.target===C.current;if(!Se&&!!q.target.closest(".nokey")||!e||!(a&&Se||t)||q.button!==0||!q.isPrimary)return;(we=(ke=q.target)==null?void 0:ke.setPointerCapture)==null||we.call(ke,q.pointerId),z.current=!1;const{x:Me,y:ve}=Na(q.nativeEvent,I.current),re=Zf({x:Me,y:ve},me);y.setState({userSelectionRect:{width:0,height:0,startX:re.x,startY:re.y,x:Me,y:ve}}),Se||(q.stopPropagation(),q.preventDefault())};function Y(q,ue){const{userSelectionRect:me}=y.getState();if(!me)return;const{transform:Se,nodeLookup:de,edgeLookup:ge,connectionLookup:Me,triggerNodeChanges:ve,triggerEdgeChanges:re,defaultEdgeOptions:ke}=y.getState(),we={x:me.startX,y:me.startY},{x:Je,y:Le}=Sf(we,Se),Ve={startX:we.x,startY:we.y,x:qqe.id)),L.current=new Set;const Pe=(ke==null?void 0:ke.selectable)??!0;for(const qe of j.current){const Z=Me.get(qe);if(Z)for(const{edgeId:ae}of Z.values()){const ne=ge.get(ae);ne&&(ne.selectable??Pe)&&L.current.add(ae)}}if(!eO(_e,j.current)){const qe=Id(de,j.current,!0);ve(qe)}if(!eO(He,L.current)){const qe=Id(ge,L.current);re(qe)}y.setState({userSelectionRect:Ve,userSelectionActive:!0,nodesSelectionActive:!1})}function J(){if(!i||!I.current)return;const[q,ue]=Jk(D.current,I.current,k);S({x:q,y:ue}).then(me=>{if(!z.current||!me){v.current=requestAnimationFrame(J);return}const{x:Se,y:de}=D.current;Y(Se,de),v.current=requestAnimationFrame(J)})}const U=()=>{cancelAnimationFrame(v.current),v.current=0,F.current=!1};g.useEffect(()=>()=>U(),[]);const te=q=>{const{userSelectionRect:ue,transform:me,resetSelectedElements:Se}=y.getState();if(!I.current||!ue)return;const{x:de,y:ge}=Na(q.nativeEvent,I.current);D.current={x:de,y:ge};const Me=Sf({x:ue.startX,y:ue.startY},me);if(!z.current){const ve=t?0:r;if(Math.hypot(de-Me.x,ge-Me.y)<=ve)return;Se(),l==null||l(q)}z.current=!0,F.current||(J(),F.current=!0),Y(de,ge)},K=q=>{var ue,me;q.button===0&&((me=(ue=q.target)==null?void 0:ue.releasePointerCapture)==null||me.call(ue,q.pointerId),!x&&q.target===C.current&&y.getState().userSelectionRect&&(A==null||A(q)),y.setState({userSelectionActive:!1,userSelectionRect:null}),z.current&&(c==null||c(q),y.setState({nodesSelectionActive:j.current.size>0})),U())},V=q=>{var ue,me;(me=(ue=q.target)==null?void 0:ue.releasePointerCapture)==null||me.call(ue,q.pointerId),U()},W=s===!0||Array.isArray(s)&&s.includes(0);return o.jsxs("div",{className:Zs(["react-flow__pane",{draggable:W,dragging:w,selection:e}]),onClick:T?void 0:$v(A,C),onContextMenu:$v(O,C),onWheel:$v(P,C),onPointerEnter:T?void 0:h,onPointerMove:T?te:p,onPointerUp:T?K:void 0,onPointerCancel:T?V:void 0,onPointerDownCapture:T?R:void 0,onClickCapture:T?$:void 0,onPointerLeave:m,ref:C,style:E1,children:[b,o.jsx(Ioe,{})]})}function M_({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:i,unselectNodesAndEdges:r,multiSelectionActive:a,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",Ia.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(r({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=s==null?void 0:s.current)==null?void 0:d.blur()})):i([e])}function B9({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:i,isSelectable:r,nodeClickDistance:a}){const l=gs(),[c,u]=g.useState(!1),d=g.useRef();return g.useEffect(()=>{d.current=rae({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{M_({id:f,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),g.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:s,domNode:e.current,isSelectable:r,nodeId:i,nodeClickDistance:a}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,s,t,r,e,i,a]),c}const Ooe=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function U9(){const e=gs();return g.useCallback(n=>{const{nodeExtent:s,snapToGrid:i,snapGrid:r,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=Ooe(a),p=i?r[0]:5,m=i?r[1]:5,b=n.direction.x*p*n.factor,v=n.direction.y*m*n.factor;for(const[,y]of u){if(!h(y))continue;let x={x:y.internals.positionAbsolute.x+b,y:y.internals.positionAbsolute.y+v};i&&(x=gg(x,r));const{position:E,positionAbsolute:w}=e9({nodeId:y.id,nextPosition:x,nodeLookup:u,nodeExtent:s,nodeOrigin:d,onError:l});y.position=E,y.internals.positionAbsolute=w,f.set(y.id,y)}c(f)},[])}const lA=g.createContext(null),Moe=lA.Provider;lA.Consumer;const F9=()=>g.useContext(lA),Loe=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Doe=(e,t,n)=>s=>{const{connectionClickStartHandle:i,connectionMode:r,connection:a}=s,{fromHandle:l,toHandle:c,isValid:u}=a,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.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:r===xf.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!i,valid:d&&u}};function Poe({type:e="source",position:t=Xe.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:i=!0,isConnectableEnd:r=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var F,A;const m=a||null,b=e==="target",v=gs(),y=F9(),{connectOnClick:x,noPanClassName:E,rfId:w}=Qt(Loe,ms),{connectingFrom:_,connectingTo:S,clickConnecting:k,isPossibleEndHandle:T,connectionInProcess:C,clickConnectionInProcess:I,valid:j}=Qt(Doe(y,m,e),ms);y||(A=(F=v.getState()).onError)==null||A.call(F,"010",Ia.error010());const L=O=>{const{defaultEdgeOptions:P,onConnect:$,hasDefaultEdges:R}=v.getState(),Y={...P,...O};if(R){const{edges:J,setEdges:U,onError:te}=v.getState();U(L9(Y,J,{onError:te}))}$==null||$(Y),l==null||l(Y)},z=O=>{if(!y)return;const P=o9(O.nativeEvent);if(i&&(P&&O.button===0||!P)){const $=v.getState();O_.onPointerDown(O.nativeEvent,{handleDomNode:O.currentTarget,autoPanOnConnect:$.autoPanOnConnect,connectionMode:$.connectionMode,connectionRadius:$.connectionRadius,domNode:$.domNode,nodeLookup:$.nodeLookup,lib:$.lib,isTarget:b,handleId:m,nodeId:y,flowId:$.rfId,panBy:$.panBy,cancelConnection:$.cancelConnection,onConnectStart:$.onConnectStart,onConnectEnd:(...R)=>{var Y,J;return(J=(Y=v.getState()).onConnectEnd)==null?void 0:J.call(Y,...R)},updateConnection:$.updateConnection,onConnect:L,isValidConnection:n||((...R)=>{var Y,J;return((J=(Y=v.getState()).isValidConnection)==null?void 0:J.call(Y,...R))??!0}),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:$.autoPanSpeed,dragThreshold:$.connectionDragThreshold})}P?d==null||d(O):f==null||f(O)},D=O=>{const{onClickConnectStart:P,onClickConnectEnd:$,connectionClickStartHandle:R,connectionMode:Y,isValidConnection:J,lib:U,rfId:te,nodeLookup:K,connection:V}=v.getState();if(!y||!R&&!i)return;if(!R){P==null||P(O.nativeEvent,{nodeId:y,handleId:m,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:y,type:e,id:m}});return}const W=r9(O.target),q=n||J,{connection:ue,isValid:me}=O_.isValid(O.nativeEvent,{handle:{nodeId:y,id:m,type:e},connectionMode:Y,fromNodeId:R.nodeId,fromHandleId:R.id||null,fromType:R.type,isValidConnection:q,flowId:te,doc:W,lib:U,nodeLookup:K});me&&ue&&L(ue);const Se=structuredClone(V);delete Se.inProgress,Se.toPosition=Se.toHandle?Se.toHandle.position:null,$==null||$(O,Se),v.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":m,"data-nodeid":y,"data-handlepos":t,"data-id":`${w}-${y}-${m}-${e}`,className:Zs(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,u,{source:!b,target:b,connectable:s,connectablestart:i,connectableend:r,clickconnecting:k,connectingfrom:_,connectingto:S,valid:j,connectionindicator:s&&(!C||T)&&(C||I?r:i)}]),onMouseDown:z,onTouchStart:z,onClick:x?D:void 0,ref:p,...h,children:c})}const Mi=g.memo(D9(Poe));function Boe({data:e,isConnectable:t,sourcePosition:n=Xe.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(Mi,{type:"source",position:n,isConnectable:t})]})}function Uoe({data:e,isConnectable:t,targetPosition:n=Xe.Top,sourcePosition:s=Xe.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(Mi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(Mi,{type:"source",position:s,isConnectable:t})]})}function Foe(){return null}function $oe({data:e,isConnectable:t,targetPosition:n=Xe.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(Mi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const tx={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},TO={input:Boe,default:Uoe,output:$oe,group:Foe};function Hoe(e){var t,n,s,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??((s=e.style)==null?void 0:s.width),height:e.height??((i=e.style)==null?void 0:i.height)}}const zoe=e=>{const{width:t,height:n,x:s,y:i}=mg(e.nodeLookup,{filter:r=>!!r.selected});return{width:_a(t)?t:null,height:_a(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${s}px,${i}px)`}};function Voe({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=gs(),{width:i,height:r,transformString:a,userSelectionActive:l}=Qt(zoe,ms),c=U9(),u=g.useRef(null);g.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!l&&i!==null&&r!==null;if(B9({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const m=s.getState().nodes.filter(b=>b.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(tx,p.key)&&(p.preventDefault(),c({direction:tx[p.key],factor:p.shiftKey?4:1}))};return o.jsx("div",{className:Zs(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:o.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:r}})})}const kO=typeof window<"u"?window:void 0,Goe=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function $9({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:r,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:b,zoomActivationKeyCode:v,elementsSelectable:y,zoomOnScroll:x,zoomOnPinch:E,panOnScroll:w,panOnScrollSpeed:_,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:T,autoPanOnSelection:C,defaultViewport:I,translateExtent:j,minZoom:L,maxZoom:z,preventScrolling:D,onSelectionContextMenu:F,noWheelClassName:A,noPanClassName:O,disableKeyboardA11y:P,onViewportChange:$,isControlledViewport:R}){const{nodesSelectionActive:Y,userSelectionActive:J}=Qt(Goe,ms),U=Rm(u,{target:kO}),te=Rm(b,{target:kO}),K=te||T,V=te||w,W=d&&K!==!0,q=U||J||W;return Noe({deleteKeyCode:c,multiSelectionKeyCode:m}),o.jsx(Aoe,{onPaneContextMenu:r,elementsSelectable:y,zoomOnScroll:x,zoomOnPinch:E,panOnScroll:V,panOnScrollSpeed:_,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:!U&&K,defaultViewport:I,translateExtent:j,minZoom:L,maxZoom:z,zoomActivationKeyCode:v,preventScrolling:D,noWheelClassName:A,noPanClassName:O,onViewportChange:$,isControlledViewport:R,paneClickDistance:l,selectionOnDrag:W,children:o.jsxs(Roe,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:r,onPaneScroll:a,panOnDrag:K,autoPanOnSelection:C,isSelecting:!!q,selectionMode:f,selectionKeyPressed:U,paneClickDistance:l,selectionOnDrag:W,children:[e,Y&&o.jsx(Voe,{onSelectionContextMenu:F,noPanClassName:O,disableKeyboardA11y:P})]})})}$9.displayName="FlowRenderer";const Koe=g.memo($9),qoe=e=>t=>e?Zk(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 Yoe(e){return Qt(g.useCallback(qoe(e),[e]),ms)}const Woe=e=>e.updateNodeInternals;function Xoe(){const e=Qt(Woe),[t]=g.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const s=new Map;n.forEach(i=>{const r=i.target.getAttribute("data-id");s.set(r,{id:r,nodeElement:i.target,force:!0})}),e(s)}));return g.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function Qoe({node:e,nodeType:t,hasDimensions:n,resizeObserver:s}){const i=gs(),r=g.useRef(null),a=g.useRef(null),l=g.useRef(e.sourcePosition),c=g.useRef(e.targetPosition),u=g.useRef(t),d=n&&!!e.internals.handleBounds;return g.useEffect(()=>{r.current&&!e.hidden&&(!d||a.current!==r.current)&&(a.current&&(s==null||s.unobserve(a.current)),s==null||s.observe(r.current),a.current=r.current)},[d,e.hidden]),g.useEffect(()=>()=>{a.current&&(s==null||s.unobserve(a.current),a.current=null)},[]),g.useEffect(()=>{if(r.current){const f=u.current!==t,h=l.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||h||p)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:r.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),r}function Zoe({id:e,onClick:t,onMouseEnter:n,onMouseMove:s,onMouseLeave:i,onContextMenu:r,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:m,rfId:b,nodeTypes:v,nodeClickDistance:y,onError:x}){const{node:E,internals:w,isParent:_}=Qt(q=>{const ue=q.nodeLookup.get(e),me=q.parentLookup.has(e);return{node:ue,internals:ue.internals,isParent:me}},ms);let S=E.type||"default",k=(v==null?void 0:v[S])||TO[S];k===void 0&&(x==null||x("003",Ia.error003(S)),S="default",k=(v==null?void 0:v.default)||TO.default);const T=!!(E.draggable||l&&typeof E.draggable>"u"),C=!!(E.selectable||c&&typeof E.selectable>"u"),I=!!(E.connectable||u&&typeof E.connectable>"u"),j=!!(E.focusable||d&&typeof E.focusable>"u"),L=gs(),z=tA(E),D=Qoe({node:E,nodeType:S,hasDimensions:z,resizeObserver:f}),F=B9({nodeRef:D,disabled:E.hidden||!T,noDragClassName:h,handleSelector:E.dragHandle,nodeId:e,isSelectable:C,nodeClickDistance:y}),A=U9();if(E.hidden)return null;const O=Jo(E),P=Hoe(E),$=C||T||t||n||s||i,R=n?q=>n(q,{...w.userNode}):void 0,Y=s?q=>s(q,{...w.userNode}):void 0,J=i?q=>i(q,{...w.userNode}):void 0,U=r?q=>r(q,{...w.userNode}):void 0,te=a?q=>a(q,{...w.userNode}):void 0,K=q=>{const{selectNodesOnDrag:ue,nodeDragThreshold:me}=L.getState();C&&(!ue||!T||me>0)&&M_({id:e,store:L,nodeRef:D}),t&&t(q,{...w.userNode})},V=q=>{if(!(a9(q.nativeEvent)||m)){if(W8.includes(q.key)&&C){const ue=q.key==="Escape";M_({id:e,store:L,unselect:ue,nodeRef:D})}else if(T&&E.selected&&Object.prototype.hasOwnProperty.call(tx,q.key)){q.preventDefault();const{ariaLabelConfig:ue}=L.getState();L.setState({ariaLiveMessage:ue["node.a11yDescription.ariaLiveMessage"]({direction:q.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),A({direction:tx[q.key],factor:q.shiftKey?4:1})}}},W=()=>{var Me;if(m||!((Me=D.current)!=null&&Me.matches(":focus-visible")))return;const{transform:q,width:ue,height:me,autoPanOnNodeFocus:Se,setCenter:de}=L.getState();if(!Se)return;Zk(new Map([[e,E]]),{x:0,y:0,width:ue,height:me},q,!0).length>0||de(E.position.x+O.width/2,E.position.y+O.height/2,{zoom:q[2]})};return o.jsx("div",{className:Zs(["react-flow__node",`react-flow__node-${S}`,{[p]:T},E.className,{selected:E.selected,selectable:C,parent:_,draggable:T,dragging:F}]),ref:D,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:$?"all":"none",visibility:z?"visible":"hidden",...E.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:R,onMouseMove:Y,onMouseLeave:J,onContextMenu:U,onClick:K,onDoubleClick:te,onKeyDown:j?V:void 0,tabIndex:j?0:void 0,onFocus:j?W:void 0,role:E.ariaRole??(j?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${C9}-${b}`,"aria-label":E.ariaLabel,...E.domAttributes,children:o.jsx(Moe,{value:e,children:o.jsx(k,{id:e,data:E.data,type:S,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:E.selected??!1,selectable:C,draggable:T,deletable:E.deletable??!0,isConnectable:I,sourcePosition:E.sourcePosition,targetPosition:E.targetPosition,dragging:F,dragHandle:E.dragHandle,zIndex:w.z,parentId:E.parentId,...O})})})}var Joe=g.memo(Zoe);const ele=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function H9(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:i,onError:r}=Qt(ele,ms),a=Yoe(e.onlyRenderVisibleElements),l=Xoe();return o.jsx("div",{className:"react-flow__nodes",style:E1,children:a.map(c=>o.jsx(Joe,{id:c,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:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:r},c))})}H9.displayName="NodeRenderer";const tle=g.memo(H9);function nle(e){return Qt(g.useCallback(n=>{if(!e)return n.edges.map(i=>i.id);const s=[];if(n.width&&n.height)for(const i of n.edges){const r=n.nodeLookup.get(i.source),a=n.nodeLookup.get(i.target);r&&a&&Fre({sourceNode:r,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&s.push(i.id)}return s},[e]),ms)}const sle=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return o.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},ile=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return o.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},AO={[Ef.Arrow]:sle,[Ef.ArrowClosed]:ile};function rle(e){const t=gs();return g.useMemo(()=>{var i,r;return Object.prototype.hasOwnProperty.call(AO,e)?AO[e]:((r=(i=t.getState()).onError)==null||r.call(i,"009",Ia.error009(e)),null)},[e])}const ale=({id:e,type:t,color:n,width:s=12.5,height:i=12.5,markerUnits:r="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=rle(t);return c?o.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:r,orient:l,refX:"0",refY:"0",children:o.jsx(c,{color:n,strokeWidth:a})}):null},z9=({defaultColor:e,rfId:t})=>{const n=Qt(r=>r.edges),s=Qt(r=>r.defaultEdgeOptions),i=g.useMemo(()=>Yre(n,{id:t,defaultColor:e,defaultMarkerStart:s==null?void 0:s.markerStart,defaultMarkerEnd:s==null?void 0:s.markerEnd}),[n,s,t,e]);return i.length?o.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:o.jsx("defs",{children:i.map(r=>o.jsx(ale,{id:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient},r.id))})}):null};z9.displayName="MarkerDefinitions";var ole=g.memo(z9);function V9({x:e,y:t,label:n,labelStyle:s,labelShowBg:i=!0,labelBgStyle:r,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...d}){const[f,h]=g.useState({x:1,y:0,width:0,height:0}),p=Zs(["react-flow__edge-textwrapper",u]),m=g.useRef(null);return g.useEffect(()=>{if(m.current){const b=m.current.getBBox();h({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[i&&o.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:r,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:m,style:s,children:n}),c]}):null}V9.displayName="EdgeText";const lle=g.memo(V9);function bg({path:e,labelX:t,labelY:n,label:s,labelStyle:i,labelShowBg:r,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...d,d:e,fill:"none",className:Zs(["react-flow__edge-path",d.className])}),u?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,s&&_a(t)&&_a(n)?o.jsx(lle,{x:t,y:n,label:s,labelStyle:i,labelShowBg:r,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function CO({pos:e,x1:t,y1:n,x2:s,y2:i}){return e===Xe.Left||e===Xe.Right?[.5*(t+s),n]:[t,.5*(n+i)]}function G9({sourceX:e,sourceY:t,sourcePosition:n=Xe.Bottom,targetX:s,targetY:i,targetPosition:r=Xe.Top}){const[a,l]=CO({pos:n,x1:e,y1:t,x2:s,y2:i}),[c,u]=CO({pos:r,x1:s,y1:i,x2:e,y2:t}),[d,f,h,p]=l9({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${s},${i}`,d,f,h,p]}function K9(e){return g.memo(({id:t,sourceX:n,sourceY:s,targetX:i,targetY:r,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:v,interactionWidth:y})=>{const[x,E,w]=G9({sourceX:n,sourceY:s,sourcePosition:a,targetX:i,targetY:r,targetPosition:l}),_=e.isInternal?void 0:t;return o.jsx(bg,{id:_,path:x,labelX:E,labelY:w,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:v,interactionWidth:y})})}const cle=K9({isInternal:!1}),q9=K9({isInternal:!0});cle.displayName="SimpleBezierEdge";q9.displayName="SimpleBezierEdgeInternal";function Y9(e){return g.memo(({id:t,sourceX:n,sourceY:s,targetX:i,targetY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=Xe.Bottom,targetPosition:m=Xe.Top,markerEnd:b,markerStart:v,pathOptions:y,interactionWidth:x})=>{const[E,w,_]=ex({sourceX:n,sourceY:s,sourcePosition:p,targetX:i,targetY:r,targetPosition:m,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),S=e.isInternal?void 0:t;return o.jsx(bg,{id:S,path:E,labelX:w,labelY:_,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:b,markerStart:v,interactionWidth:x})})}const W9=Y9({isInternal:!1}),X9=Y9({isInternal:!0});W9.displayName="SmoothStepEdge";X9.displayName="SmoothStepEdgeInternal";function Q9(e){return g.memo(({id:t,...n})=>{var i;const s=e.isInternal?void 0:t;return o.jsx(W9,{...n,id:s,pathOptions:g.useMemo(()=>{var r;return{borderRadius:0,offset:(r=n.pathOptions)==null?void 0:r.offset}},[(i=n.pathOptions)==null?void 0:i.offset])})})}const ule=Q9({isInternal:!1}),Z9=Q9({isInternal:!0});ule.displayName="StepEdge";Z9.displayName="StepEdgeInternal";function J9(e){return g.memo(({id:t,sourceX:n,sourceY:s,targetX:i,targetY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:b})=>{const[v,y,x]=d9({sourceX:n,sourceY:s,targetX:i,targetY:r}),E=e.isInternal?void 0:t;return o.jsx(bg,{id:E,path:v,labelX:y,labelY:x,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:b})})}const dle=J9({isInternal:!1}),eU=J9({isInternal:!0});dle.displayName="StraightEdge";eU.displayName="StraightEdgeInternal";function tU(e){return g.memo(({id:t,sourceX:n,sourceY:s,targetX:i,targetY:r,sourcePosition:a=Xe.Bottom,targetPosition:l=Xe.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:v,pathOptions:y,interactionWidth:x})=>{const[E,w,_]=c9({sourceX:n,sourceY:s,sourcePosition:a,targetX:i,targetY:r,targetPosition:l,curvature:y==null?void 0:y.curvature}),S=e.isInternal?void 0:t;return o.jsx(bg,{id:S,path:E,labelX:w,labelY:_,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:v,interactionWidth:x})})}const fle=tU({isInternal:!1}),nU=tU({isInternal:!0});fle.displayName="BezierEdge";nU.displayName="BezierEdgeInternal";const IO={default:nU,straight:eU,step:Z9,smoothstep:X9,simplebezier:q9},jO={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},hle=(e,t,n)=>n===Xe.Left?e-t:n===Xe.Right?e+t:e,ple=(e,t,n)=>n===Xe.Top?e-t:n===Xe.Bottom?e+t:e,RO="react-flow__edgeupdater";function OO({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:i,onMouseEnter:r,onMouseOut:a,type:l}){return o.jsx("circle",{onMouseDown:i,onMouseEnter:r,onMouseOut:a,className:Zs([RO,`${RO}-${l}`]),cx:hle(t,s,e),cy:ple(n,s,e),r:s,stroke:"transparent",fill:"transparent"})}function mle({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:s,sourceY:i,targetX:r,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const m=gs(),b=(w,_)=>{if(w.button!==0)return;const{autoPanOnConnect:S,domNode:k,connectionMode:T,connectionRadius:C,lib:I,onConnectStart:j,cancelConnection:L,nodeLookup:z,rfId:D,panBy:F,updateConnection:A}=m.getState(),O=_.type==="target",P=(Y,J)=>{h(!1),f==null||f(Y,n,_.type,J)},$=Y=>u==null?void 0:u(n,Y),R=(Y,J)=>{h(!0),d==null||d(w,n,_.type),j==null||j(Y,J)};O_.onPointerDown(w.nativeEvent,{autoPanOnConnect:S,connectionMode:T,connectionRadius:C,domNode:k,handleId:_.id,nodeId:_.nodeId,nodeLookup:z,isTarget:O,edgeUpdaterType:_.type,lib:I,flowId:D,cancelConnection:L,panBy:F,isValidConnection:(...Y)=>{var J,U;return((U=(J=m.getState()).isValidConnection)==null?void 0:U.call(J,...Y))??!0},onConnect:$,onConnectStart:R,onConnectEnd:(...Y)=>{var J,U;return(U=(J=m.getState()).onConnectEnd)==null?void 0:U.call(J,...Y)},onReconnectEnd:P,updateConnection:A,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},v=w=>b(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=w=>b(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),x=()=>p(!0),E=()=>p(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(OO,{position:l,centerX:s,centerY:i,radius:t,onMouseDown:v,onMouseEnter:x,onMouseOut:E,type:"source"}),(e===!0||e==="target")&&o.jsx(OO,{position:c,centerX:r,centerY:a,radius:t,onMouseDown:y,onMouseEnter:x,onMouseOut:E,type:"target"})]})}function gle({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:s,onClick:i,onDoubleClick:r,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:m,edgeTypes:b,noPanClassName:v,onError:y,disableKeyboardA11y:x}){let E=Qt(de=>de.edgeLookup.get(e));const w=Qt(de=>de.defaultEdgeOptions);E=w?{...w,...E}:E;let _=E.type||"default",S=(b==null?void 0:b[_])||IO[_];S===void 0&&(y==null||y("011",Ia.error011(_)),_="default",S=(b==null?void 0:b.default)||IO.default);const k=!!(E.focusable||t&&typeof E.focusable>"u"),T=typeof f<"u"&&(E.reconnectable||n&&typeof E.reconnectable>"u"),C=!!(E.selectable||s&&typeof E.selectable>"u"),I=g.useRef(null),[j,L]=g.useState(!1),[z,D]=g.useState(!1),F=gs(),{zIndex:A,sourceX:O,sourceY:P,targetX:$,targetY:R,sourcePosition:Y,targetPosition:J}=Qt(g.useCallback(de=>{const ge=de.nodeLookup.get(E.source),Me=de.nodeLookup.get(E.target);if(!ge||!Me)return{zIndex:E.zIndex,...jO};const ve=qre({id:e,sourceNode:ge,targetNode:Me,sourceHandle:E.sourceHandle||null,targetHandle:E.targetHandle||null,connectionMode:de.connectionMode,onError:y});return{zIndex:Ure({selected:E.selected,zIndex:E.zIndex,sourceNode:ge,targetNode:Me,elevateOnSelect:de.elevateEdgesOnSelect,zIndexMode:de.zIndexMode}),...ve||jO}},[E.source,E.target,E.sourceHandle,E.targetHandle,E.selected,E.zIndex]),ms),U=g.useMemo(()=>E.markerStart?`url('#${j_(E.markerStart,m)}')`:void 0,[E.markerStart,m]),te=g.useMemo(()=>E.markerEnd?`url('#${j_(E.markerEnd,m)}')`:void 0,[E.markerEnd,m]);if(E.hidden||O===null||P===null||$===null||R===null)return null;const K=de=>{var re;const{addSelectedEdges:ge,unselectNodesAndEdges:Me,multiSelectionActive:ve}=F.getState();C&&(F.setState({nodesSelectionActive:!1}),E.selected&&ve?(Me({nodes:[],edges:[E]}),(re=I.current)==null||re.blur()):ge([e])),i&&i(de,E)},V=r?de=>{r(de,{...E})}:void 0,W=a?de=>{a(de,{...E})}:void 0,q=l?de=>{l(de,{...E})}:void 0,ue=c?de=>{c(de,{...E})}:void 0,me=u?de=>{u(de,{...E})}:void 0,Se=de=>{var ge;if(!x&&W8.includes(de.key)&&C){const{unselectNodesAndEdges:Me,addSelectedEdges:ve}=F.getState();de.key==="Escape"?((ge=I.current)==null||ge.blur(),Me({edges:[E]})):ve([e])}};return o.jsx("svg",{style:{zIndex:A},children:o.jsxs("g",{className:Zs(["react-flow__edge",`react-flow__edge-${_}`,E.className,v,{selected:E.selected,animated:E.animated,inactive:!C&&!i,updating:j,selectable:C}]),onClick:K,onDoubleClick:V,onContextMenu:W,onMouseEnter:q,onMouseMove:ue,onMouseLeave:me,onKeyDown:k?Se:void 0,tabIndex:k?0:void 0,role:E.ariaRole??(k?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":E.ariaLabel===null?void 0:E.ariaLabel||`Edge from ${E.source} to ${E.target}`,"aria-describedby":k?`${I9}-${m}`:void 0,ref:I,...E.domAttributes,children:[!z&&o.jsx(S,{id:e,source:E.source,target:E.target,type:E.type,selected:E.selected,animated:E.animated,selectable:C,deletable:E.deletable??!0,label:E.label,labelStyle:E.labelStyle,labelShowBg:E.labelShowBg,labelBgStyle:E.labelBgStyle,labelBgPadding:E.labelBgPadding,labelBgBorderRadius:E.labelBgBorderRadius,sourceX:O,sourceY:P,targetX:$,targetY:R,sourcePosition:Y,targetPosition:J,data:E.data,style:E.style,sourceHandleId:E.sourceHandle,targetHandleId:E.targetHandle,markerStart:U,markerEnd:te,pathOptions:"pathOptions"in E?E.pathOptions:void 0,interactionWidth:E.interactionWidth}),T&&o.jsx(mle,{edge:E,isReconnectable:T,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:O,sourceY:P,targetX:$,targetY:R,sourcePosition:Y,targetPosition:J,setUpdateHover:L,setReconnecting:D})]})})}var ble=g.memo(gle);const yle=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function sU({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:s,noPanClassName:i,onReconnect:r,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:b}){const{edgesFocusable:v,edgesReconnectable:y,elementsSelectable:x,onError:E}=Qt(yle,ms),w=nle(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(ole,{defaultColor:e,rfId:n}),w.map(_=>o.jsx(ble,{id:_,edgesFocusable:v,edgesReconnectable:y,elementsSelectable:x,noPanClassName:i,onReconnect:r,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:E,edgeTypes:s,disableKeyboardA11y:b},_))]})}sU.displayName="EdgeRenderer";const xle=g.memo(sU),Ele=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function vle({children:e}){const t=Qt(Ele);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function wle(e){const t=x1(),n=g.useRef(!1);g.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Sle=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function _le(e){const t=Qt(Sle),n=gs();return g.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Nle(e){return e.connection.inProgress?{...e.connection,to:Zf(e.connection.to,e.transform)}:{...e.connection}}function Tle(e){return Nle}function kle(e){const t=Tle();return Qt(t,ms)}const Ale=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Cle({containerStyle:e,style:t,type:n,component:s}){const{nodesConnectable:i,width:r,height:a,isValid:l,inProgress:c}=Qt(Ale,ms);return!(r&&i&&c)?null:o.jsx("svg",{style:e,width:r,height:a,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:Zs(["react-flow__connection",Z8(l)]),children:o.jsx(iU,{style:t,type:n,CustomComponent:s,isValid:l})})})}const iU=({style:e,type:t=_l.Bezier,CustomComponent:n,isValid:s})=>{const{inProgress:i,from:r,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=kle();if(!i)return;if(n)return o.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:r.x,fromY:r.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:Z8(s),toNode:d,toHandle:f,pointer:p});let m="";const b={sourceX:r.x,sourceY:r.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case _l.Bezier:[m]=c9(b);break;case _l.SimpleBezier:[m]=G9(b);break;case _l.Step:[m]=ex({...b,borderRadius:0});break;case _l.SmoothStep:[m]=ex(b);break;default:[m]=d9(b)}return o.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};iU.displayName="ConnectionLine";const Ile={};function MO(e=Ile){g.useRef(e),gs(),g.useEffect(()=>{},[e])}function jle(){gs(),g.useRef(!1),g.useEffect(()=>{},[])}function rU({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:s,onEdgeClick:i,onNodeDoubleClick:r,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:b,connectionLineComponent:v,connectionLineContainerStyle:y,selectionKeyCode:x,selectionOnDrag:E,selectionMode:w,multiSelectionKeyCode:_,panActivationKeyCode:S,zoomActivationKeyCode:k,deleteKeyCode:T,onlyRenderVisibleElements:C,elementsSelectable:I,defaultViewport:j,translateExtent:L,minZoom:z,maxZoom:D,preventScrolling:F,defaultMarkerColor:A,zoomOnScroll:O,zoomOnPinch:P,panOnScroll:$,panOnScrollSpeed:R,panOnScrollMode:Y,zoomOnDoubleClick:J,panOnDrag:U,autoPanOnSelection:te,onPaneClick:K,onPaneMouseEnter:V,onPaneMouseMove:W,onPaneMouseLeave:q,onPaneScroll:ue,onPaneContextMenu:me,paneClickDistance:Se,nodeClickDistance:de,onEdgeContextMenu:ge,onEdgeMouseEnter:Me,onEdgeMouseMove:ve,onEdgeMouseLeave:re,reconnectRadius:ke,onReconnect:we,onReconnectStart:Je,onReconnectEnd:Le,noDragClassName:Ve,noWheelClassName:_e,noPanClassName:He,disableKeyboardA11y:Pe,nodeExtent:qe,rfId:Z,viewport:ae,onViewportChange:ne}){return MO(e),MO(t),jle(),wle(n),_le(ae),o.jsx(Koe,{onPaneClick:K,onPaneMouseEnter:V,onPaneMouseMove:W,onPaneMouseLeave:q,onPaneContextMenu:me,onPaneScroll:ue,paneClickDistance:Se,deleteKeyCode:T,selectionKeyCode:x,selectionOnDrag:E,selectionMode:w,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:_,panActivationKeyCode:S,zoomActivationKeyCode:k,elementsSelectable:I,zoomOnScroll:O,zoomOnPinch:P,zoomOnDoubleClick:J,panOnScroll:$,panOnScrollSpeed:R,panOnScrollMode:Y,panOnDrag:U,autoPanOnSelection:te,defaultViewport:j,translateExtent:L,minZoom:z,maxZoom:D,onSelectionContextMenu:f,preventScrolling:F,noDragClassName:Ve,noWheelClassName:_e,noPanClassName:He,disableKeyboardA11y:Pe,onViewportChange:ne,isControlledViewport:!!ae,children:o.jsxs(vle,{children:[o.jsx(xle,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:a,onReconnect:we,onReconnectStart:Je,onReconnectEnd:Le,onlyRenderVisibleElements:C,onEdgeContextMenu:ge,onEdgeMouseEnter:Me,onEdgeMouseMove:ve,onEdgeMouseLeave:re,reconnectRadius:ke,defaultMarkerColor:A,noPanClassName:He,disableKeyboardA11y:Pe,rfId:Z}),o.jsx(Cle,{style:b,type:m,component:v,containerStyle:y}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(tle,{nodeTypes:e,onNodeClick:s,onNodeDoubleClick:r,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:de,onlyRenderVisibleElements:C,noPanClassName:He,noDragClassName:Ve,disableKeyboardA11y:Pe,nodeExtent:qe,rfId:Z}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}rU.displayName="GraphView";const Rle=g.memo(rU),Ole=s9(),LO=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:i,height:r,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,m=new Map,b=new Map,v=new Map,y=s??t??[],x=n??e??[],E=d??[0,0],w=f??Am;p9(b,v,y);const{nodesInitialized:_}=R_(x,p,m,{nodeOrigin:E,nodeExtent:w,zIndexMode:h});let S=[0,0,1];if(a&&i&&r){const k=mg(p,{filter:j=>!!((j.width||j.initialWidth)&&(j.height||j.initialHeight))}),{x:T,y:C,zoom:I}=eA(k,i,r,c,u,(l==null?void 0:l.padding)??.1);S=[T,C,I]}return{rfId:"1",width:i??0,height:r??0,transform:S,nodes:x,nodesInitialized:_,nodeLookup:p,parentLookup:m,edges:y,edgeLookup:v,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:s!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Am,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:xf.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:E,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:l,fitViewResolver:null,connection:{...Q8},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Ole,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:X8,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Mle=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:i,height:r,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>Xae((p,m)=>{async function b(){const{nodeLookup:v,panZoom:y,fitViewOptions:x,fitViewResolver:E,width:w,height:_,minZoom:S,maxZoom:k}=m();y&&(await Rre({nodes:v,width:w,height:_,panZoom:y,minZoom:S,maxZoom:k},x),E==null||E.resolve(!0),p({fitViewResolver:null}))}return{...LO({nodes:e,edges:t,width:i,height:r,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:s,zIndexMode:h}),setNodes:v=>{const{nodeLookup:y,parentLookup:x,nodeOrigin:E,elevateNodesOnSelect:w,fitViewQueued:_,zIndexMode:S,nodesSelectionActive:k}=m(),{nodesInitialized:T,hasSelectedNodes:C}=R_(v,y,x,{nodeOrigin:E,nodeExtent:f,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:S}),I=k&&C;_&&T?(b(),p({nodes:v,nodesInitialized:T,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:I})):p({nodes:v,nodesInitialized:T,nodesSelectionActive:I})},setEdges:v=>{const{connectionLookup:y,edgeLookup:x}=m();p9(y,x,v),p({edges:v})},setDefaultNodesAndEdges:(v,y)=>{if(v){const{setNodes:x}=m();x(v),p({hasDefaultNodes:!0})}if(y){const{setEdges:x}=m();x(y),p({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:y,nodeLookup:x,parentLookup:E,domNode:w,nodeOrigin:_,nodeExtent:S,debug:k,fitViewQueued:T,zIndexMode:C}=m(),{changes:I,updatedInternals:j}=tae(v,x,E,w,_,S,C);j&&(Qre(x,E,{nodeOrigin:_,nodeExtent:S,zIndexMode:C}),T?(b(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(I==null?void 0:I.length)>0&&(k&&console.log("React Flow: trigger node changes",I),y==null||y(I)))},updateNodePositions:(v,y=!1)=>{const x=[];let E=[];const{nodeLookup:w,triggerNodeChanges:_,connection:S,updateConnection:k,onNodesChangeMiddlewareMap:T}=m();for(const[C,I]of v){const j=w.get(C),L=!!(j!=null&&j.expandParent&&(j!=null&&j.parentId)&&(I!=null&&I.position)),z={id:C,type:"position",position:L?{x:Math.max(0,I.position.x),y:Math.max(0,I.position.y)}:I.position,dragging:y};if(j&&S.inProgress&&S.fromNode.id===j.id){const D=du(j,S.fromHandle,Xe.Left,!0);k({...S,from:D})}L&&j.parentId&&x.push({id:C,parentId:j.parentId,rect:{...I.internals.positionAbsolute,width:I.measured.width??0,height:I.measured.height??0}}),E.push(z)}if(x.length>0){const{parentLookup:C,nodeOrigin:I}=m(),j=oA(x,w,C,I);E.push(...j)}for(const C of T.values())E=C(E);_(E)},triggerNodeChanges:v=>{const{onNodesChange:y,setNodes:x,nodes:E,hasDefaultNodes:w,debug:_}=m();if(v!=null&&v.length){if(w){const S=O9(v,E);x(S)}_&&console.log("React Flow: trigger node changes",v),y==null||y(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:y,setEdges:x,edges:E,hasDefaultEdges:w,debug:_}=m();if(v!=null&&v.length){if(w){const S=M9(v,E);x(S)}_&&console.log("React Flow: trigger edge changes",v),y==null||y(v)}},addSelectedNodes:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:E,triggerNodeChanges:w,triggerEdgeChanges:_}=m();if(y){const S=v.map(k=>Ic(k,!0));w(S);return}w(Id(E,new Set([...v]),!0)),_(Id(x))},addSelectedEdges:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:E,triggerNodeChanges:w,triggerEdgeChanges:_}=m();if(y){const S=v.map(k=>Ic(k,!0));_(S);return}_(Id(x,new Set([...v]))),w(Id(E,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:y}={})=>{const{edges:x,nodes:E,nodeLookup:w,triggerNodeChanges:_,triggerEdgeChanges:S}=m(),k=v||E,T=y||x,C=[];for(const j of k){if(!j.selected)continue;const L=w.get(j.id);L&&(L.selected=!1),C.push(Ic(j.id,!1))}const I=[];for(const j of T)j.selected&&I.push(Ic(j.id,!1));_(C),S(I)},setMinZoom:v=>{const{panZoom:y,maxZoom:x}=m();y==null||y.setScaleExtent([v,x]),p({minZoom:v})},setMaxZoom:v=>{const{panZoom:y,minZoom:x}=m();y==null||y.setScaleExtent([x,v]),p({maxZoom:v})},setTranslateExtent:v=>{var y;(y=m().panZoom)==null||y.setTranslateExtent(v),p({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:y,triggerNodeChanges:x,triggerEdgeChanges:E,elementsSelectable:w}=m();if(!w)return;const _=y.reduce((k,T)=>T.selected?[...k,Ic(T.id,!1)]:k,[]),S=v.reduce((k,T)=>T.selected?[...k,Ic(T.id,!1)]:k,[]);x(_),E(S)},setNodeExtent:v=>{const{nodes:y,nodeLookup:x,parentLookup:E,nodeOrigin:w,elevateNodesOnSelect:_,nodeExtent:S,zIndexMode:k}=m();v[0][0]===S[0][0]&&v[0][1]===S[0][1]&&v[1][0]===S[1][0]&&v[1][1]===S[1][1]||(R_(y,x,E,{nodeOrigin:w,nodeExtent:v,elevateNodesOnSelect:_,checkEquality:!1,zIndexMode:k}),p({nodeExtent:v}))},panBy:v=>{const{transform:y,width:x,height:E,panZoom:w,translateExtent:_}=m();return nae({delta:v,panZoom:w,transform:y,translateExtent:_,width:x,height:E})},setCenter:async(v,y,x)=>{const{width:E,height:w,maxZoom:_,panZoom:S}=m();if(!S)return!1;const k=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:_;return await S.setViewport({x:E/2-v*k,y:w/2-y*k,zoom:k},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),!0},cancelConnection:()=>{p({connection:{...Q8}})},updateConnection:v=>{p({connection:v})},reset:()=>p({...LO()})}},Object.is);function cA({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:s,initialWidth:i,initialHeight:r,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[m]=g.useState(()=>Mle({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:i,height:r,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return o.jsx(Qae,{value:m,children:o.jsx(voe,{children:p})})}function Lle({children:e,nodes:t,edges:n,defaultNodes:s,defaultEdges:i,width:r,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return g.useContext(b1)?o.jsx(o.Fragment,{children:e}):o.jsx(cA,{initialNodes:t,initialEdges:n,defaultNodes:s,defaultEdges:i,initialWidth:r,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const Dle={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Ple({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:i,nodeTypes:r,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:m,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:y,onNodeMouseEnter:x,onNodeMouseMove:E,onNodeMouseLeave:w,onNodeContextMenu:_,onNodeDoubleClick:S,onNodeDragStart:k,onNodeDrag:T,onNodeDragStop:C,onNodesDelete:I,onEdgesDelete:j,onDelete:L,onSelectionChange:z,onSelectionDragStart:D,onSelectionDrag:F,onSelectionDragStop:A,onSelectionContextMenu:O,onSelectionStart:P,onSelectionEnd:$,onBeforeDelete:R,connectionMode:Y,connectionLineType:J=_l.Bezier,connectionLineStyle:U,connectionLineComponent:te,connectionLineContainerStyle:K,deleteKeyCode:V="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:q=!1,selectionMode:ue=Cm.Full,panActivationKeyCode:me="Space",multiSelectionKeyCode:Se=jm()?"Meta":"Control",zoomActivationKeyCode:de=jm()?"Meta":"Control",snapToGrid:ge,snapGrid:Me,onlyRenderVisibleElements:ve=!1,selectNodesOnDrag:re,nodesDraggable:ke,autoPanOnNodeFocus:we,nodesConnectable:Je,nodesFocusable:Le,nodeOrigin:Ve=j9,edgesFocusable:_e,edgesReconnectable:He,elementsSelectable:Pe=!0,defaultViewport:qe=uoe,minZoom:Z=.5,maxZoom:ae=2,translateExtent:ne=Am,preventScrolling:be=!0,nodeExtent:Fe,defaultMarkerColor:Ke="#b1b1b7",zoomOnScroll:bt=!0,zoomOnPinch:dt=!0,panOnScroll:cn=!1,panOnScrollSpeed:Ut=.5,panOnScrollMode:wt=Xc.Free,zoomOnDoubleClick:$t=!0,panOnDrag:Ge=!0,onPaneClick:Yt,onPaneMouseEnter:it,onPaneMouseMove:ct,onPaneMouseLeave:Qe,onPaneScroll:vt,onPaneContextMenu:ye,paneClickDistance:Ze=1,nodeClickDistance:xt=0,children:rn,onReconnect:Hn,onReconnectStart:ut,onReconnectEnd:pt,onEdgeContextMenu:gn,onEdgeDoubleClick:en,onEdgeMouseEnter:St,onEdgeMouseMove:an,onEdgeMouseLeave:ls,reconnectRadius:Rs=10,onNodesChange:Rn,onEdgesChange:Wn,noDragClassName:bn="nodrag",noWheelClassName:yn="nowheel",noPanClassName:Xn="nopan",fitView:zs,fitViewOptions:pi,connectOnClick:bs,attributionPosition:Js,proOptions:On,defaultEdgeOptions:cs,elevateNodesOnSelect:Qn=!0,elevateEdgesOnSelect:us=!1,disableKeyboardA11y:Os=!1,autoPanOnConnect:Ms,autoPanOnNodeDrag:Ss,autoPanOnSelection:_s=!0,autoPanSpeed:un,connectionRadius:on,isValidConnection:dn,onError:ce,style:Ie,id:Ue,nodeDragThreshold:nt,connectionDragThreshold:at,viewport:We,onViewportChange:_t,width:De,height:xn,colorMode:Zn="light",debug:ki,onScroll:zn,ariaLabelConfig:Ht,zIndexMode:Nt="basic",...En},Vn){const Pa=Ue||"1",Ba=poe(Zn),Ui=g.useCallback(Mr=>{Mr.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),zn==null||zn(Mr)},[zn]);return o.jsx("div",{"data-testid":"rf__wrapper",...En,onScroll:Ui,style:{...Ie,...Dle},ref:Vn,className:Zs(["react-flow",i,Ba]),id:Ue,role:"application",children:o.jsxs(Lle,{nodes:e,edges:t,width:De,height:xn,fitView:zs,fitViewOptions:pi,minZoom:Z,maxZoom:ae,nodeOrigin:Ve,nodeExtent:Fe,zIndexMode:Nt,children:[o.jsx(hoe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:p,onConnectStart:m,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:y,nodesDraggable:ke,autoPanOnNodeFocus:we,nodesConnectable:Je,nodesFocusable:Le,edgesFocusable:_e,edgesReconnectable:He,elementsSelectable:Pe,elevateNodesOnSelect:Qn,elevateEdgesOnSelect:us,minZoom:Z,maxZoom:ae,nodeExtent:Fe,onNodesChange:Rn,onEdgesChange:Wn,snapToGrid:ge,snapGrid:Me,connectionMode:Y,translateExtent:ne,connectOnClick:bs,defaultEdgeOptions:cs,fitView:zs,fitViewOptions:pi,onNodesDelete:I,onEdgesDelete:j,onDelete:L,onNodeDragStart:k,onNodeDrag:T,onNodeDragStop:C,onSelectionDrag:F,onSelectionDragStart:D,onSelectionDragStop:A,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:Xn,nodeOrigin:Ve,rfId:Pa,autoPanOnConnect:Ms,autoPanOnNodeDrag:Ss,autoPanSpeed:un,onError:ce,connectionRadius:on,isValidConnection:dn,selectNodesOnDrag:re,nodeDragThreshold:nt,connectionDragThreshold:at,onBeforeDelete:R,debug:ki,ariaLabelConfig:Ht,zIndexMode:Nt}),o.jsx(Rle,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:x,onNodeMouseMove:E,onNodeMouseLeave:w,onNodeContextMenu:_,onNodeDoubleClick:S,nodeTypes:r,edgeTypes:a,connectionLineType:J,connectionLineStyle:U,connectionLineComponent:te,connectionLineContainerStyle:K,selectionKeyCode:W,selectionOnDrag:q,selectionMode:ue,deleteKeyCode:V,multiSelectionKeyCode:Se,panActivationKeyCode:me,zoomActivationKeyCode:de,onlyRenderVisibleElements:ve,defaultViewport:qe,translateExtent:ne,minZoom:Z,maxZoom:ae,preventScrolling:be,zoomOnScroll:bt,zoomOnPinch:dt,zoomOnDoubleClick:$t,panOnScroll:cn,panOnScrollSpeed:Ut,panOnScrollMode:wt,panOnDrag:Ge,autoPanOnSelection:_s,onPaneClick:Yt,onPaneMouseEnter:it,onPaneMouseMove:ct,onPaneMouseLeave:Qe,onPaneScroll:vt,onPaneContextMenu:ye,paneClickDistance:Ze,nodeClickDistance:xt,onSelectionContextMenu:O,onSelectionStart:P,onSelectionEnd:$,onReconnect:Hn,onReconnectStart:ut,onReconnectEnd:pt,onEdgeContextMenu:gn,onEdgeDoubleClick:en,onEdgeMouseEnter:St,onEdgeMouseMove:an,onEdgeMouseLeave:ls,reconnectRadius:Rs,defaultMarkerColor:Ke,noDragClassName:bn,noWheelClassName:yn,noPanClassName:Xn,rfId:Pa,disableKeyboardA11y:Os,nodeExtent:Fe,viewport:We,onViewportChange:_t}),o.jsx(coe,{onSelectionChange:z}),rn,o.jsx(ioe,{proOptions:On,position:Js}),o.jsx(soe,{rfId:Pa,disableKeyboardA11y:Os})]})})}var aU=D9(Ple);const Ble=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function Ule({children:e}){const t=Qt(Ble);return t?hi.createPortal(e,t):null}function oU(e){const[t,n]=g.useState(e),s=g.useCallback(i=>n(r=>O9(i,r)),[]);return[t,n,s]}function lU(e){const[t,n]=g.useState(e),s=g.useCallback(i=>n(r=>M9(i,r)),[]);return[t,n,s]}const Fle=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(const[,{internals:n}]of t.nodeLookup)if(n.handleBounds===void 0||!tA(n.userNode))return!1;return!0};function $le(e={includeHiddenNodes:!1}){return Qt(Fle(e))}function Hle({dimensions:e,lineWidth:t,variant:n,className:s}){return o.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Zs(["react-flow__background-pattern",n,s])})}function zle({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:Zs(["react-flow__background-pattern","dots",t])})}var Hl;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Hl||(Hl={}));const Vle={[Hl.Dots]:1,[Hl.Lines]:1,[Hl.Cross]:6},Gle=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function cU({id:e,variant:t=Hl.Dots,gap:n=20,size:s,lineWidth:i=1,offset:r=0,color:a,bgColor:l,style:c,className:u,patternClassName:d}){const f=g.useRef(null),{transform:h,patternId:p}=Qt(Gle,ms),m=s||Vle[t],b=t===Hl.Dots,v=t===Hl.Cross,y=Array.isArray(n)?n:[n,n],x=[y[0]*h[2]||1,y[1]*h[2]||1],E=m*h[2],w=Array.isArray(r)?r:[r,r],_=v?[E,E]:x,S=[w[0]*h[2]||1+_[0]/2,w[1]*h[2]||1+_[1]/2],k=`${p}${e||""}`;return o.jsxs("svg",{className:Zs(["react-flow__background",u]),style:{...c,...E1,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[o.jsx("pattern",{id:k,x:h[0]%x[0],y:h[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${S[0]},-${S[1]})`,children:b?o.jsx(zle,{radius:E/2,className:d}):o.jsx(Hle,{dimensions:_,lineWidth:i,variant:t,className:d})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${k})`})]})}cU.displayName="Background";const uU=g.memo(cU);function Kle(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:o.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function qle(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:o.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Yle(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:o.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 Wle(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.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 Xle(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.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 F0({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:Zs(["react-flow__controls-button",t]),...n,children:e})}const Qle=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function dU({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:i,onZoomIn:r,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const m=gs(),{isInteractive:b,minZoomReached:v,maxZoomReached:y,ariaLabelConfig:x}=Qt(Qle,ms),{zoomIn:E,zoomOut:w,fitView:_}=x1(),S=()=>{E(),r==null||r()},k=()=>{w(),a==null||a()},T=()=>{_(i),l==null||l()},C=()=>{m.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},I=h==="horizontal"?"horizontal":"vertical";return o.jsxs(y1,{className:Zs(["react-flow__controls",I,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??x["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(F0,{onClick:S,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:y,children:o.jsx(Kle,{})}),o.jsx(F0,{onClick:k,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:v,children:o.jsx(qle,{})})]}),n&&o.jsx(F0,{className:"react-flow__controls-fitview",onClick:T,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:o.jsx(Yle,{})}),s&&o.jsx(F0,{className:"react-flow__controls-interactive",onClick:C,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:b?o.jsx(Xle,{}):o.jsx(Wle,{})}),d]})}dU.displayName="Controls";const fU=g.memo(dU);function Zle({id:e,x:t,y:n,width:s,height:i,style:r,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:m,backgroundColor:b}=r||{},v=a||m||b;return o.jsx("rect",{className:Zs(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:s,height:i,style:{fill:v,stroke:l,strokeWidth:c},shapeRendering:f,onClick:p?y=>p(y,e):void 0})}const Jle=g.memo(Zle),ece=e=>e.nodes.map(t=>t.id),Hv=e=>e instanceof Function?e:()=>e;function tce({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:i,nodeComponent:r=Jle,onClick:a}){const l=Qt(ece,ms),c=Hv(t),u=Hv(e),d=Hv(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(h=>o.jsx(sce,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:s,nodeStrokeWidth:i,NodeComponent:r,onClick:a,shapeRendering:f},h))})}function nce({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:s,nodeBorderRadius:i,nodeStrokeWidth:r,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=Qt(m=>{const b=m.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const v=b.internals.userNode,{x:y,y:x}=b.internals.positionAbsolute,{width:E,height:w}=Jo(v);return{node:v,x:y,y:x,width:E,height:w}},ms);return!u||u.hidden||!tA(u)?null:o.jsx(l,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:s(u),color:t(u),borderRadius:i,strokeColor:n(u),strokeWidth:r,shapeRendering:a,onClick:c,id:u.id})}const sce=g.memo(nce);var ice=g.memo(tce);const rce=200,ace=150,oce=e=>!e.hidden,lce=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?n9(mg(e.nodeLookup,{filter:oce}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},cce="react-flow__minimap-desc";function hU({style:e,className:t,nodeStrokeColor:n,nodeColor:s,nodeClassName:i="",nodeBorderRadius:r=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:m,pannable:b=!1,zoomable:v=!1,ariaLabel:y,inversePan:x,zoomStep:E=1,offsetScale:w=5}){const _=gs(),S=g.useRef(null),{boundingRect:k,viewBB:T,rfId:C,panZoom:I,translateExtent:j,flowWidth:L,flowHeight:z,ariaLabelConfig:D}=Qt(lce,ms),F=(e==null?void 0:e.width)??rce,A=(e==null?void 0:e.height)??ace,O=k.width/F,P=k.height/A,$=Math.max(O,P),R=$*F,Y=$*A,J=w*$,U=k.x-(R-k.width)/2-J,te=k.y-(Y-k.height)/2-J,K=R+J*2,V=Y+J*2,W=`${cce}-${C}`,q=g.useRef(0),ue=g.useRef();q.current=$,g.useEffect(()=>{if(S.current&&I)return ue.current=dae({domNode:S.current,panZoom:I,getTransform:()=>_.getState().transform,getViewScale:()=>q.current}),()=>{var ge;(ge=ue.current)==null||ge.destroy()}},[I]),g.useEffect(()=>{var ge;(ge=ue.current)==null||ge.update({translateExtent:j,width:L,height:z,inversePan:x,pannable:b,zoomStep:E,zoomable:v})},[b,v,x,E,j,L,z]);const me=p?ge=>{var re;const[Me,ve]=((re=ue.current)==null?void 0:re.pointer(ge))||[0,0];p(ge,{x:Me,y:ve})}:void 0,Se=m?g.useCallback((ge,Me)=>{const ve=_.getState().nodeLookup.get(Me).internals.userNode;m(ge,ve)},[]):void 0,de=y??D["minimap.ariaLabel"];return o.jsx(y1,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c: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*$:void 0,"--xy-minimap-node-background-color-props":typeof s=="string"?s: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:Zs(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:F,height:A,viewBox:`${U} ${te} ${K} ${V}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":W,ref:S,onClick:me,children:[de&&o.jsx("title",{id:W,children:de}),o.jsx(ice,{onClick:Se,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:r,nodeClassName:i,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${U-J},${te-J}h${K+J*2}v${V+J*2}h${-K-J*2}z - M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}hU.displayName="MiniMap";const uce=g.memo(hU),dce=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,fce={[_f.Line]:"right",[_f.Handle]:"bottom-right"};function hce({nodeId:e,position:t,variant:n=_f.Handle,className:s,style:i=void 0,children:r,color:a,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:p=!0,shouldResize:m,onResizeStart:b,onResize:v,onResizeEnd:y}){const x=F9(),E=typeof e=="string"?e:x,w=gs(),_=g.useRef(null),S=n===_f.Handle,k=Qt(g.useCallback(dce(S&&p),[S,p]),ms),T=g.useRef(null),C=t??fce[n];g.useEffect(()=>{if(!(!_.current||!E))return T.current||(T.current=_ae({domNode:_.current,nodeId:E,getStoreItems:()=>{const{nodeLookup:j,transform:L,snapGrid:z,snapToGrid:D,nodeOrigin:F,domNode:A}=w.getState();return{nodeLookup:j,transform:L,snapGrid:z,snapToGrid:D,nodeOrigin:F,paneDomNode:A}},onChange:(j,L)=>{const{triggerNodeChanges:z,nodeLookup:D,parentLookup:F,nodeOrigin:A}=w.getState(),O=[],P={x:j.x,y:j.y},$=D.get(E);if($&&$.expandParent&&$.parentId){const R=$.origin??A,Y=j.width??$.measured.width??0,J=j.height??$.measured.height??0,U={id:$.id,parentId:$.parentId,rect:{width:Y,height:J,...i9({x:j.x??$.position.x,y:j.y??$.position.y},{width:Y,height:J},$.parentId,D,R)}},te=oA([U],D,F,A);O.push(...te),P.x=j.x?Math.max(R[0]*Y,j.x):void 0,P.y=j.y?Math.max(R[1]*J,j.y):void 0}if(P.x!==void 0&&P.y!==void 0){const R={id:E,type:"position",position:{...P}};O.push(R)}if(j.width!==void 0&&j.height!==void 0){const Y={id:E,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:j.width,height:j.height}};O.push(Y)}for(const R of L){const Y={...R,type:"position"};O.push(Y)}z(O)},onEnd:({width:j,height:L})=>{const z={id:E,type:"dimensions",resizing:!1,dimensions:{width:j,height:L}};w.getState().triggerNodeChanges([z])}})),T.current.update({controlPosition:C,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:b,onResize:v,onResizeEnd:y,shouldResize:m}),()=>{var j;(j=T.current)==null||j.destroy()}},[C,l,c,u,d,f,b,v,y,m]);const I=C.split("-");return o.jsx("div",{className:Zs(["react-flow__resize-control","nodrag",...I,n,s]),ref:_,style:{...i,scale:k,...a&&{[S?"backgroundColor":"borderColor"]:a}},children:r})}g.memo(hce);var pU=Object.defineProperty,pce=(e,t,n)=>t in e?pU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mce=(e,t)=>{for(var n in t)pU(e,n,{get:t[n],enumerable:!0})},gce=(e,t,n)=>pce(e,t+"",n),mU={};mce(mU,{Graph:()=>oa,alg:()=>uA,json:()=>bU,version:()=>xce});var bce=Object.defineProperty,gU=(e,t)=>{for(var n in t)bce(e,n,{get:t[n],enumerable:!0})},oa=class{constructor(t){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},t&&(this._isDirected="directed"in t?t.directed:!0,this._isMultigraph="multigraph"in t?t.multigraph:!1,this._isCompound="compound"in t?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return typeof t!="function"?this._defaultNodeLabelFn=()=>t:this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(t=>Object.keys(this._in[t]).length===0)}sinks(){return this.nodes().filter(t=>Object.keys(this._out[t]).length===0)}setNodes(t,n){return t.forEach(s=>{n!==void 0?this.setNode(s,n):this.setNode(s)}),this}setNode(t,n){return t in this._nodes?(arguments.length>1&&(this._nodes[t]=n),this):(this._nodes[t]=arguments.length>1?n:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return t in this._nodes}removeNode(t){if(t in this._nodes){let n=s=>this.removeEdge(this._edgeObjs[s]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(s=>{this.setParent(s)}),delete this._children[t]),Object.keys(this._in[t]).forEach(n),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n="\0";else{n+="";for(let s=n;s!==void 0;s=this.parent(s))if(s===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=n,this._children[n][t]=!0,this}parent(t){if(this._isCompound){let n=this._parent[t];if(n!=="\0")return n}}children(t="\0"){if(this._isCompound){let n=this._children[t];if(n)return Object.keys(n)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}return[]}predecessors(t){let n=this._preds[t];if(n)return Object.keys(n)}successors(t){let n=this._sucs[t];if(n)return Object.keys(n)}neighbors(t){let n=this.predecessors(t);if(n){let s=new Set(n);for(let i of this.successors(t))s.add(i);return Array.from(s.values())}}isLeaf(t){let n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){let n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph()),Object.entries(this._nodes).forEach(([r,a])=>{t(r)&&n.setNode(r,a)}),Object.values(this._edgeObjs).forEach(r=>{n.hasNode(r.v)&&n.hasNode(r.w)&&n.setEdge(r,this.edge(r))});let s={},i=r=>{let a=this.parent(r);return!a||n.hasNode(a)?(s[r]=a??void 0,a??void 0):a in s?s[a]:i(a)};return this._isCompound&&n.nodes().forEach(r=>n.setParent(r,i(r))),n}setDefaultEdgeLabel(t){return typeof t!="function"?this._defaultEdgeLabelFn=()=>t:this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,n){return t.reduce((s,i)=>(n!==void 0?this.setEdge(s,i,n):this.setEdge(s,i),i)),this}setEdge(t,n,s,i){let r,a,l,c,u=!1;typeof t=="object"&&t!==null&&"v"in t?(r=t.v,a=t.w,l=t.name,arguments.length===2&&(c=n,u=!0)):(r=t,a=n,l=i,arguments.length>2&&(c=s,u=!0)),r=""+r,a=""+a,l!==void 0&&(l=""+l);let d=dp(this._isDirected,r,a,l);if(d in this._edgeLabels)return u&&(this._edgeLabels[d]=c),this;if(l!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(r),this.setNode(a),this._edgeLabels[d]=u?c:this._defaultEdgeLabelFn(r,a,l);let f=yce(this._isDirected,r,a,l);return r=f.v,a=f.w,Object.freeze(f),this._edgeObjs[d]=f,DO(this._preds[a],r),DO(this._sucs[r],a),this._in[a][d]=f,this._out[r][d]=f,this._edgeCount++,this}edge(t,n,s){let i=arguments.length===1?zv(this._isDirected,t):dp(this._isDirected,t,n,s);return this._edgeLabels[i]}edgeAsObj(t,n,s){let i=arguments.length===1?this.edge(t):this.edge(t,n,s);return typeof i!="object"?{label:i}:i}hasEdge(t,n,s){return(arguments.length===1?zv(this._isDirected,t):dp(this._isDirected,t,n,s))in this._edgeLabels}removeEdge(t,n,s){let i=arguments.length===1?zv(this._isDirected,t):dp(this._isDirected,t,n,s),r=this._edgeObjs[i];if(r){let a=r.v,l=r.w;delete this._edgeLabels[i],delete this._edgeObjs[i],PO(this._preds[l],a),PO(this._sucs[a],l),delete this._in[l][i],delete this._out[a][i],this._edgeCount--}return this}inEdges(t,n){return this.isDirected()?this.filterEdges(this._in[t],t,n):this.nodeEdges(t,n)}outEdges(t,n){return this.isDirected()?this.filterEdges(this._out[t],t,n):this.nodeEdges(t,n)}nodeEdges(t,n){if(t in this._nodes)return this.filterEdges({...this._in[t],...this._out[t]},t,n)}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}filterEdges(t,n,s){if(!t)return;let i=Object.values(t);return s?i.filter(r=>r.v===n&&r.w===s||r.v===s&&r.w===n):i}};function DO(e,t){e[t]?e[t]++:e[t]=1}function PO(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function dp(e,t,n,s){let i=""+t,r=""+n;if(!e&&i>r){let a=i;i=r,r=a}return i+""+r+""+(s===void 0?"\0":s)}function yce(e,t,n,s){let i=""+t,r=""+n;if(!e&&i>r){let l=i;i=r,r=l}let a={v:i,w:r};return s&&(a.name=s),a}function zv(e,t){return dp(e,t.v,t.w,t.name)}var xce="4.0.1",bU={};gU(bU,{read:()=>Sce,write:()=>Ece});function Ece(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:vce(e),edges:wce(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function vce(e){return e.nodes().map(t=>{let n=e.node(t),s=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),s!==void 0&&(i.parent=s),i})}function wce(e){return e.edges().map(t=>{let n=e.edge(t),s={v:t.v,w:t.w};return t.name!==void 0&&(s.name=t.name),n!==void 0&&(s.value=n),s})}function Sce(e){let t=new oa(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var uA={};gU(uA,{CycleException:()=>sx,bellmanFord:()=>yU,components:()=>Tce,dijkstra:()=>nx,dijkstraAll:()=>Cce,findCycles:()=>Ice,floydWarshall:()=>Rce,isAcyclic:()=>Mce,postorder:()=>Dce,preorder:()=>Pce,prim:()=>Bce,shortestPaths:()=>Uce,tarjan:()=>EU,topsort:()=>vU});var _ce=()=>1;function yU(e,t,n,s){return Nce(e,String(t),n||_ce,s||function(i){return e.outEdges(i)})}function Nce(e,t,n,s){let i={},r,a=0,l=e.nodes(),c=function(f){let h=n(f);i[f.v].distance+he.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,s=String(e);if(!(s in n)){let i=this._arr,r=i.length;return n[s]=r,i.push({key:s,priority:t}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let s=this._arr[n].priority;if(t>s)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${s} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,s=n+1,i=e;n>1,!(t[s].priority1;function nx(e,t,n,s){let i=function(r){return e.outEdges(r)};return Ace(e,String(t),n||kce,s||i)}function Ace(e,t,n,s){let i={},r=new xU,a,l,c=function(u){let d=u.v!==a?u.v:u.w,f=i[d],h=n(u),p=l.distance+h;if(h<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+h);p0&&(a=r.removeMin(),l=i[a],l.distance!==Number.POSITIVE_INFINITY);)s(a).forEach(c);return i}function Cce(e,t,n){return e.nodes().reduce(function(s,i){return s[i]=nx(e,i,t,n),s},{})}function EU(e){let t=0,n=[],s={},i=[];function r(a){let l=s[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){c in s?s[c].onStack&&(l.lowlink=Math.min(l.lowlink,s[c].index)):(r(c),l.lowlink=Math.min(l.lowlink,s[c].lowlink))}),l.lowlink===l.index){let c=[],u;do u=n.pop(),s[u].onStack=!1,c.push(u);while(a!==u);i.push(c)}}return e.nodes().forEach(function(a){a in s||r(a)}),i}function Ice(e){return EU(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var jce=()=>1;function Rce(e,t,n){return Oce(e,t||jce,n||function(s){return e.outEdges(s)})}function Oce(e,t,n){let s={},i=e.nodes();return i.forEach(function(r){s[r]={},s[r][r]={distance:0,predecessor:""},i.forEach(function(a){r!==a&&(s[r][a]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(r).forEach(function(a){let l=a.v===r?a.w:a.v,c=t(a);s[r][l]={distance:c,predecessor:r}})}),i.forEach(function(r){let a=s[r];i.forEach(function(l){let c=s[l];i.forEach(function(u){let d=c[r],f=a[u],h=c[u],p=d.distance+f.distance;p{var c;return(c=e.isDirected()?e.successors(l):e.neighbors(l))!=null?c:[]},a={};return t.forEach(function(l){if(!e.hasNode(l))throw new Error("Graph does not have node: "+l);i=wU(e,l,n==="post",a,r,s,i)}),i}function wU(e,t,n,s,i,r,a){return t in s||(s[t]=!0,n||(a=r(a,t)),i(t).forEach(function(l){a=wU(e,l,n,s,i,r,a)}),n&&(a=r(a,t))),a}function SU(e,t,n){return Lce(e,t,n,function(s,i){return s.push(i),s},[])}function Dce(e,t){return SU(e,t,"post")}function Pce(e,t){return SU(e,t,"pre")}function Bce(e,t){let n=new oa,s={},i=new xU,r;function a(c){let u=c.v===r?c.w:c.v,d=i.priority(u);if(d!==void 0){let f=t(c);f0;){if(r=i.removeMin(),r in s)n.setEdge(r,s[r]);else{if(l)throw new Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(r).forEach(a)}return n}function Uce(e,t,n,s){return Fce(e,t,n,s??(i=>{let r=e.outEdges(i);return r??[]}))}function Fce(e,t,n,s){if(n===void 0)return nx(e,t,n,s);let i=!1,r=e.nodes();for(let a=0;at.setNode(n,e.node(n))),e.edges().forEach(n=>{let s=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:s.weight+i.weight,minlen:Math.max(s.minlen,i.minlen)})}),t}function _U(e){let t=new oa({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function BO(e,t){let n=e.x,s=e.y,i=t.x-n,r=t.y-s,a=e.width/2,l=e.height/2;if(!i&&!r)throw new Error("Not possible to find intersection inside of the rectangle");let c,u;return Math.abs(r)*a>Math.abs(i)*l?(r<0&&(l=-l),c=l*i/r,u=l):(i<0&&(a=-a),c=a,u=a*r/i),{x:n+c,y:s+u}}function yg(e){let t=Om(TU(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let s=e.node(n),i=s.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][s.order]=n)}),t}function Hce(e){let t=e.nodes().map(s=>{let i=e.node(s).rank;return i===void 0?Number.MAX_VALUE:i}),n=Za(Math.min,t);e.nodes().forEach(s=>{let i=e.node(s);Object.hasOwn(i,"rank")&&(i.rank-=n)})}function zce(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=Za(Math.min,t),s=[];e.nodes().forEach(a=>{let l=e.node(a).rank-n;s[l]||(s[l]=[]),s[l].push(a)});let i=0,r=e.graph().nodeRankFactor;Array.from(s).forEach((a,l)=>{a===void 0&&l%r!==0?--i:a!==void 0&&i&&a.forEach(c=>e.node(c).rank+=i)})}function UO(e,t,n,s){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=s),Jf(e,"border",i,t)}function Vce(e,t=NU){let n=[];for(let s=0;sNU){let n=Vce(t);return e(...n.map(s=>e(...s)))}else return e(...t)}function TU(e){let t=e.nodes().map(n=>{let s=e.node(n).rank;return s===void 0?Number.MIN_VALUE:s});return Za(Math.max,t)}function Gce(e,t){let n={lhs:[],rhs:[]};return e.forEach(s=>{t(s)?n.lhs.push(s):n.rhs.push(s)}),n}function kU(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function AU(e,t){return t()}var Kce=0;function dA(e){let t=++Kce;return e+(""+t)}function Om(e,t,n=1){t==null&&(t=e,e=0);let s=r=>rts[t]:n=t,Object.entries(e).reduce((s,[i,r])=>(s[i]=n(r,i),s),{})}function qce(e,t){return e.reduce((n,s,i)=>(n[s]=t[i],n),{})}var w1="\0",Yce="3.0.0",Wce=class{constructor(){gce(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return FO(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&FO(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,Xce)),n=n._prev;return"["+e.join(", ")+"]"}};function FO(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Xce(e,t){if(e!=="_next"&&e!=="_prev")return t}var Qce=Wce,Zce=()=>1;function Jce(e,t){if(e.nodeCount()<=1)return[];let n=tue(e,t||Zce);return eue(n.graph,n.buckets,n.zeroIdx).flatMap(s=>e.outEdges(s.v,s.w)||[])}function eue(e,t,n){var s;let i=[],r=t[t.length-1],a=t[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)Vv(e,t,n,l);for(;l=r.dequeue();)Vv(e,t,n,l);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(l=(s=t[c])==null?void 0:s.dequeue(),l){i=i.concat(Vv(e,t,n,l,!0)||[]);break}}}return i}function Vv(e,t,n,s,i){let r=[],a=i?r:void 0;return(e.inEdges(s.v)||[]).forEach(l=>{let c=e.edge(l),u=e.node(l.v);i&&r.push({v:l.v,w:l.w}),u.out-=c,L_(t,n,u)}),(e.outEdges(s.v)||[]).forEach(l=>{let c=e.edge(l),u=l.w,d=e.node(u);d.in-=c,L_(t,n,d)}),e.removeNode(s.v),a}function tue(e,t){let n=new oa,s=0,i=0;e.nodes().forEach(l=>{n.setNode(l,{v:l,in:0,out:0})}),e.edges().forEach(l=>{let c=n.edge(l.v,l.w)||0,u=t(l),d=c+u;n.setEdge(l.v,l.w,d);let f=n.node(l.v),h=n.node(l.w);i=Math.max(i,f.out+=u),s=Math.max(s,h.in+=u)});let r=nue(i+s+3).map(()=>new Qce),a=s+1;return n.nodes().forEach(l=>{L_(r,a,n.node(l))}),{graph:n,buckets:r,zeroIdx:a}}function L_(e,t,n){var s,i,r;n.out?n.in?(r=e[n.out-n.in+t])==null||r.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(s=e[0])==null||s.enqueue(n)}function nue(e){let t=[];for(let n=0;n{let s=e.edge(n);e.removeEdge(n),s.forwardName=n.name,s.reversed=!0,e.setEdge(n.w,n.v,s,dA("rev"))});function t(n){return s=>n.edge(s).weight}}function iue(e){let t=[],n={},s={};function i(r){Object.hasOwn(s,r)||(s[r]=!0,n[r]=!0,e.outEdges(r).forEach(a=>{Object.hasOwn(n,a.w)?t.push(a):i(a.w)}),delete n[r])}return e.nodes().forEach(i),t}function rue(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let s=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,s)}})}function aue(e){e.graph().dummyChains=[],e.edges().forEach(t=>oue(e,t))}function oue(e,t){let n=t.v,s=e.node(n).rank,i=t.w,r=e.node(i).rank,a=t.name,l=e.edge(t),c=l.labelRank;if(r===s+1)return;e.removeEdge(t);let u,d,f;for(f=0,++s;s{let n=e.node(t),s=n.edgeLabel,i;for(e.setEdge(n.edgeObj,s);n.dummy;)i=e.successors(t)[0],e.removeNode(t),s.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height),t=i,n=e.node(t)})}function fA(e){let t={};function n(s){let i=e.node(s);if(Object.hasOwn(t,s))return i.rank;t[s]=!0;let r=e.outEdges(s),a=r?r.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],l=Za(Math.min,a);return l===Number.POSITIVE_INFINITY&&(l=0),i.rank=l}e.sources().forEach(n)}function Tf(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var CU=cue;function cue(e){let t=new oa({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let s=n[0],i=e.nodeCount();t.setNode(s,{});let r,a;for(;uue(t,e){let a=r.v,l=s===a?r.w:a;!e.hasNode(l)&&!Tf(t,r)&&(e.setNode(l,{}),e.setEdge(s,l,{}),n(l))})}return e.nodes().forEach(n),e.nodeCount()}function due(e,t){return t.edges().reduce((n,s)=>{let i=Number.POSITIVE_INFINITY;return e.hasNode(s.v)!==e.hasNode(s.w)&&(i=Tf(t,s)),it.node(s).rank+=n)}var{preorder:hue,postorder:pue}=uA,mue=Su;Su.initLowLimValues=pA;Su.initCutValues=hA;Su.calcCutValue=IU;Su.leaveEdge=RU;Su.enterEdge=OU;Su.exchangeEdges=MU;function Su(e){e=$ce(e),fA(e);let t=CU(e);pA(t),hA(t,e);let n,s;for(;n=RU(t);)s=OU(t,e,n),MU(t,e,n,s)}function hA(e,t){let n=pue(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(s=>gue(e,t,s))}function gue(e,t,n){let s=e.node(n).parent,i=e.edge(n,s);i.cutvalue=IU(e,t,n)}function IU(e,t,n){let s=e.node(n).parent,i=!0,r=t.edge(n,s),a=0;r||(i=!1,r=t.edge(s,n)),a=r.weight;let l=t.nodeEdges(n);return l&&l.forEach(c=>{let u=c.v===n,d=u?c.w:c.v;if(d!==s){let f=u===i,h=t.edge(c).weight;if(a+=f?h:-h,yue(e,n,d)){let p=e.edge(n,d).cutvalue;a+=f?-p:p}}}),a}function pA(e,t){arguments.length<2&&(t=e.nodes()[0]),jU(e,{},1,t)}function jU(e,t,n,s,i){let r=n,a=e.node(s);t[s]=!0;let l=e.neighbors(s);return l&&l.forEach(c=>{Object.hasOwn(t,c)||(n=jU(e,t,n,c,s))}),a.low=r,a.lim=n++,i?a.parent=i:delete a.parent,n}function RU(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function OU(e,t,n){let s=n.v,i=n.w;t.hasEdge(s,i)||(s=n.w,i=n.v);let r=e.node(s),a=e.node(i),l=r,c=!1;return r.lim>a.lim&&(l=a,c=!0),t.edges().filter(u=>c===$O(e,e.node(u.v),l)&&c!==$O(e,e.node(u.w),l)).reduce((u,d)=>Tf(t,d)!e.node(i).parent);if(!n)return;let s=hue(e,[n]);s=s.slice(1),s.forEach(i=>{let r=e.node(i).parent,a=t.edge(i,r),l=!1;a||(a=t.edge(r,i),l=!0),t.node(i).rank=t.node(r).rank+(l?a.minlen:-a.minlen)})}function yue(e,t,n){return e.hasEdge(t,n)}function $O(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var xue=Eue;function Eue(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":HO(e);break;case"tight-tree":wue(e);break;case"longest-path":vue(e);break;case"none":break;default:HO(e)}}var vue=fA;function wue(e){fA(e),CU(e)}function HO(e){mue(e)}var Sue=_ue;function _ue(e){let t=Tue(e);e.graph().dummyChains.forEach(n=>{let s=e.node(n),i=s.edgeObj,r=Nue(e,t,i.v,i.w),a=r.path,l=r.lca,c=0,u=a[c],d=!0;for(;n!==i.w;){if(s=e.node(n),d){for(;(u=a[c])!==l&&e.node(u).maxRanka||l>t[c].lim));let u=c,d=s;for(;(d=e.parent(d))!==u;)r.push(d);return{path:i.concat(r.reverse()),lca:u}}function Tue(e){let t={},n=0;function s(i){let r=n;e.children(i).forEach(s),t[i]={low:r,lim:n++}}return e.children(w1).forEach(s),t}function kue(e){let t=Jf(e,"root",{},"_root"),n=Aue(e),s=Object.values(n),i=Za(Math.max,s)-1,r=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=r);let a=Cue(e)+1;e.children(w1).forEach(l=>LU(e,t,r,a,i,n,l)),e.graph().nodeRankFactor=r}function LU(e,t,n,s,i,r,a){var l;let c=e.children(a);if(!c.length){a!==t&&e.setEdge(t,a,{weight:0,minlen:n});return}let u=UO(e,"_bt"),d=UO(e,"_bb"),f=e.node(a);e.setParent(u,a),f.borderTop=u,e.setParent(d,a),f.borderBottom=d,c.forEach(h=>{var p;LU(e,t,n,s,i,r,h);let m=e.node(h),b=m.borderTop?m.borderTop:h,v=m.borderBottom?m.borderBottom:h,y=m.borderTop?s:2*s,x=b!==v?1:i-((p=r[a])!=null?p:0)+1;e.setEdge(u,b,{weight:y,minlen:x,nestingEdge:!0}),e.setEdge(v,d,{weight:y,minlen:x,nestingEdge:!0})}),e.parent(a)||e.setEdge(t,u,{weight:0,minlen:i+((l=r[a])!=null?l:0)})}function Aue(e){let t={};function n(s,i){let r=e.children(s);r&&r.length&&r.forEach(a=>n(a,i+1)),t[s]=i}return e.children(w1).forEach(s=>n(s,1)),t}function Cue(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Iue(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var jue=Rue;function Rue(e){function t(n){let s=e.children(n),i=e.node(n);if(s.length&&s.forEach(t),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let r=i.minRank,a=i.maxRank+1;rVO(e.node(t))),e.edges().forEach(t=>VO(e.edge(t)))}function VO(e){let t=e.width;e.width=e.height,e.height=t}function Lue(e){e.nodes().forEach(t=>Gv(e.node(t))),e.edges().forEach(t=>{var n;let s=e.edge(t);(n=s.points)==null||n.forEach(Gv),Object.hasOwn(s,"y")&&Gv(s)})}function Gv(e){e.y=-e.y}function Due(e){e.nodes().forEach(t=>Kv(e.node(t))),e.edges().forEach(t=>{var n;let s=e.edge(t);(n=s.points)==null||n.forEach(Kv),Object.hasOwn(s,"x")&&Kv(s)})}function Kv(e){let t=e.x;e.x=e.y,e.y=t}function Pue(e){let t={},n=e.nodes().filter(l=>!e.children(l).length),s=n.map(l=>e.node(l).rank),i=Za(Math.max,s),r=Om(i+1).map(()=>[]);function a(l){if(t[l])return;t[l]=!0;let c=e.node(l);r[c.rank].push(l);let u=e.successors(l);u&&u.forEach(a)}return n.sort((l,c)=>e.node(l).rank-e.node(c).rank).forEach(a),r}function Bue(e,t){let n=0;for(let s=1;sd)),i=t.flatMap(u=>{let d=e.outEdges(u);return d?d.map(f=>({pos:s[f.w],weight:e.edge(f).weight})).sort((f,h)=>f.pos-h.pos):[]}),r=1;for(;r{let d=u.pos+r;l[d]+=u.weight;let f=0;for(;d>0;)d%2&&(f+=l[d+1]),d=d-1>>1,l[d]+=u.weight;c+=u.weight*f}),c}function Fue(e,t=[]){return t.map(n=>{let s=e.inEdges(n);if(!s||!s.length)return{v:n};{let i=s.reduce((r,a)=>{let l=e.edge(a),c=e.node(a.v);return{sum:r.sum+l.weight*c.order,weight:r.weight+l.weight}},{sum:0,weight:0});return{v:n,barycenter:i.sum/i.weight,weight:i.weight}}})}function $ue(e,t){let n={};e.forEach((i,r)=>{let a={indegree:0,in:[],out:[],vs:[i.v],i:r};i.barycenter!==void 0&&(a.barycenter=i.barycenter,a.weight=i.weight),n[i.v]=a}),t.edges().forEach(i=>{let r=n[i.v],a=n[i.w];r!==void 0&&a!==void 0&&(a.indegree++,r.out.push(a))});let s=Object.values(n).filter(i=>!i.indegree);return Hue(s)}function Hue(e){let t=[];function n(i){return r=>{r.merged||(r.barycenter===void 0||i.barycenter===void 0||r.barycenter>=i.barycenter)&&zue(i,r)}}function s(i){return r=>{r.in.push(i),--r.indegree===0&&e.push(r)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(s(i))}return t.filter(i=>!i.merged).map(i=>ix(i,["vs","i","barycenter","weight"]))}function zue(e,t){let n=0,s=0;e.weight&&(n+=e.barycenter*e.weight,s+=e.weight),t.weight&&(n+=t.barycenter*t.weight,s+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/s,e.weight=s,e.i=Math.min(t.i,e.i),t.merged=!0}function Vue(e,t){let n=Gce(e,d=>Object.hasOwn(d,"barycenter")),s=n.lhs,i=n.rhs.sort((d,f)=>f.i-d.i),r=[],a=0,l=0,c=0;s.sort(Gue(!!t)),c=GO(r,i,c),s.forEach(d=>{c+=d.vs.length,r.push(d.vs),a+=d.barycenter*d.weight,l+=d.weight,c=GO(r,i,c)});let u={vs:r.flat(1)};return l&&(u.barycenter=a/l,u.weight=l),u}function GO(e,t,n){let s;for(;t.length&&(s=t[t.length-1]).i<=n;)t.pop(),e.push(s.vs),n++;return n}function Gue(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}function PU(e,t,n,s){let i=e.children(t),r=e.node(t),a=r?r.borderLeft:void 0,l=r?r.borderRight:void 0,c={};a&&(i=i.filter(h=>h!==a&&h!==l));let u=Fue(e,i);u.forEach(h=>{if(e.children(h.v).length){let p=PU(e,h.v,n,s);c[h.v]=p,Object.hasOwn(p,"barycenter")&&que(h,p)}});let d=$ue(u,n);Kue(d,c);let f=Vue(d,s);if(a&&l){f.vs=[a,f.vs,l].flat(1);let h=e.predecessors(a);if(h&&h.length){let p=e.node(h[0]),m=e.predecessors(l),b=e.node(m[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+p.order+b.order)/(f.weight+2),f.weight+=2}}return f}function Kue(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(s=>t[s]?t[s].vs:s)})}function que(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function Yue(e,t,n,s){s||(s=e.nodes());let i=Wue(e),r=new oa({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(a=>e.node(a));return s.forEach(a=>{let l=e.node(a),c=e.parent(a);if(l.rank===t||l.minRank<=t&&t<=l.maxRank){r.setNode(a),r.setParent(a,c||i);let u=e[n](a);u&&u.forEach(d=>{let f=d.v===a?d.w:d.v,h=r.edge(f,a),p=h!==void 0?h.weight:0;r.setEdge(f,a,{weight:e.edge(d).weight+p})}),Object.hasOwn(l,"minRank")&&r.setNode(a,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]})}}),r}function Wue(e){let t;for(;e.hasNode(t=dA("_root")););return t}function Xue(e,t,n){let s={},i;n.forEach(r=>{let a=e.parent(r),l,c;for(;a;){if(l=e.parent(a),l?(c=s[l],s[l]=a):(c=i,i=a),c&&c!==a){t.setEdge(c,a);return}a=l}})}function BU(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,BU);return}let n=TU(e),s=KO(e,Om(1,n+1),"inEdges"),i=KO(e,Om(n-1,-1,-1),"outEdges"),r=Pue(e);if(qO(e,r),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,l,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){Que(u%2?s:i,u%4>=2,c),r=yg(e);let f=Bue(e,r);f{s.has(r)||s.set(r,[]),s.get(r).push(a)};for(let r of e.nodes()){let a=e.node(r);if(typeof a.rank=="number"&&i(a.rank,r),typeof a.minRank=="number"&&typeof a.maxRank=="number")for(let l=a.minRank;l<=a.maxRank;l++)l!==a.rank&&i(l,r)}return t.map(function(r){return Yue(e,r,n,s.get(r)||[])})}function Que(e,t,n){let s=new oa;e.forEach(function(i){n.forEach(l=>s.setEdge(l.left,l.right));let r=i.graph().root,a=PU(i,r,s,t);a.vs.forEach((l,c)=>i.node(l).order=c),Xue(i,s,a.vs)})}function qO(e,t){Object.values(t).forEach(n=>n.forEach((s,i)=>e.node(s).order=i))}function Zue(e,t){let n={};function s(i,r){let a=0,l=0,c=i.length,u=r[r.length-1];return r.forEach((d,f)=>{let h=ede(e,d),p=h?e.node(h).order:c;(h||d===u)&&(r.slice(l,f+1).forEach(m=>{let b=e.predecessors(m);b&&b.forEach(v=>{let y=e.node(v),x=y.order;(x{let f=r[d];if(f!==void 0&&e.node(f).dummy){let h=e.predecessors(f);h&&h.forEach(p=>{if(p===void 0)return;let m=e.node(p);m.dummy&&(m.orderu)&&UU(n,p,f)})}})}function i(r,a){let l=-1,c=-1,u=0;return a.forEach((d,f)=>{if(e.node(d).dummy==="border"){let h=e.predecessors(d);if(h&&h.length){let p=h[0];if(p===void 0)return;c=e.node(p).order,s(a,u,f,l,c),u=f,l=c}}s(a,u,a.length,c,r.length)}),a}return t.length&&t.reduce(i),n}function ede(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(s=>e.node(s).dummy)}}function UU(e,t,n){if(t>n){let i=t;t=n,n=i}let s=e[t];s||(e[t]=s={}),s[n]=!0}function tde(e,t,n){if(t>n){let i=t;t=n,n=i}let s=e[t];return s!==void 0&&Object.hasOwn(s,n)}function nde(e,t,n,s){let i={},r={},a={};return t.forEach(l=>{l.forEach((c,u)=>{i[c]=c,r[c]=c,a[c]=u})}),t.forEach(l=>{let c=-1;l.forEach(u=>{let d=s(u);if(d&&d.length){let f=d.sort((p,m)=>{let b=a[p],v=a[m];return(b!==void 0?b:0)-(v!==void 0?v:0)}),h=(f.length-1)/2;for(let p=Math.floor(h),m=Math.ceil(h);p<=m;++p){let b=f[p];if(b===void 0)continue;let v=a[b];if(v!==void 0&&r[u]===u&&c{var y;let x=(y=r[v.v])!=null?y:0,E=a.edge(v);return Math.max(b,x+(E!==void 0?E:0))},0):r[p]=0}function d(p){let m=a.outEdges(p),b=Number.POSITIVE_INFINITY;m&&(b=m.reduce((y,x)=>{let E=r[x.w],w=a.edge(x);return Math.min(y,(E!==void 0?E:0)-(w!==void 0?w:0))},Number.POSITIVE_INFINITY));let v=e.node(p);b!==Number.POSITIVE_INFINITY&&v.borderType!==l&&(r[p]=Math.max(r[p]!==void 0?r[p]:0,b))}function f(p){return a.predecessors(p)||[]}function h(p){return a.successors(p)||[]}return c(u,f),c(d,h),Object.keys(s).forEach(p=>{var m;let b=n[p];b!==void 0&&(r[p]=(m=r[b])!=null?m:0)}),r}function ide(e,t,n,s){let i=new oa,r=e.graph(),a=cde(r.nodesep,r.edgesep,s);return t.forEach(l=>{let c;l.forEach(u=>{let d=n[u];if(d!==void 0){if(i.setNode(d),c!==void 0){let f=n[c];if(f!==void 0){let h=i.edge(f,d);i.setEdge(f,d,Math.max(a(e,u,c),h||0))}}c=u}})}),i}function rde(e,t){return Object.values(t).reduce((n,s)=>{let i=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;Object.entries(s).forEach(([l,c])=>{let u=ude(e,l)/2;i=Math.max(c+u,i),r=Math.min(c-u,r)});let a=i-r;return a{["l","r"].forEach(a=>{let l=r+a,c=e[l];if(!c||c===t)return;let u=Object.values(c),d=s-Za(Math.min,u);a!=="l"&&(d=i-Za(Math.max,u)),d&&(e[l]=v1(c,f=>f+d))})})}function ode(e,t=void 0){let n=e.ul;return n?v1(n,(s,i)=>{var r,a;if(t){let c=t.toLowerCase(),u=e[c];if(u&&u[i]!==void 0)return u[i]}let l=Object.values(e).map(c=>{let u=c[i];return u!==void 0?u:0}).sort((c,u)=>c-u);return(((r=l[1])!=null?r:0)+((a=l[2])!=null?a:0))/2}):{}}function lde(e){let t=yg(e),n=Object.assign(Zue(e,t),Jue(e,t)),s={},i;["u","d"].forEach(a=>{i=a==="u"?t:Object.values(t).reverse(),["l","r"].forEach(l=>{l==="r"&&(i=i.map(d=>Object.values(d).reverse()));let c=nde(e,i,n,d=>(a==="u"?e.predecessors(d):e.successors(d))||[]),u=sde(e,i,c.root,c.align,l==="r");l==="r"&&(u=v1(u,d=>-d)),s[a+l]=u})});let r=rde(e,s);return ade(s,r),ode(s,e.graph().align)}function cde(e,t,n){return(s,i,r)=>{let a=s.node(i),l=s.node(r),c=0,u;if(c+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":u=-a.width/2;break;case"r":u=a.width/2;break}if(u&&(c+=n?u:-u),u=void 0,c+=(a.dummy?t:e)/2,c+=(l.dummy?t:e)/2,c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":u=l.width/2;break;case"r":u=-l.width/2;break}return u&&(c+=n?u:-u),c}}function ude(e,t){return e.node(t).width}function dde(e){e=_U(e),fde(e),Object.entries(lde(e)).forEach(([t,n])=>e.node(t).x=n)}function fde(e){let t=yg(e),n=e.graph(),s=n.ranksep,i=n.rankalign,r=0;t.forEach(a=>{let l=a.reduce((c,u)=>{var d;let f=(d=e.node(u).height)!=null?d:0;return c>f?c:f},0);a.forEach(c=>{let u=e.node(c);i==="top"?u.y=r+u.height/2:i==="bottom"?u.y=r+l-u.height/2:u.y=r+l/2}),r+=l+s})}function hde(e,t={}){let n=t.debugTiming?kU:AU;return n("layout",()=>{let s=n(" buildLayoutGraph",()=>Sde(e));return n(" runLayout",()=>pde(s,n,t)),n(" updateInputGraph",()=>mde(e,s)),s})}function pde(e,t,n){t(" makeSpaceForEdgeLabels",()=>_de(e)),t(" removeSelfEdges",()=>Ode(e)),t(" acyclic",()=>sue(e)),t(" nestingGraph.run",()=>kue(e)),t(" rank",()=>xue(_U(e))),t(" injectEdgeLabelProxies",()=>Nde(e)),t(" removeEmptyRanks",()=>zce(e)),t(" nestingGraph.cleanup",()=>Iue(e)),t(" normalizeRanks",()=>Hce(e)),t(" assignRankMinMax",()=>Tde(e)),t(" removeEdgeLabelProxies",()=>kde(e)),t(" normalize.run",()=>aue(e)),t(" parentDummyChains",()=>Sue(e)),t(" addBorderSegments",()=>jue(e)),t(" order",()=>BU(e,n)),t(" insertSelfEdges",()=>Mde(e)),t(" adjustCoordinateSystem",()=>Oue(e)),t(" position",()=>dde(e)),t(" positionSelfEdges",()=>Lde(e)),t(" removeBorderNodes",()=>Rde(e)),t(" normalize.undo",()=>lue(e)),t(" fixupEdgeLabelCoords",()=>Ide(e)),t(" undoCoordinateSystem",()=>Mue(e)),t(" translateGraph",()=>Ade(e)),t(" assignNodeIntersects",()=>Cde(e)),t(" reversePoints",()=>jde(e)),t(" acyclic.undo",()=>rue(e))}function mde(e,t){e.nodes().forEach(n=>{let s=e.node(n),i=t.node(n);s&&(s.x=i.x,s.y=i.y,s.order=i.order,s.rank=i.rank,t.children(n).length&&(s.width=i.width,s.height=i.height))}),e.edges().forEach(n=>{let s=e.edge(n),i=t.edge(n);s.points=i.points,Object.hasOwn(i,"x")&&(s.x=i.x,s.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var gde=["nodesep","edgesep","ranksep","marginx","marginy"],bde={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},yde=["acyclicer","ranker","rankdir","align","rankalign"],xde=["width","height","rank"],YO={width:0,height:0},Ede=["minlen","weight","width","height","labeloffset"],vde={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},wde=["labelpos"];function Sde(e){let t=new oa({multigraph:!0,compound:!0}),n=Yv(e.graph());return t.setGraph(Object.assign({},bde,qv(n,gde),ix(n,yde))),e.nodes().forEach(s=>{let i=Yv(e.node(s)),r=qv(i,xde);Object.keys(YO).forEach(l=>{r[l]===void 0&&(r[l]=YO[l])}),t.setNode(s,r);let a=e.parent(s);a!==void 0&&t.setParent(s,a)}),e.edges().forEach(s=>{let i=Yv(e.edge(s));t.setEdge(s,Object.assign({},vde,qv(i,Ede),ix(i,wde)))}),t}function _de(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let s=e.edge(n);s.minlen*=2,s.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?s.width+=s.labeloffset:s.height+=s.labeloffset)})}function Nde(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let s=e.node(t.v),i={rank:(e.node(t.w).rank-s.rank)/2+s.rank,e:t};Jf(e,"edge-proxy",i,"_ep")}})}function Tde(e){let t=0;e.nodes().forEach(n=>{let s=e.node(n);s.borderTop&&(s.minRank=e.node(s.borderTop).rank,s.maxRank=e.node(s.borderBottom).rank,t=Math.max(t,s.maxRank))}),e.graph().maxRank=t}function kde(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let s=n;e.edge(s.e).labelRank=n.rank,e.removeNode(t)}})}function Ade(e){let t=Number.POSITIVE_INFINITY,n=0,s=Number.POSITIVE_INFINITY,i=0,r=e.graph(),a=r.marginx||0,l=r.marginy||0;function c(u){let d=u.x,f=u.y,h=u.width,p=u.height;t=Math.min(t,d-h/2),n=Math.max(n,d+h/2),s=Math.min(s,f-p/2),i=Math.max(i,f+p/2)}e.nodes().forEach(u=>c(e.node(u))),e.edges().forEach(u=>{let d=e.edge(u);Object.hasOwn(d,"x")&&c(d)}),t-=a,s-=l,e.nodes().forEach(u=>{let d=e.node(u);d.x-=t,d.y-=s}),e.edges().forEach(u=>{let d=e.edge(u);d.points.forEach(f=>{f.x-=t,f.y-=s}),Object.hasOwn(d,"x")&&(d.x-=t),Object.hasOwn(d,"y")&&(d.y-=s)}),r.width=n-t+a,r.height=i-s+l}function Cde(e){e.edges().forEach(t=>{let n=e.edge(t),s=e.node(t.v),i=e.node(t.w),r,a;n.points?(r=n.points[0],a=n.points[n.points.length-1]):(n.points=[],r=i,a=s),n.points.unshift(BO(s,r)),n.points.push(BO(i,a))})}function Ide(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function jde(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Rde(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),s=e.node(n.borderTop),i=e.node(n.borderBottom),r=e.node(n.borderLeft[n.borderLeft.length-1]),a=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-r.x),n.height=Math.abs(i.y-s.y),n.x=r.x+n.width/2,n.y=s.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function Ode(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Mde(e){yg(e).forEach(t=>{let n=0;t.forEach((s,i)=>{let r=e.node(s);r.order=i+n,(r.selfEdges||[]).forEach(a=>{Jf(e,"selfedge",{width:a.label.width,height:a.label.height,rank:r.rank,order:i+ ++n,e:a.e,label:a.label},"_se")}),delete r.selfEdges})})}function Lde(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let s=n,i=e.node(s.e.v),r=i.x+i.width/2,a=i.y,l=n.x-r,c=i.height/2;e.setEdge(s.e,s.label),e.removeNode(t),s.label.points=[{x:r+2*l/3,y:a-c},{x:r+5*l/6,y:a-c},{x:r+l,y:a},{x:r+5*l/6,y:a+c},{x:r+2*l/3,y:a+c}],s.label.x=n.x,s.label.y=n.y}})}function qv(e,t){return v1(ix(e,t),Number)}function Yv(e){let t={};return e&&Object.entries(e).forEach(([n,s])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=s}),t}function Dde(e){let t=yg(e),n=new oa({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(s=>{n.setNode(s,{label:s}),n.setParent(s,"layer"+e.node(s).rank)}),e.edges().forEach(s=>n.setEdge(s.v,s.w,{},s.name)),t.forEach((s,i)=>{let r="layer"+i;n.setNode(r,{rank:"same"}),s.reduce((a,l)=>(n.setEdge(a,l,{style:"invis"}),l))}),n}var Pde={graphlib:mU,version:Yce,layout:hde,debug:Dde,util:{time:kU,notime:AU}},WO=Pde;/*! For license information please see dagre.esm.js.LEGAL.txt */const fp={llm:{label:"智能体",description:"理解任务并直接完成一个具体工作",icon:ru},sequential:{label:"分步协作",description:"内部步骤按照顺序依次执行",icon:bB},parallel:{label:"同时处理",description:"内部步骤同时工作,完成后统一汇总",icon:uB},loop:{label:"循环执行",description:"重复执行内部步骤,直到满足停止条件",icon:Ak},a2a:{label:"远程智能体",description:"调用已经存在的远程 Agent",icon:e1}},D_=220,P_=88,XO=96,QO=34,Hp=64,Wv=310,jd=24,FU=56,B_=40,ZO=40,Bde=18,Ude=58,Fde=!1,$de=e=>e==="sequential"||e==="parallel"||e==="loop";function U_(e,t){const n=e.agentType??"llm";return $de(n)||n==="llm"&&(t.length===0||e.subAgents.length>0)}function F_(e,t=[],n="horizontal",s=!1){const i=e.agentType??"llm";if(!U_(e,t))return{width:D_,height:P_};if(s&&e.subAgents.length===0)return{width:Wv,height:Hp};const r=e.subAgents.map((f,h)=>F_(f,[...t,h],n,s)),a=r.length?Math.max(...r.map(f=>f.width)):0,l=r.length?Math.max(...r.map(f=>f.height)):0,c=r.length&&i!=="parallel"?FU:jd,u=n==="horizontal"?i!=="parallel":i==="parallel",d=r.length?i==="parallel"?Bde+ZO:i==="loop"?Ude:0:ZO;return u?{width:Math.max(Wv,r.reduce((f,h)=>f+h.width,0)+B_*Math.max(0,r.length-1)+c*2),height:Hp+jd+l+d+jd}:{width:Math.max(Wv,a+jd*2),height:Hp+c+r.reduce((f,h)=>f+h.height,0)+B_*Math.max(0,r.length-1)+d+c}}function $h(e){return e.length===0?"agent-root":`agent-${e.join("-")}`}function Hde(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}function JO(e){const t=n=>[n.agentType??"llm",n.subAgents.map(t)];return JSON.stringify(t(e))}function Hh(e,t,n,s){const i=(s==null?void 0:s.tone)==="sequential"?"hsl(213 40% 40%)":(s==null?void 0:s.tone)==="loop"?"hsl(151 34% 34%)":"hsl(220 9% 38%)";return{id:`${e}-${t}${s!=null&&s.loop?"-loop":""}`,source:e,target:t,sourceHandle:s!=null&&s.loop?"loop-source":void 0,targetHandle:s!=null&&s.loop?"loop-target":void 0,label:n,type:"insertStep",data:s?{insert:s.insert,loop:s.loop,tone:s.tone}:void 0,animated:s==null?void 0:s.loop,markerEnd:{type:Ef.ArrowClosed,width:16,height:16,color:i},style:{stroke:i,strokeWidth:1.5},labelStyle:{fill:"hsl(215 14% 42%)",fontSize:10,fontWeight:600},labelBgStyle:{fill:"hsl(var(--background))",fillOpacity:.92}}}function eM(e,t,n=!1){const s=[{id:"terminal-input",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:"用户请求"},selectable:!1,draggable:!1},{id:"terminal-output",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:"最终回复"},selectable:!1,draggable:!1}],i=[];function r(d,f,h,p,m){const b=d.agentType??"llm",v=$h(f);return U_(d,f)?(a(d,f,h,p,m),v):(s.push({id:v,type:"agent",parentId:h,extent:"parent",position:p,data:{kind:"agent",path:f,agent:d,title:b==="a2a"?"远程智能体":d.name.trim()||(f.length===0?"主 Agent":"未命名步骤"),pattern:b,description:d.description.trim()||fp[b].description,childCount:d.subAgents.length,containedIn:m}}),v)}function a(d,f,h,p={x:0,y:0},m){const b=d.agentType??"sequential",v=$h(f),y=F_(d,f,t,n);s.push({id:v,type:"group",parentId:h,extent:h?"parent":void 0,position:p,style:{width:y.width,height:y.height},data:{kind:"agent",path:f,agent:d,title:d.name.trim()||(f.length===0?"主 Agent":fp[b].label),pattern:b,description:d.description.trim()||fp[b].description,childCount:d.subAgents.length,containedIn:m,layoutWidth:y.width,layoutHeight:y.height,compactEmptyGroup:n&&d.subAgents.length===0}});const x=d.subAgents.map((k,T)=>F_(k,[...f,T],t,n)),E=x.length&&b!=="parallel"?FU:jd,w=t==="horizontal"?b!=="parallel":b==="parallel";let _=E;const S=d.subAgents.map((k,T)=>{const C=x[T],I=w?{x:_,y:Hp+jd}:{x:(y.width-C.width)/2,y:Hp+_};return _+=(w?C.width:C.height)+B_,r(k,[...f,T],v,I,b)});if(b==="sequential"||b==="loop"){for(let k=0;k1&&i.push(Hh(S[S.length-1],S[0],"继续循环",{loop:!0,tone:"loop"}))}return v}const l=(d,f)=>{const h=d.agentType??"llm",p=$h(f);if(U_(d,f))return a(d,f),[p];if(s.push({id:p,type:"agent",position:{x:0,y:0},data:{kind:"agent",path:f,agent:d,title:h==="a2a"?"远程智能体":d.name.trim()||(f.length===0?"主 Agent":"未命名步骤"),pattern:h,description:d.description.trim()||fp[h].description,childCount:d.subAgents.length}}),d.subAgents.length===0)return[p];const m=[];return d.subAgents.forEach((b,v)=>{const y=[...f,v],x=$h(y);i.push(Hh(p,x,"调用",{insert:{parentPath:f,index:v}})),m.push(...l(b,y))}),m},c=$h([]),u=l(e,[]);return i.push(Hh("terminal-input",c)),u.forEach(d=>i.push(Hh(d,"terminal-output"))),zde(s,i,t)}function zde(e,t,n){const s=new WO.graphlib.Graph().setDefaultEdgeLabel(()=>({}));s.setGraph({rankdir:n==="vertical"?"TB":"LR",ranksep:50,nodesep:34,edgesep:14,marginx:24,marginy:24});const i=new Set(e.filter(r=>!r.parentId).map(r=>r.id));return e.filter(r=>!r.parentId).forEach(r=>{const a=r.data.kind==="terminal";s.setNode(r.id,{width:a?XO:r.data.layoutWidth??D_,height:a?QO:r.data.layoutHeight??P_})}),t.filter(r=>i.has(r.source)&&i.has(r.target)).forEach(r=>s.setEdge(r.source,r.target)),WO.layout(s),{nodes:e.map(r=>{if(r.parentId)return r;const a=s.node(r.id),l=r.data.kind==="terminal",c=l?XO:r.data.layoutWidth??D_,u=l?QO:r.data.layoutHeight??P_;return{...r,position:{x:a.x-c/2,y:a.y-u/2}}}),edges:t}}const S1=g.createContext(null),_1=g.createContext("horizontal");function Vde({id:e,sourceX:t,sourceY:n,targetX:s,targetY:i,sourcePosition:r,targetPosition:a,markerEnd:l,style:c,label:u,data:d}){const f=g.useContext(S1),[h,p]=g.useState(!1),[m,b,v]=ex({sourceX:t,sourceY:n,targetX:s,targetY:i,sourcePosition:r,targetPosition:a,offset:d!=null&&d.loop?28:20});return o.jsxs(o.Fragment,{children:[o.jsx(bg,{id:e,path:m,markerEnd:l,style:c}),f&&(d==null?void 0:d.insert)&&o.jsx("path",{d:m,className:"abc-edge-hover-path",onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1)}),(u||f&&(d==null?void 0:d.insert))&&o.jsx(Ule,{children:o.jsxs("div",{className:`abc-edge-tools${f&&(d!=null&&d.insert)?" can-insert":""}${h?" is-visible":""}`,style:{transform:`translate(-50%, -50%) translate(${b}px, ${v}px)`},onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1),children:[u&&o.jsx("span",{className:"abc-edge-label",children:u}),f&&(d==null?void 0:d.insert)&&o.jsx("button",{type:"button",className:"abc-edge-add nodrag nopan","aria-label":"在这里插入步骤",title:"在这里插入步骤",onClick:y=>{y.stopPropagation(),f==null||f.onInsert(d.insert.parentPath,d.insert.index)},children:o.jsx(_i,{})})]})})]})}function Gde({data:e,selected:t}){const n=g.useContext(S1),s=g.useContext(_1),i=s==="vertical"?Xe.Top:Xe.Left,r=s==="vertical"?Xe.Bottom:Xe.Right,a=s==="vertical"?Xe.Right:Xe.Bottom,l=e.pattern??"llm",c=fp[l],u=c.icon;return o.jsxs("div",{className:`abc-node is-${l}${e.containedIn?` is-contained-in-${e.containedIn}`:""}${t?" is-selected":""}`,children:[o.jsx(Mi,{type:"target",position:i,className:"abc-handle"}),l!=="llm"&&o.jsx("span",{className:"abc-node-icon",children:o.jsx(u,{})}),o.jsxs("span",{className:"abc-node-copy",children:[o.jsx("span",{className:"abc-node-meta",children:o.jsx("span",{children:c.label})}),o.jsx("strong",{children:e.title}),o.jsx("small",{children:e.description})]}),n&&e.path!==void 0&&e.path.length>0&&o.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":`删除 ${e.title}`,title:"删除节点",onClick:d=>{d.stopPropagation(),n==null||n.onDelete(e.path)},children:o.jsx(Zl,{})}),o.jsx(Mi,{type:"source",position:r,className:"abc-handle"}),e.containedIn==="loop"&&o.jsxs(o.Fragment,{children:[o.jsx(Mi,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),o.jsx(Mi,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function Kde({data:e,selected:t}){const n=g.useContext(S1),s=g.useContext(_1),i=s==="vertical"?Xe.Top:Xe.Left,r=s==="vertical"?Xe.Bottom:Xe.Right,a=s==="vertical"?Xe.Right:Xe.Bottom,l=e.pattern??"sequential",c=e.childCount??0,u=l==="llm"?"添加子 Agent":l==="parallel"?"添加一个同时处理的步骤":l==="loop"?"添加循环步骤":"添加下一个步骤";return o.jsxs("div",{className:`abc-group is-${l}${e.compactEmptyGroup?" is-compact-empty":""}${t?" is-selected":""}`,children:[o.jsx(Mi,{type:"target",position:i,className:"abc-handle"}),o.jsx("header",{className:"abc-group-head",children:o.jsxs("span",{children:[o.jsx("strong",{title:e.title,children:e.title}),o.jsx("small",{children:e.description})]})}),n&&e.path!==void 0&&c>0&&l!=="parallel"&&o.jsxs("div",{className:"abc-group-boundary-actions",children:[o.jsx("button",{type:"button",className:"abc-group-boundary-add is-start nodrag nopan","aria-label":"添加到最前",title:"添加到最前",onClick:d=>{d.stopPropagation(),n.onInsert(e.path,0)},children:o.jsx(_i,{})}),o.jsx("button",{type:"button",className:"abc-group-boundary-add is-end nodrag nopan","aria-label":"添加到最后",title:"添加到最后",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:o.jsx(_i,{})})]}),n&&e.path!==void 0&&c>0&&l==="parallel"&&o.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-bottom nodrag nopan",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:[o.jsx(_i,{}),o.jsx("span",{children:u})]}),n&&e.path!==void 0&&c===0&&o.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-empty nodrag nopan",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:[o.jsx(_i,{}),o.jsx("span",{children:u})]}),n&&e.path!==void 0&&e.path.length>0&&o.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":`删除 ${e.title}`,title:"删除节点",onClick:d=>{d.stopPropagation(),n==null||n.onDelete(e.path)},children:o.jsx(Zl,{})}),o.jsx(Mi,{type:"source",position:r,className:"abc-handle"}),e.containedIn==="loop"&&o.jsxs(o.Fragment,{children:[o.jsx(Mi,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),o.jsx(Mi,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function qde({data:e}){const t=g.useContext(_1);return o.jsxs("div",{className:"abc-terminal",children:[o.jsx(Mi,{type:"target",position:t==="vertical"?Xe.Top:Xe.Left,className:"abc-handle"}),o.jsx("span",{children:e.title}),o.jsx(Mi,{type:"source",position:t==="vertical"?Xe.Bottom:Xe.Right,className:"abc-handle"})]})}const Yde={agent:Gde,group:Kde,terminal:qde},Wde={insertStep:Vde};function Xde({draft:e,selectedPath:t,onSelect:n,onAdd:s,onInsert:i,onDelete:r,readOnly:a=!1,interactivePreview:l=!1,direction:c="horizontal"}){const u=g.useMemo(()=>eM(e,c,a),[]),[d,f,h]=oU(u.nodes),[p,m,b]=lU(u.edges),v=$le(),y=g.useRef(`${c}:${a?"readonly":"editable"}:${JO(e)}`),x=g.useRef(null),{fitView:E}=x1(),w=g.useMemo(()=>eM(e,c,a),[c,e,a]),[_,S]=g.useState(()=>window.matchMedia("(max-width: 860px)").matches),k=g.useMemo(()=>a?{padding:.16,minZoom:.05,maxZoom:.9}:_?{padding:.08,minZoom:.35,maxZoom:.9}:{padding:.14,minZoom:.42,maxZoom:1.1},[_,a]),T=g.useCallback((I=0)=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const j=x.current;if(j&&(j.clientWidth===0||j.clientHeight===0)&&I<8){T(I+1);return}E(k)})})},[k,E]);g.useEffect(()=>{const I=window.matchMedia("(max-width: 860px)"),j=L=>S(L.matches);return I.addEventListener("change",j),()=>I.removeEventListener("change",j)},[]),g.useEffect(()=>{const I=`${c}:${a?"readonly":"editable"}:${JO(e)}`,j=I!==y.current;y.current=I,m(w.edges),f(L=>{const z=new Map(L.map(D=>[D.id,D]));return w.nodes.map(D=>{const F=z.get(D.id);return{...D,measured:!j&&F&&F.type===D.type?F.measured:void 0,position:!j&&F?F.position:D.position,selected:D.data.kind==="agent"&&!!D.data.path&&Hde(D.data.path,t)}})}),j&&T()},[w,e,T,t,m,f]),g.useEffect(()=>{T()},[_,T]),g.useEffect(()=>{v&&T()},[w,T,v]),g.useEffect(()=>{if(!a||!x.current)return;const I=new ResizeObserver(()=>T());return I.observe(x.current),T(),()=>I.disconnect()},[T,a]);const C=g.useMemo(()=>a?null:{onAdd:s,onInsert:i,onDelete:r},[s,r,i,a]);return o.jsx(_1.Provider,{value:c,children:o.jsx(S1.Provider,{value:C,children:o.jsx("section",{className:`abc-root is-${c}${a?" is-readonly":""}`,"aria-label":a?"只读 Agent 执行画布":"Agent 执行画布",children:o.jsx("div",{ref:x,className:"abc-canvas",children:o.jsxs(aU,{nodes:d,edges:p,nodeTypes:Yde,edgeTypes:Wde,onNodesChange:h,onEdgesChange:b,onNodeClick:(I,j)=>{!a&&j.data.kind==="agent"&&j.data.path&&n(j.data.path)},nodesDraggable:!a,nodesConnectable:!1,nodesFocusable:!a,elementsSelectable:!a,edgesFocusable:!1,edgesReconnectable:!1,panOnDrag:!a||l,zoomOnDoubleClick:l,zoomOnPinch:!a||l,zoomOnScroll:!a||l,fitView:!0,fitViewOptions:k,onInit:()=>T(),minZoom:a?.05:.35,maxZoom:1.6,proOptions:{hideAttribution:!0},children:[o.jsx(uU,{gap:20,size:1.2,color:"hsl(34 20% 82%)"}),(!a||l)&&o.jsx(fU,{showInteractive:!1}),Fde]})})})})})}function Mm(e){return o.jsx(cA,{children:o.jsx(Xde,{...e})})}const Qde="https://ark.cn-beijing.volces.com/api/v3/",$b=[{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:Qde}],kf=[],tM={label:"控制台",url:"https://console.volcengine.com/vikingdb/openviking"},Zde={label:"文档",url:"https://github.com/volcengine/OpenViking/blob/main/docs/zh/api/05-sessions.md"},Jde="https://api.vikingdb.cn-beijing.volces.com/openviking",efe=`{ +`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return g.useEffect(()=>{const c=(t==null?void 0:t.target)??wO,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var v,y;if(i.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!i.current||i.current&&!u)&&u9(p))return!1;const b=_O(p.code,l);if(r.current.add(p[b]),SO(a,r.current,!1)){const x=((y=(v=p.composedPath)==null?void 0:v.call(p))==null?void 0:y[0])||p.target,E=(x==null?void 0:x.nodeName)==="BUTTON"||(x==null?void 0:x.nodeName)==="A";t.preventDefault!==!1&&(i.current||!E)&&p.preventDefault(),s(!0)}},f=p=>{const m=_O(p.code,l);SO(a,r.current,!0)?(s(!1),r.current.clear()):r.current.delete(p[m]),p.key==="Meta"&&r.current.clear(),i.current=!1},h=()=>{r.current.clear(),s(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,s]),n}function SO(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(i=>t.has(i)))}function _O(e,t){return t.includes(e)?"code":"key"}const xoe=()=>{const e=fs();return g.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:s}=e.getState();return s?s.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[s,i,r],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??s,y:t.y??i,zoom:t.zoom??r},n),!0):!1},getViewport:()=>{const[t,n,s]=e.getState().transform;return{x:t,y:n,zoom:s}},setCenter:async(t,n,s)=>e.getState().setCenter(t,n,s),fitBounds:async(t,n)=>{const{width:s,height:i,minZoom:r,maxZoom:a,panZoom:l}=e.getState(),c=iA(t,s,i,r,a,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(c,{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:s,snapGrid:i,snapToGrid:r,domNode:a}=e.getState();if(!a)return t;const{x:l,y:c}=a.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},d=n.snapGrid??i,f=n.snapToGrid??r;return eh(u,s,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:s}=e.getState();if(!s)return t;const{x:i,y:r}=s.getBoundingClientRect(),a=Nf(t,n);return{x:a.x+i,y:a.y+r}}}),[])};function D9(e,t){const n=[],s=new Map,i=[];for(const r of e)if(r.type==="add"){i.push(r);continue}else if(r.type==="remove"||r.type==="replace")s.set(r.id,[r]);else{const a=s.get(r.id);a?a.push(r):s.set(r.id,[r])}for(const r of t){const a=s.get(r.id);if(!a){n.push(r);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const l={...r};for(const c of a)Eoe(c,l);n.push(l)}return i.length&&i.forEach(r=>{r.index!==void 0?n.splice(r.index,0,{...r.item}):n.push({...r.item})}),n}function Eoe(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 P9(e,t){return D9(e,t)}function B9(e,t){return D9(e,t)}function jc(e,t){return{id:e,type:"select",selected:t}}function Rd(e,t=new Set,n=!1){const s=[];for(const[i,r]of e){const a=t.has(i);!(r.selected===void 0&&!a)&&r.selected!==a&&(n&&(r.selected=a),s.push(jc(r.id,a)))}return s}function NO({items:e=[],lookup:t}){var i;const n=[],s=new Map(e.map(r=>[r.id,r]));for(const[r,a]of e.entries()){const l=t.get(a.id),c=((i=l==null?void 0:l.internals)==null?void 0:i.userNode)??l;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:r})}for(const[r]of t)s.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function TO(e){return{id:e.id,type:"remove"}}const voe=o9();function U9(e,t,n={}){return qre(e,t,{...n,onError:n.onError??voe})}const kO=e=>Rre(e),woe=e=>s9(e);function F9(e){return g.forwardRef(e)}const Soe=typeof window<"u"?g.useLayoutEffect:g.useEffect;function AO(e){const[t,n]=g.useState(BigInt(0)),[s]=g.useState(()=>_oe(()=>n(i=>i+BigInt(1))));return Soe(()=>{const i=s.get();i.length&&(e(i),s.reset())},[t]),s}function _oe(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const $9=g.createContext(null);function Noe({children:e}){const t=fs(),n=g.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:m}=t.getState();let b=c;for(const y of l)b=typeof y=="function"?y(b):y;let v=NO({items:b,lookup:h});for(const y of m.values())v=y(v);d&&u(b),v.length>0?f==null||f(v):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:x,setNodes:E}=t.getState();y&&E(x)})},[]),s=AO(n),i=g.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const m of l)p=typeof m=="function"?m(p):m;d?u(p):f&&f(NO({items:p,lookup:h}))},[]),r=AO(i),a=g.useMemo(()=>({nodeQueue:s,edgeQueue:r}),[]);return o.jsx($9.Provider,{value:a,children:e})}function Toe(){const e=g.useContext($9);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const koe=e=>!!e.panZoom;function v1(){const e=xoe(),t=fs(),n=Toe(),s=en(koe),i=g.useMemo(()=>{const r=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var y,x;const{nodeLookup:h,nodeOrigin:p}=t.getState(),m=kO(f)?f:h.get(f.id),b=m.parentId?l9(m.position,m.measured,m.parentId,h,p):m.position,v={...m,position:b,width:((y=m.measured)==null?void 0:y.width)??m.width,height:((x=m.measured)==null?void 0:x.height)??m.height};return _f(v)},u=(f,h,p={replace:!1})=>{a(m=>m.map(b=>{if(b.id===f){const v=typeof h=="function"?h(b):h;return p.replace&&kO(v)?v:{...b,...v}}return b}))},d=(f,h,p={replace:!1})=>{l(m=>m.map(b=>{if(b.id===f){const v=typeof h=="function"?h(b):h;return p.replace&&woe(v)?v:{...b,...v}}return b}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=r(f))==null?void 0:h.internals.userNode},getInternalNode:r,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:l,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,v]=p;return{nodes:f.map(y=>({...y})),edges:h.map(y=>({...y})),viewport:{x:m,y:b,zoom:v}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:m,onNodesDelete:b,onEdgesDelete:v,triggerNodeChanges:y,triggerEdgeChanges:x,onDelete:E,onBeforeDelete:w}=t.getState(),{nodes:_,edges:S}=await Pre({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:m,onBeforeDelete:w}),k=S.length>0,T=_.length>0;if(k){const C=S.map(TO);v==null||v(S),x(C)}if(T){const C=_.map(TO);b==null||b(_),y(C)}return(T||k)&&(E==null||E({nodes:_,edges:S})),{deletedNodes:_,deletedEdges:S}},getIntersectingNodes:(f,h=!0,p)=>{const m=sO(f),b=m?f:c(f),v=p!==void 0;return b?(p||t.getState().nodes).filter(y=>{const x=t.getState().nodeLookup.get(y.id);if(x&&!m&&(y.id===f.id||!x.internals.positionAbsolute))return!1;const E=_f(v?y:x),w=Cm(E,b);return h&&w>0||w>=E.width*E.height||w>=b.width*b.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const b=sO(f)?f:c(f);if(!b)return!1;const v=Cm(b,h);return p&&v>0||v>=h.width*h.height||v>=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 Ore(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??Fre();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return g.useMemo(()=>({...i,...e,viewportInitialized:s}),[s])}const CO=e=>e.selected,Aoe=typeof window<"u"?window:void 0;function Coe({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=fs(),{deleteElements:s}=v1(),i=jm(e,{actInsideInputWithModifier:!1}),r=jm(t,{target:Aoe});g.useEffect(()=>{if(i){const{edges:a,nodes:l}=n.getState();s({nodes:l.filter(CO),edges:a.filter(CO)}),n.setState({nodesSelectionActive:!1})}},[i]),g.useEffect(()=>{n.setState({multiSelectionActive:r})},[r])}function Ioe(e){const t=fs();g.useEffect(()=>{const n=()=>{var i,r,a,l;if(!e.current||!(((r=(i=e.current).checkVisibility)==null?void 0:r.call(i))??!0))return!1;const s=aA(e.current);(s.height===0||s.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Ca.error004())),t.setState({width:s.width||500,height:s.height||500})};if(e.current){n(),window.addEventListener("resize",n);const s=new ResizeObserver(()=>n());return s.observe(e.current),()=>{window.removeEventListener("resize",n),s&&e.current&&s.unobserve(e.current)}}},[])}const w1={position:"absolute",width:"100%",height:"100%",top:0,left:0},joe=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Roe({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:s=!1,panOnScrollSpeed:i=.5,panOnScrollMode:r=Qc.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:m,noWheelClassName:b,noPanClassName:v,onViewportChange:y,isControlledViewport:x,paneClickDistance:E,selectionOnDrag:w}){const _=fs(),S=g.useRef(null),{userSelectionActive:k,lib:T,connectionInProgress:C}=en(joe,ds),I=jm(h),j=g.useRef();Ioe(S);const L=g.useCallback(z=>{y==null||y({x:z[0],y:z[1],zoom:z[2]}),x||_.setState({transform:z})},[y,x]);return g.useEffect(()=>{if(S.current){j.current=Sae({domNode:S.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:A=>_.setState(M=>M.paneDragging===A?M:{paneDragging:A}),onPanZoomStart:(A,M)=>{const{onViewportChangeStart:P,onMoveStart:H}=_.getState();H==null||H(A,M),P==null||P(M)},onPanZoom:(A,M)=>{const{onViewportChange:P,onMove:H}=_.getState();H==null||H(A,M),P==null||P(M)},onPanZoomEnd:(A,M)=>{const{onViewportChangeEnd:P,onMoveEnd:H}=_.getState();H==null||H(A,M),P==null||P(M)}});const{x:z,y:D,zoom:F}=j.current.getViewport();return _.setState({panZoom:j.current,transform:[z,D,F],domNode:S.current.closest(".react-flow")}),()=>{var A;(A=j.current)==null||A.destroy()}}},[]),g.useEffect(()=>{var z;(z=j.current)==null||z.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:s,panOnScrollSpeed:i,panOnScrollMode:r,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:I,preventScrolling:p,noPanClassName:v,userSelectionActive:k,noWheelClassName:b,lib:T,onTransformChange:L,connectionInProgress:C,selectionOnDrag:w,paneClickDistance:E})},[e,t,n,s,i,r,a,l,I,p,v,k,b,T,L,C,w,E]),o.jsx("div",{className:"react-flow__renderer",ref:S,style:w1,children:m})}const Ooe=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Moe(){const{userSelectionActive:e,userSelectionRect:t}=en(Ooe,ds);return e&&t?o.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 Vv=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Loe=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Doe({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Am.Full,panOnDrag:s,autoPanOnSelection:i,paneClickDistance:r,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:m,children:b}){const v=g.useRef(0),y=fs(),{userSelectionActive:x,elementsSelectable:E,dragging:w,connectionInProgress:_,panBy:S,autoPanSpeed:k}=en(Loe,ds),T=E&&(e||x),C=g.useRef(null),I=g.useRef(),j=g.useRef(new Set),L=g.useRef(new Set),z=g.useRef(!1),D=g.useRef({x:0,y:0}),F=g.useRef(!1),A=q=>{if(z.current||_){z.current=!1;return}u==null||u(q),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},M=q=>{if(Array.isArray(s)&&(s!=null&&s.includes(2))){q.preventDefault();return}d==null||d(q)},P=f?q=>f(q):void 0,H=q=>{z.current&&(q.stopPropagation(),z.current=!1)},R=q=>{var Ne,ve;const{domNode:ue,transform:pe}=y.getState();if(I.current=ue==null?void 0:ue.getBoundingClientRect(),!I.current)return;const we=q.target===C.current;if(!we&&!!q.target.closest(".nokey")||!e||!(a&&we||t)||q.button!==0||!q.isPrimary)return;(ve=(Ne=q.target)==null?void 0:Ne.setPointerCapture)==null||ve.call(Ne,q.pointerId),z.current=!1;const{x:Le,y:Ee}=_a(q.nativeEvent,I.current),ie=eh({x:Le,y:Ee},pe);y.setState({userSelectionRect:{width:0,height:0,startX:ie.x,startY:ie.y,x:Le,y:Ee}}),we||(q.stopPropagation(),q.preventDefault())};function Y(q,ue){const{userSelectionRect:pe}=y.getState();if(!pe)return;const{transform:we,nodeLookup:de,edgeLookup:ge,connectionLookup:Le,triggerNodeChanges:Ee,triggerEdgeChanges:ie,defaultEdgeOptions:Ne}=y.getState(),ve={x:pe.startX,y:pe.startY},{x:Qe,y:De}=Nf(ve,we),Ke={startX:ve.x,startY:ve.y,x:qqe.id)),L.current=new Set;const Be=(Ne==null?void 0:Ne.selectable)??!0;for(const qe of j.current){const Z=Le.get(qe);if(Z)for(const{edgeId:ae}of Z.values()){const ne=ge.get(ae);ne&&(ne.selectable??Be)&&L.current.add(ae)}}if(!iO(Se,j.current)){const qe=Rd(de,j.current,!0);Ee(qe)}if(!iO(He,L.current)){const qe=Rd(ge,L.current);ie(qe)}y.setState({userSelectionRect:Ke,userSelectionActive:!0,nodesSelectionActive:!1})}function J(){if(!i||!I.current)return;const[q,ue]=sA(D.current,I.current,k);S({x:q,y:ue}).then(pe=>{if(!z.current||!pe){v.current=requestAnimationFrame(J);return}const{x:we,y:de}=D.current;Y(we,de),v.current=requestAnimationFrame(J)})}const U=()=>{cancelAnimationFrame(v.current),v.current=0,F.current=!1};g.useEffect(()=>()=>U(),[]);const te=q=>{const{userSelectionRect:ue,transform:pe,resetSelectedElements:we}=y.getState();if(!I.current||!ue)return;const{x:de,y:ge}=_a(q.nativeEvent,I.current);D.current={x:de,y:ge};const Le=Nf({x:ue.startX,y:ue.startY},pe);if(!z.current){const Ee=t?0:r;if(Math.hypot(de-Le.x,ge-Le.y)<=Ee)return;we(),l==null||l(q)}z.current=!0,F.current||(J(),F.current=!0),Y(de,ge)},K=q=>{var ue,pe;q.button===0&&((pe=(ue=q.target)==null?void 0:ue.releasePointerCapture)==null||pe.call(ue,q.pointerId),!x&&q.target===C.current&&y.getState().userSelectionRect&&(A==null||A(q)),y.setState({userSelectionActive:!1,userSelectionRect:null}),z.current&&(c==null||c(q),y.setState({nodesSelectionActive:j.current.size>0})),U())},V=q=>{var ue,pe;(pe=(ue=q.target)==null?void 0:ue.releasePointerCapture)==null||pe.call(ue,q.pointerId),U()},W=s===!0||Array.isArray(s)&&s.includes(0);return o.jsxs("div",{className:Zs(["react-flow__pane",{draggable:W,dragging:w,selection:e}]),onClick:T?void 0:Vv(A,C),onContextMenu:Vv(M,C),onWheel:Vv(P,C),onPointerEnter:T?void 0:h,onPointerMove:T?te:p,onPointerUp:T?K:void 0,onPointerCancel:T?V:void 0,onPointerDownCapture:T?R:void 0,onClickCapture:T?H:void 0,onPointerLeave:m,ref:C,style:w1,children:[b,o.jsx(Moe,{})]})}function B_({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:i,unselectNodesAndEdges:r,multiSelectionActive:a,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",Ca.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(r({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=s==null?void 0:s.current)==null?void 0:d.blur()})):i([e])}function H9({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:i,isSelectable:r,nodeClickDistance:a}){const l=fs(),[c,u]=g.useState(!1),d=g.useRef();return g.useEffect(()=>{d.current=cae({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{B_({id:f,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),g.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:s,domNode:e.current,isSelectable:r,nodeId:i,nodeClickDistance:a}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,s,t,r,e,i,a]),c}const Poe=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function z9(){const e=fs();return g.useCallback(n=>{const{nodeExtent:s,snapToGrid:i,snapGrid:r,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=Poe(a),p=i?r[0]:5,m=i?r[1]:5,b=n.direction.x*p*n.factor,v=n.direction.y*m*n.factor;for(const[,y]of u){if(!h(y))continue;let x={x:y.internals.positionAbsolute.x+b,y:y.internals.positionAbsolute.y+v};i&&(x=mg(x,r));const{position:E,positionAbsolute:w}=i9({nodeId:y.id,nextPosition:x,nodeLookup:u,nodeExtent:s,nodeOrigin:d,onError:l});y.position=E,y.internals.positionAbsolute=w,f.set(y.id,y)}c(f)},[])}const fA=g.createContext(null),Boe=fA.Provider;fA.Consumer;const V9=()=>g.useContext(fA),Uoe=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Foe=(e,t,n)=>s=>{const{connectionClickStartHandle:i,connectionMode:r,connection:a}=s,{fromHandle:l,toHandle:c,isValid:u}=a,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.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:r===vf.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!i,valid:d&&u}};function $oe({type:e="source",position:t=Xe.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:i=!0,isConnectableEnd:r=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var F,A;const m=a||null,b=e==="target",v=fs(),y=V9(),{connectOnClick:x,noPanClassName:E,rfId:w}=en(Uoe,ds),{connectingFrom:_,connectingTo:S,clickConnecting:k,isPossibleEndHandle:T,connectionInProcess:C,clickConnectionInProcess:I,valid:j}=en(Foe(y,m,e),ds);y||(A=(F=v.getState()).onError)==null||A.call(F,"010",Ca.error010());const L=M=>{const{defaultEdgeOptions:P,onConnect:H,hasDefaultEdges:R}=v.getState(),Y={...P,...M};if(R){const{edges:J,setEdges:U,onError:te}=v.getState();U(U9(Y,J,{onError:te}))}H==null||H(Y),l==null||l(Y)},z=M=>{if(!y)return;const P=d9(M.nativeEvent);if(i&&(P&&M.button===0||!P)){const H=v.getState();P_.onPointerDown(M.nativeEvent,{handleDomNode:M.currentTarget,autoPanOnConnect:H.autoPanOnConnect,connectionMode:H.connectionMode,connectionRadius:H.connectionRadius,domNode:H.domNode,nodeLookup:H.nodeLookup,lib:H.lib,isTarget:b,handleId:m,nodeId:y,flowId:H.rfId,panBy:H.panBy,cancelConnection:H.cancelConnection,onConnectStart:H.onConnectStart,onConnectEnd:(...R)=>{var Y,J;return(J=(Y=v.getState()).onConnectEnd)==null?void 0:J.call(Y,...R)},updateConnection:H.updateConnection,onConnect:L,isValidConnection:n||((...R)=>{var Y,J;return((J=(Y=v.getState()).isValidConnection)==null?void 0:J.call(Y,...R))??!0}),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:H.autoPanSpeed,dragThreshold:H.connectionDragThreshold})}P?d==null||d(M):f==null||f(M)},D=M=>{const{onClickConnectStart:P,onClickConnectEnd:H,connectionClickStartHandle:R,connectionMode:Y,isValidConnection:J,lib:U,rfId:te,nodeLookup:K,connection:V}=v.getState();if(!y||!R&&!i)return;if(!R){P==null||P(M.nativeEvent,{nodeId:y,handleId:m,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:y,type:e,id:m}});return}const W=c9(M.target),q=n||J,{connection:ue,isValid:pe}=P_.isValid(M.nativeEvent,{handle:{nodeId:y,id:m,type:e},connectionMode:Y,fromNodeId:R.nodeId,fromHandleId:R.id||null,fromType:R.type,isValidConnection:q,flowId:te,doc:W,lib:U,nodeLookup:K});pe&&ue&&L(ue);const we=structuredClone(V);delete we.inProgress,we.toPosition=we.toHandle?we.toHandle.position:null,H==null||H(M,we),v.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":m,"data-nodeid":y,"data-handlepos":t,"data-id":`${w}-${y}-${m}-${e}`,className:Zs(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",E,u,{source:!b,target:b,connectable:s,connectablestart:i,connectableend:r,clickconnecting:k,connectingfrom:_,connectingto:S,valid:j,connectionindicator:s&&(!C||T)&&(C||I?r:i)}]),onMouseDown:z,onTouchStart:z,onClick:x?D:void 0,ref:p,...h,children:c})}const Oi=g.memo(F9($oe));function Hoe({data:e,isConnectable:t,sourcePosition:n=Xe.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(Oi,{type:"source",position:n,isConnectable:t})]})}function zoe({data:e,isConnectable:t,targetPosition:n=Xe.Top,sourcePosition:s=Xe.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(Oi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(Oi,{type:"source",position:s,isConnectable:t})]})}function Voe(){return null}function Goe({data:e,isConnectable:t,targetPosition:n=Xe.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(Oi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const sx={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},IO={input:Hoe,default:zoe,output:Goe,group:Voe};function Koe(e){var t,n,s,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??((s=e.style)==null?void 0:s.width),height:e.height??((i=e.style)==null?void 0:i.height)}}const qoe=e=>{const{width:t,height:n,x:s,y:i}=pg(e.nodeLookup,{filter:r=>!!r.selected});return{width:Sa(t)?t:null,height:Sa(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${s}px,${i}px)`}};function Yoe({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=fs(),{width:i,height:r,transformString:a,userSelectionActive:l}=en(qoe,ds),c=z9(),u=g.useRef(null);g.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!l&&i!==null&&r!==null;if(H9({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const m=s.getState().nodes.filter(b=>b.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(sx,p.key)&&(p.preventDefault(),c({direction:sx[p.key],factor:p.shiftKey?4:1}))};return o.jsx("div",{className:Zs(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:o.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:r}})})}const jO=typeof window<"u"?window:void 0,Woe=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function G9({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:r,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:b,zoomActivationKeyCode:v,elementsSelectable:y,zoomOnScroll:x,zoomOnPinch:E,panOnScroll:w,panOnScrollSpeed:_,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:T,autoPanOnSelection:C,defaultViewport:I,translateExtent:j,minZoom:L,maxZoom:z,preventScrolling:D,onSelectionContextMenu:F,noWheelClassName:A,noPanClassName:M,disableKeyboardA11y:P,onViewportChange:H,isControlledViewport:R}){const{nodesSelectionActive:Y,userSelectionActive:J}=en(Woe,ds),U=jm(u,{target:jO}),te=jm(b,{target:jO}),K=te||T,V=te||w,W=d&&K!==!0,q=U||J||W;return Coe({deleteKeyCode:c,multiSelectionKeyCode:m}),o.jsx(Roe,{onPaneContextMenu:r,elementsSelectable:y,zoomOnScroll:x,zoomOnPinch:E,panOnScroll:V,panOnScrollSpeed:_,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:!U&&K,defaultViewport:I,translateExtent:j,minZoom:L,maxZoom:z,zoomActivationKeyCode:v,preventScrolling:D,noWheelClassName:A,noPanClassName:M,onViewportChange:H,isControlledViewport:R,paneClickDistance:l,selectionOnDrag:W,children:o.jsxs(Doe,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:r,onPaneScroll:a,panOnDrag:K,autoPanOnSelection:C,isSelecting:!!q,selectionMode:f,selectionKeyPressed:U,paneClickDistance:l,selectionOnDrag:W,children:[e,Y&&o.jsx(Yoe,{onSelectionContextMenu:F,noPanClassName:M,disableKeyboardA11y:P})]})})}G9.displayName="FlowRenderer";const Xoe=g.memo(G9),Qoe=e=>t=>e?nA(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 Zoe(e){return en(g.useCallback(Qoe(e),[e]),ds)}const Joe=e=>e.updateNodeInternals;function ele(){const e=en(Joe),[t]=g.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const s=new Map;n.forEach(i=>{const r=i.target.getAttribute("data-id");s.set(r,{id:r,nodeElement:i.target,force:!0})}),e(s)}));return g.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function tle({node:e,nodeType:t,hasDimensions:n,resizeObserver:s}){const i=fs(),r=g.useRef(null),a=g.useRef(null),l=g.useRef(e.sourcePosition),c=g.useRef(e.targetPosition),u=g.useRef(t),d=n&&!!e.internals.handleBounds;return g.useEffect(()=>{r.current&&!e.hidden&&(!d||a.current!==r.current)&&(a.current&&(s==null||s.unobserve(a.current)),s==null||s.observe(r.current),a.current=r.current)},[d,e.hidden]),g.useEffect(()=>()=>{a.current&&(s==null||s.unobserve(a.current),a.current=null)},[]),g.useEffect(()=>{if(r.current){const f=u.current!==t,h=l.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||h||p)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:r.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),r}function nle({id:e,onClick:t,onMouseEnter:n,onMouseMove:s,onMouseLeave:i,onContextMenu:r,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:m,rfId:b,nodeTypes:v,nodeClickDistance:y,onError:x}){const{node:E,internals:w,isParent:_}=en(q=>{const ue=q.nodeLookup.get(e),pe=q.parentLookup.has(e);return{node:ue,internals:ue.internals,isParent:pe}},ds);let S=E.type||"default",k=(v==null?void 0:v[S])||IO[S];k===void 0&&(x==null||x("003",Ca.error003(S)),S="default",k=(v==null?void 0:v.default)||IO.default);const T=!!(E.draggable||l&&typeof E.draggable>"u"),C=!!(E.selectable||c&&typeof E.selectable>"u"),I=!!(E.connectable||u&&typeof E.connectable>"u"),j=!!(E.focusable||d&&typeof E.focusable>"u"),L=fs(),z=rA(E),D=tle({node:E,nodeType:S,hasDimensions:z,resizeObserver:f}),F=H9({nodeRef:D,disabled:E.hidden||!T,noDragClassName:h,handleSelector:E.dragHandle,nodeId:e,isSelectable:C,nodeClickDistance:y}),A=z9();if(E.hidden)return null;const M=il(E),P=Koe(E),H=C||T||t||n||s||i,R=n?q=>n(q,{...w.userNode}):void 0,Y=s?q=>s(q,{...w.userNode}):void 0,J=i?q=>i(q,{...w.userNode}):void 0,U=r?q=>r(q,{...w.userNode}):void 0,te=a?q=>a(q,{...w.userNode}):void 0,K=q=>{const{selectNodesOnDrag:ue,nodeDragThreshold:pe}=L.getState();C&&(!ue||!T||pe>0)&&B_({id:e,store:L,nodeRef:D}),t&&t(q,{...w.userNode})},V=q=>{if(!(u9(q.nativeEvent)||m)){if(J8.includes(q.key)&&C){const ue=q.key==="Escape";B_({id:e,store:L,unselect:ue,nodeRef:D})}else if(T&&E.selected&&Object.prototype.hasOwnProperty.call(sx,q.key)){q.preventDefault();const{ariaLabelConfig:ue}=L.getState();L.setState({ariaLiveMessage:ue["node.a11yDescription.ariaLiveMessage"]({direction:q.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),A({direction:sx[q.key],factor:q.shiftKey?4:1})}}},W=()=>{var Le;if(m||!((Le=D.current)!=null&&Le.matches(":focus-visible")))return;const{transform:q,width:ue,height:pe,autoPanOnNodeFocus:we,setCenter:de}=L.getState();if(!we)return;nA(new Map([[e,E]]),{x:0,y:0,width:ue,height:pe},q,!0).length>0||de(E.position.x+M.width/2,E.position.y+M.height/2,{zoom:q[2]})};return o.jsx("div",{className:Zs(["react-flow__node",`react-flow__node-${S}`,{[p]:T},E.className,{selected:E.selected,selectable:C,parent:_,draggable:T,dragging:F}]),ref:D,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:H?"all":"none",visibility:z?"visible":"hidden",...E.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:R,onMouseMove:Y,onMouseLeave:J,onContextMenu:U,onClick:K,onDoubleClick:te,onKeyDown:j?V:void 0,tabIndex:j?0:void 0,onFocus:j?W:void 0,role:E.ariaRole??(j?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${O9}-${b}`,"aria-label":E.ariaLabel,...E.domAttributes,children:o.jsx(Boe,{value:e,children:o.jsx(k,{id:e,data:E.data,type:S,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:E.selected??!1,selectable:C,draggable:T,deletable:E.deletable??!0,isConnectable:I,sourcePosition:E.sourcePosition,targetPosition:E.targetPosition,dragging:F,dragHandle:E.dragHandle,zIndex:w.z,parentId:E.parentId,...M})})})}var sle=g.memo(nle);const ile=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function K9(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:i,onError:r}=en(ile,ds),a=Zoe(e.onlyRenderVisibleElements),l=ele();return o.jsx("div",{className:"react-flow__nodes",style:w1,children:a.map(c=>o.jsx(sle,{id:c,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:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:r},c))})}K9.displayName="NodeRenderer";const rle=g.memo(K9);function ale(e){return en(g.useCallback(n=>{if(!e)return n.edges.map(i=>i.id);const s=[];if(n.width&&n.height)for(const i of n.edges){const r=n.nodeLookup.get(i.source),a=n.nodeLookup.get(i.target);r&&a&&Vre({sourceNode:r,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&s.push(i.id)}return s},[e]),ds)}const ole=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return o.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},lle=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return o.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},RO={[wf.Arrow]:ole,[wf.ArrowClosed]:lle};function cle(e){const t=fs();return g.useMemo(()=>{var i,r;return Object.prototype.hasOwnProperty.call(RO,e)?RO[e]:((r=(i=t.getState()).onError)==null||r.call(i,"009",Ca.error009(e)),null)},[e])}const ule=({id:e,type:t,color:n,width:s=12.5,height:i=12.5,markerUnits:r="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=cle(t);return c?o.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:r,orient:l,refX:"0",refY:"0",children:o.jsx(c,{color:n,strokeWidth:a})}):null},q9=({defaultColor:e,rfId:t})=>{const n=en(r=>r.edges),s=en(r=>r.defaultEdgeOptions),i=g.useMemo(()=>Zre(n,{id:t,defaultColor:e,defaultMarkerStart:s==null?void 0:s.markerStart,defaultMarkerEnd:s==null?void 0:s.markerEnd}),[n,s,t,e]);return i.length?o.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:o.jsx("defs",{children:i.map(r=>o.jsx(ule,{id:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient},r.id))})}):null};q9.displayName="MarkerDefinitions";var dle=g.memo(q9);function Y9({x:e,y:t,label:n,labelStyle:s,labelShowBg:i=!0,labelBgStyle:r,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...d}){const[f,h]=g.useState({x:1,y:0,width:0,height:0}),p=Zs(["react-flow__edge-textwrapper",u]),m=g.useRef(null);return g.useEffect(()=>{if(m.current){const b=m.current.getBBox();h({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[i&&o.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:r,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:m,style:s,children:n}),c]}):null}Y9.displayName="EdgeText";const fle=g.memo(Y9);function gg({path:e,labelX:t,labelY:n,label:s,labelStyle:i,labelShowBg:r,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...d,d:e,fill:"none",className:Zs(["react-flow__edge-path",d.className])}),u?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,s&&Sa(t)&&Sa(n)?o.jsx(fle,{x:t,y:n,label:s,labelStyle:i,labelShowBg:r,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function OO({pos:e,x1:t,y1:n,x2:s,y2:i}){return e===Xe.Left||e===Xe.Right?[.5*(t+s),n]:[t,.5*(n+i)]}function W9({sourceX:e,sourceY:t,sourcePosition:n=Xe.Bottom,targetX:s,targetY:i,targetPosition:r=Xe.Top}){const[a,l]=OO({pos:n,x1:e,y1:t,x2:s,y2:i}),[c,u]=OO({pos:r,x1:s,y1:i,x2:e,y2:t}),[d,f,h,p]=f9({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${s},${i}`,d,f,h,p]}function X9(e){return g.memo(({id:t,sourceX:n,sourceY:s,targetX:i,targetY:r,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:v,interactionWidth:y})=>{const[x,E,w]=W9({sourceX:n,sourceY:s,sourcePosition:a,targetX:i,targetY:r,targetPosition:l}),_=e.isInternal?void 0:t;return o.jsx(gg,{id:_,path:x,labelX:E,labelY:w,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:v,interactionWidth:y})})}const hle=X9({isInternal:!1}),Q9=X9({isInternal:!0});hle.displayName="SimpleBezierEdge";Q9.displayName="SimpleBezierEdgeInternal";function Z9(e){return g.memo(({id:t,sourceX:n,sourceY:s,targetX:i,targetY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=Xe.Bottom,targetPosition:m=Xe.Top,markerEnd:b,markerStart:v,pathOptions:y,interactionWidth:x})=>{const[E,w,_]=nx({sourceX:n,sourceY:s,sourcePosition:p,targetX:i,targetY:r,targetPosition:m,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),S=e.isInternal?void 0:t;return o.jsx(gg,{id:S,path:E,labelX:w,labelY:_,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:b,markerStart:v,interactionWidth:x})})}const J9=Z9({isInternal:!1}),eU=Z9({isInternal:!0});J9.displayName="SmoothStepEdge";eU.displayName="SmoothStepEdgeInternal";function tU(e){return g.memo(({id:t,...n})=>{var i;const s=e.isInternal?void 0:t;return o.jsx(J9,{...n,id:s,pathOptions:g.useMemo(()=>{var r;return{borderRadius:0,offset:(r=n.pathOptions)==null?void 0:r.offset}},[(i=n.pathOptions)==null?void 0:i.offset])})})}const ple=tU({isInternal:!1}),nU=tU({isInternal:!0});ple.displayName="StepEdge";nU.displayName="StepEdgeInternal";function sU(e){return g.memo(({id:t,sourceX:n,sourceY:s,targetX:i,targetY:r,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:b})=>{const[v,y,x]=m9({sourceX:n,sourceY:s,targetX:i,targetY:r}),E=e.isInternal?void 0:t;return o.jsx(gg,{id:E,path:v,labelX:y,labelY:x,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:b})})}const mle=sU({isInternal:!1}),iU=sU({isInternal:!0});mle.displayName="StraightEdge";iU.displayName="StraightEdgeInternal";function rU(e){return g.memo(({id:t,sourceX:n,sourceY:s,targetX:i,targetY:r,sourcePosition:a=Xe.Bottom,targetPosition:l=Xe.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:v,pathOptions:y,interactionWidth:x})=>{const[E,w,_]=h9({sourceX:n,sourceY:s,sourcePosition:a,targetX:i,targetY:r,targetPosition:l,curvature:y==null?void 0:y.curvature}),S=e.isInternal?void 0:t;return o.jsx(gg,{id:S,path:E,labelX:w,labelY:_,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:v,interactionWidth:x})})}const gle=rU({isInternal:!1}),aU=rU({isInternal:!0});gle.displayName="BezierEdge";aU.displayName="BezierEdgeInternal";const MO={default:aU,straight:iU,step:nU,smoothstep:eU,simplebezier:Q9},LO={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},ble=(e,t,n)=>n===Xe.Left?e-t:n===Xe.Right?e+t:e,yle=(e,t,n)=>n===Xe.Top?e-t:n===Xe.Bottom?e+t:e,DO="react-flow__edgeupdater";function PO({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:i,onMouseEnter:r,onMouseOut:a,type:l}){return o.jsx("circle",{onMouseDown:i,onMouseEnter:r,onMouseOut:a,className:Zs([DO,`${DO}-${l}`]),cx:ble(t,s,e),cy:yle(n,s,e),r:s,stroke:"transparent",fill:"transparent"})}function xle({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:s,sourceY:i,targetX:r,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const m=fs(),b=(w,_)=>{if(w.button!==0)return;const{autoPanOnConnect:S,domNode:k,connectionMode:T,connectionRadius:C,lib:I,onConnectStart:j,cancelConnection:L,nodeLookup:z,rfId:D,panBy:F,updateConnection:A}=m.getState(),M=_.type==="target",P=(Y,J)=>{h(!1),f==null||f(Y,n,_.type,J)},H=Y=>u==null?void 0:u(n,Y),R=(Y,J)=>{h(!0),d==null||d(w,n,_.type),j==null||j(Y,J)};P_.onPointerDown(w.nativeEvent,{autoPanOnConnect:S,connectionMode:T,connectionRadius:C,domNode:k,handleId:_.id,nodeId:_.nodeId,nodeLookup:z,isTarget:M,edgeUpdaterType:_.type,lib:I,flowId:D,cancelConnection:L,panBy:F,isValidConnection:(...Y)=>{var J,U;return((U=(J=m.getState()).isValidConnection)==null?void 0:U.call(J,...Y))??!0},onConnect:H,onConnectStart:R,onConnectEnd:(...Y)=>{var J,U;return(U=(J=m.getState()).onConnectEnd)==null?void 0:U.call(J,...Y)},onReconnectEnd:P,updateConnection:A,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},v=w=>b(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=w=>b(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),x=()=>p(!0),E=()=>p(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(PO,{position:l,centerX:s,centerY:i,radius:t,onMouseDown:v,onMouseEnter:x,onMouseOut:E,type:"source"}),(e===!0||e==="target")&&o.jsx(PO,{position:c,centerX:r,centerY:a,radius:t,onMouseDown:y,onMouseEnter:x,onMouseOut:E,type:"target"})]})}function Ele({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:s,onClick:i,onDoubleClick:r,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:m,edgeTypes:b,noPanClassName:v,onError:y,disableKeyboardA11y:x}){let E=en(de=>de.edgeLookup.get(e));const w=en(de=>de.defaultEdgeOptions);E=w?{...w,...E}:E;let _=E.type||"default",S=(b==null?void 0:b[_])||MO[_];S===void 0&&(y==null||y("011",Ca.error011(_)),_="default",S=(b==null?void 0:b.default)||MO.default);const k=!!(E.focusable||t&&typeof E.focusable>"u"),T=typeof f<"u"&&(E.reconnectable||n&&typeof E.reconnectable>"u"),C=!!(E.selectable||s&&typeof E.selectable>"u"),I=g.useRef(null),[j,L]=g.useState(!1),[z,D]=g.useState(!1),F=fs(),{zIndex:A,sourceX:M,sourceY:P,targetX:H,targetY:R,sourcePosition:Y,targetPosition:J}=en(g.useCallback(de=>{const ge=de.nodeLookup.get(E.source),Le=de.nodeLookup.get(E.target);if(!ge||!Le)return{zIndex:E.zIndex,...LO};const Ee=Qre({id:e,sourceNode:ge,targetNode:Le,sourceHandle:E.sourceHandle||null,targetHandle:E.targetHandle||null,connectionMode:de.connectionMode,onError:y});return{zIndex:zre({selected:E.selected,zIndex:E.zIndex,sourceNode:ge,targetNode:Le,elevateOnSelect:de.elevateEdgesOnSelect,zIndexMode:de.zIndexMode}),...Ee||LO}},[E.source,E.target,E.sourceHandle,E.targetHandle,E.selected,E.zIndex]),ds),U=g.useMemo(()=>E.markerStart?`url('#${L_(E.markerStart,m)}')`:void 0,[E.markerStart,m]),te=g.useMemo(()=>E.markerEnd?`url('#${L_(E.markerEnd,m)}')`:void 0,[E.markerEnd,m]);if(E.hidden||M===null||P===null||H===null||R===null)return null;const K=de=>{var ie;const{addSelectedEdges:ge,unselectNodesAndEdges:Le,multiSelectionActive:Ee}=F.getState();C&&(F.setState({nodesSelectionActive:!1}),E.selected&&Ee?(Le({nodes:[],edges:[E]}),(ie=I.current)==null||ie.blur()):ge([e])),i&&i(de,E)},V=r?de=>{r(de,{...E})}:void 0,W=a?de=>{a(de,{...E})}:void 0,q=l?de=>{l(de,{...E})}:void 0,ue=c?de=>{c(de,{...E})}:void 0,pe=u?de=>{u(de,{...E})}:void 0,we=de=>{var ge;if(!x&&J8.includes(de.key)&&C){const{unselectNodesAndEdges:Le,addSelectedEdges:Ee}=F.getState();de.key==="Escape"?((ge=I.current)==null||ge.blur(),Le({edges:[E]})):Ee([e])}};return o.jsx("svg",{style:{zIndex:A},children:o.jsxs("g",{className:Zs(["react-flow__edge",`react-flow__edge-${_}`,E.className,v,{selected:E.selected,animated:E.animated,inactive:!C&&!i,updating:j,selectable:C}]),onClick:K,onDoubleClick:V,onContextMenu:W,onMouseEnter:q,onMouseMove:ue,onMouseLeave:pe,onKeyDown:k?we:void 0,tabIndex:k?0:void 0,role:E.ariaRole??(k?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":E.ariaLabel===null?void 0:E.ariaLabel||`Edge from ${E.source} to ${E.target}`,"aria-describedby":k?`${M9}-${m}`:void 0,ref:I,...E.domAttributes,children:[!z&&o.jsx(S,{id:e,source:E.source,target:E.target,type:E.type,selected:E.selected,animated:E.animated,selectable:C,deletable:E.deletable??!0,label:E.label,labelStyle:E.labelStyle,labelShowBg:E.labelShowBg,labelBgStyle:E.labelBgStyle,labelBgPadding:E.labelBgPadding,labelBgBorderRadius:E.labelBgBorderRadius,sourceX:M,sourceY:P,targetX:H,targetY:R,sourcePosition:Y,targetPosition:J,data:E.data,style:E.style,sourceHandleId:E.sourceHandle,targetHandleId:E.targetHandle,markerStart:U,markerEnd:te,pathOptions:"pathOptions"in E?E.pathOptions:void 0,interactionWidth:E.interactionWidth}),T&&o.jsx(xle,{edge:E,isReconnectable:T,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:M,sourceY:P,targetX:H,targetY:R,sourcePosition:Y,targetPosition:J,setUpdateHover:L,setReconnecting:D})]})})}var vle=g.memo(Ele);const wle=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function oU({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:s,noPanClassName:i,onReconnect:r,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:b}){const{edgesFocusable:v,edgesReconnectable:y,elementsSelectable:x,onError:E}=en(wle,ds),w=ale(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(dle,{defaultColor:e,rfId:n}),w.map(_=>o.jsx(vle,{id:_,edgesFocusable:v,edgesReconnectable:y,elementsSelectable:x,noPanClassName:i,onReconnect:r,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:E,edgeTypes:s,disableKeyboardA11y:b},_))]})}oU.displayName="EdgeRenderer";const Sle=g.memo(oU),_le=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Nle({children:e}){const t=en(_le);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Tle(e){const t=v1(),n=g.useRef(!1);g.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const kle=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Ale(e){const t=en(kle),n=fs();return g.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Cle(e){return e.connection.inProgress?{...e.connection,to:eh(e.connection.to,e.transform)}:{...e.connection}}function Ile(e){return Cle}function jle(e){const t=Ile();return en(t,ds)}const Rle=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Ole({containerStyle:e,style:t,type:n,component:s}){const{nodesConnectable:i,width:r,height:a,isValid:l,inProgress:c}=en(Rle,ds);return!(r&&i&&c)?null:o.jsx("svg",{style:e,width:r,height:a,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:Zs(["react-flow__connection",n9(l)]),children:o.jsx(lU,{style:t,type:n,CustomComponent:s,isValid:l})})})}const lU=({style:e,type:t=Cl.Bezier,CustomComponent:n,isValid:s})=>{const{inProgress:i,from:r,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=jle();if(!i)return;if(n)return o.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:r.x,fromY:r.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:n9(s),toNode:d,toHandle:f,pointer:p});let m="";const b={sourceX:r.x,sourceY:r.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case Cl.Bezier:[m]=h9(b);break;case Cl.SimpleBezier:[m]=W9(b);break;case Cl.Step:[m]=nx({...b,borderRadius:0});break;case Cl.SmoothStep:[m]=nx(b);break;default:[m]=m9(b)}return o.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};lU.displayName="ConnectionLine";const Mle={};function BO(e=Mle){g.useRef(e),fs(),g.useEffect(()=>{},[e])}function Lle(){fs(),g.useRef(!1),g.useEffect(()=>{},[])}function cU({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:s,onEdgeClick:i,onNodeDoubleClick:r,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:b,connectionLineComponent:v,connectionLineContainerStyle:y,selectionKeyCode:x,selectionOnDrag:E,selectionMode:w,multiSelectionKeyCode:_,panActivationKeyCode:S,zoomActivationKeyCode:k,deleteKeyCode:T,onlyRenderVisibleElements:C,elementsSelectable:I,defaultViewport:j,translateExtent:L,minZoom:z,maxZoom:D,preventScrolling:F,defaultMarkerColor:A,zoomOnScroll:M,zoomOnPinch:P,panOnScroll:H,panOnScrollSpeed:R,panOnScrollMode:Y,zoomOnDoubleClick:J,panOnDrag:U,autoPanOnSelection:te,onPaneClick:K,onPaneMouseEnter:V,onPaneMouseMove:W,onPaneMouseLeave:q,onPaneScroll:ue,onPaneContextMenu:pe,paneClickDistance:we,nodeClickDistance:de,onEdgeContextMenu:ge,onEdgeMouseEnter:Le,onEdgeMouseMove:Ee,onEdgeMouseLeave:ie,reconnectRadius:Ne,onReconnect:ve,onReconnectStart:Qe,onReconnectEnd:De,noDragClassName:Ke,noWheelClassName:Se,noPanClassName:He,disableKeyboardA11y:Be,nodeExtent:qe,rfId:Z,viewport:ae,onViewportChange:ne}){return BO(e),BO(t),Lle(),Tle(n),Ale(ae),o.jsx(Xoe,{onPaneClick:K,onPaneMouseEnter:V,onPaneMouseMove:W,onPaneMouseLeave:q,onPaneContextMenu:pe,onPaneScroll:ue,paneClickDistance:we,deleteKeyCode:T,selectionKeyCode:x,selectionOnDrag:E,selectionMode:w,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:_,panActivationKeyCode:S,zoomActivationKeyCode:k,elementsSelectable:I,zoomOnScroll:M,zoomOnPinch:P,zoomOnDoubleClick:J,panOnScroll:H,panOnScrollSpeed:R,panOnScrollMode:Y,panOnDrag:U,autoPanOnSelection:te,defaultViewport:j,translateExtent:L,minZoom:z,maxZoom:D,onSelectionContextMenu:f,preventScrolling:F,noDragClassName:Ke,noWheelClassName:Se,noPanClassName:He,disableKeyboardA11y:Be,onViewportChange:ne,isControlledViewport:!!ae,children:o.jsxs(Nle,{children:[o.jsx(Sle,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:a,onReconnect:ve,onReconnectStart:Qe,onReconnectEnd:De,onlyRenderVisibleElements:C,onEdgeContextMenu:ge,onEdgeMouseEnter:Le,onEdgeMouseMove:Ee,onEdgeMouseLeave:ie,reconnectRadius:Ne,defaultMarkerColor:A,noPanClassName:He,disableKeyboardA11y:Be,rfId:Z}),o.jsx(Ole,{style:b,type:m,component:v,containerStyle:y}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(rle,{nodeTypes:e,onNodeClick:s,onNodeDoubleClick:r,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:de,onlyRenderVisibleElements:C,noPanClassName:He,noDragClassName:Ke,disableKeyboardA11y:Be,nodeExtent:qe,rfId:Z}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}cU.displayName="GraphView";const Dle=g.memo(cU),Ple=o9(),UO=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:i,height:r,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,m=new Map,b=new Map,v=new Map,y=s??t??[],x=n??e??[],E=d??[0,0],w=f??km;y9(b,v,y);const{nodesInitialized:_}=D_(x,p,m,{nodeOrigin:E,nodeExtent:w,zIndexMode:h});let S=[0,0,1];if(a&&i&&r){const k=pg(p,{filter:j=>!!((j.width||j.initialWidth)&&(j.height||j.initialHeight))}),{x:T,y:C,zoom:I}=iA(k,i,r,c,u,(l==null?void 0:l.padding)??.1);S=[T,C,I]}return{rfId:"1",width:i??0,height:r??0,transform:S,nodes:x,nodesInitialized:_,nodeLookup:p,parentLookup:m,edges:y,edgeLookup:v,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:s!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:km,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:vf.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:E,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:l,fitViewResolver:null,connection:{...t9},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Ple,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:e9,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Ble=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:i,height:r,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>eoe((p,m)=>{async function b(){const{nodeLookup:v,panZoom:y,fitViewOptions:x,fitViewResolver:E,width:w,height:_,minZoom:S,maxZoom:k}=m();y&&(await Dre({nodes:v,width:w,height:_,panZoom:y,minZoom:S,maxZoom:k},x),E==null||E.resolve(!0),p({fitViewResolver:null}))}return{...UO({nodes:e,edges:t,width:i,height:r,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:s,zIndexMode:h}),setNodes:v=>{const{nodeLookup:y,parentLookup:x,nodeOrigin:E,elevateNodesOnSelect:w,fitViewQueued:_,zIndexMode:S,nodesSelectionActive:k}=m(),{nodesInitialized:T,hasSelectedNodes:C}=D_(v,y,x,{nodeOrigin:E,nodeExtent:f,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:S}),I=k&&C;_&&T?(b(),p({nodes:v,nodesInitialized:T,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:I})):p({nodes:v,nodesInitialized:T,nodesSelectionActive:I})},setEdges:v=>{const{connectionLookup:y,edgeLookup:x}=m();y9(y,x,v),p({edges:v})},setDefaultNodesAndEdges:(v,y)=>{if(v){const{setNodes:x}=m();x(v),p({hasDefaultNodes:!0})}if(y){const{setEdges:x}=m();x(y),p({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:y,nodeLookup:x,parentLookup:E,domNode:w,nodeOrigin:_,nodeExtent:S,debug:k,fitViewQueued:T,zIndexMode:C}=m(),{changes:I,updatedInternals:j}=rae(v,x,E,w,_,S,C);j&&(tae(x,E,{nodeOrigin:_,nodeExtent:S,zIndexMode:C}),T?(b(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(I==null?void 0:I.length)>0&&(k&&console.log("React Flow: trigger node changes",I),y==null||y(I)))},updateNodePositions:(v,y=!1)=>{const x=[];let E=[];const{nodeLookup:w,triggerNodeChanges:_,connection:S,updateConnection:k,onNodesChangeMiddlewareMap:T}=m();for(const[C,I]of v){const j=w.get(C),L=!!(j!=null&&j.expandParent&&(j!=null&&j.parentId)&&(I!=null&&I.position)),z={id:C,type:"position",position:L?{x:Math.max(0,I.position.x),y:Math.max(0,I.position.y)}:I.position,dragging:y};if(j&&S.inProgress&&S.fromNode.id===j.id){const D=fu(j,S.fromHandle,Xe.Left,!0);k({...S,from:D})}L&&j.parentId&&x.push({id:C,parentId:j.parentId,rect:{...I.internals.positionAbsolute,width:I.measured.width??0,height:I.measured.height??0}}),E.push(z)}if(x.length>0){const{parentLookup:C,nodeOrigin:I}=m(),j=dA(x,w,C,I);E.push(...j)}for(const C of T.values())E=C(E);_(E)},triggerNodeChanges:v=>{const{onNodesChange:y,setNodes:x,nodes:E,hasDefaultNodes:w,debug:_}=m();if(v!=null&&v.length){if(w){const S=P9(v,E);x(S)}_&&console.log("React Flow: trigger node changes",v),y==null||y(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:y,setEdges:x,edges:E,hasDefaultEdges:w,debug:_}=m();if(v!=null&&v.length){if(w){const S=B9(v,E);x(S)}_&&console.log("React Flow: trigger edge changes",v),y==null||y(v)}},addSelectedNodes:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:E,triggerNodeChanges:w,triggerEdgeChanges:_}=m();if(y){const S=v.map(k=>jc(k,!0));w(S);return}w(Rd(E,new Set([...v]),!0)),_(Rd(x))},addSelectedEdges:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:E,triggerNodeChanges:w,triggerEdgeChanges:_}=m();if(y){const S=v.map(k=>jc(k,!0));_(S);return}_(Rd(x,new Set([...v]))),w(Rd(E,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:y}={})=>{const{edges:x,nodes:E,nodeLookup:w,triggerNodeChanges:_,triggerEdgeChanges:S}=m(),k=v||E,T=y||x,C=[];for(const j of k){if(!j.selected)continue;const L=w.get(j.id);L&&(L.selected=!1),C.push(jc(j.id,!1))}const I=[];for(const j of T)j.selected&&I.push(jc(j.id,!1));_(C),S(I)},setMinZoom:v=>{const{panZoom:y,maxZoom:x}=m();y==null||y.setScaleExtent([v,x]),p({minZoom:v})},setMaxZoom:v=>{const{panZoom:y,minZoom:x}=m();y==null||y.setScaleExtent([x,v]),p({maxZoom:v})},setTranslateExtent:v=>{var y;(y=m().panZoom)==null||y.setTranslateExtent(v),p({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:y,triggerNodeChanges:x,triggerEdgeChanges:E,elementsSelectable:w}=m();if(!w)return;const _=y.reduce((k,T)=>T.selected?[...k,jc(T.id,!1)]:k,[]),S=v.reduce((k,T)=>T.selected?[...k,jc(T.id,!1)]:k,[]);x(_),E(S)},setNodeExtent:v=>{const{nodes:y,nodeLookup:x,parentLookup:E,nodeOrigin:w,elevateNodesOnSelect:_,nodeExtent:S,zIndexMode:k}=m();v[0][0]===S[0][0]&&v[0][1]===S[0][1]&&v[1][0]===S[1][0]&&v[1][1]===S[1][1]||(D_(y,x,E,{nodeOrigin:w,nodeExtent:v,elevateNodesOnSelect:_,checkEquality:!1,zIndexMode:k}),p({nodeExtent:v}))},panBy:v=>{const{transform:y,width:x,height:E,panZoom:w,translateExtent:_}=m();return aae({delta:v,panZoom:w,transform:y,translateExtent:_,width:x,height:E})},setCenter:async(v,y,x)=>{const{width:E,height:w,maxZoom:_,panZoom:S}=m();if(!S)return!1;const k=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:_;return await S.setViewport({x:E/2-v*k,y:w/2-y*k,zoom:k},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),!0},cancelConnection:()=>{p({connection:{...t9}})},updateConnection:v=>{p({connection:v})},reset:()=>p({...UO()})}},Object.is);function hA({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:s,initialWidth:i,initialHeight:r,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[m]=g.useState(()=>Ble({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,width:i,height:r,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return o.jsx(toe,{value:m,children:o.jsx(Noe,{children:p})})}function Ule({children:e,nodes:t,edges:n,defaultNodes:s,defaultEdges:i,width:r,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return g.useContext(x1)?o.jsx(o.Fragment,{children:e}):o.jsx(hA,{initialNodes:t,initialEdges:n,defaultNodes:s,defaultEdges:i,initialWidth:r,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const Fle={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function $le({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:i,nodeTypes:r,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:m,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:y,onNodeMouseEnter:x,onNodeMouseMove:E,onNodeMouseLeave:w,onNodeContextMenu:_,onNodeDoubleClick:S,onNodeDragStart:k,onNodeDrag:T,onNodeDragStop:C,onNodesDelete:I,onEdgesDelete:j,onDelete:L,onSelectionChange:z,onSelectionDragStart:D,onSelectionDrag:F,onSelectionDragStop:A,onSelectionContextMenu:M,onSelectionStart:P,onSelectionEnd:H,onBeforeDelete:R,connectionMode:Y,connectionLineType:J=Cl.Bezier,connectionLineStyle:U,connectionLineComponent:te,connectionLineContainerStyle:K,deleteKeyCode:V="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:q=!1,selectionMode:ue=Am.Full,panActivationKeyCode:pe="Space",multiSelectionKeyCode:we=Im()?"Meta":"Control",zoomActivationKeyCode:de=Im()?"Meta":"Control",snapToGrid:ge,snapGrid:Le,onlyRenderVisibleElements:Ee=!1,selectNodesOnDrag:ie,nodesDraggable:Ne,autoPanOnNodeFocus:ve,nodesConnectable:Qe,nodesFocusable:De,nodeOrigin:Ke=L9,edgesFocusable:Se,edgesReconnectable:He,elementsSelectable:Be=!0,defaultViewport:qe=poe,minZoom:Z=.5,maxZoom:ae=2,translateExtent:ne=km,preventScrolling:xe=!0,nodeExtent:Fe,defaultMarkerColor:at="#b1b1b7",zoomOnScroll:It=!0,zoomOnPinch:ft=!0,panOnScroll:fn=!1,panOnScrollSpeed:Et=.5,panOnScrollMode:Nt=Qc.Free,zoomOnDoubleClick:Qt=!0,panOnDrag:Ve=!0,onPaneClick:Tt,onPaneMouseEnter:rt,onPaneMouseMove:ut,onPaneMouseLeave:Ze,onPaneScroll:_t,onPaneContextMenu:me,paneClickDistance:We=1,nodeClickDistance:bt=0,children:an,onReconnect:Kn,onReconnectStart:xt,onReconnectEnd:$t,onEdgeContextMenu:hn,onEdgeDoubleClick:cn,onEdgeMouseEnter:Pt,onEdgeMouseMove:jt,onEdgeMouseLeave:Sn,reconnectRadius:pn=10,onNodesChange:zt,onEdgesChange:Fn,noDragClassName:hs="nodrag",noWheelClassName:ps="nowheel",noPanClassName:Rn="nopan",fitView:$s,fitViewOptions:ms,connectOnClick:$n,attributionPosition:Hs,proOptions:Hn,defaultEdgeOptions:js,elevateNodesOnSelect:_n=!0,elevateEdgesOnSelect:ss=!1,disableKeyboardA11y:is=!1,autoPanOnConnect:_s,autoPanOnNodeDrag:gs,autoPanOnSelection:zs=!0,autoPanSpeed:bs,connectionRadius:On,isValidConnection:Nn,onError:ce,style:Ae,id:Re,nodeDragThreshold:Je,connectionDragThreshold:st,viewport:ot,onViewportChange:kt,width:Mn,height:Tn,colorMode:qt="light",debug:pi,onScroll:Pe,ariaLabelConfig:Vt,zIndexMode:vt="basic",...qn},ys){const aa=Re||"1",Da=yoe(qt),Js=g.useCallback(mi=>{mi.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Pe==null||Pe(mi)},[Pe]);return o.jsx("div",{"data-testid":"rf__wrapper",...qn,onScroll:Js,style:{...Ae,...Fle},ref:ys,className:Zs(["react-flow",i,Da]),id:Re,role:"application",children:o.jsxs(Ule,{nodes:e,edges:t,width:Mn,height:Tn,fitView:$s,fitViewOptions:ms,minZoom:Z,maxZoom:ae,nodeOrigin:Ke,nodeExtent:Fe,zIndexMode:vt,children:[o.jsx(boe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:p,onConnectStart:m,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:y,nodesDraggable:Ne,autoPanOnNodeFocus:ve,nodesConnectable:Qe,nodesFocusable:De,edgesFocusable:Se,edgesReconnectable:He,elementsSelectable:Be,elevateNodesOnSelect:_n,elevateEdgesOnSelect:ss,minZoom:Z,maxZoom:ae,nodeExtent:Fe,onNodesChange:zt,onEdgesChange:Fn,snapToGrid:ge,snapGrid:Le,connectionMode:Y,translateExtent:ne,connectOnClick:$n,defaultEdgeOptions:js,fitView:$s,fitViewOptions:ms,onNodesDelete:I,onEdgesDelete:j,onDelete:L,onNodeDragStart:k,onNodeDrag:T,onNodeDragStop:C,onSelectionDrag:F,onSelectionDragStart:D,onSelectionDragStop:A,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:Rn,nodeOrigin:Ke,rfId:aa,autoPanOnConnect:_s,autoPanOnNodeDrag:gs,autoPanSpeed:bs,onError:ce,connectionRadius:On,isValidConnection:Nn,selectNodesOnDrag:ie,nodeDragThreshold:Je,connectionDragThreshold:st,onBeforeDelete:R,debug:pi,ariaLabelConfig:Vt,zIndexMode:vt}),o.jsx(Dle,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:x,onNodeMouseMove:E,onNodeMouseLeave:w,onNodeContextMenu:_,onNodeDoubleClick:S,nodeTypes:r,edgeTypes:a,connectionLineType:J,connectionLineStyle:U,connectionLineComponent:te,connectionLineContainerStyle:K,selectionKeyCode:W,selectionOnDrag:q,selectionMode:ue,deleteKeyCode:V,multiSelectionKeyCode:we,panActivationKeyCode:pe,zoomActivationKeyCode:de,onlyRenderVisibleElements:Ee,defaultViewport:qe,translateExtent:ne,minZoom:Z,maxZoom:ae,preventScrolling:xe,zoomOnScroll:It,zoomOnPinch:ft,zoomOnDoubleClick:Qt,panOnScroll:fn,panOnScrollSpeed:Et,panOnScrollMode:Nt,panOnDrag:Ve,autoPanOnSelection:zs,onPaneClick:Tt,onPaneMouseEnter:rt,onPaneMouseMove:ut,onPaneMouseLeave:Ze,onPaneScroll:_t,onPaneContextMenu:me,paneClickDistance:We,nodeClickDistance:bt,onSelectionContextMenu:M,onSelectionStart:P,onSelectionEnd:H,onReconnect:Kn,onReconnectStart:xt,onReconnectEnd:$t,onEdgeContextMenu:hn,onEdgeDoubleClick:cn,onEdgeMouseEnter:Pt,onEdgeMouseMove:jt,onEdgeMouseLeave:Sn,reconnectRadius:pn,defaultMarkerColor:at,noDragClassName:hs,noWheelClassName:ps,noPanClassName:Rn,rfId:aa,disableKeyboardA11y:is,nodeExtent:Fe,viewport:ot,onViewportChange:kt}),o.jsx(hoe,{onSelectionChange:z}),an,o.jsx(loe,{proOptions:Hn,position:Hs}),o.jsx(ooe,{rfId:aa,disableKeyboardA11y:is})]})})}var uU=F9($le);const Hle=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function zle({children:e}){const t=en(Hle);return t?hi.createPortal(e,t):null}function dU(e){const[t,n]=g.useState(e),s=g.useCallback(i=>n(r=>P9(i,r)),[]);return[t,n,s]}function fU(e){const[t,n]=g.useState(e),s=g.useCallback(i=>n(r=>B9(i,r)),[]);return[t,n,s]}const Vle=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(const[,{internals:n}]of t.nodeLookup)if(n.handleBounds===void 0||!rA(n.userNode))return!1;return!0};function Gle(e={includeHiddenNodes:!1}){return en(Vle(e))}function Kle({dimensions:e,lineWidth:t,variant:n,className:s}){return o.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Zs(["react-flow__background-pattern",n,s])})}function qle({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:Zs(["react-flow__background-pattern","dots",t])})}var ql;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ql||(ql={}));const Yle={[ql.Dots]:1,[ql.Lines]:1,[ql.Cross]:6},Wle=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function hU({id:e,variant:t=ql.Dots,gap:n=20,size:s,lineWidth:i=1,offset:r=0,color:a,bgColor:l,style:c,className:u,patternClassName:d}){const f=g.useRef(null),{transform:h,patternId:p}=en(Wle,ds),m=s||Yle[t],b=t===ql.Dots,v=t===ql.Cross,y=Array.isArray(n)?n:[n,n],x=[y[0]*h[2]||1,y[1]*h[2]||1],E=m*h[2],w=Array.isArray(r)?r:[r,r],_=v?[E,E]:x,S=[w[0]*h[2]||1+_[0]/2,w[1]*h[2]||1+_[1]/2],k=`${p}${e||""}`;return o.jsxs("svg",{className:Zs(["react-flow__background",u]),style:{...c,...w1,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[o.jsx("pattern",{id:k,x:h[0]%x[0],y:h[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${S[0]},-${S[1]})`,children:b?o.jsx(qle,{radius:E/2,className:d}):o.jsx(Kle,{dimensions:_,lineWidth:i,variant:t,className:d})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${k})`})]})}hU.displayName="Background";const pU=g.memo(hU);function Xle(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:o.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Qle(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:o.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Zle(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:o.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 Jle(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.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 ece(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.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 H0({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:Zs(["react-flow__controls-button",t]),...n,children:e})}const tce=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function mU({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:i,onZoomIn:r,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const m=fs(),{isInteractive:b,minZoomReached:v,maxZoomReached:y,ariaLabelConfig:x}=en(tce,ds),{zoomIn:E,zoomOut:w,fitView:_}=v1(),S=()=>{E(),r==null||r()},k=()=>{w(),a==null||a()},T=()=>{_(i),l==null||l()},C=()=>{m.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},I=h==="horizontal"?"horizontal":"vertical";return o.jsxs(E1,{className:Zs(["react-flow__controls",I,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??x["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(H0,{onClick:S,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:y,children:o.jsx(Xle,{})}),o.jsx(H0,{onClick:k,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:v,children:o.jsx(Qle,{})})]}),n&&o.jsx(H0,{className:"react-flow__controls-fitview",onClick:T,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:o.jsx(Zle,{})}),s&&o.jsx(H0,{className:"react-flow__controls-interactive",onClick:C,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:b?o.jsx(ece,{}):o.jsx(Jle,{})}),d]})}mU.displayName="Controls";const gU=g.memo(mU);function nce({id:e,x:t,y:n,width:s,height:i,style:r,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:m,backgroundColor:b}=r||{},v=a||m||b;return o.jsx("rect",{className:Zs(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:s,height:i,style:{fill:v,stroke:l,strokeWidth:c},shapeRendering:f,onClick:p?y=>p(y,e):void 0})}const sce=g.memo(nce),ice=e=>e.nodes.map(t=>t.id),Gv=e=>e instanceof Function?e:()=>e;function rce({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:s=5,nodeStrokeWidth:i,nodeComponent:r=sce,onClick:a}){const l=en(ice,ds),c=Gv(t),u=Gv(e),d=Gv(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(h=>o.jsx(oce,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:s,nodeStrokeWidth:i,NodeComponent:r,onClick:a,shapeRendering:f},h))})}function ace({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:s,nodeBorderRadius:i,nodeStrokeWidth:r,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=en(m=>{const b=m.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const v=b.internals.userNode,{x:y,y:x}=b.internals.positionAbsolute,{width:E,height:w}=il(v);return{node:v,x:y,y:x,width:E,height:w}},ds);return!u||u.hidden||!rA(u)?null:o.jsx(l,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:s(u),color:t(u),borderRadius:i,strokeColor:n(u),strokeWidth:r,shapeRendering:a,onClick:c,id:u.id})}const oce=g.memo(ace);var lce=g.memo(rce);const cce=200,uce=150,dce=e=>!e.hidden,fce=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?a9(pg(e.nodeLookup,{filter:dce}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},hce="react-flow__minimap-desc";function bU({style:e,className:t,nodeStrokeColor:n,nodeColor:s,nodeClassName:i="",nodeBorderRadius:r=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:m,pannable:b=!1,zoomable:v=!1,ariaLabel:y,inversePan:x,zoomStep:E=1,offsetScale:w=5}){const _=fs(),S=g.useRef(null),{boundingRect:k,viewBB:T,rfId:C,panZoom:I,translateExtent:j,flowWidth:L,flowHeight:z,ariaLabelConfig:D}=en(fce,ds),F=(e==null?void 0:e.width)??cce,A=(e==null?void 0:e.height)??uce,M=k.width/F,P=k.height/A,H=Math.max(M,P),R=H*F,Y=H*A,J=w*H,U=k.x-(R-k.width)/2-J,te=k.y-(Y-k.height)/2-J,K=R+J*2,V=Y+J*2,W=`${hce}-${C}`,q=g.useRef(0),ue=g.useRef();q.current=H,g.useEffect(()=>{if(S.current&&I)return ue.current=mae({domNode:S.current,panZoom:I,getTransform:()=>_.getState().transform,getViewScale:()=>q.current}),()=>{var ge;(ge=ue.current)==null||ge.destroy()}},[I]),g.useEffect(()=>{var ge;(ge=ue.current)==null||ge.update({translateExtent:j,width:L,height:z,inversePan:x,pannable:b,zoomStep:E,zoomable:v})},[b,v,x,E,j,L,z]);const pe=p?ge=>{var ie;const[Le,Ee]=((ie=ue.current)==null?void 0:ie.pointer(ge))||[0,0];p(ge,{x:Le,y:Ee})}:void 0,we=m?g.useCallback((ge,Le)=>{const Ee=_.getState().nodeLookup.get(Le).internals.userNode;m(ge,Ee)},[]):void 0,de=y??D["minimap.ariaLabel"];return o.jsx(E1,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c: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*H:void 0,"--xy-minimap-node-background-color-props":typeof s=="string"?s: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:Zs(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:F,height:A,viewBox:`${U} ${te} ${K} ${V}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":W,ref:S,onClick:pe,children:[de&&o.jsx("title",{id:W,children:de}),o.jsx(lce,{onClick:we,nodeColor:s,nodeStrokeColor:n,nodeBorderRadius:r,nodeClassName:i,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${U-J},${te-J}h${K+J*2}v${V+J*2}h${-K-J*2}z + M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}bU.displayName="MiniMap";const pce=g.memo(bU),mce=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,gce={[Tf.Line]:"right",[Tf.Handle]:"bottom-right"};function bce({nodeId:e,position:t,variant:n=Tf.Handle,className:s,style:i=void 0,children:r,color:a,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:p=!0,shouldResize:m,onResizeStart:b,onResize:v,onResizeEnd:y}){const x=V9(),E=typeof e=="string"?e:x,w=fs(),_=g.useRef(null),S=n===Tf.Handle,k=en(g.useCallback(mce(S&&p),[S,p]),ds),T=g.useRef(null),C=t??gce[n];g.useEffect(()=>{if(!(!_.current||!E))return T.current||(T.current=Aae({domNode:_.current,nodeId:E,getStoreItems:()=>{const{nodeLookup:j,transform:L,snapGrid:z,snapToGrid:D,nodeOrigin:F,domNode:A}=w.getState();return{nodeLookup:j,transform:L,snapGrid:z,snapToGrid:D,nodeOrigin:F,paneDomNode:A}},onChange:(j,L)=>{const{triggerNodeChanges:z,nodeLookup:D,parentLookup:F,nodeOrigin:A}=w.getState(),M=[],P={x:j.x,y:j.y},H=D.get(E);if(H&&H.expandParent&&H.parentId){const R=H.origin??A,Y=j.width??H.measured.width??0,J=j.height??H.measured.height??0,U={id:H.id,parentId:H.parentId,rect:{width:Y,height:J,...l9({x:j.x??H.position.x,y:j.y??H.position.y},{width:Y,height:J},H.parentId,D,R)}},te=dA([U],D,F,A);M.push(...te),P.x=j.x?Math.max(R[0]*Y,j.x):void 0,P.y=j.y?Math.max(R[1]*J,j.y):void 0}if(P.x!==void 0&&P.y!==void 0){const R={id:E,type:"position",position:{...P}};M.push(R)}if(j.width!==void 0&&j.height!==void 0){const Y={id:E,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:j.width,height:j.height}};M.push(Y)}for(const R of L){const Y={...R,type:"position"};M.push(Y)}z(M)},onEnd:({width:j,height:L})=>{const z={id:E,type:"dimensions",resizing:!1,dimensions:{width:j,height:L}};w.getState().triggerNodeChanges([z])}})),T.current.update({controlPosition:C,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:b,onResize:v,onResizeEnd:y,shouldResize:m}),()=>{var j;(j=T.current)==null||j.destroy()}},[C,l,c,u,d,f,b,v,y,m]);const I=C.split("-");return o.jsx("div",{className:Zs(["react-flow__resize-control","nodrag",...I,n,s]),ref:_,style:{...i,scale:k,...a&&{[S?"backgroundColor":"borderColor"]:a}},children:r})}g.memo(bce);var yU=Object.defineProperty,yce=(e,t,n)=>t in e?yU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xce=(e,t)=>{for(var n in t)yU(e,n,{get:t[n],enumerable:!0})},Ece=(e,t,n)=>yce(e,t+"",n),xU={};xce(xU,{Graph:()=>ia,alg:()=>pA,json:()=>vU,version:()=>Sce});var vce=Object.defineProperty,EU=(e,t)=>{for(var n in t)vce(e,n,{get:t[n],enumerable:!0})},ia=class{constructor(t){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},t&&(this._isDirected="directed"in t?t.directed:!0,this._isMultigraph="multigraph"in t?t.multigraph:!1,this._isCompound="compound"in t?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return typeof t!="function"?this._defaultNodeLabelFn=()=>t:this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(t=>Object.keys(this._in[t]).length===0)}sinks(){return this.nodes().filter(t=>Object.keys(this._out[t]).length===0)}setNodes(t,n){return t.forEach(s=>{n!==void 0?this.setNode(s,n):this.setNode(s)}),this}setNode(t,n){return t in this._nodes?(arguments.length>1&&(this._nodes[t]=n),this):(this._nodes[t]=arguments.length>1?n:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return t in this._nodes}removeNode(t){if(t in this._nodes){let n=s=>this.removeEdge(this._edgeObjs[s]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(s=>{this.setParent(s)}),delete this._children[t]),Object.keys(this._in[t]).forEach(n),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n="\0";else{n+="";for(let s=n;s!==void 0;s=this.parent(s))if(s===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=n,this._children[n][t]=!0,this}parent(t){if(this._isCompound){let n=this._parent[t];if(n!=="\0")return n}}children(t="\0"){if(this._isCompound){let n=this._children[t];if(n)return Object.keys(n)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}return[]}predecessors(t){let n=this._preds[t];if(n)return Object.keys(n)}successors(t){let n=this._sucs[t];if(n)return Object.keys(n)}neighbors(t){let n=this.predecessors(t);if(n){let s=new Set(n);for(let i of this.successors(t))s.add(i);return Array.from(s.values())}}isLeaf(t){let n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){let n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph()),Object.entries(this._nodes).forEach(([r,a])=>{t(r)&&n.setNode(r,a)}),Object.values(this._edgeObjs).forEach(r=>{n.hasNode(r.v)&&n.hasNode(r.w)&&n.setEdge(r,this.edge(r))});let s={},i=r=>{let a=this.parent(r);return!a||n.hasNode(a)?(s[r]=a??void 0,a??void 0):a in s?s[a]:i(a)};return this._isCompound&&n.nodes().forEach(r=>n.setParent(r,i(r))),n}setDefaultEdgeLabel(t){return typeof t!="function"?this._defaultEdgeLabelFn=()=>t:this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,n){return t.reduce((s,i)=>(n!==void 0?this.setEdge(s,i,n):this.setEdge(s,i),i)),this}setEdge(t,n,s,i){let r,a,l,c,u=!1;typeof t=="object"&&t!==null&&"v"in t?(r=t.v,a=t.w,l=t.name,arguments.length===2&&(c=n,u=!0)):(r=t,a=n,l=i,arguments.length>2&&(c=s,u=!0)),r=""+r,a=""+a,l!==void 0&&(l=""+l);let d=up(this._isDirected,r,a,l);if(d in this._edgeLabels)return u&&(this._edgeLabels[d]=c),this;if(l!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(r),this.setNode(a),this._edgeLabels[d]=u?c:this._defaultEdgeLabelFn(r,a,l);let f=wce(this._isDirected,r,a,l);return r=f.v,a=f.w,Object.freeze(f),this._edgeObjs[d]=f,FO(this._preds[a],r),FO(this._sucs[r],a),this._in[a][d]=f,this._out[r][d]=f,this._edgeCount++,this}edge(t,n,s){let i=arguments.length===1?Kv(this._isDirected,t):up(this._isDirected,t,n,s);return this._edgeLabels[i]}edgeAsObj(t,n,s){let i=arguments.length===1?this.edge(t):this.edge(t,n,s);return typeof i!="object"?{label:i}:i}hasEdge(t,n,s){return(arguments.length===1?Kv(this._isDirected,t):up(this._isDirected,t,n,s))in this._edgeLabels}removeEdge(t,n,s){let i=arguments.length===1?Kv(this._isDirected,t):up(this._isDirected,t,n,s),r=this._edgeObjs[i];if(r){let a=r.v,l=r.w;delete this._edgeLabels[i],delete this._edgeObjs[i],$O(this._preds[l],a),$O(this._sucs[a],l),delete this._in[l][i],delete this._out[a][i],this._edgeCount--}return this}inEdges(t,n){return this.isDirected()?this.filterEdges(this._in[t],t,n):this.nodeEdges(t,n)}outEdges(t,n){return this.isDirected()?this.filterEdges(this._out[t],t,n):this.nodeEdges(t,n)}nodeEdges(t,n){if(t in this._nodes)return this.filterEdges({...this._in[t],...this._out[t]},t,n)}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}filterEdges(t,n,s){if(!t)return;let i=Object.values(t);return s?i.filter(r=>r.v===n&&r.w===s||r.v===s&&r.w===n):i}};function FO(e,t){e[t]?e[t]++:e[t]=1}function $O(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function up(e,t,n,s){let i=""+t,r=""+n;if(!e&&i>r){let a=i;i=r,r=a}return i+""+r+""+(s===void 0?"\0":s)}function wce(e,t,n,s){let i=""+t,r=""+n;if(!e&&i>r){let l=i;i=r,r=l}let a={v:i,w:r};return s&&(a.name=s),a}function Kv(e,t){return up(e,t.v,t.w,t.name)}var Sce="4.0.1",vU={};EU(vU,{read:()=>kce,write:()=>_ce});function _ce(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Nce(e),edges:Tce(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function Nce(e){return e.nodes().map(t=>{let n=e.node(t),s=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),s!==void 0&&(i.parent=s),i})}function Tce(e){return e.edges().map(t=>{let n=e.edge(t),s={v:t.v,w:t.w};return t.name!==void 0&&(s.name=t.name),n!==void 0&&(s.value=n),s})}function kce(e){let t=new ia(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var pA={};EU(pA,{CycleException:()=>rx,bellmanFord:()=>wU,components:()=>Ice,dijkstra:()=>ix,dijkstraAll:()=>Oce,findCycles:()=>Mce,floydWarshall:()=>Dce,isAcyclic:()=>Bce,postorder:()=>Fce,preorder:()=>$ce,prim:()=>Hce,shortestPaths:()=>zce,tarjan:()=>_U,topsort:()=>NU});var Ace=()=>1;function wU(e,t,n,s){return Cce(e,String(t),n||Ace,s||function(i){return e.outEdges(i)})}function Cce(e,t,n,s){let i={},r,a=0,l=e.nodes(),c=function(f){let h=n(f);i[f.v].distance+he.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,s=String(e);if(!(s in n)){let i=this._arr,r=i.length;return n[s]=r,i.push({key:s,priority:t}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let s=this._arr[n].priority;if(t>s)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${s} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,s=n+1,i=e;n>1,!(t[s].priority1;function ix(e,t,n,s){let i=function(r){return e.outEdges(r)};return Rce(e,String(t),n||jce,s||i)}function Rce(e,t,n,s){let i={},r=new SU,a,l,c=function(u){let d=u.v!==a?u.v:u.w,f=i[d],h=n(u),p=l.distance+h;if(h<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+h);p0&&(a=r.removeMin(),l=i[a],l.distance!==Number.POSITIVE_INFINITY);)s(a).forEach(c);return i}function Oce(e,t,n){return e.nodes().reduce(function(s,i){return s[i]=ix(e,i,t,n),s},{})}function _U(e){let t=0,n=[],s={},i=[];function r(a){let l=s[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){c in s?s[c].onStack&&(l.lowlink=Math.min(l.lowlink,s[c].index)):(r(c),l.lowlink=Math.min(l.lowlink,s[c].lowlink))}),l.lowlink===l.index){let c=[],u;do u=n.pop(),s[u].onStack=!1,c.push(u);while(a!==u);i.push(c)}}return e.nodes().forEach(function(a){a in s||r(a)}),i}function Mce(e){return _U(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var Lce=()=>1;function Dce(e,t,n){return Pce(e,t||Lce,n||function(s){return e.outEdges(s)})}function Pce(e,t,n){let s={},i=e.nodes();return i.forEach(function(r){s[r]={},s[r][r]={distance:0,predecessor:""},i.forEach(function(a){r!==a&&(s[r][a]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(r).forEach(function(a){let l=a.v===r?a.w:a.v,c=t(a);s[r][l]={distance:c,predecessor:r}})}),i.forEach(function(r){let a=s[r];i.forEach(function(l){let c=s[l];i.forEach(function(u){let d=c[r],f=a[u],h=c[u],p=d.distance+f.distance;p{var c;return(c=e.isDirected()?e.successors(l):e.neighbors(l))!=null?c:[]},a={};return t.forEach(function(l){if(!e.hasNode(l))throw new Error("Graph does not have node: "+l);i=TU(e,l,n==="post",a,r,s,i)}),i}function TU(e,t,n,s,i,r,a){return t in s||(s[t]=!0,n||(a=r(a,t)),i(t).forEach(function(l){a=TU(e,l,n,s,i,r,a)}),n&&(a=r(a,t))),a}function kU(e,t,n){return Uce(e,t,n,function(s,i){return s.push(i),s},[])}function Fce(e,t){return kU(e,t,"post")}function $ce(e,t){return kU(e,t,"pre")}function Hce(e,t){let n=new ia,s={},i=new SU,r;function a(c){let u=c.v===r?c.w:c.v,d=i.priority(u);if(d!==void 0){let f=t(c);f0;){if(r=i.removeMin(),r in s)n.setEdge(r,s[r]);else{if(l)throw new Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(r).forEach(a)}return n}function zce(e,t,n,s){return Vce(e,t,n,s??(i=>{let r=e.outEdges(i);return r??[]}))}function Vce(e,t,n,s){if(n===void 0)return ix(e,t,n,s);let i=!1,r=e.nodes();for(let a=0;at.setNode(n,e.node(n))),e.edges().forEach(n=>{let s=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:s.weight+i.weight,minlen:Math.max(s.minlen,i.minlen)})}),t}function AU(e){let t=new ia({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function HO(e,t){let n=e.x,s=e.y,i=t.x-n,r=t.y-s,a=e.width/2,l=e.height/2;if(!i&&!r)throw new Error("Not possible to find intersection inside of the rectangle");let c,u;return Math.abs(r)*a>Math.abs(i)*l?(r<0&&(l=-l),c=l*i/r,u=l):(i<0&&(a=-a),c=a,u=a*r/i),{x:n+c,y:s+u}}function bg(e){let t=Rm(IU(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let s=e.node(n),i=s.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][s.order]=n)}),t}function Kce(e){let t=e.nodes().map(s=>{let i=e.node(s).rank;return i===void 0?Number.MAX_VALUE:i}),n=Za(Math.min,t);e.nodes().forEach(s=>{let i=e.node(s);Object.hasOwn(i,"rank")&&(i.rank-=n)})}function qce(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=Za(Math.min,t),s=[];e.nodes().forEach(a=>{let l=e.node(a).rank-n;s[l]||(s[l]=[]),s[l].push(a)});let i=0,r=e.graph().nodeRankFactor;Array.from(s).forEach((a,l)=>{a===void 0&&l%r!==0?--i:a!==void 0&&i&&a.forEach(c=>e.node(c).rank+=i)})}function zO(e,t,n,s){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=s),th(e,"border",i,t)}function Yce(e,t=CU){let n=[];for(let s=0;sCU){let n=Yce(t);return e(...n.map(s=>e(...s)))}else return e(...t)}function IU(e){let t=e.nodes().map(n=>{let s=e.node(n).rank;return s===void 0?Number.MIN_VALUE:s});return Za(Math.max,t)}function Wce(e,t){let n={lhs:[],rhs:[]};return e.forEach(s=>{t(s)?n.lhs.push(s):n.rhs.push(s)}),n}function jU(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function RU(e,t){return t()}var Xce=0;function mA(e){let t=++Xce;return e+(""+t)}function Rm(e,t,n=1){t==null&&(t=e,e=0);let s=r=>rts[t]:n=t,Object.entries(e).reduce((s,[i,r])=>(s[i]=n(r,i),s),{})}function Qce(e,t){return e.reduce((n,s,i)=>(n[s]=t[i],n),{})}var _1="\0",Zce="3.0.0",Jce=class{constructor(){Ece(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return VO(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&VO(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,eue)),n=n._prev;return"["+e.join(", ")+"]"}};function VO(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function eue(e,t){if(e!=="_next"&&e!=="_prev")return t}var tue=Jce,nue=()=>1;function sue(e,t){if(e.nodeCount()<=1)return[];let n=rue(e,t||nue);return iue(n.graph,n.buckets,n.zeroIdx).flatMap(s=>e.outEdges(s.v,s.w)||[])}function iue(e,t,n){var s;let i=[],r=t[t.length-1],a=t[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)qv(e,t,n,l);for(;l=r.dequeue();)qv(e,t,n,l);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(l=(s=t[c])==null?void 0:s.dequeue(),l){i=i.concat(qv(e,t,n,l,!0)||[]);break}}}return i}function qv(e,t,n,s,i){let r=[],a=i?r:void 0;return(e.inEdges(s.v)||[]).forEach(l=>{let c=e.edge(l),u=e.node(l.v);i&&r.push({v:l.v,w:l.w}),u.out-=c,U_(t,n,u)}),(e.outEdges(s.v)||[]).forEach(l=>{let c=e.edge(l),u=l.w,d=e.node(u);d.in-=c,U_(t,n,d)}),e.removeNode(s.v),a}function rue(e,t){let n=new ia,s=0,i=0;e.nodes().forEach(l=>{n.setNode(l,{v:l,in:0,out:0})}),e.edges().forEach(l=>{let c=n.edge(l.v,l.w)||0,u=t(l),d=c+u;n.setEdge(l.v,l.w,d);let f=n.node(l.v),h=n.node(l.w);i=Math.max(i,f.out+=u),s=Math.max(s,h.in+=u)});let r=aue(i+s+3).map(()=>new tue),a=s+1;return n.nodes().forEach(l=>{U_(r,a,n.node(l))}),{graph:n,buckets:r,zeroIdx:a}}function U_(e,t,n){var s,i,r;n.out?n.in?(r=e[n.out-n.in+t])==null||r.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(s=e[0])==null||s.enqueue(n)}function aue(e){let t=[];for(let n=0;n{let s=e.edge(n);e.removeEdge(n),s.forwardName=n.name,s.reversed=!0,e.setEdge(n.w,n.v,s,mA("rev"))});function t(n){return s=>n.edge(s).weight}}function lue(e){let t=[],n={},s={};function i(r){Object.hasOwn(s,r)||(s[r]=!0,n[r]=!0,e.outEdges(r).forEach(a=>{Object.hasOwn(n,a.w)?t.push(a):i(a.w)}),delete n[r])}return e.nodes().forEach(i),t}function cue(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let s=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,s)}})}function uue(e){e.graph().dummyChains=[],e.edges().forEach(t=>due(e,t))}function due(e,t){let n=t.v,s=e.node(n).rank,i=t.w,r=e.node(i).rank,a=t.name,l=e.edge(t),c=l.labelRank;if(r===s+1)return;e.removeEdge(t);let u,d,f;for(f=0,++s;s{let n=e.node(t),s=n.edgeLabel,i;for(e.setEdge(n.edgeObj,s);n.dummy;)i=e.successors(t)[0],e.removeNode(t),s.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(s.x=n.x,s.y=n.y,s.width=n.width,s.height=n.height),t=i,n=e.node(t)})}function gA(e){let t={};function n(s){let i=e.node(s);if(Object.hasOwn(t,s))return i.rank;t[s]=!0;let r=e.outEdges(s),a=r?r.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],l=Za(Math.min,a);return l===Number.POSITIVE_INFINITY&&(l=0),i.rank=l}e.sources().forEach(n)}function Af(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var OU=hue;function hue(e){let t=new ia({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let s=n[0],i=e.nodeCount();t.setNode(s,{});let r,a;for(;pue(t,e){let a=r.v,l=s===a?r.w:a;!e.hasNode(l)&&!Af(t,r)&&(e.setNode(l,{}),e.setEdge(s,l,{}),n(l))})}return e.nodes().forEach(n),e.nodeCount()}function mue(e,t){return t.edges().reduce((n,s)=>{let i=Number.POSITIVE_INFINITY;return e.hasNode(s.v)!==e.hasNode(s.w)&&(i=Af(t,s)),it.node(s).rank+=n)}var{preorder:bue,postorder:yue}=pA,xue=_u;_u.initLowLimValues=yA;_u.initCutValues=bA;_u.calcCutValue=MU;_u.leaveEdge=DU;_u.enterEdge=PU;_u.exchangeEdges=BU;function _u(e){e=Gce(e),gA(e);let t=OU(e);yA(t),bA(t,e);let n,s;for(;n=DU(t);)s=PU(t,e,n),BU(t,e,n,s)}function bA(e,t){let n=yue(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(s=>Eue(e,t,s))}function Eue(e,t,n){let s=e.node(n).parent,i=e.edge(n,s);i.cutvalue=MU(e,t,n)}function MU(e,t,n){let s=e.node(n).parent,i=!0,r=t.edge(n,s),a=0;r||(i=!1,r=t.edge(s,n)),a=r.weight;let l=t.nodeEdges(n);return l&&l.forEach(c=>{let u=c.v===n,d=u?c.w:c.v;if(d!==s){let f=u===i,h=t.edge(c).weight;if(a+=f?h:-h,wue(e,n,d)){let p=e.edge(n,d).cutvalue;a+=f?-p:p}}}),a}function yA(e,t){arguments.length<2&&(t=e.nodes()[0]),LU(e,{},1,t)}function LU(e,t,n,s,i){let r=n,a=e.node(s);t[s]=!0;let l=e.neighbors(s);return l&&l.forEach(c=>{Object.hasOwn(t,c)||(n=LU(e,t,n,c,s))}),a.low=r,a.lim=n++,i?a.parent=i:delete a.parent,n}function DU(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function PU(e,t,n){let s=n.v,i=n.w;t.hasEdge(s,i)||(s=n.w,i=n.v);let r=e.node(s),a=e.node(i),l=r,c=!1;return r.lim>a.lim&&(l=a,c=!0),t.edges().filter(u=>c===GO(e,e.node(u.v),l)&&c!==GO(e,e.node(u.w),l)).reduce((u,d)=>Af(t,d)!e.node(i).parent);if(!n)return;let s=bue(e,[n]);s=s.slice(1),s.forEach(i=>{let r=e.node(i).parent,a=t.edge(i,r),l=!1;a||(a=t.edge(r,i),l=!0),t.node(i).rank=t.node(r).rank+(l?a.minlen:-a.minlen)})}function wue(e,t,n){return e.hasEdge(t,n)}function GO(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Sue=_ue;function _ue(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":KO(e);break;case"tight-tree":Tue(e);break;case"longest-path":Nue(e);break;case"none":break;default:KO(e)}}var Nue=gA;function Tue(e){gA(e),OU(e)}function KO(e){xue(e)}var kue=Aue;function Aue(e){let t=Iue(e);e.graph().dummyChains.forEach(n=>{let s=e.node(n),i=s.edgeObj,r=Cue(e,t,i.v,i.w),a=r.path,l=r.lca,c=0,u=a[c],d=!0;for(;n!==i.w;){if(s=e.node(n),d){for(;(u=a[c])!==l&&e.node(u).maxRanka||l>t[c].lim));let u=c,d=s;for(;(d=e.parent(d))!==u;)r.push(d);return{path:i.concat(r.reverse()),lca:u}}function Iue(e){let t={},n=0;function s(i){let r=n;e.children(i).forEach(s),t[i]={low:r,lim:n++}}return e.children(_1).forEach(s),t}function jue(e){let t=th(e,"root",{},"_root"),n=Rue(e),s=Object.values(n),i=Za(Math.max,s)-1,r=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=r);let a=Oue(e)+1;e.children(_1).forEach(l=>UU(e,t,r,a,i,n,l)),e.graph().nodeRankFactor=r}function UU(e,t,n,s,i,r,a){var l;let c=e.children(a);if(!c.length){a!==t&&e.setEdge(t,a,{weight:0,minlen:n});return}let u=zO(e,"_bt"),d=zO(e,"_bb"),f=e.node(a);e.setParent(u,a),f.borderTop=u,e.setParent(d,a),f.borderBottom=d,c.forEach(h=>{var p;UU(e,t,n,s,i,r,h);let m=e.node(h),b=m.borderTop?m.borderTop:h,v=m.borderBottom?m.borderBottom:h,y=m.borderTop?s:2*s,x=b!==v?1:i-((p=r[a])!=null?p:0)+1;e.setEdge(u,b,{weight:y,minlen:x,nestingEdge:!0}),e.setEdge(v,d,{weight:y,minlen:x,nestingEdge:!0})}),e.parent(a)||e.setEdge(t,u,{weight:0,minlen:i+((l=r[a])!=null?l:0)})}function Rue(e){let t={};function n(s,i){let r=e.children(s);r&&r.length&&r.forEach(a=>n(a,i+1)),t[s]=i}return e.children(_1).forEach(s=>n(s,1)),t}function Oue(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Mue(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var Lue=Due;function Due(e){function t(n){let s=e.children(n),i=e.node(n);if(s.length&&s.forEach(t),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let r=i.minRank,a=i.maxRank+1;rYO(e.node(t))),e.edges().forEach(t=>YO(e.edge(t)))}function YO(e){let t=e.width;e.width=e.height,e.height=t}function Uue(e){e.nodes().forEach(t=>Yv(e.node(t))),e.edges().forEach(t=>{var n;let s=e.edge(t);(n=s.points)==null||n.forEach(Yv),Object.hasOwn(s,"y")&&Yv(s)})}function Yv(e){e.y=-e.y}function Fue(e){e.nodes().forEach(t=>Wv(e.node(t))),e.edges().forEach(t=>{var n;let s=e.edge(t);(n=s.points)==null||n.forEach(Wv),Object.hasOwn(s,"x")&&Wv(s)})}function Wv(e){let t=e.x;e.x=e.y,e.y=t}function $ue(e){let t={},n=e.nodes().filter(l=>!e.children(l).length),s=n.map(l=>e.node(l).rank),i=Za(Math.max,s),r=Rm(i+1).map(()=>[]);function a(l){if(t[l])return;t[l]=!0;let c=e.node(l);r[c.rank].push(l);let u=e.successors(l);u&&u.forEach(a)}return n.sort((l,c)=>e.node(l).rank-e.node(c).rank).forEach(a),r}function Hue(e,t){let n=0;for(let s=1;sd)),i=t.flatMap(u=>{let d=e.outEdges(u);return d?d.map(f=>({pos:s[f.w],weight:e.edge(f).weight})).sort((f,h)=>f.pos-h.pos):[]}),r=1;for(;r{let d=u.pos+r;l[d]+=u.weight;let f=0;for(;d>0;)d%2&&(f+=l[d+1]),d=d-1>>1,l[d]+=u.weight;c+=u.weight*f}),c}function Vue(e,t=[]){return t.map(n=>{let s=e.inEdges(n);if(!s||!s.length)return{v:n};{let i=s.reduce((r,a)=>{let l=e.edge(a),c=e.node(a.v);return{sum:r.sum+l.weight*c.order,weight:r.weight+l.weight}},{sum:0,weight:0});return{v:n,barycenter:i.sum/i.weight,weight:i.weight}}})}function Gue(e,t){let n={};e.forEach((i,r)=>{let a={indegree:0,in:[],out:[],vs:[i.v],i:r};i.barycenter!==void 0&&(a.barycenter=i.barycenter,a.weight=i.weight),n[i.v]=a}),t.edges().forEach(i=>{let r=n[i.v],a=n[i.w];r!==void 0&&a!==void 0&&(a.indegree++,r.out.push(a))});let s=Object.values(n).filter(i=>!i.indegree);return Kue(s)}function Kue(e){let t=[];function n(i){return r=>{r.merged||(r.barycenter===void 0||i.barycenter===void 0||r.barycenter>=i.barycenter)&&que(i,r)}}function s(i){return r=>{r.in.push(i),--r.indegree===0&&e.push(r)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(s(i))}return t.filter(i=>!i.merged).map(i=>ax(i,["vs","i","barycenter","weight"]))}function que(e,t){let n=0,s=0;e.weight&&(n+=e.barycenter*e.weight,s+=e.weight),t.weight&&(n+=t.barycenter*t.weight,s+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/s,e.weight=s,e.i=Math.min(t.i,e.i),t.merged=!0}function Yue(e,t){let n=Wce(e,d=>Object.hasOwn(d,"barycenter")),s=n.lhs,i=n.rhs.sort((d,f)=>f.i-d.i),r=[],a=0,l=0,c=0;s.sort(Wue(!!t)),c=WO(r,i,c),s.forEach(d=>{c+=d.vs.length,r.push(d.vs),a+=d.barycenter*d.weight,l+=d.weight,c=WO(r,i,c)});let u={vs:r.flat(1)};return l&&(u.barycenter=a/l,u.weight=l),u}function WO(e,t,n){let s;for(;t.length&&(s=t[t.length-1]).i<=n;)t.pop(),e.push(s.vs),n++;return n}function Wue(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}function $U(e,t,n,s){let i=e.children(t),r=e.node(t),a=r?r.borderLeft:void 0,l=r?r.borderRight:void 0,c={};a&&(i=i.filter(h=>h!==a&&h!==l));let u=Vue(e,i);u.forEach(h=>{if(e.children(h.v).length){let p=$U(e,h.v,n,s);c[h.v]=p,Object.hasOwn(p,"barycenter")&&Que(h,p)}});let d=Gue(u,n);Xue(d,c);let f=Yue(d,s);if(a&&l){f.vs=[a,f.vs,l].flat(1);let h=e.predecessors(a);if(h&&h.length){let p=e.node(h[0]),m=e.predecessors(l),b=e.node(m[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+p.order+b.order)/(f.weight+2),f.weight+=2}}return f}function Xue(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(s=>t[s]?t[s].vs:s)})}function Que(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function Zue(e,t,n,s){s||(s=e.nodes());let i=Jue(e),r=new ia({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(a=>e.node(a));return s.forEach(a=>{let l=e.node(a),c=e.parent(a);if(l.rank===t||l.minRank<=t&&t<=l.maxRank){r.setNode(a),r.setParent(a,c||i);let u=e[n](a);u&&u.forEach(d=>{let f=d.v===a?d.w:d.v,h=r.edge(f,a),p=h!==void 0?h.weight:0;r.setEdge(f,a,{weight:e.edge(d).weight+p})}),Object.hasOwn(l,"minRank")&&r.setNode(a,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]})}}),r}function Jue(e){let t;for(;e.hasNode(t=mA("_root")););return t}function ede(e,t,n){let s={},i;n.forEach(r=>{let a=e.parent(r),l,c;for(;a;){if(l=e.parent(a),l?(c=s[l],s[l]=a):(c=i,i=a),c&&c!==a){t.setEdge(c,a);return}a=l}})}function HU(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,HU);return}let n=IU(e),s=XO(e,Rm(1,n+1),"inEdges"),i=XO(e,Rm(n-1,-1,-1),"outEdges"),r=$ue(e);if(QO(e,r),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,l,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){tde(u%2?s:i,u%4>=2,c),r=bg(e);let f=Hue(e,r);f{s.has(r)||s.set(r,[]),s.get(r).push(a)};for(let r of e.nodes()){let a=e.node(r);if(typeof a.rank=="number"&&i(a.rank,r),typeof a.minRank=="number"&&typeof a.maxRank=="number")for(let l=a.minRank;l<=a.maxRank;l++)l!==a.rank&&i(l,r)}return t.map(function(r){return Zue(e,r,n,s.get(r)||[])})}function tde(e,t,n){let s=new ia;e.forEach(function(i){n.forEach(l=>s.setEdge(l.left,l.right));let r=i.graph().root,a=$U(i,r,s,t);a.vs.forEach((l,c)=>i.node(l).order=c),ede(i,s,a.vs)})}function QO(e,t){Object.values(t).forEach(n=>n.forEach((s,i)=>e.node(s).order=i))}function nde(e,t){let n={};function s(i,r){let a=0,l=0,c=i.length,u=r[r.length-1];return r.forEach((d,f)=>{let h=ide(e,d),p=h?e.node(h).order:c;(h||d===u)&&(r.slice(l,f+1).forEach(m=>{let b=e.predecessors(m);b&&b.forEach(v=>{let y=e.node(v),x=y.order;(x{let f=r[d];if(f!==void 0&&e.node(f).dummy){let h=e.predecessors(f);h&&h.forEach(p=>{if(p===void 0)return;let m=e.node(p);m.dummy&&(m.orderu)&&zU(n,p,f)})}})}function i(r,a){let l=-1,c=-1,u=0;return a.forEach((d,f)=>{if(e.node(d).dummy==="border"){let h=e.predecessors(d);if(h&&h.length){let p=h[0];if(p===void 0)return;c=e.node(p).order,s(a,u,f,l,c),u=f,l=c}}s(a,u,a.length,c,r.length)}),a}return t.length&&t.reduce(i),n}function ide(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(s=>e.node(s).dummy)}}function zU(e,t,n){if(t>n){let i=t;t=n,n=i}let s=e[t];s||(e[t]=s={}),s[n]=!0}function rde(e,t,n){if(t>n){let i=t;t=n,n=i}let s=e[t];return s!==void 0&&Object.hasOwn(s,n)}function ade(e,t,n,s){let i={},r={},a={};return t.forEach(l=>{l.forEach((c,u)=>{i[c]=c,r[c]=c,a[c]=u})}),t.forEach(l=>{let c=-1;l.forEach(u=>{let d=s(u);if(d&&d.length){let f=d.sort((p,m)=>{let b=a[p],v=a[m];return(b!==void 0?b:0)-(v!==void 0?v:0)}),h=(f.length-1)/2;for(let p=Math.floor(h),m=Math.ceil(h);p<=m;++p){let b=f[p];if(b===void 0)continue;let v=a[b];if(v!==void 0&&r[u]===u&&c{var y;let x=(y=r[v.v])!=null?y:0,E=a.edge(v);return Math.max(b,x+(E!==void 0?E:0))},0):r[p]=0}function d(p){let m=a.outEdges(p),b=Number.POSITIVE_INFINITY;m&&(b=m.reduce((y,x)=>{let E=r[x.w],w=a.edge(x);return Math.min(y,(E!==void 0?E:0)-(w!==void 0?w:0))},Number.POSITIVE_INFINITY));let v=e.node(p);b!==Number.POSITIVE_INFINITY&&v.borderType!==l&&(r[p]=Math.max(r[p]!==void 0?r[p]:0,b))}function f(p){return a.predecessors(p)||[]}function h(p){return a.successors(p)||[]}return c(u,f),c(d,h),Object.keys(s).forEach(p=>{var m;let b=n[p];b!==void 0&&(r[p]=(m=r[b])!=null?m:0)}),r}function lde(e,t,n,s){let i=new ia,r=e.graph(),a=hde(r.nodesep,r.edgesep,s);return t.forEach(l=>{let c;l.forEach(u=>{let d=n[u];if(d!==void 0){if(i.setNode(d),c!==void 0){let f=n[c];if(f!==void 0){let h=i.edge(f,d);i.setEdge(f,d,Math.max(a(e,u,c),h||0))}}c=u}})}),i}function cde(e,t){return Object.values(t).reduce((n,s)=>{let i=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;Object.entries(s).forEach(([l,c])=>{let u=pde(e,l)/2;i=Math.max(c+u,i),r=Math.min(c-u,r)});let a=i-r;return a{["l","r"].forEach(a=>{let l=r+a,c=e[l];if(!c||c===t)return;let u=Object.values(c),d=s-Za(Math.min,u);a!=="l"&&(d=i-Za(Math.max,u)),d&&(e[l]=S1(c,f=>f+d))})})}function dde(e,t=void 0){let n=e.ul;return n?S1(n,(s,i)=>{var r,a;if(t){let c=t.toLowerCase(),u=e[c];if(u&&u[i]!==void 0)return u[i]}let l=Object.values(e).map(c=>{let u=c[i];return u!==void 0?u:0}).sort((c,u)=>c-u);return(((r=l[1])!=null?r:0)+((a=l[2])!=null?a:0))/2}):{}}function fde(e){let t=bg(e),n=Object.assign(nde(e,t),sde(e,t)),s={},i;["u","d"].forEach(a=>{i=a==="u"?t:Object.values(t).reverse(),["l","r"].forEach(l=>{l==="r"&&(i=i.map(d=>Object.values(d).reverse()));let c=ade(e,i,n,d=>(a==="u"?e.predecessors(d):e.successors(d))||[]),u=ode(e,i,c.root,c.align,l==="r");l==="r"&&(u=S1(u,d=>-d)),s[a+l]=u})});let r=cde(e,s);return ude(s,r),dde(s,e.graph().align)}function hde(e,t,n){return(s,i,r)=>{let a=s.node(i),l=s.node(r),c=0,u;if(c+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":u=-a.width/2;break;case"r":u=a.width/2;break}if(u&&(c+=n?u:-u),u=void 0,c+=(a.dummy?t:e)/2,c+=(l.dummy?t:e)/2,c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":u=l.width/2;break;case"r":u=-l.width/2;break}return u&&(c+=n?u:-u),c}}function pde(e,t){return e.node(t).width}function mde(e){e=AU(e),gde(e),Object.entries(fde(e)).forEach(([t,n])=>e.node(t).x=n)}function gde(e){let t=bg(e),n=e.graph(),s=n.ranksep,i=n.rankalign,r=0;t.forEach(a=>{let l=a.reduce((c,u)=>{var d;let f=(d=e.node(u).height)!=null?d:0;return c>f?c:f},0);a.forEach(c=>{let u=e.node(c);i==="top"?u.y=r+u.height/2:i==="bottom"?u.y=r+l-u.height/2:u.y=r+l/2}),r+=l+s})}function bde(e,t={}){let n=t.debugTiming?jU:RU;return n("layout",()=>{let s=n(" buildLayoutGraph",()=>kde(e));return n(" runLayout",()=>yde(s,n,t)),n(" updateInputGraph",()=>xde(e,s)),s})}function yde(e,t,n){t(" makeSpaceForEdgeLabels",()=>Ade(e)),t(" removeSelfEdges",()=>Pde(e)),t(" acyclic",()=>oue(e)),t(" nestingGraph.run",()=>jue(e)),t(" rank",()=>Sue(AU(e))),t(" injectEdgeLabelProxies",()=>Cde(e)),t(" removeEmptyRanks",()=>qce(e)),t(" nestingGraph.cleanup",()=>Mue(e)),t(" normalizeRanks",()=>Kce(e)),t(" assignRankMinMax",()=>Ide(e)),t(" removeEdgeLabelProxies",()=>jde(e)),t(" normalize.run",()=>uue(e)),t(" parentDummyChains",()=>kue(e)),t(" addBorderSegments",()=>Lue(e)),t(" order",()=>HU(e,n)),t(" insertSelfEdges",()=>Bde(e)),t(" adjustCoordinateSystem",()=>Pue(e)),t(" position",()=>mde(e)),t(" positionSelfEdges",()=>Ude(e)),t(" removeBorderNodes",()=>Dde(e)),t(" normalize.undo",()=>fue(e)),t(" fixupEdgeLabelCoords",()=>Mde(e)),t(" undoCoordinateSystem",()=>Bue(e)),t(" translateGraph",()=>Rde(e)),t(" assignNodeIntersects",()=>Ode(e)),t(" reversePoints",()=>Lde(e)),t(" acyclic.undo",()=>cue(e))}function xde(e,t){e.nodes().forEach(n=>{let s=e.node(n),i=t.node(n);s&&(s.x=i.x,s.y=i.y,s.order=i.order,s.rank=i.rank,t.children(n).length&&(s.width=i.width,s.height=i.height))}),e.edges().forEach(n=>{let s=e.edge(n),i=t.edge(n);s.points=i.points,Object.hasOwn(i,"x")&&(s.x=i.x,s.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Ede=["nodesep","edgesep","ranksep","marginx","marginy"],vde={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},wde=["acyclicer","ranker","rankdir","align","rankalign"],Sde=["width","height","rank"],ZO={width:0,height:0},_de=["minlen","weight","width","height","labeloffset"],Nde={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Tde=["labelpos"];function kde(e){let t=new ia({multigraph:!0,compound:!0}),n=Qv(e.graph());return t.setGraph(Object.assign({},vde,Xv(n,Ede),ax(n,wde))),e.nodes().forEach(s=>{let i=Qv(e.node(s)),r=Xv(i,Sde);Object.keys(ZO).forEach(l=>{r[l]===void 0&&(r[l]=ZO[l])}),t.setNode(s,r);let a=e.parent(s);a!==void 0&&t.setParent(s,a)}),e.edges().forEach(s=>{let i=Qv(e.edge(s));t.setEdge(s,Object.assign({},Nde,Xv(i,_de),ax(i,Tde)))}),t}function Ade(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let s=e.edge(n);s.minlen*=2,s.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?s.width+=s.labeloffset:s.height+=s.labeloffset)})}function Cde(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let s=e.node(t.v),i={rank:(e.node(t.w).rank-s.rank)/2+s.rank,e:t};th(e,"edge-proxy",i,"_ep")}})}function Ide(e){let t=0;e.nodes().forEach(n=>{let s=e.node(n);s.borderTop&&(s.minRank=e.node(s.borderTop).rank,s.maxRank=e.node(s.borderBottom).rank,t=Math.max(t,s.maxRank))}),e.graph().maxRank=t}function jde(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let s=n;e.edge(s.e).labelRank=n.rank,e.removeNode(t)}})}function Rde(e){let t=Number.POSITIVE_INFINITY,n=0,s=Number.POSITIVE_INFINITY,i=0,r=e.graph(),a=r.marginx||0,l=r.marginy||0;function c(u){let d=u.x,f=u.y,h=u.width,p=u.height;t=Math.min(t,d-h/2),n=Math.max(n,d+h/2),s=Math.min(s,f-p/2),i=Math.max(i,f+p/2)}e.nodes().forEach(u=>c(e.node(u))),e.edges().forEach(u=>{let d=e.edge(u);Object.hasOwn(d,"x")&&c(d)}),t-=a,s-=l,e.nodes().forEach(u=>{let d=e.node(u);d.x-=t,d.y-=s}),e.edges().forEach(u=>{let d=e.edge(u);d.points.forEach(f=>{f.x-=t,f.y-=s}),Object.hasOwn(d,"x")&&(d.x-=t),Object.hasOwn(d,"y")&&(d.y-=s)}),r.width=n-t+a,r.height=i-s+l}function Ode(e){e.edges().forEach(t=>{let n=e.edge(t),s=e.node(t.v),i=e.node(t.w),r,a;n.points?(r=n.points[0],a=n.points[n.points.length-1]):(n.points=[],r=i,a=s),n.points.unshift(HO(s,r)),n.points.push(HO(i,a))})}function Mde(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function Lde(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Dde(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),s=e.node(n.borderTop),i=e.node(n.borderBottom),r=e.node(n.borderLeft[n.borderLeft.length-1]),a=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-r.x),n.height=Math.abs(i.y-s.y),n.x=r.x+n.width/2,n.y=s.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function Pde(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Bde(e){bg(e).forEach(t=>{let n=0;t.forEach((s,i)=>{let r=e.node(s);r.order=i+n,(r.selfEdges||[]).forEach(a=>{th(e,"selfedge",{width:a.label.width,height:a.label.height,rank:r.rank,order:i+ ++n,e:a.e,label:a.label},"_se")}),delete r.selfEdges})})}function Ude(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let s=n,i=e.node(s.e.v),r=i.x+i.width/2,a=i.y,l=n.x-r,c=i.height/2;e.setEdge(s.e,s.label),e.removeNode(t),s.label.points=[{x:r+2*l/3,y:a-c},{x:r+5*l/6,y:a-c},{x:r+l,y:a},{x:r+5*l/6,y:a+c},{x:r+2*l/3,y:a+c}],s.label.x=n.x,s.label.y=n.y}})}function Xv(e,t){return S1(ax(e,t),Number)}function Qv(e){let t={};return e&&Object.entries(e).forEach(([n,s])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=s}),t}function Fde(e){let t=bg(e),n=new ia({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(s=>{n.setNode(s,{label:s}),n.setParent(s,"layer"+e.node(s).rank)}),e.edges().forEach(s=>n.setEdge(s.v,s.w,{},s.name)),t.forEach((s,i)=>{let r="layer"+i;n.setNode(r,{rank:"same"}),s.reduce((a,l)=>(n.setEdge(a,l,{style:"invis"}),l))}),n}var $de={graphlib:xU,version:Zce,layout:bde,debug:Fde,util:{time:jU,notime:RU}},JO=$de;/*! For license information please see dagre.esm.js.LEGAL.txt */const dp={llm:{label:"智能体",description:"理解任务并直接完成一个具体工作",icon:au},sequential:{label:"分步协作",description:"内部步骤按照顺序依次执行",icon:vB},parallel:{label:"同时处理",description:"内部步骤同时工作,完成后统一汇总",icon:pB},loop:{label:"循环执行",description:"重复执行内部步骤,直到满足停止条件",icon:Rk},a2a:{label:"远程智能体",description:"调用已经存在的远程 Agent",icon:n1}},F_=220,$_=88,eM=96,tM=34,$p=64,Zv=310,Od=24,VU=56,H_=40,nM=40,Hde=18,zde=58,Vde=!1,Gde=e=>e==="sequential"||e==="parallel"||e==="loop";function z_(e,t){const n=e.agentType??"llm";return Gde(n)||n==="llm"&&(t.length===0||e.subAgents.length>0)}function V_(e,t=[],n="horizontal",s=!1){const i=e.agentType??"llm";if(!z_(e,t))return{width:F_,height:$_};if(s&&e.subAgents.length===0)return{width:Zv,height:$p};const r=e.subAgents.map((f,h)=>V_(f,[...t,h],n,s)),a=r.length?Math.max(...r.map(f=>f.width)):0,l=r.length?Math.max(...r.map(f=>f.height)):0,c=r.length&&i!=="parallel"?VU:Od,u=n==="horizontal"?i!=="parallel":i==="parallel",d=r.length?i==="parallel"?Hde+nM:i==="loop"?zde:0:nM;return u?{width:Math.max(Zv,r.reduce((f,h)=>f+h.width,0)+H_*Math.max(0,r.length-1)+c*2),height:$p+Od+l+d+Od}:{width:Math.max(Zv,a+Od*2),height:$p+c+r.reduce((f,h)=>f+h.height,0)+H_*Math.max(0,r.length-1)+d+c}}function Fh(e){return e.length===0?"agent-root":`agent-${e.join("-")}`}function Kde(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}function sM(e){const t=n=>[n.agentType??"llm",n.subAgents.map(t)];return JSON.stringify(t(e))}function $h(e,t,n,s){const i=(s==null?void 0:s.tone)==="sequential"?"hsl(213 40% 40%)":(s==null?void 0:s.tone)==="loop"?"hsl(151 34% 34%)":"hsl(220 9% 38%)";return{id:`${e}-${t}${s!=null&&s.loop?"-loop":""}`,source:e,target:t,sourceHandle:s!=null&&s.loop?"loop-source":void 0,targetHandle:s!=null&&s.loop?"loop-target":void 0,label:n,type:"insertStep",data:s?{insert:s.insert,loop:s.loop,tone:s.tone}:void 0,animated:s==null?void 0:s.loop,markerEnd:{type:wf.ArrowClosed,width:16,height:16,color:i},style:{stroke:i,strokeWidth:1.5},labelStyle:{fill:"hsl(215 14% 42%)",fontSize:10,fontWeight:600},labelBgStyle:{fill:"hsl(var(--background))",fillOpacity:.92}}}function iM(e,t,n=!1){const s=[{id:"terminal-input",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:"用户请求"},selectable:!1,draggable:!1},{id:"terminal-output",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:"最终回复"},selectable:!1,draggable:!1}],i=[];function r(d,f,h,p,m){const b=d.agentType??"llm",v=Fh(f);return z_(d,f)?(a(d,f,h,p,m),v):(s.push({id:v,type:"agent",parentId:h,extent:"parent",position:p,data:{kind:"agent",path:f,agent:d,title:b==="a2a"?"远程智能体":d.name.trim()||(f.length===0?"主 Agent":"未命名步骤"),pattern:b,description:d.description.trim()||dp[b].description,childCount:d.subAgents.length,containedIn:m}}),v)}function a(d,f,h,p={x:0,y:0},m){const b=d.agentType??"sequential",v=Fh(f),y=V_(d,f,t,n);s.push({id:v,type:"group",parentId:h,extent:h?"parent":void 0,position:p,style:{width:y.width,height:y.height},data:{kind:"agent",path:f,agent:d,title:d.name.trim()||(f.length===0?"主 Agent":dp[b].label),pattern:b,description:d.description.trim()||dp[b].description,childCount:d.subAgents.length,containedIn:m,layoutWidth:y.width,layoutHeight:y.height,compactEmptyGroup:n&&d.subAgents.length===0}});const x=d.subAgents.map((k,T)=>V_(k,[...f,T],t,n)),E=x.length&&b!=="parallel"?VU:Od,w=t==="horizontal"?b!=="parallel":b==="parallel";let _=E;const S=d.subAgents.map((k,T)=>{const C=x[T],I=w?{x:_,y:$p+Od}:{x:(y.width-C.width)/2,y:$p+_};return _+=(w?C.width:C.height)+H_,r(k,[...f,T],v,I,b)});if(b==="sequential"||b==="loop"){for(let k=0;k1&&i.push($h(S[S.length-1],S[0],"继续循环",{loop:!0,tone:"loop"}))}return v}const l=(d,f)=>{const h=d.agentType??"llm",p=Fh(f);if(z_(d,f))return a(d,f),[p];if(s.push({id:p,type:"agent",position:{x:0,y:0},data:{kind:"agent",path:f,agent:d,title:h==="a2a"?"远程智能体":d.name.trim()||(f.length===0?"主 Agent":"未命名步骤"),pattern:h,description:d.description.trim()||dp[h].description,childCount:d.subAgents.length}}),d.subAgents.length===0)return[p];const m=[];return d.subAgents.forEach((b,v)=>{const y=[...f,v],x=Fh(y);i.push($h(p,x,"调用",{insert:{parentPath:f,index:v}})),m.push(...l(b,y))}),m},c=Fh([]),u=l(e,[]);return i.push($h("terminal-input",c)),u.forEach(d=>i.push($h(d,"terminal-output"))),qde(s,i,t)}function qde(e,t,n){const s=new JO.graphlib.Graph().setDefaultEdgeLabel(()=>({}));s.setGraph({rankdir:n==="vertical"?"TB":"LR",ranksep:50,nodesep:34,edgesep:14,marginx:24,marginy:24});const i=new Set(e.filter(r=>!r.parentId).map(r=>r.id));return e.filter(r=>!r.parentId).forEach(r=>{const a=r.data.kind==="terminal";s.setNode(r.id,{width:a?eM:r.data.layoutWidth??F_,height:a?tM:r.data.layoutHeight??$_})}),t.filter(r=>i.has(r.source)&&i.has(r.target)).forEach(r=>s.setEdge(r.source,r.target)),JO.layout(s),{nodes:e.map(r=>{if(r.parentId)return r;const a=s.node(r.id),l=r.data.kind==="terminal",c=l?eM:r.data.layoutWidth??F_,u=l?tM:r.data.layoutHeight??$_;return{...r,position:{x:a.x-c/2,y:a.y-u/2}}}),edges:t}}const N1=g.createContext(null),T1=g.createContext("horizontal");function Yde({id:e,sourceX:t,sourceY:n,targetX:s,targetY:i,sourcePosition:r,targetPosition:a,markerEnd:l,style:c,label:u,data:d}){const f=g.useContext(N1),[h,p]=g.useState(!1),[m,b,v]=nx({sourceX:t,sourceY:n,targetX:s,targetY:i,sourcePosition:r,targetPosition:a,offset:d!=null&&d.loop?28:20});return o.jsxs(o.Fragment,{children:[o.jsx(gg,{id:e,path:m,markerEnd:l,style:c}),f&&(d==null?void 0:d.insert)&&o.jsx("path",{d:m,className:"abc-edge-hover-path",onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1)}),(u||f&&(d==null?void 0:d.insert))&&o.jsx(zle,{children:o.jsxs("div",{className:`abc-edge-tools${f&&(d!=null&&d.insert)?" can-insert":""}${h?" is-visible":""}`,style:{transform:`translate(-50%, -50%) translate(${b}px, ${v}px)`},onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1),children:[u&&o.jsx("span",{className:"abc-edge-label",children:u}),f&&(d==null?void 0:d.insert)&&o.jsx("button",{type:"button",className:"abc-edge-add nodrag nopan","aria-label":"在这里插入步骤",title:"在这里插入步骤",onClick:y=>{y.stopPropagation(),f==null||f.onInsert(d.insert.parentPath,d.insert.index)},children:o.jsx(_i,{})})]})})]})}function Wde({data:e,selected:t}){const n=g.useContext(N1),s=g.useContext(T1),i=s==="vertical"?Xe.Top:Xe.Left,r=s==="vertical"?Xe.Bottom:Xe.Right,a=s==="vertical"?Xe.Right:Xe.Bottom,l=e.pattern??"llm",c=dp[l],u=c.icon;return o.jsxs("div",{className:`abc-node is-${l}${e.containedIn?` is-contained-in-${e.containedIn}`:""}${t?" is-selected":""}`,children:[o.jsx(Oi,{type:"target",position:i,className:"abc-handle"}),l!=="llm"&&o.jsx("span",{className:"abc-node-icon",children:o.jsx(u,{})}),o.jsxs("span",{className:"abc-node-copy",children:[o.jsx("span",{className:"abc-node-meta",children:o.jsx("span",{children:c.label})}),o.jsx("strong",{children:e.title}),o.jsx("small",{children:e.description})]}),n&&e.path!==void 0&&e.path.length>0&&o.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":`删除 ${e.title}`,title:"删除节点",onClick:d=>{d.stopPropagation(),n==null||n.onDelete(e.path)},children:o.jsx(sc,{})}),o.jsx(Oi,{type:"source",position:r,className:"abc-handle"}),e.containedIn==="loop"&&o.jsxs(o.Fragment,{children:[o.jsx(Oi,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),o.jsx(Oi,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function Xde({data:e,selected:t}){const n=g.useContext(N1),s=g.useContext(T1),i=s==="vertical"?Xe.Top:Xe.Left,r=s==="vertical"?Xe.Bottom:Xe.Right,a=s==="vertical"?Xe.Right:Xe.Bottom,l=e.pattern??"sequential",c=e.childCount??0,u=l==="llm"?"添加子 Agent":l==="parallel"?"添加一个同时处理的步骤":l==="loop"?"添加循环步骤":"添加下一个步骤";return o.jsxs("div",{className:`abc-group is-${l}${e.compactEmptyGroup?" is-compact-empty":""}${t?" is-selected":""}`,children:[o.jsx(Oi,{type:"target",position:i,className:"abc-handle"}),o.jsx("header",{className:"abc-group-head",children:o.jsxs("span",{children:[o.jsx("strong",{title:e.title,children:e.title}),o.jsx("small",{children:e.description})]})}),n&&e.path!==void 0&&c>0&&l!=="parallel"&&o.jsxs("div",{className:"abc-group-boundary-actions",children:[o.jsx("button",{type:"button",className:"abc-group-boundary-add is-start nodrag nopan","aria-label":"添加到最前",title:"添加到最前",onClick:d=>{d.stopPropagation(),n.onInsert(e.path,0)},children:o.jsx(_i,{})}),o.jsx("button",{type:"button",className:"abc-group-boundary-add is-end nodrag nopan","aria-label":"添加到最后",title:"添加到最后",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:o.jsx(_i,{})})]}),n&&e.path!==void 0&&c>0&&l==="parallel"&&o.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-bottom nodrag nopan",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:[o.jsx(_i,{}),o.jsx("span",{children:u})]}),n&&e.path!==void 0&&c===0&&o.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-empty nodrag nopan",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:[o.jsx(_i,{}),o.jsx("span",{children:u})]}),n&&e.path!==void 0&&e.path.length>0&&o.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":`删除 ${e.title}`,title:"删除节点",onClick:d=>{d.stopPropagation(),n==null||n.onDelete(e.path)},children:o.jsx(sc,{})}),o.jsx(Oi,{type:"source",position:r,className:"abc-handle"}),e.containedIn==="loop"&&o.jsxs(o.Fragment,{children:[o.jsx(Oi,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),o.jsx(Oi,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function Qde({data:e}){const t=g.useContext(T1);return o.jsxs("div",{className:"abc-terminal",children:[o.jsx(Oi,{type:"target",position:t==="vertical"?Xe.Top:Xe.Left,className:"abc-handle"}),o.jsx("span",{children:e.title}),o.jsx(Oi,{type:"source",position:t==="vertical"?Xe.Bottom:Xe.Right,className:"abc-handle"})]})}const Zde={agent:Wde,group:Xde,terminal:Qde},Jde={insertStep:Yde};function efe({draft:e,selectedPath:t,onSelect:n,onAdd:s,onInsert:i,onDelete:r,readOnly:a=!1,interactivePreview:l=!1,direction:c="horizontal"}){const u=g.useMemo(()=>iM(e,c,a),[]),[d,f,h]=dU(u.nodes),[p,m,b]=fU(u.edges),v=Gle(),y=g.useRef(`${c}:${a?"readonly":"editable"}:${sM(e)}`),x=g.useRef(null),{fitView:E}=v1(),w=g.useMemo(()=>iM(e,c,a),[c,e,a]),[_,S]=g.useState(()=>window.matchMedia("(max-width: 860px)").matches),k=g.useMemo(()=>a?{padding:.16,minZoom:.05,maxZoom:.9}:_?{padding:.08,minZoom:.35,maxZoom:.9}:{padding:.14,minZoom:.42,maxZoom:1.1},[_,a]),T=g.useCallback((I=0)=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const j=x.current;if(j&&(j.clientWidth===0||j.clientHeight===0)&&I<8){T(I+1);return}E(k)})})},[k,E]);g.useEffect(()=>{const I=window.matchMedia("(max-width: 860px)"),j=L=>S(L.matches);return I.addEventListener("change",j),()=>I.removeEventListener("change",j)},[]),g.useEffect(()=>{const I=`${c}:${a?"readonly":"editable"}:${sM(e)}`,j=I!==y.current;y.current=I,m(w.edges),f(L=>{const z=new Map(L.map(D=>[D.id,D]));return w.nodes.map(D=>{const F=z.get(D.id);return{...D,measured:!j&&F&&F.type===D.type?F.measured:void 0,position:!j&&F?F.position:D.position,selected:D.data.kind==="agent"&&!!D.data.path&&Kde(D.data.path,t)}})}),j&&T()},[w,e,T,t,m,f]),g.useEffect(()=>{T()},[_,T]),g.useEffect(()=>{v&&T()},[w,T,v]),g.useEffect(()=>{if(!a||!x.current)return;const I=new ResizeObserver(()=>T());return I.observe(x.current),T(),()=>I.disconnect()},[T,a]);const C=g.useMemo(()=>a?null:{onAdd:s,onInsert:i,onDelete:r},[s,r,i,a]);return o.jsx(T1.Provider,{value:c,children:o.jsx(N1.Provider,{value:C,children:o.jsx("section",{className:`abc-root is-${c}${a?" is-readonly":""}`,"aria-label":a?"只读 Agent 执行画布":"Agent 执行画布",children:o.jsx("div",{ref:x,className:"abc-canvas",children:o.jsxs(uU,{nodes:d,edges:p,nodeTypes:Zde,edgeTypes:Jde,onNodesChange:h,onEdgesChange:b,onNodeClick:(I,j)=>{!a&&j.data.kind==="agent"&&j.data.path&&n(j.data.path)},nodesDraggable:!a,nodesConnectable:!1,nodesFocusable:!a,elementsSelectable:!a,edgesFocusable:!1,edgesReconnectable:!1,panOnDrag:!a||l,zoomOnDoubleClick:l,zoomOnPinch:!a||l,zoomOnScroll:!a||l,fitView:!0,fitViewOptions:k,onInit:()=>T(),minZoom:a?.05:.35,maxZoom:1.6,proOptions:{hideAttribution:!0},children:[o.jsx(pU,{gap:20,size:1.2,color:"hsl(34 20% 82%)"}),(!a||l)&&o.jsx(gU,{showInteractive:!1}),Vde]})})})})})}function Om(e){return o.jsx(hA,{children:o.jsx(efe,{...e})})}const tfe="https://ark.cn-beijing.volces.com/api/v3/",zb=[{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:tfe}],Cf=[],rM={label:"控制台",url:"https://console.volcengine.com/vikingdb/openviking"},nfe={label:"文档",url:"https://github.com/volcengine/OpenViking/blob/main/docs/zh/api/05-sessions.md"},sfe="https://api.vikingdb.cn-beijing.volces.com/openviking",ife=`{ "self": {"enabled": true}, "peer": {"enabled": true}, "working_memory": {"enabled": true}, "memory_types": null -}`,zh=[{key:"FEISHU_APP_ID",required:!0,placeholder:"cli_xxx",comment:"飞书应用 App ID"},{key:"FEISHU_APP_SECRET",required:!0,placeholder:"输入 App Secret",comment:"飞书应用 App Secret"}],Ta={topK:"3",region:"cn-beijing",endpoint:"https://open.volcengineapi.com/"},$U=[{key:"REGISTRY_SPACE_ID",required:!0,placeholder:"请选择智能体中心",comment:"AgentKit 智能体中心"},{key:"REGISTRY_TOP_K",required:!1,placeholder:Ta.topK,comment:"召回 Agent 数量"},{key:"REGISTRY_REGION",required:!1,placeholder:Ta.region,comment:"AgentKit 智能体中心地域"},{key:"REGISTRY_ENDPOINT",required:!1,placeholder:Ta.endpoint,comment:"AgentKit 智能体中心 OpenAPI 地址"}],_u=[{id:"web_search",label:"联网搜索",desc:"火山引擎 Web Search,获取实时信息。",importLine:"from veadk.tools.builtin_tools.web_search import web_search",toolNames:["web_search"],env:kf},{id:"parallel_web_search",label:"并行联网搜索",desc:"并行发起多条搜索查询,更快汇总。",importLine:"from veadk.tools.builtin_tools.parallel_web_search import parallel_web_search",toolNames:["parallel_web_search"],env:kf},{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:"run_code",label:"代码执行",desc:"在沙箱中执行代码",importLine:"from veadk.tools.builtin_tools.run_code import run_code",toolNames:["run_code"],env:[{key:"AGENTKIT_TOOL_ID",required:!0,placeholder:"t-xxxx",comment:"代码执行沙箱 ID"},{key:"AGENTKIT_TOOL_REGION",required:!1,placeholder:"cn-beijing",comment:"AgentKit Tools 地域"}]},{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"}]}],tfe=new Set(["web_scraper","text_to_speech","vesearch"]),HU=_u.filter(e=>!tfe.has(e.id)),$_=[{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}]}],H_=[{id:"local",label:"本地向量库",desc:"进程内 llama-index 向量库。",env:$b,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},...$b],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},...$b],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",label:"VikingDB Memory",desc:"火山 VikingDB 记忆库(支持用户画像)。",env:kf},{id:"openviking",label:"OpenViking Memory",desc:"OpenViking 长期记忆,按用户维度保存和检索偏好、事件与实体。",env:[{key:"DATABASE_OPENVIKING_URL",required:!0,placeholder:Jde,comment:"OpenViking 服务地址",link:tM},{key:"DATABASE_OPENVIKING_API_KEY",required:!0,comment:"OpenViking API Key",link:tM},{key:"DATABASE_OPENVIKING_USER_ID",required:!1,placeholder:"default",comment:"记忆归属 ID",help:"对应 viking://user/<此值>/peers/<请求用户>/memories 中的 user 段;用于隔离 Agent、租户或业务场景,默认 default。"},{key:"DATABASE_OPENVIKING_MEMORY_POLICY",required:!1,placeholder:efe,comment:"记忆策略",multiline:!0,format:"json",help:"记忆的抽取策略和隔离策略,不填写时使用官方默认策略。",link:Zde}]},{id:"mem0",label:"Mem0",desc:"Mem0 托管记忆服务。",env:[{key:"DATABASE_MEM0_API_KEY",required:!0},{key:"DATABASE_MEM0_BASE_URL",required:!1}],pipExtra:"database"}],fu="viking",z_=[{id:"viking",label:"VikingDB Knowledge",desc:"火山 VikingDB 知识库。",env:kf},{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},...$b],pipExtra:"extensions",needsEmbedding:!0},{id:"context_search",label:"Context Search",desc:"火山 Context Search 引擎(无需向量化)。",env:[...kf,{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ID",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ENDPOINT",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_APIKEY",required:!0}]}],nfe=[{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:[...kf,{key:"OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME",required:!1,comment:"TLS topic_id,留空自动创建"}]}],sfe="doubao-seed-2-1-pro-260628",ife="一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",rfe=`你是一个专业、可靠的智能助手。 +}`,Hh=[{key:"FEISHU_APP_ID",required:!0,placeholder:"cli_xxx",comment:"飞书应用 App ID"},{key:"FEISHU_APP_SECRET",required:!0,placeholder:"输入 App Secret",comment:"飞书应用 App Secret"}],Na={topK:"3",region:"cn-beijing",endpoint:"https://open.volcengineapi.com/"},GU=[{key:"REGISTRY_SPACE_ID",required:!0,placeholder:"请选择智能体中心",comment:"AgentKit 智能体中心"},{key:"REGISTRY_TOP_K",required:!1,placeholder:Na.topK,comment:"召回 Agent 数量"},{key:"REGISTRY_REGION",required:!1,placeholder:Na.region,comment:"AgentKit 智能体中心地域"},{key:"REGISTRY_ENDPOINT",required:!1,placeholder:Na.endpoint,comment:"AgentKit 智能体中心 OpenAPI 地址"}],Nu=[{id:"web_search",label:"联网搜索",desc:"火山引擎 Web Search,获取实时信息。",importLine:"from veadk.tools.builtin_tools.web_search import web_search",toolNames:["web_search"],env:Cf},{id:"parallel_web_search",label:"并行联网搜索",desc:"并行发起多条搜索查询,更快汇总。",importLine:"from veadk.tools.builtin_tools.parallel_web_search import parallel_web_search",toolNames:["parallel_web_search"],env:Cf},{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:"run_code",label:"代码执行",desc:"在沙箱中执行代码",importLine:"from veadk.tools.builtin_tools.run_code import run_code",toolNames:["run_code"],env:[{key:"AGENTKIT_TOOL_ID",required:!0,placeholder:"t-xxxx",comment:"代码执行沙箱 ID"},{key:"AGENTKIT_TOOL_REGION",required:!1,placeholder:"cn-beijing",comment:"AgentKit Tools 地域"}]},{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"}]}],rfe=new Set(["web_scraper","text_to_speech","vesearch"]),KU=Nu.filter(e=>!rfe.has(e.id)),G_=[{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}]}],K_=[{id:"local",label:"本地向量库",desc:"进程内 llama-index 向量库。",env:zb,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},...zb],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},...zb],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",label:"VikingDB Memory",desc:"火山 VikingDB 记忆库(支持用户画像)。",env:Cf},{id:"openviking",label:"OpenViking Memory",desc:"OpenViking 长期记忆,按用户维度保存和检索偏好、事件与实体。",env:[{key:"DATABASE_OPENVIKING_URL",required:!0,placeholder:sfe,comment:"OpenViking 服务地址",link:rM},{key:"DATABASE_OPENVIKING_API_KEY",required:!0,comment:"OpenViking API Key",link:rM},{key:"DATABASE_OPENVIKING_USER_ID",required:!1,placeholder:"default",comment:"记忆归属 ID",help:"对应 viking://user/<此值>/peers/<请求用户>/memories 中的 user 段;用于隔离 Agent、租户或业务场景,默认 default。"},{key:"DATABASE_OPENVIKING_MEMORY_POLICY",required:!1,placeholder:ife,comment:"记忆策略",multiline:!0,format:"json",help:"记忆的抽取策略和隔离策略,不填写时使用官方默认策略。",link:nfe}]},{id:"mem0",label:"Mem0",desc:"Mem0 托管记忆服务。",env:[{key:"DATABASE_MEM0_API_KEY",required:!0},{key:"DATABASE_MEM0_BASE_URL",required:!1}],pipExtra:"database"}],hu="viking",q_=[{id:"viking",label:"VikingDB Knowledge",desc:"火山 VikingDB 知识库。",env:Cf},{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},...zb],pipExtra:"extensions",needsEmbedding:!0},{id:"context_search",label:"Context Search",desc:"火山 Context Search 引擎(无需向量化)。",env:[...Cf,{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ID",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ENDPOINT",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_APIKEY",required:!0}]}],afe=[{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:[...Cf,{key:"OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME",required:!1,comment:"TLS topic_id,留空自动创建"}]}],ofe="doubao-seed-2-1-pro-260628",lfe="一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",cfe=`你是一个专业、可靠的智能助手。 你的目标是准确理解用户的需求,并给出条理清晰、简洁有用的回答。 约束: - 信息不足时主动提问澄清,不要臆造事实。 - 需要时合理调用可用的工具,并说明关键结论。 -- 保持礼貌、专业的语气。`;function wi(){return{name:"",description:ife,instruction:rfe,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:sfe,modelProvider:"",modelApiBase:"",shortTermBackend:"local",longTermBackend:"local",autoSaveSession:!1,knowledgebaseBackend:fu,knowledgebaseIndex:"",tracingExporters:[],selectedSkills:[],deployment:{feishuEnabled:!1}}}async function xg(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Un(void 0,rc)});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 zU(){return(await xg("/web/skill-spaces?region=all")).items||[]}async function afe(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),xg(`/web/skill-spaces?${t.toString()}`)}async function VU(e,t){const n=t?`?region=${encodeURIComponent(t)}`:"";return(await xg(`/web/skill-spaces/${encodeURIComponent(e)}/skills${n}`)).items||[]}async function ofe(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),xg(`/web/skill-spaces/${encodeURIComponent(e)}/skills?${n.toString()}`)}async function lfe(e,t,n,s,i){const r=[];n&&r.push(`version=${encodeURIComponent(n)}`),s&&r.push(`region=${encodeURIComponent(s)}`),i&&r.push(`project=${encodeURIComponent(i)}`);const a=r.length>0?`?${r.join("&")}`:"";return xg(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${a}`)}function cfe(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 ufe(e,t){return`https://console.volcengine.com/agentkit/${(t||"cn-beijing")==="cn-beijing"?"cn":"cn-shanghai"}/skillspace/detail/${encodeURIComponent(e)}`}function nM({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M4.5 6.7h4.2M12.3 6.7h7.2"}),o.jsx("path",{d:"M4.5 12h8.2M16.3 12h3.2"}),o.jsx("path",{d:"M4.5 17.3h2.7M10.8 17.3h8.7"}),o.jsx("circle",{cx:"10.5",cy:"6.7",r:"1.8",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"14.5",cy:"12",r:"1.8",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"9",cy:"17.3",r:"1.8",fill:"currentColor",stroke:"none"})]})}const dfe={coding:"智能编程",get_city_weather:"城市天气查询",get_location_weather:"位置天气查询",web_fetch:"网页内容获取"};function V_(e){const t=_u.find(n=>n.id===e||n.toolNames.includes(e));return dfe[e]??(t==null?void 0:t.label)??e}function sM(e){const t=_u.find(s=>s.id===e||s.toolNames.includes(e));return((t==null?void 0:t.desc)??"由 VeADK 提供的内置工具").replace(/[。.]+$/,"")}function ffe(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m7 7 10 10M17 7 7 17",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function hfe(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"5.8",stroke:"currentColor",strokeWidth:"1.7"}),o.jsx("path",{d:"m15.2 15.2 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function iM(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"M12 5.5v13M5.5 12h13",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function GU({title:e,description:t,icon:n,wide:s=!1,onClose:i,children:r}){const a=g.useRef(`session-capability-${Math.random().toString(36).slice(2)}`);return g.useEffect(()=>{const l=document.body.style.overflow;document.body.style.overflow="hidden";const c=u=>{u.key==="Escape"&&i()};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c),document.body.style.overflow=l}},[i]),hi.createPortal(o.jsxs("div",{className:"session-capability-dialog-layer",children:[o.jsx("button",{type:"button",className:"session-capability-dialog-scrim","aria-label":"关闭弹窗",onClick:i}),o.jsxs("section",{className:`session-capability-dialog${s?" is-wide":""}`,role:"dialog","aria-modal":"true","aria-labelledby":a.current,children:[o.jsxs("header",{className:`session-capability-dialog-head${n?"":" is-iconless"}`,children:[n&&o.jsx("span",{className:"session-capability-dialog-mark",children:n}),o.jsxs("div",{children:[o.jsx("h2",{id:a.current,children:e}),o.jsx("p",{children:t})]}),o.jsx("button",{type:"button",className:"session-capability-dialog-close","aria-label":`关闭${e}`,onClick:i,children:o.jsx(ffe,{})})]}),r]})]}),document.body)}function Hb({value:e,placeholder:t,label:n,onChange:s,autoFocus:i=!1}){return o.jsxs("label",{className:"session-capability-search",children:[o.jsx(hfe,{}),o.jsx("input",{value:e,"aria-label":n,placeholder:t,autoFocus:i,onChange:r=>s(r.target.value)})]})}function pfe({agentName:e,tools:t,selectedNames:n,mutating:s,onAdd:i,onClose:r}){const[a,l]=g.useState(""),[c,u]=g.useState(""),d=g.useMemo(()=>new Set(n),[n]),f=g.useMemo(()=>{const p=a.trim().toLowerCase();return t.filter(m=>p?`${V_(m)} ${m} ${sM(m)}`.toLowerCase().includes(p):!0)},[a,t]),h=async p=>{u(p);const m=await i({kind:"tool",name:p});u(""),m&&r()};return o.jsx(GU,{title:"添加内置工具",description:`添加后仅对 ${e} 的当前会话生效`,icon:o.jsx(nM,{}),onClose:r,children:o.jsxs("div",{className:"session-tool-dialog-body",children:[o.jsx(Hb,{value:a,label:"搜索内置工具",placeholder:"搜索中文名称或工具标识",onChange:l,autoFocus:!0}),o.jsx("div",{className:"session-tool-picker",role:"list","aria-label":"可用内置工具",children:f.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的内置工具"}):f.map(p=>{const m=d.has(p),b=c===p;return o.jsxs("article",{className:"session-tool-option",role:"listitem",children:[o.jsx("span",{className:"session-tool-option-icon",children:o.jsx(nM,{})}),o.jsxs("span",{className:"session-tool-option-copy",children:[o.jsx("strong",{children:V_(p)}),o.jsx("code",{children:p}),o.jsx("span",{children:sM(p)})]}),o.jsx("button",{type:"button",disabled:m||s||!!c,onClick:()=>void h(p),children:m?"已添加":b?"添加中…":"添加"})]},p)})})]})})}function mfe({appName:e,agentName:t,selectedNames:n,mutating:s,onAdd:i,onClose:r}){const[a,l]=g.useState("public"),[c,u]=g.useState(""),[d,f]=g.useState([]),[h,p]=g.useState(0),[m,b]=g.useState(!0),[v,y]=g.useState(""),[x,E]=g.useState([]),[w,_]=g.useState(null),[S,k]=g.useState([]),[T,C]=g.useState(""),[I,j]=g.useState(""),[L,z]=g.useState(!0),[D,F]=g.useState(!1),[A,O]=g.useState(""),[P,$]=g.useState(""),R=g.useMemo(()=>new Set(n),[n]);g.useEffect(()=>{if(a!=="public")return;let K=!0;const V=window.setTimeout(()=>{b(!0),y(""),GB(e,c.trim()).then(W=>{K&&(f(W.items),p(W.totalCount))}).catch(W=>{K&&(f([]),p(0),y(W instanceof Error?W.message:"搜索 Skill Hub 失败"))}).finally(()=>{K&&b(!1)})},250);return()=>{K=!1,window.clearTimeout(V)}},[e,c,a]),g.useEffect(()=>{if(a!=="agentkit")return;let K=!0;return z(!0),O(""),zU().then(V=>{K&&(E(V),_(V[0]??null))}).catch(V=>{K&&O(V instanceof Error?V.message:"读取 Skill Space 失败")}).finally(()=>{K&&z(!1)}),()=>{K=!1}},[a]),g.useEffect(()=>{if(a!=="agentkit")return;if(!w){k([]);return}let K=!0;return F(!0),O(""),VU(w.id,w.region).then(V=>{K&&k(V)}).catch(V=>{K&&O(V instanceof Error?V.message:"读取技能失败")}).finally(()=>{K&&F(!1)}),()=>{K=!1}},[w,a]);const Y=g.useMemo(()=>{const K=T.trim().toLowerCase();return K?x.filter(V=>`${V.name} ${V.id} ${V.description}`.toLowerCase().includes(K)):x},[T,x]),J=g.useMemo(()=>{const K=I.trim().toLowerCase();return K?S.filter(V=>`${V.skillName} ${V.skillDescription}`.toLowerCase().includes(K)):S},[I,S]),U=async K=>{if(!w)return;$(K.skillId);const V=await i({kind:"skill",name:K.skillName,skillSourceId:w.id,description:K.skillDescription,version:K.version});$(""),V&&r()},te=async K=>{$(K.slug);const V=await i({kind:"skill",name:K.name,skillSourceId:`findskill:${K.slug}`,description:K.description,version:K.version||K.updatedAt});$(""),V&&r()};return o.jsx(GU,{title:"添加技能",description:`从公域 Skill Hub 或 AgentKit Skill 中心添加到 ${t} 当前会话`,wide:!0,onClose:r,children:o.jsxs("div",{className:"session-skill-dialog-body",children:[o.jsxs("div",{className:"session-skill-source-tabs",role:"tablist","aria-label":"技能来源",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":a==="public",className:a==="public"?"is-active":"",onClick:()=>l("public"),children:["Skill Hub",o.jsx("span",{children:"公域"})]}),o.jsx("button",{type:"button",role:"tab","aria-selected":a==="agentkit",className:a==="agentkit"?"is-active":"",onClick:()=>l("agentkit"),children:"AgentKit Skill 中心"})]}),a==="public"?o.jsxs("section",{className:"session-public-skill-browser","aria-label":"Skill Hub 公域技能",children:[o.jsxs("div",{className:"session-public-skill-head",children:[o.jsx(Hb,{value:c,label:"搜索 Skill Hub",placeholder:"搜索技能名称、用途或关键词",onChange:u,autoFocus:!0}),o.jsxs("span",{children:[h.toLocaleString()," 个公域技能"]})]}),o.jsx("div",{className:"session-public-skill-list",children:v?o.jsx("div",{className:"session-capability-error",children:v}):m?o.jsx("div",{className:"session-capability-loading",children:"正在搜索 Skill Hub…"}):d.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的公域技能"}):d.map(K=>{const V=R.has(K.name),W=P===K.slug;return o.jsxs("article",{className:"session-skill-option session-public-skill-option",children:[o.jsxs("span",{className:"session-skill-option-copy",children:[o.jsx("strong",{children:K.name}),o.jsx("span",{children:K.description||"暂无描述"}),o.jsxs("small",{children:[K.sourceRepo||K.sourceType||"FindSkill",o.jsx("span",{"aria-hidden":"true",children:" · "}),K.downloadCount.toLocaleString()," 次下载",K.evaluationScore>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{"aria-hidden":"true",children:" · "}),K.evaluationScore.toFixed(1)," 分"]})]})]}),o.jsx("button",{type:"button",disabled:V||s||!!P,onClick:()=>void te(K),children:V?"已添加":W?"添加中…":o.jsxs(o.Fragment,{children:[o.jsx(iM,{}),"添加"]})})]},K.slug)})})]}):o.jsxs("div",{className:"session-skill-browser",children:[o.jsxs("section",{className:"session-skill-spaces","aria-label":"Skill Space 列表",children:[o.jsxs("div",{className:"session-skill-pane-head",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"Skill Space"}),o.jsx("span",{children:x.length})]}),o.jsx(Hb,{value:T,label:"搜索 Skill Space",placeholder:"搜索空间",onChange:C,autoFocus:!0})]}),o.jsx("div",{className:"session-skill-pane-list",children:L?o.jsx("div",{className:"session-capability-loading",children:"正在读取 Skill Space…"}):Y.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的 Skill Space"}):Y.map(K=>o.jsx("button",{type:"button",className:`session-skill-space${(w==null?void 0:w.id)===K.id?" is-active":""}`,onClick:()=>{_(K),j("")},children:o.jsxs("span",{children:[o.jsx("strong",{children:K.name||K.id}),o.jsx("small",{children:K.description||K.id}),o.jsxs("em",{children:[K.skillCount??0," 个技能"]})]})},`${K.projectName??"default"}:${K.id}`))})]}),o.jsxs("section",{className:"session-skill-results","aria-label":"AgentKit Skill 列表",children:[o.jsxs("div",{className:"session-skill-pane-head",children:[o.jsxs("div",{children:[o.jsx("strong",{title:w==null?void 0:w.name,children:(w==null?void 0:w.name)||"选择 Skill Space"}),o.jsx("span",{children:S.length})]}),o.jsx(Hb,{value:I,label:"搜索 AgentKit 技能",placeholder:"搜索技能名称或描述",onChange:j})]}),o.jsx("div",{className:"session-skill-pane-list",children:A?o.jsx("div",{className:"session-capability-error",children:A}):w?D?o.jsx("div",{className:"session-capability-loading",children:"正在读取技能…"}):J.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的技能"}):J.map(K=>{const V=R.has(K.skillName),W=P===K.skillId;return o.jsxs("article",{className:"session-skill-option",children:[o.jsxs("span",{className:"session-skill-option-copy",children:[o.jsx("strong",{children:K.skillName}),o.jsx("span",{children:K.skillDescription||"暂无描述"}),o.jsxs("small",{children:["版本 ",K.version||"—"]})]}),o.jsx("button",{type:"button",disabled:V||s||!!P,onClick:()=>void U(K),children:V?"已添加":W?"添加中…":o.jsxs(o.Fragment,{children:[o.jsx(iM,{}),"添加"]})})]},`${K.skillId}:${K.version}`)}):o.jsx("div",{className:"session-capability-empty",children:"选择一个 Skill Space 查看技能"})})]})]})]})})}function ka({as:e="span",className:t="",duration:n=4,spread:s=20,children:i,style:r,...a}){const l=Math.min(Math.max(s,5),45);return o.jsx(e,{className:`text-shimmer${t?` ${t}`:""}`,style:{...r,backgroundImage:`linear-gradient(to right, hsl(var(--muted-foreground)) ${50-l}%, hsl(var(--foreground)) 50%, hsl(var(--muted-foreground)) ${50+l}%)`,animationDuration:`${n}s`},...a,children:i})}function KU(e){return 1+e.children.reduce((t,n)=>t+KU(n),0)}function qU(e){return e.id||e.name}function gfe(e,t){const n=qU(e);if(e.id&&e.name&&e.name!==n)return e.name;if(t&&n==="agent")return"主 Agent";const s=/^agent_sub_(\d+)$/.exec(n);return s?`子 Agent ${s[1]}`:e.name||n}function YU(e,t=!0){return{...e,id:qU(e),name:gfe(e,t),children:e.children.map(n=>YU(n,!1))}}function WU(e){const t=wi();return{...t,name:e.name,description:e.description,instruction:e.instruction||t.instruction,agentType:e.type,modelName:e.model,tools:e.tools??[],skills:(e.skills??[]).map(n=>n.name),subAgents:e.children.map(WU)}}function bfe(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}function yfe(e){return[...new Map(e.filter(t=>t.name.trim()).map(t=>[t.name.trim(),{...t,name:t.name.trim()}])).values()]}function Xv({title:e,count:t}){return o.jsxs("div",{className:"topo-module-title",children:[o.jsx("span",{className:"topo-module-label",title:e,children:e}),t!==void 0&&o.jsx("span",{className:"topo-section-count","aria-label":`${t} 项`,children:t})]})}function xfe({appName:e,info:t,loading:n,variant:s="rail",capabilities:i=null,capabilityLoading:r=!1,capabilityMutating:a=!1,builtinTools:l=[],onAddCapability:c,onRemoveCapability:u}){const[d,f]=g.useState(null),[h,p]=g.useState(!1),m=g.useRef(null),b=()=>{p(!1),window.requestAnimationFrame(()=>{var S;return(S=m.current)==null?void 0:S.focus()})};if(g.useEffect(()=>{if(!h)return;const S=document.body.style.overflow,k=T=>{T.key==="Escape"&&b()};return document.body.style.overflow="hidden",document.addEventListener("keydown",k),()=>{document.body.style.overflow=S,document.removeEventListener("keydown",k)}},[h]),n&&!t)return o.jsx("aside",{className:`topo is-loading${s==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息","aria-live":"polite",children:o.jsx(ka,{as:"span",className:"topo-loading-label",duration:2.2,children:"正在读取 Agent 信息…"})});if(!t)return null;const v=YU(t.graph??{id:t.name,name:t.name,description:t.description,type:t.type??"llm",model:t.model,tools:t.tools,skills:t.skills,path:[t.name],mentionable:!1,children:[]}),y=(i==null?void 0:i.tools)??bfe(t.tools).map(S=>({id:`base:tool:${S}`,kind:"tool",name:S,custom:!1})),x=(i==null?void 0:i.skills)??yfe(t.skills).map(S=>({id:`base:skill:${S.name}`,kind:"skill",name:S.name,description:S.description,custom:!1})),E=!!(i&&c&&u),w=WU(v),_=S=>o.jsx(Mm,{draft:w,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},S);return o.jsxs(o.Fragment,{children:[o.jsxs("aside",{className:`topo${s==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息与拓扑",children:[o.jsxs("section",{className:"topo-agent-card","aria-label":"Agent 信息",children:[o.jsxs("div",{className:"topo-agent-heading",children:[o.jsx("h2",{title:t.name,children:t.name||"未命名 Agent"}),t.model&&o.jsx("span",{title:t.model,children:t.model})]}),t.description&&o.jsx("p",{className:"topo-description",title:t.description,children:t.description})]}),o.jsxs("div",{className:"topo-module-stack",children:[o.jsxs("section",{className:"topo-module-card topo-tools-card","aria-label":"工具",children:[o.jsx(Xv,{title:"工具",count:y.length}),o.jsx("div",{className:"topo-module-scroll topo-tools-scroll",role:"region","aria-label":"工具列表",tabIndex:0,children:y.length>0?o.jsx("div",{className:"topo-tool-list",children:y.map(S=>o.jsxs("div",{className:"topo-tool",title:S.name,children:[o.jsxs("span",{className:"topo-capability-title",children:[o.jsxs("span",{className:"topo-capability-copy",children:[o.jsx("span",{className:"topo-capability-name",children:V_(S.name)}),o.jsx("code",{children:S.name})]}),S.custom&&o.jsx("span",{className:"topo-custom-badge",children:"自定义"})]}),S.custom&&o.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除工具 ${S.name}`,title:"移除",disabled:a,onClick:()=>u==null?void 0:u(S.id),children:"×"})]},S.id))}):o.jsx("div",{className:"topo-empty",children:"未配置"})}),E&&o.jsx("div",{className:"topo-capability-add-dock",children:o.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加内置工具",disabled:r||a,onClick:()=>f("tool"),children:[o.jsx("span",{"aria-hidden":"true",children:"+"}),o.jsx("span",{children:"在此对话中添加工具"})]})})]}),o.jsxs("section",{className:"topo-module-card topo-skills-card","aria-label":"技能",children:[o.jsx(Xv,{title:"技能",count:t.skillsPreviewSupported?x.length:void 0}),o.jsx("div",{className:"topo-module-scroll topo-skills-scroll",role:"region","aria-label":"技能列表",tabIndex:0,children:t.skillsPreviewSupported?x.length>0?o.jsx("div",{className:"topo-skill-list",children:x.map(S=>o.jsxs("div",{className:"topo-skill",title:S.description||S.name,children:[o.jsxs("div",{className:"topo-skill-title",children:[o.jsx("span",{className:"topo-skill-name",children:S.name}),S.custom&&o.jsx("span",{className:"topo-custom-badge",children:"自定义"}),S.custom&&o.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除技能 ${S.name}`,title:"移除",disabled:a,onClick:()=>u==null?void 0:u(S.id),children:"×"})]}),S.description&&o.jsx("span",{className:"topo-skill-description",children:S.description})]},`${S.name}:${S.description}`))}):o.jsx("div",{className:"topo-empty",children:"未配置"}):o.jsx("div",{className:"topo-empty",children:"暂不支持预览"})}),E&&o.jsx("div",{className:"topo-capability-add-dock",children:o.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加技能",disabled:r||a,onClick:()=>f("skill"),children:[o.jsx("span",{"aria-hidden":"true",children:"+"}),o.jsx("span",{children:"在此对话中添加技能"})]})})]}),o.jsxs("section",{className:"topo-module-card topo-topology","aria-label":"Agent 画布",children:[o.jsxs("div",{className:"topo-canvas-heading",children:[o.jsx(Xv,{title:"结构拓扑",count:KU(v)}),o.jsx("button",{ref:m,type:"button",className:"topo-canvas-expand","aria-label":"全屏查看 Agent 画布",title:"全屏查看",onClick:()=>p(!0),children:o.jsx(qc,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-preview",role:"region","aria-label":"Agent 执行画布",children:_(`conversation-canvas:${e}`)})]})]}),d==="tool"&&c&&o.jsx(pfe,{agentName:t.name,tools:l,selectedNames:y.map(S=>S.name),mutating:a,onAdd:c,onClose:()=>f(null)}),d==="skill"&&c&&o.jsx(mfe,{appName:e,agentName:t.name,selectedNames:x.map(S=>S.name),mutating:a,onAdd:c,onClose:()=>f(null)})]}),h&&hi.createPortal(o.jsxs("section",{className:"topo-canvas-dialog",role:"dialog","aria-modal":"true","aria-label":"全屏 Agent 执行画布",children:[o.jsxs("header",{className:"topo-canvas-dialog-header",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"Agent 执行画布"}),o.jsx("span",{children:t.name})]}),o.jsx("button",{type:"button","aria-label":"关闭全屏画布",title:"关闭",onClick:b,autoFocus:!0,children:o.jsx(Ti,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-dialog-body",children:_(`conversation-canvas-fullscreen:${e}`)})]}),document.body)]})}function fMe(){}function rM(e){const t=[],n=String(e||"");let s=n.indexOf(","),i=0,r=!1;for(;!r;){s===-1&&(s=n.length,r=!0);const a=n.slice(i,s).trim();(a||!r)&&t.push(a),i=s+1,s=n.indexOf(",",i)}return t}function XU(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Efe=/[$_\p{ID_Start}]/u,vfe=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,wfe=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,Sfe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_fe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,QU={};function hMe(e){return e?Efe.test(String.fromCodePoint(e)):!1}function pMe(e,t){const s=(t||QU).jsx?wfe:vfe;return e?s.test(String.fromCodePoint(e)):!1}function aM(e,t){return(QU.jsx?_fe:Sfe).test(e)}const Nfe=/[ \t\n\f\r]/g;function Tfe(e){return typeof e=="object"?e.type==="text"?oM(e.value):!1:oM(e)}function oM(e){return e.replace(Nfe,"")===""}let Eg=class{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}};Eg.prototype.normal={};Eg.prototype.property={};Eg.prototype.space=void 0;function ZU(e,t){const n={},s={};for(const i of e)Object.assign(n,i.property),Object.assign(s,i.normal);return new Eg(n,s,t)}function Lm(e){return e.toLowerCase()}class fr{constructor(t,n){this.attribute=n,this.property=t}}fr.prototype.attribute="";fr.prototype.booleanish=!1;fr.prototype.boolean=!1;fr.prototype.commaOrSpaceSeparated=!1;fr.prototype.commaSeparated=!1;fr.prototype.defined=!1;fr.prototype.mustUseProperty=!1;fr.prototype.number=!1;fr.prototype.overloadedBoolean=!1;fr.prototype.property="";fr.prototype.spaceSeparated=!1;fr.prototype.space=void 0;let kfe=0;const Pt=Nu(),Ks=Nu(),G_=Nu(),Be=Nu(),Kn=Nu(),Wd=Nu(),gr=Nu();function Nu(){return 2**++kfe}const K_=Object.freeze(Object.defineProperty({__proto__:null,boolean:Pt,booleanish:Ks,commaOrSpaceSeparated:gr,commaSeparated:Wd,number:Be,overloadedBoolean:G_,spaceSeparated:Kn},Symbol.toStringTag,{value:"Module"})),Qv=Object.keys(K_);class mA extends fr{constructor(t,n,s,i){let r=-1;if(super(t,n),lM(this,"space",i),typeof s=="number")for(;++r4&&n.slice(0,4)==="data"&&Rfe.test(t)){if(t.charAt(4)==="-"){const r=t.slice(5).replace(cM,Mfe);s="data"+r.charAt(0).toUpperCase()+r.slice(1)}else{const r=t.slice(4);if(!cM.test(r)){let a=r.replace(jfe,Ofe);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=mA}return new i(s,t)}function Ofe(e){return"-"+e.toLowerCase()}function Mfe(e){return e.charAt(1).toUpperCase()}const vg=ZU([JU,Afe,n7,s7,i7],"html"),ac=ZU([JU,Cfe,n7,s7,i7],"svg");function uM(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function r7(e){return e.join(" ").trim()}var gA={},dM=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Lfe=/\n/g,Dfe=/^\s*/,Pfe=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Bfe=/^:\s*/,Ufe=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Ffe=/^[;\s]*/,$fe=/^\s+|\s+$/g,Hfe=` -`,fM="/",hM="*",Mc="",zfe="comment",Vfe="declaration";function Gfe(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,s=1;function i(m){var b=m.match(Lfe);b&&(n+=b.length);var v=m.lastIndexOf(Hfe);s=~v?m.length-v:s+m.length}function r(){var m={line:n,column:s};return function(b){return b.position=new a(m),u(),b}}function a(m){this.start=m,this.end={line:n,column:s},this.source=t.source}a.prototype.content=e;function l(m){var b=new Error(t.source+":"+n+":"+s+": "+m);if(b.reason=m,b.filename=t.source,b.line=n,b.column=s,b.source=e,!t.silent)throw b}function c(m){var b=m.exec(e);if(b){var v=b[0];return i(v),e=e.slice(v.length),b}}function u(){c(Dfe)}function d(m){var b;for(m=m||[];b=f();)b!==!1&&m.push(b);return m}function f(){var m=r();if(!(fM!=e.charAt(0)||hM!=e.charAt(1))){for(var b=2;Mc!=e.charAt(b)&&(hM!=e.charAt(b)||fM!=e.charAt(b+1));)++b;if(b+=2,Mc===e.charAt(b-1))return l("End of comment missing");var v=e.slice(2,b-2);return s+=2,i(v),e=e.slice(b),s+=2,m({type:zfe,comment:v})}}function h(){var m=r(),b=c(Pfe);if(b){if(f(),!c(Bfe))return l("property missing ':'");var v=c(Ufe),y=m({type:Vfe,property:pM(b[0].replace(dM,Mc)),value:v?pM(v[0].replace(dM,Mc)):Mc});return c(Ffe),y}}function p(){var m=[];d(m);for(var b;b=h();)b!==!1&&(m.push(b),d(m));return m}return u(),p()}function pM(e){return e?e.replace($fe,Mc):Mc}var Kfe=Gfe,qfe=Nl&&Nl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(gA,"__esModule",{value:!0});gA.default=Wfe;const Yfe=qfe(Kfe);function Wfe(e,t){let n=null;if(!e||typeof e!="string")return n;const s=(0,Yfe.default)(e),i=typeof t=="function";return s.forEach(r=>{if(r.type!=="declaration")return;const{property:a,value:l}=r;i?t(a,l,r):l&&(n=n||{},n[a]=l)}),n}var T1={};Object.defineProperty(T1,"__esModule",{value:!0});T1.camelCase=void 0;var Xfe=/^--[a-zA-Z0-9_-]+$/,Qfe=/-([a-z])/g,Zfe=/^[^-]+$/,Jfe=/^-(webkit|moz|ms|o|khtml)-/,ehe=/^-(ms)-/,the=function(e){return!e||Zfe.test(e)||Xfe.test(e)},nhe=function(e,t){return t.toUpperCase()},mM=function(e,t){return"".concat(t,"-")},she=function(e,t){return t===void 0&&(t={}),the(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(ehe,mM):e=e.replace(Jfe,mM),e.replace(Qfe,nhe))};T1.camelCase=she;var ihe=Nl&&Nl.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},rhe=ihe(gA),ahe=T1;function q_(e,t){var n={};return!e||typeof e!="string"||(0,rhe.default)(e,function(s,i){s&&i&&(n[(0,ahe.camelCase)(s,t)]=i)}),n}q_.default=q_;var ohe=q_;const lhe=Df(ohe),k1=a7("end"),lo=a7("start");function a7(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function che(e){const t=lo(e),n=k1(e);if(t&&n)return{start:t,end:n}}function zp(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?gM(e.position):"start"in e||"end"in e?gM(e):"line"in e||"column"in e?Y_(e):""}function Y_(e){return bM(e&&e.line)+":"+bM(e&&e.column)}function gM(e){return Y_(e&&e.start)+"-"+Y_(e&&e.end)}function bM(e){return e&&typeof e=="number"?e:1}class Pi extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let i="",r={},a=!1;if(n&&("line"in n&&"column"in n?r={place:n}:"start"in n&&"end"in n?r={place:n}:"type"in n?r={ancestors:[n],place:n.position}:r={...n}),typeof t=="string"?i=t:!r.cause&&t&&(a=!0,i=t.message,r.cause=t),!r.ruleId&&!r.source&&typeof s=="string"){const c=s.indexOf(":");c===-1?r.ruleId=s:(r.source=s.slice(0,c),r.ruleId=s.slice(c+1))}if(!r.place&&r.ancestors&&r.ancestors){const c=r.ancestors[r.ancestors.length-1];c&&(r.place=c.position)}const l=r.place&&"start"in r.place?r.place.start:r.place;this.ancestors=r.ancestors||void 0,this.cause=r.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=zp(r.place)||"1:1",this.place=r.place||void 0,this.reason=this.message,this.ruleId=r.ruleId||void 0,this.source=r.source||void 0,this.stack=a&&r.cause&&typeof r.cause.stack=="string"?r.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Pi.prototype.file="";Pi.prototype.name="";Pi.prototype.reason="";Pi.prototype.message="";Pi.prototype.stack="";Pi.prototype.column=void 0;Pi.prototype.line=void 0;Pi.prototype.ancestors=void 0;Pi.prototype.cause=void 0;Pi.prototype.fatal=void 0;Pi.prototype.place=void 0;Pi.prototype.ruleId=void 0;Pi.prototype.source=void 0;const bA={}.hasOwnProperty,uhe=new Map,dhe=/[A-Z]/g,fhe=new Set(["table","tbody","thead","tfoot","tr"]),hhe=new Set(["td","th"]),o7="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function phe(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=whe(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");s=vhe(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,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"?ac:vg,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},r=l7(i,e,void 0);return r&&typeof r!="string"?r:i.create(e,i.Fragment,{children:r||void 0},void 0)}function l7(e,t,n){if(t.type==="element")return mhe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ghe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return yhe(e,t,n);if(t.type==="mdxjsEsm")return bhe(e,t);if(t.type==="root")return xhe(e,t,n);if(t.type==="text")return Ehe(e,t)}function mhe(e,t,n){const s=e.schema;let i=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(i=ac,e.schema=i),e.ancestors.push(t);const r=u7(e,t.tagName,!1),a=She(e,t);let l=xA(e,t);return fhe.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!Tfe(c):!0})),c7(e,a,r,t),yA(a,l),e.ancestors.pop(),e.schema=s,e.create(t,r,a,n)}function ghe(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}Dm(e,t.position)}function bhe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Dm(e,t.position)}function yhe(e,t,n){const s=e.schema;let i=s;t.name==="svg"&&s.space==="html"&&(i=ac,e.schema=i),e.ancestors.push(t);const r=t.name===null?e.Fragment:u7(e,t.name,!0),a=_he(e,t),l=xA(e,t);return c7(e,a,r,t),yA(a,l),e.ancestors.pop(),e.schema=s,e.create(t,r,a,n)}function xhe(e,t,n){const s={};return yA(s,xA(e,t)),e.create(t,e.Fragment,s,n)}function Ehe(e,t){return t.value}function c7(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function yA(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function vhe(e,t,n){return s;function s(i,r,a,l){const u=Array.isArray(a.children)?n:t;return l?u(r,a,l):u(r,a)}}function whe(e,t){return n;function n(s,i,r,a){const l=Array.isArray(r.children),c=lo(s);return t(i,r,a,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function She(e,t){const n={};let s,i;for(i in t.properties)if(i!=="children"&&bA.call(t.properties,i)){const r=Nhe(e,i,t.properties[i]);if(r){const[a,l]=r;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&hhe.has(t.tagName)?s=l:n[a]=l}}if(s){const r=n.style||(n.style={});r[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function _he(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const r=s.data.estree.body[0];r.type;const a=r.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Dm(e,t.position);else{const i=s.name;let r;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const l=s.value.data.estree.body[0];l.type,r=e.evaluater.evaluateExpression(l.expression)}else Dm(e,t.position);else r=s.value===null?!0:s.value;n[i]=r}return n}function xA(e,t){const n=[];let s=-1;const i=e.passKeys?new Map:uhe;for(;++si?0:i+t:t=t>i?i:t,n=n>0?n:0,s.length<1e4)a=Array.from(s),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);r0?(Cr(e,e.length,0,t),e):t}const EM={}.hasOwnProperty;function f7(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 Aa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Gi=oc(/[A-Za-z]/),Li=oc(/[\dA-Za-z]/),Mhe=oc(/[#-'*+\--9=?A-Z^-~]/);function rx(e){return e!==null&&(e<32||e===127)}const W_=oc(/\d/),Lhe=oc(/[\dA-Fa-f]/),Dhe=oc(/[!-/:-@[-`{-~]/);function mt(e){return e!==null&&e<-2}function $n(e){return e!==null&&(e<0||e===32)}function qt(e){return e===-2||e===-1||e===32}const A1=oc(new RegExp("\\p{P}|\\p{S}","u")),hu=oc(/\s/);function oc(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function th(e){const t=[];let n=-1,s=0,i=0;for(;++n55295&&r<57344){const l=e.charCodeAt(n+1);r<56320&&l>56319&&l<57344?(a=String.fromCharCode(r,l),i=1):a="�"}else a=String.fromCharCode(r);a&&(t.push(e.slice(s,n),encodeURIComponent(a)),s=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(s)}function nn(e,t,n,s){const i=s?s-1:Number.POSITIVE_INFINITY;let r=0;return a;function a(c){return qt(c)?(e.enter(n),l(c)):t(c)}function l(c){return qt(c)&&r++a))return;const k=t.events.length;let T=k,C,I;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(C){I=t.events[T][1].end;break}C=!0}for(y(s),S=k;SE;){const _=n[w];t.containerState=_[1],_[0].exit.call(t,e)}n.length=E}function x(){i.write([null]),r=void 0,i=void 0,t.containerState._closeFlow=void 0}}function $he(e,t,n){return nn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Af(e){if(e===null||$n(e)||hu(e))return 1;if(A1(e))return 2}function C1(e,t,n){const s=[];let i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[s][1].end},h={...e[n][1].start};wM(f,-c),wM(h,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[s][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},r={type:c>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[s][1].end={...a.start},e[n][1].start={...l.end},u=[],e[s][1].end.offset-e[s][1].start.offset&&(u=qr(u,[["enter",e[s][1],t],["exit",e[s][1],t]])),u=qr(u,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",r,t]]),u=qr(u,C1(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),u=qr(u,[["exit",r,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=qr(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Cr(e,s-1,n-s+3,u),n=s+u.length-d-2;break}}for(n=-1;++n0&&qt(S)?nn(e,x,"linePrefix",r+1)(S):x(S)}function x(S){return S===null||mt(S)?e.check(SM,b,w)(S):(e.enter("codeFlowValue"),E(S))}function E(S){return S===null||mt(S)?(e.exit("codeFlowValue"),x(S)):(e.consume(S),E)}function w(S){return e.exit("codeFenced"),t(S)}function _(S,k,T){let C=0;return I;function I(F){return S.enter("lineEnding"),S.consume(F),S.exit("lineEnding"),j}function j(F){return S.enter("codeFencedFence"),qt(F)?nn(S,L,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):L(F)}function L(F){return F===l?(S.enter("codeFencedFenceSequence"),z(F)):T(F)}function z(F){return F===l?(C++,S.consume(F),z):C>=a?(S.exit("codeFencedFenceSequence"),qt(F)?nn(S,D,"whitespace")(F):D(F)):T(F)}function D(F){return F===null||mt(F)?(S.exit("codeFencedFence"),k(F)):T(F)}}}function Jhe(e,t,n){const s=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r)}function r(a){return s.parser.lazy[s.now().line]?n(a):t(a)}}const Jv={name:"codeIndented",tokenize:tpe},epe={partial:!0,tokenize:npe};function tpe(e,t,n){const s=this;return i;function i(u){return e.enter("codeIndented"),nn(e,r,"linePrefix",5)(u)}function r(u){const d=s.events[s.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?c(u):mt(u)?e.attempt(epe,a,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||mt(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function npe(e,t,n){const s=this;return i;function i(a){return s.parser.lazy[s.now().line]?n(a):mt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):nn(e,r,"linePrefix",5)(a)}function r(a){const l=s.events[s.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):mt(a)?i(a):n(a)}}const spe={name:"codeText",previous:rpe,resolve:ipe,tokenize:ape};function ipe(e){let t=e.length-4,n=3,s,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s=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-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const i=n||0;this.setCursor(Math.trunc(t));const r=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return s&&Vh(this.left,s),r.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),Vh(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Vh(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(s.parser.constructs.flow,n,t)(a)}}function y7(e,t,n,s,i,r,a,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(y){return y===60?(e.enter(s),e.enter(i),e.enter(r),e.consume(y),e.exit(r),h):y===null||y===32||y===41||rx(y)?n(y):(e.enter(s),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(y))}function h(y){return y===62?(e.enter(r),e.consume(y),e.exit(r),e.exit(i),e.exit(s),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(l),h(y)):y===null||y===60||mt(y)?n(y):(e.consume(y),y===92?m:p)}function m(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function b(y){return!d&&(y===null||y===41||$n(y))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(s),t(y)):d999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(r),e.enter(i),e.consume(p),e.exit(i),e.exit(s),t):mt(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||mt(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!qt(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function E7(e,t,n,s,i,r){let a;return l;function l(h){return h===34||h===39||h===40?(e.enter(s),e.enter(i),e.consume(h),e.exit(i),a=h===40?41:h,c):n(h)}function c(h){return h===a?(e.enter(i),e.consume(h),e.exit(i),e.exit(s),t):(e.enter(r),u(h))}function u(h){return h===a?(e.exit(r),c(a)):h===null?n(h):mt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),nn(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||mt(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 Vp(e,t){let n;return s;function s(i){return mt(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,s):qt(i)?nn(e,s,n?"linePrefix":"lineSuffix")(i):t(i)}}const ppe={name:"definition",tokenize:gpe},mpe={partial:!0,tokenize:bpe};function gpe(e,t,n){const s=this;let i;return r;function r(p){return e.enter("definition"),a(p)}function a(p){return x7.call(s,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return i=Aa(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return $n(p)?Vp(e,u)(p):u(p)}function u(p){return y7(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(mpe,f,f)(p)}function f(p){return qt(p)?nn(e,h,"whitespace")(p):h(p)}function h(p){return p===null||mt(p)?(e.exit("definition"),s.parser.defined.push(i),t(p)):n(p)}}function bpe(e,t,n){return s;function s(l){return $n(l)?Vp(e,i)(l):n(l)}function i(l){return E7(e,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function r(l){return qt(l)?nn(e,a,"whitespace")(l):a(l)}function a(l){return l===null||mt(l)?t(l):n(l)}}const ype={name:"hardBreakEscape",tokenize:xpe};function xpe(e,t,n){return s;function s(r){return e.enter("hardBreakEscape"),e.consume(r),i}function i(r){return mt(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}const Epe={name:"headingAtx",resolve:vpe,tokenize:wpe};function vpe(e,t){let n=e.length-2,s=3,i,r;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(i={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},r={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},Cr(e,s,n-s+1,[["enter",i,t],["enter",r,t],["exit",r,t],["exit",i,t]])),e}function wpe(e,t,n){let s=0;return i;function i(d){return e.enter("atxHeading"),r(d)}function r(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&s++<6?(e.consume(d),a):d===null||$n(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||mt(d)?(e.exit("atxHeading"),t(d)):qt(d)?nn(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||$n(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const Spe=["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"],NM=["pre","script","style","textarea"],_pe={concrete:!0,name:"htmlFlow",resolveTo:kpe,tokenize:Ape},Npe={partial:!0,tokenize:Ipe},Tpe={partial:!0,tokenize:Cpe};function kpe(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 Ape(e,t,n){const s=this;let i,r,a,l,c;return u;function u(U){return d(U)}function d(U){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(U),f}function f(U){return U===33?(e.consume(U),h):U===47?(e.consume(U),r=!0,b):U===63?(e.consume(U),i=3,s.interrupt?t:R):Gi(U)?(e.consume(U),a=String.fromCharCode(U),v):n(U)}function h(U){return U===45?(e.consume(U),i=2,p):U===91?(e.consume(U),i=5,l=0,m):Gi(U)?(e.consume(U),i=4,s.interrupt?t:R):n(U)}function p(U){return U===45?(e.consume(U),s.interrupt?t:R):n(U)}function m(U){const te="CDATA[";return U===te.charCodeAt(l++)?(e.consume(U),l===te.length?s.interrupt?t:L:m):n(U)}function b(U){return Gi(U)?(e.consume(U),a=String.fromCharCode(U),v):n(U)}function v(U){if(U===null||U===47||U===62||$n(U)){const te=U===47,K=a.toLowerCase();return!te&&!r&&NM.includes(K)?(i=1,s.interrupt?t(U):L(U)):Spe.includes(a.toLowerCase())?(i=6,te?(e.consume(U),y):s.interrupt?t(U):L(U)):(i=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(U):r?x(U):E(U))}return U===45||Li(U)?(e.consume(U),a+=String.fromCharCode(U),v):n(U)}function y(U){return U===62?(e.consume(U),s.interrupt?t:L):n(U)}function x(U){return qt(U)?(e.consume(U),x):I(U)}function E(U){return U===47?(e.consume(U),I):U===58||U===95||Gi(U)?(e.consume(U),w):qt(U)?(e.consume(U),E):I(U)}function w(U){return U===45||U===46||U===58||U===95||Li(U)?(e.consume(U),w):_(U)}function _(U){return U===61?(e.consume(U),S):qt(U)?(e.consume(U),_):E(U)}function S(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(e.consume(U),c=U,k):qt(U)?(e.consume(U),S):T(U)}function k(U){return U===c?(e.consume(U),c=null,C):U===null||mt(U)?n(U):(e.consume(U),k)}function T(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||$n(U)?_(U):(e.consume(U),T)}function C(U){return U===47||U===62||qt(U)?E(U):n(U)}function I(U){return U===62?(e.consume(U),j):n(U)}function j(U){return U===null||mt(U)?L(U):qt(U)?(e.consume(U),j):n(U)}function L(U){return U===45&&i===2?(e.consume(U),A):U===60&&i===1?(e.consume(U),O):U===62&&i===4?(e.consume(U),Y):U===63&&i===3?(e.consume(U),R):U===93&&i===5?(e.consume(U),$):mt(U)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Npe,J,z)(U)):U===null||mt(U)?(e.exit("htmlFlowData"),z(U)):(e.consume(U),L)}function z(U){return e.check(Tpe,D,J)(U)}function D(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),F}function F(U){return U===null||mt(U)?z(U):(e.enter("htmlFlowData"),L(U))}function A(U){return U===45?(e.consume(U),R):L(U)}function O(U){return U===47?(e.consume(U),a="",P):L(U)}function P(U){if(U===62){const te=a.toLowerCase();return NM.includes(te)?(e.consume(U),Y):L(U)}return Gi(U)&&a.length<8?(e.consume(U),a+=String.fromCharCode(U),P):L(U)}function $(U){return U===93?(e.consume(U),R):L(U)}function R(U){return U===62?(e.consume(U),Y):U===45&&i===2?(e.consume(U),R):L(U)}function Y(U){return U===null||mt(U)?(e.exit("htmlFlowData"),J(U)):(e.consume(U),Y)}function J(U){return e.exit("htmlFlow"),t(U)}}function Cpe(e,t,n){const s=this;return i;function i(a){return mt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r):n(a)}function r(a){return s.parser.lazy[s.now().line]?n(a):t(a)}}function Ipe(e,t,n){return s;function s(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(wg,t,n)}}const jpe={name:"htmlText",tokenize:Rpe};function Rpe(e,t,n){const s=this;let i,r,a;return l;function l(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),c}function c(R){return R===33?(e.consume(R),u):R===47?(e.consume(R),_):R===63?(e.consume(R),E):Gi(R)?(e.consume(R),T):n(R)}function u(R){return R===45?(e.consume(R),d):R===91?(e.consume(R),r=0,m):Gi(R)?(e.consume(R),x):n(R)}function d(R){return R===45?(e.consume(R),p):n(R)}function f(R){return R===null?n(R):R===45?(e.consume(R),h):mt(R)?(a=f,O(R)):(e.consume(R),f)}function h(R){return R===45?(e.consume(R),p):f(R)}function p(R){return R===62?A(R):R===45?h(R):f(R)}function m(R){const Y="CDATA[";return R===Y.charCodeAt(r++)?(e.consume(R),r===Y.length?b:m):n(R)}function b(R){return R===null?n(R):R===93?(e.consume(R),v):mt(R)?(a=b,O(R)):(e.consume(R),b)}function v(R){return R===93?(e.consume(R),y):b(R)}function y(R){return R===62?A(R):R===93?(e.consume(R),y):b(R)}function x(R){return R===null||R===62?A(R):mt(R)?(a=x,O(R)):(e.consume(R),x)}function E(R){return R===null?n(R):R===63?(e.consume(R),w):mt(R)?(a=E,O(R)):(e.consume(R),E)}function w(R){return R===62?A(R):E(R)}function _(R){return Gi(R)?(e.consume(R),S):n(R)}function S(R){return R===45||Li(R)?(e.consume(R),S):k(R)}function k(R){return mt(R)?(a=k,O(R)):qt(R)?(e.consume(R),k):A(R)}function T(R){return R===45||Li(R)?(e.consume(R),T):R===47||R===62||$n(R)?C(R):n(R)}function C(R){return R===47?(e.consume(R),A):R===58||R===95||Gi(R)?(e.consume(R),I):mt(R)?(a=C,O(R)):qt(R)?(e.consume(R),C):A(R)}function I(R){return R===45||R===46||R===58||R===95||Li(R)?(e.consume(R),I):j(R)}function j(R){return R===61?(e.consume(R),L):mt(R)?(a=j,O(R)):qt(R)?(e.consume(R),j):C(R)}function L(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),i=R,z):mt(R)?(a=L,O(R)):qt(R)?(e.consume(R),L):(e.consume(R),D)}function z(R){return R===i?(e.consume(R),i=void 0,F):R===null?n(R):mt(R)?(a=z,O(R)):(e.consume(R),z)}function D(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||$n(R)?C(R):(e.consume(R),D)}function F(R){return R===47||R===62||$n(R)?C(R):n(R)}function A(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function O(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),P}function P(R){return qt(R)?nn(e,$,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):$(R)}function $(R){return e.enter("htmlTextData"),a(R)}}const wA={name:"labelEnd",resolveAll:Dpe,resolveTo:Ppe,tokenize:Bpe},Ope={tokenize:Upe},Mpe={tokenize:Fpe},Lpe={tokenize:$pe};function Dpe(e){let t=-1;const n=[];for(;++t=3&&(u===null||mt(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===i?(e.consume(u),s++,c):(e.exit("thematicBreakSequence"),qt(u)?nn(e,l,"whitespace")(u):l(u))}}const nr={continuation:{tokenize:Qpe},exit:Jpe,name:"list",tokenize:Xpe},Ype={partial:!0,tokenize:eme},Wpe={partial:!0,tokenize:Zpe};function Xpe(e,t,n){const s=this,i=s.events[s.events.length-1];let r=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return l;function l(p){const m=s.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!s.containerState.marker||p===s.containerState.marker:W_(p)){if(s.containerState.type||(s.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(zb,n,u)(p):u(p);if(!s.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return W_(p)&&++a<10?(e.consume(p),c):(!s.interrupt||a<2)&&(s.containerState.marker?p===s.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"),s.containerState.marker=s.containerState.marker||p,e.check(wg,s.interrupt?n:d,e.attempt(Ype,h,f))}function d(p){return s.containerState.initialBlankLine=!0,r++,h(p)}function f(p){return qt(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return s.containerState.size=r+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Qpe(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(wg,i,r);function i(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,nn(e,t,"listItemIndent",s.containerState.size+1)(l)}function r(l){return s.containerState.furtherBlankLines||!qt(l)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,a(l)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(Wpe,t,a)(l))}function a(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,nn(e,e.attempt(nr,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Zpe(e,t,n){const s=this;return nn(e,i,"listItemIndent",s.containerState.size+1);function i(r){const a=s.events[s.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===s.containerState.size?t(r):n(r)}}function Jpe(e){e.exit(this.containerState.type)}function eme(e,t,n){const s=this;return nn(e,i,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(r){const a=s.events[s.events.length-1];return!qt(r)&&a&&a[1].type==="listItemPrefixWhitespace"?t(r):n(r)}}const TM={name:"setextUnderline",resolveTo:tme,tokenize:nme};function tme(e,t){let n=e.length,s,i,r;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!r&&e[n][1].type==="definition"&&(r=n);const a={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",r?(e.splice(i,0,["enter",a,t]),e.splice(r+1,0,["exit",e[s][1],t]),e[s][1].end={...e[r][1].end}):e[s][1]=a,e.push(["exit",a,t]),e}function nme(e,t,n){const s=this;let i;return r;function r(u){let d=s.events.length,f;for(;d--;)if(s.events[d][1].type!=="lineEnding"&&s.events[d][1].type!=="linePrefix"&&s.events[d][1].type!=="content"){f=s.events[d][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||f)?(e.enter("setextHeadingLine"),i=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===i?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),qt(u)?nn(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||mt(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const sme={tokenize:ime};function ime(e){const t=this,n=e.attempt(wg,s,e.attempt(this.parser.constructs.flowInitial,i,nn(e,e.attempt(this.parser.constructs.flow,i,e.attempt(cpe,i)),"linePrefix")));return n;function s(r){if(r===null){e.consume(r);return}return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const rme={resolveAll:w7()},ame=v7("string"),ome=v7("text");function v7(e){return{resolveAll:w7(e==="text"?lme:void 0),tokenize:t};function t(n){const s=this,i=this.parser.constructs[e],r=n.attempt(i,a,l);return a;function a(d){return u(d)?r(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),r(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=i[d];let h=-1;if(f)for(;++h-1){const l=a[0];typeof l=="string"?a[0]=l.slice(s):a.shift()}r>0&&a.push(e[i].slice(0,r))}return a}function vme(e,t){let n=-1;const s=[];let i;for(;++n0?`?${r.join("&")}`:"";return yg(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${a}`)}function hfe(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 pfe(e,t){return`https://console.volcengine.com/agentkit/${(t||"cn-beijing")==="cn-beijing"?"cn":"cn-shanghai"}/skillspace/detail/${encodeURIComponent(e)}`}function aM({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M4.5 6.7h4.2M12.3 6.7h7.2"}),o.jsx("path",{d:"M4.5 12h8.2M16.3 12h3.2"}),o.jsx("path",{d:"M4.5 17.3h2.7M10.8 17.3h8.7"}),o.jsx("circle",{cx:"10.5",cy:"6.7",r:"1.8",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"14.5",cy:"12",r:"1.8",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"9",cy:"17.3",r:"1.8",fill:"currentColor",stroke:"none"})]})}const mfe={coding:"智能编程",get_city_weather:"城市天气查询",get_location_weather:"位置天气查询",web_fetch:"网页内容获取"};function Y_(e){const t=Nu.find(n=>n.id===e||n.toolNames.includes(e));return mfe[e]??(t==null?void 0:t.label)??e}function oM(e){const t=Nu.find(s=>s.id===e||s.toolNames.includes(e));return((t==null?void 0:t.desc)??"由 VeADK 提供的内置工具").replace(/[。.]+$/,"")}function gfe(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m7 7 10 10M17 7 7 17",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function bfe(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"5.8",stroke:"currentColor",strokeWidth:"1.7"}),o.jsx("path",{d:"m15.2 15.2 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function lM(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"M12 5.5v13M5.5 12h13",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function WU({title:e,description:t,icon:n,wide:s=!1,onClose:i,children:r}){const a=g.useRef(`session-capability-${Math.random().toString(36).slice(2)}`);return g.useEffect(()=>{const l=document.body.style.overflow;document.body.style.overflow="hidden";const c=u=>{u.key==="Escape"&&i()};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c),document.body.style.overflow=l}},[i]),hi.createPortal(o.jsxs("div",{className:"session-capability-dialog-layer",children:[o.jsx("button",{type:"button",className:"session-capability-dialog-scrim","aria-label":"关闭弹窗",onClick:i}),o.jsxs("section",{className:`session-capability-dialog${s?" is-wide":""}`,role:"dialog","aria-modal":"true","aria-labelledby":a.current,children:[o.jsxs("header",{className:`session-capability-dialog-head${n?"":" is-iconless"}`,children:[n&&o.jsx("span",{className:"session-capability-dialog-mark",children:n}),o.jsxs("div",{children:[o.jsx("h2",{id:a.current,children:e}),o.jsx("p",{children:t})]}),o.jsx("button",{type:"button",className:"session-capability-dialog-close","aria-label":`关闭${e}`,onClick:i,children:o.jsx(gfe,{})})]}),r]})]}),document.body)}function Vb({value:e,placeholder:t,label:n,onChange:s,autoFocus:i=!1}){return o.jsxs("label",{className:"session-capability-search",children:[o.jsx(bfe,{}),o.jsx("input",{value:e,"aria-label":n,placeholder:t,autoFocus:i,onChange:r=>s(r.target.value)})]})}function yfe({agentName:e,tools:t,selectedNames:n,mutating:s,onAdd:i,onClose:r}){const[a,l]=g.useState(""),[c,u]=g.useState(""),d=g.useMemo(()=>new Set(n),[n]),f=g.useMemo(()=>{const p=a.trim().toLowerCase();return t.filter(m=>p?`${Y_(m)} ${m} ${oM(m)}`.toLowerCase().includes(p):!0)},[a,t]),h=async p=>{u(p);const m=await i({kind:"tool",name:p});u(""),m&&r()};return o.jsx(WU,{title:"添加内置工具",description:`添加后仅对 ${e} 的当前会话生效`,icon:o.jsx(aM,{}),onClose:r,children:o.jsxs("div",{className:"session-tool-dialog-body",children:[o.jsx(Vb,{value:a,label:"搜索内置工具",placeholder:"搜索中文名称或工具标识",onChange:l,autoFocus:!0}),o.jsx("div",{className:"session-tool-picker",role:"list","aria-label":"可用内置工具",children:f.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的内置工具"}):f.map(p=>{const m=d.has(p),b=c===p;return o.jsxs("article",{className:"session-tool-option",role:"listitem",children:[o.jsx("span",{className:"session-tool-option-icon",children:o.jsx(aM,{})}),o.jsxs("span",{className:"session-tool-option-copy",children:[o.jsx("strong",{children:Y_(p)}),o.jsx("code",{children:p}),o.jsx("span",{children:oM(p)})]}),o.jsx("button",{type:"button",disabled:m||s||!!c,onClick:()=>void h(p),children:m?"已添加":b?"添加中…":"添加"})]},p)})})]})})}function xfe({appName:e,agentName:t,selectedNames:n,mutating:s,onAdd:i,onClose:r}){const[a,l]=g.useState("public"),[c,u]=g.useState(""),[d,f]=g.useState([]),[h,p]=g.useState(0),[m,b]=g.useState(!0),[v,y]=g.useState(""),[x,E]=g.useState([]),[w,_]=g.useState(null),[S,k]=g.useState([]),[T,C]=g.useState(""),[I,j]=g.useState(""),[L,z]=g.useState(!0),[D,F]=g.useState(!1),[A,M]=g.useState(""),[P,H]=g.useState(""),R=g.useMemo(()=>new Set(n),[n]);g.useEffect(()=>{if(a!=="public")return;let K=!0;const V=window.setTimeout(()=>{b(!0),y(""),WB(e,c.trim()).then(W=>{K&&(f(W.items),p(W.totalCount))}).catch(W=>{K&&(f([]),p(0),y(W instanceof Error?W.message:"搜索 Skill Hub 失败"))}).finally(()=>{K&&b(!1)})},250);return()=>{K=!1,window.clearTimeout(V)}},[e,c,a]),g.useEffect(()=>{if(a!=="agentkit")return;let K=!0;return z(!0),M(""),qU().then(V=>{K&&(E(V),_(V[0]??null))}).catch(V=>{K&&M(V instanceof Error?V.message:"读取 Skill Space 失败")}).finally(()=>{K&&z(!1)}),()=>{K=!1}},[a]),g.useEffect(()=>{if(a!=="agentkit")return;if(!w){k([]);return}let K=!0;return F(!0),M(""),YU(w.id,w.region).then(V=>{K&&k(V)}).catch(V=>{K&&M(V instanceof Error?V.message:"读取技能失败")}).finally(()=>{K&&F(!1)}),()=>{K=!1}},[w,a]);const Y=g.useMemo(()=>{const K=T.trim().toLowerCase();return K?x.filter(V=>`${V.name} ${V.id} ${V.description}`.toLowerCase().includes(K)):x},[T,x]),J=g.useMemo(()=>{const K=I.trim().toLowerCase();return K?S.filter(V=>`${V.skillName} ${V.skillDescription}`.toLowerCase().includes(K)):S},[I,S]),U=async K=>{if(!w)return;H(K.skillId);const V=await i({kind:"skill",name:K.skillName,skillSourceId:w.id,description:K.skillDescription,version:K.version});H(""),V&&r()},te=async K=>{H(K.slug);const V=await i({kind:"skill",name:K.name,skillSourceId:`findskill:${K.slug}`,description:K.description,version:K.version||K.updatedAt});H(""),V&&r()};return o.jsx(WU,{title:"添加技能",description:`从公域 Skill Hub 或 AgentKit Skill 中心添加到 ${t} 当前会话`,wide:!0,onClose:r,children:o.jsxs("div",{className:"session-skill-dialog-body",children:[o.jsxs("div",{className:"session-skill-source-tabs",role:"tablist","aria-label":"技能来源",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":a==="public",className:a==="public"?"is-active":"",onClick:()=>l("public"),children:["Skill Hub",o.jsx("span",{children:"公域"})]}),o.jsx("button",{type:"button",role:"tab","aria-selected":a==="agentkit",className:a==="agentkit"?"is-active":"",onClick:()=>l("agentkit"),children:"AgentKit Skill 中心"})]}),a==="public"?o.jsxs("section",{className:"session-public-skill-browser","aria-label":"Skill Hub 公域技能",children:[o.jsxs("div",{className:"session-public-skill-head",children:[o.jsx(Vb,{value:c,label:"搜索 Skill Hub",placeholder:"搜索技能名称、用途或关键词",onChange:u,autoFocus:!0}),o.jsxs("span",{children:[h.toLocaleString()," 个公域技能"]})]}),o.jsx("div",{className:"session-public-skill-list",children:v?o.jsx("div",{className:"session-capability-error",children:v}):m?o.jsx("div",{className:"session-capability-loading",children:"正在搜索 Skill Hub…"}):d.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的公域技能"}):d.map(K=>{const V=R.has(K.name),W=P===K.slug;return o.jsxs("article",{className:"session-skill-option session-public-skill-option",children:[o.jsxs("span",{className:"session-skill-option-copy",children:[o.jsx("strong",{children:K.name}),o.jsx("span",{children:K.description||"暂无描述"}),o.jsxs("small",{children:[K.sourceRepo||K.sourceType||"FindSkill",o.jsx("span",{"aria-hidden":"true",children:" · "}),K.downloadCount.toLocaleString()," 次下载",K.evaluationScore>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{"aria-hidden":"true",children:" · "}),K.evaluationScore.toFixed(1)," 分"]})]})]}),o.jsx("button",{type:"button",disabled:V||s||!!P,onClick:()=>void te(K),children:V?"已添加":W?"添加中…":o.jsxs(o.Fragment,{children:[o.jsx(lM,{}),"添加"]})})]},K.slug)})})]}):o.jsxs("div",{className:"session-skill-browser",children:[o.jsxs("section",{className:"session-skill-spaces","aria-label":"Skill Space 列表",children:[o.jsxs("div",{className:"session-skill-pane-head",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"Skill Space"}),o.jsx("span",{children:x.length})]}),o.jsx(Vb,{value:T,label:"搜索 Skill Space",placeholder:"搜索空间",onChange:C,autoFocus:!0})]}),o.jsx("div",{className:"session-skill-pane-list",children:L?o.jsx("div",{className:"session-capability-loading",children:"正在读取 Skill Space…"}):Y.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的 Skill Space"}):Y.map(K=>o.jsx("button",{type:"button",className:`session-skill-space${(w==null?void 0:w.id)===K.id?" is-active":""}`,onClick:()=>{_(K),j("")},children:o.jsxs("span",{children:[o.jsx("strong",{children:K.name||K.id}),o.jsx("small",{children:K.description||K.id}),o.jsxs("em",{children:[K.skillCount??0," 个技能"]})]})},`${K.projectName??"default"}:${K.id}`))})]}),o.jsxs("section",{className:"session-skill-results","aria-label":"AgentKit Skill 列表",children:[o.jsxs("div",{className:"session-skill-pane-head",children:[o.jsxs("div",{children:[o.jsx("strong",{title:w==null?void 0:w.name,children:(w==null?void 0:w.name)||"选择 Skill Space"}),o.jsx("span",{children:S.length})]}),o.jsx(Vb,{value:I,label:"搜索 AgentKit 技能",placeholder:"搜索技能名称或描述",onChange:j})]}),o.jsx("div",{className:"session-skill-pane-list",children:A?o.jsx("div",{className:"session-capability-error",children:A}):w?D?o.jsx("div",{className:"session-capability-loading",children:"正在读取技能…"}):J.length===0?o.jsx("div",{className:"session-capability-empty",children:"没有匹配的技能"}):J.map(K=>{const V=R.has(K.skillName),W=P===K.skillId;return o.jsxs("article",{className:"session-skill-option",children:[o.jsxs("span",{className:"session-skill-option-copy",children:[o.jsx("strong",{children:K.skillName}),o.jsx("span",{children:K.skillDescription||"暂无描述"}),o.jsxs("small",{children:["版本 ",K.version||"—"]})]}),o.jsx("button",{type:"button",disabled:V||s||!!P,onClick:()=>void U(K),children:V?"已添加":W?"添加中…":o.jsxs(o.Fragment,{children:[o.jsx(lM,{}),"添加"]})})]},`${K.skillId}:${K.version}`)}):o.jsx("div",{className:"session-capability-empty",children:"选择一个 Skill Space 查看技能"})})]})]})]})})}function Ta({as:e="span",className:t="",duration:n=4,spread:s=20,children:i,style:r,...a}){const l=Math.min(Math.max(s,5),45);return o.jsx(e,{className:`text-shimmer${t?` ${t}`:""}`,style:{...r,backgroundImage:`linear-gradient(to right, hsl(var(--muted-foreground)) ${50-l}%, hsl(var(--foreground)) 50%, hsl(var(--muted-foreground)) ${50+l}%)`,animationDuration:`${n}s`},...a,children:i})}function XU(e){return 1+e.children.reduce((t,n)=>t+XU(n),0)}function QU(e){return e.id||e.name}function Efe(e,t){const n=QU(e);if(e.id&&e.name&&e.name!==n)return e.name;if(t&&n==="agent")return"主 Agent";const s=/^agent_sub_(\d+)$/.exec(n);return s?`子 Agent ${s[1]}`:e.name||n}function ZU(e,t=!0){return{...e,id:QU(e),name:Efe(e,t),children:e.children.map(n=>ZU(n,!1))}}function JU(e){const t=wi();return{...t,name:e.name,description:e.description,instruction:e.instruction||t.instruction,agentType:e.type,modelName:e.model,tools:e.tools??[],skills:(e.skills??[]).map(n=>n.name),subAgents:e.children.map(JU)}}function vfe(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}function wfe(e){return[...new Map(e.filter(t=>t.name.trim()).map(t=>[t.name.trim(),{...t,name:t.name.trim()}])).values()]}function Jv({title:e,count:t}){return o.jsxs("div",{className:"topo-module-title",children:[o.jsx("span",{className:"topo-module-label",title:e,children:e}),t!==void 0&&o.jsx("span",{className:"topo-section-count","aria-label":`${t} 项`,children:t})]})}function Sfe({appName:e,info:t,loading:n,variant:s="rail",capabilities:i=null,capabilityLoading:r=!1,capabilityMutating:a=!1,builtinTools:l=[],onAddCapability:c,onRemoveCapability:u}){const[d,f]=g.useState(null),[h,p]=g.useState(!1),m=g.useRef(null),b=()=>{p(!1),window.requestAnimationFrame(()=>{var S;return(S=m.current)==null?void 0:S.focus()})};if(g.useEffect(()=>{if(!h)return;const S=document.body.style.overflow,k=T=>{T.key==="Escape"&&b()};return document.body.style.overflow="hidden",document.addEventListener("keydown",k),()=>{document.body.style.overflow=S,document.removeEventListener("keydown",k)}},[h]),n&&!t)return o.jsx("aside",{className:`topo is-loading${s==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息","aria-live":"polite",children:o.jsx(Ta,{as:"span",className:"topo-loading-label",duration:2.2,children:"正在读取 Agent 信息…"})});if(!t)return null;const v=ZU(t.graph??{id:t.name,name:t.name,description:t.description,type:t.type??"llm",model:t.model,tools:t.tools,skills:t.skills,path:[t.name],mentionable:!1,children:[]}),y=(i==null?void 0:i.tools)??vfe(t.tools).map(S=>({id:`base:tool:${S}`,kind:"tool",name:S,custom:!1})),x=(i==null?void 0:i.skills)??wfe(t.skills).map(S=>({id:`base:skill:${S.name}`,kind:"skill",name:S.name,description:S.description,custom:!1})),E=!!(i&&c&&u),w=JU(v),_=S=>o.jsx(Om,{draft:w,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},S);return o.jsxs(o.Fragment,{children:[o.jsxs("aside",{className:`topo${s==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息与拓扑",children:[o.jsxs("section",{className:"topo-agent-card","aria-label":"Agent 信息",children:[o.jsxs("div",{className:"topo-agent-heading",children:[o.jsx("h2",{title:t.name,children:t.name||"未命名 Agent"}),t.model&&o.jsx("span",{title:t.model,children:t.model})]}),t.description&&o.jsx("p",{className:"topo-description",title:t.description,children:t.description})]}),o.jsxs("div",{className:"topo-module-stack",children:[o.jsxs("section",{className:"topo-module-card topo-tools-card","aria-label":"工具",children:[o.jsx(Jv,{title:"工具",count:y.length}),o.jsx("div",{className:"topo-module-scroll topo-tools-scroll",role:"region","aria-label":"工具列表",tabIndex:0,children:y.length>0?o.jsx("div",{className:"topo-tool-list",children:y.map(S=>o.jsxs("div",{className:"topo-tool",title:S.name,children:[o.jsxs("span",{className:"topo-capability-title",children:[o.jsxs("span",{className:"topo-capability-copy",children:[o.jsx("span",{className:"topo-capability-name",children:Y_(S.name)}),o.jsx("code",{children:S.name})]}),S.custom&&o.jsx("span",{className:"topo-custom-badge",children:"自定义"})]}),S.custom&&o.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除工具 ${S.name}`,title:"移除",disabled:a,onClick:()=>u==null?void 0:u(S.id),children:"×"})]},S.id))}):o.jsx("div",{className:"topo-empty",children:"未配置"})}),E&&o.jsx("div",{className:"topo-capability-add-dock",children:o.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加内置工具",disabled:r||a,onClick:()=>f("tool"),children:[o.jsx("span",{"aria-hidden":"true",children:"+"}),o.jsx("span",{children:"在此对话中添加工具"})]})})]}),o.jsxs("section",{className:"topo-module-card topo-skills-card","aria-label":"技能",children:[o.jsx(Jv,{title:"技能",count:t.skillsPreviewSupported?x.length:void 0}),o.jsx("div",{className:"topo-module-scroll topo-skills-scroll",role:"region","aria-label":"技能列表",tabIndex:0,children:t.skillsPreviewSupported?x.length>0?o.jsx("div",{className:"topo-skill-list",children:x.map(S=>o.jsxs("div",{className:"topo-skill",title:S.description||S.name,children:[o.jsxs("div",{className:"topo-skill-title",children:[o.jsx("span",{className:"topo-skill-name",children:S.name}),S.custom&&o.jsx("span",{className:"topo-custom-badge",children:"自定义"}),S.custom&&o.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除技能 ${S.name}`,title:"移除",disabled:a,onClick:()=>u==null?void 0:u(S.id),children:"×"})]}),S.description&&o.jsx("span",{className:"topo-skill-description",children:S.description})]},`${S.name}:${S.description}`))}):o.jsx("div",{className:"topo-empty",children:"未配置"}):o.jsx("div",{className:"topo-empty",children:"暂不支持预览"})}),E&&o.jsx("div",{className:"topo-capability-add-dock",children:o.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加技能",disabled:r||a,onClick:()=>f("skill"),children:[o.jsx("span",{"aria-hidden":"true",children:"+"}),o.jsx("span",{children:"在此对话中添加技能"})]})})]}),o.jsxs("section",{className:"topo-module-card topo-topology","aria-label":"Agent 画布",children:[o.jsxs("div",{className:"topo-canvas-heading",children:[o.jsx(Jv,{title:"结构拓扑",count:XU(v)}),o.jsx("button",{ref:m,type:"button",className:"topo-canvas-expand","aria-label":"全屏查看 Agent 画布",title:"全屏查看",onClick:()=>p(!0),children:o.jsx(Yc,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-preview",role:"region","aria-label":"Agent 执行画布",children:_(`conversation-canvas:${e}`)})]})]}),d==="tool"&&c&&o.jsx(yfe,{agentName:t.name,tools:l,selectedNames:y.map(S=>S.name),mutating:a,onAdd:c,onClose:()=>f(null)}),d==="skill"&&c&&o.jsx(xfe,{appName:e,agentName:t.name,selectedNames:x.map(S=>S.name),mutating:a,onAdd:c,onClose:()=>f(null)})]}),h&&hi.createPortal(o.jsxs("section",{className:"topo-canvas-dialog",role:"dialog","aria-modal":"true","aria-label":"全屏 Agent 执行画布",children:[o.jsxs("header",{className:"topo-canvas-dialog-header",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"Agent 执行画布"}),o.jsx("span",{children:t.name})]}),o.jsx("button",{type:"button","aria-label":"关闭全屏画布",title:"关闭",onClick:b,autoFocus:!0,children:o.jsx(Ti,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-dialog-body",children:_(`conversation-canvas-fullscreen:${e}`)})]}),document.body)]})}function gMe(){}function cM(e){const t=[],n=String(e||"");let s=n.indexOf(","),i=0,r=!1;for(;!r;){s===-1&&(s=n.length,r=!0);const a=n.slice(i,s).trim();(a||!r)&&t.push(a),i=s+1,s=n.indexOf(",",i)}return t}function e7(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const _fe=/[$_\p{ID_Start}]/u,Nfe=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,Tfe=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,kfe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Afe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,t7={};function bMe(e){return e?_fe.test(String.fromCodePoint(e)):!1}function yMe(e,t){const s=(t||t7).jsx?Tfe:Nfe;return e?s.test(String.fromCodePoint(e)):!1}function uM(e,t){return(t7.jsx?Afe:kfe).test(e)}const Cfe=/[ \t\n\f\r]/g;function Ife(e){return typeof e=="object"?e.type==="text"?dM(e.value):!1:dM(e)}function dM(e){return e.replace(Cfe,"")===""}let xg=class{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}};xg.prototype.normal={};xg.prototype.property={};xg.prototype.space=void 0;function n7(e,t){const n={},s={};for(const i of e)Object.assign(n,i.property),Object.assign(s,i.normal);return new xg(n,s,t)}function Mm(e){return e.toLowerCase()}class dr{constructor(t,n){this.attribute=n,this.property=t}}dr.prototype.attribute="";dr.prototype.booleanish=!1;dr.prototype.boolean=!1;dr.prototype.commaOrSpaceSeparated=!1;dr.prototype.commaSeparated=!1;dr.prototype.defined=!1;dr.prototype.mustUseProperty=!1;dr.prototype.number=!1;dr.prototype.overloadedBoolean=!1;dr.prototype.property="";dr.prototype.spaceSeparated=!1;dr.prototype.space=void 0;let jfe=0;const Ut=Tu(),Ks=Tu(),W_=Tu(),Ue=Tu(),zn=Tu(),Qd=Tu(),gr=Tu();function Tu(){return 2**++jfe}const X_=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ut,booleanish:Ks,commaOrSpaceSeparated:gr,commaSeparated:Qd,number:Ue,overloadedBoolean:W_,spaceSeparated:zn},Symbol.toStringTag,{value:"Module"})),ew=Object.keys(X_);class xA extends dr{constructor(t,n,s,i){let r=-1;if(super(t,n),fM(this,"space",i),typeof s=="number")for(;++r4&&n.slice(0,4)==="data"&&Dfe.test(t)){if(t.charAt(4)==="-"){const r=t.slice(5).replace(hM,Bfe);s="data"+r.charAt(0).toUpperCase()+r.slice(1)}else{const r=t.slice(4);if(!hM.test(r)){let a=r.replace(Lfe,Pfe);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=xA}return new i(s,t)}function Pfe(e){return"-"+e.toLowerCase()}function Bfe(e){return e.charAt(1).toUpperCase()}const Eg=n7([s7,Rfe,a7,o7,l7],"html"),dc=n7([s7,Ofe,a7,o7,l7],"svg");function pM(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function c7(e){return e.join(" ").trim()}var EA={},mM=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Ufe=/\n/g,Ffe=/^\s*/,$fe=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Hfe=/^:\s*/,zfe=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Vfe=/^[;\s]*/,Gfe=/^\s+|\s+$/g,Kfe=` +`,gM="/",bM="*",Lc="",qfe="comment",Yfe="declaration";function Wfe(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,s=1;function i(m){var b=m.match(Ufe);b&&(n+=b.length);var v=m.lastIndexOf(Kfe);s=~v?m.length-v:s+m.length}function r(){var m={line:n,column:s};return function(b){return b.position=new a(m),u(),b}}function a(m){this.start=m,this.end={line:n,column:s},this.source=t.source}a.prototype.content=e;function l(m){var b=new Error(t.source+":"+n+":"+s+": "+m);if(b.reason=m,b.filename=t.source,b.line=n,b.column=s,b.source=e,!t.silent)throw b}function c(m){var b=m.exec(e);if(b){var v=b[0];return i(v),e=e.slice(v.length),b}}function u(){c(Ffe)}function d(m){var b;for(m=m||[];b=f();)b!==!1&&m.push(b);return m}function f(){var m=r();if(!(gM!=e.charAt(0)||bM!=e.charAt(1))){for(var b=2;Lc!=e.charAt(b)&&(bM!=e.charAt(b)||gM!=e.charAt(b+1));)++b;if(b+=2,Lc===e.charAt(b-1))return l("End of comment missing");var v=e.slice(2,b-2);return s+=2,i(v),e=e.slice(b),s+=2,m({type:qfe,comment:v})}}function h(){var m=r(),b=c($fe);if(b){if(f(),!c(Hfe))return l("property missing ':'");var v=c(zfe),y=m({type:Yfe,property:yM(b[0].replace(mM,Lc)),value:v?yM(v[0].replace(mM,Lc)):Lc});return c(Vfe),y}}function p(){var m=[];d(m);for(var b;b=h();)b!==!1&&(m.push(b),d(m));return m}return u(),p()}function yM(e){return e?e.replace(Gfe,Lc):Lc}var Xfe=Wfe,Qfe=Il&&Il.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(EA,"__esModule",{value:!0});EA.default=Jfe;const Zfe=Qfe(Xfe);function Jfe(e,t){let n=null;if(!e||typeof e!="string")return n;const s=(0,Zfe.default)(e),i=typeof t=="function";return s.forEach(r=>{if(r.type!=="declaration")return;const{property:a,value:l}=r;i?t(a,l,r):l&&(n=n||{},n[a]=l)}),n}var A1={};Object.defineProperty(A1,"__esModule",{value:!0});A1.camelCase=void 0;var ehe=/^--[a-zA-Z0-9_-]+$/,the=/-([a-z])/g,nhe=/^[^-]+$/,she=/^-(webkit|moz|ms|o|khtml)-/,ihe=/^-(ms)-/,rhe=function(e){return!e||nhe.test(e)||ehe.test(e)},ahe=function(e,t){return t.toUpperCase()},xM=function(e,t){return"".concat(t,"-")},ohe=function(e,t){return t===void 0&&(t={}),rhe(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(ihe,xM):e=e.replace(she,xM),e.replace(the,ahe))};A1.camelCase=ohe;var lhe=Il&&Il.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},che=lhe(EA),uhe=A1;function Q_(e,t){var n={};return!e||typeof e!="string"||(0,che.default)(e,function(s,i){s&&i&&(n[(0,uhe.camelCase)(s,t)]=i)}),n}Q_.default=Q_;var dhe=Q_;const fhe=Bf(dhe),C1=u7("end"),lo=u7("start");function u7(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function hhe(e){const t=lo(e),n=C1(e);if(t&&n)return{start:t,end:n}}function Hp(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?EM(e.position):"start"in e||"end"in e?EM(e):"line"in e||"column"in e?Z_(e):""}function Z_(e){return vM(e&&e.line)+":"+vM(e&&e.column)}function EM(e){return Z_(e&&e.start)+"-"+Z_(e&&e.end)}function vM(e){return e&&typeof e=="number"?e:1}class Di extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let i="",r={},a=!1;if(n&&("line"in n&&"column"in n?r={place:n}:"start"in n&&"end"in n?r={place:n}:"type"in n?r={ancestors:[n],place:n.position}:r={...n}),typeof t=="string"?i=t:!r.cause&&t&&(a=!0,i=t.message,r.cause=t),!r.ruleId&&!r.source&&typeof s=="string"){const c=s.indexOf(":");c===-1?r.ruleId=s:(r.source=s.slice(0,c),r.ruleId=s.slice(c+1))}if(!r.place&&r.ancestors&&r.ancestors){const c=r.ancestors[r.ancestors.length-1];c&&(r.place=c.position)}const l=r.place&&"start"in r.place?r.place.start:r.place;this.ancestors=r.ancestors||void 0,this.cause=r.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=Hp(r.place)||"1:1",this.place=r.place||void 0,this.reason=this.message,this.ruleId=r.ruleId||void 0,this.source=r.source||void 0,this.stack=a&&r.cause&&typeof r.cause.stack=="string"?r.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Di.prototype.file="";Di.prototype.name="";Di.prototype.reason="";Di.prototype.message="";Di.prototype.stack="";Di.prototype.column=void 0;Di.prototype.line=void 0;Di.prototype.ancestors=void 0;Di.prototype.cause=void 0;Di.prototype.fatal=void 0;Di.prototype.place=void 0;Di.prototype.ruleId=void 0;Di.prototype.source=void 0;const vA={}.hasOwnProperty,phe=new Map,mhe=/[A-Z]/g,ghe=new Set(["table","tbody","thead","tfoot","tr"]),bhe=new Set(["td","th"]),d7="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function yhe(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=The(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");s=Nhe(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,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"?dc:Eg,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},r=f7(i,e,void 0);return r&&typeof r!="string"?r:i.create(e,i.Fragment,{children:r||void 0},void 0)}function f7(e,t,n){if(t.type==="element")return xhe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Ehe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return whe(e,t,n);if(t.type==="mdxjsEsm")return vhe(e,t);if(t.type==="root")return She(e,t,n);if(t.type==="text")return _he(e,t)}function xhe(e,t,n){const s=e.schema;let i=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(i=dc,e.schema=i),e.ancestors.push(t);const r=p7(e,t.tagName,!1),a=khe(e,t);let l=SA(e,t);return ghe.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!Ife(c):!0})),h7(e,a,r,t),wA(a,l),e.ancestors.pop(),e.schema=s,e.create(t,r,a,n)}function Ehe(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}Lm(e,t.position)}function vhe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Lm(e,t.position)}function whe(e,t,n){const s=e.schema;let i=s;t.name==="svg"&&s.space==="html"&&(i=dc,e.schema=i),e.ancestors.push(t);const r=t.name===null?e.Fragment:p7(e,t.name,!0),a=Ahe(e,t),l=SA(e,t);return h7(e,a,r,t),wA(a,l),e.ancestors.pop(),e.schema=s,e.create(t,r,a,n)}function She(e,t,n){const s={};return wA(s,SA(e,t)),e.create(t,e.Fragment,s,n)}function _he(e,t){return t.value}function h7(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function wA(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Nhe(e,t,n){return s;function s(i,r,a,l){const u=Array.isArray(a.children)?n:t;return l?u(r,a,l):u(r,a)}}function The(e,t){return n;function n(s,i,r,a){const l=Array.isArray(r.children),c=lo(s);return t(i,r,a,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function khe(e,t){const n={};let s,i;for(i in t.properties)if(i!=="children"&&vA.call(t.properties,i)){const r=Che(e,i,t.properties[i]);if(r){const[a,l]=r;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&bhe.has(t.tagName)?s=l:n[a]=l}}if(s){const r=n.style||(n.style={});r[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function Ahe(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const r=s.data.estree.body[0];r.type;const a=r.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Lm(e,t.position);else{const i=s.name;let r;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const l=s.value.data.estree.body[0];l.type,r=e.evaluater.evaluateExpression(l.expression)}else Lm(e,t.position);else r=s.value===null?!0:s.value;n[i]=r}return n}function SA(e,t){const n=[];let s=-1;const i=e.passKeys?new Map:phe;for(;++si?0:i+t:t=t>i?i:t,n=n>0?n:0,s.length<1e4)a=Array.from(s),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);r0?(Cr(e,e.length,0,t),e):t}const _M={}.hasOwnProperty;function g7(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 ka(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Vi=fc(/[A-Za-z]/),Mi=fc(/[\dA-Za-z]/),Bhe=fc(/[#-'*+\--9=?A-Z^-~]/);function ox(e){return e!==null&&(e<32||e===127)}const J_=fc(/\d/),Uhe=fc(/[\dA-Fa-f]/),Fhe=fc(/[!-/:-@[-`{-~]/);function gt(e){return e!==null&&e<-2}function Un(e){return e!==null&&(e<0||e===32)}function Xt(e){return e===-2||e===-1||e===32}const I1=fc(new RegExp("\\p{P}|\\p{S}","u")),pu=fc(/\s/);function fc(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function sh(e){const t=[];let n=-1,s=0,i=0;for(;++n55295&&r<57344){const l=e.charCodeAt(n+1);r<56320&&l>56319&&l<57344?(a=String.fromCharCode(r,l),i=1):a="�"}else a=String.fromCharCode(r);a&&(t.push(e.slice(s,n),encodeURIComponent(a)),s=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(s)}function sn(e,t,n,s){const i=s?s-1:Number.POSITIVE_INFINITY;let r=0;return a;function a(c){return Xt(c)?(e.enter(n),l(c)):t(c)}function l(c){return Xt(c)&&r++a))return;const k=t.events.length;let T=k,C,I;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(C){I=t.events[T][1].end;break}C=!0}for(y(s),S=k;SE;){const _=n[w];t.containerState=_[1],_[0].exit.call(t,e)}n.length=E}function x(){i.write([null]),r=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Ghe(e,t,n){return sn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function If(e){if(e===null||Un(e)||pu(e))return 1;if(I1(e))return 2}function j1(e,t,n){const s=[];let i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[s][1].end},h={...e[n][1].start};TM(f,-c),TM(h,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[s][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},r={type:c>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[s][1].end={...a.start},e[n][1].start={...l.end},u=[],e[s][1].end.offset-e[s][1].start.offset&&(u=Vr(u,[["enter",e[s][1],t],["exit",e[s][1],t]])),u=Vr(u,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",r,t]]),u=Vr(u,j1(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),u=Vr(u,[["exit",r,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Vr(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Cr(e,s-1,n-s+3,u),n=s+u.length-d-2;break}}for(n=-1;++n0&&Xt(S)?sn(e,x,"linePrefix",r+1)(S):x(S)}function x(S){return S===null||gt(S)?e.check(kM,b,w)(S):(e.enter("codeFlowValue"),E(S))}function E(S){return S===null||gt(S)?(e.exit("codeFlowValue"),x(S)):(e.consume(S),E)}function w(S){return e.exit("codeFenced"),t(S)}function _(S,k,T){let C=0;return I;function I(F){return S.enter("lineEnding"),S.consume(F),S.exit("lineEnding"),j}function j(F){return S.enter("codeFencedFence"),Xt(F)?sn(S,L,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):L(F)}function L(F){return F===l?(S.enter("codeFencedFenceSequence"),z(F)):T(F)}function z(F){return F===l?(C++,S.consume(F),z):C>=a?(S.exit("codeFencedFenceSequence"),Xt(F)?sn(S,D,"whitespace")(F):D(F)):T(F)}function D(F){return F===null||gt(F)?(S.exit("codeFencedFence"),k(F)):T(F)}}}function spe(e,t,n){const s=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r)}function r(a){return s.parser.lazy[s.now().line]?n(a):t(a)}}const nw={name:"codeIndented",tokenize:rpe},ipe={partial:!0,tokenize:ape};function rpe(e,t,n){const s=this;return i;function i(u){return e.enter("codeIndented"),sn(e,r,"linePrefix",5)(u)}function r(u){const d=s.events[s.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?c(u):gt(u)?e.attempt(ipe,a,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||gt(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function ape(e,t,n){const s=this;return i;function i(a){return s.parser.lazy[s.now().line]?n(a):gt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):sn(e,r,"linePrefix",5)(a)}function r(a){const l=s.events[s.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):gt(a)?i(a):n(a)}}const ope={name:"codeText",previous:cpe,resolve:lpe,tokenize:upe};function lpe(e){let t=e.length-4,n=3,s,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s=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-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const i=n||0;this.setCursor(Math.trunc(t));const r=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return s&&zh(this.left,s),r.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),zh(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),zh(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(s.parser.constructs.flow,n,t)(a)}}function w7(e,t,n,s,i,r,a,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(y){return y===60?(e.enter(s),e.enter(i),e.enter(r),e.consume(y),e.exit(r),h):y===null||y===32||y===41||ox(y)?n(y):(e.enter(s),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(y))}function h(y){return y===62?(e.enter(r),e.consume(y),e.exit(r),e.exit(i),e.exit(s),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(l),h(y)):y===null||y===60||gt(y)?n(y):(e.consume(y),y===92?m:p)}function m(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function b(y){return!d&&(y===null||y===41||Un(y))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(s),t(y)):d999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(r),e.enter(i),e.consume(p),e.exit(i),e.exit(s),t):gt(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||gt(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!Xt(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function _7(e,t,n,s,i,r){let a;return l;function l(h){return h===34||h===39||h===40?(e.enter(s),e.enter(i),e.consume(h),e.exit(i),a=h===40?41:h,c):n(h)}function c(h){return h===a?(e.enter(i),e.consume(h),e.exit(i),e.exit(s),t):(e.enter(r),u(h))}function u(h){return h===a?(e.exit(r),c(a)):h===null?n(h):gt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),sn(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||gt(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 zp(e,t){let n;return s;function s(i){return gt(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,s):Xt(i)?sn(e,s,n?"linePrefix":"lineSuffix")(i):t(i)}}const ype={name:"definition",tokenize:Epe},xpe={partial:!0,tokenize:vpe};function Epe(e,t,n){const s=this;let i;return r;function r(p){return e.enter("definition"),a(p)}function a(p){return S7.call(s,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return i=ka(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return Un(p)?zp(e,u)(p):u(p)}function u(p){return w7(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(xpe,f,f)(p)}function f(p){return Xt(p)?sn(e,h,"whitespace")(p):h(p)}function h(p){return p===null||gt(p)?(e.exit("definition"),s.parser.defined.push(i),t(p)):n(p)}}function vpe(e,t,n){return s;function s(l){return Un(l)?zp(e,i)(l):n(l)}function i(l){return _7(e,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function r(l){return Xt(l)?sn(e,a,"whitespace")(l):a(l)}function a(l){return l===null||gt(l)?t(l):n(l)}}const wpe={name:"hardBreakEscape",tokenize:Spe};function Spe(e,t,n){return s;function s(r){return e.enter("hardBreakEscape"),e.consume(r),i}function i(r){return gt(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}const _pe={name:"headingAtx",resolve:Npe,tokenize:Tpe};function Npe(e,t){let n=e.length-2,s=3,i,r;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(i={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},r={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},Cr(e,s,n-s+1,[["enter",i,t],["enter",r,t],["exit",r,t],["exit",i,t]])),e}function Tpe(e,t,n){let s=0;return i;function i(d){return e.enter("atxHeading"),r(d)}function r(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&s++<6?(e.consume(d),a):d===null||Un(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||gt(d)?(e.exit("atxHeading"),t(d)):Xt(d)?sn(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Un(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const kpe=["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"],CM=["pre","script","style","textarea"],Ape={concrete:!0,name:"htmlFlow",resolveTo:jpe,tokenize:Rpe},Cpe={partial:!0,tokenize:Mpe},Ipe={partial:!0,tokenize:Ope};function jpe(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 Rpe(e,t,n){const s=this;let i,r,a,l,c;return u;function u(U){return d(U)}function d(U){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(U),f}function f(U){return U===33?(e.consume(U),h):U===47?(e.consume(U),r=!0,b):U===63?(e.consume(U),i=3,s.interrupt?t:R):Vi(U)?(e.consume(U),a=String.fromCharCode(U),v):n(U)}function h(U){return U===45?(e.consume(U),i=2,p):U===91?(e.consume(U),i=5,l=0,m):Vi(U)?(e.consume(U),i=4,s.interrupt?t:R):n(U)}function p(U){return U===45?(e.consume(U),s.interrupt?t:R):n(U)}function m(U){const te="CDATA[";return U===te.charCodeAt(l++)?(e.consume(U),l===te.length?s.interrupt?t:L:m):n(U)}function b(U){return Vi(U)?(e.consume(U),a=String.fromCharCode(U),v):n(U)}function v(U){if(U===null||U===47||U===62||Un(U)){const te=U===47,K=a.toLowerCase();return!te&&!r&&CM.includes(K)?(i=1,s.interrupt?t(U):L(U)):kpe.includes(a.toLowerCase())?(i=6,te?(e.consume(U),y):s.interrupt?t(U):L(U)):(i=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(U):r?x(U):E(U))}return U===45||Mi(U)?(e.consume(U),a+=String.fromCharCode(U),v):n(U)}function y(U){return U===62?(e.consume(U),s.interrupt?t:L):n(U)}function x(U){return Xt(U)?(e.consume(U),x):I(U)}function E(U){return U===47?(e.consume(U),I):U===58||U===95||Vi(U)?(e.consume(U),w):Xt(U)?(e.consume(U),E):I(U)}function w(U){return U===45||U===46||U===58||U===95||Mi(U)?(e.consume(U),w):_(U)}function _(U){return U===61?(e.consume(U),S):Xt(U)?(e.consume(U),_):E(U)}function S(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(e.consume(U),c=U,k):Xt(U)?(e.consume(U),S):T(U)}function k(U){return U===c?(e.consume(U),c=null,C):U===null||gt(U)?n(U):(e.consume(U),k)}function T(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||Un(U)?_(U):(e.consume(U),T)}function C(U){return U===47||U===62||Xt(U)?E(U):n(U)}function I(U){return U===62?(e.consume(U),j):n(U)}function j(U){return U===null||gt(U)?L(U):Xt(U)?(e.consume(U),j):n(U)}function L(U){return U===45&&i===2?(e.consume(U),A):U===60&&i===1?(e.consume(U),M):U===62&&i===4?(e.consume(U),Y):U===63&&i===3?(e.consume(U),R):U===93&&i===5?(e.consume(U),H):gt(U)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Cpe,J,z)(U)):U===null||gt(U)?(e.exit("htmlFlowData"),z(U)):(e.consume(U),L)}function z(U){return e.check(Ipe,D,J)(U)}function D(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),F}function F(U){return U===null||gt(U)?z(U):(e.enter("htmlFlowData"),L(U))}function A(U){return U===45?(e.consume(U),R):L(U)}function M(U){return U===47?(e.consume(U),a="",P):L(U)}function P(U){if(U===62){const te=a.toLowerCase();return CM.includes(te)?(e.consume(U),Y):L(U)}return Vi(U)&&a.length<8?(e.consume(U),a+=String.fromCharCode(U),P):L(U)}function H(U){return U===93?(e.consume(U),R):L(U)}function R(U){return U===62?(e.consume(U),Y):U===45&&i===2?(e.consume(U),R):L(U)}function Y(U){return U===null||gt(U)?(e.exit("htmlFlowData"),J(U)):(e.consume(U),Y)}function J(U){return e.exit("htmlFlow"),t(U)}}function Ope(e,t,n){const s=this;return i;function i(a){return gt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r):n(a)}function r(a){return s.parser.lazy[s.now().line]?n(a):t(a)}}function Mpe(e,t,n){return s;function s(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(vg,t,n)}}const Lpe={name:"htmlText",tokenize:Dpe};function Dpe(e,t,n){const s=this;let i,r,a;return l;function l(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),c}function c(R){return R===33?(e.consume(R),u):R===47?(e.consume(R),_):R===63?(e.consume(R),E):Vi(R)?(e.consume(R),T):n(R)}function u(R){return R===45?(e.consume(R),d):R===91?(e.consume(R),r=0,m):Vi(R)?(e.consume(R),x):n(R)}function d(R){return R===45?(e.consume(R),p):n(R)}function f(R){return R===null?n(R):R===45?(e.consume(R),h):gt(R)?(a=f,M(R)):(e.consume(R),f)}function h(R){return R===45?(e.consume(R),p):f(R)}function p(R){return R===62?A(R):R===45?h(R):f(R)}function m(R){const Y="CDATA[";return R===Y.charCodeAt(r++)?(e.consume(R),r===Y.length?b:m):n(R)}function b(R){return R===null?n(R):R===93?(e.consume(R),v):gt(R)?(a=b,M(R)):(e.consume(R),b)}function v(R){return R===93?(e.consume(R),y):b(R)}function y(R){return R===62?A(R):R===93?(e.consume(R),y):b(R)}function x(R){return R===null||R===62?A(R):gt(R)?(a=x,M(R)):(e.consume(R),x)}function E(R){return R===null?n(R):R===63?(e.consume(R),w):gt(R)?(a=E,M(R)):(e.consume(R),E)}function w(R){return R===62?A(R):E(R)}function _(R){return Vi(R)?(e.consume(R),S):n(R)}function S(R){return R===45||Mi(R)?(e.consume(R),S):k(R)}function k(R){return gt(R)?(a=k,M(R)):Xt(R)?(e.consume(R),k):A(R)}function T(R){return R===45||Mi(R)?(e.consume(R),T):R===47||R===62||Un(R)?C(R):n(R)}function C(R){return R===47?(e.consume(R),A):R===58||R===95||Vi(R)?(e.consume(R),I):gt(R)?(a=C,M(R)):Xt(R)?(e.consume(R),C):A(R)}function I(R){return R===45||R===46||R===58||R===95||Mi(R)?(e.consume(R),I):j(R)}function j(R){return R===61?(e.consume(R),L):gt(R)?(a=j,M(R)):Xt(R)?(e.consume(R),j):C(R)}function L(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),i=R,z):gt(R)?(a=L,M(R)):Xt(R)?(e.consume(R),L):(e.consume(R),D)}function z(R){return R===i?(e.consume(R),i=void 0,F):R===null?n(R):gt(R)?(a=z,M(R)):(e.consume(R),z)}function D(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Un(R)?C(R):(e.consume(R),D)}function F(R){return R===47||R===62||Un(R)?C(R):n(R)}function A(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function M(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),P}function P(R){return Xt(R)?sn(e,H,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):H(R)}function H(R){return e.enter("htmlTextData"),a(R)}}const TA={name:"labelEnd",resolveAll:Fpe,resolveTo:$pe,tokenize:Hpe},Ppe={tokenize:zpe},Bpe={tokenize:Vpe},Upe={tokenize:Gpe};function Fpe(e){let t=-1;const n=[];for(;++t=3&&(u===null||gt(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===i?(e.consume(u),s++,c):(e.exit("thematicBreakSequence"),Xt(u)?sn(e,l,"whitespace")(u):l(u))}}const tr={continuation:{tokenize:tme},exit:sme,name:"list",tokenize:eme},Zpe={partial:!0,tokenize:ime},Jpe={partial:!0,tokenize:nme};function eme(e,t,n){const s=this,i=s.events[s.events.length-1];let r=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return l;function l(p){const m=s.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!s.containerState.marker||p===s.containerState.marker:J_(p)){if(s.containerState.type||(s.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Gb,n,u)(p):u(p);if(!s.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return J_(p)&&++a<10?(e.consume(p),c):(!s.interrupt||a<2)&&(s.containerState.marker?p===s.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"),s.containerState.marker=s.containerState.marker||p,e.check(vg,s.interrupt?n:d,e.attempt(Zpe,h,f))}function d(p){return s.containerState.initialBlankLine=!0,r++,h(p)}function f(p){return Xt(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return s.containerState.size=r+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function tme(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(vg,i,r);function i(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,sn(e,t,"listItemIndent",s.containerState.size+1)(l)}function r(l){return s.containerState.furtherBlankLines||!Xt(l)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,a(l)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(Jpe,t,a)(l))}function a(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,sn(e,e.attempt(tr,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function nme(e,t,n){const s=this;return sn(e,i,"listItemIndent",s.containerState.size+1);function i(r){const a=s.events[s.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===s.containerState.size?t(r):n(r)}}function sme(e){e.exit(this.containerState.type)}function ime(e,t,n){const s=this;return sn(e,i,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(r){const a=s.events[s.events.length-1];return!Xt(r)&&a&&a[1].type==="listItemPrefixWhitespace"?t(r):n(r)}}const IM={name:"setextUnderline",resolveTo:rme,tokenize:ame};function rme(e,t){let n=e.length,s,i,r;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!r&&e[n][1].type==="definition"&&(r=n);const a={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",r?(e.splice(i,0,["enter",a,t]),e.splice(r+1,0,["exit",e[s][1],t]),e[s][1].end={...e[r][1].end}):e[s][1]=a,e.push(["exit",a,t]),e}function ame(e,t,n){const s=this;let i;return r;function r(u){let d=s.events.length,f;for(;d--;)if(s.events[d][1].type!=="lineEnding"&&s.events[d][1].type!=="linePrefix"&&s.events[d][1].type!=="content"){f=s.events[d][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||f)?(e.enter("setextHeadingLine"),i=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===i?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),Xt(u)?sn(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||gt(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const ome={tokenize:lme};function lme(e){const t=this,n=e.attempt(vg,s,e.attempt(this.parser.constructs.flowInitial,i,sn(e,e.attempt(this.parser.constructs.flow,i,e.attempt(hpe,i)),"linePrefix")));return n;function s(r){if(r===null){e.consume(r);return}return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const cme={resolveAll:T7()},ume=N7("string"),dme=N7("text");function N7(e){return{resolveAll:T7(e==="text"?fme:void 0),tokenize:t};function t(n){const s=this,i=this.parser.constructs[e],r=n.attempt(i,a,l);return a;function a(d){return u(d)?r(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),r(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=i[d];let h=-1;if(f)for(;++h-1){const l=a[0];typeof l=="string"?a[0]=l.slice(s):a.shift()}r>0&&a.push(e[i].slice(0,r))}return a}function Nme(e,t){let n=-1;const s=[];let i;for(;++n0){const Ke=ne.tokenStack[ne.tokenStack.length-1];(Ke[1]||AM).call(ne,void 0,Ke[0])}for(ae.position={start:dl(Z.length>0?Z[0][1].start:{line:1,column:1,offset:0}),end:dl(Z.length>0?Z[Z.length-2][1].end:{line:1,column:1,offset:0})},Fe=-1;++Fe0&&(s.className=["language-"+i[0]]);let r={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(r.data={meta:t.meta}),e.patch(t,r),r=e.applyData(t,r),r={type:"element",tagName:"pre",properties:{},children:[r]},e.patch(t,r),r}function Lme(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Dme(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Pme(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),i=th(s.toLowerCase()),r=e.footnoteOrder.indexOf(s);let a,l=e.footnoteCounts.get(s);l===void 0?(l=0,e.footnoteOrder.push(s),a=e.footnoteOrder.length):a=r+1,l+=1,e.footnoteCounts.set(s,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function Bme(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 Ume(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function N7(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const i=e.all(t),r=i[0];r&&r.type==="text"?r.value="["+r.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=s:i.push({type:"text",value:s}),i}function Fme(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return N7(e,t);const i={src:th(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(i.title=s.title);const r={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,r),e.applyData(t,r)}function $me(e,t){const n={src:th(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 s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function Hme(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function zme(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return N7(e,t);const i={href:th(s.url||"")};s.title!==null&&s.title!==void 0&&(i.title=s.title);const r={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Vme(e,t){const n={href:th(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function Gme(e,t,n){const s=e.all(t),i=n?Kme(n):T7(t),r={},a=[];if(typeof t.checked=="boolean"){const d=s[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},s.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:[]}),r.className=["task-list-item"]}let l=-1;for(;++l0){const at=ne.tokenStack[ne.tokenStack.length-1];(at[1]||RM).call(ne,void 0,at[0])}for(ae.position={start:gl(Z.length>0?Z[0][1].start:{line:1,column:1,offset:0}),end:gl(Z.length>0?Z[Z.length-2][1].end:{line:1,column:1,offset:0})},Fe=-1;++Fe0&&(s.className=["language-"+i[0]]);let r={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(r.data={meta:t.meta}),e.patch(t,r),r=e.applyData(t,r),r={type:"element",tagName:"pre",properties:{},children:[r]},e.patch(t,r),r}function Ume(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Fme(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $me(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),i=sh(s.toLowerCase()),r=e.footnoteOrder.indexOf(s);let a,l=e.footnoteCounts.get(s);l===void 0?(l=0,e.footnoteOrder.push(s),a=e.footnoteOrder.length):a=r+1,l+=1,e.footnoteCounts.set(s,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function Hme(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 zme(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function C7(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const i=e.all(t),r=i[0];r&&r.type==="text"?r.value="["+r.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=s:i.push({type:"text",value:s}),i}function Vme(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return C7(e,t);const i={src:sh(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(i.title=s.title);const r={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,r),e.applyData(t,r)}function Gme(e,t){const n={src:sh(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 s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function Kme(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function qme(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return C7(e,t);const i={href:sh(s.url||"")};s.title!==null&&s.title!==void 0&&(i.title=s.title);const r={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Yme(e,t){const n={href:sh(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function Wme(e,t,n){const s=e.all(t),i=n?Xme(n):I7(t),r={},a=[];if(typeof t.checked=="boolean"){const d=s[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},s.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:[]}),r.className=["task-list-item"]}let l=-1;for(;++l1}function qme(e,t){const n={},s=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)},l=lo(t.children[1]),c=k1(t.children[t.children.length-1]);l&&c&&(a.position={start:l,end:c}),i.push(a)}const r={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,r),e.applyData(t,r)}function Zme(e,t,n){const s=n?n.children:void 0,r=(s?s.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:t.children.length;let c=-1;const u=[];for(;++c0,!0),s[0]),i=s.index+s[0].length,s=n.exec(t);return r.push(jM(t.slice(i),i>0,!1)),r.join("")}function jM(e,t,n){let s=0,i=e.length;if(t){let r=e.codePointAt(s);for(;r===CM||r===IM;)s++,r=e.codePointAt(s)}if(n){let r=e.codePointAt(i-1);for(;r===CM||r===IM;)i--,r=e.codePointAt(i-1)}return i>s?e.slice(s,i):""}function tge(e,t){const n={type:"text",value:ege(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function nge(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const sge={blockquote:Rme,break:Ome,code:Mme,delete:Lme,emphasis:Dme,footnoteReference:Pme,heading:Bme,html:Ume,imageReference:Fme,image:$me,inlineCode:Hme,linkReference:zme,link:Vme,listItem:Gme,list:qme,paragraph:Yme,root:Wme,strong:Xme,table:Qme,tableCell:Jme,tableRow:Zme,text:tge,thematicBreak:nge,toml:$0,yaml:$0,definition:$0,footnoteDefinition:$0};function $0(){}const k7=-1,I1=0,Gp=1,ax=2,SA=3,_A=4,NA=5,TA=6,A7=7,C7=8,ige=typeof self=="object"?self:globalThis,RM=(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 ige[e](t)},rge=(e,t)=>{const n=(i,r)=>(e.set(r,i),i),s=i=>{if(e.has(i))return e.get(i);const[r,a]=t[i];switch(r){case I1:case k7:return n(a,i);case Gp:{const l=n([],i);for(const c of a)l.push(s(c));return l}case ax:{const l=n({},i);for(const[c,u]of a)l[s(c)]=s(u);return l}case SA:return n(new Date(a),i);case _A:{const{source:l,flags:c}=a;return n(new RegExp(l,c),i)}case NA:{const l=n(new Map,i);for(const[c,u]of a)l.set(s(c),s(u));return l}case TA:{const l=n(new Set,i);for(const c of a)l.add(s(c));return l}case A7:{const{name:l,message:c}=a;return n(RM(l,c),i)}case C7: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:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(RM(r,a),i)};return s},OM=e=>rge(new Map,e)(0),Ku="",{toString:age}={},{keys:oge}=Object,Gh=e=>{const t=typeof e;if(t!=="object"||!e)return[I1,t];const n=age.call(e).slice(8,-1);switch(n){case"Array":return[Gp,Ku];case"Object":return[ax,Ku];case"Date":return[SA,Ku];case"RegExp":return[_A,Ku];case"Map":return[NA,Ku];case"Set":return[TA,Ku];case"DataView":return[Gp,n]}return n.includes("Array")?[Gp,n]:n.includes("Error")?[A7,n]:[ax,n]},H0=([e,t])=>e===I1&&(t==="function"||t==="symbol"),lge=(e,t,n,s)=>{const i=(a,l)=>{const c=s.push(a)-1;return n.set(l,c),c},r=a=>{if(n.has(a))return n.get(a);let[l,c]=Gh(a);switch(l){case I1:{let d=a;switch(c){case"bigint":l=C7,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return i([k7],a)}return i([l,d],a)}case Gp:{if(c){let h=a;return c==="DataView"?h=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(a)),i([c,[...h]],a)}const d=[],f=i([l,d],a);for(const h of a)d.push(r(h));return f}case ax:{if(c)switch(c){case"BigInt":return i([c,a.toString()],a);case"Boolean":case"Number":case"String":return i([c,a.valueOf()],a)}if(t&&"toJSON"in a)return r(a.toJSON());const d=[],f=i([l,d],a);for(const h of oge(a))(e||!H0(Gh(a[h])))&&d.push([r(h),r(a[h])]);return f}case SA:return i([l,a.toISOString()],a);case _A:{const{source:d,flags:f}=a;return i([l,{source:d,flags:f}],a)}case NA:{const d=[],f=i([l,d],a);for(const[h,p]of a)(e||!(H0(Gh(h))||H0(Gh(p))))&&d.push([r(h),r(p)]);return f}case TA:{const d=[],f=i([l,d],a);for(const h of a)(e||!H0(Gh(h)))&&d.push(r(h));return f}}const{message:u}=a;return i([l,{name:c,message:u}],a)};return r},MM=(e,{json:t,lossy:n}={})=>{const s=[];return lge(!(t||n),!!t,new Map,s)(e),s},Cf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?OM(MM(e,t)):structuredClone(e):(e,t)=>OM(MM(e,t));function cge(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 uge(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function dge(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||cge,s=e.options.footnoteBackLabel||uge,i=e.options.footnoteLabel||"Footnotes",r=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&m.push({type:"text",value:" "});let x=typeof n=="string"?n:n(c,p);typeof x=="string"&&(x={type:"text",value:x}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(c,p),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const v=d[d.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const x=v.children[v.children.length-1];x&&x.type==="text"?x.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...m)}else d.push(...m);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:r,properties:{...Cf(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` +`});const u={type:"element",tagName:"li",properties:r,children:a};return e.patch(t,u),e.applyData(t,u)}function Xme(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s1}function Qme(e,t){const n={},s=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)},l=lo(t.children[1]),c=C1(t.children[t.children.length-1]);l&&c&&(a.position={start:l,end:c}),i.push(a)}const r={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,r),e.applyData(t,r)}function nge(e,t,n){const s=n?n.children:void 0,r=(s?s.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:t.children.length;let c=-1;const u=[];for(;++c0,!0),s[0]),i=s.index+s[0].length,s=n.exec(t);return r.push(LM(t.slice(i),i>0,!1)),r.join("")}function LM(e,t,n){let s=0,i=e.length;if(t){let r=e.codePointAt(s);for(;r===OM||r===MM;)s++,r=e.codePointAt(s)}if(n){let r=e.codePointAt(i-1);for(;r===OM||r===MM;)i--,r=e.codePointAt(i-1)}return i>s?e.slice(s,i):""}function rge(e,t){const n={type:"text",value:ige(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function age(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const oge={blockquote:Dme,break:Pme,code:Bme,delete:Ume,emphasis:Fme,footnoteReference:$me,heading:Hme,html:zme,imageReference:Vme,image:Gme,inlineCode:Kme,linkReference:qme,link:Yme,listItem:Wme,list:Qme,paragraph:Zme,root:Jme,strong:ege,table:tge,tableCell:sge,tableRow:nge,text:rge,thematicBreak:age,toml:z0,yaml:z0,definition:z0,footnoteDefinition:z0};function z0(){}const j7=-1,R1=0,Vp=1,lx=2,kA=3,AA=4,CA=5,IA=6,R7=7,O7=8,lge=typeof self=="object"?self:globalThis,DM=(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 lge[e](t)},cge=(e,t)=>{const n=(i,r)=>(e.set(r,i),i),s=i=>{if(e.has(i))return e.get(i);const[r,a]=t[i];switch(r){case R1:case j7:return n(a,i);case Vp:{const l=n([],i);for(const c of a)l.push(s(c));return l}case lx:{const l=n({},i);for(const[c,u]of a)l[s(c)]=s(u);return l}case kA:return n(new Date(a),i);case AA:{const{source:l,flags:c}=a;return n(new RegExp(l,c),i)}case CA:{const l=n(new Map,i);for(const[c,u]of a)l.set(s(c),s(u));return l}case IA:{const l=n(new Set,i);for(const c of a)l.add(s(c));return l}case R7:{const{name:l,message:c}=a;return n(DM(l,c),i)}case O7: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:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(DM(r,a),i)};return s},PM=e=>cge(new Map,e)(0),Yu="",{toString:uge}={},{keys:dge}=Object,Vh=e=>{const t=typeof e;if(t!=="object"||!e)return[R1,t];const n=uge.call(e).slice(8,-1);switch(n){case"Array":return[Vp,Yu];case"Object":return[lx,Yu];case"Date":return[kA,Yu];case"RegExp":return[AA,Yu];case"Map":return[CA,Yu];case"Set":return[IA,Yu];case"DataView":return[Vp,n]}return n.includes("Array")?[Vp,n]:n.includes("Error")?[R7,n]:[lx,n]},V0=([e,t])=>e===R1&&(t==="function"||t==="symbol"),fge=(e,t,n,s)=>{const i=(a,l)=>{const c=s.push(a)-1;return n.set(l,c),c},r=a=>{if(n.has(a))return n.get(a);let[l,c]=Vh(a);switch(l){case R1:{let d=a;switch(c){case"bigint":l=O7,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return i([j7],a)}return i([l,d],a)}case Vp:{if(c){let h=a;return c==="DataView"?h=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(a)),i([c,[...h]],a)}const d=[],f=i([l,d],a);for(const h of a)d.push(r(h));return f}case lx:{if(c)switch(c){case"BigInt":return i([c,a.toString()],a);case"Boolean":case"Number":case"String":return i([c,a.valueOf()],a)}if(t&&"toJSON"in a)return r(a.toJSON());const d=[],f=i([l,d],a);for(const h of dge(a))(e||!V0(Vh(a[h])))&&d.push([r(h),r(a[h])]);return f}case kA:return i([l,a.toISOString()],a);case AA:{const{source:d,flags:f}=a;return i([l,{source:d,flags:f}],a)}case CA:{const d=[],f=i([l,d],a);for(const[h,p]of a)(e||!(V0(Vh(h))||V0(Vh(p))))&&d.push([r(h),r(p)]);return f}case IA:{const d=[],f=i([l,d],a);for(const h of a)(e||!V0(Vh(h)))&&d.push(r(h));return f}}const{message:u}=a;return i([l,{name:c,message:u}],a)};return r},BM=(e,{json:t,lossy:n}={})=>{const s=[];return fge(!(t||n),!!t,new Map,s)(e),s},jf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?PM(BM(e,t)):structuredClone(e):(e,t)=>PM(BM(e,t));function hge(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 pge(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function mge(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||hge,s=e.options.footnoteBackLabel||pge,i=e.options.footnoteLabel||"Footnotes",r=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&m.push({type:"text",value:" "});let x=typeof n=="string"?n:n(c,p);typeof x=="string"&&(x={type:"text",value:x}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(c,p),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const v=d[d.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const x=v.children[v.children.length-1];x&&x.type==="text"?x.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...m)}else d.push(...m);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:r,properties:{...jf(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:` -`}]}}const Sg=function(e){if(e==null)return mge;if(typeof e=="function")return j1(e);if(typeof e=="object")return Array.isArray(e)?fge(e):hge(e);if(typeof e=="string")return pge(e);throw new Error("Expected function, string, or object as test")};function fge(e){const t=[];let n=-1;for(;++n":""))+")"})}return h;function h(){let p=I7,m,b,v;if((!t||r(c,u,d[d.length-1]||void 0))&&(p=xge(n(c,d)),p[0]===Q_))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==yge)for(b=(s?y.children.length:-1)+a,v=d.concat(y);b>-1&&b":""))+")"})}return h;function h(){let p=M7,m,b,v;if((!t||r(c,u,d[d.length-1]||void 0))&&(p=Sge(n(c,d)),p[0]===tN))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==wge)for(b=(s?y.children.length:-1)+a,v=d.concat(y);b>-1&&b0&&n.push({type:"text",value:` -`}),n}function LM(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function DM(e,t){const n=vge(e,t),s=n.one(e,void 0),i=dge(n),r=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return i&&r.children.push({type:"text",value:` -`},i),r}function Tge(e,t){return e&&"run"in e?async function(n,s){const i=DM(n,{file:s,...t});await e.run(i,s)}:function(n,s){return DM(n,{file:s,...e||t})}}function PM(e){if(e)throw e}var Vb=Object.prototype.hasOwnProperty,R7=Object.prototype.toString,BM=Object.defineProperty,UM=Object.getOwnPropertyDescriptor,FM=function(t){return typeof Array.isArray=="function"?Array.isArray(t):R7.call(t)==="[object Array]"},$M=function(t){if(!t||R7.call(t)!=="[object Object]")return!1;var n=Vb.call(t,"constructor"),s=t.constructor&&t.constructor.prototype&&Vb.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!s)return!1;var i;for(i in t);return typeof i>"u"||Vb.call(t,i)},HM=function(t,n){BM&&n.name==="__proto__"?BM(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},zM=function(t,n){if(n==="__proto__")if(Vb.call(t,n)){if(UM)return UM(t,n).value}else return;return t[n]},kge=function e(){var t,n,s,i,r,a,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});ca.length;let c;l&&a.push(i);try{c=e.apply(this,a)}catch(u){const d=u;if(l&&n)throw d;return i(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(r,i):c instanceof Error?i(c):r(c))}function i(a,...l){n||(n=!0,t(a,...l))}function r(a){i(null,a)}}const Ka={basename:Ige,dirname:jge,extname:Rge,join:Oge,sep:"/"};function Ige(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ng(e);let n=0,s=-1,i=e.length,r;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(r){n=i+1;break}}else s<0&&(r=!0,s=i+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let a=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(r){n=i+1;break}}else a<0&&(r=!0,a=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(s=i):(l=-1,s=a));return n===s?s=a:s<0&&(s=e.length),e.slice(n,s)}function jge(e){if(Ng(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Rge(e){Ng(e);let t=e.length,n=-1,s=0,i=-1,r=0,a;for(;t--;){const l=e.codePointAt(t);if(l===47){if(a){s=t+1;break}continue}n<0&&(a=!0,n=t+1),l===46?i<0?i=t:r!==1&&(r=1):i>-1&&(r=-1)}return i<0||n<0||r===0||r===1&&i===n-1&&i===s+1?"":e.slice(i,n)}function Oge(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Lge(e,t){let n="",s=0,i=-1,r=0,a=-1,l,c;for(;++a<=e.length;){if(a2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",s=0):(n=n.slice(0,c),s=n.length-1-n.lastIndexOf("/")),i=a,r=0;continue}}else if(n.length>0){n="",s=0,i=a,r=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),s=a-i-1;i=a,r=0}else l===46&&r>-1?r++:r=-1}return n}function Ng(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Dge={cwd:Pge};function Pge(){return"/"}function eN(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Bge(e){if(typeof e=="string")e=new URL(e);else if(!eN(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 Uge(e)}function Uge(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n0){let[p,...m]=d;const b=s[h][1];J_(b)&&J_(p)&&(p=tw(!0,b,p)),s[h]=[u,p,...m]}}}}const zge=new kA().freeze();function rw(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function aw(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ow(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 GM(e){if(!J_(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function KM(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function z0(e){return Vge(e)?e:new O7(e)}function Vge(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Gge(e){return typeof e=="string"||Kge(e)}function Kge(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const qge="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",qM=[],YM={allowDangerousHtml:!0},Yge=/^(https?|ircs?|mailto|xmpp)$/i,Wge=[{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 Xge(e){const t=Qge(e),n=Zge(e);return Jge(t.runSync(t.parse(n),n),e)}function Qge(e){const t=e.rehypePlugins||qM,n=e.remarkPlugins||qM,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...YM}:YM;return zge().use(jme).use(n).use(Tge,s).use(t)}function Zge(e){const t=e.children||"",n=new O7;return typeof t=="string"&&(n.value=t),n}function Jge(e,t){const n=t.allowedElements,s=t.allowElement,i=t.components,r=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||e0e;for(const d of Wge)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+qge+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),_g(e,u),phe(e,{Fragment:o.Fragment,components:i,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.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 Zv)if(Object.hasOwn(Zv,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],b=Zv[p];(b===null||b.includes(d.tagName))&&(d.properties[p]=c(String(m||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):r?r.includes(d.tagName):!1;if(!p&&s&&typeof f=="number"&&(p=!s(d,f,h)),p&&h&&typeof f=="number")return l&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function e0e(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||s!==-1&&t>s||Yge.test(e.slice(0,t))?e:""}function WM(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,i=n.indexOf(t);for(;i!==-1;)s++,i=n.indexOf(t,i+t.length);return s}function t0e(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function n0e(e,t,n){const i=Sg((n||{}).ignore||[]),r=s0e(t);let a=-1;for(;++a0?{type:"text",value:S}:void 0),S===!1?h.lastIndex=w+1:(m!==w&&x.push({type:"text",value:u.value.slice(m,w)}),Array.isArray(S)?x.push(...S):S&&x.push(S),m=w+E[0].length,y=!0),!h.global)break;E=h.exec(u.value)}return y?(m?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const i=WM(e,"(");let r=WM(e,")");for(;s!==-1&&i>r;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),r++;return[e,n]}function M7(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||hu(n)||A1(n))&&(!t||n!==47)}L7.peek=T0e;function y0e(){this.buffer()}function x0e(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function E0e(){this.buffer()}function v0e(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function w0e(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Aa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function S0e(e){this.exit(e)}function _0e(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Aa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function N0e(e){this.exit(e)}function T0e(){return"["}function L7(e,t,n,s){const i=n.createTracker(s);let r=i.move("[^");const a=n.enter("footnoteReference"),l=n.enter("reference");return r+=i.move(n.safe(n.associationId(e),{after:"]",before:r})),l(),a(),r+=i.move("]"),r}function k0e(){return{enter:{gfmFootnoteCallString:y0e,gfmFootnoteCall:x0e,gfmFootnoteDefinitionLabelString:E0e,gfmFootnoteDefinition:v0e},exit:{gfmFootnoteCallString:w0e,gfmFootnoteCall:S0e,gfmFootnoteDefinitionLabelString:_0e,gfmFootnoteDefinition:N0e}}}function A0e(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:L7},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,i,r,a){const l=r.createTracker(a);let c=l.move("[^");const u=r.enter("footnoteDefinition"),d=r.enter("label");return c+=l.move(r.safe(r.associationId(s),{before:c,after:"]"})),d(),c+=l.move("]:"),s.children&&s.children.length>0&&(l.shift(4),c+=l.move((t?` -`:" ")+r.indentLines(r.containerFlow(s,l.current()),t?D7:C0e))),u(),c}}function C0e(e,t,n){return t===0?e:D7(e,t,n)}function D7(e,t,n){return(n?"":" ")+e}const I0e=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];P7.peek=L0e;function j0e(){return{canContainEols:["delete"],enter:{strikethrough:O0e},exit:{strikethrough:M0e}}}function R0e(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:I0e}],handlers:{delete:P7}}}function O0e(e){this.enter({type:"delete",children:[]},e)}function M0e(e){this.exit(e)}function P7(e,t,n,s){const i=n.createTracker(s),r=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),r(),a}function L0e(){return"~"}function D0e(e){return e.length}function P0e(e,t){const n=t||{},s=(n.align||[]).concat(),i=n.stringLength||D0e,r=[],a=[],l=[],c=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++yc[y])&&(c[y]=E)}b.push(x)}a[d]=b,l[d]=v}let f=-1;if(typeof s=="object"&&"length"in s)for(;++fc[f]&&(c[f]=x),p[f]=x),h[f]=E}a.splice(1,0,h),l.splice(1,0,p),d=-1;const m=[];for(;++d "),r.shift(2);const a=n.indentLines(n.containerFlow(e,r.current()),F0e);return i(),a}function F0e(e,t,n){return">"+(n?"":" ")+e}function $0e(e,t){return ZM(e,t.inConstruct,!0)&&!ZM(e,t.notInConstruct,!1)}function ZM(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++sa&&(a=r):r=1,i=s+t.length,s=n.indexOf(t,i);return a}function z0e(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 V0e(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 G0e(e,t,n,s){const i=V0e(n),r=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(z0e(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(r,K0e);return f(),h}const l=n.createTracker(s),c=i.repeat(Math.max(H0e(r,i)+1,3)),u=n.enter("codeFenced");let d=l.move(c);if(e.lang){const f=n.enter(`codeFencedLang${a}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${a}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:` +`}),n}function UM(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function FM(e,t){const n=Nge(e,t),s=n.one(e,void 0),i=mge(n),r=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return i&&r.children.push({type:"text",value:` +`},i),r}function Ige(e,t){return e&&"run"in e?async function(n,s){const i=FM(n,{file:s,...t});await e.run(i,s)}:function(n,s){return FM(n,{file:s,...e||t})}}function $M(e){if(e)throw e}var Kb=Object.prototype.hasOwnProperty,D7=Object.prototype.toString,HM=Object.defineProperty,zM=Object.getOwnPropertyDescriptor,VM=function(t){return typeof Array.isArray=="function"?Array.isArray(t):D7.call(t)==="[object Array]"},GM=function(t){if(!t||D7.call(t)!=="[object Object]")return!1;var n=Kb.call(t,"constructor"),s=t.constructor&&t.constructor.prototype&&Kb.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!s)return!1;var i;for(i in t);return typeof i>"u"||Kb.call(t,i)},KM=function(t,n){HM&&n.name==="__proto__"?HM(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},qM=function(t,n){if(n==="__proto__")if(Kb.call(t,n)){if(zM)return zM(t,n).value}else return;return t[n]},jge=function e(){var t,n,s,i,r,a,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});ca.length;let c;l&&a.push(i);try{c=e.apply(this,a)}catch(u){const d=u;if(l&&n)throw d;return i(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(r,i):c instanceof Error?i(c):r(c))}function i(a,...l){n||(n=!0,t(a,...l))}function r(a){i(null,a)}}const Ka={basename:Mge,dirname:Lge,extname:Dge,join:Pge,sep:"/"};function Mge(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');_g(e);let n=0,s=-1,i=e.length,r;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(r){n=i+1;break}}else s<0&&(r=!0,s=i+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let a=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(r){n=i+1;break}}else a<0&&(r=!0,a=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(s=i):(l=-1,s=a));return n===s?s=a:s<0&&(s=e.length),e.slice(n,s)}function Lge(e){if(_g(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Dge(e){_g(e);let t=e.length,n=-1,s=0,i=-1,r=0,a;for(;t--;){const l=e.codePointAt(t);if(l===47){if(a){s=t+1;break}continue}n<0&&(a=!0,n=t+1),l===46?i<0?i=t:r!==1&&(r=1):i>-1&&(r=-1)}return i<0||n<0||r===0||r===1&&i===n-1&&i===s+1?"":e.slice(i,n)}function Pge(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Uge(e,t){let n="",s=0,i=-1,r=0,a=-1,l,c;for(;++a<=e.length;){if(a2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",s=0):(n=n.slice(0,c),s=n.length-1-n.lastIndexOf("/")),i=a,r=0;continue}}else if(n.length>0){n="",s=0,i=a,r=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),s=a-i-1;i=a,r=0}else l===46&&r>-1?r++:r=-1}return n}function _g(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Fge={cwd:$ge};function $ge(){return"/"}function iN(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Hge(e){if(typeof e=="string")e=new URL(e);else if(!iN(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 zge(e)}function zge(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n0){let[p,...m]=d;const b=s[h][1];sN(b)&&sN(p)&&(p=iw(!0,b,p)),s[h]=[u,p,...m]}}}}const qge=new jA().freeze();function lw(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function cw(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function uw(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 WM(e){if(!sN(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function XM(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function G0(e){return Yge(e)?e:new P7(e)}function Yge(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Wge(e){return typeof e=="string"||Xge(e)}function Xge(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Qge="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",QM=[],ZM={allowDangerousHtml:!0},Zge=/^(https?|ircs?|mailto|xmpp)$/i,Jge=[{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 e0e(e){const t=t0e(e),n=n0e(e);return s0e(t.runSync(t.parse(n),n),e)}function t0e(e){const t=e.rehypePlugins||QM,n=e.remarkPlugins||QM,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...ZM}:ZM;return qge().use(Lme).use(n).use(Ige,s).use(t)}function n0e(e){const t=e.children||"",n=new P7;return typeof t=="string"&&(n.value=t),n}function s0e(e,t){const n=t.allowedElements,s=t.allowElement,i=t.components,r=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||i0e;for(const d of Jge)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Qge+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Sg(e,u),yhe(e,{Fragment:o.Fragment,components:i,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.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 tw)if(Object.hasOwn(tw,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],b=tw[p];(b===null||b.includes(d.tagName))&&(d.properties[p]=c(String(m||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):r?r.includes(d.tagName):!1;if(!p&&s&&typeof f=="number"&&(p=!s(d,f,h)),p&&h&&typeof f=="number")return l&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function i0e(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||s!==-1&&t>s||Zge.test(e.slice(0,t))?e:""}function JM(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,i=n.indexOf(t);for(;i!==-1;)s++,i=n.indexOf(t,i+t.length);return s}function r0e(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function a0e(e,t,n){const i=wg((n||{}).ignore||[]),r=o0e(t);let a=-1;for(;++a0?{type:"text",value:S}:void 0),S===!1?h.lastIndex=w+1:(m!==w&&x.push({type:"text",value:u.value.slice(m,w)}),Array.isArray(S)?x.push(...S):S&&x.push(S),m=w+E[0].length,y=!0),!h.global)break;E=h.exec(u.value)}return y?(m?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const i=JM(e,"(");let r=JM(e,")");for(;s!==-1&&i>r;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),r++;return[e,n]}function B7(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||pu(n)||I1(n))&&(!t||n!==47)}U7.peek=I0e;function w0e(){this.buffer()}function S0e(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function _0e(){this.buffer()}function N0e(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function T0e(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ka(this.sliceSerialize(e)).toLowerCase(),n.label=t}function k0e(e){this.exit(e)}function A0e(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ka(this.sliceSerialize(e)).toLowerCase(),n.label=t}function C0e(e){this.exit(e)}function I0e(){return"["}function U7(e,t,n,s){const i=n.createTracker(s);let r=i.move("[^");const a=n.enter("footnoteReference"),l=n.enter("reference");return r+=i.move(n.safe(n.associationId(e),{after:"]",before:r})),l(),a(),r+=i.move("]"),r}function j0e(){return{enter:{gfmFootnoteCallString:w0e,gfmFootnoteCall:S0e,gfmFootnoteDefinitionLabelString:_0e,gfmFootnoteDefinition:N0e},exit:{gfmFootnoteCallString:T0e,gfmFootnoteCall:k0e,gfmFootnoteDefinitionLabelString:A0e,gfmFootnoteDefinition:C0e}}}function R0e(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:U7},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,i,r,a){const l=r.createTracker(a);let c=l.move("[^");const u=r.enter("footnoteDefinition"),d=r.enter("label");return c+=l.move(r.safe(r.associationId(s),{before:c,after:"]"})),d(),c+=l.move("]:"),s.children&&s.children.length>0&&(l.shift(4),c+=l.move((t?` +`:" ")+r.indentLines(r.containerFlow(s,l.current()),t?F7:O0e))),u(),c}}function O0e(e,t,n){return t===0?e:F7(e,t,n)}function F7(e,t,n){return(n?"":" ")+e}const M0e=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];$7.peek=U0e;function L0e(){return{canContainEols:["delete"],enter:{strikethrough:P0e},exit:{strikethrough:B0e}}}function D0e(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:M0e}],handlers:{delete:$7}}}function P0e(e){this.enter({type:"delete",children:[]},e)}function B0e(e){this.exit(e)}function $7(e,t,n,s){const i=n.createTracker(s),r=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),r(),a}function U0e(){return"~"}function F0e(e){return e.length}function $0e(e,t){const n=t||{},s=(n.align||[]).concat(),i=n.stringLength||F0e,r=[],a=[],l=[],c=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++yc[y])&&(c[y]=E)}b.push(x)}a[d]=b,l[d]=v}let f=-1;if(typeof s=="object"&&"length"in s)for(;++fc[f]&&(c[f]=x),p[f]=x),h[f]=E}a.splice(1,0,h),l.splice(1,0,p),d=-1;const m=[];for(;++d "),r.shift(2);const a=n.indentLines(n.containerFlow(e,r.current()),V0e);return i(),a}function V0e(e,t,n){return">"+(n?"":" ")+e}function G0e(e,t){return nL(e,t.inConstruct,!0)&&!nL(e,t.notInConstruct,!1)}function nL(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++sa&&(a=r):r=1,i=s+t.length,s=n.indexOf(t,i);return a}function q0e(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 Y0e(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 W0e(e,t,n,s){const i=Y0e(n),r=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(q0e(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(r,X0e);return f(),h}const l=n.createTracker(s),c=i.repeat(Math.max(K0e(r,i)+1,3)),u=n.enter("codeFenced");let d=l.move(c);if(e.lang){const f=n.enter(`codeFencedLang${a}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${a}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:` `,encode:["`"],...l.current()})),f()}return d+=l.move(` `),r&&(d+=l.move(r+` -`)),d+=l.move(c),u(),d}function K0e(e,t,n){return(n?"":" ")+e}function AA(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 q0e(e,t,n,s){const i=AA(n),r=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let l=n.enter("label");const c=n.createTracker(s);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":` -`,...c.current()}))),l(),e.title&&(l=n.enter(`title${r}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),l()),a(),u}function Y0e(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 Pm(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ox(e,t,n){const s=Af(e),i=Af(t);return s===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===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}}U7.peek=W0e;function U7(e,t,n,s){const i=Y0e(n),r=n.enter("emphasis"),a=n.createTracker(s),l=a.move(i);let c=a.move(n.containerPhrasing(e,{after:i,before:l,...a.current()}));const u=c.charCodeAt(0),d=ox(s.before.charCodeAt(s.before.length-1),u,i);d.inside&&(c=Pm(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=ox(s.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+Pm(f));const p=a.move(i);return r(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function W0e(e,t,n){return n.options.emphasis||"*"}function X0e(e,t){let n=!1;return _g(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,Q_}),!!((!e.depth||e.depth<3)&&EA(e)&&(t.options.setext||n))}function Q0e(e,t,n,s){const i=Math.max(Math.min(6,e.depth||1),1),r=n.createTracker(s);if(X0e(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...r.current(),before:` +`)),d+=l.move(c),u(),d}function X0e(e,t,n){return(n?"":" ")+e}function RA(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 Q0e(e,t,n,s){const i=RA(n),r=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let l=n.enter("label");const c=n.createTracker(s);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":` +`,...c.current()}))),l(),e.title&&(l=n.enter(`title${r}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),l()),a(),u}function Z0e(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 Dm(e){return"&#x"+e.toString(16).toUpperCase()+";"}function cx(e,t,n){const s=If(e),i=If(t);return s===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===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}}z7.peek=J0e;function z7(e,t,n,s){const i=Z0e(n),r=n.enter("emphasis"),a=n.createTracker(s),l=a.move(i);let c=a.move(n.containerPhrasing(e,{after:i,before:l,...a.current()}));const u=c.charCodeAt(0),d=cx(s.before.charCodeAt(s.before.length-1),u,i);d.inside&&(c=Dm(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=cx(s.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+Dm(f));const p=a.move(i);return r(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function J0e(e,t,n){return n.options.emphasis||"*"}function ebe(e,t){let n=!1;return Sg(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,tN}),!!((!e.depth||e.depth<3)&&_A(e)&&(t.options.setext||n))}function tbe(e,t,n,s){const i=Math.max(Math.min(6,e.depth||1),1),r=n.createTracker(s);if(ebe(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...r.current(),before:` `,after:` `});return f(),d(),h+` `+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(` `))+1))}const a="#".repeat(i),l=n.enter("headingAtx"),c=n.enter("phrasing");r.move(a+" ");let u=n.containerPhrasing(e,{before:"# ",after:` -`,...r.current()});return/^[\t ]/.test(u)&&(u=Pm(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),c(),l(),u}F7.peek=Z0e;function F7(e){return e.value||""}function Z0e(){return"<"}$7.peek=J0e;function $7(e,t,n,s){const i=AA(n),r=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let l=n.enter("label");const c=n.createTracker(s);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${r}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),l()),u+=c.move(")"),a(),u}function J0e(){return"!"}H7.peek=ebe;function H7(e,t,n,s){const i=e.referenceType,r=n.enter("imageReference");let a=n.enter("label");const l=n.createTracker(s);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return a(),n.stack=d,r(),i==="full"||!u||u!==f?c+=l.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function ebe(){return"!"}z7.peek=tbe;function z7(e,t,n){let s=e.value||"",i="`",r=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(s);)i+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++r\u007F]/.test(e.url))}G7.peek=nbe;function G7(e,t,n,s){const i=AA(n),r=i==='"'?"Quote":"Apostrophe",a=n.createTracker(s);let l,c;if(V7(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let f=a.move("<");return f+=a.move(n.containerPhrasing(e,{before:f,after:">",...a.current()})),f+=a.move(">"),l(),n.stack=d,f}l=n.enter("link"),c=n.enter("label");let u=a.move("[");return u+=a.move(n.containerPhrasing(e,{before:u,after:"](",...a.current()})),u+=a.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(c=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),c(),e.title&&(c=n.enter(`title${r}`),u+=a.move(" "+i),u+=a.move(n.safe(e.title,{before:u,after:i,...a.current()})),u+=a.move(i),c()),u+=a.move(")"),l(),u}function nbe(e,t,n){return V7(e,n)?"<":"["}K7.peek=sbe;function K7(e,t,n,s){const i=e.referenceType,r=n.enter("linkReference");let a=n.enter("label");const l=n.createTracker(s);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return a(),n.stack=d,r(),i==="full"||!u||u!==f?c+=l.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function sbe(){return"["}function CA(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 ibe(e){const t=CA(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 rbe(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 q7(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 abe(e,t,n,s){const i=n.enter("list"),r=n.bulletCurrent;let a=e.ordered?rbe(n):CA(n);const l=e.ordered?a==="."?")":".":ibe(n);let c=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&&(c=!0),q7(n)===a&&d){let f=-1;for(;++f-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+r);let a=r.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const l=n.createTracker(s);l.move(r+" ".repeat(a-r.length)),l.shift(a);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),d);return c(),u;function d(f,h,p){return h?(p?"":" ".repeat(a))+f:(p?r:r+" ".repeat(a-r.length))+f}}function cbe(e,t,n,s){const i=n.enter("paragraph"),r=n.enter("phrasing"),a=n.containerPhrasing(e,s);return r(),i(),a}const ube=Sg(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function dbe(e,t,n,s){return(e.children.some(function(a){return ube(a)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function fbe(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Y7.peek=hbe;function Y7(e,t,n,s){const i=fbe(n),r=n.enter("strong"),a=n.createTracker(s),l=a.move(i+i);let c=a.move(n.containerPhrasing(e,{after:i,before:l,...a.current()}));const u=c.charCodeAt(0),d=ox(s.before.charCodeAt(s.before.length-1),u,i);d.inside&&(c=Pm(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=ox(s.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+Pm(f));const p=a.move(i+i);return r(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function hbe(e,t,n){return n.options.strong||"*"}function pbe(e,t,n,s){return n.safe(e.value,s)}function mbe(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 gbe(e,t,n){const s=(q7(n)+(n.options.ruleSpaces?" ":"")).repeat(mbe(n));return n.options.ruleSpaces?s.slice(0,-1):s}const W7={blockquote:U0e,break:JM,code:G0e,definition:q0e,emphasis:U7,hardBreak:JM,heading:Q0e,html:F7,image:$7,imageReference:H7,inlineCode:z7,link:G7,linkReference:K7,list:abe,listItem:lbe,paragraph:cbe,root:dbe,strong:Y7,text:pbe,thematicBreak:gbe};function bbe(){return{enter:{table:ybe,tableData:eL,tableHeader:eL,tableRow:Ebe},exit:{codeText:vbe,table:xbe,tableData:dw,tableHeader:dw,tableRow:dw}}}function ybe(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 xbe(e){this.exit(e),this.data.inTable=void 0}function Ebe(e){this.enter({type:"tableRow",children:[]},e)}function dw(e){this.exit(e)}function eL(e){this.enter({type:"tableCell",children:[]},e)}function vbe(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,wbe));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function wbe(e,t){return t==="|"?t:e}function Sbe(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,i=t.stringLength,r=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,...r.current()});return/^[\t ]/.test(u)&&(u=Dm(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),c(),l(),u}V7.peek=nbe;function V7(e){return e.value||""}function nbe(){return"<"}G7.peek=sbe;function G7(e,t,n,s){const i=RA(n),r=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let l=n.enter("label");const c=n.createTracker(s);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${r}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),l()),u+=c.move(")"),a(),u}function sbe(){return"!"}K7.peek=ibe;function K7(e,t,n,s){const i=e.referenceType,r=n.enter("imageReference");let a=n.enter("label");const l=n.createTracker(s);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return a(),n.stack=d,r(),i==="full"||!u||u!==f?c+=l.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function ibe(){return"!"}q7.peek=rbe;function q7(e,t,n){let s=e.value||"",i="`",r=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(s);)i+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++r\u007F]/.test(e.url))}W7.peek=abe;function W7(e,t,n,s){const i=RA(n),r=i==='"'?"Quote":"Apostrophe",a=n.createTracker(s);let l,c;if(Y7(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let f=a.move("<");return f+=a.move(n.containerPhrasing(e,{before:f,after:">",...a.current()})),f+=a.move(">"),l(),n.stack=d,f}l=n.enter("link"),c=n.enter("label");let u=a.move("[");return u+=a.move(n.containerPhrasing(e,{before:u,after:"](",...a.current()})),u+=a.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(c=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),c(),e.title&&(c=n.enter(`title${r}`),u+=a.move(" "+i),u+=a.move(n.safe(e.title,{before:u,after:i,...a.current()})),u+=a.move(i),c()),u+=a.move(")"),l(),u}function abe(e,t,n){return Y7(e,n)?"<":"["}X7.peek=obe;function X7(e,t,n,s){const i=e.referenceType,r=n.enter("linkReference");let a=n.enter("label");const l=n.createTracker(s);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return a(),n.stack=d,r(),i==="full"||!u||u!==f?c+=l.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function obe(){return"["}function OA(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 lbe(e){const t=OA(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 cbe(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 Q7(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 ube(e,t,n,s){const i=n.enter("list"),r=n.bulletCurrent;let a=e.ordered?cbe(n):OA(n);const l=e.ordered?a==="."?")":".":lbe(n);let c=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&&(c=!0),Q7(n)===a&&d){let f=-1;for(;++f-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+r);let a=r.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const l=n.createTracker(s);l.move(r+" ".repeat(a-r.length)),l.shift(a);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),d);return c(),u;function d(f,h,p){return h?(p?"":" ".repeat(a))+f:(p?r:r+" ".repeat(a-r.length))+f}}function hbe(e,t,n,s){const i=n.enter("paragraph"),r=n.enter("phrasing"),a=n.containerPhrasing(e,s);return r(),i(),a}const pbe=wg(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function mbe(e,t,n,s){return(e.children.some(function(a){return pbe(a)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function gbe(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Z7.peek=bbe;function Z7(e,t,n,s){const i=gbe(n),r=n.enter("strong"),a=n.createTracker(s),l=a.move(i+i);let c=a.move(n.containerPhrasing(e,{after:i,before:l,...a.current()}));const u=c.charCodeAt(0),d=cx(s.before.charCodeAt(s.before.length-1),u,i);d.inside&&(c=Dm(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=cx(s.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+Dm(f));const p=a.move(i+i);return r(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function bbe(e,t,n){return n.options.strong||"*"}function ybe(e,t,n,s){return n.safe(e.value,s)}function xbe(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 Ebe(e,t,n){const s=(Q7(n)+(n.options.ruleSpaces?" ":"")).repeat(xbe(n));return n.options.ruleSpaces?s.slice(0,-1):s}const J7={blockquote:z0e,break:sL,code:W0e,definition:Q0e,emphasis:z7,hardBreak:sL,heading:tbe,html:V7,image:G7,imageReference:K7,inlineCode:q7,link:W7,linkReference:X7,list:ube,listItem:fbe,paragraph:hbe,root:mbe,strong:Z7,text:ybe,thematicBreak:Ebe};function vbe(){return{enter:{table:wbe,tableData:iL,tableHeader:iL,tableRow:_be},exit:{codeText:Nbe,table:Sbe,tableData:pw,tableHeader:pw,tableRow:pw}}}function wbe(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 Sbe(e){this.exit(e),this.data.inTable=void 0}function _be(e){this.enter({type:"tableRow",children:[]},e)}function pw(e){this.exit(e)}function iL(e){this.enter({type:"tableCell",children:[]},e)}function Nbe(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Tbe));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Tbe(e,t){return t==="|"?t:e}function kbe(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,i=t.stringLength,r=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:c,tableRow:l}};function a(p,m,b,v){return u(d(p,b,v),p.align)}function l(p,m,b,v){const y=f(p,b,v),x=u([y]);return x.slice(0,x.indexOf(` -`))}function c(p,m,b,v){const y=b.enter("tableCell"),x=b.enter("phrasing"),E=b.containerPhrasing(p,{...v,before:r,after:r});return x(),y(),E}function u(p,m){return P0e(p,{align:m,alignDelimiters:s,padding:n,stringLength:i})}function d(p,m,b){const v=p.children;let y=-1;const x=[],E=m.enter("table");for(;++y0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const $be={tokenize:Wbe,partial:!0};function Hbe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Kbe,continuation:{tokenize:qbe},exit:Ybe}},text:{91:{name:"gfmFootnoteCall",tokenize:Gbe},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:zbe,resolveTo:Vbe}}}}function zbe(e,t,n){const s=this;let i=s.events.length;const r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let a;for(;i--;){const c=s.events[i][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!a||!a._balanced)return n(c);const u=Aa(s.sliceSerialize({start:a.end,end:s.now()}));return u.codePointAt(0)!==94||!r.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function Vbe(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 s={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 r={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},r.start),end:Object.assign({},r.end)},l=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",r,t],["enter",a,t],["exit",a,t],["exit",r,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...l),e}function Gbe(e,t,n){const s=this,i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let r=0,a;return l;function l(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),c}function c(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(r>999||f===93&&!a||f===null||f===91||$n(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return i.includes(Aa(s.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return $n(f)||(a=!0),r++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),r++,u):u(f)}}function Kbe(e,t,n){const s=this,i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let r,a=0,l;return c;function c(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&&!l||m===null||m===91||$n(m))return n(m);if(m===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return r=Aa(s.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return $n(m)||(l=!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(r)||i.push(r),nn(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function qbe(e,t,n){return e.check(wg,t,e.attempt($be,t,n))}function Ybe(e){e.exit("gfmFootnoteDefinition")}function Wbe(e,t,n){const s=this;return nn(e,i,"gfmFootnoteDefinitionIndent",5);function i(r){const a=s.events[s.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(r):n(r)}}function Xbe(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:r,resolveAll:i};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function i(a,l){let c=-1;for(;++c1?c(m):(a.consume(m),f++,p);if(f<2&&!n)return c(m);const v=a.exit("strikethroughSequenceTemporary"),y=Af(m);return v._open=!y||y===2&&!!b,v._close=!b||b===2&&!!y,l(m)}}}class Qbe{constructor(){this.map=[]}add(t,n,s){Zbe(this,t,n,s)}consume(t){if(this.map.sort(function(r,a){return r[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let i=s.pop();for(;i;){for(const r of i)t.push(r);i=s.pop()}this.map.length=0}}function Zbe(e,t,n,s){let i=0;if(!(n===0&&s.length===0)){for(;i-1;){const D=s.events[j][1].type;if(D==="lineEnding"||D==="linePrefix")j--;else break}const L=j>-1?s.events[j][1].type:null,z=L==="tableHead"||L==="tableRow"?S:c;return z===S&&s.parser.lazy[s.now().line]?n(I):z(I)}function c(I){return e.enter("tableHead"),e.enter("tableRow"),u(I)}function u(I){return I===124||(a=!0,r+=1),d(I)}function d(I){return I===null?n(I):mt(I)?r>1?(r=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),p):n(I):qt(I)?nn(e,d,"whitespace")(I):(r+=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||$n(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 s.interrupt=!1,s.parser.lazy[s.now().line]?n(I):(e.enter("tableDelimiterRow"),a=!1,qt(I)?nn(e,m,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):m(I))}function m(I){return I===45||I===58?v(I):I===124?(a=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),b):_(I)}function b(I){return qt(I)?nn(e,v,"whitespace")(I):v(I)}function v(I){return I===58?(r+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),y):I===45?(r+=1,y(I)):I===null||mt(I)?w(I):_(I)}function y(I){return I===45?(e.enter("tableDelimiterFiller"),x(I)):_(I)}function x(I){return I===45?(e.consume(I),x):I===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(I))}function E(I){return qt(I)?nn(e,w,"whitespace")(I):w(I)}function w(I){return I===124?m(I):I===null||mt(I)?!a||i!==r?_(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):_(I)}function _(I){return n(I)}function S(I){return e.enter("tableRow"),k(I)}function k(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),k):I===null||mt(I)?(e.exit("tableRow"),t(I)):qt(I)?nn(e,k,"whitespace")(I):(e.enter("data"),T(I))}function T(I){return I===null||I===124||$n(I)?(e.exit("data"),k(I)):(e.consume(I),I===92?C:T)}function C(I){return I===92||I===124?(e.consume(I),T):T(I)}}function nye(e,t){let n=-1,s=!0,i=0,r=[0,0,0,0],a=[0,0,0,0],l=!1,c=0,u,d,f;const h=new Qbe;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 i!==void 0&&(r.end=Object.assign({},od(t.events,i)),e.add(i,0,[["exit",r,t]]),r=void 0),r}function nL(e,t,n,s,i){const r=[],a=od(t.events,n);i&&(i.end=Object.assign({},a),r.push(["exit",i,t])),s.end=Object.assign({},a),r.push(["exit",s,t]),e.add(n+1,0,r)}function od(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const sye={name:"tasklistCheck",tokenize:rye};function iye(){return{text:{91:sye}}}function rye(e,t,n){const s=this;return i;function i(c){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),r)}function r(c){return $n(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return mt(c)?t(c):qt(c)?e.check({tokenize:aye},t,n)(c):n(c)}}function aye(e,t,n){return nn(e,s,"whitespace");function s(i){return i===null?n(i):t(i)}}function oye(e){return f7([Rbe(),Hbe(),Xbe(e),eye(),iye()])}const lye={};function cye(e){const t=this,n=e||lye,s=t.data(),i=s.micromarkExtensions||(s.micromarkExtensions=[]),r=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),a=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);i.push(oye(n)),r.push(Abe()),a.push(Cbe(n))}const sL=function(e,t,n){const s=Sg(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&&c.push(` -`.repeat(u)||" "),u=-1,c.push(d))}return c.join("")}function rF(e,t,n){return e.type==="element"?bye(e,t,n):e.type==="text"?n.whitespace==="normal"?aF(e,n):yye(e):[]}function bye(e,t,n){const s=oF(e,n),i=e.children||[];let r=-1,a=[];if(mye(e))return a;let l,c;for(nN(e)||oL(e)&&sL(t,e,oL)?c=` -`:pye(e)?(l=2,c=2):iF(e)&&(l=1,c=1);++r]+>")+")",l={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"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],v=["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"],y=["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"],w={type:b,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},_={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},S=[_,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:S.concat([{begin:/\(/,end:/\)/,keywords:w,contains:S.concat(["self"]),relevance:0}]),relevance:0},T={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:s,keywords:w,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:w,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:w,illegal:"",keywords:w,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:w},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Nye(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=_ye(e),s=n.keywords;return s.type=[...s.type,...t.type],s.literal=[...s.literal,...t.literal],s.built_in=[...s.built_in,...t.built_in],s._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function lF(e){const t=e.regex,n={},s={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},s]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},r=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"})]}},l={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(l);const c={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"],v=["true","false"],y={match:/(\/[a-z._-]+)+/},x=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],E=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],w=["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"],_=["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:v,built_in:[...x,...E,"set","shopt",...w,..._]},contains:[p,e.SHEBANG(),m,f,r,a,y,l,c,u,d,n]}}function Tye(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),s="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",a="("+s+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={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*\\(",v={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"},y=[f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],x={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:v,contains:y.concat([{begin:/\(/,end:/\)/,keywords:v,contains:y.concat(["self"]),relevance:0}]),relevance:0},E={begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:v,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:s,keywords:v,relevance:0},{begin:p,returnBegin:!0,contains:[e.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:v,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:v}}}function kye(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),s="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",a="(?!struct)("+s+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={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"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],v=["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"],y=["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"],w={type:b,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},_={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},S=[_,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:S.concat([{begin:/\(/,end:/\)/,keywords:w,contains:S.concat(["self"]),relevance:0}]),relevance:0},T={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:s,keywords:w,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:w,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:w,illegal:"",keywords:w,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:w},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Aye(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"],s=["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"],r=["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(r),built_in:t,literal:s},l=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={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]},v=e.inherit(b,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});h.contains=[b,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.C_BLOCK_COMMENT_MODE],p.contains=[v,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[u,b,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},x={begin:"<",end:">",contains:[{beginKeywords:"in out"},l]},E=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",w={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"}},y,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},l,x,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,x,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:"("+E+"\\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,x],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,relevance:0,contains:[y,c,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},w]}}const Cye=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_-]*/}}),Iye=["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"],jye=["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"],Rye=[...Iye,...jye],Oye=["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(),Mye=["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(),Lye=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Dye=["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 Pye(e){const t=e.regex,n=Cye(e),s={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",r=/@-?\w[\w]*(-\w+)*/,a="[a-zA-Z-][a-zA-Z0-9_-]*",l=[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,s,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:":("+Mye.join("|")+")"},{begin:":(:)?("+Lye.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Dye.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...l,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...l,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:r},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:Oye.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Rye.join("|")+")\\b"}]}}function Bye(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 Uye(e){const r={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:r,illegal:"uF(e,t,n-1))}function $ye(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",s=n+uF("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),c={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:c,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,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:["(?:"+s+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,lL,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},lL,u]}}const cL="[A-Za-z$_][0-9A-Za-z$_]*",Hye=["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"],zye=["true","false","null","undefined","NaN","Infinity"],dF=["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"],fF=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],hF=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Vye=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Gye=[].concat(hF,dF,fF);function pF(e){const t=e.regex,n=(P,{after:$})=>{const R="",end:""},r=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(P,$)=>{const R=P[0].length+P.index,Y=P.input[R];if(Y==="<"||Y===","){$.ignoreMatch();return}Y===">"&&(n(P,{after:R})||$.ignoreMatch());let J;const U=P.input.substring(R);if(J=U.match(/^\s*=/)){$.ignoreMatch();return}if((J=U.match(/^\s+extends\s+/))&&J.index===0){$.ignoreMatch();return}}},l={$pattern:cL,keyword:Hye,literal:zye,built_in:Gye,"variable.language":Vye},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\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:l,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"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={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:s+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,v,{match:/\$\d+/},f];h.contains=E.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(E)});const w=[].concat(x,h.contains),_=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(w)}]),S={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:_},k={variants:[{match:[/class/,/\s+/,s,/\s+/,/extends/,/\s+/,t.concat(s,"(",t.concat(/\./,s),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,s],scope:{1:"keyword",3:"title.class"}}]},T={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:{_:[...dF,...fF]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[S],illegal:/%/},j={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function L(P){return t.concat("(?!",P.join("|"),")")}const z={match:t.concat(/\b/,L([...hF,"super","import"].map(P=>`${P}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},F={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},S]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",O={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[S]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:T},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,v,x,{match:/\$\d+/},f,T,{scope:"attr",match:s+t.lookahead(":"),relevance:0},O,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,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:l,contains:_}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:r},{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:[S,e.inherit(e.TITLE_MODE,{begin:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[S]},z,j,k,F,{match:/\$[(.]/}]}}function mF(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},s=["true","false","null"],i={scope:"literal",beginKeywords:s.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:s},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 cd="[0-9](_*[0-9])*",q0=`\\.(${cd})`,Y0="[0-9a-fA-F](_*[0-9a-fA-F])*",Kye={className:"number",variants:[{begin:`(\\b(${cd})((${q0})|\\.)?|(${q0}))[eE][+-]?(${cd})[fFdD]?\\b`},{begin:`\\b(${cd})((${q0})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${q0})[fFdD]?\\b`},{begin:`\\b(${cd})[fFdD]\\b`},{begin:`\\b0[xX]((${Y0})\\.?|(${Y0})?\\.(${Y0}))[pP][+-]?(${cd})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Y0})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function qye(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+/}]}},s={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},r={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},a={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[r,i]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,r,i]}]};i.contains.push(a);const l={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(a,{className:"string"}),"self"]}]},u=Kye,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,s,l,c,{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,l,c,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},l,c]},a,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` -`},u]}}const Yye=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_-]*/}}),Wye=["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"],Xye=["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"],Qye=[...Wye,...Xye],Zye=["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(),gF=["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(),bF=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Jye=["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(),exe=gF.concat(bF).sort().reverse();function txe(e){const t=Yye(e),n=exe,s="and or not only",i="[\\w-]+",r="("+i+"|@\\{"+i+"\\})",a=[],l=[],c=function(E){return{className:"string",begin:"~?"+E+".*?"+E}},u=function(E,w,_){return{className:E,begin:w,relevance:_}},d={$pattern:/[a-z-]+/,keyword:s,attribute:Zye.join(" ")},f={begin:"\\(",end:"\\)",contains:l,keywords:d,relevance:0};l.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,c("'"),c('"'),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=l.concat({begin:/\{/,end:/\}/,contains:a}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},m={begin:r+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Jye.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},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:l,relevance:0}},v={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:h}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:r,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("+Qye.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,u("selector-tag",r,0),u("selector-id","#"+r),u("selector-class","\\."+r,0),u("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+gF.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+bF.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},x={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,v,x,m,y,p,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}function nxe(e){const t="\\[=*\\[",n="\\]=*\\]",s={begin:t,end:n,contains:["self"]},i=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[s],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:[s],relevance:5}])}}function yF(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},s={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}]},r={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}]},l=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,l,/:\/\/.*?\)/),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,c];return[u,d,f,h].forEach(y=>{y.contains=y.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,r,u,d,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},i,s,c,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function sxe(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_]*/,l={"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"]},c={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:l,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function ixe(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"],s=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},r={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},a={begin:/->\{/,end:/\}/},l={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[l]},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,r,c],f=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],h=(b,v,y="\\1")=>{const x=y==="\\1"?y:t.concat(y,v);return t.concat(t.concat("(?:",b,")"),v,/(?:\\.|[^\\\/])*?/,x,/(?:\\.|[^\\\/])*?/,y,s)},p=(b,v,y)=>t.concat(t.concat("(?:",b,")"),v,/(?:\\.|[^\\\/])*?/,y,s),m=[c,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,l]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,l,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return r.contains=m,a.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:m}}function rxe(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,s=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),r=t.concat(/[A-Z]+/,n),a={scope:"variable",match:"\\$+"+s},l={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={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(c)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(D,F)=>{F.data._beginMatch=D[1]||D[2]},"on:end":(D,F)=>{F.data._beginMatch!==D[1]&&F.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},v=["false","null","true"],y=["__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"],x=["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"],w={keyword:y,literal:(D=>{const F=[];return D.forEach(A=>{F.push(A),A.toLowerCase()===A?F.push(A.toUpperCase()):F.push(A.toLowerCase())}),F})(v),built_in:x},_=D=>D.map(F=>F.replace(/\|\d+$/,"")),S={variants:[{match:[/new/,t.concat(p,"+"),t.concat("(?!",_(x).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},k=t.concat(s,"\\b(?!\\()"),T={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),k],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),k],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"}}]},C={scope:"attr",match:t.concat(s,t.lookahead(":"),t.lookahead(/(?!::)/))},I={relevance:0,begin:/\(/,end:/\)/,keywords:w,contains:[C,a,T,e.C_BLOCK_COMMENT_MODE,m,b,S]},j={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",_(y).join("\\b|"),"|",_(x).join("\\b|"),"\\b)"),s,t.concat(p,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[I]};I.contains.push(j);const L=[C,T,e.C_BLOCK_COMMENT_MODE,m,b,S],z={begin:t.concat(/#\[\s*\\?/,t.either(i,r)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:v,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:v,keyword:["new","array"]},contains:["self",...L]},...L,{scope:"meta",variants:[{match:i},{match:r}]}]};return{case_insensitive:!1,keywords:w,contains:[z,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}]}},l,{scope:"variable.language",match:/\$this\b/},a,j,T,{match:[/const/,/\s/,s],scope:{1:"keyword",3:"variable.constant"}},S,{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:w,contains:["self",z,a,T,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 axe(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 oxe(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function EF(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),s=["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"],l={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:s,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"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:l,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,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c,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|${s.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})`}]},v={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",c,b,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,b,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[c,b,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,v,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{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,y,f]}]}}function lxe(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function cxe(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,s=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=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,r=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,s]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,s]},{scope:{1:"punctuation",2:"number"},match:[r,s]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,s]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:r},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function uxe(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",s=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(s,/(::\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"]},l={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},u=[e.COMMENT("#","$",{contains:[l]}),e.COMMENT("^=begin","^=end",{contains:[l],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}]},S=[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:s,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(c,u),relevance:0}].concat(c,u);d.contains=S,b.contains=S;const I=[{begin:/^\s*=>/,starts:{end:"$",contains:S}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:a,contains:S}}];return u.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(I).concat(u).concat(S)}}function dxe(e){const t=e.regex,n=/(r#)?/,s=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),r={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))?",l=["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"],c=["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:l,literal:c,built_in:u},illegal:""},r]}}const fxe=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_-]*/}}),hxe=["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"],pxe=["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"],mxe=[...hxe,...pxe],gxe=["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(),bxe=["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(),yxe=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),xxe=["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 Exe(e){const t=fxe(e),n=yxe,s=bxe,i="@[a-z-]+",r="and or not only",l={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("+mxe.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+s.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},l,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+xxe.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,l,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:r,attribute:gxe.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},l,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function vxe(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function wxe(e){const t=e.regex,n=e.COMMENT("--","$"),s={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},r=["true","false","unknown"],a=["double precision","large object","with timezone","without timezone"],l=["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"],c=["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,...c].filter(_=>!d.includes(_)),b={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},v={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function x(_){return t.concat(/\b/,t.either(..._.map(S=>S.replace(/\s+/,"\\s+"))),/\b/)}const E={scope:"keyword",match:x(h),relevance:0};function w(_,{exceptions:S,when:k}={}){const T=k;return S=S||[],_.map(C=>C.match(/\|\d+$/)||S.includes(C)?C:T(C)?`${C}|0`:C)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:w(m,{when:_=>_.length<3}),literal:r,type:l,built_in:f},contains:[{scope:"type",match:x(a)},E,y,b,s,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,v]}}function vF(e){return e?typeof e=="string"?e:e.source:null}function Kh(e){return An("(?=",e,")")}function An(...e){return e.map(n=>vF(n)).join("")}function Sxe(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function zi(...e){return"("+(Sxe(e).capture?"":"?:")+e.map(s=>vF(s)).join("|")+")"}const RA=e=>An(/\b/,e,/\w$/.test(e)?/\b/:/\B/),_xe=["Protocol","Type"].map(RA),uL=["init","self"].map(RA),Nxe=["Any","Self"],fw=["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"],dL=["false","nil","true"],Txe=["assignment","associativity","higherThan","left","lowerThan","none","right"],kxe=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],fL=["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"],wF=zi(/[/=\-+!*%<>&|^~?]/,/[\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]/),SF=zi(wF,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),hw=An(wF,SF,"*"),_F=zi(/[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]/),lx=zi(_F,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Ga=An(_F,lx,"*"),W0=An(/[A-Z]/,lx,"*"),Axe=["attached","autoclosure",An(/convention\(/,zi("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",An(/objc\(/,Ga,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],Cxe=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function Ixe(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),s=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,zi(..._xe,...uL)],className:{2:"keyword"}},r={match:An(/\./,zi(...fw)),relevance:0},a=fw.filter(re=>typeof re=="string").concat(["_|0"]),l=fw.filter(re=>typeof re!="string").concat(Nxe).map(RA),c={variants:[{className:"keyword",match:zi(...l,...uL)}]},u={$pattern:zi(/\b\w+/,/#\w+/),keyword:a.concat(kxe),literal:dL},d=[i,r,c],f={match:An(/\./,zi(...fL)),relevance:0},h={className:"built_in",match:An(/\b/,zi(...fL),/(?=\()/)},p=[f,h],m={match:/->/,relevance:0},b={className:"operator",relevance:0,variants:[{match:hw},{match:`\\.(\\.|${SF})+`}]},v=[m,b],y="([0-9]_*)+",x="([0-9a-fA-F]_*)+",E={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${x})(\\.(${x}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},w=(re="")=>({className:"subst",variants:[{match:An(/\\/,re,/[0\\tnr"']/)},{match:An(/\\/,re,/u\{[0-9a-fA-F]{1,8}\}/)}]}),_=(re="")=>({className:"subst",match:An(/\\/,re,/[\t ]*(?:[\r\n]|\r\n)/)}),S=(re="")=>({className:"subst",label:"interpol",begin:An(/\\/,re,/\(/),end:/\)/}),k=(re="")=>({begin:An(re,/"""/),end:An(/"""/,re),contains:[w(re),_(re),S(re)]}),T=(re="")=>({begin:An(re,/"/),end:An(/"/,re),contains:[w(re),S(re)]}),C={className:"string",variants:[k(),k("#"),k("##"),k("###"),T(),T("#"),T("##"),T("###")]},I=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],j={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:I},L=re=>{const ke=An(re,/\//),we=An(/\//,re);return{begin:ke,end:we,contains:[...I,{scope:"comment",begin:`#(?!.*${we})`,end:/$/}]}},z={scope:"regexp",variants:[L("###"),L("##"),L("#"),j]},D={match:An(/`/,Ga,/`/)},F={className:"variable",match:/\$\d+/},A={className:"variable",match:`\\$${lx}+`},O=[D,F,A],P={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:Cxe,contains:[...v,E,C]}]}},$={scope:"keyword",match:An(/@/,zi(...Axe),Kh(zi(/\(/,/\s+/)))},R={scope:"meta",match:An(/@/,Ga)},Y=[P,$,R],J={match:Kh(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:An(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,lx,"+")},{className:"type",match:W0,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:An(/\s+&\s+/,Kh(W0)),relevance:0}]},U={begin://,keywords:u,contains:[...s,...d,...Y,m,J]};J.contains.push(U);const te={match:An(Ga,/\s*:/),keywords:"_|0",relevance:0},K={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",te,...s,z,...d,...p,...v,E,C,...O,...Y,J]},V={begin://,keywords:"repeat each",contains:[...s,J]},W={begin:zi(Kh(An(Ga,/\s*:/)),Kh(An(Ga,/\s+/,Ga,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Ga}]},q={begin:/\(/,end:/\)/,keywords:u,contains:[W,...s,...d,...v,E,C,...Y,J,K],endsParent:!0,illegal:/["']/},ue={match:[/(func|macro)/,/\s+/,zi(D.match,Ga,hw)],className:{1:"keyword",3:"title.function"},contains:[V,q,t],illegal:[/\[/,/%/]},me={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[V,q,t],illegal:/\[|%/},Se={match:[/operator/,/\s+/,hw],className:{1:"keyword",3:"title"}},de={begin:[/precedencegroup/,/\s+/,W0],className:{1:"keyword",3:"title"},contains:[J],keywords:[...Txe,...dL],end:/}/},ge={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Me={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},ve={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Ga,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[V,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:W0},...d],relevance:0}]};for(const re of C.variants){const ke=re.contains.find(Je=>Je.label==="interpol");ke.keywords=u;const we=[...d,...p,...v,E,C,...O];ke.contains=[...we,{begin:/\(/,end:/\)/,contains:["self",...we]}]}return{name:"Swift",keywords:u,contains:[...s,ue,me,ge,Me,ve,Se,de,{beginKeywords:"import",end:/$/,contains:[...s],relevance:0},z,...d,...p,...v,E,C,...O,...Y,J,K]}}const cx="[A-Za-z$_][0-9A-Za-z$_]*",NF=["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"],TF=["true","false","null","undefined","NaN","Infinity"],kF=["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"],AF=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],CF=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],IF=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],jF=[].concat(CF,kF,AF);function jxe(e){const t=e.regex,n=(P,{after:$})=>{const R="",end:""},r=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(P,$)=>{const R=P[0].length+P.index,Y=P.input[R];if(Y==="<"||Y===","){$.ignoreMatch();return}Y===">"&&(n(P,{after:R})||$.ignoreMatch());let J;const U=P.input.substring(R);if(J=U.match(/^\s*=/)){$.ignoreMatch();return}if((J=U.match(/^\s+extends\s+/))&&J.index===0){$.ignoreMatch();return}}},l={$pattern:cx,keyword:NF,literal:TF,built_in:jF,"variable.language":IF},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\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:l,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"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={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:s+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,v,{match:/\$\d+/},f];h.contains=E.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(E)});const w=[].concat(x,h.contains),_=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(w)}]),S={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:_},k={variants:[{match:[/class/,/\s+/,s,/\s+/,/extends/,/\s+/,t.concat(s,"(",t.concat(/\./,s),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,s],scope:{1:"keyword",3:"title.class"}}]},T={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:{_:[...kF,...AF]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[S],illegal:/%/},j={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function L(P){return t.concat("(?!",P.join("|"),")")}const z={match:t.concat(/\b/,L([...CF,"super","import"].map(P=>`${P}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},F={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},S]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",O={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[S]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:T},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,v,x,{match:/\$\d+/},f,T,{scope:"attr",match:s+t.lookahead(":"),relevance:0},O,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,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:l,contains:_}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:r},{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:[S,e.inherit(e.TITLE_MODE,{begin:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[S]},z,j,k,F,{match:/\$[(.]/}]}}function RF(e){const t=e.regex,n=jxe(e),s=cx,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],r={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]},l={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:cx,keyword:NF.concat(c),literal:TF,built_in:jF.concat(i),"variable.language":IF},d={className:"meta",begin:"@"+s},f=(b,v,y)=>{const x=b.contains.findIndex(E=>E.label===v);if(x===-1)throw new Error("can not find mode to replace");b.contains.splice(x,1,y)};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(s,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,p]),n.contains=n.contains.concat([d,r,a,p]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",l);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 Rxe(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},s={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,r=/\d{4}-\d{1,2}-\d{1,2}/,a=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,l=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:t.concat(/# */,t.either(r,i),/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(r,i),/ +/,t.either(a,l),/ *#/)}]},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,s,c,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 Oxe(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),s=["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"}},r={className:"variable",begin:/\$[\w_]+/},a={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},l={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/},c={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:s},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},r,a,i,e.QUOTE_STRING_MODE,c,u,l]}}function Mxe(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),s=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},r={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},a=e.inherit(r,{begin:/\(/,end:/\)/}),l=e.inherit(e.APOS_STRING_MODE,{className:"string"}),c=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:[r,c,l,a,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[r,a,c,l]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{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 OF(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",s={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},r={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]},l=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},v=[s,{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,r,a],y=[...v];return y.pop(),y.push(l),p.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:v}}const Lxe={arduino:Nye,bash:lF,c:Tye,cpp:kye,csharp:Aye,css:Pye,diff:Bye,go:Uye,graphql:Fye,ini:cF,java:$ye,javascript:pF,json:mF,kotlin:qye,less:txe,lua:nxe,makefile:yF,markdown:xF,objectivec:sxe,perl:ixe,php:rxe,"php-template":axe,plaintext:oxe,python:EF,"python-repl":lxe,r:cxe,ruby:uxe,rust:dxe,scss:Exe,shell:vxe,sql:wxe,swift:Ixe,typescript:RF,vbnet:Rxe,wasm:Oxe,xml:Mxe,yaml:OF};function MF(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],s=typeof n;(s==="object"||s==="function")&&!Object.isFrozen(n)&&MF(n)}),e}let hL=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function LF(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function jl(e,...t){const n=Object.create(null);for(const s in e)n[s]=e[s];return t.forEach(function(s){for(const i in s)n[i]=s[i]}),n}const Dxe="",pL=e=>!!e.scope,Pxe=(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((s,i)=>`${s}${"_".repeat(i+1)}`)].join(" ")}return`${t}${e}`};class Bxe{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=LF(t)}openNode(t){if(!pL(t))return;const n=Pxe(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){pL(t)&&(this.buffer+=Dxe)}value(){return this.buffer}span(t){this.buffer+=``}}const mL=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class OA{constructor(){this.rootNode=mL(),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=mL({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(s=>this._walk(t,s)),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=>{OA._collapse(n)}))}}class Uxe extends OA{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const s=t.root;n&&(s.scope=`language:${n}`),this.add(s)}toHTML(){return new Bxe(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Bm(e){return e?typeof e=="string"?e:e.source:null}function DF(e){return ku("(?=",e,")")}function Fxe(e){return ku("(?:",e,")*")}function $xe(e){return ku("(?:",e,")?")}function ku(...e){return e.map(n=>Bm(n)).join("")}function Hxe(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function MA(...e){return"("+(Hxe(e).capture?"":"?:")+e.map(s=>Bm(s)).join("|")+")"}function PF(e){return new RegExp(e.toString()+"|").exec("").length-1}function zxe(e,t){const n=e&&e.exec(t);return n&&n.index===0}const Vxe=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function LA(e,{joinWith:t}){let n=0;return e.map(s=>{n+=1;const i=n;let r=Bm(s),a="";for(;r.length>0;){const l=Vxe.exec(r);if(!l){a+=r;break}a+=r.substring(0,l.index),r=r.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?a+="\\"+String(Number(l[1])+i):(a+=l[0],l[0]==="("&&n++)}return a}).map(s=>`(${s})`).join(t)}const Gxe=/\b\B/,BF="[a-zA-Z]\\w*",DA="[a-zA-Z_]\\w*",UF="\\b\\d+(\\.\\d+)?",FF="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",$F="\\b(0b[01]+)",Kxe="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",qxe=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=ku(t,/.*\b/,e.binary,/\b.*/)),jl({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,s)=>{n.index!==0&&s.ignoreMatch()}},e)},Um={begin:"\\\\[\\s\\S]",relevance:0},Yxe={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Um]},Wxe={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Um]},Xxe={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/},R1=function(e,t,n={}){const s=jl({scope:"comment",begin:e,end:t,contains:[]},n);s.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=MA("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 s.contains.push({begin:ku(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),s},Qxe=R1("//","$"),Zxe=R1("/\\*","\\*/"),Jxe=R1("#","$"),e1e={scope:"number",begin:UF,relevance:0},t1e={scope:"number",begin:FF,relevance:0},n1e={scope:"number",begin:$F,relevance:0},s1e={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Um,{begin:/\[/,end:/\]/,relevance:0,contains:[Um]}]},i1e={scope:"title",begin:BF,relevance:0},r1e={scope:"title",begin:DA,relevance:0},a1e={begin:"\\.\\s*"+DA,relevance:0},o1e=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 X0=Object.freeze({__proto__:null,APOS_STRING_MODE:Yxe,BACKSLASH_ESCAPE:Um,BINARY_NUMBER_MODE:n1e,BINARY_NUMBER_RE:$F,COMMENT:R1,C_BLOCK_COMMENT_MODE:Zxe,C_LINE_COMMENT_MODE:Qxe,C_NUMBER_MODE:t1e,C_NUMBER_RE:FF,END_SAME_AS_BEGIN:o1e,HASH_COMMENT_MODE:Jxe,IDENT_RE:BF,MATCH_NOTHING_RE:Gxe,METHOD_GUARD:a1e,NUMBER_MODE:e1e,NUMBER_RE:UF,PHRASAL_WORDS_MODE:Xxe,QUOTE_STRING_MODE:Wxe,REGEXP_MODE:s1e,RE_STARTERS_RE:Kxe,SHEBANG:qxe,TITLE_MODE:i1e,UNDERSCORE_IDENT_RE:DA,UNDERSCORE_TITLE_MODE:r1e});function l1e(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function c1e(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function u1e(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=l1e,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function d1e(e,t){Array.isArray(e.illegal)&&(e.illegal=MA(...e.illegal))}function f1e(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 h1e(e,t){e.relevance===void 0&&(e.relevance=1)}const p1e=(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(s=>{delete e[s]}),e.keywords=n.keywords,e.begin=ku(n.beforeMatch,DF(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},m1e=["of","and","for","in","not","or","if","then","parent","list","value"],g1e="keyword";function HF(e,t,n=g1e){const s=Object.create(null);return typeof e=="string"?i(n,e.split(" ")):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(r){Object.assign(s,HF(e[r],t,r))}),s;function i(r,a){t&&(a=a.map(l=>l.toLowerCase())),a.forEach(function(l){const c=l.split("|");s[c[0]]=[r,b1e(c[0],c[1])]})}}function b1e(e,t){return t?Number(t):y1e(e)?0:1}function y1e(e){return m1e.includes(e.toLowerCase())}const gL={},Qc=e=>{console.error(e)},bL=(e,...t)=>{console.log(`WARN: ${e}`,...t)},qu=(e,t)=>{gL[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),gL[`${e}/${t}`]=!0)},ux=new Error;function zF(e,t,{key:n}){let s=0;const i=e[n],r={},a={};for(let l=1;l<=t.length;l++)a[l+s]=i[l],r[l+s]=!0,s+=PF(t[l-1]);e[n]=a,e[n]._emit=r,e[n]._multi=!0}function x1e(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Qc("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ux;if(typeof e.beginScope!="object"||e.beginScope===null)throw Qc("beginScope must be object"),ux;zF(e,e.begin,{key:"beginScope"}),e.begin=LA(e.begin,{joinWith:""})}}function E1e(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Qc("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ux;if(typeof e.endScope!="object"||e.endScope===null)throw Qc("endScope must be object"),ux;zF(e,e.end,{key:"endScope"}),e.end=LA(e.end,{joinWith:""})}}function v1e(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function w1e(e){v1e(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),x1e(e),E1e(e)}function S1e(e){function t(a,l){return new RegExp(Bm(a),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,l]),this.matchAt+=PF(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=t(LA(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;const c=this.matcherRe.exec(l);if(!c)return null;const u=c.findIndex((f,h)=>h>0&&f!==void 0),d=this.matchIndexes[u];return c.splice(0,u),Object.assign(c,d)}}class s{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];const c=new n;return this.rules.slice(l).forEach(([u,d])=>c.addRule(u,d)),c.compile(),this.multiRegexes[l]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,c){this.rules.push([l,c]),c.type==="begin"&&this.count++}exec(l){const c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let u=c.exec(l);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,u=d.exec(l)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function i(a){const l=new s;return a.contains.forEach(c=>l.addRule(c.begin,{rule:c,type:"begin"})),a.terminatorEnd&&l.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&l.addRule(a.illegal,{type:"illegal"}),l}function r(a,l){const c=a;if(a.isCompiled)return c;[c1e,f1e,w1e,p1e].forEach(d=>d(a,l)),e.compilerExtensions.forEach(d=>d(a,l)),a.__beforeBegin=null,[u1e,d1e,h1e].forEach(d=>d(a,l)),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=HF(a.keywords,e.case_insensitive)),c.keywordPatternRe=t(u,!0),l&&(a.begin||(a.begin=/\B|\b/),c.beginRe=t(c.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(c.endRe=t(c.end)),c.terminatorEnd=Bm(c.end)||"",a.endsWithParent&&l.terminatorEnd&&(c.terminatorEnd+=(a.end?"|":"")+l.terminatorEnd)),a.illegal&&(c.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(d){return _1e(d==="self"?a:d)})),a.contains.forEach(function(d){r(d,c)}),a.starts&&r(a.starts,l),c.matcher=i(c),c}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=jl(e.classNameAliases||{}),r(e)}function VF(e){return e?e.endsWithParent||VF(e.starts):!1}function _1e(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return jl(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:VF(e)?jl(e,{starts:e.starts?jl(e.starts):null}):Object.isFrozen(e)?jl(e):e}var N1e="11.11.1";class T1e extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const pw=LF,yL=jl,xL=Symbol("nomatch"),k1e=7,GF=function(e){const t=Object.create(null),n=Object.create(null),s=[];let i=!0;const r="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]};let l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Uxe};function c(A){return l.noHighlightRe.test(A)}function u(A){let O=A.className+" ";O+=A.parentNode?A.parentNode.className:"";const P=l.languageDetectRe.exec(O);if(P){const $=T(P[1]);return $||(bL(r.replace("{}",P[1])),bL("Falling back to no-highlight mode for this block.",A)),$?P[1]:"no-highlight"}return O.split(/\s+/).find($=>c($)||T($))}function d(A,O,P){let $="",R="";typeof O=="object"?($=A,P=O.ignoreIllegals,R=O.language):(qu("10.7.0","highlight(lang, code, ...args) has been deprecated."),qu("10.7.0",`Please use highlight(code, options) instead. -https://github.com/highlightjs/highlight.js/issues/2277`),R=A,$=O),P===void 0&&(P=!0);const Y={code:$,language:R};D("before:highlight",Y);const J=Y.result?Y.result:f(Y.language,Y.code,P);return J.code=Y.code,D("after:highlight",J),J}function f(A,O,P,$){const R=Object.create(null);function Y(Z,ae){return Z.keywords[ae]}function J(){if(!we.keywords){Le.addText(Ve);return}let Z=0;we.keywordPatternRe.lastIndex=0;let ae=we.keywordPatternRe.exec(Ve),ne="";for(;ae;){ne+=Ve.substring(Z,ae.index);const be=ve.case_insensitive?ae[0].toLowerCase():ae[0],Fe=Y(we,be);if(Fe){const[Ke,bt]=Fe;if(Le.addText(ne),ne="",R[be]=(R[be]||0)+1,R[be]<=k1e&&(_e+=bt),Ke.startsWith("_"))ne+=ae[0];else{const dt=ve.classNameAliases[Ke]||Ke;K(ae[0],dt)}}else ne+=ae[0];Z=we.keywordPatternRe.lastIndex,ae=we.keywordPatternRe.exec(Ve)}ne+=Ve.substring(Z),Le.addText(ne)}function U(){if(Ve==="")return;let Z=null;if(typeof we.subLanguage=="string"){if(!t[we.subLanguage]){Le.addText(Ve);return}Z=f(we.subLanguage,Ve,!0,Je[we.subLanguage]),Je[we.subLanguage]=Z._top}else Z=p(Ve,we.subLanguage.length?we.subLanguage:null);we.relevance>0&&(_e+=Z.relevance),Le.__addSublanguage(Z._emitter,Z.language)}function te(){we.subLanguage!=null?U():J(),Ve=""}function K(Z,ae){Z!==""&&(Le.startScope(ae),Le.addText(Z),Le.endScope())}function V(Z,ae){let ne=1;const be=ae.length-1;for(;ne<=be;){if(!Z._emit[ne]){ne++;continue}const Fe=ve.classNameAliases[Z[ne]]||Z[ne],Ke=ae[ne];Fe?K(Ke,Fe):(Ve=Ke,J(),Ve=""),ne++}}function W(Z,ae){return Z.scope&&typeof Z.scope=="string"&&Le.openNode(ve.classNameAliases[Z.scope]||Z.scope),Z.beginScope&&(Z.beginScope._wrap?(K(Ve,ve.classNameAliases[Z.beginScope._wrap]||Z.beginScope._wrap),Ve=""):Z.beginScope._multi&&(V(Z.beginScope,ae),Ve="")),we=Object.create(Z,{parent:{value:we}}),we}function q(Z,ae,ne){let be=zxe(Z.endRe,ne);if(be){if(Z["on:end"]){const Fe=new hL(Z);Z["on:end"](ae,Fe),Fe.isMatchIgnored&&(be=!1)}if(be){for(;Z.endsParent&&Z.parent;)Z=Z.parent;return Z}}if(Z.endsWithParent)return q(Z.parent,ae,ne)}function ue(Z){return we.matcher.regexIndex===0?(Ve+=Z[0],1):(qe=!0,0)}function me(Z){const ae=Z[0],ne=Z.rule,be=new hL(ne),Fe=[ne.__beforeBegin,ne["on:begin"]];for(const Ke of Fe)if(Ke&&(Ke(Z,be),be.isMatchIgnored))return ue(ae);return ne.skip?Ve+=ae:(ne.excludeBegin&&(Ve+=ae),te(),!ne.returnBegin&&!ne.excludeBegin&&(Ve=ae)),W(ne,Z),ne.returnBegin?0:ae.length}function Se(Z){const ae=Z[0],ne=O.substring(Z.index),be=q(we,Z,ne);if(!be)return xL;const Fe=we;we.endScope&&we.endScope._wrap?(te(),K(ae,we.endScope._wrap)):we.endScope&&we.endScope._multi?(te(),V(we.endScope,Z)):Fe.skip?Ve+=ae:(Fe.returnEnd||Fe.excludeEnd||(Ve+=ae),te(),Fe.excludeEnd&&(Ve=ae));do we.scope&&Le.closeNode(),!we.skip&&!we.subLanguage&&(_e+=we.relevance),we=we.parent;while(we!==be.parent);return be.starts&&W(be.starts,Z),Fe.returnEnd?0:ae.length}function de(){const Z=[];for(let ae=we;ae!==ve;ae=ae.parent)ae.scope&&Z.unshift(ae.scope);Z.forEach(ae=>Le.openNode(ae))}let ge={};function Me(Z,ae){const ne=ae&&ae[0];if(Ve+=Z,ne==null)return te(),0;if(ge.type==="begin"&&ae.type==="end"&&ge.index===ae.index&&ne===""){if(Ve+=O.slice(ae.index,ae.index+1),!i){const be=new Error(`0 width match regex (${A})`);throw be.languageName=A,be.badRule=ge.rule,be}return 1}if(ge=ae,ae.type==="begin")return me(ae);if(ae.type==="illegal"&&!P){const be=new Error('Illegal lexeme "'+ne+'" for mode "'+(we.scope||"")+'"');throw be.mode=we,be}else if(ae.type==="end"){const be=Se(ae);if(be!==xL)return be}if(ae.type==="illegal"&&ne==="")return Ve+=` -`,1;if(Pe>1e5&&Pe>ae.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ve+=ne,ne.length}const ve=T(A);if(!ve)throw Qc(r.replace("{}",A)),new Error('Unknown language: "'+A+'"');const re=S1e(ve);let ke="",we=$||re;const Je={},Le=new l.__emitter(l);de();let Ve="",_e=0,He=0,Pe=0,qe=!1;try{if(ve.__emitTokens)ve.__emitTokens(O,Le);else{for(we.matcher.considerAll();;){Pe++,qe?qe=!1:we.matcher.considerAll(),we.matcher.lastIndex=He;const Z=we.matcher.exec(O);if(!Z)break;const ae=O.substring(He,Z.index),ne=Me(ae,Z);He=Z.index+ne}Me(O.substring(He))}return Le.finalize(),ke=Le.toHTML(),{language:A,value:ke,relevance:_e,illegal:!1,_emitter:Le,_top:we}}catch(Z){if(Z.message&&Z.message.includes("Illegal"))return{language:A,value:pw(O),illegal:!0,relevance:0,_illegalBy:{message:Z.message,index:He,context:O.slice(He-100,He+100),mode:Z.mode,resultSoFar:ke},_emitter:Le};if(i)return{language:A,value:pw(O),illegal:!1,relevance:0,errorRaised:Z,_emitter:Le,_top:we};throw Z}}function h(A){const O={value:pw(A),illegal:!1,relevance:0,_top:a,_emitter:new l.__emitter(l)};return O._emitter.addText(A),O}function p(A,O){O=O||l.languages||Object.keys(t);const P=h(A),$=O.filter(T).filter(I).map(te=>f(te,A,!1));$.unshift(P);const R=$.sort((te,K)=>{if(te.relevance!==K.relevance)return K.relevance-te.relevance;if(te.language&&K.language){if(T(te.language).supersetOf===K.language)return 1;if(T(K.language).supersetOf===te.language)return-1}return 0}),[Y,J]=R,U=Y;return U.secondBest=J,U}function m(A,O,P){const $=O&&n[O]||P;A.classList.add("hljs"),A.classList.add(`language-${$}`)}function b(A){let O=null;const P=u(A);if(c(P))return;if(D("before:highlightElement",{el:A,language:P}),A.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",A);return}if(A.children.length>0&&(l.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)),l.throwUnescapedHTML))throw new T1e("One of your code blocks includes unescaped HTML.",A.innerHTML);O=A;const $=O.textContent,R=P?d($,{language:P,ignoreIllegals:!0}):p($);A.innerHTML=R.value,A.dataset.highlighted="yes",m(A,P,R.language),A.result={language:R.language,re:R.relevance,relevance:R.relevance},R.secondBest&&(A.secondBest={language:R.secondBest.language,relevance:R.secondBest.relevance}),D("after:highlightElement",{el:A,result:R,text:$})}function v(A){l=yL(l,A)}const y=()=>{w(),qu("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function x(){w(),qu("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let E=!1;function w(){function A(){w()}if(document.readyState==="loading"){E||window.addEventListener("DOMContentLoaded",A,!1),E=!0;return}document.querySelectorAll(l.cssSelector).forEach(b)}function _(A,O){let P=null;try{P=O(e)}catch($){if(Qc("Language definition for '{}' could not be registered.".replace("{}",A)),i)Qc($);else throw $;P=a}P.name||(P.name=A),t[A]=P,P.rawDefinition=O.bind(null,e),P.aliases&&C(P.aliases,{languageName:A})}function S(A){delete t[A];for(const O of Object.keys(n))n[O]===A&&delete n[O]}function k(){return Object.keys(t)}function T(A){return A=(A||"").toLowerCase(),t[A]||t[n[A]]}function C(A,{languageName:O}){typeof A=="string"&&(A=[A]),A.forEach(P=>{n[P.toLowerCase()]=O})}function I(A){const O=T(A);return O&&!O.disableAutodetect}function j(A){A["before:highlightBlock"]&&!A["before:highlightElement"]&&(A["before:highlightElement"]=O=>{A["before:highlightBlock"](Object.assign({block:O.el},O))}),A["after:highlightBlock"]&&!A["after:highlightElement"]&&(A["after:highlightElement"]=O=>{A["after:highlightBlock"](Object.assign({block:O.el},O))})}function L(A){j(A),s.push(A)}function z(A){const O=s.indexOf(A);O!==-1&&s.splice(O,1)}function D(A,O){const P=A;s.forEach(function($){$[P]&&$[P](O)})}function F(A){return qu("10.7.0","highlightBlock will be removed entirely in v12.0"),qu("10.7.0","Please use highlightElement now."),b(A)}Object.assign(e,{highlight:d,highlightAuto:p,highlightAll:w,highlightElement:b,highlightBlock:F,configure:v,initHighlighting:y,initHighlightingOnLoad:x,registerLanguage:_,unregisterLanguage:S,listLanguages:k,getLanguage:T,registerAliases:C,autoDetection:I,inherit:yL,addPlugin:L,removePlugin:z}),e.debugMode=function(){i=!1},e.safeMode=function(){i=!0},e.versionString=N1e,e.regex={concat:ku,lookahead:DF,either:MA,optional:$xe,anyNumberOfTimes:Fxe};for(const A in X0)typeof X0[A]=="object"&&MF(X0[A]);return Object.assign(e,X0),e},If=GF({});If.newInstance=()=>GF({});var A1e=If;If.HighlightJS=If;If.default=If;const lr=Df(A1e),EL={},C1e="hljs-";function I1e(e){const t=lr.newInstance();return e&&r(e),{highlight:n,highlightAuto:s,listLanguages:i,register:r,registerAlias:a,registered:l};function n(c,u,d){const f=d||EL,h=typeof f.prefix=="string"?f.prefix:C1e;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:j1e,classPrefix:h});const p=t.highlight(u,{ignoreIllegals:!0,language:c});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 s(c,u){const f=(u||EL).subset||i();let h=-1,p=0,m;for(;++hp&&(p=v.data.relevance,m=v)}return m||{type:"root",children:[],data:{language:void 0,relevance:p}}}function i(){return t.listLanguages()}function r(c,u){if(typeof c=="string")t.registerLanguage(c,u);else{let d;for(d in c)Object.hasOwn(c,d)&&t.registerLanguage(d,c[d])}}function a(c,u){if(typeof c=="string")t.registerAliases(typeof u=="string"?u:[...u],{languageName:c});else{let d;for(d in c)if(Object.hasOwn(c,d)){const f=c[d];t.registerAliases(typeof f=="string"?f:[...f],{languageName:d})}}}function l(c){return!!t.getLanguage(c)}}class j1e{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],s=n.children[n.children.length-1];s&&s.type==="text"?s.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const s=this.stack[this.stack.length-1],i=t.root.children;n?s.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):s.children.push(...i)}openNode(t){const n=this,s=t.split(".").map(function(a,l){return l?a+"_".repeat(l):n.options.classPrefix+a}),i=this.stack[this.stack.length-1],r={type:"element",tagName:"span",properties:{className:s},children:[]};i.children.push(r),this.stack.push(r)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const R1e={};function vL(e){const t=e||R1e,n=t.aliases,s=t.detect||!1,i=t.languages||Lxe,r=t.plainText,a=t.prefix,l=t.subset;let c="hljs";const u=I1e(i);if(n&&u.registerAlias(n),a){const d=a.indexOf("-");c=d===-1?a:a.slice(0,d)}return function(d,f){_g(d,"element",function(h,p,m){if(h.tagName!=="code"||!m||m.type!=="element"||m.tagName!=="pre")return;const b=O1e(h);if(b===!1||!b&&!s||b&&r&&r.includes(b))return;Array.isArray(h.properties.className)||(h.properties.className=[]),h.properties.className.includes(c)||h.properties.className.unshift(c);const v=gye(h,{whitespace:"pre"});let y;try{y=b?u.highlight(b,v,{prefix:a}):u.highlightAuto(v,{prefix:a,subset:l})}catch(x){const E=x;if(b&&/Unknown language/.test(E.message)){f.message("Cannot highlight as `"+b+"`, it’s not registered",{ancestors:[m,h],cause:E,place:h.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw E}!b&&y.data&&y.data.language&&h.properties.className.push("language-"+y.data.language),y.children.length>0&&(h.children=y.children)})}}function O1e(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let s;for(;++n-1&&r<=t.length){let a=0;for(;;){let l=n[a];if(l===void 0){const c=_L(t,n[a-1]);l=c===-1?t.length+1:c+1,n[a]=l}if(l>r)return{line:a+1,column:r-(a>0?n[a-1]:0)+1,offset:r};a++}}}function i(r){if(r&&typeof r.line=="number"&&typeof r.column=="number"&&!Number.isNaN(r.line)&&!Number.isNaN(r.column)){for(;n.length1?n[r.line-2]:0)+r.column-1;if(a=55296&&e<=57343}function rEe(e){return e>=56320&&e<=57343}function aEe(e,t){return(e-55296)*1024+9216+t}function QF(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function ZF(e){return e>=64976&&e<=65007||iEe.has(e)}var Ee;(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"})(Ee||(Ee={}));const oEe=65536;class lEe{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=oEe,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:s,col:i,offset:r}=this,a=i+n,l=r+n;return{code:t,startLine:s,endLine:s,startCol:a,endCol:a,startOffset:l,endOffset:l}}_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(rEe(n))return this.pos++,this._addGap(),aEe(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,G.EOF;return this._err(Ee.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 s=0;s=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,G.EOF;const s=this.html.charCodeAt(n);return s===G.CARRIAGE_RETURN?G.LINE_FEED:s}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,G.EOF;let t=this.html.charCodeAt(this.pos);return t===G.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,G.LINE_FEED):t===G.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,XF(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===G.LINE_FEED||t===G.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){QF(t)?this._err(Ee.controlCharacterInInputStream):ZF(t)&&this._err(Ee.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 cEe=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))),uEe=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 dEe(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=uEe.get(e))!==null&&t!==void 0?t:e}var di;(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"})(di||(di={}));const fEe=32;var Rl;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Rl||(Rl={}));function iN(e){return e>=di.ZERO&&e<=di.NINE}function hEe(e){return e>=di.UPPER_A&&e<=di.UPPER_F||e>=di.LOWER_A&&e<=di.LOWER_F}function pEe(e){return e>=di.UPPER_A&&e<=di.UPPER_Z||e>=di.LOWER_A&&e<=di.LOWER_Z||iN(e)}function mEe(e){return e===di.EQUALS||pEe(e)}var oi;(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"})(oi||(oi={}));var Ao;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Ao||(Ao={}));class gEe{constructor(t,n,s){this.decodeTree=t,this.emitCodePoint=n,this.errors=s,this.state=oi.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Ao.Strict}startEntity(t){this.decodeMode=t,this.state=oi.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case oi.EntityStart:return t.charCodeAt(n)===di.NUM?(this.state=oi.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=oi.NamedEntity,this.stateNamedEntity(t,n));case oi.NumericStart:return this.stateNumericStart(t,n);case oi.NumericDecimal:return this.stateNumericDecimal(t,n);case oi.NumericHex:return this.stateNumericHex(t,n);case oi.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|fEe)===di.LOWER_X?(this.state=oi.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=oi.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,s,i){if(n!==s){const r=s-n;this.result=this.result*Math.pow(i,r)+Number.parseInt(t.substr(n,r),i),this.consumed+=r}}stateNumericHex(t,n){const s=n;for(;n>14;for(;n>14,r!==0){if(a===di.SEMI)return this.emitNamedEntityData(this.treeIndex,r,this.consumed+this.excess);this.decodeMode!==Ao.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:s}=this,i=(s[n]&Rl.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,s){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[t]&~Rl.VALUE_LENGTH:i[t+1],s),n===3&&this.emitCodePoint(i[t+2],s),s}end(){var t;switch(this.state){case oi.NamedEntity:return this.result!==0&&(this.decodeMode!==Ao.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case oi.NumericDecimal:return this.emitNumericEntity(0,2);case oi.NumericHex:return this.emitNumericEntity(0,3);case oi.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case oi.EntityStart:return 0}}}function bEe(e,t,n,s){const i=(t&Rl.BRANCH_LENGTH)>>7,r=t&Rl.JUMP_TABLE;if(i===0)return r!==0&&s===r?n:-1;if(r){const c=s-r;return c<0||c>=i?-1:e[n+c]-1}let a=n,l=a+i-1;for(;a<=l;){const c=a+l>>>1,u=e[c];if(us)l=c-1;else return e[c+i]}return-1}var Re;(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/"})(Re||(Re={}));var Zc;(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"})(Zc||(Zc={}));var Yr;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Yr||(Yr={}));var fe;(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"})(fe||(fe={}));var N;(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"})(N||(N={}));const yEe=new Map([[fe.A,N.A],[fe.ADDRESS,N.ADDRESS],[fe.ANNOTATION_XML,N.ANNOTATION_XML],[fe.APPLET,N.APPLET],[fe.AREA,N.AREA],[fe.ARTICLE,N.ARTICLE],[fe.ASIDE,N.ASIDE],[fe.B,N.B],[fe.BASE,N.BASE],[fe.BASEFONT,N.BASEFONT],[fe.BGSOUND,N.BGSOUND],[fe.BIG,N.BIG],[fe.BLOCKQUOTE,N.BLOCKQUOTE],[fe.BODY,N.BODY],[fe.BR,N.BR],[fe.BUTTON,N.BUTTON],[fe.CAPTION,N.CAPTION],[fe.CENTER,N.CENTER],[fe.CODE,N.CODE],[fe.COL,N.COL],[fe.COLGROUP,N.COLGROUP],[fe.DD,N.DD],[fe.DESC,N.DESC],[fe.DETAILS,N.DETAILS],[fe.DIALOG,N.DIALOG],[fe.DIR,N.DIR],[fe.DIV,N.DIV],[fe.DL,N.DL],[fe.DT,N.DT],[fe.EM,N.EM],[fe.EMBED,N.EMBED],[fe.FIELDSET,N.FIELDSET],[fe.FIGCAPTION,N.FIGCAPTION],[fe.FIGURE,N.FIGURE],[fe.FONT,N.FONT],[fe.FOOTER,N.FOOTER],[fe.FOREIGN_OBJECT,N.FOREIGN_OBJECT],[fe.FORM,N.FORM],[fe.FRAME,N.FRAME],[fe.FRAMESET,N.FRAMESET],[fe.H1,N.H1],[fe.H2,N.H2],[fe.H3,N.H3],[fe.H4,N.H4],[fe.H5,N.H5],[fe.H6,N.H6],[fe.HEAD,N.HEAD],[fe.HEADER,N.HEADER],[fe.HGROUP,N.HGROUP],[fe.HR,N.HR],[fe.HTML,N.HTML],[fe.I,N.I],[fe.IMG,N.IMG],[fe.IMAGE,N.IMAGE],[fe.INPUT,N.INPUT],[fe.IFRAME,N.IFRAME],[fe.KEYGEN,N.KEYGEN],[fe.LABEL,N.LABEL],[fe.LI,N.LI],[fe.LINK,N.LINK],[fe.LISTING,N.LISTING],[fe.MAIN,N.MAIN],[fe.MALIGNMARK,N.MALIGNMARK],[fe.MARQUEE,N.MARQUEE],[fe.MATH,N.MATH],[fe.MENU,N.MENU],[fe.META,N.META],[fe.MGLYPH,N.MGLYPH],[fe.MI,N.MI],[fe.MO,N.MO],[fe.MN,N.MN],[fe.MS,N.MS],[fe.MTEXT,N.MTEXT],[fe.NAV,N.NAV],[fe.NOBR,N.NOBR],[fe.NOFRAMES,N.NOFRAMES],[fe.NOEMBED,N.NOEMBED],[fe.NOSCRIPT,N.NOSCRIPT],[fe.OBJECT,N.OBJECT],[fe.OL,N.OL],[fe.OPTGROUP,N.OPTGROUP],[fe.OPTION,N.OPTION],[fe.P,N.P],[fe.PARAM,N.PARAM],[fe.PLAINTEXT,N.PLAINTEXT],[fe.PRE,N.PRE],[fe.RB,N.RB],[fe.RP,N.RP],[fe.RT,N.RT],[fe.RTC,N.RTC],[fe.RUBY,N.RUBY],[fe.S,N.S],[fe.SCRIPT,N.SCRIPT],[fe.SEARCH,N.SEARCH],[fe.SECTION,N.SECTION],[fe.SELECT,N.SELECT],[fe.SOURCE,N.SOURCE],[fe.SMALL,N.SMALL],[fe.SPAN,N.SPAN],[fe.STRIKE,N.STRIKE],[fe.STRONG,N.STRONG],[fe.STYLE,N.STYLE],[fe.SUB,N.SUB],[fe.SUMMARY,N.SUMMARY],[fe.SUP,N.SUP],[fe.TABLE,N.TABLE],[fe.TBODY,N.TBODY],[fe.TEMPLATE,N.TEMPLATE],[fe.TEXTAREA,N.TEXTAREA],[fe.TFOOT,N.TFOOT],[fe.TD,N.TD],[fe.TH,N.TH],[fe.THEAD,N.THEAD],[fe.TITLE,N.TITLE],[fe.TR,N.TR],[fe.TRACK,N.TRACK],[fe.TT,N.TT],[fe.U,N.U],[fe.UL,N.UL],[fe.SVG,N.SVG],[fe.VAR,N.VAR],[fe.WBR,N.WBR],[fe.XMP,N.XMP]]);function sh(e){var t;return(t=yEe.get(e))!==null&&t!==void 0?t:N.UNKNOWN}const Oe=N,xEe={[Re.HTML]:new Set([Oe.ADDRESS,Oe.APPLET,Oe.AREA,Oe.ARTICLE,Oe.ASIDE,Oe.BASE,Oe.BASEFONT,Oe.BGSOUND,Oe.BLOCKQUOTE,Oe.BODY,Oe.BR,Oe.BUTTON,Oe.CAPTION,Oe.CENTER,Oe.COL,Oe.COLGROUP,Oe.DD,Oe.DETAILS,Oe.DIR,Oe.DIV,Oe.DL,Oe.DT,Oe.EMBED,Oe.FIELDSET,Oe.FIGCAPTION,Oe.FIGURE,Oe.FOOTER,Oe.FORM,Oe.FRAME,Oe.FRAMESET,Oe.H1,Oe.H2,Oe.H3,Oe.H4,Oe.H5,Oe.H6,Oe.HEAD,Oe.HEADER,Oe.HGROUP,Oe.HR,Oe.HTML,Oe.IFRAME,Oe.IMG,Oe.INPUT,Oe.LI,Oe.LINK,Oe.LISTING,Oe.MAIN,Oe.MARQUEE,Oe.MENU,Oe.META,Oe.NAV,Oe.NOEMBED,Oe.NOFRAMES,Oe.NOSCRIPT,Oe.OBJECT,Oe.OL,Oe.P,Oe.PARAM,Oe.PLAINTEXT,Oe.PRE,Oe.SCRIPT,Oe.SECTION,Oe.SELECT,Oe.SOURCE,Oe.STYLE,Oe.SUMMARY,Oe.TABLE,Oe.TBODY,Oe.TD,Oe.TEMPLATE,Oe.TEXTAREA,Oe.TFOOT,Oe.TH,Oe.THEAD,Oe.TITLE,Oe.TR,Oe.TRACK,Oe.UL,Oe.WBR,Oe.XMP]),[Re.MATHML]:new Set([Oe.MI,Oe.MO,Oe.MN,Oe.MS,Oe.MTEXT,Oe.ANNOTATION_XML]),[Re.SVG]:new Set([Oe.TITLE,Oe.FOREIGN_OBJECT,Oe.DESC]),[Re.XLINK]:new Set,[Re.XML]:new Set,[Re.XMLNS]:new Set},rN=new Set([Oe.H1,Oe.H2,Oe.H3,Oe.H4,Oe.H5,Oe.H6]);fe.STYLE,fe.SCRIPT,fe.XMP,fe.IFRAME,fe.NOEMBED,fe.NOFRAMES,fe.PLAINTEXT;var X;(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"})(X||(X={}));const Bs={DATA:X.DATA,RCDATA:X.RCDATA,RAWTEXT:X.RAWTEXT,SCRIPT_DATA:X.SCRIPT_DATA,PLAINTEXT:X.PLAINTEXT,CDATA_SECTION:X.CDATA_SECTION};function EEe(e){return e>=G.DIGIT_0&&e<=G.DIGIT_9}function hp(e){return e>=G.LATIN_CAPITAL_A&&e<=G.LATIN_CAPITAL_Z}function vEe(e){return e>=G.LATIN_SMALL_A&&e<=G.LATIN_SMALL_Z}function pl(e){return vEe(e)||hp(e)}function TL(e){return pl(e)||EEe(e)}function Q0(e){return e+32}function e$(e){return e===G.SPACE||e===G.LINE_FEED||e===G.TABULATION||e===G.FORM_FEED}function kL(e){return e$(e)||e===G.SOLIDUS||e===G.GREATER_THAN_SIGN}function wEe(e){return e===G.NULL?Ee.nullCharacterReference:e>1114111?Ee.characterReferenceOutsideUnicodeRange:XF(e)?Ee.surrogateCharacterReference:ZF(e)?Ee.noncharacterCharacterReference:QF(e)||e===G.CARRIAGE_RETURN?Ee.controlCharacterReference:null}class SEe{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=X.DATA,this.returnState=X.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new lEe(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new gEe(cEe,(s,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(s)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(Ee.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:s=>{this._err(Ee.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+s)},validateNumericCharacterReference:s=>{const i=wEe(s);i&&this._err(i,1)}}:void 0)}_err(t,n=0){var s,i;(i=(s=this.handler).onParseError)===null||i===void 0||i.call(s,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,s){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||s==null||s()}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(Ee.endTagWithAttributes),t.selfClosing&&this._err(Ee.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 zt.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case zt.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case zt.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:zt.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=e$(t)?zt.WHITESPACE_CHARACTER:t===G.NULL?zt.NULL_CHARACTER:zt.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(zt.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=X.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Ao.Attribute:Ao.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===X.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===X.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===X.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case X.DATA:{this._stateData(t);break}case X.RCDATA:{this._stateRcdata(t);break}case X.RAWTEXT:{this._stateRawtext(t);break}case X.SCRIPT_DATA:{this._stateScriptData(t);break}case X.PLAINTEXT:{this._statePlaintext(t);break}case X.TAG_OPEN:{this._stateTagOpen(t);break}case X.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case X.TAG_NAME:{this._stateTagName(t);break}case X.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case X.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case X.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case X.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case X.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case X.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case X.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case X.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case X.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case X.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case X.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case X.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case X.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case X.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case X.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case X.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case X.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case X.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case X.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case X.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case X.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case X.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case X.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case X.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case X.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case X.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case X.BOGUS_COMMENT:{this._stateBogusComment(t);break}case X.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case X.COMMENT_START:{this._stateCommentStart(t);break}case X.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case X.COMMENT:{this._stateComment(t);break}case X.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case X.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case X.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case X.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case X.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case X.COMMENT_END:{this._stateCommentEnd(t);break}case X.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case X.DOCTYPE:{this._stateDoctype(t);break}case X.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case X.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case X.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case X.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case X.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case X.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case X.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case X.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case X.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case X.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case X.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case X.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case X.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case X.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case X.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case X.CDATA_SECTION:{this._stateCdataSection(t);break}case X.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case X.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case X.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case X.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case G.LESS_THAN_SIGN:{this.state=X.TAG_OPEN;break}case G.AMPERSAND:{this._startCharacterReference();break}case G.NULL:{this._err(Ee.unexpectedNullCharacter),this._emitCodePoint(t);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case G.AMPERSAND:{this._startCharacterReference();break}case G.LESS_THAN_SIGN:{this.state=X.RCDATA_LESS_THAN_SIGN;break}case G.NULL:{this._err(Ee.unexpectedNullCharacter),this._emitChars(fs);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case G.LESS_THAN_SIGN:{this.state=X.RAWTEXT_LESS_THAN_SIGN;break}case G.NULL:{this._err(Ee.unexpectedNullCharacter),this._emitChars(fs);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case G.LESS_THAN_SIGN:{this.state=X.SCRIPT_DATA_LESS_THAN_SIGN;break}case G.NULL:{this._err(Ee.unexpectedNullCharacter),this._emitChars(fs);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case G.NULL:{this._err(Ee.unexpectedNullCharacter),this._emitChars(fs);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(pl(t))this._createStartTagToken(),this.state=X.TAG_NAME,this._stateTagName(t);else switch(t){case G.EXCLAMATION_MARK:{this.state=X.MARKUP_DECLARATION_OPEN;break}case G.SOLIDUS:{this.state=X.END_TAG_OPEN;break}case G.QUESTION_MARK:{this._err(Ee.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=X.BOGUS_COMMENT,this._stateBogusComment(t);break}case G.EOF:{this._err(Ee.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(Ee.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=X.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(pl(t))this._createEndTagToken(),this.state=X.TAG_NAME,this._stateTagName(t);else switch(t){case G.GREATER_THAN_SIGN:{this._err(Ee.missingEndTagName),this.state=X.DATA;break}case G.EOF:{this._err(Ee.eofBeforeTagName),this._emitChars("");break}case G.NULL:{this._err(Ee.unexpectedNullCharacter),this.state=X.SCRIPT_DATA_ESCAPED,this._emitChars(fs);break}case G.EOF:{this._err(Ee.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=X.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===G.SOLIDUS?this.state=X.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:pl(t)?(this._emitChars("<"),this.state=X.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=X.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){pl(t)?(this.state=X.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case G.NULL:{this._err(Ee.unexpectedNullCharacter),this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(fs);break}case G.EOF:{this._err(Ee.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===G.SOLIDUS?(this.state=X.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(tr.SCRIPT,!1)&&kL(this.preprocessor.peek(tr.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 s=this._indexOf(t);this.items[s]=n,s===this.stackTop&&(this.current=n)}insertAfter(t,n,s){const i=this._indexOf(t)+1;this.items.splice(i,0,n),this.tagIDs.splice(i,0,s),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])!==Re.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;s--)if(t.has(this.tagIDs[s])&&this.treeAdapter.getNamespaceURI(this.items[s])===n)return s;return-1}clearBackTo(t,n){const s=this._indexOfTagNames(t,n);this.shortenToLength(s+1)}clearBackToTableContext(){this.clearBackTo(AEe,Re.HTML)}clearBackToTableBodyContext(){this.clearBackTo(kEe,Re.HTML)}clearBackToTableRowContext(){this.clearBackTo(TEe,Re.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]===N.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]===N.HTML}hasInDynamicScope(t,n){for(let s=this.stackTop;s>=0;s--){const i=this.tagIDs[s];switch(this.treeAdapter.getNamespaceURI(this.items[s])){case Re.HTML:{if(i===t)return!0;if(n.has(i))return!1;break}case Re.SVG:{if(IL.has(i))return!1;break}case Re.MATHML:{if(CL.has(i))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,dx)}hasInListItemScope(t){return this.hasInDynamicScope(t,_Ee)}hasInButtonScope(t){return this.hasInDynamicScope(t,NEe)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case Re.HTML:{if(rN.has(n))return!0;if(dx.has(n))return!1;break}case Re.SVG:{if(IL.has(n))return!1;break}case Re.MATHML:{if(CL.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===Re.HTML)switch(this.tagIDs[n]){case t:return!0;case N.TABLE:case N.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===Re.HTML)switch(this.tagIDs[t]){case N.TBODY:case N.THEAD:case N.TFOOT:return!0;case N.TABLE:case N.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===Re.HTML)switch(this.tagIDs[n]){case t:return!0;case N.OPTION:case N.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&t$.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&AL.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&AL.has(this.currentTagId);)this.pop()}}const mw=3;var Ya;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(Ya||(Ya={}));const jL={type:Ya.Marker};class jEe{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const s=[],i=n.length,r=this.treeAdapter.getTagName(t),a=this.treeAdapter.getNamespaceURI(t);for(let l=0;l[a.name,a.value]));let r=0;for(let a=0;ai.get(c.name)===c.value)&&(r+=1,r>=mw&&this.entries.splice(l.idx,1))}}insertMarker(){this.entries.unshift(jL)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:Ya.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const s=this.entries.indexOf(this.bookmark);this.entries.splice(s,0,{type:Ya.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(jL);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(s=>s.type===Ya.Marker||this.treeAdapter.getTagName(s.element)===t);return n&&n.type===Ya.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===Ya.Element&&n.element===t)}}const ml={createDocument(){return{nodeName:"#document",mode:Yr.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 s=e.childNodes.indexOf(n);e.childNodes.splice(s,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,s){const i=e.childNodes.find(r=>r.nodeName==="#documentType");if(i)i.name=t,i.publicId=n,i.systemId=s;else{const r={nodeName:"#documentType",name:t,publicId:n,systemId:s,parentNode:null};ml.appendChild(e,r)}},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(ml.isTextNode(n)){n.value+=t;return}}ml.appendChild(e,ml.createTextNode(t))},insertTextBefore(e,t,n){const s=e.childNodes[e.childNodes.indexOf(n)-1];s&&ml.isTextNode(s)?s.value+=t:ml.insertBefore(e,ml.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(s=>s.name));for(let s=0;se.startsWith(n))}function PEe(e){return e.name===n$&&e.publicId===null&&(e.systemId===null||e.systemId===REe)}function BEe(e){if(e.name!==n$)return Yr.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===OEe)return Yr.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),LEe.has(n))return Yr.QUIRKS;let s=t===null?MEe:s$;if(RL(n,s))return Yr.QUIRKS;if(s=t===null?i$:DEe,RL(n,s))return Yr.LIMITED_QUIRKS}return Yr.NO_QUIRKS}const OL={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},UEe="definitionurl",FEe="definitionURL",$Ee=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])),HEe=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:Re.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:Re.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:Re.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:Re.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:Re.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:Re.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:Re.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:Re.XML}],["xml:space",{prefix:"xml",name:"space",namespace:Re.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:Re.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:Re.XMLNS}]]),zEe=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])),VEe=new Set([N.B,N.BIG,N.BLOCKQUOTE,N.BODY,N.BR,N.CENTER,N.CODE,N.DD,N.DIV,N.DL,N.DT,N.EM,N.EMBED,N.H1,N.H2,N.H3,N.H4,N.H5,N.H6,N.HEAD,N.HR,N.I,N.IMG,N.LI,N.LISTING,N.MENU,N.META,N.NOBR,N.OL,N.P,N.PRE,N.RUBY,N.S,N.SMALL,N.SPAN,N.STRONG,N.STRIKE,N.SUB,N.SUP,N.TABLE,N.TT,N.U,N.UL,N.VAR]);function GEe(e){const t=e.tagID;return t===N.FONT&&e.attrs.some(({name:s})=>s===Zc.COLOR||s===Zc.SIZE||s===Zc.FACE)||VEe.has(t)}function r$(e){for(let t=0;t0&&this._setContextModes(t,n)}onItemPop(t,n){var s,i;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(i=(s=this.treeAdapter).onItemPop)===null||i===void 0||i.call(s,t,this.openElements.current),n){let r,a;this.openElements.stackTop===0&&this.fragmentContext?(r=this.fragmentContext,a=this.fragmentContextID):{current:r,currentTagId:a}=this.openElements,this._setContextModes(r,a)}}_setContextModes(t,n){const s=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===Re.HTML;this.currentNotInHTML=!s,this.tokenizer.inForeignNode=!s&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,Re.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=ee.TEXT}switchToPlaintextParsing(){this.insertionMode=ee.TEXT,this.originalInsertionMode=ee.IN_BODY,this.tokenizer.state=Bs.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)===fe.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==Re.HTML))switch(this.fragmentContextID){case N.TITLE:case N.TEXTAREA:{this.tokenizer.state=Bs.RCDATA;break}case N.STYLE:case N.XMP:case N.IFRAME:case N.NOEMBED:case N.NOFRAMES:case N.NOSCRIPT:{this.tokenizer.state=Bs.RAWTEXT;break}case N.SCRIPT:{this.tokenizer.state=Bs.SCRIPT_DATA;break}case N.PLAINTEXT:{this.tokenizer.state=Bs.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",s=t.publicId||"",i=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,s,i),t.location){const a=this.treeAdapter.getChildNodes(this.document).find(l=>this.treeAdapter.isDocumentTypeNode(l));a&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const s=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,s)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const s=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(s??this.document,t)}}_appendElement(t,n){const s=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(s,t.location)}_insertElement(t,n){const s=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(s,t.location),this.openElements.push(s,t.tagID)}_insertFakeElement(t,n){const s=this.treeAdapter.createElement(t,Re.HTML,[]);this._attachElementToTree(s,null),this.openElements.push(s,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,Re.HTML,t.attrs),s=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,s),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(s,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(fe.HTML,Re.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,N.HTML)}_appendCommentNode(t,n){const s=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,s),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(s,t.location)}_insertCharacters(t){let n,s;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:s}=this._findFosterParentingLocation(),s?this.treeAdapter.insertTextBefore(n,t.chars,s):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),r=s?i.lastIndexOf(s):i.length,a=i[r-1];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:c,endCol:u,endOffset:d}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:c,endCol:u,endOffset:d})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}_adoptNodes(t,n){for(let s=this.treeAdapter.getFirstChild(t);s;s=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(s),this.treeAdapter.appendChild(n,s)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const s=n.location,i=this.treeAdapter.getTagName(t),r=n.type===zt.END_TAG&&i===n.tagName?{endTag:{...s},endLine:s.endLine,endCol:s.endCol,endOffset:s.endOffset}:{endLine:s.startLine,endCol:s.startCol,endOffset:s.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,r)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,s;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,s=this.fragmentContextID):{current:n,currentTagId:s}=this.openElements,t.tagID===N.SVG&&this.treeAdapter.getTagName(n)===fe.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===Re.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===N.MGLYPH||t.tagID===N.MALIGNMARK)&&s!==void 0&&!this._isIntegrationPoint(s,n,Re.HTML)}_processToken(t){switch(t.type){case zt.CHARACTER:{this.onCharacter(t);break}case zt.NULL_CHARACTER:{this.onNullCharacter(t);break}case zt.COMMENT:{this.onComment(t);break}case zt.DOCTYPE:{this.onDoctype(t);break}case zt.START_TAG:{this._processStartTag(t);break}case zt.END_TAG:{this.onEndTag(t);break}case zt.EOF:{this.onEof(t);break}case zt.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,s){const i=this.treeAdapter.getNamespaceURI(n),r=this.treeAdapter.getAttrList(n);return WEe(t,i,r,s)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(i=>i.type===Ya.Marker||this.openElements.contains(i.element)),s=n===-1?t-1:n-1;for(let i=s;i>=0;i--){const r=this.activeFormattingElements.entries[i];this._insertElement(r.token,this.treeAdapter.getNamespaceURI(r.element)),r.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=ee.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(N.P),this.openElements.popUntilTagNamePopped(N.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case N.TR:{this.insertionMode=ee.IN_ROW;return}case N.TBODY:case N.THEAD:case N.TFOOT:{this.insertionMode=ee.IN_TABLE_BODY;return}case N.CAPTION:{this.insertionMode=ee.IN_CAPTION;return}case N.COLGROUP:{this.insertionMode=ee.IN_COLUMN_GROUP;return}case N.TABLE:{this.insertionMode=ee.IN_TABLE;return}case N.BODY:{this.insertionMode=ee.IN_BODY;return}case N.FRAMESET:{this.insertionMode=ee.IN_FRAMESET;return}case N.SELECT:{this._resetInsertionModeForSelect(t);return}case N.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case N.HTML:{this.insertionMode=this.headElement?ee.AFTER_HEAD:ee.BEFORE_HEAD;return}case N.TD:case N.TH:{if(t>0){this.insertionMode=ee.IN_CELL;return}break}case N.HEAD:{if(t>0){this.insertionMode=ee.IN_HEAD;return}break}}this.insertionMode=ee.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const s=this.openElements.tagIDs[n];if(s===N.TEMPLATE)break;if(s===N.TABLE){this.insertionMode=ee.IN_SELECT_IN_TABLE;return}}this.insertionMode=ee.IN_SELECT}_isElementCausesFosterParenting(t){return o$.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 N.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===Re.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case N.TABLE:{const s=this.treeAdapter.getParentNode(n);return s?{parent:s,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 s=this.treeAdapter.getNamespaceURI(t);return xEe[s].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Cwe(this,t);return}switch(this.insertionMode){case ee.INITIAL:{qh(this,t);break}case ee.BEFORE_HTML:{Kp(this,t);break}case ee.BEFORE_HEAD:{qp(this,t);break}case ee.IN_HEAD:{Yp(this,t);break}case ee.IN_HEAD_NO_SCRIPT:{Wp(this,t);break}case ee.AFTER_HEAD:{Xp(this,t);break}case ee.IN_BODY:case ee.IN_CAPTION:case ee.IN_CELL:case ee.IN_TEMPLATE:{c$(this,t);break}case ee.TEXT:case ee.IN_SELECT:case ee.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case ee.IN_TABLE:case ee.IN_TABLE_BODY:case ee.IN_ROW:{gw(this,t);break}case ee.IN_TABLE_TEXT:{m$(this,t);break}case ee.IN_COLUMN_GROUP:{fx(this,t);break}case ee.AFTER_BODY:{hx(this,t);break}case ee.AFTER_AFTER_BODY:{Kb(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Awe(this,t);return}switch(this.insertionMode){case ee.INITIAL:{qh(this,t);break}case ee.BEFORE_HTML:{Kp(this,t);break}case ee.BEFORE_HEAD:{qp(this,t);break}case ee.IN_HEAD:{Yp(this,t);break}case ee.IN_HEAD_NO_SCRIPT:{Wp(this,t);break}case ee.AFTER_HEAD:{Xp(this,t);break}case ee.TEXT:{this._insertCharacters(t);break}case ee.IN_TABLE:case ee.IN_TABLE_BODY:case ee.IN_ROW:{gw(this,t);break}case ee.IN_COLUMN_GROUP:{fx(this,t);break}case ee.AFTER_BODY:{hx(this,t);break}case ee.AFTER_AFTER_BODY:{Kb(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){aN(this,t);return}switch(this.insertionMode){case ee.INITIAL:case ee.BEFORE_HTML:case ee.BEFORE_HEAD:case ee.IN_HEAD:case ee.IN_HEAD_NO_SCRIPT:case ee.AFTER_HEAD:case ee.IN_BODY:case ee.IN_TABLE:case ee.IN_CAPTION:case ee.IN_COLUMN_GROUP:case ee.IN_TABLE_BODY:case ee.IN_ROW:case ee.IN_CELL:case ee.IN_SELECT:case ee.IN_SELECT_IN_TABLE:case ee.IN_TEMPLATE:case ee.IN_FRAMESET:case ee.AFTER_FRAMESET:{aN(this,t);break}case ee.IN_TABLE_TEXT:{Yh(this,t);break}case ee.AFTER_BODY:{ave(this,t);break}case ee.AFTER_AFTER_BODY:case ee.AFTER_AFTER_FRAMESET:{ove(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case ee.INITIAL:{lve(this,t);break}case ee.BEFORE_HEAD:case ee.IN_HEAD:case ee.IN_HEAD_NO_SCRIPT:case ee.AFTER_HEAD:{this._err(t,Ee.misplacedDoctype);break}case ee.IN_TABLE_TEXT:{Yh(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,Ee.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?Iwe(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case ee.INITIAL:{qh(this,t);break}case ee.BEFORE_HTML:{cve(this,t);break}case ee.BEFORE_HEAD:{dve(this,t);break}case ee.IN_HEAD:{Ma(this,t);break}case ee.IN_HEAD_NO_SCRIPT:{pve(this,t);break}case ee.AFTER_HEAD:{gve(this,t);break}case ee.IN_BODY:{Bi(this,t);break}case ee.IN_TABLE:{jf(this,t);break}case ee.IN_TABLE_TEXT:{Yh(this,t);break}case ee.IN_CAPTION:{fwe(this,t);break}case ee.IN_COLUMN_GROUP:{HA(this,t);break}case ee.IN_TABLE_BODY:{L1(this,t);break}case ee.IN_ROW:{D1(this,t);break}case ee.IN_CELL:{mwe(this,t);break}case ee.IN_SELECT:{y$(this,t);break}case ee.IN_SELECT_IN_TABLE:{bwe(this,t);break}case ee.IN_TEMPLATE:{xwe(this,t);break}case ee.AFTER_BODY:{vwe(this,t);break}case ee.IN_FRAMESET:{wwe(this,t);break}case ee.AFTER_FRAMESET:{_we(this,t);break}case ee.AFTER_AFTER_BODY:{Twe(this,t);break}case ee.AFTER_AFTER_FRAMESET:{kwe(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?jwe(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case ee.INITIAL:{qh(this,t);break}case ee.BEFORE_HTML:{uve(this,t);break}case ee.BEFORE_HEAD:{fve(this,t);break}case ee.IN_HEAD:{hve(this,t);break}case ee.IN_HEAD_NO_SCRIPT:{mve(this,t);break}case ee.AFTER_HEAD:{bve(this,t);break}case ee.IN_BODY:{M1(this,t);break}case ee.TEXT:{nwe(this,t);break}case ee.IN_TABLE:{Fm(this,t);break}case ee.IN_TABLE_TEXT:{Yh(this,t);break}case ee.IN_CAPTION:{hwe(this,t);break}case ee.IN_COLUMN_GROUP:{pwe(this,t);break}case ee.IN_TABLE_BODY:{oN(this,t);break}case ee.IN_ROW:{b$(this,t);break}case ee.IN_CELL:{gwe(this,t);break}case ee.IN_SELECT:{x$(this,t);break}case ee.IN_SELECT_IN_TABLE:{ywe(this,t);break}case ee.IN_TEMPLATE:{Ewe(this,t);break}case ee.AFTER_BODY:{v$(this,t);break}case ee.IN_FRAMESET:{Swe(this,t);break}case ee.AFTER_FRAMESET:{Nwe(this,t);break}case ee.AFTER_AFTER_BODY:{Kb(this,t);break}}}onEof(t){switch(this.insertionMode){case ee.INITIAL:{qh(this,t);break}case ee.BEFORE_HTML:{Kp(this,t);break}case ee.BEFORE_HEAD:{qp(this,t);break}case ee.IN_HEAD:{Yp(this,t);break}case ee.IN_HEAD_NO_SCRIPT:{Wp(this,t);break}case ee.AFTER_HEAD:{Xp(this,t);break}case ee.IN_BODY:case ee.IN_TABLE:case ee.IN_CAPTION:case ee.IN_COLUMN_GROUP:case ee.IN_TABLE_BODY:case ee.IN_ROW:case ee.IN_CELL:case ee.IN_SELECT:case ee.IN_SELECT_IN_TABLE:{h$(this,t);break}case ee.TEXT:{swe(this,t);break}case ee.IN_TABLE_TEXT:{Yh(this,t);break}case ee.IN_TEMPLATE:{E$(this,t);break}case ee.AFTER_BODY:case ee.IN_FRAMESET:case ee.AFTER_FRAMESET:case ee.AFTER_AFTER_BODY:case ee.AFTER_AFTER_FRAMESET:{$A(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===G.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 ee.IN_HEAD:case ee.IN_HEAD_NO_SCRIPT:case ee.AFTER_HEAD:case ee.TEXT:case ee.IN_COLUMN_GROUP:case ee.IN_SELECT:case ee.IN_SELECT_IN_TABLE:case ee.IN_FRAMESET:case ee.AFTER_FRAMESET:{this._insertCharacters(t);break}case ee.IN_BODY:case ee.IN_CAPTION:case ee.IN_CELL:case ee.IN_TEMPLATE:case ee.AFTER_BODY:case ee.AFTER_AFTER_BODY:case ee.AFTER_AFTER_FRAMESET:{l$(this,t);break}case ee.IN_TABLE:case ee.IN_TABLE_BODY:case ee.IN_ROW:{gw(this,t);break}case ee.IN_TABLE_TEXT:{p$(this,t);break}}}};function eve(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):f$(e,t),n}function tve(e,t){let n=null,s=e.openElements.stackTop;for(;s>=0;s--){const i=e.openElements.items[s];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[s])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(s,0)),e.activeFormattingElements.removeEntry(t)),n}function nve(e,t,n){let s=t,i=e.openElements.getCommonAncestor(t);for(let r=0,a=i;a!==n;r++,a=i){i=e.openElements.getCommonAncestor(a);const l=e.activeFormattingElements.getElementEntry(a),c=l&&r>=ZEe;!l||c?(c&&e.activeFormattingElements.removeEntry(l),e.openElements.remove(a)):(a=sve(e,l),s===t&&(e.activeFormattingElements.bookmark=l),e.treeAdapter.detachNode(s),e.treeAdapter.appendChild(a,s),s=a)}return s}function sve(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),s=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,s),t.element=s,s}function ive(e,t,n){const s=e.treeAdapter.getTagName(t),i=sh(s);if(e._isElementCausesFosterParenting(i))e._fosterParentElement(n);else{const r=e.treeAdapter.getNamespaceURI(t);i===N.TEMPLATE&&r===Re.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function rve(e,t,n){const s=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,r=e.treeAdapter.createElement(i.tagName,s,i.attrs);e._adoptNodes(t,r),e.treeAdapter.appendChild(t,r),e.activeFormattingElements.insertElementAfterBookmark(r,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,r,i.tagID)}function FA(e,t){for(let n=0;n=n;s--)e._setEndLocation(e.openElements.items[s],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const s=e.openElements.items[0],i=e.treeAdapter.getNodeSourceCodeLocation(s);if(i&&!i.endTag&&(e._setEndLocation(s,t),e.openElements.stackTop>=1)){const r=e.openElements.items[1],a=e.treeAdapter.getNodeSourceCodeLocation(r);a&&!a.endTag&&e._setEndLocation(r,t)}}}}function lve(e,t){e._setDocumentType(t);const n=t.forceQuirks?Yr.QUIRKS:BEe(t);PEe(t)||e._err(t,Ee.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=ee.BEFORE_HTML}function qh(e,t){e._err(t,Ee.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Yr.QUIRKS),e.insertionMode=ee.BEFORE_HTML,e._processToken(t)}function cve(e,t){t.tagID===N.HTML?(e._insertElement(t,Re.HTML),e.insertionMode=ee.BEFORE_HEAD):Kp(e,t)}function uve(e,t){const n=t.tagID;(n===N.HTML||n===N.HEAD||n===N.BODY||n===N.BR)&&Kp(e,t)}function Kp(e,t){e._insertFakeRootElement(),e.insertionMode=ee.BEFORE_HEAD,e._processToken(t)}function dve(e,t){switch(t.tagID){case N.HTML:{Bi(e,t);break}case N.HEAD:{e._insertElement(t,Re.HTML),e.headElement=e.openElements.current,e.insertionMode=ee.IN_HEAD;break}default:qp(e,t)}}function fve(e,t){const n=t.tagID;n===N.HEAD||n===N.BODY||n===N.HTML||n===N.BR?qp(e,t):e._err(t,Ee.endTagWithoutMatchingOpenElement)}function qp(e,t){e._insertFakeElement(fe.HEAD,N.HEAD),e.headElement=e.openElements.current,e.insertionMode=ee.IN_HEAD,e._processToken(t)}function Ma(e,t){switch(t.tagID){case N.HTML:{Bi(e,t);break}case N.BASE:case N.BASEFONT:case N.BGSOUND:case N.LINK:case N.META:{e._appendElement(t,Re.HTML),t.ackSelfClosing=!0;break}case N.TITLE:{e._switchToTextParsing(t,Bs.RCDATA);break}case N.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,Bs.RAWTEXT):(e._insertElement(t,Re.HTML),e.insertionMode=ee.IN_HEAD_NO_SCRIPT);break}case N.NOFRAMES:case N.STYLE:{e._switchToTextParsing(t,Bs.RAWTEXT);break}case N.SCRIPT:{e._switchToTextParsing(t,Bs.SCRIPT_DATA);break}case N.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=ee.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(ee.IN_TEMPLATE);break}case N.HEAD:{e._err(t,Ee.misplacedStartTagForHeadElement);break}default:Yp(e,t)}}function hve(e,t){switch(t.tagID){case N.HEAD:{e.openElements.pop(),e.insertionMode=ee.AFTER_HEAD;break}case N.BODY:case N.BR:case N.HTML:{Yp(e,t);break}case N.TEMPLATE:{Au(e,t);break}default:e._err(t,Ee.endTagWithoutMatchingOpenElement)}}function Au(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==N.TEMPLATE&&e._err(t,Ee.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(N.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,Ee.endTagWithoutMatchingOpenElement)}function Yp(e,t){e.openElements.pop(),e.insertionMode=ee.AFTER_HEAD,e._processToken(t)}function pve(e,t){switch(t.tagID){case N.HTML:{Bi(e,t);break}case N.BASEFONT:case N.BGSOUND:case N.HEAD:case N.LINK:case N.META:case N.NOFRAMES:case N.STYLE:{Ma(e,t);break}case N.NOSCRIPT:{e._err(t,Ee.nestedNoscriptInHead);break}default:Wp(e,t)}}function mve(e,t){switch(t.tagID){case N.NOSCRIPT:{e.openElements.pop(),e.insertionMode=ee.IN_HEAD;break}case N.BR:{Wp(e,t);break}default:e._err(t,Ee.endTagWithoutMatchingOpenElement)}}function Wp(e,t){const n=t.type===zt.EOF?Ee.openElementsLeftAfterEof:Ee.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=ee.IN_HEAD,e._processToken(t)}function gve(e,t){switch(t.tagID){case N.HTML:{Bi(e,t);break}case N.BODY:{e._insertElement(t,Re.HTML),e.framesetOk=!1,e.insertionMode=ee.IN_BODY;break}case N.FRAMESET:{e._insertElement(t,Re.HTML),e.insertionMode=ee.IN_FRAMESET;break}case N.BASE:case N.BASEFONT:case N.BGSOUND:case N.LINK:case N.META:case N.NOFRAMES:case N.SCRIPT:case N.STYLE:case N.TEMPLATE:case N.TITLE:{e._err(t,Ee.abandonedHeadElementChild),e.openElements.push(e.headElement,N.HEAD),Ma(e,t),e.openElements.remove(e.headElement);break}case N.HEAD:{e._err(t,Ee.misplacedStartTagForHeadElement);break}default:Xp(e,t)}}function bve(e,t){switch(t.tagID){case N.BODY:case N.HTML:case N.BR:{Xp(e,t);break}case N.TEMPLATE:{Au(e,t);break}default:e._err(t,Ee.endTagWithoutMatchingOpenElement)}}function Xp(e,t){e._insertFakeElement(fe.BODY,N.BODY),e.insertionMode=ee.IN_BODY,O1(e,t)}function O1(e,t){switch(t.type){case zt.CHARACTER:{c$(e,t);break}case zt.WHITESPACE_CHARACTER:{l$(e,t);break}case zt.COMMENT:{aN(e,t);break}case zt.START_TAG:{Bi(e,t);break}case zt.END_TAG:{M1(e,t);break}case zt.EOF:{h$(e,t);break}}}function l$(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function c$(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function yve(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function xve(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function Eve(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,Re.HTML),e.insertionMode=ee.IN_FRAMESET)}function vve(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,Re.HTML)}function wve(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&rN.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,Re.HTML)}function Sve(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,Re.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function _ve(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,Re.HTML),n||(e.formElement=e.openElements.current))}function Nve(e,t){e.framesetOk=!1;const n=t.tagID;for(let s=e.openElements.stackTop;s>=0;s--){const i=e.openElements.tagIDs[s];if(n===N.LI&&i===N.LI||(n===N.DD||n===N.DT)&&(i===N.DD||i===N.DT)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(i!==N.ADDRESS&&i!==N.DIV&&i!==N.P&&e._isSpecialElement(e.openElements.items[s],i))break}e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,Re.HTML)}function Tve(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,Re.HTML),e.tokenizer.state=Bs.PLAINTEXT}function kve(e,t){e.openElements.hasInScope(N.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(N.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,Re.HTML),e.framesetOk=!1}function Ave(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(fe.A);n&&(FA(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,Re.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Cve(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Re.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Ive(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(N.NOBR)&&(FA(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,Re.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function jve(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Re.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function Rve(e,t){e.treeAdapter.getDocumentMode(e.document)!==Yr.QUIRKS&&e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,Re.HTML),e.framesetOk=!1,e.insertionMode=ee.IN_TABLE}function u$(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,Re.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function d$(e){const t=JF(e,Zc.TYPE);return t!=null&&t.toLowerCase()===XEe}function Ove(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,Re.HTML),d$(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function Mve(e,t){e._appendElement(t,Re.HTML),t.ackSelfClosing=!0}function Lve(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._appendElement(t,Re.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Dve(e,t){t.tagName=fe.IMG,t.tagID=N.IMG,u$(e,t)}function Pve(e,t){e._insertElement(t,Re.HTML),e.skipNextNewLine=!0,e.tokenizer.state=Bs.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=ee.TEXT}function Bve(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,Bs.RAWTEXT)}function Uve(e,t){e.framesetOk=!1,e._switchToTextParsing(t,Bs.RAWTEXT)}function DL(e,t){e._switchToTextParsing(t,Bs.RAWTEXT)}function Fve(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Re.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===ee.IN_TABLE||e.insertionMode===ee.IN_CAPTION||e.insertionMode===ee.IN_TABLE_BODY||e.insertionMode===ee.IN_ROW||e.insertionMode===ee.IN_CELL?ee.IN_SELECT_IN_TABLE:ee.IN_SELECT}function $ve(e,t){e.openElements.currentTagId===N.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,Re.HTML)}function Hve(e,t){e.openElements.hasInScope(N.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,Re.HTML)}function zve(e,t){e.openElements.hasInScope(N.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(N.RTC),e._insertElement(t,Re.HTML)}function Vve(e,t){e._reconstructActiveFormattingElements(),r$(t),UA(t),t.selfClosing?e._appendElement(t,Re.MATHML):e._insertElement(t,Re.MATHML),t.ackSelfClosing=!0}function Gve(e,t){e._reconstructActiveFormattingElements(),a$(t),UA(t),t.selfClosing?e._appendElement(t,Re.SVG):e._insertElement(t,Re.SVG),t.ackSelfClosing=!0}function PL(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Re.HTML)}function Bi(e,t){switch(t.tagID){case N.I:case N.S:case N.B:case N.U:case N.EM:case N.TT:case N.BIG:case N.CODE:case N.FONT:case N.SMALL:case N.STRIKE:case N.STRONG:{Cve(e,t);break}case N.A:{Ave(e,t);break}case N.H1:case N.H2:case N.H3:case N.H4:case N.H5:case N.H6:{wve(e,t);break}case N.P:case N.DL:case N.OL:case N.UL:case N.DIV:case N.DIR:case N.NAV:case N.MAIN:case N.MENU:case N.ASIDE:case N.CENTER:case N.FIGURE:case N.FOOTER:case N.HEADER:case N.HGROUP:case N.DIALOG:case N.DETAILS:case N.ADDRESS:case N.ARTICLE:case N.SEARCH:case N.SECTION:case N.SUMMARY:case N.FIELDSET:case N.BLOCKQUOTE:case N.FIGCAPTION:{vve(e,t);break}case N.LI:case N.DD:case N.DT:{Nve(e,t);break}case N.BR:case N.IMG:case N.WBR:case N.AREA:case N.EMBED:case N.KEYGEN:{u$(e,t);break}case N.HR:{Lve(e,t);break}case N.RB:case N.RTC:{Hve(e,t);break}case N.RT:case N.RP:{zve(e,t);break}case N.PRE:case N.LISTING:{Sve(e,t);break}case N.XMP:{Bve(e,t);break}case N.SVG:{Gve(e,t);break}case N.HTML:{yve(e,t);break}case N.BASE:case N.LINK:case N.META:case N.STYLE:case N.TITLE:case N.SCRIPT:case N.BGSOUND:case N.BASEFONT:case N.TEMPLATE:{Ma(e,t);break}case N.BODY:{xve(e,t);break}case N.FORM:{_ve(e,t);break}case N.NOBR:{Ive(e,t);break}case N.MATH:{Vve(e,t);break}case N.TABLE:{Rve(e,t);break}case N.INPUT:{Ove(e,t);break}case N.PARAM:case N.TRACK:case N.SOURCE:{Mve(e,t);break}case N.IMAGE:{Dve(e,t);break}case N.BUTTON:{kve(e,t);break}case N.APPLET:case N.OBJECT:case N.MARQUEE:{jve(e,t);break}case N.IFRAME:{Uve(e,t);break}case N.SELECT:{Fve(e,t);break}case N.OPTION:case N.OPTGROUP:{$ve(e,t);break}case N.NOEMBED:case N.NOFRAMES:{DL(e,t);break}case N.FRAMESET:{Eve(e,t);break}case N.TEXTAREA:{Pve(e,t);break}case N.NOSCRIPT:{e.options.scriptingEnabled?DL(e,t):PL(e,t);break}case N.PLAINTEXT:{Tve(e,t);break}case N.COL:case N.TH:case N.TD:case N.TR:case N.HEAD:case N.FRAME:case N.TBODY:case N.TFOOT:case N.THEAD:case N.CAPTION:case N.COLGROUP:break;default:PL(e,t)}}function Kve(e,t){if(e.openElements.hasInScope(N.BODY)&&(e.insertionMode=ee.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function qve(e,t){e.openElements.hasInScope(N.BODY)&&(e.insertionMode=ee.AFTER_BODY,v$(e,t))}function Yve(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function Wve(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(N.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(N.FORM):n&&e.openElements.remove(n))}function Xve(e){e.openElements.hasInButtonScope(N.P)||e._insertFakeElement(fe.P,N.P),e._closePElement()}function Qve(e){e.openElements.hasInListItemScope(N.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(N.LI),e.openElements.popUntilTagNamePopped(N.LI))}function Zve(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function Jve(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function ewe(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function twe(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(fe.BR,N.BR),e.openElements.pop(),e.framesetOk=!1}function f$(e,t){const n=t.tagName,s=t.tagID;for(let i=e.openElements.stackTop;i>0;i--){const r=e.openElements.items[i],a=e.openElements.tagIDs[i];if(s===a&&(s!==N.UNKNOWN||e.treeAdapter.getTagName(r)===n)){e.openElements.generateImpliedEndTagsWithExclusion(s),e.openElements.stackTop>=i&&e.openElements.shortenToLength(i);break}if(e._isSpecialElement(r,a))break}}function M1(e,t){switch(t.tagID){case N.A:case N.B:case N.I:case N.S:case N.U:case N.EM:case N.TT:case N.BIG:case N.CODE:case N.FONT:case N.NOBR:case N.SMALL:case N.STRIKE:case N.STRONG:{FA(e,t);break}case N.P:{Xve(e);break}case N.DL:case N.UL:case N.OL:case N.DIR:case N.DIV:case N.NAV:case N.PRE:case N.MAIN:case N.MENU:case N.ASIDE:case N.BUTTON:case N.CENTER:case N.FIGURE:case N.FOOTER:case N.HEADER:case N.HGROUP:case N.DIALOG:case N.ADDRESS:case N.ARTICLE:case N.DETAILS:case N.SEARCH:case N.SECTION:case N.SUMMARY:case N.LISTING:case N.FIELDSET:case N.BLOCKQUOTE:case N.FIGCAPTION:{Yve(e,t);break}case N.LI:{Qve(e);break}case N.DD:case N.DT:{Zve(e,t);break}case N.H1:case N.H2:case N.H3:case N.H4:case N.H5:case N.H6:{Jve(e);break}case N.BR:{twe(e);break}case N.BODY:{Kve(e,t);break}case N.HTML:{qve(e,t);break}case N.FORM:{Wve(e);break}case N.APPLET:case N.OBJECT:case N.MARQUEE:{ewe(e,t);break}case N.TEMPLATE:{Au(e,t);break}default:f$(e,t)}}function h$(e,t){e.tmplInsertionModeStack.length>0?E$(e,t):$A(e,t)}function nwe(e,t){var n;t.tagID===N.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function swe(e,t){e._err(t,Ee.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function gw(e,t){if(e.openElements.currentTagId!==void 0&&o$.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=ee.IN_TABLE_TEXT,t.type){case zt.CHARACTER:{m$(e,t);break}case zt.WHITESPACE_CHARACTER:{p$(e,t);break}}else Tg(e,t)}function iwe(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,Re.HTML),e.insertionMode=ee.IN_CAPTION}function rwe(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,Re.HTML),e.insertionMode=ee.IN_COLUMN_GROUP}function awe(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(fe.COLGROUP,N.COLGROUP),e.insertionMode=ee.IN_COLUMN_GROUP,HA(e,t)}function owe(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,Re.HTML),e.insertionMode=ee.IN_TABLE_BODY}function lwe(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(fe.TBODY,N.TBODY),e.insertionMode=ee.IN_TABLE_BODY,L1(e,t)}function cwe(e,t){e.openElements.hasInTableScope(N.TABLE)&&(e.openElements.popUntilTagNamePopped(N.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function uwe(e,t){d$(t)?e._appendElement(t,Re.HTML):Tg(e,t),t.ackSelfClosing=!0}function dwe(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,Re.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function jf(e,t){switch(t.tagID){case N.TD:case N.TH:case N.TR:{lwe(e,t);break}case N.STYLE:case N.SCRIPT:case N.TEMPLATE:{Ma(e,t);break}case N.COL:{awe(e,t);break}case N.FORM:{dwe(e,t);break}case N.TABLE:{cwe(e,t);break}case N.TBODY:case N.TFOOT:case N.THEAD:{owe(e,t);break}case N.INPUT:{uwe(e,t);break}case N.CAPTION:{iwe(e,t);break}case N.COLGROUP:{rwe(e,t);break}default:Tg(e,t)}}function Fm(e,t){switch(t.tagID){case N.TABLE:{e.openElements.hasInTableScope(N.TABLE)&&(e.openElements.popUntilTagNamePopped(N.TABLE),e._resetInsertionMode());break}case N.TEMPLATE:{Au(e,t);break}case N.BODY:case N.CAPTION:case N.COL:case N.COLGROUP:case N.HTML:case N.TBODY:case N.TD:case N.TFOOT:case N.TH:case N.THEAD:case N.TR:break;default:Tg(e,t)}}function Tg(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,O1(e,t),e.fosterParentingEnabled=n}function p$(e,t){e.pendingCharacterTokens.push(t)}function m$(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function Yh(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===N.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===N.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===N.OPTGROUP&&e.openElements.pop();break}case N.OPTION:{e.openElements.currentTagId===N.OPTION&&e.openElements.pop();break}case N.SELECT:{e.openElements.hasInSelectScope(N.SELECT)&&(e.openElements.popUntilTagNamePopped(N.SELECT),e._resetInsertionMode());break}case N.TEMPLATE:{Au(e,t);break}}}function bwe(e,t){const n=t.tagID;n===N.CAPTION||n===N.TABLE||n===N.TBODY||n===N.TFOOT||n===N.THEAD||n===N.TR||n===N.TD||n===N.TH?(e.openElements.popUntilTagNamePopped(N.SELECT),e._resetInsertionMode(),e._processStartTag(t)):y$(e,t)}function ywe(e,t){const n=t.tagID;n===N.CAPTION||n===N.TABLE||n===N.TBODY||n===N.TFOOT||n===N.THEAD||n===N.TR||n===N.TD||n===N.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(N.SELECT),e._resetInsertionMode(),e.onEndTag(t)):x$(e,t)}function xwe(e,t){switch(t.tagID){case N.BASE:case N.BASEFONT:case N.BGSOUND:case N.LINK:case N.META:case N.NOFRAMES:case N.SCRIPT:case N.STYLE:case N.TEMPLATE:case N.TITLE:{Ma(e,t);break}case N.CAPTION:case N.COLGROUP:case N.TBODY:case N.TFOOT:case N.THEAD:{e.tmplInsertionModeStack[0]=ee.IN_TABLE,e.insertionMode=ee.IN_TABLE,jf(e,t);break}case N.COL:{e.tmplInsertionModeStack[0]=ee.IN_COLUMN_GROUP,e.insertionMode=ee.IN_COLUMN_GROUP,HA(e,t);break}case N.TR:{e.tmplInsertionModeStack[0]=ee.IN_TABLE_BODY,e.insertionMode=ee.IN_TABLE_BODY,L1(e,t);break}case N.TD:case N.TH:{e.tmplInsertionModeStack[0]=ee.IN_ROW,e.insertionMode=ee.IN_ROW,D1(e,t);break}default:e.tmplInsertionModeStack[0]=ee.IN_BODY,e.insertionMode=ee.IN_BODY,Bi(e,t)}}function Ewe(e,t){t.tagID===N.TEMPLATE&&Au(e,t)}function E$(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(N.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):$A(e,t)}function vwe(e,t){t.tagID===N.HTML?Bi(e,t):hx(e,t)}function v$(e,t){var n;if(t.tagID===N.HTML){if(e.fragmentContext||(e.insertionMode=ee.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===N.HTML){e._setEndLocation(e.openElements.items[0],t);const s=e.openElements.items[1];s&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(s))===null||n===void 0)&&n.endTag)&&e._setEndLocation(s,t)}}else hx(e,t)}function hx(e,t){e.insertionMode=ee.IN_BODY,O1(e,t)}function wwe(e,t){switch(t.tagID){case N.HTML:{Bi(e,t);break}case N.FRAMESET:{e._insertElement(t,Re.HTML);break}case N.FRAME:{e._appendElement(t,Re.HTML),t.ackSelfClosing=!0;break}case N.NOFRAMES:{Ma(e,t);break}}}function Swe(e,t){t.tagID===N.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==N.FRAMESET&&(e.insertionMode=ee.AFTER_FRAMESET))}function _we(e,t){switch(t.tagID){case N.HTML:{Bi(e,t);break}case N.NOFRAMES:{Ma(e,t);break}}}function Nwe(e,t){t.tagID===N.HTML&&(e.insertionMode=ee.AFTER_AFTER_FRAMESET)}function Twe(e,t){t.tagID===N.HTML?Bi(e,t):Kb(e,t)}function Kb(e,t){e.insertionMode=ee.IN_BODY,O1(e,t)}function kwe(e,t){switch(t.tagID){case N.HTML:{Bi(e,t);break}case N.NOFRAMES:{Ma(e,t);break}}}function Awe(e,t){t.chars=fs,e._insertCharacters(t)}function Cwe(e,t){e._insertCharacters(t),e.framesetOk=!1}function w$(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==Re.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function Iwe(e,t){if(GEe(t))w$(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),s=e.treeAdapter.getNamespaceURI(n);s===Re.MATHML?r$(t):s===Re.SVG&&(KEe(t),a$(t)),UA(t),t.selfClosing?e._appendElement(t,s):e._insertElement(t,s),t.ackSelfClosing=!0}}function jwe(e,t){if(t.tagID===N.P||t.tagID===N.BR){w$(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const s=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(s)===Re.HTML){e._endTagOutsideForeignContent(t);break}const i=e.treeAdapter.getTagName(s);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}fe.AREA,fe.BASE,fe.BASEFONT,fe.BGSOUND,fe.BR,fe.COL,fe.EMBED,fe.FRAME,fe.HR,fe.IMG,fe.INPUT,fe.KEYGEN,fe.LINK,fe.META,fe.PARAM,fe.SOURCE,fe.TRACK,fe.WBR;const Rwe=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,Owe=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),BL={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function S$(e,t){const n=zwe(e),s=B7("type",{handlers:{root:Mwe,element:Lwe,text:Dwe,comment:N$,doctype:Pwe,raw:Uwe},unknown:Fwe}),i={parser:n?new LL(BL):LL.getFragmentParser(void 0,BL),handle(l){s(l,i)},stitches:!1,options:t||{}};s(e,i),ih(i,lo());const r=n?i.parser.document:i.parser.getFragment(),a=V1e(r,{file:i.options.file});return i.stitches&&_g(a,"comment",function(l,c,u){const d=l;if(d.value.stitch&&u&&c!==void 0){const f=u.children;return f[c]=d.value.stitch,c}}),a.type==="root"&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function _$(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:zt.CHARACTER,chars:e.value,location:kg(e)};ih(t,lo(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function Pwe(e,t){const n={type:zt.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:kg(e)};ih(t,lo(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function Bwe(e,t){t.stitches=!0;const n=Vwe(e);if("children"in e&&"children"in n){const s=S$({type:"root",children:e.children},t.options);n.children=s.children}N$({type:"comment",value:{stitch:n}},t)}function N$(e,t){const n=e.value,s={type:zt.COMMENT,data:n,location:kg(e)};ih(t,lo(e)),t.parser.currentToken=s,t.parser._processToken(t.parser.currentToken)}function Uwe(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,T$(t,lo(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(Rwe,"<$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 Fwe(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))Bwe(n,t);else{let s="";throw Owe.has(n.type)&&(s=". 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"+s)}}function ih(e,t){T$(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=Bs.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 T$(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 $we(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===Bs.PLAINTEXT)return;ih(t,lo(e));const s=t.parser.openElements.current;let i="namespaceURI"in s?s.namespaceURI:Pc.html;i===Pc.html&&n==="svg"&&(i=Pc.svg);const r=W1e({...e,children:[]},{space:i===Pc.svg?"svg":"html"}),a={type:zt.START_TAG,tagName:n,tagID:sh(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in r?r.attrs:[],location:kg(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function Hwe(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&sEe.includes(n)||t.parser.tokenizer.state===Bs.PLAINTEXT)return;ih(t,k1(e));const s={type:zt.END_TAG,tagName:n,tagID:sh(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:kg(e)};t.parser.currentToken=s,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===Bs.RCDATA||t.parser.tokenizer.state===Bs.RAWTEXT||t.parser.tokenizer.state===Bs.SCRIPT_DATA)&&(t.parser.tokenizer.state=Bs.DATA)}function zwe(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function kg(e){const t=lo(e)||{line:void 0,column:void 0,offset:void 0},n=k1(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 Vwe(e){return"children"in e?Cf({...e,children:[]}):Cf(e)}function Gwe(e){return function(t,n){return S$(t,{...e,file:n})}}const k$=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function A$(e){if(!e)return!1;try{const t=e.toLowerCase();return k$.some(n=>t.includes(n))}catch{return!1}}function Kwe(e){var s;const t=(s=e==null?void 0:e.properties)==null?void 0:s.href;if(!t)return!1;if(A$(t))return!0;const n=e==null?void 0:e.children;if(n&&Array.isArray(n)){const i=n.map(r=>(r==null?void 0:r.value)||"").join("").toLowerCase();return k$.some(r=>i.includes(r))}return!1}function qwe({text:e,className:t,allowRawHtml:n=!0}){const[s,i]=g.useState(null),r=(c,u)=>{if(c.src)return c.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=c=>{try{const d=new URL(c).pathname.split("/");return d[d.length-1]||"video.mp4"}catch{return"video.mp4"}},l=c=>c?Array.isArray(c)?c.map(u=>(u==null?void 0:u.value)||"").join("")||"video":(c==null?void 0:c.value)||"video":"video";return o.jsxs("div",{className:t?`md ${t}`:"md",children:[o.jsx(Xge,{remarkPlugins:[cye],rehypePlugins:n?[Gwe,vL]:[vL],components:{a:({node:c,...u})=>{const d=u.href;if(d&&(A$(d)||Kwe(c))){const f=d,h=l(c==null?void 0:c.children);return o.jsxs("div",{className:"video-container",children:[o.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":`点击播放视频: ${h}`,onClick:()=>i({src:f,title:h}),children:[o.jsx("video",{src:f,playsInline:!0,className:"video-thumbnail",preload:"metadata"}),o.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:o.jsx(qc,{})})]}),o.jsx("div",{className:"video-caption",children:o.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"video-link-text",children:h})})]})}return o.jsx("a",{...u,target:"_blank",rel:"noopener noreferrer"})},img:({node:c,src:u,alt:d,...f})=>{const h=o.jsx("img",{...f,src:u,alt:d??"",loading:"lazy"});return u?o.jsx(lB,{src:u,children:o.jsxs("button",{type:"button",className:"image-preview-trigger","aria-label":`放大预览:${d||"图片"}`,children:[h,o.jsx("span",{className:"image-preview-hint","aria-hidden":"true",children:o.jsx(qc,{})})]})}):h},video:({node:c,src:u,children:d,...f})=>{const h=r({src:u},d);return h?o.jsx("div",{className:"video-container",children:o.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":"点击放大视频",onClick:()=>i({src:h}),children:[o.jsx("video",{src:h,...f,playsInline:!0,className:"video-thumbnail",children:d}),o.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:o.jsx(qc,{})})]})}):o.jsx("video",{src:u,controls:!0,playsInline:!0,className:"video-inline",...f,children:d})}},children:e}),s&&o.jsx("div",{className:"video-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":"视频预览",onClick:()=>i(null),children:o.jsxs("div",{className:"video-viewer",onClick:c=>c.stopPropagation(),children:[o.jsxs("div",{className:"video-viewer-header",children:[o.jsx("div",{className:"video-viewer-title",children:s.title||a(s.src)}),o.jsxs("nav",{className:"video-viewer-nav",children:[o.jsx("a",{href:s.src,download:s.title||a(s.src),"aria-label":"下载视频",title:"下载视频",className:"video-viewer-download",children:o.jsx(Jx,{})}),o.jsx("button",{type:"button",className:"video-viewer-close","aria-label":"关闭",onClick:()=>i(null),children:o.jsx(Ti,{})})]})]}),o.jsx("div",{className:"video-viewer-body",children:o.jsx("video",{src:s.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const rh=g.memo(qwe),UL=6,FL=7,Ywe={active:"可用",available:"可用",creating:"创建中",disabled:"已停用",enabled:"已启用",failed:"异常",inactive:"未启用",pending:"等待中",published:"已发布",ready:"就绪",released:"已发布",running:"运行中",success:"正常",unavailable:"不可用",unreleased:"未发布",updating:"更新中"};function lN(e){return Ywe[(e||"").trim().toLowerCase()]||"未知"}function $L(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 Wwe(e){if(!e)return"";const t=e.trim(),n=Number(t),s=/^\d+(?:\.\d+)?$/.test(t)?new Date(n<1e12?n*1e3:n):new Date(t);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(s)}function Xwe(e){const t=e.replace(/\r\n/g,` +`))}function c(p,m,b,v){const y=b.enter("tableCell"),x=b.enter("phrasing"),E=b.containerPhrasing(p,{...v,before:r,after:r});return x(),y(),E}function u(p,m){return $0e(p,{align:m,alignDelimiters:s,padding:n,stringLength:i})}function d(p,m,b){const v=p.children;let y=-1;const x=[],E=m.enter("table");for(;++y0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Gbe={tokenize:Jbe,partial:!0};function Kbe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Xbe,continuation:{tokenize:Qbe},exit:Zbe}},text:{91:{name:"gfmFootnoteCall",tokenize:Wbe},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:qbe,resolveTo:Ybe}}}}function qbe(e,t,n){const s=this;let i=s.events.length;const r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let a;for(;i--;){const c=s.events[i][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!a||!a._balanced)return n(c);const u=ka(s.sliceSerialize({start:a.end,end:s.now()}));return u.codePointAt(0)!==94||!r.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function Ybe(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 s={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 r={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},r.start),end:Object.assign({},r.end)},l=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",r,t],["enter",a,t],["exit",a,t],["exit",r,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...l),e}function Wbe(e,t,n){const s=this,i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let r=0,a;return l;function l(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),c}function c(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(r>999||f===93&&!a||f===null||f===91||Un(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return i.includes(ka(s.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Un(f)||(a=!0),r++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),r++,u):u(f)}}function Xbe(e,t,n){const s=this,i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let r,a=0,l;return c;function c(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&&!l||m===null||m===91||Un(m))return n(m);if(m===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return r=ka(s.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Un(m)||(l=!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(r)||i.push(r),sn(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function Qbe(e,t,n){return e.check(vg,t,e.attempt(Gbe,t,n))}function Zbe(e){e.exit("gfmFootnoteDefinition")}function Jbe(e,t,n){const s=this;return sn(e,i,"gfmFootnoteDefinitionIndent",5);function i(r){const a=s.events[s.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(r):n(r)}}function eye(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:r,resolveAll:i};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function i(a,l){let c=-1;for(;++c1?c(m):(a.consume(m),f++,p);if(f<2&&!n)return c(m);const v=a.exit("strikethroughSequenceTemporary"),y=If(m);return v._open=!y||y===2&&!!b,v._close=!b||b===2&&!!y,l(m)}}}class tye{constructor(){this.map=[]}add(t,n,s){nye(this,t,n,s)}consume(t){if(this.map.sort(function(r,a){return r[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let i=s.pop();for(;i;){for(const r of i)t.push(r);i=s.pop()}this.map.length=0}}function nye(e,t,n,s){let i=0;if(!(n===0&&s.length===0)){for(;i-1;){const D=s.events[j][1].type;if(D==="lineEnding"||D==="linePrefix")j--;else break}const L=j>-1?s.events[j][1].type:null,z=L==="tableHead"||L==="tableRow"?S:c;return z===S&&s.parser.lazy[s.now().line]?n(I):z(I)}function c(I){return e.enter("tableHead"),e.enter("tableRow"),u(I)}function u(I){return I===124||(a=!0,r+=1),d(I)}function d(I){return I===null?n(I):gt(I)?r>1?(r=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),p):n(I):Xt(I)?sn(e,d,"whitespace")(I):(r+=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||Un(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 s.interrupt=!1,s.parser.lazy[s.now().line]?n(I):(e.enter("tableDelimiterRow"),a=!1,Xt(I)?sn(e,m,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):m(I))}function m(I){return I===45||I===58?v(I):I===124?(a=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),b):_(I)}function b(I){return Xt(I)?sn(e,v,"whitespace")(I):v(I)}function v(I){return I===58?(r+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),y):I===45?(r+=1,y(I)):I===null||gt(I)?w(I):_(I)}function y(I){return I===45?(e.enter("tableDelimiterFiller"),x(I)):_(I)}function x(I){return I===45?(e.consume(I),x):I===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(I))}function E(I){return Xt(I)?sn(e,w,"whitespace")(I):w(I)}function w(I){return I===124?m(I):I===null||gt(I)?!a||i!==r?_(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):_(I)}function _(I){return n(I)}function S(I){return e.enter("tableRow"),k(I)}function k(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),k):I===null||gt(I)?(e.exit("tableRow"),t(I)):Xt(I)?sn(e,k,"whitespace")(I):(e.enter("data"),T(I))}function T(I){return I===null||I===124||Un(I)?(e.exit("data"),k(I)):(e.consume(I),I===92?C:T)}function C(I){return I===92||I===124?(e.consume(I),T):T(I)}}function aye(e,t){let n=-1,s=!0,i=0,r=[0,0,0,0],a=[0,0,0,0],l=!1,c=0,u,d,f;const h=new tye;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 i!==void 0&&(r.end=Object.assign({},cd(t.events,i)),e.add(i,0,[["exit",r,t]]),r=void 0),r}function aL(e,t,n,s,i){const r=[],a=cd(t.events,n);i&&(i.end=Object.assign({},a),r.push(["exit",i,t])),s.end=Object.assign({},a),r.push(["exit",s,t]),e.add(n+1,0,r)}function cd(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const oye={name:"tasklistCheck",tokenize:cye};function lye(){return{text:{91:oye}}}function cye(e,t,n){const s=this;return i;function i(c){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),r)}function r(c){return Un(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return gt(c)?t(c):Xt(c)?e.check({tokenize:uye},t,n)(c):n(c)}}function uye(e,t,n){return sn(e,s,"whitespace");function s(i){return i===null?n(i):t(i)}}function dye(e){return g7([Dbe(),Kbe(),eye(e),iye(),lye()])}const fye={};function hye(e){const t=this,n=e||fye,s=t.data(),i=s.micromarkExtensions||(s.micromarkExtensions=[]),r=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),a=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);i.push(dye(n)),r.push(Rbe()),a.push(Obe(n))}const oL=function(e,t,n){const s=wg(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&&c.push(` +`.repeat(u)||" "),u=-1,c.push(d))}return c.join("")}function cF(e,t,n){return e.type==="element"?vye(e,t,n):e.type==="text"?n.whitespace==="normal"?uF(e,n):wye(e):[]}function vye(e,t,n){const s=dF(e,n),i=e.children||[];let r=-1,a=[];if(xye(e))return a;let l,c;for(aN(e)||dL(e)&&oL(t,e,dL)?c=` +`:yye(e)?(l=2,c=2):lF(e)&&(l=1,c=1);++r]+>")+")",l={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"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],v=["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"],y=["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"],w={type:b,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},_={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},S=[_,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:S.concat([{begin:/\(/,end:/\)/,keywords:w,contains:S.concat(["self"]),relevance:0}]),relevance:0},T={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:s,keywords:w,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:w,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:w,illegal:"",keywords:w,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:w},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Cye(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=Aye(e),s=n.keywords;return s.type=[...s.type,...t.type],s.literal=[...s.literal,...t.literal],s.built_in=[...s.built_in,...t.built_in],s._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function fF(e){const t=e.regex,n={},s={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},s]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},r=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"})]}},l={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(l);const c={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"],v=["true","false"],y={match:/(\/[a-z._-]+)+/},x=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],E=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],w=["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"],_=["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:v,built_in:[...x,...E,"set","shopt",...w,..._]},contains:[p,e.SHEBANG(),m,f,r,a,y,l,c,u,d,n]}}function Iye(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),s="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",a="("+s+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={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*\\(",v={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"},y=[f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],x={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:v,contains:y.concat([{begin:/\(/,end:/\)/,keywords:v,contains:y.concat(["self"]),relevance:0}]),relevance:0},E={begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:v,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:s,keywords:v,relevance:0},{begin:p,returnBegin:!0,contains:[e.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:v,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:v}}}function jye(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),s="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",a="(?!struct)("+s+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={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"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],v=["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"],y=["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"],w={type:b,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:v},_={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},S=[_,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:S.concat([{begin:/\(/,end:/\)/,keywords:w,contains:S.concat(["self"]),relevance:0}]),relevance:0},T={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:s,keywords:w,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:w,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:w,illegal:"",keywords:w,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:w},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Rye(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"],s=["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"],r=["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(r),built_in:t,literal:s},l=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={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]},v=e.inherit(b,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});h.contains=[b,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.C_BLOCK_COMMENT_MODE],p.contains=[v,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[u,b,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},x={begin:"<",end:">",contains:[{beginKeywords:"in out"},l]},E=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",w={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"}},y,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},l,x,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,x,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:"("+E+"\\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,x],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,relevance:0,contains:[y,c,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},w]}}const Oye=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_-]*/}}),Mye=["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"],Lye=["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"],Dye=[...Mye,...Lye],Pye=["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(),Bye=["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(),Uye=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Fye=["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 $ye(e){const t=e.regex,n=Oye(e),s={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",r=/@-?\w[\w]*(-\w+)*/,a="[a-zA-Z-][a-zA-Z0-9_-]*",l=[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,s,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:":("+Bye.join("|")+")"},{begin:":(:)?("+Uye.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Fye.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...l,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...l,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:r},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:Pye.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Dye.join("|")+")\\b"}]}}function Hye(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 zye(e){const r={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:r,illegal:"pF(e,t,n-1))}function Gye(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",s=n+pF("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),c={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:c,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,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:["(?:"+s+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,fL,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},fL,u]}}const hL="[A-Za-z$_][0-9A-Za-z$_]*",Kye=["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"],qye=["true","false","null","undefined","NaN","Infinity"],mF=["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"],gF=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],bF=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Yye=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Wye=[].concat(bF,mF,gF);function yF(e){const t=e.regex,n=(P,{after:H})=>{const R="",end:""},r=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(P,H)=>{const R=P[0].length+P.index,Y=P.input[R];if(Y==="<"||Y===","){H.ignoreMatch();return}Y===">"&&(n(P,{after:R})||H.ignoreMatch());let J;const U=P.input.substring(R);if(J=U.match(/^\s*=/)){H.ignoreMatch();return}if((J=U.match(/^\s+extends\s+/))&&J.index===0){H.ignoreMatch();return}}},l={$pattern:hL,keyword:Kye,literal:qye,built_in:Wye,"variable.language":Yye},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\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:l,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"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={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:s+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,v,{match:/\$\d+/},f];h.contains=E.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(E)});const w=[].concat(x,h.contains),_=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(w)}]),S={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:_},k={variants:[{match:[/class/,/\s+/,s,/\s+/,/extends/,/\s+/,t.concat(s,"(",t.concat(/\./,s),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,s],scope:{1:"keyword",3:"title.class"}}]},T={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:{_:[...mF,...gF]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[S],illegal:/%/},j={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function L(P){return t.concat("(?!",P.join("|"),")")}const z={match:t.concat(/\b/,L([...bF,"super","import"].map(P=>`${P}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},F={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},S]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",M={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[S]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:T},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,v,x,{match:/\$\d+/},f,T,{scope:"attr",match:s+t.lookahead(":"),relevance:0},M,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,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:l,contains:_}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:r},{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:[S,e.inherit(e.TITLE_MODE,{begin:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[S]},z,j,k,F,{match:/\$[(.]/}]}}function xF(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},s=["true","false","null"],i={scope:"literal",beginKeywords:s.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:s},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 dd="[0-9](_*[0-9])*",W0=`\\.(${dd})`,X0="[0-9a-fA-F](_*[0-9a-fA-F])*",Xye={className:"number",variants:[{begin:`(\\b(${dd})((${W0})|\\.)?|(${W0}))[eE][+-]?(${dd})[fFdD]?\\b`},{begin:`\\b(${dd})((${W0})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${W0})[fFdD]?\\b`},{begin:`\\b(${dd})[fFdD]\\b`},{begin:`\\b0[xX]((${X0})\\.?|(${X0})?\\.(${X0}))[pP][+-]?(${dd})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${X0})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Qye(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+/}]}},s={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},r={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},a={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[r,i]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,r,i]}]};i.contains.push(a);const l={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(a,{className:"string"}),"self"]}]},u=Xye,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,s,l,c,{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,l,c,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},l,c]},a,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` +`},u]}}const Zye=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_-]*/}}),Jye=["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"],exe=["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"],txe=[...Jye,...exe],nxe=["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(),EF=["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(),vF=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),sxe=["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(),ixe=EF.concat(vF).sort().reverse();function rxe(e){const t=Zye(e),n=ixe,s="and or not only",i="[\\w-]+",r="("+i+"|@\\{"+i+"\\})",a=[],l=[],c=function(E){return{className:"string",begin:"~?"+E+".*?"+E}},u=function(E,w,_){return{className:E,begin:w,relevance:_}},d={$pattern:/[a-z-]+/,keyword:s,attribute:nxe.join(" ")},f={begin:"\\(",end:"\\)",contains:l,keywords:d,relevance:0};l.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,c("'"),c('"'),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=l.concat({begin:/\{/,end:/\}/,contains:a}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},m={begin:r+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+sxe.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},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:l,relevance:0}},v={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:h}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:r,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("+txe.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,u("selector-tag",r,0),u("selector-id","#"+r),u("selector-class","\\."+r,0),u("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+EF.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+vF.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},x={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,v,x,m,y,p,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}function axe(e){const t="\\[=*\\[",n="\\]=*\\]",s={begin:t,end:n,contains:["self"]},i=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[s],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:[s],relevance:5}])}}function wF(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},s={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}]},r={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}]},l=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,l,/:\/\/.*?\)/),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,c];return[u,d,f,h].forEach(y=>{y.contains=y.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,r,u,d,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},i,s,c,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function oxe(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_]*/,l={"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"]},c={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:l,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function lxe(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"],s=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},r={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},a={begin:/->\{/,end:/\}/},l={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[l]},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,r,c],f=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],h=(b,v,y="\\1")=>{const x=y==="\\1"?y:t.concat(y,v);return t.concat(t.concat("(?:",b,")"),v,/(?:\\.|[^\\\/])*?/,x,/(?:\\.|[^\\\/])*?/,y,s)},p=(b,v,y)=>t.concat(t.concat("(?:",b,")"),v,/(?:\\.|[^\\\/])*?/,y,s),m=[c,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,l]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,l,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return r.contains=m,a.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:m}}function cxe(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,s=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),r=t.concat(/[A-Z]+/,n),a={scope:"variable",match:"\\$+"+s},l={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={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(c)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(D,F)=>{F.data._beginMatch=D[1]||D[2]},"on:end":(D,F)=>{F.data._beginMatch!==D[1]&&F.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},v=["false","null","true"],y=["__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"],x=["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"],w={keyword:y,literal:(D=>{const F=[];return D.forEach(A=>{F.push(A),A.toLowerCase()===A?F.push(A.toUpperCase()):F.push(A.toLowerCase())}),F})(v),built_in:x},_=D=>D.map(F=>F.replace(/\|\d+$/,"")),S={variants:[{match:[/new/,t.concat(p,"+"),t.concat("(?!",_(x).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},k=t.concat(s,"\\b(?!\\()"),T={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),k],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),k],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"}}]},C={scope:"attr",match:t.concat(s,t.lookahead(":"),t.lookahead(/(?!::)/))},I={relevance:0,begin:/\(/,end:/\)/,keywords:w,contains:[C,a,T,e.C_BLOCK_COMMENT_MODE,m,b,S]},j={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",_(y).join("\\b|"),"|",_(x).join("\\b|"),"\\b)"),s,t.concat(p,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[I]};I.contains.push(j);const L=[C,T,e.C_BLOCK_COMMENT_MODE,m,b,S],z={begin:t.concat(/#\[\s*\\?/,t.either(i,r)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:v,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:v,keyword:["new","array"]},contains:["self",...L]},...L,{scope:"meta",variants:[{match:i},{match:r}]}]};return{case_insensitive:!1,keywords:w,contains:[z,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}]}},l,{scope:"variable.language",match:/\$this\b/},a,j,T,{match:[/const/,/\s/,s],scope:{1:"keyword",3:"variable.constant"}},S,{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:w,contains:["self",z,a,T,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 uxe(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 dxe(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function _F(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),s=["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"],l={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:s,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"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:l,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,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c,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|${s.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})`}]},v={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",c,b,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,b,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[c,b,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,v,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{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,y,f]}]}}function fxe(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function hxe(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,s=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=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,r=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,s]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,s]},{scope:{1:"punctuation",2:"number"},match:[r,s]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,s]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:r},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function pxe(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",s=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(s,/(::\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"]},l={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},u=[e.COMMENT("#","$",{contains:[l]}),e.COMMENT("^=begin","^=end",{contains:[l],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}]},S=[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:s,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(c,u),relevance:0}].concat(c,u);d.contains=S,b.contains=S;const I=[{begin:/^\s*=>/,starts:{end:"$",contains:S}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:a,contains:S}}];return u.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(I).concat(u).concat(S)}}function mxe(e){const t=e.regex,n=/(r#)?/,s=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),r={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))?",l=["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"],c=["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:l,literal:c,built_in:u},illegal:""},r]}}const gxe=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_-]*/}}),bxe=["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"],yxe=["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"],xxe=[...bxe,...yxe],Exe=["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(),vxe=["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(),wxe=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Sxe=["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 _xe(e){const t=gxe(e),n=wxe,s=vxe,i="@[a-z-]+",r="and or not only",l={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("+xxe.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+s.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},l,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Sxe.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,l,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:r,attribute:Exe.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},l,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function Nxe(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function Txe(e){const t=e.regex,n=e.COMMENT("--","$"),s={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},r=["true","false","unknown"],a=["double precision","large object","with timezone","without timezone"],l=["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"],c=["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,...c].filter(_=>!d.includes(_)),b={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},v={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function x(_){return t.concat(/\b/,t.either(..._.map(S=>S.replace(/\s+/,"\\s+"))),/\b/)}const E={scope:"keyword",match:x(h),relevance:0};function w(_,{exceptions:S,when:k}={}){const T=k;return S=S||[],_.map(C=>C.match(/\|\d+$/)||S.includes(C)?C:T(C)?`${C}|0`:C)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:w(m,{when:_=>_.length<3}),literal:r,type:l,built_in:f},contains:[{scope:"type",match:x(a)},E,y,b,s,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,v]}}function NF(e){return e?typeof e=="string"?e:e.source:null}function Gh(e){return An("(?=",e,")")}function An(...e){return e.map(n=>NF(n)).join("")}function kxe(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Hi(...e){return"("+(kxe(e).capture?"":"?:")+e.map(s=>NF(s)).join("|")+")"}const DA=e=>An(/\b/,e,/\w$/.test(e)?/\b/:/\B/),Axe=["Protocol","Type"].map(DA),pL=["init","self"].map(DA),Cxe=["Any","Self"],mw=["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"],mL=["false","nil","true"],Ixe=["assignment","associativity","higherThan","left","lowerThan","none","right"],jxe=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],gL=["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"],TF=Hi(/[/=\-+!*%<>&|^~?]/,/[\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]/),kF=Hi(TF,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),gw=An(TF,kF,"*"),AF=Hi(/[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]/),ux=Hi(AF,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Ga=An(AF,ux,"*"),Q0=An(/[A-Z]/,ux,"*"),Rxe=["attached","autoclosure",An(/convention\(/,Hi("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",An(/objc\(/,Ga,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],Oxe=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function Mxe(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),s=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,Hi(...Axe,...pL)],className:{2:"keyword"}},r={match:An(/\./,Hi(...mw)),relevance:0},a=mw.filter(ie=>typeof ie=="string").concat(["_|0"]),l=mw.filter(ie=>typeof ie!="string").concat(Cxe).map(DA),c={variants:[{className:"keyword",match:Hi(...l,...pL)}]},u={$pattern:Hi(/\b\w+/,/#\w+/),keyword:a.concat(jxe),literal:mL},d=[i,r,c],f={match:An(/\./,Hi(...gL)),relevance:0},h={className:"built_in",match:An(/\b/,Hi(...gL),/(?=\()/)},p=[f,h],m={match:/->/,relevance:0},b={className:"operator",relevance:0,variants:[{match:gw},{match:`\\.(\\.|${kF})+`}]},v=[m,b],y="([0-9]_*)+",x="([0-9a-fA-F]_*)+",E={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${x})(\\.(${x}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},w=(ie="")=>({className:"subst",variants:[{match:An(/\\/,ie,/[0\\tnr"']/)},{match:An(/\\/,ie,/u\{[0-9a-fA-F]{1,8}\}/)}]}),_=(ie="")=>({className:"subst",match:An(/\\/,ie,/[\t ]*(?:[\r\n]|\r\n)/)}),S=(ie="")=>({className:"subst",label:"interpol",begin:An(/\\/,ie,/\(/),end:/\)/}),k=(ie="")=>({begin:An(ie,/"""/),end:An(/"""/,ie),contains:[w(ie),_(ie),S(ie)]}),T=(ie="")=>({begin:An(ie,/"/),end:An(/"/,ie),contains:[w(ie),S(ie)]}),C={className:"string",variants:[k(),k("#"),k("##"),k("###"),T(),T("#"),T("##"),T("###")]},I=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],j={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:I},L=ie=>{const Ne=An(ie,/\//),ve=An(/\//,ie);return{begin:Ne,end:ve,contains:[...I,{scope:"comment",begin:`#(?!.*${ve})`,end:/$/}]}},z={scope:"regexp",variants:[L("###"),L("##"),L("#"),j]},D={match:An(/`/,Ga,/`/)},F={className:"variable",match:/\$\d+/},A={className:"variable",match:`\\$${ux}+`},M=[D,F,A],P={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:Oxe,contains:[...v,E,C]}]}},H={scope:"keyword",match:An(/@/,Hi(...Rxe),Gh(Hi(/\(/,/\s+/)))},R={scope:"meta",match:An(/@/,Ga)},Y=[P,H,R],J={match:Gh(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:An(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,ux,"+")},{className:"type",match:Q0,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:An(/\s+&\s+/,Gh(Q0)),relevance:0}]},U={begin://,keywords:u,contains:[...s,...d,...Y,m,J]};J.contains.push(U);const te={match:An(Ga,/\s*:/),keywords:"_|0",relevance:0},K={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",te,...s,z,...d,...p,...v,E,C,...M,...Y,J]},V={begin://,keywords:"repeat each",contains:[...s,J]},W={begin:Hi(Gh(An(Ga,/\s*:/)),Gh(An(Ga,/\s+/,Ga,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Ga}]},q={begin:/\(/,end:/\)/,keywords:u,contains:[W,...s,...d,...v,E,C,...Y,J,K],endsParent:!0,illegal:/["']/},ue={match:[/(func|macro)/,/\s+/,Hi(D.match,Ga,gw)],className:{1:"keyword",3:"title.function"},contains:[V,q,t],illegal:[/\[/,/%/]},pe={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[V,q,t],illegal:/\[|%/},we={match:[/operator/,/\s+/,gw],className:{1:"keyword",3:"title"}},de={begin:[/precedencegroup/,/\s+/,Q0],className:{1:"keyword",3:"title"},contains:[J],keywords:[...Ixe,...mL],end:/}/},ge={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Le={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Ee={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Ga,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[V,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:Q0},...d],relevance:0}]};for(const ie of C.variants){const Ne=ie.contains.find(Qe=>Qe.label==="interpol");Ne.keywords=u;const ve=[...d,...p,...v,E,C,...M];Ne.contains=[...ve,{begin:/\(/,end:/\)/,contains:["self",...ve]}]}return{name:"Swift",keywords:u,contains:[...s,ue,pe,ge,Le,Ee,we,de,{beginKeywords:"import",end:/$/,contains:[...s],relevance:0},z,...d,...p,...v,E,C,...M,...Y,J,K]}}const dx="[A-Za-z$_][0-9A-Za-z$_]*",CF=["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"],IF=["true","false","null","undefined","NaN","Infinity"],jF=["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"],RF=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],OF=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],MF=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],LF=[].concat(OF,jF,RF);function Lxe(e){const t=e.regex,n=(P,{after:H})=>{const R="",end:""},r=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(P,H)=>{const R=P[0].length+P.index,Y=P.input[R];if(Y==="<"||Y===","){H.ignoreMatch();return}Y===">"&&(n(P,{after:R})||H.ignoreMatch());let J;const U=P.input.substring(R);if(J=U.match(/^\s*=/)){H.ignoreMatch();return}if((J=U.match(/^\s+extends\s+/))&&J.index===0){H.ignoreMatch();return}}},l={$pattern:dx,keyword:CF,literal:IF,built_in:LF,"variable.language":MF},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\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:l,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"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={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:s+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},E=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,v,{match:/\$\d+/},f];h.contains=E.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(E)});const w=[].concat(x,h.contains),_=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(w)}]),S={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:_},k={variants:[{match:[/class/,/\s+/,s,/\s+/,/extends/,/\s+/,t.concat(s,"(",t.concat(/\./,s),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,s],scope:{1:"keyword",3:"title.class"}}]},T={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:{_:[...jF,...RF]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[S],illegal:/%/},j={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function L(P){return t.concat("(?!",P.join("|"),")")}const z={match:t.concat(/\b/,L([...OF,"super","import"].map(P=>`${P}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},F={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},S]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",M={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[S]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:T},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,v,x,{match:/\$\d+/},f,T,{scope:"attr",match:s+t.lookahead(":"),relevance:0},M,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,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:l,contains:_}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:r},{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:[S,e.inherit(e.TITLE_MODE,{begin:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[S]},z,j,k,F,{match:/\$[(.]/}]}}function DF(e){const t=e.regex,n=Lxe(e),s=dx,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],r={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]},l={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:dx,keyword:CF.concat(c),literal:IF,built_in:LF.concat(i),"variable.language":MF},d={className:"meta",begin:"@"+s},f=(b,v,y)=>{const x=b.contains.findIndex(E=>E.label===v);if(x===-1)throw new Error("can not find mode to replace");b.contains.splice(x,1,y)};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(s,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,p]),n.contains=n.contains.concat([d,r,a,p]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",l);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 Dxe(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},s={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,r=/\d{4}-\d{1,2}-\d{1,2}/,a=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,l=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:t.concat(/# */,t.either(r,i),/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(r,i),/ +/,t.either(a,l),/ *#/)}]},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,s,c,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 Pxe(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),s=["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"}},r={className:"variable",begin:/\$[\w_]+/},a={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},l={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/},c={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:s},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},r,a,i,e.QUOTE_STRING_MODE,c,u,l]}}function Bxe(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),s=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},r={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},a=e.inherit(r,{begin:/\(/,end:/\)/}),l=e.inherit(e.APOS_STRING_MODE,{className:"string"}),c=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:[r,c,l,a,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[r,a,c,l]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{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 PF(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",s={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},r={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]},l=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},v=[s,{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,r,a],y=[...v];return y.pop(),y.push(l),p.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:v}}const Uxe={arduino:Cye,bash:fF,c:Iye,cpp:jye,csharp:Rye,css:$ye,diff:Hye,go:zye,graphql:Vye,ini:hF,java:Gye,javascript:yF,json:xF,kotlin:Qye,less:rxe,lua:axe,makefile:wF,markdown:SF,objectivec:oxe,perl:lxe,php:cxe,"php-template":uxe,plaintext:dxe,python:_F,"python-repl":fxe,r:hxe,ruby:pxe,rust:mxe,scss:_xe,shell:Nxe,sql:Txe,swift:Mxe,typescript:DF,vbnet:Dxe,wasm:Pxe,xml:Bxe,yaml:PF};function BF(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],s=typeof n;(s==="object"||s==="function")&&!Object.isFrozen(n)&&BF(n)}),e}let bL=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function UF(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Dl(e,...t){const n=Object.create(null);for(const s in e)n[s]=e[s];return t.forEach(function(s){for(const i in s)n[i]=s[i]}),n}const Fxe="",yL=e=>!!e.scope,$xe=(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((s,i)=>`${s}${"_".repeat(i+1)}`)].join(" ")}return`${t}${e}`};class Hxe{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=UF(t)}openNode(t){if(!yL(t))return;const n=$xe(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){yL(t)&&(this.buffer+=Fxe)}value(){return this.buffer}span(t){this.buffer+=``}}const xL=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class PA{constructor(){this.rootNode=xL(),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=xL({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(s=>this._walk(t,s)),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=>{PA._collapse(n)}))}}class zxe extends PA{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const s=t.root;n&&(s.scope=`language:${n}`),this.add(s)}toHTML(){return new Hxe(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Pm(e){return e?typeof e=="string"?e:e.source:null}function FF(e){return Au("(?=",e,")")}function Vxe(e){return Au("(?:",e,")*")}function Gxe(e){return Au("(?:",e,")?")}function Au(...e){return e.map(n=>Pm(n)).join("")}function Kxe(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function BA(...e){return"("+(Kxe(e).capture?"":"?:")+e.map(s=>Pm(s)).join("|")+")"}function $F(e){return new RegExp(e.toString()+"|").exec("").length-1}function qxe(e,t){const n=e&&e.exec(t);return n&&n.index===0}const Yxe=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function UA(e,{joinWith:t}){let n=0;return e.map(s=>{n+=1;const i=n;let r=Pm(s),a="";for(;r.length>0;){const l=Yxe.exec(r);if(!l){a+=r;break}a+=r.substring(0,l.index),r=r.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?a+="\\"+String(Number(l[1])+i):(a+=l[0],l[0]==="("&&n++)}return a}).map(s=>`(${s})`).join(t)}const Wxe=/\b\B/,HF="[a-zA-Z]\\w*",FA="[a-zA-Z_]\\w*",zF="\\b\\d+(\\.\\d+)?",VF="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",GF="\\b(0b[01]+)",Xxe="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Qxe=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=Au(t,/.*\b/,e.binary,/\b.*/)),Dl({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,s)=>{n.index!==0&&s.ignoreMatch()}},e)},Bm={begin:"\\\\[\\s\\S]",relevance:0},Zxe={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Bm]},Jxe={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Bm]},e1e={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/},M1=function(e,t,n={}){const s=Dl({scope:"comment",begin:e,end:t,contains:[]},n);s.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=BA("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 s.contains.push({begin:Au(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),s},t1e=M1("//","$"),n1e=M1("/\\*","\\*/"),s1e=M1("#","$"),i1e={scope:"number",begin:zF,relevance:0},r1e={scope:"number",begin:VF,relevance:0},a1e={scope:"number",begin:GF,relevance:0},o1e={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Bm,{begin:/\[/,end:/\]/,relevance:0,contains:[Bm]}]},l1e={scope:"title",begin:HF,relevance:0},c1e={scope:"title",begin:FA,relevance:0},u1e={begin:"\\.\\s*"+FA,relevance:0},d1e=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 Z0=Object.freeze({__proto__:null,APOS_STRING_MODE:Zxe,BACKSLASH_ESCAPE:Bm,BINARY_NUMBER_MODE:a1e,BINARY_NUMBER_RE:GF,COMMENT:M1,C_BLOCK_COMMENT_MODE:n1e,C_LINE_COMMENT_MODE:t1e,C_NUMBER_MODE:r1e,C_NUMBER_RE:VF,END_SAME_AS_BEGIN:d1e,HASH_COMMENT_MODE:s1e,IDENT_RE:HF,MATCH_NOTHING_RE:Wxe,METHOD_GUARD:u1e,NUMBER_MODE:i1e,NUMBER_RE:zF,PHRASAL_WORDS_MODE:e1e,QUOTE_STRING_MODE:Jxe,REGEXP_MODE:o1e,RE_STARTERS_RE:Xxe,SHEBANG:Qxe,TITLE_MODE:l1e,UNDERSCORE_IDENT_RE:FA,UNDERSCORE_TITLE_MODE:c1e});function f1e(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function h1e(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function p1e(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=f1e,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function m1e(e,t){Array.isArray(e.illegal)&&(e.illegal=BA(...e.illegal))}function g1e(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 b1e(e,t){e.relevance===void 0&&(e.relevance=1)}const y1e=(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(s=>{delete e[s]}),e.keywords=n.keywords,e.begin=Au(n.beforeMatch,FF(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},x1e=["of","and","for","in","not","or","if","then","parent","list","value"],E1e="keyword";function KF(e,t,n=E1e){const s=Object.create(null);return typeof e=="string"?i(n,e.split(" ")):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(r){Object.assign(s,KF(e[r],t,r))}),s;function i(r,a){t&&(a=a.map(l=>l.toLowerCase())),a.forEach(function(l){const c=l.split("|");s[c[0]]=[r,v1e(c[0],c[1])]})}}function v1e(e,t){return t?Number(t):w1e(e)?0:1}function w1e(e){return x1e.includes(e.toLowerCase())}const EL={},Zc=e=>{console.error(e)},vL=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Wu=(e,t)=>{EL[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),EL[`${e}/${t}`]=!0)},fx=new Error;function qF(e,t,{key:n}){let s=0;const i=e[n],r={},a={};for(let l=1;l<=t.length;l++)a[l+s]=i[l],r[l+s]=!0,s+=$F(t[l-1]);e[n]=a,e[n]._emit=r,e[n]._multi=!0}function S1e(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Zc("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),fx;if(typeof e.beginScope!="object"||e.beginScope===null)throw Zc("beginScope must be object"),fx;qF(e,e.begin,{key:"beginScope"}),e.begin=UA(e.begin,{joinWith:""})}}function _1e(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Zc("skip, excludeEnd, returnEnd not compatible with endScope: {}"),fx;if(typeof e.endScope!="object"||e.endScope===null)throw Zc("endScope must be object"),fx;qF(e,e.end,{key:"endScope"}),e.end=UA(e.end,{joinWith:""})}}function N1e(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function T1e(e){N1e(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),S1e(e),_1e(e)}function k1e(e){function t(a,l){return new RegExp(Pm(a),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,l]),this.matchAt+=$F(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=t(UA(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;const c=this.matcherRe.exec(l);if(!c)return null;const u=c.findIndex((f,h)=>h>0&&f!==void 0),d=this.matchIndexes[u];return c.splice(0,u),Object.assign(c,d)}}class s{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];const c=new n;return this.rules.slice(l).forEach(([u,d])=>c.addRule(u,d)),c.compile(),this.multiRegexes[l]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,c){this.rules.push([l,c]),c.type==="begin"&&this.count++}exec(l){const c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let u=c.exec(l);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,u=d.exec(l)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function i(a){const l=new s;return a.contains.forEach(c=>l.addRule(c.begin,{rule:c,type:"begin"})),a.terminatorEnd&&l.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&l.addRule(a.illegal,{type:"illegal"}),l}function r(a,l){const c=a;if(a.isCompiled)return c;[h1e,g1e,T1e,y1e].forEach(d=>d(a,l)),e.compilerExtensions.forEach(d=>d(a,l)),a.__beforeBegin=null,[p1e,m1e,b1e].forEach(d=>d(a,l)),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=KF(a.keywords,e.case_insensitive)),c.keywordPatternRe=t(u,!0),l&&(a.begin||(a.begin=/\B|\b/),c.beginRe=t(c.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(c.endRe=t(c.end)),c.terminatorEnd=Pm(c.end)||"",a.endsWithParent&&l.terminatorEnd&&(c.terminatorEnd+=(a.end?"|":"")+l.terminatorEnd)),a.illegal&&(c.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(d){return A1e(d==="self"?a:d)})),a.contains.forEach(function(d){r(d,c)}),a.starts&&r(a.starts,l),c.matcher=i(c),c}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=Dl(e.classNameAliases||{}),r(e)}function YF(e){return e?e.endsWithParent||YF(e.starts):!1}function A1e(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Dl(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:YF(e)?Dl(e,{starts:e.starts?Dl(e.starts):null}):Object.isFrozen(e)?Dl(e):e}var C1e="11.11.1";class I1e extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const bw=UF,wL=Dl,SL=Symbol("nomatch"),j1e=7,WF=function(e){const t=Object.create(null),n=Object.create(null),s=[];let i=!0;const r="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]};let l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:zxe};function c(A){return l.noHighlightRe.test(A)}function u(A){let M=A.className+" ";M+=A.parentNode?A.parentNode.className:"";const P=l.languageDetectRe.exec(M);if(P){const H=T(P[1]);return H||(vL(r.replace("{}",P[1])),vL("Falling back to no-highlight mode for this block.",A)),H?P[1]:"no-highlight"}return M.split(/\s+/).find(H=>c(H)||T(H))}function d(A,M,P){let H="",R="";typeof M=="object"?(H=A,P=M.ignoreIllegals,R=M.language):(Wu("10.7.0","highlight(lang, code, ...args) has been deprecated."),Wu("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),R=A,H=M),P===void 0&&(P=!0);const Y={code:H,language:R};D("before:highlight",Y);const J=Y.result?Y.result:f(Y.language,Y.code,P);return J.code=Y.code,D("after:highlight",J),J}function f(A,M,P,H){const R=Object.create(null);function Y(Z,ae){return Z.keywords[ae]}function J(){if(!ve.keywords){De.addText(Ke);return}let Z=0;ve.keywordPatternRe.lastIndex=0;let ae=ve.keywordPatternRe.exec(Ke),ne="";for(;ae;){ne+=Ke.substring(Z,ae.index);const xe=Ee.case_insensitive?ae[0].toLowerCase():ae[0],Fe=Y(ve,xe);if(Fe){const[at,It]=Fe;if(De.addText(ne),ne="",R[xe]=(R[xe]||0)+1,R[xe]<=j1e&&(Se+=It),at.startsWith("_"))ne+=ae[0];else{const ft=Ee.classNameAliases[at]||at;K(ae[0],ft)}}else ne+=ae[0];Z=ve.keywordPatternRe.lastIndex,ae=ve.keywordPatternRe.exec(Ke)}ne+=Ke.substring(Z),De.addText(ne)}function U(){if(Ke==="")return;let Z=null;if(typeof ve.subLanguage=="string"){if(!t[ve.subLanguage]){De.addText(Ke);return}Z=f(ve.subLanguage,Ke,!0,Qe[ve.subLanguage]),Qe[ve.subLanguage]=Z._top}else Z=p(Ke,ve.subLanguage.length?ve.subLanguage:null);ve.relevance>0&&(Se+=Z.relevance),De.__addSublanguage(Z._emitter,Z.language)}function te(){ve.subLanguage!=null?U():J(),Ke=""}function K(Z,ae){Z!==""&&(De.startScope(ae),De.addText(Z),De.endScope())}function V(Z,ae){let ne=1;const xe=ae.length-1;for(;ne<=xe;){if(!Z._emit[ne]){ne++;continue}const Fe=Ee.classNameAliases[Z[ne]]||Z[ne],at=ae[ne];Fe?K(at,Fe):(Ke=at,J(),Ke=""),ne++}}function W(Z,ae){return Z.scope&&typeof Z.scope=="string"&&De.openNode(Ee.classNameAliases[Z.scope]||Z.scope),Z.beginScope&&(Z.beginScope._wrap?(K(Ke,Ee.classNameAliases[Z.beginScope._wrap]||Z.beginScope._wrap),Ke=""):Z.beginScope._multi&&(V(Z.beginScope,ae),Ke="")),ve=Object.create(Z,{parent:{value:ve}}),ve}function q(Z,ae,ne){let xe=qxe(Z.endRe,ne);if(xe){if(Z["on:end"]){const Fe=new bL(Z);Z["on:end"](ae,Fe),Fe.isMatchIgnored&&(xe=!1)}if(xe){for(;Z.endsParent&&Z.parent;)Z=Z.parent;return Z}}if(Z.endsWithParent)return q(Z.parent,ae,ne)}function ue(Z){return ve.matcher.regexIndex===0?(Ke+=Z[0],1):(qe=!0,0)}function pe(Z){const ae=Z[0],ne=Z.rule,xe=new bL(ne),Fe=[ne.__beforeBegin,ne["on:begin"]];for(const at of Fe)if(at&&(at(Z,xe),xe.isMatchIgnored))return ue(ae);return ne.skip?Ke+=ae:(ne.excludeBegin&&(Ke+=ae),te(),!ne.returnBegin&&!ne.excludeBegin&&(Ke=ae)),W(ne,Z),ne.returnBegin?0:ae.length}function we(Z){const ae=Z[0],ne=M.substring(Z.index),xe=q(ve,Z,ne);if(!xe)return SL;const Fe=ve;ve.endScope&&ve.endScope._wrap?(te(),K(ae,ve.endScope._wrap)):ve.endScope&&ve.endScope._multi?(te(),V(ve.endScope,Z)):Fe.skip?Ke+=ae:(Fe.returnEnd||Fe.excludeEnd||(Ke+=ae),te(),Fe.excludeEnd&&(Ke=ae));do ve.scope&&De.closeNode(),!ve.skip&&!ve.subLanguage&&(Se+=ve.relevance),ve=ve.parent;while(ve!==xe.parent);return xe.starts&&W(xe.starts,Z),Fe.returnEnd?0:ae.length}function de(){const Z=[];for(let ae=ve;ae!==Ee;ae=ae.parent)ae.scope&&Z.unshift(ae.scope);Z.forEach(ae=>De.openNode(ae))}let ge={};function Le(Z,ae){const ne=ae&&ae[0];if(Ke+=Z,ne==null)return te(),0;if(ge.type==="begin"&&ae.type==="end"&&ge.index===ae.index&&ne===""){if(Ke+=M.slice(ae.index,ae.index+1),!i){const xe=new Error(`0 width match regex (${A})`);throw xe.languageName=A,xe.badRule=ge.rule,xe}return 1}if(ge=ae,ae.type==="begin")return pe(ae);if(ae.type==="illegal"&&!P){const xe=new Error('Illegal lexeme "'+ne+'" for mode "'+(ve.scope||"")+'"');throw xe.mode=ve,xe}else if(ae.type==="end"){const xe=we(ae);if(xe!==SL)return xe}if(ae.type==="illegal"&&ne==="")return Ke+=` +`,1;if(Be>1e5&&Be>ae.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ke+=ne,ne.length}const Ee=T(A);if(!Ee)throw Zc(r.replace("{}",A)),new Error('Unknown language: "'+A+'"');const ie=k1e(Ee);let Ne="",ve=H||ie;const Qe={},De=new l.__emitter(l);de();let Ke="",Se=0,He=0,Be=0,qe=!1;try{if(Ee.__emitTokens)Ee.__emitTokens(M,De);else{for(ve.matcher.considerAll();;){Be++,qe?qe=!1:ve.matcher.considerAll(),ve.matcher.lastIndex=He;const Z=ve.matcher.exec(M);if(!Z)break;const ae=M.substring(He,Z.index),ne=Le(ae,Z);He=Z.index+ne}Le(M.substring(He))}return De.finalize(),Ne=De.toHTML(),{language:A,value:Ne,relevance:Se,illegal:!1,_emitter:De,_top:ve}}catch(Z){if(Z.message&&Z.message.includes("Illegal"))return{language:A,value:bw(M),illegal:!0,relevance:0,_illegalBy:{message:Z.message,index:He,context:M.slice(He-100,He+100),mode:Z.mode,resultSoFar:Ne},_emitter:De};if(i)return{language:A,value:bw(M),illegal:!1,relevance:0,errorRaised:Z,_emitter:De,_top:ve};throw Z}}function h(A){const M={value:bw(A),illegal:!1,relevance:0,_top:a,_emitter:new l.__emitter(l)};return M._emitter.addText(A),M}function p(A,M){M=M||l.languages||Object.keys(t);const P=h(A),H=M.filter(T).filter(I).map(te=>f(te,A,!1));H.unshift(P);const R=H.sort((te,K)=>{if(te.relevance!==K.relevance)return K.relevance-te.relevance;if(te.language&&K.language){if(T(te.language).supersetOf===K.language)return 1;if(T(K.language).supersetOf===te.language)return-1}return 0}),[Y,J]=R,U=Y;return U.secondBest=J,U}function m(A,M,P){const H=M&&n[M]||P;A.classList.add("hljs"),A.classList.add(`language-${H}`)}function b(A){let M=null;const P=u(A);if(c(P))return;if(D("before:highlightElement",{el:A,language:P}),A.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",A);return}if(A.children.length>0&&(l.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)),l.throwUnescapedHTML))throw new I1e("One of your code blocks includes unescaped HTML.",A.innerHTML);M=A;const H=M.textContent,R=P?d(H,{language:P,ignoreIllegals:!0}):p(H);A.innerHTML=R.value,A.dataset.highlighted="yes",m(A,P,R.language),A.result={language:R.language,re:R.relevance,relevance:R.relevance},R.secondBest&&(A.secondBest={language:R.secondBest.language,relevance:R.secondBest.relevance}),D("after:highlightElement",{el:A,result:R,text:H})}function v(A){l=wL(l,A)}const y=()=>{w(),Wu("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function x(){w(),Wu("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let E=!1;function w(){function A(){w()}if(document.readyState==="loading"){E||window.addEventListener("DOMContentLoaded",A,!1),E=!0;return}document.querySelectorAll(l.cssSelector).forEach(b)}function _(A,M){let P=null;try{P=M(e)}catch(H){if(Zc("Language definition for '{}' could not be registered.".replace("{}",A)),i)Zc(H);else throw H;P=a}P.name||(P.name=A),t[A]=P,P.rawDefinition=M.bind(null,e),P.aliases&&C(P.aliases,{languageName:A})}function S(A){delete t[A];for(const M of Object.keys(n))n[M]===A&&delete n[M]}function k(){return Object.keys(t)}function T(A){return A=(A||"").toLowerCase(),t[A]||t[n[A]]}function C(A,{languageName:M}){typeof A=="string"&&(A=[A]),A.forEach(P=>{n[P.toLowerCase()]=M})}function I(A){const M=T(A);return M&&!M.disableAutodetect}function j(A){A["before:highlightBlock"]&&!A["before:highlightElement"]&&(A["before:highlightElement"]=M=>{A["before:highlightBlock"](Object.assign({block:M.el},M))}),A["after:highlightBlock"]&&!A["after:highlightElement"]&&(A["after:highlightElement"]=M=>{A["after:highlightBlock"](Object.assign({block:M.el},M))})}function L(A){j(A),s.push(A)}function z(A){const M=s.indexOf(A);M!==-1&&s.splice(M,1)}function D(A,M){const P=A;s.forEach(function(H){H[P]&&H[P](M)})}function F(A){return Wu("10.7.0","highlightBlock will be removed entirely in v12.0"),Wu("10.7.0","Please use highlightElement now."),b(A)}Object.assign(e,{highlight:d,highlightAuto:p,highlightAll:w,highlightElement:b,highlightBlock:F,configure:v,initHighlighting:y,initHighlightingOnLoad:x,registerLanguage:_,unregisterLanguage:S,listLanguages:k,getLanguage:T,registerAliases:C,autoDetection:I,inherit:wL,addPlugin:L,removePlugin:z}),e.debugMode=function(){i=!1},e.safeMode=function(){i=!0},e.versionString=C1e,e.regex={concat:Au,lookahead:FF,either:BA,optional:Gxe,anyNumberOfTimes:Vxe};for(const A in Z0)typeof Z0[A]=="object"&&BF(Z0[A]);return Object.assign(e,Z0),e},Rf=WF({});Rf.newInstance=()=>WF({});var R1e=Rf;Rf.HighlightJS=Rf;Rf.default=Rf;const or=Bf(R1e),_L={},O1e="hljs-";function M1e(e){const t=or.newInstance();return e&&r(e),{highlight:n,highlightAuto:s,listLanguages:i,register:r,registerAlias:a,registered:l};function n(c,u,d){const f=d||_L,h=typeof f.prefix=="string"?f.prefix:O1e;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:L1e,classPrefix:h});const p=t.highlight(u,{ignoreIllegals:!0,language:c});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 s(c,u){const f=(u||_L).subset||i();let h=-1,p=0,m;for(;++hp&&(p=v.data.relevance,m=v)}return m||{type:"root",children:[],data:{language:void 0,relevance:p}}}function i(){return t.listLanguages()}function r(c,u){if(typeof c=="string")t.registerLanguage(c,u);else{let d;for(d in c)Object.hasOwn(c,d)&&t.registerLanguage(d,c[d])}}function a(c,u){if(typeof c=="string")t.registerAliases(typeof u=="string"?u:[...u],{languageName:c});else{let d;for(d in c)if(Object.hasOwn(c,d)){const f=c[d];t.registerAliases(typeof f=="string"?f:[...f],{languageName:d})}}}function l(c){return!!t.getLanguage(c)}}class L1e{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],s=n.children[n.children.length-1];s&&s.type==="text"?s.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const s=this.stack[this.stack.length-1],i=t.root.children;n?s.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):s.children.push(...i)}openNode(t){const n=this,s=t.split(".").map(function(a,l){return l?a+"_".repeat(l):n.options.classPrefix+a}),i=this.stack[this.stack.length-1],r={type:"element",tagName:"span",properties:{className:s},children:[]};i.children.push(r),this.stack.push(r)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const D1e={};function NL(e){const t=e||D1e,n=t.aliases,s=t.detect||!1,i=t.languages||Uxe,r=t.plainText,a=t.prefix,l=t.subset;let c="hljs";const u=M1e(i);if(n&&u.registerAlias(n),a){const d=a.indexOf("-");c=d===-1?a:a.slice(0,d)}return function(d,f){Sg(d,"element",function(h,p,m){if(h.tagName!=="code"||!m||m.type!=="element"||m.tagName!=="pre")return;const b=P1e(h);if(b===!1||!b&&!s||b&&r&&r.includes(b))return;Array.isArray(h.properties.className)||(h.properties.className=[]),h.properties.className.includes(c)||h.properties.className.unshift(c);const v=Eye(h,{whitespace:"pre"});let y;try{y=b?u.highlight(b,v,{prefix:a}):u.highlightAuto(v,{prefix:a,subset:l})}catch(x){const E=x;if(b&&/Unknown language/.test(E.message)){f.message("Cannot highlight as `"+b+"`, it’s not registered",{ancestors:[m,h],cause:E,place:h.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw E}!b&&y.data&&y.data.language&&h.properties.className.push("language-"+y.data.language),y.children.length>0&&(h.children=y.children)})}}function P1e(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let s;for(;++n-1&&r<=t.length){let a=0;for(;;){let l=n[a];if(l===void 0){const c=AL(t,n[a-1]);l=c===-1?t.length+1:c+1,n[a]=l}if(l>r)return{line:a+1,column:r-(a>0?n[a-1]:0)+1,offset:r};a++}}}function i(r){if(r&&typeof r.line=="number"&&typeof r.column=="number"&&!Number.isNaN(r.line)&&!Number.isNaN(r.column)){for(;n.length1?n[r.line-2]:0)+r.column-1;if(a=55296&&e<=57343}function cEe(e){return e>=56320&&e<=57343}function uEe(e,t){return(e-55296)*1024+9216+t}function t$(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function n$(e){return e>=64976&&e<=65007||lEe.has(e)}var ye;(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"})(ye||(ye={}));const dEe=65536;class fEe{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=dEe,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:s,col:i,offset:r}=this,a=i+n,l=r+n;return{code:t,startLine:s,endLine:s,startCol:a,endCol:a,startOffset:l,endOffset:l}}_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(cEe(n))return this.pos++,this._addGap(),uEe(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,G.EOF;return this._err(ye.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 s=0;s=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,G.EOF;const s=this.html.charCodeAt(n);return s===G.CARRIAGE_RETURN?G.LINE_FEED:s}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,G.EOF;let t=this.html.charCodeAt(this.pos);return t===G.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,G.LINE_FEED):t===G.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,e$(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===G.LINE_FEED||t===G.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){t$(t)?this._err(ye.controlCharacterInInputStream):n$(t)&&this._err(ye.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 hEe=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))),pEe=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 mEe(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=pEe.get(e))!==null&&t!==void 0?t:e}var di;(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"})(di||(di={}));const gEe=32;var Pl;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Pl||(Pl={}));function lN(e){return e>=di.ZERO&&e<=di.NINE}function bEe(e){return e>=di.UPPER_A&&e<=di.UPPER_F||e>=di.LOWER_A&&e<=di.LOWER_F}function yEe(e){return e>=di.UPPER_A&&e<=di.UPPER_Z||e>=di.LOWER_A&&e<=di.LOWER_Z||lN(e)}function xEe(e){return e===di.EQUALS||yEe(e)}var oi;(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"})(oi||(oi={}));var Oo;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Oo||(Oo={}));class EEe{constructor(t,n,s){this.decodeTree=t,this.emitCodePoint=n,this.errors=s,this.state=oi.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Oo.Strict}startEntity(t){this.decodeMode=t,this.state=oi.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case oi.EntityStart:return t.charCodeAt(n)===di.NUM?(this.state=oi.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=oi.NamedEntity,this.stateNamedEntity(t,n));case oi.NumericStart:return this.stateNumericStart(t,n);case oi.NumericDecimal:return this.stateNumericDecimal(t,n);case oi.NumericHex:return this.stateNumericHex(t,n);case oi.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|gEe)===di.LOWER_X?(this.state=oi.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=oi.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,s,i){if(n!==s){const r=s-n;this.result=this.result*Math.pow(i,r)+Number.parseInt(t.substr(n,r),i),this.consumed+=r}}stateNumericHex(t,n){const s=n;for(;n>14;for(;n>14,r!==0){if(a===di.SEMI)return this.emitNamedEntityData(this.treeIndex,r,this.consumed+this.excess);this.decodeMode!==Oo.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:s}=this,i=(s[n]&Pl.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,s){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[t]&~Pl.VALUE_LENGTH:i[t+1],s),n===3&&this.emitCodePoint(i[t+2],s),s}end(){var t;switch(this.state){case oi.NamedEntity:return this.result!==0&&(this.decodeMode!==Oo.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case oi.NumericDecimal:return this.emitNumericEntity(0,2);case oi.NumericHex:return this.emitNumericEntity(0,3);case oi.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case oi.EntityStart:return 0}}}function vEe(e,t,n,s){const i=(t&Pl.BRANCH_LENGTH)>>7,r=t&Pl.JUMP_TABLE;if(i===0)return r!==0&&s===r?n:-1;if(r){const c=s-r;return c<0||c>=i?-1:e[n+c]-1}let a=n,l=a+i-1;for(;a<=l;){const c=a+l>>>1,u=e[c];if(us)l=c-1;else return e[c+i]}return-1}var je;(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/"})(je||(je={}));var Jc;(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"})(Jc||(Jc={}));var Gr;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Gr||(Gr={}));var he;(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"})(he||(he={}));var N;(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"})(N||(N={}));const wEe=new Map([[he.A,N.A],[he.ADDRESS,N.ADDRESS],[he.ANNOTATION_XML,N.ANNOTATION_XML],[he.APPLET,N.APPLET],[he.AREA,N.AREA],[he.ARTICLE,N.ARTICLE],[he.ASIDE,N.ASIDE],[he.B,N.B],[he.BASE,N.BASE],[he.BASEFONT,N.BASEFONT],[he.BGSOUND,N.BGSOUND],[he.BIG,N.BIG],[he.BLOCKQUOTE,N.BLOCKQUOTE],[he.BODY,N.BODY],[he.BR,N.BR],[he.BUTTON,N.BUTTON],[he.CAPTION,N.CAPTION],[he.CENTER,N.CENTER],[he.CODE,N.CODE],[he.COL,N.COL],[he.COLGROUP,N.COLGROUP],[he.DD,N.DD],[he.DESC,N.DESC],[he.DETAILS,N.DETAILS],[he.DIALOG,N.DIALOG],[he.DIR,N.DIR],[he.DIV,N.DIV],[he.DL,N.DL],[he.DT,N.DT],[he.EM,N.EM],[he.EMBED,N.EMBED],[he.FIELDSET,N.FIELDSET],[he.FIGCAPTION,N.FIGCAPTION],[he.FIGURE,N.FIGURE],[he.FONT,N.FONT],[he.FOOTER,N.FOOTER],[he.FOREIGN_OBJECT,N.FOREIGN_OBJECT],[he.FORM,N.FORM],[he.FRAME,N.FRAME],[he.FRAMESET,N.FRAMESET],[he.H1,N.H1],[he.H2,N.H2],[he.H3,N.H3],[he.H4,N.H4],[he.H5,N.H5],[he.H6,N.H6],[he.HEAD,N.HEAD],[he.HEADER,N.HEADER],[he.HGROUP,N.HGROUP],[he.HR,N.HR],[he.HTML,N.HTML],[he.I,N.I],[he.IMG,N.IMG],[he.IMAGE,N.IMAGE],[he.INPUT,N.INPUT],[he.IFRAME,N.IFRAME],[he.KEYGEN,N.KEYGEN],[he.LABEL,N.LABEL],[he.LI,N.LI],[he.LINK,N.LINK],[he.LISTING,N.LISTING],[he.MAIN,N.MAIN],[he.MALIGNMARK,N.MALIGNMARK],[he.MARQUEE,N.MARQUEE],[he.MATH,N.MATH],[he.MENU,N.MENU],[he.META,N.META],[he.MGLYPH,N.MGLYPH],[he.MI,N.MI],[he.MO,N.MO],[he.MN,N.MN],[he.MS,N.MS],[he.MTEXT,N.MTEXT],[he.NAV,N.NAV],[he.NOBR,N.NOBR],[he.NOFRAMES,N.NOFRAMES],[he.NOEMBED,N.NOEMBED],[he.NOSCRIPT,N.NOSCRIPT],[he.OBJECT,N.OBJECT],[he.OL,N.OL],[he.OPTGROUP,N.OPTGROUP],[he.OPTION,N.OPTION],[he.P,N.P],[he.PARAM,N.PARAM],[he.PLAINTEXT,N.PLAINTEXT],[he.PRE,N.PRE],[he.RB,N.RB],[he.RP,N.RP],[he.RT,N.RT],[he.RTC,N.RTC],[he.RUBY,N.RUBY],[he.S,N.S],[he.SCRIPT,N.SCRIPT],[he.SEARCH,N.SEARCH],[he.SECTION,N.SECTION],[he.SELECT,N.SELECT],[he.SOURCE,N.SOURCE],[he.SMALL,N.SMALL],[he.SPAN,N.SPAN],[he.STRIKE,N.STRIKE],[he.STRONG,N.STRONG],[he.STYLE,N.STYLE],[he.SUB,N.SUB],[he.SUMMARY,N.SUMMARY],[he.SUP,N.SUP],[he.TABLE,N.TABLE],[he.TBODY,N.TBODY],[he.TEMPLATE,N.TEMPLATE],[he.TEXTAREA,N.TEXTAREA],[he.TFOOT,N.TFOOT],[he.TD,N.TD],[he.TH,N.TH],[he.THEAD,N.THEAD],[he.TITLE,N.TITLE],[he.TR,N.TR],[he.TRACK,N.TRACK],[he.TT,N.TT],[he.U,N.U],[he.UL,N.UL],[he.SVG,N.SVG],[he.VAR,N.VAR],[he.WBR,N.WBR],[he.XMP,N.XMP]]);function rh(e){var t;return(t=wEe.get(e))!==null&&t!==void 0?t:N.UNKNOWN}const Oe=N,SEe={[je.HTML]:new Set([Oe.ADDRESS,Oe.APPLET,Oe.AREA,Oe.ARTICLE,Oe.ASIDE,Oe.BASE,Oe.BASEFONT,Oe.BGSOUND,Oe.BLOCKQUOTE,Oe.BODY,Oe.BR,Oe.BUTTON,Oe.CAPTION,Oe.CENTER,Oe.COL,Oe.COLGROUP,Oe.DD,Oe.DETAILS,Oe.DIR,Oe.DIV,Oe.DL,Oe.DT,Oe.EMBED,Oe.FIELDSET,Oe.FIGCAPTION,Oe.FIGURE,Oe.FOOTER,Oe.FORM,Oe.FRAME,Oe.FRAMESET,Oe.H1,Oe.H2,Oe.H3,Oe.H4,Oe.H5,Oe.H6,Oe.HEAD,Oe.HEADER,Oe.HGROUP,Oe.HR,Oe.HTML,Oe.IFRAME,Oe.IMG,Oe.INPUT,Oe.LI,Oe.LINK,Oe.LISTING,Oe.MAIN,Oe.MARQUEE,Oe.MENU,Oe.META,Oe.NAV,Oe.NOEMBED,Oe.NOFRAMES,Oe.NOSCRIPT,Oe.OBJECT,Oe.OL,Oe.P,Oe.PARAM,Oe.PLAINTEXT,Oe.PRE,Oe.SCRIPT,Oe.SECTION,Oe.SELECT,Oe.SOURCE,Oe.STYLE,Oe.SUMMARY,Oe.TABLE,Oe.TBODY,Oe.TD,Oe.TEMPLATE,Oe.TEXTAREA,Oe.TFOOT,Oe.TH,Oe.THEAD,Oe.TITLE,Oe.TR,Oe.TRACK,Oe.UL,Oe.WBR,Oe.XMP]),[je.MATHML]:new Set([Oe.MI,Oe.MO,Oe.MN,Oe.MS,Oe.MTEXT,Oe.ANNOTATION_XML]),[je.SVG]:new Set([Oe.TITLE,Oe.FOREIGN_OBJECT,Oe.DESC]),[je.XLINK]:new Set,[je.XML]:new Set,[je.XMLNS]:new Set},cN=new Set([Oe.H1,Oe.H2,Oe.H3,Oe.H4,Oe.H5,Oe.H6]);he.STYLE,he.SCRIPT,he.XMP,he.IFRAME,he.NOEMBED,he.NOFRAMES,he.PLAINTEXT;var X;(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"})(X||(X={}));const Ds={DATA:X.DATA,RCDATA:X.RCDATA,RAWTEXT:X.RAWTEXT,SCRIPT_DATA:X.SCRIPT_DATA,PLAINTEXT:X.PLAINTEXT,CDATA_SECTION:X.CDATA_SECTION};function _Ee(e){return e>=G.DIGIT_0&&e<=G.DIGIT_9}function fp(e){return e>=G.LATIN_CAPITAL_A&&e<=G.LATIN_CAPITAL_Z}function NEe(e){return e>=G.LATIN_SMALL_A&&e<=G.LATIN_SMALL_Z}function xl(e){return NEe(e)||fp(e)}function IL(e){return xl(e)||_Ee(e)}function J0(e){return e+32}function i$(e){return e===G.SPACE||e===G.LINE_FEED||e===G.TABULATION||e===G.FORM_FEED}function jL(e){return i$(e)||e===G.SOLIDUS||e===G.GREATER_THAN_SIGN}function TEe(e){return e===G.NULL?ye.nullCharacterReference:e>1114111?ye.characterReferenceOutsideUnicodeRange:e$(e)?ye.surrogateCharacterReference:n$(e)?ye.noncharacterCharacterReference:t$(e)||e===G.CARRIAGE_RETURN?ye.controlCharacterReference:null}class kEe{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=X.DATA,this.returnState=X.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new fEe(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new EEe(hEe,(s,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(s)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(ye.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:s=>{this._err(ye.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+s)},validateNumericCharacterReference:s=>{const i=TEe(s);i&&this._err(i,1)}}:void 0)}_err(t,n=0){var s,i;(i=(s=this.handler).onParseError)===null||i===void 0||i.call(s,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,s){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||s==null||s()}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(ye.endTagWithAttributes),t.selfClosing&&this._err(ye.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 Gt.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case Gt.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case Gt.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:Gt.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=i$(t)?Gt.WHITESPACE_CHARACTER:t===G.NULL?Gt.NULL_CHARACTER:Gt.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(Gt.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=X.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Oo.Attribute:Oo.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===X.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===X.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===X.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case X.DATA:{this._stateData(t);break}case X.RCDATA:{this._stateRcdata(t);break}case X.RAWTEXT:{this._stateRawtext(t);break}case X.SCRIPT_DATA:{this._stateScriptData(t);break}case X.PLAINTEXT:{this._statePlaintext(t);break}case X.TAG_OPEN:{this._stateTagOpen(t);break}case X.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case X.TAG_NAME:{this._stateTagName(t);break}case X.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case X.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case X.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case X.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case X.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case X.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case X.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case X.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case X.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case X.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case X.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case X.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case X.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case X.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case X.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case X.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case X.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case X.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case X.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case X.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case X.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case X.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case X.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case X.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case X.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case X.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case X.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case X.BOGUS_COMMENT:{this._stateBogusComment(t);break}case X.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case X.COMMENT_START:{this._stateCommentStart(t);break}case X.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case X.COMMENT:{this._stateComment(t);break}case X.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case X.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case X.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case X.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case X.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case X.COMMENT_END:{this._stateCommentEnd(t);break}case X.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case X.DOCTYPE:{this._stateDoctype(t);break}case X.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case X.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case X.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case X.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case X.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case X.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case X.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case X.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case X.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case X.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case X.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case X.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case X.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case X.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case X.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case X.CDATA_SECTION:{this._stateCdataSection(t);break}case X.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case X.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case X.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case X.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case G.LESS_THAN_SIGN:{this.state=X.TAG_OPEN;break}case G.AMPERSAND:{this._startCharacterReference();break}case G.NULL:{this._err(ye.unexpectedNullCharacter),this._emitCodePoint(t);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case G.AMPERSAND:{this._startCharacterReference();break}case G.LESS_THAN_SIGN:{this.state=X.RCDATA_LESS_THAN_SIGN;break}case G.NULL:{this._err(ye.unexpectedNullCharacter),this._emitChars(ls);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case G.LESS_THAN_SIGN:{this.state=X.RAWTEXT_LESS_THAN_SIGN;break}case G.NULL:{this._err(ye.unexpectedNullCharacter),this._emitChars(ls);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case G.LESS_THAN_SIGN:{this.state=X.SCRIPT_DATA_LESS_THAN_SIGN;break}case G.NULL:{this._err(ye.unexpectedNullCharacter),this._emitChars(ls);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case G.NULL:{this._err(ye.unexpectedNullCharacter),this._emitChars(ls);break}case G.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(xl(t))this._createStartTagToken(),this.state=X.TAG_NAME,this._stateTagName(t);else switch(t){case G.EXCLAMATION_MARK:{this.state=X.MARKUP_DECLARATION_OPEN;break}case G.SOLIDUS:{this.state=X.END_TAG_OPEN;break}case G.QUESTION_MARK:{this._err(ye.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=X.BOGUS_COMMENT,this._stateBogusComment(t);break}case G.EOF:{this._err(ye.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(ye.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=X.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(xl(t))this._createEndTagToken(),this.state=X.TAG_NAME,this._stateTagName(t);else switch(t){case G.GREATER_THAN_SIGN:{this._err(ye.missingEndTagName),this.state=X.DATA;break}case G.EOF:{this._err(ye.eofBeforeTagName),this._emitChars("");break}case G.NULL:{this._err(ye.unexpectedNullCharacter),this.state=X.SCRIPT_DATA_ESCAPED,this._emitChars(ls);break}case G.EOF:{this._err(ye.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=X.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===G.SOLIDUS?this.state=X.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:xl(t)?(this._emitChars("<"),this.state=X.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=X.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){xl(t)?(this.state=X.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case G.NULL:{this._err(ye.unexpectedNullCharacter),this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(ls);break}case G.EOF:{this._err(ye.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===G.SOLIDUS?(this.state=X.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=X.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(er.SCRIPT,!1)&&jL(this.preprocessor.peek(er.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 s=this._indexOf(t);this.items[s]=n,s===this.stackTop&&(this.current=n)}insertAfter(t,n,s){const i=this._indexOf(t)+1;this.items.splice(i,0,n),this.tagIDs.splice(i,0,s),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])!==je.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;s--)if(t.has(this.tagIDs[s])&&this.treeAdapter.getNamespaceURI(this.items[s])===n)return s;return-1}clearBackTo(t,n){const s=this._indexOfTagNames(t,n);this.shortenToLength(s+1)}clearBackToTableContext(){this.clearBackTo(REe,je.HTML)}clearBackToTableBodyContext(){this.clearBackTo(jEe,je.HTML)}clearBackToTableRowContext(){this.clearBackTo(IEe,je.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]===N.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]===N.HTML}hasInDynamicScope(t,n){for(let s=this.stackTop;s>=0;s--){const i=this.tagIDs[s];switch(this.treeAdapter.getNamespaceURI(this.items[s])){case je.HTML:{if(i===t)return!0;if(n.has(i))return!1;break}case je.SVG:{if(ML.has(i))return!1;break}case je.MATHML:{if(OL.has(i))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,hx)}hasInListItemScope(t){return this.hasInDynamicScope(t,AEe)}hasInButtonScope(t){return this.hasInDynamicScope(t,CEe)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case je.HTML:{if(cN.has(n))return!0;if(hx.has(n))return!1;break}case je.SVG:{if(ML.has(n))return!1;break}case je.MATHML:{if(OL.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===je.HTML)switch(this.tagIDs[n]){case t:return!0;case N.TABLE:case N.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===je.HTML)switch(this.tagIDs[t]){case N.TBODY:case N.THEAD:case N.TFOOT:return!0;case N.TABLE:case N.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===je.HTML)switch(this.tagIDs[n]){case t:return!0;case N.OPTION:case N.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&r$.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&RL.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&RL.has(this.currentTagId);)this.pop()}}const yw=3;var Ya;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(Ya||(Ya={}));const LL={type:Ya.Marker};class LEe{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const s=[],i=n.length,r=this.treeAdapter.getTagName(t),a=this.treeAdapter.getNamespaceURI(t);for(let l=0;l[a.name,a.value]));let r=0;for(let a=0;ai.get(c.name)===c.value)&&(r+=1,r>=yw&&this.entries.splice(l.idx,1))}}insertMarker(){this.entries.unshift(LL)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:Ya.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const s=this.entries.indexOf(this.bookmark);this.entries.splice(s,0,{type:Ya.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(LL);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(s=>s.type===Ya.Marker||this.treeAdapter.getTagName(s.element)===t);return n&&n.type===Ya.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===Ya.Element&&n.element===t)}}const El={createDocument(){return{nodeName:"#document",mode:Gr.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 s=e.childNodes.indexOf(n);e.childNodes.splice(s,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,s){const i=e.childNodes.find(r=>r.nodeName==="#documentType");if(i)i.name=t,i.publicId=n,i.systemId=s;else{const r={nodeName:"#documentType",name:t,publicId:n,systemId:s,parentNode:null};El.appendChild(e,r)}},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(El.isTextNode(n)){n.value+=t;return}}El.appendChild(e,El.createTextNode(t))},insertTextBefore(e,t,n){const s=e.childNodes[e.childNodes.indexOf(n)-1];s&&El.isTextNode(s)?s.value+=t:El.insertBefore(e,El.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(s=>s.name));for(let s=0;se.startsWith(n))}function $Ee(e){return e.name===a$&&e.publicId===null&&(e.systemId===null||e.systemId===DEe)}function HEe(e){if(e.name!==a$)return Gr.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===PEe)return Gr.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),UEe.has(n))return Gr.QUIRKS;let s=t===null?BEe:o$;if(DL(n,s))return Gr.QUIRKS;if(s=t===null?l$:FEe,DL(n,s))return Gr.LIMITED_QUIRKS}return Gr.NO_QUIRKS}const PL={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},zEe="definitionurl",VEe="definitionURL",GEe=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])),KEe=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:je.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:je.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:je.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:je.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:je.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:je.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:je.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:je.XML}],["xml:space",{prefix:"xml",name:"space",namespace:je.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:je.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:je.XMLNS}]]),qEe=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])),YEe=new Set([N.B,N.BIG,N.BLOCKQUOTE,N.BODY,N.BR,N.CENTER,N.CODE,N.DD,N.DIV,N.DL,N.DT,N.EM,N.EMBED,N.H1,N.H2,N.H3,N.H4,N.H5,N.H6,N.HEAD,N.HR,N.I,N.IMG,N.LI,N.LISTING,N.MENU,N.META,N.NOBR,N.OL,N.P,N.PRE,N.RUBY,N.S,N.SMALL,N.SPAN,N.STRONG,N.STRIKE,N.SUB,N.SUP,N.TABLE,N.TT,N.U,N.UL,N.VAR]);function WEe(e){const t=e.tagID;return t===N.FONT&&e.attrs.some(({name:s})=>s===Jc.COLOR||s===Jc.SIZE||s===Jc.FACE)||YEe.has(t)}function c$(e){for(let t=0;t0&&this._setContextModes(t,n)}onItemPop(t,n){var s,i;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(i=(s=this.treeAdapter).onItemPop)===null||i===void 0||i.call(s,t,this.openElements.current),n){let r,a;this.openElements.stackTop===0&&this.fragmentContext?(r=this.fragmentContext,a=this.fragmentContextID):{current:r,currentTagId:a}=this.openElements,this._setContextModes(r,a)}}_setContextModes(t,n){const s=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===je.HTML;this.currentNotInHTML=!s,this.tokenizer.inForeignNode=!s&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,je.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=ee.TEXT}switchToPlaintextParsing(){this.insertionMode=ee.TEXT,this.originalInsertionMode=ee.IN_BODY,this.tokenizer.state=Ds.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)===he.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==je.HTML))switch(this.fragmentContextID){case N.TITLE:case N.TEXTAREA:{this.tokenizer.state=Ds.RCDATA;break}case N.STYLE:case N.XMP:case N.IFRAME:case N.NOEMBED:case N.NOFRAMES:case N.NOSCRIPT:{this.tokenizer.state=Ds.RAWTEXT;break}case N.SCRIPT:{this.tokenizer.state=Ds.SCRIPT_DATA;break}case N.PLAINTEXT:{this.tokenizer.state=Ds.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",s=t.publicId||"",i=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,s,i),t.location){const a=this.treeAdapter.getChildNodes(this.document).find(l=>this.treeAdapter.isDocumentTypeNode(l));a&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const s=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,s)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const s=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(s??this.document,t)}}_appendElement(t,n){const s=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(s,t.location)}_insertElement(t,n){const s=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(s,t.location),this.openElements.push(s,t.tagID)}_insertFakeElement(t,n){const s=this.treeAdapter.createElement(t,je.HTML,[]);this._attachElementToTree(s,null),this.openElements.push(s,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,je.HTML,t.attrs),s=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,s),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(s,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(he.HTML,je.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,N.HTML)}_appendCommentNode(t,n){const s=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,s),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(s,t.location)}_insertCharacters(t){let n,s;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:s}=this._findFosterParentingLocation(),s?this.treeAdapter.insertTextBefore(n,t.chars,s):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),r=s?i.lastIndexOf(s):i.length,a=i[r-1];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:c,endCol:u,endOffset:d}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:c,endCol:u,endOffset:d})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}_adoptNodes(t,n){for(let s=this.treeAdapter.getFirstChild(t);s;s=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(s),this.treeAdapter.appendChild(n,s)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const s=n.location,i=this.treeAdapter.getTagName(t),r=n.type===Gt.END_TAG&&i===n.tagName?{endTag:{...s},endLine:s.endLine,endCol:s.endCol,endOffset:s.endOffset}:{endLine:s.startLine,endCol:s.startCol,endOffset:s.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,r)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,s;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,s=this.fragmentContextID):{current:n,currentTagId:s}=this.openElements,t.tagID===N.SVG&&this.treeAdapter.getTagName(n)===he.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===je.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===N.MGLYPH||t.tagID===N.MALIGNMARK)&&s!==void 0&&!this._isIntegrationPoint(s,n,je.HTML)}_processToken(t){switch(t.type){case Gt.CHARACTER:{this.onCharacter(t);break}case Gt.NULL_CHARACTER:{this.onNullCharacter(t);break}case Gt.COMMENT:{this.onComment(t);break}case Gt.DOCTYPE:{this.onDoctype(t);break}case Gt.START_TAG:{this._processStartTag(t);break}case Gt.END_TAG:{this.onEndTag(t);break}case Gt.EOF:{this.onEof(t);break}case Gt.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,s){const i=this.treeAdapter.getNamespaceURI(n),r=this.treeAdapter.getAttrList(n);return JEe(t,i,r,s)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(i=>i.type===Ya.Marker||this.openElements.contains(i.element)),s=n===-1?t-1:n-1;for(let i=s;i>=0;i--){const r=this.activeFormattingElements.entries[i];this._insertElement(r.token,this.treeAdapter.getNamespaceURI(r.element)),r.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=ee.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(N.P),this.openElements.popUntilTagNamePopped(N.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case N.TR:{this.insertionMode=ee.IN_ROW;return}case N.TBODY:case N.THEAD:case N.TFOOT:{this.insertionMode=ee.IN_TABLE_BODY;return}case N.CAPTION:{this.insertionMode=ee.IN_CAPTION;return}case N.COLGROUP:{this.insertionMode=ee.IN_COLUMN_GROUP;return}case N.TABLE:{this.insertionMode=ee.IN_TABLE;return}case N.BODY:{this.insertionMode=ee.IN_BODY;return}case N.FRAMESET:{this.insertionMode=ee.IN_FRAMESET;return}case N.SELECT:{this._resetInsertionModeForSelect(t);return}case N.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case N.HTML:{this.insertionMode=this.headElement?ee.AFTER_HEAD:ee.BEFORE_HEAD;return}case N.TD:case N.TH:{if(t>0){this.insertionMode=ee.IN_CELL;return}break}case N.HEAD:{if(t>0){this.insertionMode=ee.IN_HEAD;return}break}}this.insertionMode=ee.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const s=this.openElements.tagIDs[n];if(s===N.TEMPLATE)break;if(s===N.TABLE){this.insertionMode=ee.IN_SELECT_IN_TABLE;return}}this.insertionMode=ee.IN_SELECT}_isElementCausesFosterParenting(t){return d$.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 N.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===je.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case N.TABLE:{const s=this.treeAdapter.getParentNode(n);return s?{parent:s,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 s=this.treeAdapter.getNamespaceURI(t);return SEe[s].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Owe(this,t);return}switch(this.insertionMode){case ee.INITIAL:{Kh(this,t);break}case ee.BEFORE_HTML:{Gp(this,t);break}case ee.BEFORE_HEAD:{Kp(this,t);break}case ee.IN_HEAD:{qp(this,t);break}case ee.IN_HEAD_NO_SCRIPT:{Yp(this,t);break}case ee.AFTER_HEAD:{Wp(this,t);break}case ee.IN_BODY:case ee.IN_CAPTION:case ee.IN_CELL:case ee.IN_TEMPLATE:{h$(this,t);break}case ee.TEXT:case ee.IN_SELECT:case ee.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case ee.IN_TABLE:case ee.IN_TABLE_BODY:case ee.IN_ROW:{xw(this,t);break}case ee.IN_TABLE_TEXT:{x$(this,t);break}case ee.IN_COLUMN_GROUP:{px(this,t);break}case ee.AFTER_BODY:{mx(this,t);break}case ee.AFTER_AFTER_BODY:{Yb(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Rwe(this,t);return}switch(this.insertionMode){case ee.INITIAL:{Kh(this,t);break}case ee.BEFORE_HTML:{Gp(this,t);break}case ee.BEFORE_HEAD:{Kp(this,t);break}case ee.IN_HEAD:{qp(this,t);break}case ee.IN_HEAD_NO_SCRIPT:{Yp(this,t);break}case ee.AFTER_HEAD:{Wp(this,t);break}case ee.TEXT:{this._insertCharacters(t);break}case ee.IN_TABLE:case ee.IN_TABLE_BODY:case ee.IN_ROW:{xw(this,t);break}case ee.IN_COLUMN_GROUP:{px(this,t);break}case ee.AFTER_BODY:{mx(this,t);break}case ee.AFTER_AFTER_BODY:{Yb(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){uN(this,t);return}switch(this.insertionMode){case ee.INITIAL:case ee.BEFORE_HTML:case ee.BEFORE_HEAD:case ee.IN_HEAD:case ee.IN_HEAD_NO_SCRIPT:case ee.AFTER_HEAD:case ee.IN_BODY:case ee.IN_TABLE:case ee.IN_CAPTION:case ee.IN_COLUMN_GROUP:case ee.IN_TABLE_BODY:case ee.IN_ROW:case ee.IN_CELL:case ee.IN_SELECT:case ee.IN_SELECT_IN_TABLE:case ee.IN_TEMPLATE:case ee.IN_FRAMESET:case ee.AFTER_FRAMESET:{uN(this,t);break}case ee.IN_TABLE_TEXT:{qh(this,t);break}case ee.AFTER_BODY:{uve(this,t);break}case ee.AFTER_AFTER_BODY:case ee.AFTER_AFTER_FRAMESET:{dve(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case ee.INITIAL:{fve(this,t);break}case ee.BEFORE_HEAD:case ee.IN_HEAD:case ee.IN_HEAD_NO_SCRIPT:case ee.AFTER_HEAD:{this._err(t,ye.misplacedDoctype);break}case ee.IN_TABLE_TEXT:{qh(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,ye.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?Mwe(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case ee.INITIAL:{Kh(this,t);break}case ee.BEFORE_HTML:{hve(this,t);break}case ee.BEFORE_HEAD:{mve(this,t);break}case ee.IN_HEAD:{Oa(this,t);break}case ee.IN_HEAD_NO_SCRIPT:{yve(this,t);break}case ee.AFTER_HEAD:{Eve(this,t);break}case ee.IN_BODY:{Pi(this,t);break}case ee.IN_TABLE:{Of(this,t);break}case ee.IN_TABLE_TEXT:{qh(this,t);break}case ee.IN_CAPTION:{gwe(this,t);break}case ee.IN_COLUMN_GROUP:{KA(this,t);break}case ee.IN_TABLE_BODY:{P1(this,t);break}case ee.IN_ROW:{B1(this,t);break}case ee.IN_CELL:{xwe(this,t);break}case ee.IN_SELECT:{w$(this,t);break}case ee.IN_SELECT_IN_TABLE:{vwe(this,t);break}case ee.IN_TEMPLATE:{Swe(this,t);break}case ee.AFTER_BODY:{Nwe(this,t);break}case ee.IN_FRAMESET:{Twe(this,t);break}case ee.AFTER_FRAMESET:{Awe(this,t);break}case ee.AFTER_AFTER_BODY:{Iwe(this,t);break}case ee.AFTER_AFTER_FRAMESET:{jwe(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?Lwe(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case ee.INITIAL:{Kh(this,t);break}case ee.BEFORE_HTML:{pve(this,t);break}case ee.BEFORE_HEAD:{gve(this,t);break}case ee.IN_HEAD:{bve(this,t);break}case ee.IN_HEAD_NO_SCRIPT:{xve(this,t);break}case ee.AFTER_HEAD:{vve(this,t);break}case ee.IN_BODY:{D1(this,t);break}case ee.TEXT:{awe(this,t);break}case ee.IN_TABLE:{Um(this,t);break}case ee.IN_TABLE_TEXT:{qh(this,t);break}case ee.IN_CAPTION:{bwe(this,t);break}case ee.IN_COLUMN_GROUP:{ywe(this,t);break}case ee.IN_TABLE_BODY:{dN(this,t);break}case ee.IN_ROW:{v$(this,t);break}case ee.IN_CELL:{Ewe(this,t);break}case ee.IN_SELECT:{S$(this,t);break}case ee.IN_SELECT_IN_TABLE:{wwe(this,t);break}case ee.IN_TEMPLATE:{_we(this,t);break}case ee.AFTER_BODY:{N$(this,t);break}case ee.IN_FRAMESET:{kwe(this,t);break}case ee.AFTER_FRAMESET:{Cwe(this,t);break}case ee.AFTER_AFTER_BODY:{Yb(this,t);break}}}onEof(t){switch(this.insertionMode){case ee.INITIAL:{Kh(this,t);break}case ee.BEFORE_HTML:{Gp(this,t);break}case ee.BEFORE_HEAD:{Kp(this,t);break}case ee.IN_HEAD:{qp(this,t);break}case ee.IN_HEAD_NO_SCRIPT:{Yp(this,t);break}case ee.AFTER_HEAD:{Wp(this,t);break}case ee.IN_BODY:case ee.IN_TABLE:case ee.IN_CAPTION:case ee.IN_COLUMN_GROUP:case ee.IN_TABLE_BODY:case ee.IN_ROW:case ee.IN_CELL:case ee.IN_SELECT:case ee.IN_SELECT_IN_TABLE:{b$(this,t);break}case ee.TEXT:{owe(this,t);break}case ee.IN_TABLE_TEXT:{qh(this,t);break}case ee.IN_TEMPLATE:{_$(this,t);break}case ee.AFTER_BODY:case ee.IN_FRAMESET:case ee.AFTER_FRAMESET:case ee.AFTER_AFTER_BODY:case ee.AFTER_AFTER_FRAMESET:{GA(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===G.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 ee.IN_HEAD:case ee.IN_HEAD_NO_SCRIPT:case ee.AFTER_HEAD:case ee.TEXT:case ee.IN_COLUMN_GROUP:case ee.IN_SELECT:case ee.IN_SELECT_IN_TABLE:case ee.IN_FRAMESET:case ee.AFTER_FRAMESET:{this._insertCharacters(t);break}case ee.IN_BODY:case ee.IN_CAPTION:case ee.IN_CELL:case ee.IN_TEMPLATE:case ee.AFTER_BODY:case ee.AFTER_AFTER_BODY:case ee.AFTER_AFTER_FRAMESET:{f$(this,t);break}case ee.IN_TABLE:case ee.IN_TABLE_BODY:case ee.IN_ROW:{xw(this,t);break}case ee.IN_TABLE_TEXT:{y$(this,t);break}}}};function ive(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):g$(e,t),n}function rve(e,t){let n=null,s=e.openElements.stackTop;for(;s>=0;s--){const i=e.openElements.items[s];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[s])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(s,0)),e.activeFormattingElements.removeEntry(t)),n}function ave(e,t,n){let s=t,i=e.openElements.getCommonAncestor(t);for(let r=0,a=i;a!==n;r++,a=i){i=e.openElements.getCommonAncestor(a);const l=e.activeFormattingElements.getElementEntry(a),c=l&&r>=nve;!l||c?(c&&e.activeFormattingElements.removeEntry(l),e.openElements.remove(a)):(a=ove(e,l),s===t&&(e.activeFormattingElements.bookmark=l),e.treeAdapter.detachNode(s),e.treeAdapter.appendChild(a,s),s=a)}return s}function ove(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),s=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,s),t.element=s,s}function lve(e,t,n){const s=e.treeAdapter.getTagName(t),i=rh(s);if(e._isElementCausesFosterParenting(i))e._fosterParentElement(n);else{const r=e.treeAdapter.getNamespaceURI(t);i===N.TEMPLATE&&r===je.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function cve(e,t,n){const s=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,r=e.treeAdapter.createElement(i.tagName,s,i.attrs);e._adoptNodes(t,r),e.treeAdapter.appendChild(t,r),e.activeFormattingElements.insertElementAfterBookmark(r,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,r,i.tagID)}function VA(e,t){for(let n=0;n=n;s--)e._setEndLocation(e.openElements.items[s],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const s=e.openElements.items[0],i=e.treeAdapter.getNodeSourceCodeLocation(s);if(i&&!i.endTag&&(e._setEndLocation(s,t),e.openElements.stackTop>=1)){const r=e.openElements.items[1],a=e.treeAdapter.getNodeSourceCodeLocation(r);a&&!a.endTag&&e._setEndLocation(r,t)}}}}function fve(e,t){e._setDocumentType(t);const n=t.forceQuirks?Gr.QUIRKS:HEe(t);$Ee(t)||e._err(t,ye.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=ee.BEFORE_HTML}function Kh(e,t){e._err(t,ye.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Gr.QUIRKS),e.insertionMode=ee.BEFORE_HTML,e._processToken(t)}function hve(e,t){t.tagID===N.HTML?(e._insertElement(t,je.HTML),e.insertionMode=ee.BEFORE_HEAD):Gp(e,t)}function pve(e,t){const n=t.tagID;(n===N.HTML||n===N.HEAD||n===N.BODY||n===N.BR)&&Gp(e,t)}function Gp(e,t){e._insertFakeRootElement(),e.insertionMode=ee.BEFORE_HEAD,e._processToken(t)}function mve(e,t){switch(t.tagID){case N.HTML:{Pi(e,t);break}case N.HEAD:{e._insertElement(t,je.HTML),e.headElement=e.openElements.current,e.insertionMode=ee.IN_HEAD;break}default:Kp(e,t)}}function gve(e,t){const n=t.tagID;n===N.HEAD||n===N.BODY||n===N.HTML||n===N.BR?Kp(e,t):e._err(t,ye.endTagWithoutMatchingOpenElement)}function Kp(e,t){e._insertFakeElement(he.HEAD,N.HEAD),e.headElement=e.openElements.current,e.insertionMode=ee.IN_HEAD,e._processToken(t)}function Oa(e,t){switch(t.tagID){case N.HTML:{Pi(e,t);break}case N.BASE:case N.BASEFONT:case N.BGSOUND:case N.LINK:case N.META:{e._appendElement(t,je.HTML),t.ackSelfClosing=!0;break}case N.TITLE:{e._switchToTextParsing(t,Ds.RCDATA);break}case N.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,Ds.RAWTEXT):(e._insertElement(t,je.HTML),e.insertionMode=ee.IN_HEAD_NO_SCRIPT);break}case N.NOFRAMES:case N.STYLE:{e._switchToTextParsing(t,Ds.RAWTEXT);break}case N.SCRIPT:{e._switchToTextParsing(t,Ds.SCRIPT_DATA);break}case N.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=ee.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(ee.IN_TEMPLATE);break}case N.HEAD:{e._err(t,ye.misplacedStartTagForHeadElement);break}default:qp(e,t)}}function bve(e,t){switch(t.tagID){case N.HEAD:{e.openElements.pop(),e.insertionMode=ee.AFTER_HEAD;break}case N.BODY:case N.BR:case N.HTML:{qp(e,t);break}case N.TEMPLATE:{Cu(e,t);break}default:e._err(t,ye.endTagWithoutMatchingOpenElement)}}function Cu(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==N.TEMPLATE&&e._err(t,ye.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(N.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,ye.endTagWithoutMatchingOpenElement)}function qp(e,t){e.openElements.pop(),e.insertionMode=ee.AFTER_HEAD,e._processToken(t)}function yve(e,t){switch(t.tagID){case N.HTML:{Pi(e,t);break}case N.BASEFONT:case N.BGSOUND:case N.HEAD:case N.LINK:case N.META:case N.NOFRAMES:case N.STYLE:{Oa(e,t);break}case N.NOSCRIPT:{e._err(t,ye.nestedNoscriptInHead);break}default:Yp(e,t)}}function xve(e,t){switch(t.tagID){case N.NOSCRIPT:{e.openElements.pop(),e.insertionMode=ee.IN_HEAD;break}case N.BR:{Yp(e,t);break}default:e._err(t,ye.endTagWithoutMatchingOpenElement)}}function Yp(e,t){const n=t.type===Gt.EOF?ye.openElementsLeftAfterEof:ye.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=ee.IN_HEAD,e._processToken(t)}function Eve(e,t){switch(t.tagID){case N.HTML:{Pi(e,t);break}case N.BODY:{e._insertElement(t,je.HTML),e.framesetOk=!1,e.insertionMode=ee.IN_BODY;break}case N.FRAMESET:{e._insertElement(t,je.HTML),e.insertionMode=ee.IN_FRAMESET;break}case N.BASE:case N.BASEFONT:case N.BGSOUND:case N.LINK:case N.META:case N.NOFRAMES:case N.SCRIPT:case N.STYLE:case N.TEMPLATE:case N.TITLE:{e._err(t,ye.abandonedHeadElementChild),e.openElements.push(e.headElement,N.HEAD),Oa(e,t),e.openElements.remove(e.headElement);break}case N.HEAD:{e._err(t,ye.misplacedStartTagForHeadElement);break}default:Wp(e,t)}}function vve(e,t){switch(t.tagID){case N.BODY:case N.HTML:case N.BR:{Wp(e,t);break}case N.TEMPLATE:{Cu(e,t);break}default:e._err(t,ye.endTagWithoutMatchingOpenElement)}}function Wp(e,t){e._insertFakeElement(he.BODY,N.BODY),e.insertionMode=ee.IN_BODY,L1(e,t)}function L1(e,t){switch(t.type){case Gt.CHARACTER:{h$(e,t);break}case Gt.WHITESPACE_CHARACTER:{f$(e,t);break}case Gt.COMMENT:{uN(e,t);break}case Gt.START_TAG:{Pi(e,t);break}case Gt.END_TAG:{D1(e,t);break}case Gt.EOF:{b$(e,t);break}}}function f$(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function h$(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function wve(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function Sve(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function _ve(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,je.HTML),e.insertionMode=ee.IN_FRAMESET)}function Nve(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,je.HTML)}function Tve(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&cN.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,je.HTML)}function kve(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,je.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function Ave(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,je.HTML),n||(e.formElement=e.openElements.current))}function Cve(e,t){e.framesetOk=!1;const n=t.tagID;for(let s=e.openElements.stackTop;s>=0;s--){const i=e.openElements.tagIDs[s];if(n===N.LI&&i===N.LI||(n===N.DD||n===N.DT)&&(i===N.DD||i===N.DT)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(i!==N.ADDRESS&&i!==N.DIV&&i!==N.P&&e._isSpecialElement(e.openElements.items[s],i))break}e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,je.HTML)}function Ive(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,je.HTML),e.tokenizer.state=Ds.PLAINTEXT}function jve(e,t){e.openElements.hasInScope(N.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(N.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML),e.framesetOk=!1}function Rve(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(he.A);n&&(VA(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Ove(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Mve(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(N.NOBR)&&(VA(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,je.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Lve(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function Dve(e,t){e.treeAdapter.getDocumentMode(e.document)!==Gr.QUIRKS&&e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._insertElement(t,je.HTML),e.framesetOk=!1,e.insertionMode=ee.IN_TABLE}function p$(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,je.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function m$(e){const t=s$(e,Jc.TYPE);return t!=null&&t.toLowerCase()===eve}function Pve(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,je.HTML),m$(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function Bve(e,t){e._appendElement(t,je.HTML),t.ackSelfClosing=!0}function Uve(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._appendElement(t,je.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Fve(e,t){t.tagName=he.IMG,t.tagID=N.IMG,p$(e,t)}function $ve(e,t){e._insertElement(t,je.HTML),e.skipNextNewLine=!0,e.tokenizer.state=Ds.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=ee.TEXT}function Hve(e,t){e.openElements.hasInButtonScope(N.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,Ds.RAWTEXT)}function zve(e,t){e.framesetOk=!1,e._switchToTextParsing(t,Ds.RAWTEXT)}function FL(e,t){e._switchToTextParsing(t,Ds.RAWTEXT)}function Vve(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===ee.IN_TABLE||e.insertionMode===ee.IN_CAPTION||e.insertionMode===ee.IN_TABLE_BODY||e.insertionMode===ee.IN_ROW||e.insertionMode===ee.IN_CELL?ee.IN_SELECT_IN_TABLE:ee.IN_SELECT}function Gve(e,t){e.openElements.currentTagId===N.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML)}function Kve(e,t){e.openElements.hasInScope(N.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,je.HTML)}function qve(e,t){e.openElements.hasInScope(N.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(N.RTC),e._insertElement(t,je.HTML)}function Yve(e,t){e._reconstructActiveFormattingElements(),c$(t),zA(t),t.selfClosing?e._appendElement(t,je.MATHML):e._insertElement(t,je.MATHML),t.ackSelfClosing=!0}function Wve(e,t){e._reconstructActiveFormattingElements(),u$(t),zA(t),t.selfClosing?e._appendElement(t,je.SVG):e._insertElement(t,je.SVG),t.ackSelfClosing=!0}function $L(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,je.HTML)}function Pi(e,t){switch(t.tagID){case N.I:case N.S:case N.B:case N.U:case N.EM:case N.TT:case N.BIG:case N.CODE:case N.FONT:case N.SMALL:case N.STRIKE:case N.STRONG:{Ove(e,t);break}case N.A:{Rve(e,t);break}case N.H1:case N.H2:case N.H3:case N.H4:case N.H5:case N.H6:{Tve(e,t);break}case N.P:case N.DL:case N.OL:case N.UL:case N.DIV:case N.DIR:case N.NAV:case N.MAIN:case N.MENU:case N.ASIDE:case N.CENTER:case N.FIGURE:case N.FOOTER:case N.HEADER:case N.HGROUP:case N.DIALOG:case N.DETAILS:case N.ADDRESS:case N.ARTICLE:case N.SEARCH:case N.SECTION:case N.SUMMARY:case N.FIELDSET:case N.BLOCKQUOTE:case N.FIGCAPTION:{Nve(e,t);break}case N.LI:case N.DD:case N.DT:{Cve(e,t);break}case N.BR:case N.IMG:case N.WBR:case N.AREA:case N.EMBED:case N.KEYGEN:{p$(e,t);break}case N.HR:{Uve(e,t);break}case N.RB:case N.RTC:{Kve(e,t);break}case N.RT:case N.RP:{qve(e,t);break}case N.PRE:case N.LISTING:{kve(e,t);break}case N.XMP:{Hve(e,t);break}case N.SVG:{Wve(e,t);break}case N.HTML:{wve(e,t);break}case N.BASE:case N.LINK:case N.META:case N.STYLE:case N.TITLE:case N.SCRIPT:case N.BGSOUND:case N.BASEFONT:case N.TEMPLATE:{Oa(e,t);break}case N.BODY:{Sve(e,t);break}case N.FORM:{Ave(e,t);break}case N.NOBR:{Mve(e,t);break}case N.MATH:{Yve(e,t);break}case N.TABLE:{Dve(e,t);break}case N.INPUT:{Pve(e,t);break}case N.PARAM:case N.TRACK:case N.SOURCE:{Bve(e,t);break}case N.IMAGE:{Fve(e,t);break}case N.BUTTON:{jve(e,t);break}case N.APPLET:case N.OBJECT:case N.MARQUEE:{Lve(e,t);break}case N.IFRAME:{zve(e,t);break}case N.SELECT:{Vve(e,t);break}case N.OPTION:case N.OPTGROUP:{Gve(e,t);break}case N.NOEMBED:case N.NOFRAMES:{FL(e,t);break}case N.FRAMESET:{_ve(e,t);break}case N.TEXTAREA:{$ve(e,t);break}case N.NOSCRIPT:{e.options.scriptingEnabled?FL(e,t):$L(e,t);break}case N.PLAINTEXT:{Ive(e,t);break}case N.COL:case N.TH:case N.TD:case N.TR:case N.HEAD:case N.FRAME:case N.TBODY:case N.TFOOT:case N.THEAD:case N.CAPTION:case N.COLGROUP:break;default:$L(e,t)}}function Xve(e,t){if(e.openElements.hasInScope(N.BODY)&&(e.insertionMode=ee.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function Qve(e,t){e.openElements.hasInScope(N.BODY)&&(e.insertionMode=ee.AFTER_BODY,N$(e,t))}function Zve(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function Jve(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(N.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(N.FORM):n&&e.openElements.remove(n))}function ewe(e){e.openElements.hasInButtonScope(N.P)||e._insertFakeElement(he.P,N.P),e._closePElement()}function twe(e){e.openElements.hasInListItemScope(N.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(N.LI),e.openElements.popUntilTagNamePopped(N.LI))}function nwe(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function swe(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function iwe(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function rwe(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(he.BR,N.BR),e.openElements.pop(),e.framesetOk=!1}function g$(e,t){const n=t.tagName,s=t.tagID;for(let i=e.openElements.stackTop;i>0;i--){const r=e.openElements.items[i],a=e.openElements.tagIDs[i];if(s===a&&(s!==N.UNKNOWN||e.treeAdapter.getTagName(r)===n)){e.openElements.generateImpliedEndTagsWithExclusion(s),e.openElements.stackTop>=i&&e.openElements.shortenToLength(i);break}if(e._isSpecialElement(r,a))break}}function D1(e,t){switch(t.tagID){case N.A:case N.B:case N.I:case N.S:case N.U:case N.EM:case N.TT:case N.BIG:case N.CODE:case N.FONT:case N.NOBR:case N.SMALL:case N.STRIKE:case N.STRONG:{VA(e,t);break}case N.P:{ewe(e);break}case N.DL:case N.UL:case N.OL:case N.DIR:case N.DIV:case N.NAV:case N.PRE:case N.MAIN:case N.MENU:case N.ASIDE:case N.BUTTON:case N.CENTER:case N.FIGURE:case N.FOOTER:case N.HEADER:case N.HGROUP:case N.DIALOG:case N.ADDRESS:case N.ARTICLE:case N.DETAILS:case N.SEARCH:case N.SECTION:case N.SUMMARY:case N.LISTING:case N.FIELDSET:case N.BLOCKQUOTE:case N.FIGCAPTION:{Zve(e,t);break}case N.LI:{twe(e);break}case N.DD:case N.DT:{nwe(e,t);break}case N.H1:case N.H2:case N.H3:case N.H4:case N.H5:case N.H6:{swe(e);break}case N.BR:{rwe(e);break}case N.BODY:{Xve(e,t);break}case N.HTML:{Qve(e,t);break}case N.FORM:{Jve(e);break}case N.APPLET:case N.OBJECT:case N.MARQUEE:{iwe(e,t);break}case N.TEMPLATE:{Cu(e,t);break}default:g$(e,t)}}function b$(e,t){e.tmplInsertionModeStack.length>0?_$(e,t):GA(e,t)}function awe(e,t){var n;t.tagID===N.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function owe(e,t){e._err(t,ye.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function xw(e,t){if(e.openElements.currentTagId!==void 0&&d$.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=ee.IN_TABLE_TEXT,t.type){case Gt.CHARACTER:{x$(e,t);break}case Gt.WHITESPACE_CHARACTER:{y$(e,t);break}}else Ng(e,t)}function lwe(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,je.HTML),e.insertionMode=ee.IN_CAPTION}function cwe(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,je.HTML),e.insertionMode=ee.IN_COLUMN_GROUP}function uwe(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(he.COLGROUP,N.COLGROUP),e.insertionMode=ee.IN_COLUMN_GROUP,KA(e,t)}function dwe(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,je.HTML),e.insertionMode=ee.IN_TABLE_BODY}function fwe(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(he.TBODY,N.TBODY),e.insertionMode=ee.IN_TABLE_BODY,P1(e,t)}function hwe(e,t){e.openElements.hasInTableScope(N.TABLE)&&(e.openElements.popUntilTagNamePopped(N.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function pwe(e,t){m$(t)?e._appendElement(t,je.HTML):Ng(e,t),t.ackSelfClosing=!0}function mwe(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,je.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Of(e,t){switch(t.tagID){case N.TD:case N.TH:case N.TR:{fwe(e,t);break}case N.STYLE:case N.SCRIPT:case N.TEMPLATE:{Oa(e,t);break}case N.COL:{uwe(e,t);break}case N.FORM:{mwe(e,t);break}case N.TABLE:{hwe(e,t);break}case N.TBODY:case N.TFOOT:case N.THEAD:{dwe(e,t);break}case N.INPUT:{pwe(e,t);break}case N.CAPTION:{lwe(e,t);break}case N.COLGROUP:{cwe(e,t);break}default:Ng(e,t)}}function Um(e,t){switch(t.tagID){case N.TABLE:{e.openElements.hasInTableScope(N.TABLE)&&(e.openElements.popUntilTagNamePopped(N.TABLE),e._resetInsertionMode());break}case N.TEMPLATE:{Cu(e,t);break}case N.BODY:case N.CAPTION:case N.COL:case N.COLGROUP:case N.HTML:case N.TBODY:case N.TD:case N.TFOOT:case N.TH:case N.THEAD:case N.TR:break;default:Ng(e,t)}}function Ng(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,L1(e,t),e.fosterParentingEnabled=n}function y$(e,t){e.pendingCharacterTokens.push(t)}function x$(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function qh(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===N.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===N.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===N.OPTGROUP&&e.openElements.pop();break}case N.OPTION:{e.openElements.currentTagId===N.OPTION&&e.openElements.pop();break}case N.SELECT:{e.openElements.hasInSelectScope(N.SELECT)&&(e.openElements.popUntilTagNamePopped(N.SELECT),e._resetInsertionMode());break}case N.TEMPLATE:{Cu(e,t);break}}}function vwe(e,t){const n=t.tagID;n===N.CAPTION||n===N.TABLE||n===N.TBODY||n===N.TFOOT||n===N.THEAD||n===N.TR||n===N.TD||n===N.TH?(e.openElements.popUntilTagNamePopped(N.SELECT),e._resetInsertionMode(),e._processStartTag(t)):w$(e,t)}function wwe(e,t){const n=t.tagID;n===N.CAPTION||n===N.TABLE||n===N.TBODY||n===N.TFOOT||n===N.THEAD||n===N.TR||n===N.TD||n===N.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(N.SELECT),e._resetInsertionMode(),e.onEndTag(t)):S$(e,t)}function Swe(e,t){switch(t.tagID){case N.BASE:case N.BASEFONT:case N.BGSOUND:case N.LINK:case N.META:case N.NOFRAMES:case N.SCRIPT:case N.STYLE:case N.TEMPLATE:case N.TITLE:{Oa(e,t);break}case N.CAPTION:case N.COLGROUP:case N.TBODY:case N.TFOOT:case N.THEAD:{e.tmplInsertionModeStack[0]=ee.IN_TABLE,e.insertionMode=ee.IN_TABLE,Of(e,t);break}case N.COL:{e.tmplInsertionModeStack[0]=ee.IN_COLUMN_GROUP,e.insertionMode=ee.IN_COLUMN_GROUP,KA(e,t);break}case N.TR:{e.tmplInsertionModeStack[0]=ee.IN_TABLE_BODY,e.insertionMode=ee.IN_TABLE_BODY,P1(e,t);break}case N.TD:case N.TH:{e.tmplInsertionModeStack[0]=ee.IN_ROW,e.insertionMode=ee.IN_ROW,B1(e,t);break}default:e.tmplInsertionModeStack[0]=ee.IN_BODY,e.insertionMode=ee.IN_BODY,Pi(e,t)}}function _we(e,t){t.tagID===N.TEMPLATE&&Cu(e,t)}function _$(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(N.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):GA(e,t)}function Nwe(e,t){t.tagID===N.HTML?Pi(e,t):mx(e,t)}function N$(e,t){var n;if(t.tagID===N.HTML){if(e.fragmentContext||(e.insertionMode=ee.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===N.HTML){e._setEndLocation(e.openElements.items[0],t);const s=e.openElements.items[1];s&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(s))===null||n===void 0)&&n.endTag)&&e._setEndLocation(s,t)}}else mx(e,t)}function mx(e,t){e.insertionMode=ee.IN_BODY,L1(e,t)}function Twe(e,t){switch(t.tagID){case N.HTML:{Pi(e,t);break}case N.FRAMESET:{e._insertElement(t,je.HTML);break}case N.FRAME:{e._appendElement(t,je.HTML),t.ackSelfClosing=!0;break}case N.NOFRAMES:{Oa(e,t);break}}}function kwe(e,t){t.tagID===N.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==N.FRAMESET&&(e.insertionMode=ee.AFTER_FRAMESET))}function Awe(e,t){switch(t.tagID){case N.HTML:{Pi(e,t);break}case N.NOFRAMES:{Oa(e,t);break}}}function Cwe(e,t){t.tagID===N.HTML&&(e.insertionMode=ee.AFTER_AFTER_FRAMESET)}function Iwe(e,t){t.tagID===N.HTML?Pi(e,t):Yb(e,t)}function Yb(e,t){e.insertionMode=ee.IN_BODY,L1(e,t)}function jwe(e,t){switch(t.tagID){case N.HTML:{Pi(e,t);break}case N.NOFRAMES:{Oa(e,t);break}}}function Rwe(e,t){t.chars=ls,e._insertCharacters(t)}function Owe(e,t){e._insertCharacters(t),e.framesetOk=!1}function T$(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==je.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function Mwe(e,t){if(WEe(t))T$(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),s=e.treeAdapter.getNamespaceURI(n);s===je.MATHML?c$(t):s===je.SVG&&(XEe(t),u$(t)),zA(t),t.selfClosing?e._appendElement(t,s):e._insertElement(t,s),t.ackSelfClosing=!0}}function Lwe(e,t){if(t.tagID===N.P||t.tagID===N.BR){T$(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const s=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(s)===je.HTML){e._endTagOutsideForeignContent(t);break}const i=e.treeAdapter.getTagName(s);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}he.AREA,he.BASE,he.BASEFONT,he.BGSOUND,he.BR,he.COL,he.EMBED,he.FRAME,he.HR,he.IMG,he.INPUT,he.KEYGEN,he.LINK,he.META,he.PARAM,he.SOURCE,he.TRACK,he.WBR;const Dwe=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,Pwe=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),HL={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function k$(e,t){const n=qwe(e),s=H7("type",{handlers:{root:Bwe,element:Uwe,text:Fwe,comment:C$,doctype:$we,raw:zwe},unknown:Vwe}),i={parser:n?new UL(HL):UL.getFragmentParser(void 0,HL),handle(l){s(l,i)},stitches:!1,options:t||{}};s(e,i),ah(i,lo());const r=n?i.parser.document:i.parser.getFragment(),a=Y1e(r,{file:i.options.file});return i.stitches&&Sg(a,"comment",function(l,c,u){const d=l;if(d.value.stitch&&u&&c!==void 0){const f=u.children;return f[c]=d.value.stitch,c}}),a.type==="root"&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function A$(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:Gt.CHARACTER,chars:e.value,location:Tg(e)};ah(t,lo(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function $we(e,t){const n={type:Gt.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:Tg(e)};ah(t,lo(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function Hwe(e,t){t.stitches=!0;const n=Ywe(e);if("children"in e&&"children"in n){const s=k$({type:"root",children:e.children},t.options);n.children=s.children}C$({type:"comment",value:{stitch:n}},t)}function C$(e,t){const n=e.value,s={type:Gt.COMMENT,data:n,location:Tg(e)};ah(t,lo(e)),t.parser.currentToken=s,t.parser._processToken(t.parser.currentToken)}function zwe(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,I$(t,lo(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(Dwe,"<$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 Vwe(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))Hwe(n,t);else{let s="";throw Pwe.has(n.type)&&(s=". 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"+s)}}function ah(e,t){I$(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=Ds.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 I$(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 Gwe(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===Ds.PLAINTEXT)return;ah(t,lo(e));const s=t.parser.openElements.current;let i="namespaceURI"in s?s.namespaceURI:Bc.html;i===Bc.html&&n==="svg"&&(i=Bc.svg);const r=J1e({...e,children:[]},{space:i===Bc.svg?"svg":"html"}),a={type:Gt.START_TAG,tagName:n,tagID:rh(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in r?r.attrs:[],location:Tg(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function Kwe(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&oEe.includes(n)||t.parser.tokenizer.state===Ds.PLAINTEXT)return;ah(t,C1(e));const s={type:Gt.END_TAG,tagName:n,tagID:rh(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:Tg(e)};t.parser.currentToken=s,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===Ds.RCDATA||t.parser.tokenizer.state===Ds.RAWTEXT||t.parser.tokenizer.state===Ds.SCRIPT_DATA)&&(t.parser.tokenizer.state=Ds.DATA)}function qwe(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function Tg(e){const t=lo(e)||{line:void 0,column:void 0,offset:void 0},n=C1(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 Ywe(e){return"children"in e?jf({...e,children:[]}):jf(e)}function Wwe(e){return function(t,n){return k$(t,{...e,file:n})}}const j$=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function R$(e){if(!e)return!1;try{const t=e.toLowerCase();return j$.some(n=>t.includes(n))}catch{return!1}}function Xwe(e){var s;const t=(s=e==null?void 0:e.properties)==null?void 0:s.href;if(!t)return!1;if(R$(t))return!0;const n=e==null?void 0:e.children;if(n&&Array.isArray(n)){const i=n.map(r=>(r==null?void 0:r.value)||"").join("").toLowerCase();return j$.some(r=>i.includes(r))}return!1}function Qwe({text:e,className:t,allowRawHtml:n=!0}){const[s,i]=g.useState(null),r=(c,u)=>{if(c.src)return c.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=c=>{try{const d=new URL(c).pathname.split("/");return d[d.length-1]||"video.mp4"}catch{return"video.mp4"}},l=c=>c?Array.isArray(c)?c.map(u=>(u==null?void 0:u.value)||"").join("")||"video":(c==null?void 0:c.value)||"video":"video";return o.jsxs("div",{className:t?`md ${t}`:"md",children:[o.jsx(e0e,{remarkPlugins:[hye],rehypePlugins:n?[Wwe,NL]:[NL],components:{a:({node:c,...u})=>{const d=u.href;if(d&&(R$(d)||Xwe(c))){const f=d,h=l(c==null?void 0:c.children);return o.jsxs("div",{className:"video-container",children:[o.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":`点击播放视频: ${h}`,onClick:()=>i({src:f,title:h}),children:[o.jsx("video",{src:f,playsInline:!0,className:"video-thumbnail",preload:"metadata"}),o.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:o.jsx(Yc,{})})]}),o.jsx("div",{className:"video-caption",children:o.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"video-link-text",children:h})})]})}return o.jsx("a",{...u,target:"_blank",rel:"noopener noreferrer"})},img:({node:c,src:u,alt:d,...f})=>{const h=o.jsx("img",{...f,src:u,alt:d??"",loading:"lazy"});return u?o.jsx(fB,{src:u,children:o.jsxs("button",{type:"button",className:"image-preview-trigger","aria-label":`放大预览:${d||"图片"}`,children:[h,o.jsx("span",{className:"image-preview-hint","aria-hidden":"true",children:o.jsx(Yc,{})})]})}):h},video:({node:c,src:u,children:d,...f})=>{const h=r({src:u},d);return h?o.jsx("div",{className:"video-container",children:o.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":"点击放大视频",onClick:()=>i({src:h}),children:[o.jsx("video",{src:h,...f,playsInline:!0,className:"video-thumbnail",children:d}),o.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:o.jsx(Yc,{})})]})}):o.jsx("video",{src:u,controls:!0,playsInline:!0,className:"video-inline",...f,children:d})}},children:e}),s&&o.jsx("div",{className:"video-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":"视频预览",onClick:()=>i(null),children:o.jsxs("div",{className:"video-viewer",onClick:c=>c.stopPropagation(),children:[o.jsxs("div",{className:"video-viewer-header",children:[o.jsx("div",{className:"video-viewer-title",children:s.title||a(s.src)}),o.jsxs("nav",{className:"video-viewer-nav",children:[o.jsx("a",{href:s.src,download:s.title||a(s.src),"aria-label":"下载视频",title:"下载视频",className:"video-viewer-download",children:o.jsx(t1,{})}),o.jsx("button",{type:"button",className:"video-viewer-close","aria-label":"关闭",onClick:()=>i(null),children:o.jsx(Ti,{})})]})]}),o.jsx("div",{className:"video-viewer-body",children:o.jsx("video",{src:s.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const oh=g.memo(Qwe),zL=6,VL=7,Zwe={active:"可用",available:"可用",creating:"创建中",disabled:"已停用",enabled:"已启用",failed:"异常",inactive:"未启用",pending:"等待中",published:"已发布",ready:"就绪",released:"已发布",running:"运行中",success:"正常",unavailable:"不可用",unreleased:"未发布",updating:"更新中"};function fN(e){return Zwe[(e||"").trim().toLowerCase()]||"未知"}function GL(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 Jwe(e){if(!e)return"";const t=e.trim(),n=Number(t),s=/^\d+(?:\.\d+)?$/.test(t)?new Date(n<1e12?n*1e3:n):new Date(t);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(s)}function eSe(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 Qwe({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.jsx("path",{d:"M6.25 4.75h8.6l2.9 2.9v11.6h-11.5z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),o.jsx("path",{d:"M14.75 4.9v3h2.85M8.9 11.1h4.2M8.9 14h5.7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),o.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 Zwe(){return o.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:"m7.5 7.5 9 9m0-9-9 9",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function HL({direction:e}){return o.jsx("svg",{className:"icon",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:o.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 cN(){return o.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function zL({page:e,total:t,pageSize:n,onPage:s}){const i=Math.max(1,Math.ceil(t/n));return o.jsxs("footer",{className:"skillcenter-pager",children:[o.jsxs("span",{children:["共 ",t," 项"]}),o.jsxs("div",{className:"skillcenter-pager-actions",children:[o.jsx("button",{type:"button",onClick:()=>s(e-1),disabled:e<=1,"aria-label":"上一页",children:o.jsx(HL,{direction:"left"})}),o.jsxs("span",{children:[e," / ",i]}),o.jsx("button",{type:"button",onClick:()=>s(e+1),disabled:e>=i,"aria-label":"下一页",children:o.jsx(HL,{direction:"right"})})]})]})}function qb({children:e}){return o.jsx("div",{className:"skillcenter-empty",children:e})}function Jwe({skill:e,space:t,region:n,detail:s,loading:i,error:r,onClose:a}){return g.useEffect(()=>{const l=c=>{c.key==="Escape"&&a()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[a]),o.jsx("div",{className:"skill-detail-backdrop",role:"presentation",onMouseDown:a,children:o.jsxs("section",{className:"skill-detail-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-detail-title",onMouseDown:l=>l.stopPropagation(),children:[o.jsxs("header",{className:"skill-detail-head",children:[o.jsxs("div",{className:"skill-detail-heading",children:[o.jsx("span",{className:"skillcenter-symbol skillcenter-symbol--skill",children:o.jsx(Qwe,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:"skill-detail-title",children:(s==null?void 0:s.name)||e.skillName}),o.jsx("p",{children:(s==null?void 0:s.description)||e.skillDescription||"暂无描述"})]})]}),o.jsx("button",{type:"button",className:"skill-detail-close",onClick:a,"aria-label":"关闭技能详情",children:o.jsx(Zwe,{})})]}),o.jsxs("dl",{className:"skill-detail-meta",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"技能 ID"}),o.jsx("dd",{title:e.skillId,children:e.skillId})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"版本"}),o.jsx("dd",{children:(s==null?void 0:s.version)||e.version||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:lN(e.skillStatus)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"技能空间"}),o.jsx("dd",{title:t.name,children:t.name})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"Project"}),o.jsx("dd",{title:t.projectName||"default",children:t.projectName||"default"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"地域"}),o.jsx("dd",{children:n==="cn-beijing"?"北京":"上海"})]})]}),o.jsxs("div",{className:"skill-detail-content",children:[o.jsx("div",{className:"skill-detail-content-title",children:"SKILL.md"}),i?o.jsxs("div",{className:"skillcenter-loading",children:[o.jsx(cN,{}),"正在读取技能内容…"]}):r?o.jsx("div",{className:"skillcenter-error",children:r}):s!=null&&s.skillMd?o.jsx(rh,{text:Xwe(s.skillMd),className:"skill-detail-markdown",allowRawHtml:!1}):o.jsx(qb,{children:"该技能暂无 SKILL.md 内容"})]})]})})}function eSe(){const[e,t]=g.useState("cn-beijing"),[n,s]=g.useState([]),[i,r]=g.useState(1),[a,l]=g.useState(0),[c,u]=g.useState(!1),[d,f]=g.useState(""),[h,p]=g.useState(null),[m,b]=g.useState([]),[v,y]=g.useState(1),[x,E]=g.useState(0),[w,_]=g.useState(!1),[S,k]=g.useState(""),[T,C]=g.useState(null),[I,j]=g.useState(null),[L,z]=g.useState(!1),[D,F]=g.useState(""),A=g.useRef(0);g.useEffect(()=>{let Y=!0;return u(!0),f(""),afe({region:e,page:i,pageSize:UL}).then(J=>{if(!Y)return;const U=J.items||[];s(U),l(J.totalCount||0),p(te=>U.find(K=>K.id===(te==null?void 0:te.id))||null)}).catch(J=>{Y&&(s([]),l(0),p(null),f(J instanceof Error?J.message:"读取技能空间失败,请稍后重试"))}).finally(()=>{Y&&u(!1)}),()=>{Y=!1}},[e,i]),g.useEffect(()=>{if(!h){b([]),E(0);return}let Y=!0;return _(!0),k(""),ofe(h.id,{region:e,page:v,pageSize:FL,project:h.projectName}).then(J=>{Y&&(b(J.items||[]),E(J.totalCount||0))}).catch(J=>{Y&&(b([]),E(0),k(J instanceof Error?J.message:"读取技能失败,请稍后重试"))}).finally(()=>{Y&&_(!1)}),()=>{Y=!1}},[e,h,v]);const O=Y=>{Y!==e&&($(),t(Y),r(1),y(1),p(null),b([]))},P=Y=>{$(),p(Y),y(1)},$=()=>{A.current+=1,C(null),j(null),F(""),z(!1)},R=async Y=>{if(!h)return;const J=A.current+1;A.current=J,C(Y),j(null),F(""),z(!0);try{const U=await lfe(h.id,Y.skillId,Y.version,e,h.projectName);A.current===J&&j(U)}catch(U){A.current===J&&F(U instanceof Error?U.message:"读取技能详情失败,请稍后重试")}finally{A.current===J&&z(!1)}};return o.jsxs("section",{className:"skillcenter",children:[o.jsxs("div",{className:"skillcenter-browser",children:[o.jsxs("section",{className:"skillcenter-panel","aria-label":"技能空间列表",children:[o.jsxs("header",{className:"skillcenter-panel-head",children:[o.jsxs("div",{children:[o.jsx("h2",{children:"技能空间"}),o.jsx("span",{className:"skillcenter-count-badge",children:a})]}),o.jsxs("div",{className:"skillcenter-regions","aria-label":"地域",children:[o.jsx("button",{type:"button",className:e==="cn-beijing"?"active":"",onClick:()=>O("cn-beijing"),children:"北京"}),o.jsx("button",{type:"button",className:e==="cn-shanghai"?"active":"",onClick:()=>O("cn-shanghai"),children:"上海"})]})]}),o.jsxs("div",{className:"skillcenter-listwrap",children:[c&&o.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[o.jsx(cN,{}),"正在读取技能空间…"]}),d?o.jsx("div",{className:"skillcenter-error",children:d}):n.length===0&&!c?o.jsx(qb,{children:"当前地域暂无可访问的技能空间"}):o.jsx("div",{className:"skillcenter-list",children:n.map(Y=>o.jsx("button",{type:"button",className:`skillcenter-space-item ${(h==null?void 0:h.id)===Y.id?"active":""}`,onClick:()=>P(Y),children:o.jsxs("span",{className:"skillcenter-item-body",children:[o.jsx("span",{className:"skillcenter-item-title",title:Y.name,children:Y.name}),o.jsx("span",{className:"skillcenter-item-description",children:Y.description||"暂无描述"}),o.jsxs("span",{className:"skillcenter-item-meta",children:[o.jsx("span",{className:`skillcenter-status ${$L(Y.status)}`,children:lN(Y.status)}),o.jsxs("span",{className:"skillcenter-meta-text",title:Y.projectName||"default",children:["Project · ",Y.projectName||"default"]}),o.jsxs("span",{className:"skillcenter-meta-text",children:[Y.skillCount??0," 个技能"]}),Y.updatedAt&&o.jsxs("span",{className:"skillcenter-meta-text",children:["更新于 ",Wwe(Y.updatedAt)]})]})]})},`${Y.projectName||"default"}:${Y.id}`))})]}),o.jsx(zL,{page:i,total:a,pageSize:UL,onPage:r})]}),o.jsx("section",{className:"skillcenter-panel","aria-label":"技能列表",children:h?o.jsxs(o.Fragment,{children:[o.jsxs("header",{className:"skillcenter-panel-head",children:[o.jsx("div",{children:o.jsxs("h2",{title:h.name,children:[h.name," · 技能"]})}),o.jsx("span",{children:x})]}),o.jsxs("div",{className:"skillcenter-listwrap",children:[w&&o.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[o.jsx(cN,{}),"正在读取技能…"]}),S?o.jsx("div",{className:"skillcenter-error",children:S}):m.length===0&&!w?o.jsx(qb,{children:"这个空间中暂无技能"}):o.jsx("div",{className:"skillcenter-list skillcenter-list--skills",children:m.map(Y=>o.jsx("button",{type:"button",className:"skillcenter-skill-item",onClick:()=>void R(Y),children:o.jsxs("span",{className:"skillcenter-item-body",children:[o.jsx("span",{className:"skillcenter-item-title",title:Y.skillName,children:Y.skillName}),o.jsx("span",{className:"skillcenter-item-description",children:Y.skillDescription||"暂无描述"}),o.jsxs("span",{className:"skillcenter-item-meta",children:[o.jsx("span",{className:`skillcenter-status ${$L(Y.skillStatus)}`,children:lN(Y.skillStatus)}),o.jsxs("span",{className:"skillcenter-meta-text",children:["版本 · ",Y.version||"—"]})]})]})},`${Y.skillId}:${Y.version}`))})]}),o.jsx(zL,{page:v,total:x,pageSize:FL,onPage:y})]}):o.jsx(qb,{children:"点击 Skill 空间以查看详情"})})]}),T&&h&&o.jsx(Jwe,{skill:T,space:h,region:e,detail:I,loading:L,error:D,onClose:$})]})}const C$="veadk_agentkit_connections",tSe=["cn-beijing","cn-shanghai"];function nSe(e){const t=e||"cn-beijing";return[t,...tSe.filter(n=>n!==t)]}function Ea(){try{const e=localStorage.getItem(C$);return(e?JSON.parse(e):[]).filter(n=>!n.runtimeId||!!n.region)}catch{return[]}}function P1(e){try{localStorage.setItem(C$,JSON.stringify(e))}catch{}}function so(e,t){return`agentkit:${e}:${t}`}function I$(e){try{return new URL(e).host}catch{return e}}function ah(e){_B();for(const t of e)if(!(t.runtimeId&&!t.region))for(const n of t.apps)SB(so(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function j$(e,t,n,s,i,r){const a={id:`rt_${e}`,name:t||e,runtimeId:e,region:n,apps:s,appLabels:i,currentVersion:r},l=Ea(),c=l.findIndex(u=>u.runtimeId===e);return c===-1?l.push(a):l[c]=a,P1(l),ah(l),a}async function Yb(e,t,n,s){let i=null,r=n||"cn-beijing",a=null;for(const u of nSe(n))try{const d=await $k(e,u,{retryProbe:!0});if(d&&d.length>0){i=d,r=u;break}}catch(d){if(d instanceof Yf)throw px(e),d;if(d instanceof Sr&&d.unsupported){a=d;continue}throw d}if(!i||i.length===0)throw px(e),a||new Error("该 Runtime 暂不支持连接,请确认服务已正常运行。");const l=Object.fromEntries(i.map(u=>[u,t])),c=j$(e,t,r,i,l,s);return so(c.id,i[0])}async function R$(e,t,n,s){const i=t.trim().replace(/\/+$/,""),r=await i1(i,n.trim()),a={id:Date.now().toString(36),name:e.trim()||I$(i),base:i,apiKey:n.trim(),apps:r,appLabels:s&&r.length>0?{[r[0]]:s}:void 0},l=[...Ea().filter(c=>c.base!==i),a];return P1(l),ah(l),a}function sSe(e){const t=Ea().filter(n=>n.id!==e);return P1(t),ah(t),t}function px(e){const t=Ea().filter(n=>n.runtimeId!==e);return P1(t),ah(t),t}function O$(e,t){const n=e.map(i=>({id:i,label:i,app:i,remote:!1})),s=t.flatMap(i=>i.apps.map(r=>{var l;const a=((l=i.appLabels)==null?void 0:l[r])??r;return{id:so(i.id,r),label:a,app:r,remote:!0,host:i.runtimeId?i.name:I$(i.base??""),runtimeId:i.runtimeId,region:i.region,currentVersion:i.currentVersion}}));return[...n,...s]}const VL=Object.freeze(Object.defineProperty({__proto__:null,addConnection:R$,addRuntimeConnection:j$,buildAgentEntries:O$,connectRuntime:Yb,loadConnections:Ea,registerConnections:ah,remoteAppId:so,removeConnection:sSe,removeRuntimeConnection:px},Symbol.toStringTag,{value:"Module"}));function iSe({onAdded:e,onCancel:t}){const[n,s]=g.useState(""),[i,r]=g.useState(""),[a,l]=g.useState(""),[c,u]=g.useState(!1),[d,f]=g.useState(""),h=n.trim().length>0&&i.trim().length>0&&!c;async function p(){if(h){u(!0),f("");try{const m=await R$(a,n,i,a);if(m.apps.length===0){f("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。"),u(!1);return}e(so(m.id,m.apps[0]))}catch(m){f(`连接失败:${String(m)}。请检查 URL、API Key,以及该网关是否允许跨域。`),u(!1)}}}return o.jsx("div",{className:"addagent",children:o.jsxs("div",{className:"addagent-card",children:[o.jsx("h2",{className:"addagent-title",children:"添加 AgentKit 智能体"}),o.jsx("p",{className:"addagent-sub",children:"填入 AgentKit 部署的访问地址与 API Key,将通过 ADK 协议连接,连接成功后其 Agent 会出现在左上角的下拉中。"}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"访问地址 URL"}),o.jsx("input",{className:"addagent-input",value:n,onChange:m=>s(m.target.value),placeholder:"https://xxxxx.apigateway-cn-beijing.volceapi.com",autoFocus:!0})]}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"API Key"}),o.jsx("input",{className:"addagent-input",type:"password",value:i,onChange:m=>r(m.target.value),placeholder:"以 Authorization: Bearer 方式连接"})]}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"显示名称(可选)"}),o.jsx("input",{className:"addagent-input",value:a,onChange:m=>l(m.target.value),placeholder:"默认取 URL 的主机名"})]}),d&&o.jsx("div",{className:"addagent-error",children:d}),o.jsxs("div",{className:"addagent-actions",children:[o.jsx("button",{className:"addagent-btn addagent-btn--ghost",onClick:t,disabled:c,children:"取消"}),o.jsxs("button",{className:"addagent-btn addagent-btn--primary",onClick:p,disabled:!h,children:[c?o.jsx(mn,{className:"icon spin"}):null,c?"连接中…":"连接并添加"]})]})]})})}function rSe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M12 4.2 21 19H3L12 4.2Z"}),o.jsx("path",{d:"M12 9.4v4.2"}),o.jsx("path",{d:"M12 16.8h.01"})]})}function aSe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"m7 7 10 10"}),o.jsx("path",{d:"m17 7-10 10"})]})}function zA({title:e,description:t,confirmLabel:n,cancelLabel:s="取消",closeLabel:i="关闭确认框",variant:r="warning",busy:a=!1,onCancel:l,onConfirm:c}){const u=g.useId(),d=g.useId(),f=g.useRef(null),h=g.useRef(a),p=g.useRef(l);return g.useEffect(()=>{h.current=a,p.current=l},[a,l]),g.useEffect(()=>{var y;const m=document.body.style.overflow,b=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(y=f.current)==null||y.focus();const v=x=>{x.key==="Escape"&&!h.current&&p.current()};return window.addEventListener("keydown",v),()=>{document.body.style.overflow=m,window.removeEventListener("keydown",v),b!=null&&b.isConnected&&b.focus()}},[]),hi.createPortal(o.jsx("div",{className:"studio-confirm-backdrop",onMouseDown:m=>{m.target===m.currentTarget&&!a&&l()},children:o.jsxs("section",{className:`studio-confirm-dialog studio-confirm-dialog--${r}`,role:"alertdialog","aria-modal":"true","aria-labelledby":u,"aria-describedby":d,"aria-busy":a||void 0,children:[o.jsxs("header",{className:"studio-confirm-head",children:[o.jsxs("div",{className:"studio-confirm-title-wrap",children:[o.jsx("span",{className:"studio-confirm-title-icon","aria-hidden":"true",children:o.jsx(rSe,{})}),o.jsx("h2",{id:u,children:e})]}),o.jsx("button",{type:"button",className:"studio-confirm-close",onClick:l,disabled:a,"aria-label":i,children:o.jsx(aSe,{})})]}),o.jsx("div",{className:"studio-confirm-body",children:o.jsx("p",{id:d,children:t})}),o.jsxs("footer",{className:"studio-confirm-actions",children:[o.jsx("button",{ref:f,type:"button",onClick:l,disabled:a,children:s}),o.jsx("button",{type:"button",className:"studio-confirm-primary",onClick:c,disabled:a,children:n})]})]})}),document.body)}const oSe=[{id:"case-1",itemKey:"case-1",kind:"good",input:"总结本周客户反馈,并按优先级归类。",output:"覆盖主要问题,给出清晰的优先级与下一步动作。",referenceOutput:"覆盖主要问题,给出清晰的优先级与下一步动作。",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T09:12:00+08:00",evaluationSetId:"",evaluationSetName:"示例 good case",workspaceId:"",tag:"总结",source:"auto",score:.92,reason:"任务完整覆盖了用户目标,输出结构清晰,并给出了可执行的下一步动作。"},{id:"case-2",itemKey:"case-2",kind:"good",input:"查询最新公开资料并附上来源。",output:"调用搜索工具,结论与引用一一对应。",referenceOutput:"调用搜索工具,结论与引用一一对应。",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T08:47:00+08:00",evaluationSetId:"",evaluationSetName:"示例 good case",workspaceId:"",tag:"工具调用",source:"user"},{id:"case-3",itemKey:"case-3",kind:"bad",input:"在信息不足时直接给出确定结论。",output:"应明确说明未知,并主动询问缺失信息。",referenceOutput:"",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T07:35:00+08:00",evaluationSetId:"",evaluationSetName:"示例 bad case",workspaceId:"",tag:"幻觉",source:"auto",score:.28,reason:"信息不足时仍给出了确定结论,缺少必要的澄清步骤与不确定性说明。"},{id:"case-4",itemKey:"case-4",kind:"bad",input:"连续重复调用相同工具获取同一结果。",output:"复用已有结果,避免无意义的重复调用。",referenceOutput:"",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T06:58:00+08:00",evaluationSetId:"",evaluationSetName:"示例 bad case",workspaceId:"",tag:"效率",source:"user"}],lSe=[{id:"eval-regression",name:"核心能力回归",agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量","工具调用"],concurrency:"4",history:[{id:"run-1",createdAt:"今天 10:32",score:88,status:"completed"},{id:"run-2",createdAt:"昨天 16:08",score:84,status:"completed"}]},{id:"eval-safety",name:"安全与幻觉检查",agentIds:[],caseSet:"安全边界集",evaluator:"事实一致性评估器",metrics:["事实准确性","拒答合理性"],concurrency:"2",history:[{id:"run-3",createdAt:"7 月 25 日 14:20",score:91,status:"completed"}]}],Yu=[{id:"basic",label:"基本信息"},{id:"evaluations",label:"评测集"},{id:"optimizations",label:"优化项"},{id:"integrations",label:"接入方法"}],Wh=[{id:"api-server",label:"API Server"},{id:"a2a",label:"A2A"}];function bw(e,t){return e?`${e.replace(/\/+$/,"")}${t}`:""}function cSe(e,t){const n=e.trim();if(!n||!t)return n;try{const s=new URL(n),i=s.hostname.replace(/^\[|\]$/g,"").toLowerCase();if(!["localhost","127.0.0.1","::1"].includes(i))return n;const r=new URL(t);return s.protocol=r.protocol,s.hostname=r.hostname,s.port=r.port,s.toString()}catch{return n}}function GL(e){return e==="key_auth"?"API Key":e==="custom_jwt"?"OAuth / JWT":e==="none"?"无需鉴权":"暂无"}function uN(e){return JSON.stringify(e)}function M$(e){return e==="key_auth"?`API_KEY = "" +`,4);return n>=0?t.slice(n+5).trimStart():e}function tSe({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.jsx("path",{d:"M6.25 4.75h8.6l2.9 2.9v11.6h-11.5z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),o.jsx("path",{d:"M14.75 4.9v3h2.85M8.9 11.1h4.2M8.9 14h5.7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),o.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 nSe(){return o.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:"m7.5 7.5 9 9m0-9-9 9",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function KL({direction:e}){return o.jsx("svg",{className:"icon",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:o.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 hN(){return o.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function qL({page:e,total:t,pageSize:n,onPage:s}){const i=Math.max(1,Math.ceil(t/n));return o.jsxs("footer",{className:"skillcenter-pager",children:[o.jsxs("span",{children:["共 ",t," 项"]}),o.jsxs("div",{className:"skillcenter-pager-actions",children:[o.jsx("button",{type:"button",onClick:()=>s(e-1),disabled:e<=1,"aria-label":"上一页",children:o.jsx(KL,{direction:"left"})}),o.jsxs("span",{children:[e," / ",i]}),o.jsx("button",{type:"button",onClick:()=>s(e+1),disabled:e>=i,"aria-label":"下一页",children:o.jsx(KL,{direction:"right"})})]})]})}function Wb({children:e}){return o.jsx("div",{className:"skillcenter-empty",children:e})}function sSe({skill:e,space:t,region:n,detail:s,loading:i,error:r,onClose:a}){return g.useEffect(()=>{const l=c=>{c.key==="Escape"&&a()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[a]),o.jsx("div",{className:"skill-detail-backdrop",role:"presentation",onMouseDown:a,children:o.jsxs("section",{className:"skill-detail-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-detail-title",onMouseDown:l=>l.stopPropagation(),children:[o.jsxs("header",{className:"skill-detail-head",children:[o.jsxs("div",{className:"skill-detail-heading",children:[o.jsx("span",{className:"skillcenter-symbol skillcenter-symbol--skill",children:o.jsx(tSe,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:"skill-detail-title",children:(s==null?void 0:s.name)||e.skillName}),o.jsx("p",{children:(s==null?void 0:s.description)||e.skillDescription||"暂无描述"})]})]}),o.jsx("button",{type:"button",className:"skill-detail-close",onClick:a,"aria-label":"关闭技能详情",children:o.jsx(nSe,{})})]}),o.jsxs("dl",{className:"skill-detail-meta",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"技能 ID"}),o.jsx("dd",{title:e.skillId,children:e.skillId})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"版本"}),o.jsx("dd",{children:(s==null?void 0:s.version)||e.version||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:fN(e.skillStatus)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"技能空间"}),o.jsx("dd",{title:t.name,children:t.name})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"Project"}),o.jsx("dd",{title:t.projectName||"default",children:t.projectName||"default"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"地域"}),o.jsx("dd",{children:n==="cn-beijing"?"北京":"上海"})]})]}),o.jsxs("div",{className:"skill-detail-content",children:[o.jsx("div",{className:"skill-detail-content-title",children:"SKILL.md"}),i?o.jsxs("div",{className:"skillcenter-loading",children:[o.jsx(hN,{}),"正在读取技能内容…"]}):r?o.jsx("div",{className:"skillcenter-error",children:r}):s!=null&&s.skillMd?o.jsx(oh,{text:eSe(s.skillMd),className:"skill-detail-markdown",allowRawHtml:!1}):o.jsx(Wb,{children:"该技能暂无 SKILL.md 内容"})]})]})})}function iSe(){const[e,t]=g.useState("cn-beijing"),[n,s]=g.useState([]),[i,r]=g.useState(1),[a,l]=g.useState(0),[c,u]=g.useState(!1),[d,f]=g.useState(""),[h,p]=g.useState(null),[m,b]=g.useState([]),[v,y]=g.useState(1),[x,E]=g.useState(0),[w,_]=g.useState(!1),[S,k]=g.useState(""),[T,C]=g.useState(null),[I,j]=g.useState(null),[L,z]=g.useState(!1),[D,F]=g.useState(""),A=g.useRef(0);g.useEffect(()=>{let Y=!0;return u(!0),f(""),ufe({region:e,page:i,pageSize:zL}).then(J=>{if(!Y)return;const U=J.items||[];s(U),l(J.totalCount||0),p(te=>U.find(K=>K.id===(te==null?void 0:te.id))||null)}).catch(J=>{Y&&(s([]),l(0),p(null),f(J instanceof Error?J.message:"读取技能空间失败,请稍后重试"))}).finally(()=>{Y&&u(!1)}),()=>{Y=!1}},[e,i]),g.useEffect(()=>{if(!h){b([]),E(0);return}let Y=!0;return _(!0),k(""),dfe(h.id,{region:e,page:v,pageSize:VL,project:h.projectName}).then(J=>{Y&&(b(J.items||[]),E(J.totalCount||0))}).catch(J=>{Y&&(b([]),E(0),k(J instanceof Error?J.message:"读取技能失败,请稍后重试"))}).finally(()=>{Y&&_(!1)}),()=>{Y=!1}},[e,h,v]);const M=Y=>{Y!==e&&(H(),t(Y),r(1),y(1),p(null),b([]))},P=Y=>{H(),p(Y),y(1)},H=()=>{A.current+=1,C(null),j(null),F(""),z(!1)},R=async Y=>{if(!h)return;const J=A.current+1;A.current=J,C(Y),j(null),F(""),z(!0);try{const U=await ffe(h.id,Y.skillId,Y.version,e,h.projectName);A.current===J&&j(U)}catch(U){A.current===J&&F(U instanceof Error?U.message:"读取技能详情失败,请稍后重试")}finally{A.current===J&&z(!1)}};return o.jsxs("section",{className:"skillcenter",children:[o.jsxs("div",{className:"skillcenter-browser",children:[o.jsxs("section",{className:"skillcenter-panel","aria-label":"技能空间列表",children:[o.jsxs("header",{className:"skillcenter-panel-head",children:[o.jsxs("div",{children:[o.jsx("h2",{children:"技能空间"}),o.jsx("span",{className:"skillcenter-count-badge",children:a})]}),o.jsxs("div",{className:"skillcenter-regions","aria-label":"地域",children:[o.jsx("button",{type:"button",className:e==="cn-beijing"?"active":"",onClick:()=>M("cn-beijing"),children:"北京"}),o.jsx("button",{type:"button",className:e==="cn-shanghai"?"active":"",onClick:()=>M("cn-shanghai"),children:"上海"})]})]}),o.jsxs("div",{className:"skillcenter-listwrap",children:[c&&o.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[o.jsx(hN,{}),"正在读取技能空间…"]}),d?o.jsx("div",{className:"skillcenter-error",children:d}):n.length===0&&!c?o.jsx(Wb,{children:"当前地域暂无可访问的技能空间"}):o.jsx("div",{className:"skillcenter-list",children:n.map(Y=>o.jsx("button",{type:"button",className:`skillcenter-space-item ${(h==null?void 0:h.id)===Y.id?"active":""}`,onClick:()=>P(Y),children:o.jsxs("span",{className:"skillcenter-item-body",children:[o.jsx("span",{className:"skillcenter-item-title",title:Y.name,children:Y.name}),o.jsx("span",{className:"skillcenter-item-description",children:Y.description||"暂无描述"}),o.jsxs("span",{className:"skillcenter-item-meta",children:[o.jsx("span",{className:`skillcenter-status ${GL(Y.status)}`,children:fN(Y.status)}),o.jsxs("span",{className:"skillcenter-meta-text",title:Y.projectName||"default",children:["Project · ",Y.projectName||"default"]}),o.jsxs("span",{className:"skillcenter-meta-text",children:[Y.skillCount??0," 个技能"]}),Y.updatedAt&&o.jsxs("span",{className:"skillcenter-meta-text",children:["更新于 ",Jwe(Y.updatedAt)]})]})]})},`${Y.projectName||"default"}:${Y.id}`))})]}),o.jsx(qL,{page:i,total:a,pageSize:zL,onPage:r})]}),o.jsx("section",{className:"skillcenter-panel","aria-label":"技能列表",children:h?o.jsxs(o.Fragment,{children:[o.jsxs("header",{className:"skillcenter-panel-head",children:[o.jsx("div",{children:o.jsxs("h2",{title:h.name,children:[h.name," · 技能"]})}),o.jsx("span",{children:x})]}),o.jsxs("div",{className:"skillcenter-listwrap",children:[w&&o.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[o.jsx(hN,{}),"正在读取技能…"]}),S?o.jsx("div",{className:"skillcenter-error",children:S}):m.length===0&&!w?o.jsx(Wb,{children:"这个空间中暂无技能"}):o.jsx("div",{className:"skillcenter-list skillcenter-list--skills",children:m.map(Y=>o.jsx("button",{type:"button",className:"skillcenter-skill-item",onClick:()=>void R(Y),children:o.jsxs("span",{className:"skillcenter-item-body",children:[o.jsx("span",{className:"skillcenter-item-title",title:Y.skillName,children:Y.skillName}),o.jsx("span",{className:"skillcenter-item-description",children:Y.skillDescription||"暂无描述"}),o.jsxs("span",{className:"skillcenter-item-meta",children:[o.jsx("span",{className:`skillcenter-status ${GL(Y.skillStatus)}`,children:fN(Y.skillStatus)}),o.jsxs("span",{className:"skillcenter-meta-text",children:["版本 · ",Y.version||"—"]})]})]})},`${Y.skillId}:${Y.version}`))})]}),o.jsx(qL,{page:v,total:x,pageSize:VL,onPage:y})]}):o.jsx(Wb,{children:"点击 Skill 空间以查看详情"})})]}),T&&h&&o.jsx(sSe,{skill:T,space:h,region:e,detail:I,loading:L,error:D,onClose:H})]})}const O$="veadk_agentkit_connections",rSe=["cn-beijing","cn-shanghai"];function aSe(e){const t=e||"cn-beijing";return[t,...rSe.filter(n=>n!==t)]}function xa(){try{const e=localStorage.getItem(O$);return(e?JSON.parse(e):[]).filter(n=>!n.runtimeId||!!n.region)}catch{return[]}}function U1(e){try{localStorage.setItem(O$,JSON.stringify(e))}catch{}}function so(e,t){return`agentkit:${e}:${t}`}function M$(e){try{return new URL(e).host}catch{return e}}function lh(e){AB();for(const t of e)if(!(t.runtimeId&&!t.region))for(const n of t.apps)kB(so(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function L$(e,t,n,s,i,r){const a={id:`rt_${e}`,name:t||e,runtimeId:e,region:n,apps:s,appLabels:i,currentVersion:r},l=xa(),c=l.findIndex(u=>u.runtimeId===e);return c===-1?l.push(a):l[c]=a,U1(l),lh(l),a}async function Xb(e,t,n,s){let i=null,r=n||"cn-beijing",a=null;for(const u of aSe(n))try{const d=await Gk(e,u,{retryProbe:!0});if(d&&d.length>0){i=d,r=u;break}}catch(d){if(d instanceof Xf)throw gx(e),d;if(d instanceof Sr&&d.unsupported){a=d;continue}throw d}if(!i||i.length===0)throw gx(e),a||new Error("该 Runtime 暂不支持连接,请确认服务已正常运行。");const l=Object.fromEntries(i.map(u=>[u,t])),c=L$(e,t,r,i,l,s);return so(c.id,i[0])}async function D$(e,t,n,s){const i=t.trim().replace(/\/+$/,""),r=await a1(i,n.trim()),a={id:Date.now().toString(36),name:e.trim()||M$(i),base:i,apiKey:n.trim(),apps:r,appLabels:s&&r.length>0?{[r[0]]:s}:void 0},l=[...xa().filter(c=>c.base!==i),a];return U1(l),lh(l),a}function oSe(e){const t=xa().filter(n=>n.id!==e);return U1(t),lh(t),t}function gx(e){const t=xa().filter(n=>n.runtimeId!==e);return U1(t),lh(t),t}function P$(e,t){const n=e.map(i=>({id:i,label:i,app:i,remote:!1})),s=t.flatMap(i=>i.apps.map(r=>{var l;const a=((l=i.appLabels)==null?void 0:l[r])??r;return{id:so(i.id,r),label:a,app:r,remote:!0,host:i.runtimeId?i.name:M$(i.base??""),runtimeId:i.runtimeId,region:i.region,currentVersion:i.currentVersion}}));return[...n,...s]}const YL=Object.freeze(Object.defineProperty({__proto__:null,addConnection:D$,addRuntimeConnection:L$,buildAgentEntries:P$,connectRuntime:Xb,loadConnections:xa,registerConnections:lh,remoteAppId:so,removeConnection:oSe,removeRuntimeConnection:gx},Symbol.toStringTag,{value:"Module"}));function lSe({onAdded:e,onCancel:t}){const[n,s]=g.useState(""),[i,r]=g.useState(""),[a,l]=g.useState(""),[c,u]=g.useState(!1),[d,f]=g.useState(""),h=n.trim().length>0&&i.trim().length>0&&!c;async function p(){if(h){u(!0),f("");try{const m=await D$(a,n,i,a);if(m.apps.length===0){f("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。"),u(!1);return}e(so(m.id,m.apps[0]))}catch(m){f(`连接失败:${String(m)}。请检查 URL、API Key,以及该网关是否允许跨域。`),u(!1)}}}return o.jsx("div",{className:"addagent",children:o.jsxs("div",{className:"addagent-card",children:[o.jsx("h2",{className:"addagent-title",children:"添加 AgentKit 智能体"}),o.jsx("p",{className:"addagent-sub",children:"填入 AgentKit 部署的访问地址与 API Key,将通过 ADK 协议连接,连接成功后其 Agent 会出现在左上角的下拉中。"}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"访问地址 URL"}),o.jsx("input",{className:"addagent-input",value:n,onChange:m=>s(m.target.value),placeholder:"https://xxxxx.apigateway-cn-beijing.volceapi.com",autoFocus:!0})]}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"API Key"}),o.jsx("input",{className:"addagent-input",type:"password",value:i,onChange:m=>r(m.target.value),placeholder:"以 Authorization: Bearer 方式连接"})]}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"显示名称(可选)"}),o.jsx("input",{className:"addagent-input",value:a,onChange:m=>l(m.target.value),placeholder:"默认取 URL 的主机名"})]}),d&&o.jsx("div",{className:"addagent-error",children:d}),o.jsxs("div",{className:"addagent-actions",children:[o.jsx("button",{className:"addagent-btn addagent-btn--ghost",onClick:t,disabled:c,children:"取消"}),o.jsxs("button",{className:"addagent-btn addagent-btn--primary",onClick:p,disabled:!h,children:[c?o.jsx(dn,{className:"icon spin"}):null,c?"连接中…":"连接并添加"]})]})]})})}function cSe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M12 4.2 21 19H3L12 4.2Z"}),o.jsx("path",{d:"M12 9.4v4.2"}),o.jsx("path",{d:"M12 16.8h.01"})]})}function uSe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"m7 7 10 10"}),o.jsx("path",{d:"m17 7-10 10"})]})}function qA({title:e,description:t,confirmLabel:n,cancelLabel:s="取消",closeLabel:i="关闭确认框",variant:r="warning",busy:a=!1,onCancel:l,onConfirm:c}){const u=g.useId(),d=g.useId(),f=g.useRef(null),h=g.useRef(a),p=g.useRef(l);return g.useEffect(()=>{h.current=a,p.current=l},[a,l]),g.useEffect(()=>{var y;const m=document.body.style.overflow,b=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(y=f.current)==null||y.focus();const v=x=>{x.key==="Escape"&&!h.current&&p.current()};return window.addEventListener("keydown",v),()=>{document.body.style.overflow=m,window.removeEventListener("keydown",v),b!=null&&b.isConnected&&b.focus()}},[]),hi.createPortal(o.jsx("div",{className:"studio-confirm-backdrop",onMouseDown:m=>{m.target===m.currentTarget&&!a&&l()},children:o.jsxs("section",{className:`studio-confirm-dialog studio-confirm-dialog--${r}`,role:"alertdialog","aria-modal":"true","aria-labelledby":u,"aria-describedby":d,"aria-busy":a||void 0,children:[o.jsxs("header",{className:"studio-confirm-head",children:[o.jsxs("div",{className:"studio-confirm-title-wrap",children:[o.jsx("span",{className:"studio-confirm-title-icon","aria-hidden":"true",children:o.jsx(cSe,{})}),o.jsx("h2",{id:u,children:e})]}),o.jsx("button",{type:"button",className:"studio-confirm-close",onClick:l,disabled:a,"aria-label":i,children:o.jsx(uSe,{})})]}),o.jsx("div",{className:"studio-confirm-body",children:o.jsx("p",{id:d,children:t})}),o.jsxs("footer",{className:"studio-confirm-actions",children:[o.jsx("button",{ref:f,type:"button",onClick:l,disabled:a,children:s}),o.jsx("button",{type:"button",className:"studio-confirm-primary",onClick:c,disabled:a,children:n})]})]})}),document.body)}const dSe=[{id:"case-1",itemKey:"case-1",kind:"good",input:"总结本周客户反馈,并按优先级归类。",output:"覆盖主要问题,给出清晰的优先级与下一步动作。",referenceOutput:"覆盖主要问题,给出清晰的优先级与下一步动作。",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T09:12:00+08:00",evaluationSetId:"",evaluationSetName:"示例 good case",workspaceId:"",tag:"总结",source:"auto",score:.92,reason:"任务完整覆盖了用户目标,输出结构清晰,并给出了可执行的下一步动作。"},{id:"case-2",itemKey:"case-2",kind:"good",input:"查询最新公开资料并附上来源。",output:"调用搜索工具,结论与引用一一对应。",referenceOutput:"调用搜索工具,结论与引用一一对应。",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T08:47:00+08:00",evaluationSetId:"",evaluationSetName:"示例 good case",workspaceId:"",tag:"工具调用",source:"user"},{id:"case-3",itemKey:"case-3",kind:"bad",input:"在信息不足时直接给出确定结论。",output:"应明确说明未知,并主动询问缺失信息。",referenceOutput:"",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T07:35:00+08:00",evaluationSetId:"",evaluationSetName:"示例 bad case",workspaceId:"",tag:"幻觉",source:"auto",score:.28,reason:"信息不足时仍给出了确定结论,缺少必要的澄清步骤与不确定性说明。"},{id:"case-4",itemKey:"case-4",kind:"bad",input:"连续重复调用相同工具获取同一结果。",output:"复用已有结果,避免无意义的重复调用。",referenceOutput:"",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T06:58:00+08:00",evaluationSetId:"",evaluationSetName:"示例 bad case",workspaceId:"",tag:"效率",source:"user"}],fSe=[{id:"eval-regression",name:"核心能力回归",agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量","工具调用"],concurrency:"4",history:[{id:"run-1",createdAt:"今天 10:32",score:88,status:"completed"},{id:"run-2",createdAt:"昨天 16:08",score:84,status:"completed"}]},{id:"eval-safety",name:"安全与幻觉检查",agentIds:[],caseSet:"安全边界集",evaluator:"事实一致性评估器",metrics:["事实准确性","拒答合理性"],concurrency:"2",history:[{id:"run-3",createdAt:"7 月 25 日 14:20",score:91,status:"completed"}]}],Xu=[{id:"basic",label:"基本信息"},{id:"evaluations",label:"评测集"},{id:"optimizations",label:"优化项"},{id:"integrations",label:"接入方法"}],Yh=[{id:"api-server",label:"API Server"},{id:"a2a",label:"A2A"}];function Ew(e,t){return e?`${e.replace(/\/+$/,"")}${t}`:""}function hSe(e,t){const n=e.trim();if(!n||!t)return n;try{const s=new URL(n),i=s.hostname.replace(/^\[|\]$/g,"").toLowerCase();if(!["localhost","127.0.0.1","::1"].includes(i))return n;const r=new URL(t);return s.protocol=r.protocol,s.hostname=r.hostname,s.port=r.port,s.toString()}catch{return n}}function WL(e){return e==="key_auth"?"API Key":e==="custom_jwt"?"OAuth / JWT":e==="none"?"无需鉴权":"暂无"}function pN(e){return JSON.stringify(e)}function B$(e){return e==="key_auth"?`API_KEY = "" HEADERS = {"Authorization": f"Bearer {API_KEY}"}`:e==="custom_jwt"?`ACCESS_TOKEN = "" HEADERS = {"Authorization": f"Bearer {ACCESS_TOKEN}"}`:e==="none"?"HEADERS = {}":`AUTH_TOKEN = "" -HEADERS = {"Authorization": f"Bearer {AUTH_TOKEN}"}`}function uSe(e,t,n){const s=e.replace(/\/+$/,"");return`\`\`\`python +HEADERS = {"Authorization": f"Bearer {AUTH_TOKEN}"}`}function pSe(e,t,n){const s=e.replace(/\/+$/,"");return`\`\`\`python import uuid import requests -BASE_URL = ${uN(s)} -APP_NAME = ${uN(t)} +BASE_URL = ${pN(s)} +APP_NAME = ${pN(t)} USER_ID = "demo-user" SESSION_ID = str(uuid.uuid4()) -${M$(n)} +${B$(n)} session_response = requests.post( f"{BASE_URL}/apps/{APP_NAME}/users/{USER_ID}/sessions/{SESSION_ID}", @@ -615,13 +615,13 @@ with requests.post( for line in response.iter_lines(): if line: print(line.decode("utf-8")) -\`\`\``}function dSe(e,t){return`\`\`\`python +\`\`\``}function mSe(e,t){return`\`\`\`python import uuid import requests -AGENT_URL = ${uN(e)} -${M$(t)} +AGENT_URL = ${pN(e)} +${B$(t)} response = requests.post( AGENT_URL, @@ -642,11 +642,11 @@ response = requests.post( ) response.raise_for_status() print(response.json()) -\`\`\``}function fSe({visible:e}){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M2.8 12s3.3-5.4 9.2-5.4 9.2 5.4 9.2 5.4-3.3 5.4-9.2 5.4S2.8 12 2.8 12Z"}),o.jsx("circle",{cx:"12",cy:"12",r:"2.4"}),!e&&o.jsx("path",{d:"m4.2 4.2 15.6 15.6"})]})}function KL({available:e,authType:t,value:n,visible:s,loading:i,error:r,onToggle:a}){return e?t==="none"?"无需 API Key":t==="custom_jwt"?"使用 OAuth / JWT":t!=="key_auth"?"暂无":o.jsxs("span",{className:"aw-integration-secret",children:[o.jsx("span",{className:"aw-integration-secret-value","aria-live":"polite",children:s&&n?n:"****"}),o.jsx("button",{type:"button",className:"aw-integration-secret-toggle","aria-label":s?"隐藏 API Key":"显示 API Key",title:s?"隐藏 API Key":"显示 API Key",disabled:i,onClick:a,children:i?o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}):o.jsx(fSe,{visible:s})}),r&&o.jsx("span",{className:"aw-integration-secret-error",role:"alert",children:r})]}):"暂无"}function qL({protocol:e,title:t,available:n,fields:s,example:i}){return o.jsxs("section",{className:`aw-integration-panel${n&&i?" has-example":""}`,id:`integration-${e}-panel`,role:"tabpanel","aria-labelledby":`integration-${e}-tab`,children:[o.jsx("header",{children:o.jsx("h3",{children:t})}),o.jsx("dl",{children:s.map(r=>o.jsxs("div",{children:[o.jsx("dt",{children:r.label}),o.jsx("dd",{children:r.value||"暂无"})]},r.label))}),n&&i&&o.jsxs("section",{className:"aw-integration-example",children:[o.jsx("h4",{children:"Python 示例"}),o.jsx(rh,{text:i,className:"aw-integration-example-code",allowRawHtml:!1})]})]})}function L$(e){const t=e.tools??[],n=_u.filter(i=>i.toolNames.some(r=>t.includes(r))),s=new Set(n.flatMap(i=>i.toolNames));return{...wi(),name:e.name,description:e.description,instruction:e.instruction||wi().instruction,agentType:e.type,modelName:e.model,tools:t.filter(i=>!s.has(i)),builtinTools:n.map(i=>i.id),skills:(e.skills??[]).map(i=>i.name),subAgents:(e.children??[]).map(L$)}}function hSe(e,t){var n;return e!=null&&e.draft?e.draft:e!=null&&e.graph?L$(e.graph):{...wi(),name:(e==null?void 0:e.name)||t,description:(e==null?void 0:e.description)||"暂无描述",agentType:(e==null?void 0:e.type)??"llm",modelName:e==null?void 0:e.model,tools:(e==null?void 0:e.tools)??[],skills:((n=e==null?void 0:e.skills)==null?void 0:n.map(s=>s.name))??[]}}function D$(e){return e?1+e.children.reduce((t,n)=>t+D$(n),0):1}function P$(e){return 1+e.subAgents.reduce((t,n)=>t+P$(n),0)}function dN(e){if(!e)return 0;const t=Number(e);if(Number.isFinite(t))return t<1e12?t*1e3:t;const n=Date.parse(e);return Number.isFinite(n)?n:0}function pSe(e){const t=dN(e);return t?new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(t)):"时间未知"}function mSe(e){return e.source!=="auto"||typeof e.score!="number"||!Number.isFinite(e.score)?"—":`${Math.round(e.score*100)} 分`}function gSe(e){return e==="high"?"高":e==="medium"?"中":"低"}const bSe={agent_structure:"Agent 结构",prompt:"提示词",tool:"工具",knowledge:"知识库",memory:"记忆",workflow:"工作流",other:"其他"};function ySe(e){var t;return e.module==="other"?((t=e.customModule)==null?void 0:t.trim())||"其他":bSe[e.module]}function xSe(e,t){return e.find(n=>n.kind===t)}function YL(e){return e.items.map(t=>({...t,tag:t.kind==="good"?"Good case":"Bad case"})).sort((t,n)=>dN(n.createdAt)-dN(t.createdAt))}function ESe(e){const t=n=>[n.name,n.description,n.agentType??"llm",n.modelName??"",n.tools??[],n.builtinTools??[],(n.customTools??[]).map(s=>s.name),(n.mcpTools??[]).map(s=>s.name),n.skills??[],(n.selectedSkills??[]).map(s=>s.name),(n.subAgents??[]).map(t)];return JSON.stringify(t(e))}const pp=[{phase:"prepare",label:"准备部署",description:"校验配置并创建部署任务"},{phase:"build",label:"构建镜像",description:"生成运行环境与智能体代码"},{phase:"deploy",label:"部署服务",description:"创建并启动 AgentKit Runtime"},{phase:"publish",label:"发布服务",description:"等待服务就绪并生成访问地址"},{phase:"complete",label:"部署完成",description:"智能体已可以正常使用"}],vSe={phase:"evaluation",label:"创建评测集",description:"自动创建 Good Case 和 Bad Case 评测集"};function wSe(e){return{phase:"update",label:"更新实例配置",description:`将 Runtime 实例数调整为 ${e.min}~${e.max}`}}const SSe=pp.findIndex(e=>e.phase==="build");function B$(e){const t=e.instanceRange?[...pp.slice(0,-1),wSe(e.instanceRange),pp[pp.length-1]]:pp;return e.createEvaluationSets?[...t.slice(0,-1),vSe,t[t.length-1]]:t}function U$(e){const t=B$(e);if(e.status==="success")return t.length-1;const n=e.phase??{准备部署:"prepare",构建镜像:"build",部署:"deploy",发布:"publish",创建评测集:"evaluation",部署完成:"complete"}[e.label],s=t.findIndex(i=>i.phase===n);return s<0?0:s}function _Se(e){if(!e)return"";try{return new Intl.DateTimeFormat("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(new Date(e))}catch{return""}}function NSe({task:e}){const t=e.buildLog,n=g.useRef(null),s=(t==null?void 0:t.status)!=="complete"&&(e.status==="running"||e.status==="error")&&U$(e)===SSe,[i,r]=g.useState(s),[a,l]=g.useState(!1),c=!!(t!=null&&t.text||t!=null&&t.error),u=(t==null?void 0:t.text)||(t==null?void 0:t.error)||"",d=u.split(` +\`\`\``}function gSe({visible:e}){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M2.8 12s3.3-5.4 9.2-5.4 9.2 5.4 9.2 5.4-3.3 5.4-9.2 5.4S2.8 12 2.8 12Z"}),o.jsx("circle",{cx:"12",cy:"12",r:"2.4"}),!e&&o.jsx("path",{d:"m4.2 4.2 15.6 15.6"})]})}function XL({available:e,authType:t,value:n,visible:s,loading:i,error:r,onToggle:a}){return e?t==="none"?"无需 API Key":t==="custom_jwt"?"使用 OAuth / JWT":t!=="key_auth"?"暂无":o.jsxs("span",{className:"aw-integration-secret",children:[o.jsx("span",{className:"aw-integration-secret-value","aria-live":"polite",children:s&&n?n:"****"}),o.jsx("button",{type:"button",className:"aw-integration-secret-toggle","aria-label":s?"隐藏 API Key":"显示 API Key",title:s?"隐藏 API Key":"显示 API Key",disabled:i,onClick:a,children:i?o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}):o.jsx(gSe,{visible:s})}),r&&o.jsx("span",{className:"aw-integration-secret-error",role:"alert",children:r})]}):"暂无"}function QL({protocol:e,title:t,available:n,fields:s,example:i}){return o.jsxs("section",{className:`aw-integration-panel${n&&i?" has-example":""}`,id:`integration-${e}-panel`,role:"tabpanel","aria-labelledby":`integration-${e}-tab`,children:[o.jsx("header",{children:o.jsx("h3",{children:t})}),o.jsx("dl",{children:s.map(r=>o.jsxs("div",{children:[o.jsx("dt",{children:r.label}),o.jsx("dd",{children:r.value||"暂无"})]},r.label))}),n&&i&&o.jsxs("section",{className:"aw-integration-example",children:[o.jsx("h4",{children:"Python 示例"}),o.jsx(oh,{text:i,className:"aw-integration-example-code",allowRawHtml:!1})]})]})}function U$(e){const t=e.tools??[],n=Nu.filter(i=>i.toolNames.some(r=>t.includes(r))),s=new Set(n.flatMap(i=>i.toolNames));return{...wi(),name:e.name,description:e.description,instruction:e.instruction||wi().instruction,agentType:e.type,modelName:e.model,tools:t.filter(i=>!s.has(i)),builtinTools:n.map(i=>i.id),skills:(e.skills??[]).map(i=>i.name),subAgents:(e.children??[]).map(U$)}}function bSe(e,t){var n;return e!=null&&e.draft?e.draft:e!=null&&e.graph?U$(e.graph):{...wi(),name:(e==null?void 0:e.name)||t,description:(e==null?void 0:e.description)||"暂无描述",agentType:(e==null?void 0:e.type)??"llm",modelName:e==null?void 0:e.model,tools:(e==null?void 0:e.tools)??[],skills:((n=e==null?void 0:e.skills)==null?void 0:n.map(s=>s.name))??[]}}function F$(e){return e?1+e.children.reduce((t,n)=>t+F$(n),0):1}function $$(e){return 1+e.subAgents.reduce((t,n)=>t+$$(n),0)}function mN(e){if(!e)return 0;const t=Number(e);if(Number.isFinite(t))return t<1e12?t*1e3:t;const n=Date.parse(e);return Number.isFinite(n)?n:0}function ySe(e){const t=mN(e);return t?new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(t)):"时间未知"}function xSe(e){return e.source!=="auto"||typeof e.score!="number"||!Number.isFinite(e.score)?"—":`${Math.round(e.score*100)} 分`}function ESe(e){return e==="high"?"高":e==="medium"?"中":"低"}const vSe={agent_structure:"Agent 结构",prompt:"提示词",tool:"工具",knowledge:"知识库",memory:"记忆",workflow:"工作流",other:"其他"};function wSe(e){var t;return e.module==="other"?((t=e.customModule)==null?void 0:t.trim())||"其他":vSe[e.module]}function SSe(e,t){return e.find(n=>n.kind===t)}function ZL(e){return e.items.map(t=>({...t,tag:t.kind==="good"?"Good case":"Bad case"})).sort((t,n)=>mN(n.createdAt)-mN(t.createdAt))}function _Se(e){const t=n=>[n.name,n.description,n.agentType??"llm",n.modelName??"",n.tools??[],n.builtinTools??[],(n.customTools??[]).map(s=>s.name),(n.mcpTools??[]).map(s=>s.name),n.skills??[],(n.selectedSkills??[]).map(s=>s.name),(n.subAgents??[]).map(t)];return JSON.stringify(t(e))}const hp=[{phase:"prepare",label:"准备部署",description:"校验配置并创建部署任务"},{phase:"build",label:"构建镜像",description:"生成运行环境与智能体代码"},{phase:"deploy",label:"部署服务",description:"创建并启动 AgentKit Runtime"},{phase:"publish",label:"发布服务",description:"等待服务就绪并生成访问地址"},{phase:"complete",label:"部署完成",description:"智能体已可以正常使用"}],NSe={phase:"evaluation",label:"创建评测集",description:"自动创建 Good Case 和 Bad Case 评测集"};function TSe(e){return{phase:"update",label:"更新实例配置",description:`将 Runtime 实例数调整为 ${e.min}~${e.max}`}}const kSe=hp.findIndex(e=>e.phase==="build");function H$(e){const t=e.instanceRange?[...hp.slice(0,-1),TSe(e.instanceRange),hp[hp.length-1]]:hp;return e.createEvaluationSets?[...t.slice(0,-1),NSe,t[t.length-1]]:t}function z$(e){const t=H$(e);if(e.status==="success")return t.length-1;const n=e.phase??{准备部署:"prepare",构建镜像:"build",部署:"deploy",发布:"publish",创建评测集:"evaluation",部署完成:"complete"}[e.label],s=t.findIndex(i=>i.phase===n);return s<0?0:s}function ASe(e){if(!e)return"";try{return new Intl.DateTimeFormat("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(new Date(e))}catch{return""}}function CSe({task:e}){const t=e.buildLog,n=g.useRef(null),s=(t==null?void 0:t.status)!=="complete"&&(e.status==="running"||e.status==="error")&&z$(e)===kSe,[i,r]=g.useState(s),[a,l]=g.useState(!1),c=!!(t!=null&&t.text||t!=null&&t.error),u=(t==null?void 0:t.text)||(t==null?void 0:t.error)||"",d=u.split(` `),f=i?u:d.slice(-36).join(` -`),h=(t==null?void 0:t.pendingMessage)||"正在等待构建日志…";if(g.useEffect(()=>{t&&r(s)},[e.id,t==null?void 0:t.status,s]),g.useEffect(()=>{if(!i||!c)return;const x=n.current;x&&(x.scrollTop=x.scrollHeight)},[i,c,f]),!t||!t.text&&t.status!=="error"&&!t.pendingMessage)return null;const p=_Se(t.updatedAt),m=t.status==="complete"?"已同步":t.status==="error"?"读取失败":"同步中",b=t.omittedEarly?"已省略早期日志":t.snapshotTruncated?"仅显示最近的构建日志":t.truncated?"已省略部分日志":"",v=[m,t.lineCount?`${t.lineCount} 行`:"",b,p].filter(Boolean).join(" · ");async function y(){try{await navigator.clipboard.writeText(u),l(!0),window.setTimeout(()=>l(!1),1500)}catch{l(!1)}}return o.jsxs("section",{className:`aw-deploy-log is-${t.status}${i?"":" is-collapsed"}`,"aria-label":"构建日志",children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("strong",{children:"构建日志"}),o.jsx("span",{children:v})]}),o.jsxs("div",{className:"aw-deploy-log-actions",children:[c&&o.jsx("button",{type:"button",onClick:()=>r(x=>!x),children:i?"收起":"展开"}),c&&o.jsxs("button",{type:"button",onClick:()=>void y(),"aria-label":a?"已复制构建日志":"复制构建日志",title:a?"已复制":"复制构建日志",children:[a?o.jsx(Ra,{"aria-hidden":!0}):o.jsx(Zx,{"aria-hidden":!0}),o.jsx("span",{children:a?"已复制":"复制"})]})]})]}),i&&(c?o.jsx("pre",{ref:n,children:f}):o.jsx("div",{className:"aw-deploy-log-empty",children:h}))]})}function TSe({task:e}){const t=B$(e),n=U$(e),s=e.status==="success"?100:Math.max(6,Math.min(100,e.pct??6)),i=e.status==="running"?"正在部署":e.status==="success"?"部署完成":e.status==="error"?"部署失败":"部署已取消";return o.jsxs("section",{className:`aw-deploy-progress-card is-${e.status}`,"aria-live":"polite",children:[o.jsxs("div",{className:"aw-deploy-progress-head",children:[o.jsxs("div",{children:[o.jsx("span",{className:"aw-deploy-progress-icon","aria-hidden":!0,children:e.status==="running"?o.jsx(mn,{className:"spin"}):e.status==="success"?o.jsx(YJ,{}):e.status==="error"?o.jsx(Sk,{}):o.jsx(bR,{})}),o.jsxs("div",{children:[o.jsx("h3",{children:i}),o.jsx("p",{children:e.runtimeName})]})]}),o.jsx("strong",{children:e.status==="running"?`${Math.round(s)}%`:e.label})]}),o.jsx("div",{className:"aw-deploy-progress-track",role:"progressbar","aria-label":"部署进度","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(s),children:o.jsx("span",{style:{width:`${s}%`}})}),o.jsx("ol",{className:"aw-deploy-steps",children:t.map((r,a)=>{const l=e.status==="success"||anew Set),[Hn,ut]=g.useState(()=>new Set),[pt,gn]=g.useState(!1),[en,St]=g.useState(""),[an,ls]=g.useState(null),[Rs,Rn]=g.useState([]),[Wn,bn]=g.useState([]),[yn,Xn]=g.useState(!1),[zs,pi]=g.useState(""),[bs,Js]=g.useState(0),[On,cs]=g.useState([]),[Qn,us]=g.useState(!1),[Os,Ms]=g.useState(""),[Ss,_s]=g.useState(0),[un,on]=g.useState(!1),[dn,ce]=g.useState(()=>new Set),[Ie,Ue]=g.useState(!1),[nt,at]=g.useState(""),[We,_t]=g.useState(""),[De,xn]=g.useState(()=>new Set),Zn=g.useRef(!1),ki=g.useRef(""),zn=g.useRef(null),Ht=g.useRef(0),Nt=g.useRef(0),[En,Vn]=g.useState(lSe),[Pa,Ba]=g.useState("");g.useEffect(()=>{e.length!==0&&Vn(H=>H.map((oe,he)=>he===0&&oe.agentIds.length===0?{...oe,agentIds:e.slice(0,2).map(Ce=>Ce.id)}:oe))},[e]);const Ui=g.useMemo(()=>{const H=new Map;for(const oe of e)oe.runtimeId&&H.set(oe.runtimeId,oe);return H},[e]),Mr=g.useMemo(()=>{var oe;const H=new Map;for(const he of t){const Ce=(oe=he.deploymentTarget)==null?void 0:oe.runtimeId;if(!Ce||!Ui.has(Ce))continue;const st=H.get(Ce);(!st||he.updatedAt>st.updatedAt)&&H.set(Ce,he)}return H},[Ui,t]),ca=g.useMemo(()=>{const H=new Map;for(const oe of d){if(!oe.runtimeId)continue;const he=H.get(oe.runtimeId);(!he||oe.startedAt>he.startedAt)&&H.set(oe.runtimeId,oe)}return H},[d]),cc=g.useMemo(()=>{const H=Fe.trim().toLowerCase();return H?e.filter(oe=>{const he=oe.runtimeId?Mr.get(oe.runtimeId):void 0,Ce=oe.runtimeId?ca.get(oe.runtimeId):void 0;return[oe.label,oe.app,oe.host??"",(he==null?void 0:he.draft.name)??"",(he==null?void 0:he.draft.description)??"",(Ce==null?void 0:Ce.runtimeName)??""].join(" ").toLowerCase().includes(H)}):e},[e,ca,Fe,Mr]),Mn=g.useMemo(()=>{const H=Fe.trim().toLowerCase();return t.filter(oe=>{var Ce;const he=(Ce=oe.deploymentTarget)==null?void 0:Ce.runtimeId;return he&&Ui.has(he)?!1:H?`${oe.draft.name} ${oe.draft.description}`.toLowerCase().includes(H):!0})},[Ui,t,Fe]),uo=g.useMemo(()=>t.filter(H=>{var he;const oe=(he=H.deploymentTarget)==null?void 0:he.runtimeId;return!oe||!Ui.has(oe)}).length,[Ui,t]),uc=g.useMemo(()=>{const H=Fe.trim().toLowerCase();return H?En.filter(oe=>oe.name.toLowerCase().includes(H)):En},[En,Fe]),ie=e.find(H=>H.id===A),Zt=t.find(H=>H.id===P),Ln=f?d.find(H=>H.id===f):void 0,Ns=ie!=null&&ie.runtimeId?Mr.get(ie.runtimeId):void 0,Wt=v?Z:A&&i===A?s:null,Jn=(Wt==null?void 0:Wt.appName)||(ie==null?void 0:ie.runtimeApp)||(ie==null?void 0:ie.app)||"",se=`${(ie==null?void 0:ie.region)??"cn-beijing"}:${(ie==null?void 0:ie.runtimeId)??""}`,Te=(de==null?void 0:de.requestKey)===se?de.value:"",pe=(J==null?void 0:J.requestKey)===se?J:null,et=!!((As=pe==null?void 0:pe.apiApps)!=null&&As.length),pn=!!(pe!=null&&pe.a2a),Gn=((Sh=pe==null?void 0:pe.apiApps)==null?void 0:Sh[0])??Jn,Tt=(R==null?void 0:R.endpoint)??"",ys=cSe(((Dn=pe==null?void 0:pe.a2a)==null?void 0:Dn.endpoint)??"",Tt),Ts=JSON.stringify([(ie==null?void 0:ie.runtimeId)??"",(ie==null?void 0:ie.region)??""]),tn=(Le==null?void 0:Le.requestKey)===Ts?Le.value:null;g.useEffect(()=>{const H=Ht.current+1;Ht.current=H,Ve(null),qe("");const oe=(ie==null?void 0:ie.runtimeId)??"",he=(ie==null?void 0:ie.region)??"";if(!l||!oe||!he){He(!1);return}const Ce=new AbortController;return He(!0),l8({runtimeId:oe,region:he,signal:Ce.signal}).then(st=>{var yt;if(H===Ht.current){if(st.runtime.runtimeId!==oe||st.runtime.region!==he||st.canUpdate&&!((yt=st.agent)!=null&&yt.appName)){qe("Runtime 更新能力响应与当前选择不匹配。");return}Ve({requestKey:Ts,value:st})}}).catch(st=>{H!==Ht.current||Ce.signal.aborted||qe(st instanceof Error?st.message:"检查 Runtime 更新能力失败。")}).finally(()=>{H===Ht.current&&!Ce.signal.aborted&&He(!1)}),()=>Ce.abort()},[l,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeId,Ts]);const ln=g.useMemo(()=>{const H=new Map(e.map((he,Ce)=>[he.id,Ce])),oe=new Map(n.map((he,Ce)=>[he,Ce]));return[...cc].sort((he,Ce)=>{const st=he.runtimeId?ca.get(he.runtimeId):void 0,yt=Ce.runtimeId?ca.get(Ce.runtimeId):void 0,Mt=(st==null?void 0:st.status)==="running"?st.startedAt:0,gi=(yt==null?void 0:yt.status)==="running"?yt.startedAt:0;if(Mt!==gi)return gi-Mt;const Lt=oe.get(he.id),Pr=oe.get(Ce.id);return Lt!=null&&Pr!=null?Lt-Pr:Lt!=null?-1:Pr!=null?1:(H.get(he.id)??0)-(H.get(Ce.id)??0)})},[n,e,cc,ca]),ks=(ie==null?void 0:ie.label)||(Wt==null?void 0:Wt.name)||(Zt==null?void 0:Zt.draft.name)||(Ln==null?void 0:Ln.runtimeName)||"未选择智能体",Xi=En.find(H=>H.id===Pa),Lr=ln.filter(H=>H.canDelete===!0),Ou=ln.filter(H=>xt.has(H.id)&&H.canDelete===!0),Mu=Mn.filter(H=>Hn.has(H.id)),$g=Lr.length+Mn.length,dc=Ou.length+Mu.length,mi=g.useMemo(()=>(Ln==null?void 0:Ln.agentDraft)??(Zt==null?void 0:Zt.draft)??(Ns==null?void 0:Ns.draft)??hSe(Wt,(ie==null?void 0:ie.label)??"agent"),[Wt,ie==null?void 0:ie.label,Ns==null?void 0:Ns.draft,Zt==null?void 0:Zt.draft,Ln==null?void 0:Ln.agentDraft]),hr=Zt?a?"":"当前账号没有新建 Agent 的权限。":l?ie!=null&&ie.runtimeId?ie.region?_e?"正在检查 Runtime 更新能力…":Pe||(tn?tn.canUpdate?(Jg=tn.agent)!=null&&Jg.appName?"":"Runtime 更新能力响应缺少智能体信息。":tn.reason||"当前 Runtime 不支持原地更新。":"尚未完成 Runtime 更新能力检查。"):"Runtime 缺少地域信息,无法更新。":"仅支持更新已部署的云端智能体。":"当前账号没有管理 Agent 的权限。",fc="aw-update-disabled-reason",cE=tn!=null&&tn.agent?{runtimeId:tn.runtime.runtimeId,name:tn.runtime.name,region:tn.runtime.region,appName:tn.agent.appName,currentVersion:tn.runtime.currentVersion}:Ns==null?void 0:Ns.deploymentTarget,mh=g.useMemo(()=>{if(Wt)return Wt.tools;const H=(mi.builtinTools??[]).map(oe=>{var he;return((he=_u.find(Ce=>Ce.id===oe))==null?void 0:he.label)??oe});return Array.from(new Set([...mi.tools,...H,...(mi.customTools??[]).map(oe=>oe.name),...(mi.mcpTools??[]).map(oe=>oe.name)].filter(Boolean)))},[mi,Wt]),gh=g.useMemo(()=>Wt?Wt.skillsPreviewSupported?Wt.skills.map(H=>H.name):null:Array.from(new Set([...(mi.selectedSkills??[]).map(H=>H.name),...mi.skills].filter(Boolean))),[mi,Wt]),Vs=g.useMemo(()=>{if(Ln)return Ln;if(Zt)return d.filter(H=>{var oe,he;return((oe=H.agentDraft)==null?void 0:oe.name)===Zt.draft.name||H.runtimeName===Zt.draft.name||!!((he=Zt.deploymentTarget)!=null&&he.runtimeId)&&H.runtimeId===Zt.deploymentTarget.runtimeId}).sort((H,oe)=>oe.startedAt-H.startedAt)[0];if(ie)return d.filter(H=>!!ie.runtimeId&&H.runtimeId===ie.runtimeId||H.runtimeName===ie.label).sort((H,oe)=>oe.startedAt-H.startedAt)[0]},[d,ie,Zt,Ln]),uE=!!(f&&Vs&&Vs.id===f),Hg=!!(Vs&&(Vs.status!=="success"||uE)),zg=g.useMemo(()=>ESe(mi),[mi]),Dr=(ie==null?void 0:ie.currentVersion)??(R==null?void 0:R.currentVersion)??null,dE=Dr??(Ln==null?void 0:Ln.startedAt)??"unknown",Vg=Wt?`runtime:${(ie==null?void 0:ie.runtimeId)??Wt.name}:v${dE}:${zg}`:`draft:${(Ln==null?void 0:Ln.id)??(Zt==null?void 0:Zt.id)??(ie==null?void 0:ie.id)??ks}:${zg}`;g.useEffect(()=>{if(!f)return;const H=d.find(he=>he.id===f),oe=H!=null&&H.runtimeId?Ui.get(H.runtimeId):void 0;if(oe){$(""),O(oe.id),F("basic");return}O(""),$(""),F("basic")},[Ui,d,f]),g.useEffect(()=>{if(!h){ki.current="";return}const H=`${h}:${p}:${m}`;ki.current!==H&&e.some(oe=>oe.id===h)&&(ki.current=H,$(""),O(h),F(p),p==="evaluations"&&(dt(m),Ut("")))},[e,h,p,m]),g.useEffect(()=>{for(const H of ln.slice(0,8)){if(!H.runtimeId)continue;const oe=H.region??"cn-beijing";u8(H.runtimeId,oe),WB(H.runtimeId,oe,H.runtimeApp??""),Vy(H.runtimeId,oe,H.runtimeApp??"").then(he=>{const Ce=he.appName||H.app;Ce&&h_({runtimeId:H.runtimeId??"",region:oe,appName:Ce,pageSize:100})}).catch(()=>{})}},[ln]),g.useEffect(()=>{!(ie!=null&&ie.runtimeId)||!Jn||h_({runtimeId:ie.runtimeId,region:ie.region??"cn-beijing",appName:Jn,pageSize:100})},[Jn,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{let H=!1;const oe=(ie==null?void 0:ie.runtimeId)??"",he=(ie==null?void 0:ie.region)??"cn-beijing",Ce=(ie==null?void 0:ie.runtimeApp)??"",st=oe?YB(oe,he,Ce):null;if(ae(st),be(!!st||!v||!oe),!(!v||!oe))return Vy(oe,he,Ce,{force:!0}).then(yt=>{H||ae(yt)}).catch(()=>{!H&&!st&&ae(null)}).finally(()=>{H||be(!0)}),()=>{H=!0}},[v,ie==null?void 0:ie.currentVersion,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeApp,ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{let H=!1;const oe=(ie==null?void 0:ie.runtimeId)??"",he=(ie==null?void 0:ie.region)??"cn-beijing";if(cs([]),Ms(""),D!=="optimizations"||!oe){us(!1);return}if(v&&!Jn){us(!ne);return}return us(!0),MB({runtimeId:oe,region:he,appName:Jn}).then(Ce=>{H||cs(Ce.groups)}).catch(Ce=>{H||Ms(Ce instanceof Error?Ce.message:String(Ce))}).finally(()=>{H||us(!1)}),()=>{H=!0}},[ne,v,Ss,D,Jn,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{Nt.current+=1,ge(null),ve(!1),ke(!1),Je(""),Se("api-server")},[se,D]);function hc(){Nt.current+=1,ge(null),ve(!1),ke(!1),Je("")}function Gg(H){H!==me&&(hc(),Se(H))}async function fo(){if(Me){hc();return}const H=(ie==null?void 0:ie.runtimeId)??"",oe=(ie==null?void 0:ie.region)??"cn-beijing";if(!H)return;const he=Nt.current+1;Nt.current=he,ke(!0),Je("");try{const Ce=await a8(H,oe);if(he!==Nt.current)return;ge({requestKey:se,value:Ce}),ve(!0)}catch(Ce){if(he!==Nt.current)return;ge(null),ve(!1),Je(Ce instanceof Error?Ce.message:"读取 Runtime API Key 失败。")}finally{he===Nt.current&&ke(!1)}}g.useEffect(()=>{let H=!1;const oe=(ie==null?void 0:ie.runtimeId)??"",he=(ie==null?void 0:ie.region)??"cn-beijing",Ce=oe?c8(oe,he):null;if(Y(Ce),!!oe)return Hk(oe,he,{force:!0}).then(st=>{H||Y(st)}).catch(()=>{!H&&!Ce&&Y(null)}),()=>{H=!0}},[ie==null?void 0:ie.currentVersion,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{let H=!1;const oe=(ie==null?void 0:ie.runtimeId)??"",he=(ie==null?void 0:ie.region)??"cn-beijing",Ce=`${he}:${oe}`;if(W(""),D!=="integrations"||!oe){K(!1),oe||U(null);return}K(!0);const st=$k(oe,he,{retryProbe:!0}).catch(yt=>{if(yt instanceof Sr&&yt.unsupported)return null;throw yt});return Promise.all([st,r8(oe,he,{retryProbe:!0})]).then(([yt,Mt])=>{H||U({requestKey:Ce,apiApps:yt,a2a:Mt})}).catch(yt=>{H||(U(null),W(yt instanceof Error?yt.message:"探测集成方式失败。"))}).finally(()=>{H||K(!1)}),()=>{H=!0}},[q,D,ie==null?void 0:ie.currentVersion,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{let H=!1;const oe=(ie==null?void 0:ie.runtimeId)??"",he=(ie==null?void 0:ie.region)??"cn-beijing",Ce=oe&&Jn?LB({runtimeId:oe,region:he,appName:Jn,pageSize:100}):null;if(Rn(Ce?YL(Ce):[]),bn((Ce==null?void 0:Ce.sets)??[]),pi(""),D!=="evaluations"||!oe){Xn(!1);return}if(v&&!Jn){Xn(!ne);return}return Xn(!Ce),r1({runtimeId:oe,region:he,appName:Jn,pageSize:100},{force:!0}).then(st=>{H||(bn(st.sets),Rn(YL(st)))}).catch(st=>{H||pi(st instanceof Error?st.message:String(st))}).finally(()=>{H||Xn(!1)}),()=>{H=!0}},[ne,v,bs,D,Jn,Wt==null?void 0:Wt.appName,ie==null?void 0:ie.region,ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{const H=new Set(Rs.map(oe=>oe.id));ce(oe=>{const he=new Set([...oe].filter(Ce=>H.has(Ce)));return he.size===oe.size?oe:he}),xn(oe=>{const he=new Set([...oe].filter(Ce=>H.has(Ce)));return he.size===oe.size?oe:he}),We&&!H.has(We)&&_t("")},[Rs,We]),g.useEffect(()=>{on(!1),ce(new Set),xn(new Set),at(""),_t("")},[ie==null?void 0:ie.runtimeId]),g.useEffect(()=>{const H=new Set(ln.filter(oe=>oe.canDelete===!0).map(oe=>oe.id));rn(oe=>{const he=new Set([...oe].filter(Ce=>H.has(Ce)));return he.size===oe.size?oe:he})},[ln]),g.useEffect(()=>{const H=new Set(Mn.map(oe=>oe.id));ut(oe=>{const he=new Set([...oe].filter(Ce=>H.has(Ce)));return he.size===oe.size?oe:he})},[Mn]);const tl=g.useMemo(()=>!b||!(ie!=null&&ie.runtimeId)||b.runtimeId!==ie.runtimeId||Jn&&b.agentName&&b.agentName!==Jn?null:{...b,tag:b.kind==="good"?"Good case":"Bad case"},[b,ie==null?void 0:ie.runtimeId,Jn]),Tn=g.useMemo(()=>ie!=null&&ie.runtimeId?tl?[tl,...Rs.filter(H=>H.id!==tl.id&&(!H.messageId||H.messageId!==tl.messageId))]:Rs:oSe,[Rs,tl,ie==null?void 0:ie.runtimeId]),nl=Tn.filter(H=>{if(H.kind!==bt||(H.source==="auto"?"auto":"user")!==wt)return!1;const he=cn.trim().toLowerCase();return he?[H.input,H.output,H.referenceOutput,H.comment,H.tag??"",H.sessionId,H.messageId,H.userId,H.evaluationSetName].join(" ").toLowerCase().includes(he):!0}),bh=nl.filter(H=>dn.has(H.id)),Kg=!!(ie!=null&&ie.runtimeId),Fi=H=>{dt(H),Ut(""),at("");const oe=Tn.find(he=>he.kind===H);_t((oe==null?void 0:oe.id)??""),window.setTimeout(()=>{var he;(he=zn.current)==null||he.scrollIntoView({behavior:"smooth",block:"start"})},0)},qg=H=>{at(""),ce(oe=>{const he=new Set(oe);return he.has(H.id)?he.delete(H.id):he.add(H.id),he})},yh=()=>{at(""),ce(new Set(nl.map(H=>H.id)))},fE=()=>{at(""),ce(new Set),on(!1)},hE=H=>{xn(oe=>{const he=new Set(oe);return he.has(H)?he.delete(H):he.add(H),he})},xh=H=>{_t(H.id),at(""),!(!H.sessionId||!H.messageId)&&(k==null||k(H))},Lu=async H=>{if(!(ie!=null&&ie.runtimeId)||!Jn||Ie||H.length===0)return;const oe=H.length===1?"确定删除这条反馈案例?原始聊天记录不会被删除。":`确定删除选中的 ${H.length} 条反馈案例?原始聊天记录不会被删除。`;if(!window.confirm(oe))return;const he=H.map(st=>st.id),Ce=new Set(he);Ue(!0),at("");try{await BB({runtimeId:ie.runtimeId,region:ie.region??"cn-beijing",appName:Jn,itemIds:he});const st=new Map;for(const yt of H)st.set(yt.kind,(st.get(yt.kind)??0)+1);Rn(yt=>yt.filter(Mt=>!Ce.has(Mt.id))),bn(yt=>yt.map(Mt=>({...Mt,itemCount:Math.max(0,Mt.itemCount-(st.get(Mt.kind)??0))}))),ce(yt=>new Set([...yt].filter(Mt=>!Ce.has(Mt)))),xn(yt=>new Set([...yt].filter(Mt=>!Ce.has(Mt)))),We&&Ce.has(We)&&_t(""),H.length>1&&on(!1),T==null||T(H)}catch(st){at(st instanceof Error?st.message:String(st))}finally{Ue(!1)}},Du=H=>{Vn(oe=>oe.map(he=>he.id===H.id?H:he))},Yg=()=>{const H=new Set(e.map(Ce=>Ce.id)),oe=n.filter(Ce=>H.has(Ce)),he=new Set(oe);return[...oe,...e.filter(Ce=>!he.has(Ce.id)).map(Ce=>Ce.id)]},Wg=(H,oe,he)=>{if(!x||H===oe)return;const Ce=Yg().filter(Mt=>Mt!==H),st=Ce.indexOf(oe),yt=st<0?Ce.length:he==="after"?st+1:st;Ce.splice(yt,0,H),x(Ce)},Ua=(H,oe)=>{if(!Ge||Ge===oe)return;const he=H.currentTarget.getBoundingClientRect();ct(oe),vt(H.clientY>he.top+he.height/2?"after":"before")},Ft=(H,oe)=>{if(!x)return;const he=Yg(),Ce=he.indexOf(H),st=Math.max(0,Math.min(he.length-1,Ce+oe));Ce<0||Ce===st||(he.splice(Ce,1),he.splice(st,0,H),x(he))},Xg=H=>{H.canDelete===!0&&(St(""),rn(oe=>{const he=new Set(oe);return he.has(H.id)?he.delete(H.id):he.add(H.id),he}))},Qg=H=>{St(""),ut(oe=>{const he=new Set(oe);return he.has(H.id)?he.delete(H.id):he.add(H.id),he})},pE=()=>{St(""),rn(new Set(Lr.map(H=>H.id))),ut(new Set(Mn.map(H=>H.id)))},Eh=()=>{St(""),rn(new Set),ut(new Set),Ze(!1)},vh=()=>{if(dc===0||pt)return;const H=Ou.length,oe=Mu.length;St(""),ls({kind:"selection",title:H===1&&oe===0?"删除 Agent?":H===0&&oe===1?"删除草稿?":"删除所选项目?",description:H===1&&oe===0?`"${Ou[0].label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`:H===0&&oe===1?`"${Mu[0].draft.name||"未命名 Agent"}" 将从本地草稿中删除。`:`将删除选中的 ${dc} 个项目。${H>0?`${H} 个云端 Runtime 将被永久删除,此操作不可撤销。`:"草稿删除后无法恢复。"}`,confirmLabel:H===0&&oe===1?"删除草稿":"删除所选",agents:Ou,drafts:Mu})},mE=async()=>{if(!(!an||pt)){gn(!0),St("");try{if(an.kind==="selection"){const{agents:H,drafts:oe}=an;if(H.length>0){if(!E)throw new Error("当前页面不支持删除已部署 Agent。");await E(H)}oe.length>0&&(w==null||w(oe)),rn(new Set),ut(new Set),Ze(!1),H.some(he=>he.id===A)&&O(""),oe.some(he=>he.id===P)&&$("")}else if(an.kind==="agent"){if(!E)throw new Error("当前页面不支持删除已部署 Agent。");await E([an.agent]),A===an.agent.id&&O("")}else{if(!w)throw new Error("当前页面不支持删除草稿。");w([an.draft]),P===an.draft.id&&$("")}ls(null)}catch(H){St(H instanceof Error?H.message:String(H))}finally{gn(!1)}}},gE=H=>{!E||H.canDelete!==!0||pt||(St(""),ls({kind:"agent",title:"删除 Agent?",description:`"${H.label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`,confirmLabel:"删除 Agent",agent:H}))},wh=H=>{if(!w||pt)return;const oe=H.draft.name||"未命名 Agent";St(""),ls({kind:"draft",title:"删除草稿?",description:`"${oe}" 将从本地草稿中删除。`,confirmLabel:"删除草稿",draft:H})},ai=()=>{const H=`eval-${Date.now()}`,oe={id:H,name:`新评测组 ${En.length+1}`,agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量"],concurrency:"4",history:[]};Vn(he=>[oe,...he]),Ba(H)},Zg=H=>{Du({...H,history:[{id:`run-${Date.now()}`,createdAt:"刚刚",score:86+H.history.length%7,status:"completed"},...H.history]})};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`aw-root${v?" is-detail-only":""}`,children:[o.jsxs("nav",{className:"aw-view-tabs","aria-label":"智能体工作台",children:[o.jsx("button",{type:"button",className:L==="library"?"is-active":"","aria-pressed":L==="library",onClick:()=>{z("library"),Ke("")},children:"智能体库"}),o.jsx("button",{type:"button",className:L==="evaluation"?"is-active":"","aria-pressed":L==="evaluation",onClick:()=>{z("evaluation"),Ke("")},children:"评测"})]}),o.jsxs("div",{className:"aw-workspace-frame",children:[o.jsxs("div",{className:"aw-workspace","aria-hidden":L==="evaluation"||void 0,ref:H=>{H==null||H.toggleAttribute("inert",L==="evaluation")},children:[o.jsxs("aside",{className:"aw-sidebar","aria-label":L==="library"?"智能体列表":"评测组列表",children:[o.jsxs("label",{className:"aw-search",children:[o.jsx(By,{"aria-hidden":!0}),o.jsx("input",{value:Fe,onChange:H=>Ke(H.currentTarget.value),placeholder:L==="library"?"搜索智能体":"搜索评测组","aria-label":L==="library"?"搜索智能体":"搜索评测组"})]}),o.jsxs("button",{type:"button",className:"aw-create-card",onClick:L==="library"?C:ai,disabled:L==="library"&&!a,children:[o.jsx(_i,{"aria-hidden":!0}),o.jsx("span",{children:L==="library"?"新建 Agent":"新建评测组"})]}),L==="library"&&(E||w)&&o.jsx("div",{className:`aw-selection-toolbar${ye?" is-active":""}`,children:ye?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"aw-selection-count",children:["已选 ",dc," 个"]}),o.jsx("button",{type:"button",onClick:pE,disabled:$g===0||pt,children:"全选"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void vh(),disabled:dc===0||pt,children:pt?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:Eh,disabled:pt,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{St(""),Ze(!0)},disabled:$g===0,children:"选择"})}),L==="library"&&en&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:en}),o.jsx("div",{className:"aw-agent-list",children:L==="evaluation"?uc.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的评测组"}):uc.map(H=>o.jsxs("button",{type:"button",className:`aw-agent-item${H.id===Pa?" is-active":""}`,onClick:()=>Ba(H.id),children:[o.jsxs("span",{className:"aw-agent-copy aw-eval-group-copy",children:[o.jsx("strong",{children:H.name}),o.jsxs("small",{children:[H.agentIds.length," 个智能体 · ",H.history.length," 次运行"]})]}),o.jsx(Pp,{"aria-hidden":!0})]},H.id)):c&&ln.length===0&&Mn.length===0?o.jsx("div",{className:"aw-list-empty",children:"正在读取云端智能体…"}):u&&ln.length===0&&Mn.length===0?o.jsxs("div",{className:"aw-list-empty aw-list-error",children:[o.jsx("span",{children:u}),y&&o.jsx("button",{type:"button",onClick:y,children:"重试"})]}):ln.length===0&&Mn.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的智能体"}):o.jsxs(o.Fragment,{children:[Mn.map(H=>{const oe=d.filter(Ce=>{var st,yt;return((st=Ce.agentDraft)==null?void 0:st.name)===H.draft.name||Ce.runtimeName===H.draft.name||!!((yt=H.deploymentTarget)!=null&&yt.runtimeId)&&Ce.runtimeId===H.deploymentTarget.runtimeId}).sort((Ce,st)=>st.startedAt-Ce.startedAt)[0],he=Hn.has(H.id);return o.jsxs("button",{type:"button",className:["aw-agent-item",ye?"is-selecting":"",he?"is-selected-for-delete":"",H.id===P?"is-active":""].filter(Boolean).join(" "),"aria-pressed":ye?he:void 0,onClick:()=>{if(ye){Qg(H);return}O(""),$(H.id),F("basic")},children:[ye&&o.jsx("span",{className:`aw-select-marker${he?" is-checked":""}`,"aria-hidden":"true"}),o.jsxs("span",{className:"aw-agent-copy",children:[o.jsxs("span",{className:"aw-agent-name-row",children:[o.jsx("strong",{children:H.draft.name||"未命名 Agent"}),o.jsx("span",{className:`aw-draft-badge${(oe==null?void 0:oe.status)==="running"?" is-deploying":""}`,children:(oe==null?void 0:oe.status)==="running"?"部署中":"草稿"})]}),o.jsx("small",{children:H.deploymentTarget?"待更新":"尚未发布"})]}),o.jsx(Pp,{"aria-hidden":!0})]},H.id)}),ln.map(H=>{const oe=H.runtimeId?ca.get(H.runtimeId):void 0,he=H.runtimeId?Mr.get(H.runtimeId):void 0,Ce=xt.has(H.id),st=H.canDelete===!0,yt=(oe==null?void 0:oe.status)==="running"?{label:"部署中",className:" is-deploying"}:(oe==null?void 0:oe.status)==="error"?{label:"失败",className:" is-error"}:(oe==null?void 0:oe.status)==="cancelled"?{label:"已取消",className:" is-muted"}:he?{label:"待更新",className:""}:null,Mt=(oe==null?void 0:oe.status)==="running"?"正在更新部署":he?"待更新":H.remote?H.host||"远程智能体":"本地智能体",gi=["aw-agent-item","aw-agent-item--sortable",H.id===A?"is-active":"",ye?"is-selecting":"",Ce?"is-selected-for-delete":"",ye&&!st?"is-selection-disabled":"",H.id===Ge?"is-dragging":"",H.id===it&&H.id!==Ge?`is-drop-target is-drop-${Qe}`:""].filter(Boolean).join(" ");return o.jsxs("button",{type:"button",draggable:!!x&&!ye,className:gi,"aria-pressed":ye?Ce:void 0,"aria-keyshortcuts":x?"Alt+ArrowUp Alt+ArrowDown":void 0,onDragStart:Lt=>{x&&(Zn.current=!0,Yt(H.id),Lt.dataTransfer.effectAllowed="move",Lt.dataTransfer.setData("text/plain",H.id))},onDragEnter:Lt=>{Ua(Lt,H.id)},onDragOver:Lt=>{!Ge||Ge===H.id||(Lt.preventDefault(),Lt.dataTransfer.dropEffect="move",Ua(Lt,H.id))},onDragLeave:Lt=>{const Pr=Lt.relatedTarget;Pr instanceof Node&&Lt.currentTarget.contains(Pr)||it===H.id&&ct("")},onDrop:Lt=>{Lt.preventDefault();const Pr=Lt.dataTransfer.getData("text/plain")||Ge;Wg(Pr,H.id,Qe),Yt(""),ct(""),vt("before")},onDragEnd:()=>{Yt(""),ct(""),vt("before"),window.setTimeout(()=>{Zn.current=!1},0)},onKeyDown:Lt=>{Lt.altKey&&(Lt.key==="ArrowUp"?(Lt.preventDefault(),Ft(H.id,-1)):Lt.key==="ArrowDown"&&(Lt.preventDefault(),Ft(H.id,1)))},onClick:Lt=>{if(ye){Lt.preventDefault(),Xg(H);return}if(Zn.current){Lt.preventDefault(),Zn.current=!1;return}$(""),O(H.id),F("basic"),_(H.id)},children:[ye&&o.jsx("span",{className:`aw-select-marker${Ce?" is-checked":""}`,"aria-hidden":"true"}),o.jsxs("span",{className:"aw-agent-copy",children:[o.jsxs("span",{className:"aw-agent-name-row",children:[o.jsx("strong",{children:H.label}),H.currentVersion!=null&&o.jsxs("span",{className:"aw-version-badge",children:["v",H.currentVersion]}),yt&&o.jsx("span",{className:`aw-draft-badge${yt.className}`,children:yt.label})]}),o.jsx("small",{children:Mt})]}),o.jsx(Pp,{"aria-hidden":!0})]},H.id)})]})}),o.jsxs("div",{className:"aw-list-count",children:["共 ",L==="library"?e.length+uo:En.length," 个"]})]}),L==="evaluation"&&Xi?o.jsx(jSe,{group:Xi,agents:e,cases:Tn,onChange:Du,onRun:Zg}):L==="evaluation"?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择评测组"})}):!ie&&!Zt&&!Ln?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择智能体"})}):o.jsxs("main",{className:"aw-main",children:[ie&&!Wt&&r&&o.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"aw-detail-loading-card",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:"正在加载智能体"}),o.jsx("small",{children:"正在读取配置与运行信息…"})]})]})}),D==="integrations"&&te&&o.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"aw-detail-loading-card",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:"正在探测接入方式"}),o.jsx("small",{children:"正在确认 API Server 与 A2A…"})]})]})}),o.jsxs("div",{className:"aw-agent-head",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"aw-agent-title-row",children:[o.jsx("h2",{children:ks}),Dr!=null&&o.jsxs("span",{children:["v",Dr]}),Zt&&o.jsx("span",{children:"草稿"}),Ns&&o.jsx("span",{children:"待更新"}),!ie&&!Zt&&Ln&&o.jsx("span",{children:Ln.label})]}),o.jsx("p",{children:mi.description||(r||v&&!ne?"正在读取智能体信息…":"暂无描述")})]}),(Zt||Ns||(ie==null?void 0:ie.canDelete))&&o.jsxs("div",{className:"aw-head-actions",children:[(Zt||Ns)&&o.jsxs("button",{type:"button",className:"aw-head-delete aw-head-delete--draft",onClick:()=>{const H=Zt??Ns;H&&wh(H)},disabled:pt,"aria-label":"删除草稿",title:"删除草稿",children:[o.jsx(Zl,{"aria-hidden":!0}),o.jsx("span",{children:"删除草稿"})]}),(ie==null?void 0:ie.canDelete)&&o.jsxs("button",{type:"button",className:"aw-head-delete",onClick:()=>void gE(ie),disabled:pt,"aria-label":"删除 Agent",title:"删除 Agent",children:[o.jsx(Zl,{"aria-hidden":!0}),o.jsx("span",{children:pt?"删除中…":"删除 Agent"})]})]})]}),Vs&&Hg&&o.jsx("div",{className:"aw-detail-deployment",children:o.jsx(TSe,{task:Vs})}),o.jsx("nav",{className:"aw-agent-tabs","aria-label":"智能体详情",role:"tablist",children:Yu.map(H=>o.jsx("button",{type:"button",id:`agent-${H.id}-tab`,className:D===H.id?"is-active":"",role:"tab","aria-selected":D===H.id,"aria-controls":`agent-${H.id}-panel`,tabIndex:D===H.id?0:-1,onClick:()=>F(H.id),onKeyDown:oe=>{var yt;if(!["ArrowLeft","ArrowRight","Home","End"].includes(oe.key))return;oe.preventDefault();const he=Yu.findIndex(Mt=>Mt.id===H.id),Ce=oe.key==="Home"?0:oe.key==="End"?Yu.length-1:(he+(oe.key==="ArrowRight"?1:-1)+Yu.length)%Yu.length,st=Yu[Ce];F(st.id),(yt=document.getElementById(`agent-${st.id}-tab`))==null||yt.focus()},children:H.label},H.id))}),o.jsxs("div",{className:"aw-content",id:`agent-${D}-panel`,role:"tabpanel","aria-labelledby":`agent-${D}-tab`,children:[D==="basic"&&o.jsxs("div",{className:"aw-basic-stack",children:[o.jsxs("section",{className:"aw-deployment-panel aw-settings-card",children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:"部署配置"}),o.jsx("p",{children:"配置目标环境与网络访问方式。"})]})}),o.jsxs("dl",{className:"aw-readonly-config",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"运行状态"}),o.jsxs("dd",{className:(R==null?void 0:R.status.toLowerCase())==="ready"?"is-ready":void 0,children:[(R==null?void 0:R.status.toLowerCase())==="ready"&&o.jsx("span",{className:"aw-status-dot"}),(R==null?void 0:R.status)||"读取中…"]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"部署区域"}),o.jsx("dd",{children:(R==null?void 0:R.region)||(ie==null?void 0:ie.region)||(Vs==null?void 0:Vs.region)||"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"网络访问"}),o.jsx("dd",{children:R!=null&&R.networkTypes.length?R.networkTypes.join(" / "):"暂未提供"})]})]})]}),o.jsxs("section",{className:"aw-canvas-card",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:"执行流程"})}),o.jsx("div",{className:"aw-canvas",children:o.jsx(Mm,{draft:mi,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},Vg)})]}),o.jsxs("section",{className:"aw-details-card",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:"详细信息"})}),o.jsxs("dl",{className:"aw-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"模型"}),o.jsx("dd",{children:(Wt==null?void 0:Wt.model)||mi.modelName||"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"智能体数量"}),o.jsx("dd",{children:Wt!=null&&Wt.graph?D$(Wt.graph):P$(mi)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"工具"}),o.jsx("dd",{className:"aw-fact-badges",children:mh.length?mh.map(H=>o.jsx("span",{children:H},H)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"技能"}),o.jsx("dd",{className:"aw-fact-badges",children:gh===null?"暂不支持预览":gh.length?gh.map(H=>o.jsx("span",{children:H},H)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:Dr!=null?`v${Dr}`:"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:Zt?"草稿":(Vs==null?void 0:Vs.status)==="error"?"部署失败":(Vs==null?void 0:Vs.status)==="cancelled"?"已取消":Ns?"待更新":o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"aw-status-dot"}),"可用"]})})]})]})]})]}),D==="integrations"&&o.jsxs("div",{className:"aw-integration-stack",children:[o.jsxs("div",{className:"aw-integration-intro",children:[o.jsx("h3",{children:"接入方式"}),o.jsx("p",{children:"仅展示当前 Runtime 可确认的公开协议与地址。"})]}),V&&o.jsxs("div",{className:"aw-integration-error",role:"alert",children:[o.jsx("span",{children:V}),o.jsx("button",{type:"button",onClick:()=>ue(H=>H+1),children:"重试"})]}),!V&&o.jsxs("div",{className:"aw-integration-body",children:[o.jsxs("div",{className:`aw-integration-protocol-tabs${me==="a2a"?" is-a2a":""}`,role:"tablist","aria-label":"接入协议",children:[o.jsx("span",{className:"aw-integration-protocol-slider","aria-hidden":"true"}),Wh.map((H,oe)=>o.jsx("button",{type:"button",id:`integration-${H.id}-tab`,role:"tab","aria-selected":me===H.id,"aria-controls":`integration-${H.id}-panel`,tabIndex:me===H.id?0:-1,onClick:()=>Gg(H.id),onKeyDown:he=>{var yt;if(!["ArrowLeft","ArrowRight","Home","End"].includes(he.key))return;he.preventDefault();const Ce=he.key==="Home"?0:he.key==="End"?Wh.length-1:(oe+(he.key==="ArrowRight"?1:-1)+Wh.length)%Wh.length,st=Wh[Ce];Gg(st.id),(yt=document.getElementById(`integration-${st.id}-tab`))==null||yt.focus()},children:H.label},H.id))]}),me==="api-server"?o.jsx(qL,{protocol:"api-server",title:"API Server",available:et,fields:[{label:"Agent",value:et?((ei=pe==null?void 0:pe.apiApps)==null?void 0:ei.join("、"))??"":""},{label:"发现接口",value:et?bw(Tt,"/list-apps"):""},{label:"调用接口",value:et?bw(Tt,"/run_sse"):""},{label:"鉴权方式",value:et?GL(R==null?void 0:R.authType):""},{label:"API Key",value:o.jsx(KL,{available:et,authType:R==null?void 0:R.authType,value:Te,visible:Me&&!!Te,loading:re,error:we,onToggle:()=>void fo()})}],example:et?uSe(Tt,Gn,R==null?void 0:R.authType):""}):o.jsx(qL,{protocol:"a2a",title:"A2A",available:pn,fields:[{label:"Agent",value:((Pu=pe==null?void 0:pe.a2a)==null?void 0:Pu.name)??""},{label:"Agent Card",value:pn?bw(Tt,"/.well-known/agent-card.json"):""},{label:"调用地址",value:ys},{label:"鉴权方式",value:pn?GL(R==null?void 0:R.authType):""},{label:"API Key",value:o.jsx(KL,{available:pn,authType:R==null?void 0:R.authType,value:Te,visible:Me&&!!Te,loading:re,error:we,onToggle:()=>void fo()})}],example:pn?dSe(ys,R==null?void 0:R.authType):""})]})]}),D==="evaluations"&&o.jsxs("section",{className:"aw-cases",children:[(ie==null?void 0:ie.runtimeId)&&o.jsx("div",{className:"aw-case-summary",children:["good","bad"].map(H=>{const oe=xSe(Wn,H),he=Tn.filter(st=>st.kind===H).length,Ce=tl?he:(oe==null?void 0:oe.itemCount)??he;return o.jsxs("button",{type:"button",onClick:()=>Fi(H),children:[o.jsx("strong",{children:Ce}),o.jsx("span",{children:H==="good"?"Good cases":"Bad cases"})]},H)})}),o.jsxs("div",{className:"aw-case-filter-bar",children:[o.jsxs("div",{className:"aw-case-filter-stack",children:[o.jsx("div",{className:"aw-case-filters","aria-label":"案例结果筛选",children:["good","bad"].map(H=>o.jsx("button",{type:"button",className:bt===H?"is-active":"","aria-pressed":bt===H,onClick:()=>dt(H),children:H==="good"?"Good case":"Bad case"},H))}),o.jsx("div",{className:"aw-case-source-filters","aria-label":"回流方式筛选",children:["auto","user"].map(H=>o.jsx("button",{type:"button",className:wt===H?"is-active":"","aria-pressed":wt===H,onClick:()=>$t(H),children:H==="auto"?"自动回流":"手动回流"},H))})]}),o.jsxs("label",{className:"aw-case-search",children:[o.jsx(By,{"aria-hidden":!0}),o.jsx("input",{type:"search",value:cn,onChange:H=>Ut(H.currentTarget.value),placeholder:"搜索用户输入、期望行为或标签","aria-label":"搜索评测案例"})]})]}),Kg&&o.jsx("div",{className:`aw-case-toolbar${un?" is-active":""}`,children:un?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"aw-selection-count",children:["已选 ",bh.length," 条"]}),o.jsx("button",{type:"button",onClick:yh,disabled:nl.length===0||Ie,children:"全选当前"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void Lu(bh),disabled:bh.length===0||Ie,children:Ie?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:fE,disabled:Ie,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{at(""),on(!0)},disabled:nl.length===0||Ie,children:"选择案例"})}),nt&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:nt}),o.jsx("div",{ref:zn,children:o.jsx(ISe,{cases:nl,loading:yn&&nl.length===0,error:zs,runtimeBacked:!!(ie!=null&&ie.runtimeId),selectionMode:un,selectedCaseIds:dn,focusedCaseId:We,expandedCaseIds:De,deleting:Ie,canDelete:Kg,onOpenCase:xh,onToggleCase:qg,onToggleExpanded:hE,onDeleteCase:H=>void Lu([H]),onRetry:()=>Js(H=>H+1)})})]}),D==="optimizations"&&o.jsxs("section",{className:"aw-optimizations",children:[o.jsxs("div",{className:"aw-optimization-intro",children:[o.jsx("h3",{children:"优化项"}),o.jsx("p",{children:"根据评测结果汇总需要优先处理的改进建议。"})]}),Qn?o.jsxs("div",{className:"aw-optimization-state",role:"status",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsx("span",{children:"正在读取优化项"})]}):Os?o.jsxs("div",{className:"aw-optimization-state is-error",role:"alert",children:[o.jsx("span",{children:Os}),o.jsx("button",{type:"button",onClick:()=>_s(H=>H+1),children:"重试"})]}):On.length>0?o.jsx(ASe,{groups:On}):o.jsx("div",{className:"aw-optimization-state",children:"暂无优化项,自动评测完成后会在这里生成建议。"})]})]}),D==="basic"&&(ie||Zt)&&o.jsxs("div",{className:"aw-basic-actions",children:[ie&&o.jsxs("button",{type:"button",className:"aw-talk studio-update-action",onClick:()=>S==null?void 0:S(ie),children:[o.jsx(pee,{"aria-hidden":!0}),o.jsx("span",{children:"去对话"})]}),o.jsxs("span",{className:`aw-update-wrap${hr?" is-disabled":""}`,tabIndex:hr?0:void 0,"aria-describedby":hr?fc:void 0,children:[o.jsx("button",{type:"button",className:"aw-update studio-update-action",disabled:!!hr,"aria-busy":_e||void 0,"aria-describedby":hr?fc:void 0,onClick:()=>{var H;return Zt?j==null?void 0:j(Zt):Ns?j==null?void 0:j({...Ns,deploymentTarget:cE}):tn?I(((H=tn.agent)==null?void 0:H.draft)??mi,tn):void 0},children:_e?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"loading-gap-spinner aw-update-spinner","aria-hidden":"true"}),o.jsx("span",{children:"检测中"})]}):Zt||Ns?"继续编辑":"更新"}),hr&&o.jsx("span",{id:fc,className:"aw-update-disabled-reason",role:"tooltip",children:hr})]})]})]})]}),L==="evaluation"&&o.jsx("div",{className:"aw-evaluation-glass",role:"status",children:o.jsx("span",{children:"敬请期待"})})]})]}),an&&o.jsx(zA,{variant:"danger",title:an.title,description:an.description,confirmLabel:pt?"删除中...":an.confirmLabel,closeLabel:"关闭删除确认",busy:pt,onCancel:()=>ls(null),onConfirm:()=>void mE()})]})}function ASe({groups:e}){return o.jsx("div",{className:"aw-optimization-table-wrap",children:o.jsxs("table",{className:"aw-optimization-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",children:"修复优先级"}),o.jsx("th",{scope:"col",children:"建议优化模块"}),o.jsx("th",{scope:"col",children:"优化建议和理由"})]})}),o.jsx("tbody",{children:e.map(t=>o.jsxs("tr",{children:[o.jsx("td",{children:o.jsx("span",{className:`aw-priority is-${t.priority}`,children:gSe(t.priority)})}),o.jsx("td",{children:o.jsx("span",{className:"aw-optimization-module",children:ySe(t)})}),o.jsx("td",{children:o.jsx("ul",{className:"aw-optimization-list",children:t.items.map(n=>o.jsxs("li",{children:[o.jsx("strong",{children:n.suggestion}),o.jsx("p",{children:n.reason})]},`${n.suggestion}:${n.reason}`))})})]},`${t.priority}:${t.module}:${t.customModule??""}`))})]})})}function CSe(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M4.5 7h15"}),o.jsx("path",{d:"M9 7V4.8h6V7"}),o.jsx("path",{d:"m6.5 7 .8 12h9.4l.8-12"}),o.jsx("path",{d:"M10 10.5v5M14 10.5v5"})]})}function ISe({cases:e,loading:t=!1,error:n="",runtimeBacked:s=!1,selectionMode:i=!1,selectedCaseIds:r,focusedCaseId:a="",expandedCaseIds:l,deleting:c=!1,canDelete:u=!1,onOpenCase:d,onToggleCase:f,onToggleExpanded:h,onDeleteCase:p,onRetry:m}){return o.jsxs("div",{className:"aw-case-table",children:[o.jsxs("div",{className:"aw-case-row aw-case-row-head",children:[o.jsx("span",{children:"用户输入"}),o.jsx("span",{children:"Agent 输出"}),o.jsx("span",{children:"评分"}),o.jsx("span",{children:"评分理由"}),o.jsx("span",{className:"aw-case-action-head",children:"操作"})]}),t?o.jsx("div",{className:"aw-case-empty",children:"正在读取 AgentKit 评测集…"}):n?o.jsxs("div",{className:"aw-case-empty aw-case-error",children:[o.jsx("span",{children:n}),m&&o.jsx("button",{type:"button",onClick:m,children:"重试"})]}):e.length===0?o.jsx("div",{className:"aw-case-empty",children:s?"暂无用户反馈案例":"没有匹配的案例"}):e.map(b=>{var k;const v=b.id.startsWith("local:"),y=(r==null?void 0:r.has(b.id))??!1,x=(l==null?void 0:l.has(b.id))??!1,w=b.output.length+b.referenceOutput.length>220||(((k=b.reason)==null?void 0:k.length)??0)>120,_=u&&!v,S=b.source==="auto";return o.jsxs("div",{className:["aw-case-row",a===b.id?"is-focused":"",i?"is-selecting":"",y?"is-selected-for-delete":""].filter(Boolean).join(" "),role:"row",tabIndex:0,"aria-selected":i?y:void 0,onClick:()=>{if(i){_&&(f==null||f(b));return}d==null||d(b)},onKeyDown:T=>{T.target===T.currentTarget&&(T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),i?_&&(f==null||f(b)):d==null||d(b)))},children:[o.jsxs("div",{className:"aw-case-text aw-case-cell","data-label":"用户输入",children:[o.jsxs("span",{className:"aw-case-title-line",children:[i&&_&&o.jsx("span",{className:`aw-select-marker${y?" is-checked":""}`,"aria-hidden":"true"}),o.jsx("strong",{title:b.input,children:b.input||"无用户输入"})]}),b.comment&&o.jsxs("small",{title:b.comment,children:["备注:",b.comment]}),o.jsx("small",{className:"aw-case-time",children:pSe(b.createdAt)}),(b.userId||b.sessionId)&&o.jsx("small",{title:[b.userId,b.sessionId].filter(Boolean).join(" · "),children:[b.userId,b.sessionId].filter(Boolean).join(" · ")})]}),o.jsxs("div",{className:`aw-case-output aw-case-cell${x?" is-expanded":""}`,"data-label":"Agent 输出",children:[o.jsx("p",{className:"aw-case-output-preview",title:b.output,children:b.output||"无可见回复"}),b.referenceOutput&&o.jsxs("small",{className:"aw-case-output-preview",title:b.referenceOutput,children:["Reference: ",b.referenceOutput]}),w&&o.jsx("button",{type:"button",className:"aw-case-expand",onClick:T=>{T.stopPropagation(),h==null||h(b.id)},children:x?"收起":"展开"})]}),o.jsx("div",{className:"aw-case-score aw-case-cell","data-label":"评分",children:mSe(b)}),o.jsx("div",{className:`aw-case-reason aw-case-cell${x?" is-expanded":""}`,"data-label":"评分理由",children:o.jsx("p",{title:S?b.reason:void 0,children:S?b.reason||"暂无评分理由":"—"})}),o.jsx("div",{className:"aw-case-actions aw-case-cell","data-label":"操作",children:_&&o.jsx("button",{type:"button",className:"aw-case-delete",onClick:T=>{T.stopPropagation(),p==null||p(b)},disabled:c,title:"删除反馈案例","aria-label":"删除反馈案例",children:o.jsx(CSe,{})})})]},b.id)})]})}function jSe({group:e,agents:t,cases:n,onChange:s,onRun:i}){const[r,a]=g.useState("config"),l=e.agentIds.map(f=>t.find(h=>h.id===f)).filter(f=>!!f),c=["回答质量","事实准确性","工具调用","响应效率"];g.useEffect(()=>a("config"),[e.id]);const u=f=>{s({...e,agentIds:e.agentIds.includes(f)?e.agentIds.filter(h=>h!==f):[...e.agentIds,f]})},d=f=>{s({...e,metrics:e.metrics.includes(f)?e.metrics.filter(h=>h!==f):[...e.metrics,f]})};return o.jsxs("main",{className:"aw-main",children:[o.jsxs("div",{className:"aw-eval-head",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"aw-agent-title-row",children:[o.jsx("h2",{children:e.name}),o.jsx("span",{children:"评测组"})]}),o.jsxs("p",{children:[l.length," 个参评智能体 · ",e.caseSet," · ",e.history.length," 次运行"]})]}),o.jsxs("button",{type:"button",className:"aw-run",onClick:()=>i(e),disabled:!0,children:[o.jsx(iee,{"aria-hidden":!0}),"开始评测"]})]}),o.jsxs("nav",{className:"aw-agent-tabs","aria-label":"评测组详情",children:[o.jsx("button",{type:"button",className:r==="config"?"is-active":"","aria-pressed":r==="config",onClick:()=>a("config"),disabled:!0,children:"评测配置"}),o.jsx("button",{type:"button",className:r==="history"?"is-active":"","aria-pressed":r==="history",onClick:()=>a("history"),disabled:!0,children:"历史结果"})]}),o.jsx("div",{className:"aw-content",children:r==="config"?o.jsxs("div",{className:"aw-eval-setup",children:[o.jsxs("section",{className:"aw-eval-block",children:[o.jsxs("div",{className:"aw-card-head",children:[o.jsx("strong",{children:"参评智能体"}),o.jsxs("span",{children:["已选择 ",l.length," 个"]})]}),o.jsx("div",{className:"aw-eval-agent-grid",children:t.map(f=>o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:e.agentIds.includes(f.id),onChange:()=>u(f.id)}),o.jsxs("span",{children:[o.jsx("strong",{children:f.label}),o.jsx("small",{children:f.remote?"远程":"本地"})]})]},f.id))})]}),o.jsxs("div",{className:"aw-eval-setting-grid",children:[o.jsxs("section",{className:"aw-eval-block",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:"评测资源"})}),o.jsxs("div",{className:"aw-eval-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"评测集"}),o.jsxs("select",{value:e.caseSet,onChange:f=>s({...e,caseSet:f.currentTarget.value}),children:[o.jsx("option",{children:"核心回归集"}),o.jsx("option",{children:"安全边界集"}),o.jsx("option",{children:"工具调用集"})]}),o.jsxs("small",{children:[n.length," 条案例"]})]}),o.jsxs("label",{children:[o.jsx("span",{children:"评估器"}),o.jsxs("select",{value:e.evaluator,onChange:f=>s({...e,evaluator:f.currentTarget.value}),children:[o.jsx("option",{children:"综合质量评估器"}),o.jsx("option",{children:"事实一致性评估器"}),o.jsx("option",{children:"工具调用评估器"})]})]}),o.jsxs("label",{children:[o.jsx("span",{children:"并发数"}),o.jsxs("select",{value:e.concurrency,onChange:f=>s({...e,concurrency:f.currentTarget.value}),children:[o.jsx("option",{value:"2",children:"2"}),o.jsx("option",{value:"4",children:"4"}),o.jsx("option",{value:"8",children:"8"})]})]})]})]}),o.jsxs("section",{className:"aw-eval-block",children:[o.jsxs("div",{className:"aw-card-head",children:[o.jsx("strong",{children:"评测指标"}),o.jsxs("span",{children:["已选择 ",e.metrics.length," 项"]})]}),o.jsx("div",{className:"aw-metric-list",children:c.map(f=>o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:e.metrics.includes(f),onChange:()=>d(f)}),o.jsx("span",{children:f})]},f))})]})]})]}):o.jsxs("section",{className:"aw-eval-history",children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:"历史结果"}),o.jsx("p",{children:"查看该评测组历次运行的总体表现。"})]})}),e.history.length===0?o.jsxs("div",{className:"aw-results-empty",children:[o.jsx("strong",{children:"暂无历史结果"}),o.jsx("span",{children:"完成首次评测后,结果会出现在这里。"})]}):o.jsx("div",{className:"aw-history-list",children:e.history.map((f,h)=>o.jsxs("button",{type:"button",children:[o.jsxs("span",{children:[o.jsxs("strong",{children:["评测运行 #",e.history.length-h]}),o.jsxs("small",{children:[f.createdAt," · ",l.length," 个智能体"]})]}),o.jsxs("span",{className:"aw-history-score",children:[o.jsx("strong",{children:f.score}),o.jsx("small",{children:"综合得分"})]}),o.jsxs("span",{className:"aw-complete",children:[o.jsx(Ra,{}),"已完成"]}),o.jsx(Pp,{"aria-hidden":!0})]},f.id))})]})})]})}function F$(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{const t=e.currentTarget;if(!(t instanceof HTMLElement))return;const n=t.offsetWidth;let s=.985;n<=80?s=.96:n<=150?s=.97:n<=220?s=.98:n>600&&(s=.995),t.style.setProperty("--scale",s.toString())},fN=(e,t)=>{const n=()=>{const a=setTimeout(e);return()=>{clearTimeout(a)}};if(!DSe||typeof window.requestAnimationFrame!="function"||H$&&document.visibilityState==="hidden")return n();let i=2,r=window.requestAnimationFrame(function a(){i-=1,i===0?e():r=window.requestAnimationFrame(a)});return()=>{typeof window.cancelAnimationFrame=="function"&&window.cancelAnimationFrame(r)}},PSe=e=>Object.keys(e).reduce((n,s)=>{const i=e[s];if(i||i===0){const r=s.startsWith("--")?"":"--",a=typeof i=="number"?`${i}px`:i;n[`${r}${s}`]=a}return n},{}),BSe=e=>{const t=g.Children.toArray(e),n=[];let s="";const i=()=>{s!==""&&(n.push(s),s="")};for(const r of t)if(!(r==null||typeof r=="boolean")){if(typeof r=="string"||typeof r=="number"){s+=String(r);continue}i(),n.push(r)}return i(),n},V$=e=>{const t=BSe(e),n=g.Children.count(t);return g.Children.map(t,s=>{if(typeof s=="string"&&s.trim())return n<=1?s:o.jsx("span",{children:s});if(g.isValidElement(s)){const i=s,{children:r,...a}=i.props;return r!=null?g.cloneElement(i,a,V$(r)):i}return s})};g.createContext(null);var USe=typeof Nl=="object"&&Nl&&Nl.Object===Object&&Nl,FSe=typeof self=="object"&&self&&self.Object===Object&&self;USe||FSe||Function("return this")();var $Se=typeof window<"u"?g.useLayoutEffect:g.useEffect;function HSe(){const e=g.useRef(!1);return g.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),g.useCallback(()=>e.current,[])}var WL={width:void 0,height:void 0};function zSe(e){const{ref:t,box:n="content-box"}=e,[{width:s,height:i},r]=g.useState(WL),a=HSe(),l=g.useRef({...WL}),c=g.useRef(void 0);return c.current=e.onResize,g.useEffect(()=>{if(!t.current||typeof window>"u"||!("ResizeObserver"in window))return;const u=new ResizeObserver(([d])=>{const f=n==="border-box"?"borderBoxSize":n==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",h=XL(d,f,"inlineSize"),p=XL(d,f,"blockSize");if(l.current.width!==h||l.current.height!==p){const b={width:h,height:p};l.current.width=h,l.current.height=p,c.current?c.current(b):a()&&r(b)}});return u.observe(t.current,{box:n}),()=>{u.disconnect()}},[n,t,a]),{width:s,height:i}}function XL(e,t,n){return e[t]?Array.isArray(e[t])?e[t][0][n]:e[t][n]:t==="contentBoxSize"?e.contentRect[n==="inlineSize"?"width":"height"]:void 0}function VSe(e,t){const n=g.useRef(e);$Se(()=>{n.current=e},[e]),g.useEffect(()=>{if(!t&&t!==0)return;const s=setTimeout(()=>{n.current()},t);return()=>{clearTimeout(s)}},[t])}const GSe="_LoadingIndicator_7yl6f_1",KSe={LoadingIndicator:GSe},qSe=({className:e,size:t,strokeWidth:n,style:s,...i})=>o.jsx("div",{...i,className:la(KSe.LoadingIndicator,e),style:s||PSe({"indicator-size":t,"indicator-stroke":n})});function YSe(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}const WSe=()=>$$,QL=(e,t=!1,n="TransitionGroup")=>{const s=[];return g.Children.forEach(e,i=>{if(i&&typeof i=="object"&&"key"in i&&i.key)s.push(i);else if(t)throw new Error(`Child elements of <${n} /> must include a \`key\``)}),s},Wu=()=>{},Xu=e=>{const t=g.useRef(e);return t.current=e,g.useCallback(n=>t.current(n),[])};function XSe(e,t,n,s){const i=e.reduce((c,u)=>({...c,[u.key]:1}),{}),r=t.reduce((c,u)=>({...c,[u.component.key]:1}),{}),a=e.filter(c=>!r[c.key]).map(n),l=t.map(c=>({...c,component:e.find(({key:u})=>u===c.component.key)||c.component,shouldRender:!!i[c.component.key]}));return s==="append"?l.concat(a):a.concat(l)}function QSe(e,t,n){if(($$||OSe)&&t&&n>1)throw new Error(`Cannot use forwardRef with multiple children in <${e} />`)}const ZSe="_TransitionGroupChild_1hv1z_1",JSe={TransitionGroupChild:ZSe},G$={enter:!1,enterActive:!1,exit:!1,exitActive:!1,interrupted:!1},e_e=e=>({...G$,enter:!e}),t_e=(e,t)=>{switch(t.type){case"enter-before":return{enter:!0,enterActive:!1,exit:!1,exitActive:!1,interrupted:e.interrupted||e.exit};case"enter-active":return{enter:!0,enterActive:!0,exit:!1,exitActive:!1,interrupted:!1};case"exit-before":return{enter:!1,enterActive:!1,exit:!0,exitActive:!1,interrupted:e.interrupted||e.enter};case"exit-active":return{enter:!1,enterActive:!1,exit:!0,exitActive:!0,interrupted:!1};case"done":default:return G$}},n_e=({ref:e,as:t,children:n,className:s,transitionId:i,style:r,preventMountTransition:a,shouldRender:l,enterDuration:c,exitDuration:u,removeChild:d,onEnter:f,onEnterActive:h,onEnterComplete:p,onExit:m,onExitActive:b,onExitComplete:v})=>{const[y,x]=g.useReducer(t_e,e_e(a||!1)),E=g.useRef(!1),w=g.useRef(null),_=g.useRef(c);_.current=c;const S=g.useRef(u);S.current=u;const k=g.useRef(null),T=g.useCallback(C=>{const I=w.current;if(!(!I||C===k.current))switch(k.current=C,C){case"enter":f(I);break;case"enter-active":h(I);break;case"enter-complete":p(I);break;case"exit":m(I);break;case"exit-active":b(I);break;case"exit-complete":v(I);break}},[f,h,p,m,b,v]);return Bt.useLayoutEffect(()=>{if(!l){let j;x({type:"exit-before"}),T("exit");const L=fN(()=>{x({type:"exit-active"}),T("exit-active"),j=window.setTimeout(()=>{T("exit-complete"),d()},S.current)});return()=>{L(),j!==void 0&&clearTimeout(j)}}if(a&&!E.current){E.current=!0;return}let C;x({type:"enter-before"}),T("enter");const I=fN(()=>{x({type:"enter-active"}),T("enter-active"),C=window.setTimeout(()=>{x({type:"done"}),T("enter-complete")},_.current)});return()=>{I(),C!==void 0&&clearTimeout(C)}},[l,a,d,T]),g.useEffect(()=>()=>{E.current=!1},[]),o.jsx(t,{ref:YSe([w,e]),className:la(s,JSe.TransitionGroupChild),"data-transition-id":i,style:r,"data-entering":y.enter?"":void 0,"data-entering-active":y.enterActive?"":void 0,"data-exiting":y.exit?"":void 0,"data-exiting-active":y.exitActive?"":void 0,"data-interrupted":y.interrupted?"":void 0,children:n})},s_e=e=>{const{enterMountDelay:t,preventMountTransition:n}=e,s=!n&&t!=null?t:null,[i,r]=g.useState(s==null);return VSe(()=>r(!0),i?null:s),i?o.jsx(n_e,{...e}):null},i_e=e=>{const{ref:t,as:n="span",children:s,className:i,transitionId:r,style:a,enterDuration:l=0,exitDuration:c=0,preventInitialTransition:u=!0,enterMountDelay:d,insertMethod:f="append",disableAnimations:h=WSe()}=e,p=Xu(e.onEnter??Wu),m=Xu(e.onEnterActive??Wu),b=Xu(e.onEnterComplete??Wu),v=Xu(e.onExit??Wu),y=Xu(e.onExitActive??Wu),x=Xu(e.onExitComplete??Wu);g.Children.forEach(s,S=>{if(S&&!S.key)throw new Error("Child elements of must include a `key`")});const E=g.useCallback(S=>({component:S,shouldRender:!0,removeChild:()=>{_(k=>k.filter(T=>S.key!==T.component.key))},onEnter:p,onEnterActive:m,onEnterComplete:b,onExit:v,onExitActive:y,onExitComplete:x}),[p,m,b,v,y,x]),[w,_]=g.useState(()=>QL(s).map(S=>({...E(S),preventMountTransition:u})));return g.useLayoutEffect(()=>{_(S=>{const k=QL(s);return XSe(k,S,E,f)})},[s,f,E]),QSe("TransitionGroup",t,g.Children.count(s)),h?o.jsx(o.Fragment,{children:g.Children.map(s,S=>o.jsx(n,{ref:t,className:i,style:a,"data-transition-id":r,children:S}))}):o.jsx(o.Fragment,{children:w.map(({component:S,...k})=>o.jsx(s_e,{...k,as:n,className:i,transitionId:r,enterDuration:l,exitDuration:c,enterMountDelay:d,style:a,ref:t,children:S},S.key))})},r_e="_Button_1864l_1",a_e="_ButtonInner_1864l_4",o_e="_ButtonLoader_1864l_749",yw={Button:r_e,ButtonInner:a_e,ButtonLoader:o_e},ZL=e=>{const{type:t="button",color:n="primary",variant:s="solid",pill:i=!0,uniform:r=!1,size:a="md",iconSize:l,gutterSize:c,loading:u,selected:d,block:f,opticallyAlign:h,children:p,className:m,onClick:b,disabled:v,disabledTone:y,inert:x=u,...E}=e,w=v||x,_=g.useCallback(S=>{v||b==null||b(S)},[b,v]);return o.jsxs("button",{type:t,className:la(yw.Button,m),"data-color":n,"data-variant":s,"data-pill":i?"":void 0,"data-uniform":r?"":void 0,"data-size":a,"data-gutter-size":c,"data-icon-size":l,"data-loading":u?"":void 0,"data-selected":d?"":void 0,"data-block":f?"":void 0,"data-optically-align":h,onPointerEnter:z$,disabled:w,"aria-disabled":w,tabIndex:w?-1:void 0,"data-disabled":v?"":void 0,"data-disabled-tone":v?y:void 0,onClick:_,...E,children:[o.jsx(i_e,{className:yw.ButtonLoader,enterDuration:250,exitDuration:150,children:u&&o.jsx(qSe,{},"loader")}),o.jsx("span",{className:yw.ButtonInner,children:V$(p)})]})},l_e=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8-10C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2Zm4.465 6.763a1 1 0 0 0-1.228-1.228l-5.5 1.5a1 1 0 0 0-.702.702l-1.5 5.5a1 1 0 0 0 1.228 1.228l5.5-1.5a1 1 0 0 0 .702-.702l1.5-5.5Zm-6.54 5.312.89-3.26 3.26-.89-.89 3.26-3.26.89Z",clipRule:"evenodd"})}),c_e="_EmptyMessage_1r5gu_1",u_e="_IconBadge_1r5gu_16",d_e="_Title_1r5gu_54",f_e="_Description_1r5gu_69",h_e="_ActionRow_1r5gu_77",Ag={EmptyMessage:c_e,IconBadge:u_e,Title:d_e,Description:f_e,ActionRow:h_e},ns=({children:e,className:t,fill:n="static"})=>o.jsx("div",{className:la(Ag.EmptyMessage,t),"data-fill":n,children:e}),p_e=({size:e="md",color:t="secondary",children:n,className:s})=>o.jsx("div",{className:la(Ag.IconBadge,s),"data-size":e,"data-color":t,children:n}),m_e=({children:e,className:t,color:n="secondary"})=>o.jsx("div",{className:la(Ag.Title,t),"data-color":n,children:e}),g_e=({children:e,className:t})=>o.jsx("div",{className:la(Ag.Description,t),children:e}),b_e=({children:e,className:t})=>o.jsx("div",{className:la(Ag.ActionRow,t),children:e});ns.Icon=p_e;ns.Title=m_e;ns.Description=g_e;ns.ActionRow=b_e;const sr="/web/sandbox/sessions",JL=3e4,e3=33e4,y_e=6e4,x_e=6e5,xw=15e3,No=6e4,E_e=33e4,t3=40;function B1(e){switch(e.trim().toLowerCase()){case"ready":return"就绪";case"creating":return"创建中";case"starting":case"initializing":return"启动中";case"pending":return"等待中";case"running":return"运行中";case"failed":case"error":return"异常";case"stopped":return"已停止";case"expired":return"已过期";case"deleting":return"删除中";case"deleted":return"已删除";default:return"未知状态"}}function ti(e){const t=t1(e);return t.has("Accept")||t.set("Accept","application/json"),t}async function ni(e,t){const n=await e.text().catch(()=>"");let s={};try{s=JSON.parse(n)}catch{const c=`${t}(HTTP ${e.status})`;return new Error(n?`${c}:${n}`:c)}const i=s.detail,r=i&&typeof i=="object"&&"message"in i?i.message:i??s.error??s.message,a=typeof r=="string"?r:r==null?"":JSON.stringify(r),l=`${t}(HTTP ${e.status})`;return new Error(a?`${l}:${a}`:l)}function Qu(e,t="codex"){if(!e.sessionId||!e.status)throw new Error("AgentKit 沙箱返回了无效的 Session 信息。");return{id:e.sessionId,toolName:t,userSessionId:e.userSessionId??"",displayName:e.displayName??"",status:e.status,createdAt:e.createdAt??"",expireAt:e.expireAt??"",toolType:e.toolType??"",createdBy:e.createdBy??"",threadId:e.threadId??"",cwd:e.cwd??"",workspaceLocked:e.workspaceLocked===!0,busy:e.busy===!0,...typeof e.model=="string"?{model:e.model}:{},permissions:U1(e.permissions)}}const Xh={approvalPolicy:"on-request",approvalsReviewer:"user",sandboxMode:"workspace-write",networkAccess:!1};function U1(e){if(!e||typeof e!="object")return{...Xh};const t=e,n=t.approvalPolicy,s=t.approvalsReviewer,i=t.sandboxMode;return{approvalPolicy:n==="untrusted"||n==="on-request"||n==="never"?n:Xh.approvalPolicy,approvalsReviewer:s==="user"||s==="auto_review"?s:Xh.approvalsReviewer,sandboxMode:i==="read-only"||i==="workspace-write"||i==="danger-full-access"?i:Xh.sandboxMode,networkAccess:typeof t.networkAccess=="boolean"?t.networkAccess:Xh.networkAccess}}function n3(e){if(!e||typeof e!="object")throw new Error("Sandbox 返回了无效设置。");const t=e;return{threadId:typeof t.threadId=="string"?t.threadId:"",cwd:typeof t.cwd=="string"?t.cwd:"",...typeof t.model=="string"?{model:t.model}:{},workspaceLocked:t.workspaceLocked===!0,busy:t.busy===!0,permissions:U1(t.permissions)}}function va(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function v_e(e){const t=va(e);if(!(!t||typeof t.id!="string"||!t.id))return{id:t.id,displayName:typeof t.displayName=="string"?t.displayName:t.id,description:typeof t.description=="string"?t.description:"",isDefault:t.isDefault===!0}}function w_e(e){const t=va(e);if(!(!t||typeof t.id!="string"||!t.id||typeof t.name!="string"||!t.name))return{id:t.id,name:t.name,description:typeof t.description=="string"?t.description:""}}function K$(e){const t=va(e);if(!(!t||typeof t.id!="string"||!t.id))return{id:t.id,...typeof t.name=="string"&&t.name?{name:t.name}:{},preview:typeof t.preview=="string"?t.preview:"",cwd:typeof t.cwd=="string"?t.cwd:"",modelProvider:typeof t.modelProvider=="string"?t.modelProvider:"",createdAt:typeof t.createdAt=="number"&&Number.isFinite(t.createdAt)?t.createdAt:0,updatedAt:typeof t.updatedAt=="number"&&Number.isFinite(t.updatedAt)?t.updatedAt:0,status:typeof t.status=="string"?t.status:"unknown"}}function Z0(e){const t=va(e),n=K$(t==null?void 0:t.thread);if(!t||!n||typeof t.threadId!="string"||!Array.isArray(t.messages))throw new Error("Sandbox 返回了无效 Thread 快照。");const s=t.messages.flatMap(i=>{const r=va(i);if(!r||typeof r.id!="string"||r.role!=="user"&&r.role!=="assistant"||typeof r.content!="string"||typeof r.timestamp!="number")return[];const a=Array.isArray(r.skillNames)?r.skillNames.filter(l=>typeof l=="string"&&!!l):[];return[{id:r.id,role:r.role,content:r.content,timestamp:r.timestamp,...a.length?{skillNames:a}:{}}]});return{thread:n,threadId:t.threadId,messages:s,...typeof t.model=="string"?{model:t.model}:{},...typeof t.cwd=="string"?{cwd:t.cwd}:{},workspaceLocked:t.workspaceLocked===!0,permissions:U1(t.permissions)}}function hN(e){if(!e||typeof e!="object")return;const t=e;if(![t.totalTokens,t.inputTokens,t.cachedInputTokens,t.outputTokens,t.reasoningOutputTokens].some(s=>typeof s!="number"||!Number.isFinite(s)||s<0))return{totalTokens:Math.trunc(t.totalTokens),inputTokens:Math.trunc(t.inputTokens),cachedInputTokens:Math.trunc(t.cachedInputTokens),outputTokens:Math.trunc(t.outputTokens),reasoningOutputTokens:Math.trunc(t.reasoningOutputTokens)}}function S_e(e){const t=hN(e.usage);if(!t||typeof e.turnId!="string")return;const n=hN(e.threadTotal),s=e.modelContextWindow;return{turnId:e.turnId,usage:t,...n?{threadTotal:n}:{},...typeof s=="number"&&Number.isFinite(s)&&s>=0?{modelContextWindow:Math.trunc(s)}:{}}}function __e(e){return typeof e.id!="string"||e.kind!=="command"&&e.kind!=="file"||typeof e.method!="string"?null:{id:e.id,kind:e.kind,method:e.method,...typeof e.reason=="string"?{reason:e.reason}:{},...typeof e.command=="string"?{command:e.command}:{},...typeof e.cwd=="string"?{cwd:e.cwd}:{},...typeof e.grantRoot=="string"?{grantRoot:e.grantRoot}:{},...e.changes!==void 0?{changes:e.changes}:{},...typeof e.threadId=="string"?{threadId:e.threadId}:{},...typeof e.turnId=="string"?{turnId:e.turnId}:{},...typeof e.itemId=="string"?{itemId:e.itemId}:{}}}async function N_e(e,t={}){if(!e.body)throw new Error("沙箱对话服务未返回内容。");const n=e.body.getReader(),s=new TextDecoder;let i="",r="";const a=[],l=new Map;let c;function u(){var p;(p=t.onBlocks)==null||p.call(t,a.map(m=>({...m})))}function d(p){r+=p;const m=a[a.length-1];(m==null?void 0:m.kind)==="text"?m.text+=p:a.push({kind:"text",text:p}),u()}function f(p){if(typeof p.id!="string"||p.kind!=="thinking"&&p.kind!=="tool"||p.status!=="running"&&p.status!=="done")return;const m=p.status==="done";let b;if(p.kind==="thinking"){if(typeof p.text!="string"||!p.text)return;b={kind:"thinking",text:p.text,done:m}}else{if(typeof p.name!="string"||!p.name)return;b={kind:"tool",name:p.name,args:p.args,response:p.response,done:m}}const v=l.get(p.id);v===void 0?(l.set(p.id,a.length),a.push(b)):a[v]=b,u()}function h(p){var y,x,E;let m="message";const b=[];for(const w of p.split(/\r?\n/))w.startsWith("event:")&&(m=w.slice(6).trim()),w.startsWith("data:")&&b.push(w.slice(5).trimStart());if(b.length===0)return;let v;try{v=JSON.parse(b.join(` -`))}catch{throw new Error("沙箱对话服务返回了无法解析的响应。")}if(m==="error")throw new Error(typeof v.message=="string"&&v.message?v.message:"沙箱对话失败,请稍后重试。");if(m==="activity"&&f(v),m==="approval"){const w=__e(v);w&&((y=t.onApproval)==null||y.call(t,w))}if(m==="usage"){const w=S_e(v);w&&(c=w,(x=t.onUsage)==null||x.call(t,w))}m==="approval_resolved"&&typeof v.approvalId=="string"&&((E=t.onApprovalResolved)==null||E.call(t,v.approvalId)),m==="delta"&&typeof v.text=="string"&&d(v.text),m==="done"&&!r&&typeof v.text=="string"&&d(v.text)}for(;;){const{done:p,value:m}=await n.read();i+=s.decode(m,{stream:!p});const b=i.split(/\r?\n\r?\n/);if(i=b.pop()??"",b.forEach(h),p)break}if(i.trim()&&h(i),a.length===0)throw new Error("沙箱未返回有效回复,请重试。");return{text:r,blocks:a,...c?{usage:c}:{}}}async function za(e,t,{method:n="GET",body:s,options:i={},fallback:r}){if(!e)throw new Error("缺少要操作的 AgentKit Session。");const a=await fetch(Cn(`${sr}/${encodeURIComponent(e)}/${t}`),{method:n,headers:ti(s===void 0?void 0:{"Content-Type":"application/json"}),...s===void 0?{}:{body:JSON.stringify(s)},signal:Un(i.signal,No)});if(!a.ok)throw await ni(a,r);return a.json()}const sn={async listSessions(e={}){const t=await fetch(Cn(sr),{method:"GET",headers:ti(),signal:Un(e.signal,JL)});if(!t.ok)throw await ni(t,"无法读取 Codex 智能体,请稍后重试。");const n=await t.json();if(!Array.isArray(n.sessions))throw new Error("AgentKit 沙箱返回了无效的 Session 列表。");return n.sessions.map(s=>Qu(s))},async startSession(e={}){var n;const t=await fetch(Cn(sr),{method:"POST",headers:ti({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((n=e.displayName)==null?void 0:n.trim())??""}),signal:Un(e.signal,e3)});if(!t.ok)throw await ni(t,"无法启动 AgentKit 沙箱,请稍后重试。");return Qu(await t.json())},async listAgentSessions(e,t={}){const n=await fetch(Cn(`/web/${e}/sessions`),{method:"GET",headers:ti(),signal:Un(t.signal,JL)});if(!n.ok)throw await ni(n,`无法读取 ${e} 智能体,请稍后重试。`);const s=await n.json();if(!Array.isArray(s.sessions))throw new Error(`AgentKit 返回了无效的 ${e} Session 列表。`);return s.sessions.map(i=>Qu(i,e))},async startAgentSession(e,t={}){var s;const n=await fetch(Cn(`/web/${e}/sessions`),{method:"POST",headers:ti({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((s=t.displayName)==null?void 0:s.trim())??""}),signal:Un(t.signal,e3)});if(!n.ok)throw await ni(n,`无法创建 ${e} 智能体,请稍后重试。`);return Qu(await n.json(),e)},async openAgentSession(e,t,n={}){if(!t)throw new Error("缺少要打开的 AgentKit Session。");const s=await fetch(Cn(`/web/${e}/sessions/${encodeURIComponent(t)}/open`),{method:"POST",headers:ti(),signal:Un(n.signal,No)});if(!s.ok)throw await ni(s,`无法打开 ${e} 智能体。`);const i=await s.json();if(typeof i.webuiUrl!="string"||!i.webuiUrl.startsWith("/"))throw new Error(`${e} 智能体返回了无效的主页面地址。`);return{session:Qu(i,e),kind:e,webuiUrl:Cn(i.webuiUrl)}},async launchAgentTerminal(e,t,n={}){if(!t)throw new Error("缺少要打开 Terminal 的 AgentKit Session。");const s=await fetch(Cn(`/web/${e}/sessions/${encodeURIComponent(t)}/terminal`),{method:"POST",headers:ti(),signal:Un(n.signal,No)});if(!s.ok)throw await ni(s,`无法打开 ${e} Terminal。`);const i=await s.json();return{url:q$(i.url,`${e} Terminal`),...typeof i.shellSessionId=="string"?{shellSessionId:i.shellSessionId}:{}}},async deleteAgentSession(e,t,n={}){if(!t)return;const s=await fetch(Cn(`/web/${e}/sessions/${encodeURIComponent(t)}`),{method:"DELETE",headers:ti(),signal:Un(n.signal,xw)});if(!s.ok&&s.status!==404)throw await ni(s,`无法删除 ${e} 智能体。`)},async connectSession(e,t={}){if(!e)throw new Error("缺少要连接的 AgentKit Session。");const n=await fetch(Cn(`${sr}/${encodeURIComponent(e)}/connect`),{method:"POST",headers:ti({"Content-Type":"application/json"}),signal:Un(t.signal,y_e)});if(!n.ok)throw await ni(n,"无法连接 Codex 智能体,请稍后重试。");const s=Qu(await n.json());if(s.status.toLowerCase()!=="ready")throw new Error(`AgentKit Session 尚未就绪,当前状态:${s.status}。`);return s},async sendMessage(e,t={}){var s;if(!e.sessionId||!e.text.trim())throw new Error("内置智能体会话缺少有效的消息内容。");const n=await fetch(Cn(`${sr}/${encodeURIComponent(e.sessionId)}/messages`),{method:"POST",headers:ti({Accept:"text/event-stream","Content-Type":"application/json"}),body:JSON.stringify({message:e.text,...(s=e.skillIds)!=null&&s.length?{skillIds:e.skillIds}:{}}),signal:Un(t.signal,x_e)});if(!n.ok)throw await ni(n,"沙箱对话失败,请稍后重试。");return N_e(n,t)},async getStatus(e,t={}){const n=await za(e,"status",{options:t,fallback:"无法读取 Codex 状态。"}),s=n3(n),i=va(n),r=hN(i==null?void 0:i.threadTotal),a=i==null?void 0:i.modelContextWindow;return{...s,...r?{threadTotal:r}:{},...typeof a=="number"&&Number.isFinite(a)&&a>=0?{modelContextWindow:Math.trunc(a)}:{}}},async listModels(e,t={}){const n=va(await za(e,"models",{options:t,fallback:"无法读取 Codex 模型列表。"}));if(!Array.isArray(n==null?void 0:n.models))throw new Error("Sandbox 返回了无效模型列表。");return n.models.flatMap(s=>{const i=v_e(s);return i?[i]:[]})},async setModel(e,t,n={}){const s=va(await za(e,"model",{method:"PUT",body:{model:t},options:n,fallback:"无法切换 Codex 模型。"}));if(typeof(s==null?void 0:s.model)!="string"||!s.model)throw new Error("Sandbox 返回了无效模型。");return s.model},async listSkills(e,t=!1,n={}){const i=va(await za(e,`skills${t?"?force_reload=true":""}`,{options:n,fallback:"无法读取 Codex Skills。"}));if(!Array.isArray(i==null?void 0:i.skills))throw new Error("Sandbox 返回了无效 Skill 列表。");return i.skills.flatMap(r=>{const a=w_e(r);return a?[a]:[]})},async listThreads(e,t={},n={}){const s=new URLSearchParams;t.cursor&&s.set("cursor",t.cursor),t.search&&s.set("search",t.search),t.archived&&s.set("archived","true");const i=s.size?`?${s}`:"",r=va(await za(e,`threads${i}`,{options:n,fallback:"无法读取 Codex Thread 列表。"}));if(!Array.isArray(r==null?void 0:r.threads))throw new Error("Sandbox 返回了无效 Thread 列表。");return{threads:r.threads.flatMap(a=>{const l=K$(a);return l?[l]:[]}),...typeof r.nextCursor=="string"?{nextCursor:r.nextCursor}:{}}},async newThread(e,t={}){return Z0(await za(e,"threads/new",{method:"POST",options:t,fallback:"无法创建新的 Codex Thread。"}))},async resumeThread(e,t,n={}){return Z0(await za(e,"threads/resume",{method:"POST",body:{threadId:t},options:n,fallback:"无法恢复 Codex Thread。"}))},async forkThread(e,t={}){return Z0(await za(e,"threads/fork",{method:"POST",options:t,fallback:"无法分叉 Codex Thread。"}))},async archiveThread(e,t,n={}){const s=va(await za(e,"threads/archive",{method:"POST",body:{threadId:t},options:n,fallback:"无法归档 Codex Thread。"}));if((s==null?void 0:s.archived)!==!0)throw new Error("Sandbox 返回了无效归档结果。");return{archived:!0,...s.thread?{snapshot:Z0(s)}:{}}},async compactThread(e,t={}){await za(e,"threads/compact",{method:"POST",options:t,fallback:"无法压缩 Codex Thread。"})},async getSettings(e,t={}){const n=await fetch(Cn(`${sr}/${encodeURIComponent(e)}/settings`),{method:"GET",headers:ti(),signal:Un(t.signal,No)});if(!n.ok)throw await ni(n,"无法读取 Codex 权限与工作空间。");return n3(await n.json())},async updatePermissions(e,t,n={}){const s=await fetch(Cn(`${sr}/${encodeURIComponent(e)}/permissions`),{method:"PUT",headers:ti({"Content-Type":"application/json"}),body:JSON.stringify(t),signal:Un(n.signal,No)});if(!s.ok)throw await ni(s,"无法更新 Codex 权限。");const i=await s.json();return U1(i.permissions)},async updateWorkspace(e,t,n={}){const s=await fetch(Cn(`${sr}/${encodeURIComponent(e)}/workspace`),{method:"PUT",headers:ti({"Content-Type":"application/json"}),body:JSON.stringify({cwd:t}),signal:Un(n.signal,No)});if(!s.ok)throw await ni(s,"无法更新 Codex 工作空间。");const i=await s.json();if(typeof i.cwd!="string"||!i.cwd)throw new Error("Sandbox 返回了无效工作目录。");return i.cwd},async listDirectories(e,t,n={}){const s=new URLSearchParams({path:t}),i=await fetch(Cn(`${sr}/${encodeURIComponent(e)}/directories?${s}`),{method:"GET",headers:ti(),signal:Un(n.signal,No)});if(!i.ok)throw await ni(i,"无法读取 Sandbox 目录。");const r=await i.json();if(typeof r.path!="string"||!Array.isArray(r.directories)||r.directories.some(a=>!a||typeof a.name!="string"||typeof a.path!="string"))throw new Error("Sandbox 返回了无效目录列表。");return{path:r.path,...typeof r.parent=="string"?{parent:r.parent}:{},directories:r.directories}},async resolveApproval(e,t,n,s={}){const i=await fetch(Cn(`${sr}/${encodeURIComponent(e)}/approvals/${encodeURIComponent(t)}`),{method:"POST",headers:ti({"Content-Type":"application/json"}),body:JSON.stringify({decision:n}),signal:Un(s.signal,No)});if(!i.ok)throw await ni(i,"无法提交 Codex 审批决定。")},async launchTerminal(e,t={}){return s3(e,"terminal",t)},async launchBrowser(e,t={}){return s3(e,"browser",t)},async uploadFile(e,t,n={}){const s=new FormData;s.set("file",t,t.name);const i=await fetch(Cn(`${sr}/${encodeURIComponent(e)}/files`),{method:"POST",headers:ti(),body:s,signal:Un(n.signal,E_e)});if(!i.ok)throw await ni(i,"无法上传文件到 Sandbox。");const r=await i.json();if(typeof r.id!="string"||typeof r.path!="string"||typeof r.name!="string"||typeof r.mimeType!="string"||typeof r.sizeBytes!="number")throw new Error("Sandbox 返回了无效上传结果。");return r},async closeSession(e,t={}){if(!e)return;const n=await fetch(Cn(`${sr}/${encodeURIComponent(e)}/disconnect`),{method:"POST",headers:ti(),signal:Un(t.signal,xw)});if(!n.ok&&n.status!==404)throw await ni(n,"无法断开 Codex 智能体连接。")},async deleteSession(e,t={}){if(!e)return;const n=await fetch(Cn(`${sr}/${encodeURIComponent(e)}`),{method:"DELETE",headers:ti(),signal:Un(t.signal,xw)});if(!n.ok&&n.status!==404)throw await ni(n,"无法删除 Codex 智能体。")}};async function s3(e,t,n){const s=await fetch(Cn(`${sr}/${encodeURIComponent(e)}/${t}`),{method:"POST",headers:ti(),signal:Un(n.signal,No)});if(!s.ok)throw await ni(s,t==="terminal"?"无法打开 Sandbox Terminal。":"无法打开 Sandbox Browser。");const i=await s.json();return{url:q$(i.url,"Sandbox 工具"),...typeof i.shellSessionId=="string"?{shellSessionId:i.shellSessionId}:{}}}function q$(e,t){if(typeof e!="string")throw new Error(`${t} 返回了无效地址。`);if(e.startsWith("/"))return Cn(e);let n;try{n=new URL(e)}catch{throw new Error(`${t} 返回了无效地址。`)}const s=n.protocol==="http:"&&window.location.protocol==="http:";if(n.protocol!=="https:"&&!s)throw new Error(`${t} 返回了不安全的地址。`);return n.toString()}function Od(e,t,n){const s=e instanceof Error?`${e.name}: ${e.message}`:String(e||"未知错误");return[`${t}失败`,`详细信息:${s}`,n?`请求:${n}`:""].filter(Boolean).join(` -`)}function T_e(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M8.4 18.4H7.2a4.2 4.2 0 0 1-.65-8.35A5.7 5.7 0 0 1 17.3 8.2a4.6 4.6 0 0 1-.4 9.2h-3.2"}),o.jsx("path",{d:"m7.8 12.3 2 2-2 2M12.2 16.3h3.2"})]})}function k_e(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M18.9 6.25A8.4 8.4 0 1 0 19.6 16"}),o.jsx("path",{d:"M19 6.2c.1 2.1-.65 3.75-2.25 4.95-1.2.9-2.75 1.25-4.2.9"}),o.jsx("circle",{cx:"10.6",cy:"12.8",r:"2.45"}),o.jsx("path",{d:"m5.25 18.6 3.65-3.9M14.8 17.9c1.9-.45 3.55-1.65 4.65-3.35"})]})}function A_e(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6.2 20c.55-2.15.75-4.1.75-6.7V9.8A5.35 5.35 0 0 1 12.35 4c3.35 0 5.65 2.35 5.65 5.65v4.6c0 2.35.35 4.25 1.15 5.75"}),o.jsx("path",{d:"M8.05 10.2c1.35-.6 2.2-1.65 2.55-3.15.45 1.55 1.35 2.55 2.7 3.05.1-1 .4-1.95.85-2.75.45 1.25 1.2 2.2 2.15 2.75"}),o.jsx("path",{d:"M9.3 12.65h.01M14.9 12.65h.01M10.8 15.55c.8.5 1.65.5 2.45 0"}),o.jsx("path",{d:"M8.45 19.85c.95-.85 1.45-1.95 1.5-3.25M15.1 16.65c.05 1.2.55 2.3 1.55 3.2"})]})}function $m({kind:e,...t}){return e==="codex"?o.jsx(T_e,{...t}):e==="openclaw"?o.jsx(k_e,{...t}):o.jsx(A_e,{...t})}const i3="cn-beijing",Ew=[{id:"general",label:"通用智能体"},{id:"codex",label:"Codex 智能体"},{id:"openclaw",label:"OpenClaw 智能体"},{id:"hermes",label:"Hermes 智能体"}],C_e=24,I_e=3e4,Md=new Map,Qd=new Map,j_e=new Set;function J0(e){if(!e){Md.clear(),Qd.clear();return}const t=new Set(e);if(t.size!==0){for(const[n,s]of Qd)s.page.runtimes.some(i=>t.has(i.runtimeId))&&Qd.delete(n);Md.clear()}}function R_e(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"6.2",stroke:"currentColor",strokeWidth:"1.7"}),o.jsx("path",{d:"m15.4 15.4 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function vw(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function O_e({type:e}){return e==="general"?o.jsx(Yc,{}):o.jsx($m,{kind:e})}function VA(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(t).replace(/\//g,"-")}function M_e(e){return e==="cn-shanghai"?"上海":e==="cn-beijing"?"北京":e||"—"}function r3(e){var t;return{id:e.runtimeId,name:e.name,description:((t=e.description)==null?void 0:t.trim())||"暂无描述",createdAt:VA(e.createdAt??""),specificationLabel:"创建人",specification:e.author||"—",isMine:e.isMine,runtime:{runtimeId:e.runtimeId,region:e.region,currentVersion:e.currentVersion,canDelete:e.canDelete}}}function L_e(e){return{id:e.id,name:e.displayName||`${e.toolName} 智能体`,description:B1(e.status),createdAt:VA(e.createdAt),specificationLabel:"创建人",specification:e.createdBy||"—",sandbox:e}}function D_e(e){var t;return{id:e.id,name:e.draft.name||"未命名 Agent",description:((t=e.draft.description)==null?void 0:t.trim())||"暂无描述",createdAt:VA(new Date(e.updatedAt).toISOString()),specificationLabel:"存储位置",specification:"当前浏览器",draft:e}}async function P_e(e,t,n){const s=`${e}:all:${t}`,i=Qd.get(s);if(i&&i.expiresAt>Date.now())return n(i.page.runtimes.map(r3)),i.page.nextToken;i&&Qd.delete(s);let r=Md.get(s);r||(r=a1({scope:e,region:"all",pageSize:C_e,nextToken:t}),Md.set(s,r),r.then(()=>Md.delete(s),()=>Md.delete(s)));const a=await r;return Qd.set(s,{page:a,expiresAt:Date.now()+I_e}),n(a.runtimes.map(r3)),a.nextToken}function B_e({agent:e,onUse:t,onViewDetails:n,connecting:s,connected:i,showOwnership:r,deploymentTask:a,onViewDeploymentTask:l,onEditDraft:c,onDeleteDraft:u}){const d=!!(e.runtime||e.sandbox);return o.jsxs("article",{className:"my-agent-card",children:[o.jsxs("div",{className:"my-agent-card-content",children:[o.jsxs("div",{className:"my-agent-card-title",children:[o.jsxs("div",{className:"my-agent-card-title-copy",children:[o.jsx("h3",{children:e.name}),e.sandbox?o.jsx("span",{className:"my-agent-session-id",title:e.sandbox.id,children:e.sandbox.id}):null]}),e.draft?o.jsx("span",{className:"my-agent-draft-badge",children:a?"部署中":"草稿"}):e.sandbox?o.jsx("span",{className:"my-agent-status-label","data-ready":e.sandbox.status.toLowerCase()==="ready"||void 0,children:e.description}):e.runtime?o.jsxs("div",{className:"my-agent-card-badges",children:[a?o.jsx("span",{className:"my-agent-deploying-badge",children:"部署中"}):null,o.jsx("span",{className:"my-agent-region-badge",children:M_e(e.runtime.region)}),r&&e.isMine?o.jsx("span",{className:"runtime-owner-badge",children:"我创建的"}):null]}):null]}),e.sandbox?null:o.jsx("p",{className:"my-agent-description",children:e.description}),o.jsxs("dl",{className:"my-agent-meta",children:[o.jsxs("div",{className:"my-agent-created-at",children:[o.jsx("dt",{children:e.draft?"更新时间":"创建时间"}),o.jsx("dd",{children:e.createdAt})]}),o.jsxs("div",{className:"my-agent-region",children:[o.jsx("dt",{children:e.specificationLabel}),o.jsx("dd",{children:e.specification})]})]})]}),o.jsx("footer",{className:"my-agent-actions",children:e.draft?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"my-agent-details","aria-label":a?`查看 ${e.name} 部署进度`:`编辑草稿 ${e.name}`,onClick:()=>a?l==null?void 0:l(a):c==null?void 0:c(e.draft),children:a?"查看进度":"编辑"}),o.jsx("button",{type:"button",className:"my-agent-delete","aria-label":`删除草稿 ${e.name}`,onClick:()=>u==null?void 0:u(e.draft),children:"删除"})]}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"my-agent-details",disabled:!d,"aria-label":a?`查看 ${e.name} 部署进度`:`查看 ${e.name} 详情`,onClick:()=>a?l==null?void 0:l(a):n==null?void 0:n(e),children:a?"查看进度":"查看详情"}),o.jsx("button",{type:"button",className:`my-agent-use${i?" is-connected":""}`,disabled:!d||s||i,"aria-busy":s||void 0,"aria-label":i?`${e.name} 已连接`:`使用 ${e.name}`,onClick:()=>void(t==null?void 0:t(e)),children:s?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-use-spinner","aria-hidden":"true"}),o.jsx("span",{children:"连接中"})]}):i?"已连接":"使用"})]})})]})}function U_e({canCreate:e,runtimeScope:t,onCreateAgent:n,onUseAgent:s,onViewAgentDetails:i,onCreateSandboxAgent:r,onUseSandboxAgent:a,onViewSandboxAgentDetails:l,sandboxRefreshKey:c=0,connectedRuntimeId:u="",hiddenRuntimeIds:d=j_e,drafts:f=[],deploymentTasks:h=[],draftDeploymentTaskIds:p={},onViewDeploymentTask:m,onEditDraft:b,onDeleteDraft:v}){const y=g.useRef(null),x=g.useRef(null),E=g.useRef(0),w=g.useRef(0),_=g.useRef(null),[S,k]=g.useState("general"),[T,C]=g.useState(""),[I,j]=g.useState([]),[L,z]=g.useState(""),[D,F]=g.useState(!0),[A,O]=g.useState(""),[P,$]=g.useState([]),[R,Y]=g.useState(!1),[J,U]=g.useState(""),[te,K]=g.useState(""),[V,W]=g.useState(null),q=g.useMemo(()=>f.map(D_e),[f]),ue=g.useMemo(()=>{const _e=new Map,He=new Map;for(const Pe of h){if(Pe.status!=="running"||(_e.set(Pe.id,Pe),!Pe.runtimeId))continue;const qe=He.get(Pe.runtimeId);(!qe||Pe.startedAt>qe.startedAt)&&He.set(Pe.runtimeId,Pe)}return{byId:_e,byRuntimeId:He}},[h]),me=g.useCallback(_e=>{var Pe;if(_e.draft){const qe=p[_e.draft.id];return qe?ue.byId.get(qe):void 0}const He=(Pe=_e.runtime)==null?void 0:Pe.runtimeId;return He?ue.byRuntimeId.get(He):void 0},[ue,p]),Se=g.useCallback((_e,He)=>{const Pe=++E.current;return F(!0),O(""),P_e(t,_e,qe=>{E.current===Pe&&j(Z=>He?qe:[...Z,...qe])}).then(qe=>{E.current===Pe&&z(qe)}).catch(qe=>{E.current===Pe&&O(Od(qe,"加载通用智能体","GET /web/runtimes"))}).finally(()=>{E.current===Pe&&F(!1)})},[t]);g.useEffect(()=>{if(S==="general")return j([]),z(""),Se("",!0),()=>{E.current+=1}},[S,Se]);const de=g.useCallback(async _e=>{var qe,Z;(qe=_.current)==null||qe.abort();const He=new AbortController;_.current=He;const Pe=++w.current;Y(!0),U(""),$([]);try{const ae=_e==="codex"?await sn.listSessions({signal:He.signal}):await sn.listAgentSessions(_e,{signal:He.signal});if(w.current!==Pe)return;$(ae.map(L_e))}catch(ae){if((ae==null?void 0:ae.name)==="AbortError"||w.current!==Pe)return;U(Od(ae,`加载 ${((Z=Ew.find(ne=>ne.id===_e))==null?void 0:Z.label)??_e}`,`GET /web/${_e==="codex"?"sandbox":_e}/sessions`))}finally{_.current===He&&(_.current=null),w.current===Pe&&Y(!1)}},[]);function ge(_e){var He;_e!==S&&(_e==="general"?(E.current+=1,j([]),z(""),O(""),F(!0)):((He=_.current)==null||He.abort(),_.current=null,w.current+=1,$([]),U(""),Y(!0)),k(_e))}g.useEffect(()=>{var _e;if(S==="general"){(_e=_.current)==null||_e.abort(),_.current=null,w.current+=1;return}return de(S),()=>{var He;(He=_.current)==null||He.abort(),_.current=null,w.current+=1}},[S,de,c]),g.useEffect(()=>{const _e=x.current,He=y.current;if(!_e||!He||S!=="general"||!L||D)return;const Pe=new IntersectionObserver(([qe])=>{qe.isIntersecting&&Se(L,!1)},{root:He,rootMargin:"240px 0px",threshold:.01});return Pe.observe(_e),()=>Pe.disconnect()},[S,Se,D,L]);const Me=g.useCallback(async _e=>{if(!te){K(_e.id);try{await new Promise(He=>requestAnimationFrame(()=>He())),_e.sandbox?await a(_e.sandbox):await s(_e)}finally{K("")}}},[te,s,a]),ve=g.useMemo(()=>{const _e=T.trim().toLocaleLowerCase(),He=S==="general"?[...q,...I]:P,Pe=_e?He.filter(ae=>ae.name.toLocaleLowerCase().includes(_e)):He;if(S!=="general")return Pe;const qe=d.size>0?Pe.filter(ae=>!ae.runtime||!d.has(ae.runtime.runtimeId)):Pe,Z=qe.findIndex(ae=>{var ne;return((ne=ae.runtime)==null?void 0:ne.runtimeId)===u});return Z<=0?qe:[qe[Z],...qe.slice(0,Z),...qe.slice(Z+1)]},[S,u,q,d,T,I,P]),re=Ew.find(_e=>_e.id===S),ke=(re==null?void 0:re.label)??"智能体",we=S==="general"?D&&I.length===0&&q.length===0:R&&P.length===0,Je=!we&&ve.length===0,Le=e?S==="general"?()=>n(i3):()=>r(S):void 0,Ve=e?void 0:"当前账号没有创建智能体权限";return o.jsxs("div",{className:"my-agents-page",children:[o.jsxs("header",{className:"my-agents-header",children:[o.jsxs("div",{className:"my-agents-heading",children:[o.jsx("div",{className:"my-agents-title-row",children:o.jsx("h1",{children:"智能体"})}),o.jsx("p",{children:t==="all"?"在此处浏览所有智能体":"在此处浏览您的所有智能体"})]}),o.jsxs("label",{className:"my-agent-search",children:[o.jsx(R_e,{}),o.jsx("input",{type:"search","aria-label":"搜索智能体",value:T,onChange:_e=>C(_e.target.value),placeholder:"搜索所有类型智能体名称"})]})]}),o.jsxs("div",{className:"my-agent-type-bar",children:[o.jsx("nav",{className:"my-agent-type-pills","aria-label":"智能体类型",children:Ew.map(_e=>o.jsx("button",{type:"button",className:`my-agent-type-pill${S===_e.id?" is-active":""}`,"aria-pressed":S===_e.id,onClick:()=>ge(_e.id),children:_e.label},_e.id))}),o.jsxs("button",{type:"button",className:"my-agent-create-primary",disabled:!Le,title:Ve,onClick:()=>Le==null?void 0:Le(),children:[o.jsx(vw,{}),o.jsx("span",{children:"创建智能体"})]})]}),o.jsxs("section",{className:"my-agent-results",ref:y,"aria-label":`${ke}列表`,children:[we?o.jsxs("div",{className:"my-agent-initial-loading",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载智能体"})]}):(S==="general"?A:J)&&ve.length===0?o.jsxs("div",{className:"my-agent-empty",role:"alert",children:[o.jsx("p",{children:S==="general"?A:J}),o.jsx("button",{type:"button",onClick:()=>{S==="general"?Se("",!0):de(S)},children:"重新加载"})]}):Je?T.trim()?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(ns,{fill:"none",children:[o.jsx(ns.Icon,{children:o.jsx(l_e,{})}),o.jsx(ns.Title,{children:"没有匹配的智能体"}),o.jsx(ns.Description,{children:"请尝试搜索其他名称"})]})}):S!=="general"?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(ns,{fill:"none",children:[o.jsx(ns.Icon,{children:o.jsx(O_e,{type:S})}),o.jsxs(ns.Title,{children:["暂无 ",ke]}),e?o.jsx(ns.ActionRow,{children:o.jsxs(ZL,{color:"primary",size:"lg",onClick:()=>r(S),children:[o.jsx(vw,{}),"创建智能体"]})}):null]})}):o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(ns,{fill:"none",children:[o.jsx(ns.Icon,{children:o.jsx(Yc,{})}),o.jsx(ns.Title,{children:"暂无通用智能体"}),o.jsx(ns.Description,{children:"创建一个通用智能体,开始构建和对话"}),e?o.jsx(ns.ActionRow,{children:o.jsxs(ZL,{color:"primary",size:"lg",onClick:()=>n(i3),children:[o.jsx(vw,{}),"创建智能体"]})}):null]})}):o.jsxs(o.Fragment,{children:[S==="general"&&A?o.jsxs("div",{className:"my-agent-inline-error",role:"alert",children:[o.jsx("span",{children:A}),o.jsx("button",{type:"button",onClick:()=>void Se("",!0),children:"重新加载"})]}):null,o.jsx("div",{className:"my-agent-grid",children:ve.map(_e=>{var He;return o.jsx(B_e,{agent:_e,deploymentTask:me(_e),onViewDeploymentTask:m,onUse:Me,onViewDetails:Pe=>{Pe.sandbox?l(Pe.sandbox):i(Pe)},connecting:_e.id===te,connected:((He=_e.runtime)==null?void 0:He.runtimeId)===u,showOwnership:t==="all",onEditDraft:b,onDeleteDraft:W},_e.id)})})]}),S==="general"&&!A&&!we&&(ve.length>0||!!L)&&o.jsx("div",{className:"my-agent-load-more",ref:x,"aria-live":"polite",children:D?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载更多智能体"})]}):L?o.jsx("span",{children:"继续下滑加载更多"}):o.jsx("span",{children:"已加载全部智能体"})})]}),V?o.jsx(zA,{title:"删除草稿?",description:`删除后将无法恢复“${V.draft.name||"未命名 Agent"}”。`,confirmLabel:"删除草稿",variant:"danger",onCancel:()=>W(null),onConfirm:()=>{v==null||v(V),W(null)}}):null]})}const F_e={id:"coding-agents",kind:"coding-agent",category:"development",icon:"coding-agents",name:"配置 Coding Agents",badge:"本地",badgeTone:"success",description:"将 VeADK 和 AgentKit 内置 Skills 全局配置到 Trae、Claude Code 或 Codex。"},$_e={id:"feishu",kind:"feishu",category:"channels",icon:"feishu",name:"飞书机器人",badge:"Beta",description:"创建飞书机器人,并将消息直接接入 AgentKit Runtime。"},H_e="https://api.github.com",z_e=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,a3=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,199}$/,V_e=/^[A-Za-z0-9._/-]+$/;function G_e(e,t,n){return e===401||e===403?"GitHub Token 无效或没有仓库写入权限":e===404?"仓库、分支或文件不存在,或 Token 无权访问":e===422?"GitHub 拒绝了提交,请检查分支和文件状态":String((t==null?void 0:t.message)||"").split(n).join("***").trim().slice(0,240)||`GitHub 请求失败(HTTP ${e})`}async function Ec(e,t){const n={Accept:"application/vnd.github+json",Authorization:`Bearer ${t.token}`,"X-GitHub-Api-Version":"2022-11-28"};t.body&&(n["Content-Type"]="application/json");let s;try{s=await fetch(`${H_e}${e}`,{method:t.method||"GET",headers:n,body:t.body?JSON.stringify(t.body):void 0,signal:t.signal})}catch(r){throw t.signal.aborted?r:new Error("连接 GitHub 失败,请检查网络后重试")}const i=await s.json().catch(()=>null);if(!t.expected.includes(s.status))throw new Error(G_e(s.status,i,t.token));return{status:s.status,payload:i}}function ww(e){return e.split("/").map(encodeURIComponent).join("/")}function K_e(e){const t=new TextEncoder().encode(e);let n="";const s=32768;for(let i=0;i({...h,path:GA(h.path,"")})),r=AbortSignal.any([t,AbortSignal.timeout(6e4)]),a=`/repos/${n}`;await Ec(`${a}`,{token:e.token,expected:[200],signal:r});const c=(f=(await Ec(`${a}/git/ref/heads/${ww(s)}`,{token:e.token,expected:[200],signal:r})).payload.object)==null?void 0:f.sha;if(!c)throw new Error("目标分支缺少有效 Git SHA");const u=q_e(e.branchPrefix);await Ec(`${a}/git/refs`,{token:e.token,expected:[201],signal:r,method:"POST",body:{ref:`refs/heads/${u}`,sha:c}});let d=!0;try{for(const p of i){const m=ww(p.path),b=await Ec(`${a}/contents/${m}?ref=${encodeURIComponent(s)}`,{token:e.token,expected:[200,404],signal:r});if(p.mustBeNew&&b.status===200)throw new Error(`目标仓库中已存在 ${p.path},未覆盖现有文件`);if(b.status===200&&!b.payload.sha)throw new Error(`目标路径 ${p.path} 不是可更新的文件`);await Ec(`${a}/contents/${m}`,{token:e.token,expected:[200,201],signal:r,method:"PUT",body:{message:p.commitMessage,content:K_e(p.content),branch:u,...b.payload.sha?{sha:b.payload.sha}:{}}})}const h=await Ec(`${a}/pulls`,{token:e.token,expected:[201],signal:r,method:"POST",body:{title:e.title,head:u,base:s,body:e.description}});if(!h.payload.number||!h.payload.html_url)throw new Error("GitHub 未返回有效的 Pull Request");return d=!1,{number:h.payload.number,url:h.payload.html_url,branch:u}}finally{d&&await Ec(`${a}/git/refs/heads/${ww(u)}`,{token:e.token,expected:[204],signal:AbortSignal.timeout(15e3),method:"DELETE"}).catch(()=>{})}}const qA={name:"repository",label:"GitHub Repo",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL",required:!0},YA={name:"baseBranch",label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base",required:!1},W$={name:"runtimeName",label:"Runtime 名称",placeholder:"support-agent",help:"用于 AgentKit 发布配置",required:!0},X$={name:"runtimeId",label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"持续更新的目标 AgentKit Runtime",required:!0};function WA(e={}){return{repository:"",baseBranch:"main",projectPath:".",runtimeName:"",runtimeId:"",sandboxToolId:"",modelName:"",modelBaseUrl:"https://ark.cn-beijing.volces.com/api/coding/v3",region:"cn-beijing",token:"",...e}}function XA(e){return{repository:e.repository.trim(),baseBranch:e.baseBranch.trim()||"main",region:e.region,token:e.token.trim()}}const Y_e=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/,W_e=/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/;function X_e(e){if(!Y_e.test(e.sandboxToolId))throw new Error("Sandbox Tool ID 格式不正确");if(!W_e.test(e.modelName))throw new Error("模型名称格式不正确");let t;try{t=new URL(e.modelBaseUrl)}catch{throw new Error("模型 API 地址必须是安全的 HTTPS URL")}if(t.protocol!=="https:"||!t.hostname||t.username||t.password||t.search||t.hash)throw new Error("模型 API 地址必须是安全的 HTTPS URL")}function Q_e(e){X_e(e);const t=String.raw`name: PR Automated Review +`),h=(t==null?void 0:t.pendingMessage)||"正在等待构建日志…";if(g.useEffect(()=>{t&&r(s)},[e.id,t==null?void 0:t.status,s]),g.useEffect(()=>{if(!i||!c)return;const x=n.current;x&&(x.scrollTop=x.scrollHeight)},[i,c,f]),!t||!t.text&&t.status!=="error"&&!t.pendingMessage)return null;const p=ASe(t.updatedAt),m=t.status==="complete"?"已同步":t.status==="error"?"读取失败":"同步中",b=t.omittedEarly?"已省略早期日志":t.snapshotTruncated?"仅显示最近的构建日志":t.truncated?"已省略部分日志":"",v=[m,t.lineCount?`${t.lineCount} 行`:"",b,p].filter(Boolean).join(" · ");async function y(){try{await navigator.clipboard.writeText(u),l(!0),window.setTimeout(()=>l(!1),1500)}catch{l(!1)}}return o.jsxs("section",{className:`aw-deploy-log is-${t.status}${i?"":" is-collapsed"}`,"aria-label":"构建日志",children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("strong",{children:"构建日志"}),o.jsx("span",{children:v})]}),o.jsxs("div",{className:"aw-deploy-log-actions",children:[c&&o.jsx("button",{type:"button",onClick:()=>r(x=>!x),children:i?"收起":"展开"}),c&&o.jsxs("button",{type:"button",onClick:()=>void y(),"aria-label":a?"已复制构建日志":"复制构建日志",title:a?"已复制":"复制构建日志",children:[a?o.jsx(ja,{"aria-hidden":!0}):o.jsx(e1,{"aria-hidden":!0}),o.jsx("span",{children:a?"已复制":"复制"})]})]})]}),i&&(c?o.jsx("pre",{ref:n,children:f}):o.jsx("div",{className:"aw-deploy-log-empty",children:h}))]})}function ISe({task:e}){const t=H$(e),n=z$(e),s=e.status==="success"?100:Math.max(6,Math.min(100,e.pct??6)),i=e.status==="running"?"正在部署":e.status==="success"?"部署完成":e.status==="error"?"部署失败":"部署已取消";return o.jsxs("section",{className:`aw-deploy-progress-card is-${e.status}`,"aria-live":"polite",children:[o.jsxs("div",{className:"aw-deploy-progress-head",children:[o.jsxs("div",{children:[o.jsx("span",{className:"aw-deploy-progress-icon","aria-hidden":!0,children:e.status==="running"?o.jsx(dn,{className:"spin"}):e.status==="success"?o.jsx(ZJ,{}):e.status==="error"?o.jsx(kk,{}):o.jsx(vR,{})}),o.jsxs("div",{children:[o.jsx("h3",{children:i}),o.jsx("p",{children:e.runtimeName})]})]}),o.jsx("strong",{children:e.status==="running"?`${Math.round(s)}%`:e.label})]}),o.jsx("div",{className:"aw-deploy-progress-track",role:"progressbar","aria-label":"部署进度","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(s),children:o.jsx("span",{style:{width:`${s}%`}})}),o.jsx("ol",{className:"aw-deploy-steps",children:t.map((r,a)=>{const l=e.status==="success"||anew Set),[Kn,xt]=g.useState(()=>new Set),[$t,hn]=g.useState(!1),[cn,Pt]=g.useState(""),[jt,Sn]=g.useState(null),[pn,zt]=g.useState([]),[Fn,hs]=g.useState([]),[ps,Rn]=g.useState(!1),[$s,ms]=g.useState(""),[$n,Hs]=g.useState(0),[Hn,js]=g.useState([]),[_n,ss]=g.useState(!1),[is,_s]=g.useState(""),[gs,zs]=g.useState(0),[bs,On]=g.useState(!1),[Nn,ce]=g.useState(()=>new Set),[Ae,Re]=g.useState(!1),[Je,st]=g.useState(""),[ot,kt]=g.useState(""),[Mn,Tn]=g.useState(()=>new Set),qt=g.useRef(!1),pi=g.useRef(""),Pe=g.useRef(null),Vt=g.useRef(0),vt=g.useRef(0),[qn,ys]=g.useState(fSe),[aa,Da]=g.useState("");g.useEffect(()=>{e.length!==0&&ys($=>$.map((oe,fe)=>fe===0&&oe.agentIds.length===0?{...oe,agentIds:e.slice(0,2).map(Ce=>Ce.id)}:oe))},[e]);const Js=g.useMemo(()=>{const $=new Map;for(const oe of e)oe.runtimeId&&$.set(oe.runtimeId,oe);return $},[e]),mi=g.useMemo(()=>{var oe;const $=new Map;for(const fe of t){const Ce=(oe=fe.deploymentTarget)==null?void 0:oe.runtimeId;if(!Ce||!Js.has(Ce))continue;const nt=$.get(Ce);(!nt||fe.updatedAt>nt.updatedAt)&&$.set(Ce,fe)}return $},[Js,t]),oa=g.useMemo(()=>{const $=new Map;for(const oe of d){if(!oe.runtimeId)continue;const fe=$.get(oe.runtimeId);(!fe||oe.startedAt>fe.startedAt)&&$.set(oe.runtimeId,oe)}return $},[d]),al=g.useMemo(()=>{const $=Fe.trim().toLowerCase();return $?e.filter(oe=>{const fe=oe.runtimeId?mi.get(oe.runtimeId):void 0,Ce=oe.runtimeId?oa.get(oe.runtimeId):void 0;return[oe.label,oe.app,oe.host??"",(fe==null?void 0:fe.draft.name)??"",(fe==null?void 0:fe.draft.description)??"",(Ce==null?void 0:Ce.runtimeName)??""].join(" ").toLowerCase().includes($)}):e},[e,oa,Fe,mi]),Wi=g.useMemo(()=>{const $=Fe.trim().toLowerCase();return t.filter(oe=>{var Ce;const fe=(Ce=oe.deploymentTarget)==null?void 0:Ce.runtimeId;return fe&&Js.has(fe)?!1:$?`${oe.draft.name} ${oe.draft.description}`.toLowerCase().includes($):!0})},[Js,t,Fe]),Mu=g.useMemo(()=>t.filter($=>{var fe;const oe=(fe=$.deploymentTarget)==null?void 0:fe.runtimeId;return!oe||!Js.has(oe)}).length,[Js,t]),pc=g.useMemo(()=>{const $=Fe.trim().toLowerCase();return $?qn.filter(oe=>oe.name.toLowerCase().includes($)):qn},[qn,Fe]),re=e.find($=>$.id===A),wt=t.find($=>$.id===P),mn=f?d.find($=>$.id===f):void 0,Ns=re!=null&&re.runtimeId?mi.get(re.runtimeId):void 0,nn=v?Z:A&&i===A?s:null,Ts=(nn==null?void 0:nn.appName)||(re==null?void 0:re.runtimeApp)||(re==null?void 0:re.app)||"",se=`${(re==null?void 0:re.region)??"cn-beijing"}:${(re==null?void 0:re.runtimeId)??""}`,Te=(de==null?void 0:de.requestKey)===se?de.value:"",ze=(J==null?void 0:J.requestKey)===se?J:null,et=!!((t0=ze==null?void 0:ze.apiApps)!=null&&t0.length),gn=!!(ze!=null&&ze.a2a),rs=((Uu=ze==null?void 0:ze.apiApps)==null?void 0:Uu[0])??Ts,Me=(R==null?void 0:R.endpoint)??"",Rs=hSe(((ti=ze==null?void 0:ze.a2a)==null?void 0:ti.endpoint)??"",Me),xs=JSON.stringify([(re==null?void 0:re.runtimeId)??"",(re==null?void 0:re.region)??""]),Zt=(De==null?void 0:De.requestKey)===xs?De.value:null;g.useEffect(()=>{const $=Vt.current+1;Vt.current=$,Ke(null),qe("");const oe=(re==null?void 0:re.runtimeId)??"",fe=(re==null?void 0:re.region)??"";if(!l||!oe||!fe){He(!1);return}const Ce=new AbortController;return He(!0),f8({runtimeId:oe,region:fe,signal:Ce.signal}).then(nt=>{var ht;if($===Vt.current){if(nt.runtime.runtimeId!==oe||nt.runtime.region!==fe||nt.canUpdate&&!((ht=nt.agent)!=null&&ht.appName)){qe("Runtime 更新能力响应与当前选择不匹配。");return}Ke({requestKey:xs,value:nt})}}).catch(nt=>{$!==Vt.current||Ce.signal.aborted||qe(nt instanceof Error?nt.message:"检查 Runtime 更新能力失败。")}).finally(()=>{$===Vt.current&&!Ce.signal.aborted&&He(!1)}),()=>Ce.abort()},[l,re==null?void 0:re.region,re==null?void 0:re.runtimeId,xs]);const mt=g.useMemo(()=>{const $=new Map(e.map((fe,Ce)=>[fe.id,Ce])),oe=new Map(n.map((fe,Ce)=>[fe,Ce]));return[...al].sort((fe,Ce)=>{const nt=fe.runtimeId?oa.get(fe.runtimeId):void 0,ht=Ce.runtimeId?oa.get(Ce.runtimeId):void 0,bn=(nt==null?void 0:nt.status)==="running"?nt.startedAt:0,la=(ht==null?void 0:ht.status)==="running"?ht.startedAt:0;if(bn!==la)return la-bn;const un=oe.get(fe.id),fr=oe.get(Ce.id);return un!=null&&fr!=null?un-fr:un!=null?-1:fr!=null?1:($.get(fe.id)??0)-($.get(Ce.id)??0)})},[n,e,al,oa]),as=(re==null?void 0:re.label)||(nn==null?void 0:nn.name)||(wt==null?void 0:wt.draft.name)||(mn==null?void 0:mn.runtimeName)||"未选择智能体",Bi=qn.find($=>$.id===aa),uo=mt.filter($=>$.canDelete===!0),Lu=mt.filter($=>bt.has($.id)&&$.canDelete===!0),fo=Wi.filter($=>Kn.has($.id)),Fg=uo.length+Wi.length,Pa=Lu.length+fo.length,gi=g.useMemo(()=>(mn==null?void 0:mn.agentDraft)??(wt==null?void 0:wt.draft)??(Ns==null?void 0:Ns.draft)??bSe(nn,(re==null?void 0:re.label)??"agent"),[nn,re==null?void 0:re.label,Ns==null?void 0:Ns.draft,wt==null?void 0:wt.draft,mn==null?void 0:mn.agentDraft]),ho=wt?a?"":"当前账号没有新建 Agent 的权限。":l?re!=null&&re.runtimeId?re.region?Se?"正在检查 Runtime 更新能力…":Be||(Zt?Zt.canUpdate?(vh=Zt.agent)!=null&&vh.appName?"":"Runtime 更新能力响应缺少智能体信息。":Zt.reason||"当前 Runtime 不支持原地更新。":"尚未完成 Runtime 更新能力检查。"):"Runtime 缺少地域信息,无法更新。":"仅支持更新已部署的云端智能体。":"当前账号没有管理 Agent 的权限。",bh="aw-update-disabled-reason",$g=Zt!=null&&Zt.agent?{runtimeId:Zt.runtime.runtimeId,name:Zt.runtime.name,region:Zt.runtime.region,appName:Zt.agent.appName,currentVersion:Zt.runtime.currentVersion}:Ns==null?void 0:Ns.deploymentTarget,Hg=g.useMemo(()=>{if(nn)return nn.tools;const $=(gi.builtinTools??[]).map(oe=>{var fe;return((fe=Nu.find(Ce=>Ce.id===oe))==null?void 0:fe.label)??oe});return Array.from(new Set([...gi.tools,...$,...(gi.customTools??[]).map(oe=>oe.name),...(gi.mcpTools??[]).map(oe=>oe.name)].filter(Boolean)))},[gi,nn]),po=g.useMemo(()=>nn?nn.skillsPreviewSupported?nn.skills.map($=>$.name):null:Array.from(new Set([...(gi.selectedSkills??[]).map($=>$.name),...gi.skills].filter(Boolean))),[gi,nn]),ei=g.useMemo(()=>{if(mn)return mn;if(wt)return d.filter($=>{var oe,fe;return((oe=$.agentDraft)==null?void 0:oe.name)===wt.draft.name||$.runtimeName===wt.draft.name||!!((fe=wt.deploymentTarget)!=null&&fe.runtimeId)&&$.runtimeId===wt.deploymentTarget.runtimeId}).sort(($,oe)=>oe.startedAt-$.startedAt)[0];if(re)return d.filter($=>!!re.runtimeId&&$.runtimeId===re.runtimeId||$.runtimeName===re.label).sort(($,oe)=>oe.startedAt-$.startedAt)[0]},[d,re,wt,mn]),dE=!!(f&&ei&&ei.id===f),zg=!!(ei&&(ei.status!=="success"||dE)),Vg=g.useMemo(()=>_Se(gi),[gi]),Ba=(re==null?void 0:re.currentVersion)??(R==null?void 0:R.currentVersion)??null,fE=Ba??(mn==null?void 0:mn.startedAt)??"unknown",Gg=nn?`runtime:${(re==null?void 0:re.runtimeId)??nn.name}:v${fE}:${Vg}`:`draft:${(mn==null?void 0:mn.id)??(wt==null?void 0:wt.id)??(re==null?void 0:re.id)??as}:${Vg}`;g.useEffect(()=>{if(!f)return;const $=d.find(fe=>fe.id===f),oe=$!=null&&$.runtimeId?Js.get($.runtimeId):void 0;if(oe){H(""),M(oe.id),F("basic");return}M(""),H(""),F("basic")},[Js,d,f]),g.useEffect(()=>{if(!h){pi.current="";return}const $=`${h}:${p}:${m}`;pi.current!==$&&e.some(oe=>oe.id===h)&&(pi.current=$,H(""),M(h),F(p),p==="evaluations"&&(ft(m),Et("")))},[e,h,p,m]),g.useEffect(()=>{for(const $ of mt.slice(0,8)){if(!$.runtimeId)continue;const oe=$.region??"cn-beijing";p8($.runtimeId,oe),JB($.runtimeId,oe,$.runtimeApp??""),Ky($.runtimeId,oe,$.runtimeApp??"").then(fe=>{const Ce=fe.appName||$.app;Ce&&b_({runtimeId:$.runtimeId??"",region:oe,appName:Ce,pageSize:100})}).catch(()=>{})}},[mt]),g.useEffect(()=>{!(re!=null&&re.runtimeId)||!Ts||b_({runtimeId:re.runtimeId,region:re.region??"cn-beijing",appName:Ts,pageSize:100})},[Ts,re==null?void 0:re.region,re==null?void 0:re.runtimeId]),g.useEffect(()=>{let $=!1;const oe=(re==null?void 0:re.runtimeId)??"",fe=(re==null?void 0:re.region)??"cn-beijing",Ce=(re==null?void 0:re.runtimeApp)??"",nt=oe?ZB(oe,fe,Ce):null;if(ae(nt),xe(!!nt||!v||!oe),!(!v||!oe))return Ky(oe,fe,Ce,{force:!0}).then(ht=>{$||ae(ht)}).catch(()=>{!$&&!nt&&ae(null)}).finally(()=>{$||xe(!0)}),()=>{$=!0}},[v,re==null?void 0:re.currentVersion,re==null?void 0:re.region,re==null?void 0:re.runtimeApp,re==null?void 0:re.runtimeId]),g.useEffect(()=>{let $=!1;const oe=(re==null?void 0:re.runtimeId)??"",fe=(re==null?void 0:re.region)??"cn-beijing";if(js([]),_s(""),D!=="optimizations"||!oe){ss(!1);return}if(v&&!Ts){ss(!ne);return}return ss(!0),BB({runtimeId:oe,region:fe,appName:Ts}).then(Ce=>{$||js(Ce.groups)}).catch(Ce=>{$||_s(Ce instanceof Error?Ce.message:String(Ce))}).finally(()=>{$||ss(!1)}),()=>{$=!0}},[ne,v,gs,D,Ts,re==null?void 0:re.region,re==null?void 0:re.runtimeId]),g.useEffect(()=>{vt.current+=1,ge(null),Ee(!1),Ne(!1),Qe(""),we("api-server")},[se,D]);function Kg(){vt.current+=1,ge(null),Ee(!1),Ne(!1),Qe("")}function mo($){$!==pe&&(Kg(),we($))}async function qg(){if(Le){Kg();return}const $=(re==null?void 0:re.runtimeId)??"",oe=(re==null?void 0:re.region)??"cn-beijing";if(!$)return;const fe=vt.current+1;vt.current=fe,Ne(!0),Qe("");try{const Ce=await u8($,oe);if(fe!==vt.current)return;ge({requestKey:se,value:Ce}),Ee(!0)}catch(Ce){if(fe!==vt.current)return;ge(null),Ee(!1),Qe(Ce instanceof Error?Ce.message:"读取 Runtime API Key 失败。")}finally{fe===vt.current&&Ne(!1)}}g.useEffect(()=>{let $=!1;const oe=(re==null?void 0:re.runtimeId)??"",fe=(re==null?void 0:re.region)??"cn-beijing",Ce=oe?h8(oe,fe):null;if(Y(Ce),!!oe)return Kk(oe,fe,{force:!0}).then(nt=>{$||Y(nt)}).catch(()=>{!$&&!Ce&&Y(null)}),()=>{$=!0}},[re==null?void 0:re.currentVersion,re==null?void 0:re.region,re==null?void 0:re.runtimeId]),g.useEffect(()=>{let $=!1;const oe=(re==null?void 0:re.runtimeId)??"",fe=(re==null?void 0:re.region)??"cn-beijing",Ce=`${fe}:${oe}`;if(W(""),D!=="integrations"||!oe){K(!1),oe||U(null);return}K(!0);const nt=Gk(oe,fe,{retryProbe:!0}).catch(ht=>{if(ht instanceof Sr&&ht.unsupported)return null;throw ht});return Promise.all([nt,c8(oe,fe,{retryProbe:!0})]).then(([ht,bn])=>{$||U({requestKey:Ce,apiApps:ht,a2a:bn})}).catch(ht=>{$||(U(null),W(ht instanceof Error?ht.message:"探测集成方式失败。"))}).finally(()=>{$||K(!1)}),()=>{$=!0}},[q,D,re==null?void 0:re.currentVersion,re==null?void 0:re.region,re==null?void 0:re.runtimeId]),g.useEffect(()=>{let $=!1;const oe=(re==null?void 0:re.runtimeId)??"",fe=(re==null?void 0:re.region)??"cn-beijing",Ce=oe&&Ts?UB({runtimeId:oe,region:fe,appName:Ts,pageSize:100}):null;if(zt(Ce?ZL(Ce):[]),hs((Ce==null?void 0:Ce.sets)??[]),ms(""),D!=="evaluations"||!oe){Rn(!1);return}if(v&&!Ts){Rn(!ne);return}return Rn(!Ce),o1({runtimeId:oe,region:fe,appName:Ts,pageSize:100},{force:!0}).then(nt=>{$||(hs(nt.sets),zt(ZL(nt)))}).catch(nt=>{$||ms(nt instanceof Error?nt.message:String(nt))}).finally(()=>{$||Rn(!1)}),()=>{$=!0}},[ne,v,$n,D,Ts,nn==null?void 0:nn.appName,re==null?void 0:re.region,re==null?void 0:re.runtimeId]),g.useEffect(()=>{const $=new Set(pn.map(oe=>oe.id));ce(oe=>{const fe=new Set([...oe].filter(Ce=>$.has(Ce)));return fe.size===oe.size?oe:fe}),Tn(oe=>{const fe=new Set([...oe].filter(Ce=>$.has(Ce)));return fe.size===oe.size?oe:fe}),ot&&!$.has(ot)&&kt("")},[pn,ot]),g.useEffect(()=>{On(!1),ce(new Set),Tn(new Set),st(""),kt("")},[re==null?void 0:re.runtimeId]),g.useEffect(()=>{const $=new Set(mt.filter(oe=>oe.canDelete===!0).map(oe=>oe.id));an(oe=>{const fe=new Set([...oe].filter(Ce=>$.has(Ce)));return fe.size===oe.size?oe:fe})},[mt]),g.useEffect(()=>{const $=new Set(Wi.map(oe=>oe.id));xt(oe=>{const fe=new Set([...oe].filter(Ce=>$.has(Ce)));return fe.size===oe.size?oe:fe})},[Wi]);const go=g.useMemo(()=>!b||!(re!=null&&re.runtimeId)||b.runtimeId!==re.runtimeId||Ts&&b.agentName&&b.agentName!==Ts?null:{...b,tag:b.kind==="good"?"Good case":"Bad case"},[b,re==null?void 0:re.runtimeId,Ts]),bo=g.useMemo(()=>re!=null&&re.runtimeId?go?[go,...pn.filter($=>$.id!==go.id&&(!$.messageId||$.messageId!==go.messageId))]:pn:dSe,[pn,go,re==null?void 0:re.runtimeId]),ol=bo.filter($=>{if($.kind!==It||($.source==="auto"?"auto":"user")!==Nt)return!1;const fe=fn.trim().toLowerCase();return fe?[$.input,$.output,$.referenceOutput,$.comment,$.tag??"",$.sessionId,$.messageId,$.userId,$.evaluationSetName].join(" ").toLowerCase().includes(fe):!0}),Ua=ol.filter($=>Nn.has($.id)),Yg=!!(re!=null&&re.runtimeId),Yn=$=>{ft($),Et(""),st("");const oe=bo.find(fe=>fe.kind===$);kt((oe==null?void 0:oe.id)??""),window.setTimeout(()=>{var fe;(fe=Pe.current)==null||fe.scrollIntoView({behavior:"smooth",block:"start"})},0)},hE=$=>{st(""),ce(oe=>{const fe=new Set(oe);return fe.has($.id)?fe.delete($.id):fe.add($.id),fe})},pE=()=>{st(""),ce(new Set(ol.map($=>$.id)))},mE=()=>{st(""),ce(new Set),On(!1)},Ui=$=>{Tn(oe=>{const fe=new Set(oe);return fe.has($)?fe.delete($):fe.add($),fe})},Wg=$=>{kt($.id),st(""),!(!$.sessionId||!$.messageId)&&(k==null||k($))},Du=async $=>{if(!(re!=null&&re.runtimeId)||!Ts||Ae||$.length===0)return;const oe=$.length===1?"确定删除这条反馈案例?原始聊天记录不会被删除。":`确定删除选中的 ${$.length} 条反馈案例?原始聊天记录不会被删除。`;if(!window.confirm(oe))return;const fe=$.map(nt=>nt.id),Ce=new Set(fe);Re(!0),st("");try{await HB({runtimeId:re.runtimeId,region:re.region??"cn-beijing",appName:Ts,itemIds:fe});const nt=new Map;for(const ht of $)nt.set(ht.kind,(nt.get(ht.kind)??0)+1);zt(ht=>ht.filter(bn=>!Ce.has(bn.id))),hs(ht=>ht.map(bn=>({...bn,itemCount:Math.max(0,bn.itemCount-(nt.get(bn.kind)??0))}))),ce(ht=>new Set([...ht].filter(bn=>!Ce.has(bn)))),Tn(ht=>new Set([...ht].filter(bn=>!Ce.has(bn)))),ot&&Ce.has(ot)&&kt(""),$.length>1&&On(!1),T==null||T($)}catch(nt){st(nt instanceof Error?nt.message:String(nt))}finally{Re(!1)}},Xg=$=>{ys(oe=>oe.map(fe=>fe.id===$.id?$:fe))},Qg=()=>{const $=new Set(e.map(Ce=>Ce.id)),oe=n.filter(Ce=>$.has(Ce)),fe=new Set(oe);return[...oe,...e.filter(Ce=>!fe.has(Ce.id)).map(Ce=>Ce.id)]},yh=($,oe,fe)=>{if(!x||$===oe)return;const Ce=Qg().filter(bn=>bn!==$),nt=Ce.indexOf(oe),ht=nt<0?Ce.length:fe==="after"?nt+1:nt;Ce.splice(ht,0,$),x(Ce)},Pu=($,oe)=>{if(!Ve||Ve===oe)return;const fe=$.currentTarget.getBoundingClientRect();ut(oe),_t($.clientY>fe.top+fe.height/2?"after":"before")},Bu=($,oe)=>{if(!x)return;const fe=Qg(),Ce=fe.indexOf($),nt=Math.max(0,Math.min(fe.length-1,Ce+oe));Ce<0||Ce===nt||(fe.splice(Ce,1),fe.splice(nt,0,$),x(fe))},gE=$=>{$.canDelete===!0&&(Pt(""),an(oe=>{const fe=new Set(oe);return fe.has($.id)?fe.delete($.id):fe.add($.id),fe}))},Zg=$=>{Pt(""),xt(oe=>{const fe=new Set(oe);return fe.has($.id)?fe.delete($.id):fe.add($.id),fe})},yo=()=>{Pt(""),an(new Set(uo.map($=>$.id))),xt(new Set(Wi.map($=>$.id)))},Ht=()=>{Pt(""),an(new Set),xt(new Set),We(!1)},Jg=()=>{if(Pa===0||$t)return;const $=Lu.length,oe=fo.length;Pt(""),Sn({kind:"selection",title:$===1&&oe===0?"删除 Agent?":$===0&&oe===1?"删除草稿?":"删除所选项目?",description:$===1&&oe===0?`"${Lu[0].label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`:$===0&&oe===1?`"${fo[0].draft.name||"未命名 Agent"}" 将从本地草稿中删除。`:`将删除选中的 ${Pa} 个项目。${$>0?`${$} 个云端 Runtime 将被永久删除,此操作不可撤销。`:"草稿删除后无法恢复。"}`,confirmLabel:$===0&&oe===1?"删除草稿":"删除所选",agents:Lu,drafts:fo})},e0=async()=>{if(!(!jt||$t)){hn(!0),Pt("");try{if(jt.kind==="selection"){const{agents:$,drafts:oe}=jt;if($.length>0){if(!E)throw new Error("当前页面不支持删除已部署 Agent。");await E($)}oe.length>0&&(w==null||w(oe)),an(new Set),xt(new Set),We(!1),$.some(fe=>fe.id===A)&&M(""),oe.some(fe=>fe.id===P)&&H("")}else if(jt.kind==="agent"){if(!E)throw new Error("当前页面不支持删除已部署 Agent。");await E([jt.agent]),A===jt.agent.id&&M("")}else{if(!w)throw new Error("当前页面不支持删除草稿。");w([jt.draft]),P===jt.draft.id&&H("")}Sn(null)}catch($){Pt($ instanceof Error?$.message:String($))}finally{hn(!1)}}},bE=$=>{!E||$.canDelete!==!0||$t||(Pt(""),Sn({kind:"agent",title:"删除 Agent?",description:`"${$.label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`,confirmLabel:"删除 Agent",agent:$}))},xh=$=>{if(!w||$t)return;const oe=$.draft.name||"未命名 Agent";Pt(""),Sn({kind:"draft",title:"删除草稿?",description:`"${oe}" 将从本地草稿中删除。`,confirmLabel:"删除草稿",draft:$})},Eh=()=>{const $=`eval-${Date.now()}`,oe={id:$,name:`新评测组 ${qn.length+1}`,agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量"],concurrency:"4",history:[]};ys(fe=>[oe,...fe]),Da($)},yE=$=>{Xg({...$,history:[{id:`run-${Date.now()}`,createdAt:"刚刚",score:86+$.history.length%7,status:"completed"},...$.history]})};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`aw-root${v?" is-detail-only":""}`,children:[o.jsxs("nav",{className:"aw-view-tabs","aria-label":"智能体工作台",children:[o.jsx("button",{type:"button",className:L==="library"?"is-active":"","aria-pressed":L==="library",onClick:()=>{z("library"),at("")},children:"智能体库"}),o.jsx("button",{type:"button",className:L==="evaluation"?"is-active":"","aria-pressed":L==="evaluation",onClick:()=>{z("evaluation"),at("")},children:"评测"})]}),o.jsxs("div",{className:"aw-workspace-frame",children:[o.jsxs("div",{className:"aw-workspace","aria-hidden":L==="evaluation"||void 0,ref:$=>{$==null||$.toggleAttribute("inert",L==="evaluation")},children:[o.jsxs("aside",{className:"aw-sidebar","aria-label":L==="library"?"智能体列表":"评测组列表",children:[o.jsxs("label",{className:"aw-search",children:[o.jsx(Fy,{"aria-hidden":!0}),o.jsx("input",{value:Fe,onChange:$=>at($.currentTarget.value),placeholder:L==="library"?"搜索智能体":"搜索评测组","aria-label":L==="library"?"搜索智能体":"搜索评测组"})]}),o.jsxs("button",{type:"button",className:"aw-create-card",onClick:L==="library"?C:Eh,disabled:L==="library"&&!a,children:[o.jsx(_i,{"aria-hidden":!0}),o.jsx("span",{children:L==="library"?"新建 Agent":"新建评测组"})]}),L==="library"&&(E||w)&&o.jsx("div",{className:`aw-selection-toolbar${me?" is-active":""}`,children:me?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"aw-selection-count",children:["已选 ",Pa," 个"]}),o.jsx("button",{type:"button",onClick:yo,disabled:Fg===0||$t,children:"全选"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void Jg(),disabled:Pa===0||$t,children:$t?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:Ht,disabled:$t,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{Pt(""),We(!0)},disabled:Fg===0,children:"选择"})}),L==="library"&&cn&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:cn}),o.jsx("div",{className:"aw-agent-list",children:L==="evaluation"?pc.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的评测组"}):pc.map($=>o.jsxs("button",{type:"button",className:`aw-agent-item${$.id===aa?" is-active":""}`,onClick:()=>Da($.id),children:[o.jsxs("span",{className:"aw-agent-copy aw-eval-group-copy",children:[o.jsx("strong",{children:$.name}),o.jsxs("small",{children:[$.agentIds.length," 个智能体 · ",$.history.length," 次运行"]})]}),o.jsx(Dp,{"aria-hidden":!0})]},$.id)):c&&mt.length===0&&Wi.length===0?o.jsx("div",{className:"aw-list-empty",children:"正在读取云端智能体…"}):u&&mt.length===0&&Wi.length===0?o.jsxs("div",{className:"aw-list-empty aw-list-error",children:[o.jsx("span",{children:u}),y&&o.jsx("button",{type:"button",onClick:y,children:"重试"})]}):mt.length===0&&Wi.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的智能体"}):o.jsxs(o.Fragment,{children:[Wi.map($=>{const oe=d.filter(Ce=>{var nt,ht;return((nt=Ce.agentDraft)==null?void 0:nt.name)===$.draft.name||Ce.runtimeName===$.draft.name||!!((ht=$.deploymentTarget)!=null&&ht.runtimeId)&&Ce.runtimeId===$.deploymentTarget.runtimeId}).sort((Ce,nt)=>nt.startedAt-Ce.startedAt)[0],fe=Kn.has($.id);return o.jsxs("button",{type:"button",className:["aw-agent-item",me?"is-selecting":"",fe?"is-selected-for-delete":"",$.id===P?"is-active":""].filter(Boolean).join(" "),"aria-pressed":me?fe:void 0,onClick:()=>{if(me){Zg($);return}M(""),H($.id),F("basic")},children:[me&&o.jsx("span",{className:`aw-select-marker${fe?" is-checked":""}`,"aria-hidden":"true"}),o.jsxs("span",{className:"aw-agent-copy",children:[o.jsxs("span",{className:"aw-agent-name-row",children:[o.jsx("strong",{children:$.draft.name||"未命名 Agent"}),o.jsx("span",{className:`aw-draft-badge${(oe==null?void 0:oe.status)==="running"?" is-deploying":""}`,children:(oe==null?void 0:oe.status)==="running"?"部署中":"草稿"})]}),o.jsx("small",{children:$.deploymentTarget?"待更新":"尚未发布"})]}),o.jsx(Dp,{"aria-hidden":!0})]},$.id)}),mt.map($=>{const oe=$.runtimeId?oa.get($.runtimeId):void 0,fe=$.runtimeId?mi.get($.runtimeId):void 0,Ce=bt.has($.id),nt=$.canDelete===!0,ht=(oe==null?void 0:oe.status)==="running"?{label:"部署中",className:" is-deploying"}:(oe==null?void 0:oe.status)==="error"?{label:"失败",className:" is-error"}:(oe==null?void 0:oe.status)==="cancelled"?{label:"已取消",className:" is-muted"}:fe?{label:"待更新",className:""}:null,bn=(oe==null?void 0:oe.status)==="running"?"正在更新部署":fe?"待更新":$.remote?$.host||"远程智能体":"本地智能体",la=["aw-agent-item","aw-agent-item--sortable",$.id===A?"is-active":"",me?"is-selecting":"",Ce?"is-selected-for-delete":"",me&&!nt?"is-selection-disabled":"",$.id===Ve?"is-dragging":"",$.id===rt&&$.id!==Ve?`is-drop-target is-drop-${Ze}`:""].filter(Boolean).join(" ");return o.jsxs("button",{type:"button",draggable:!!x&&!me,className:la,"aria-pressed":me?Ce:void 0,"aria-keyshortcuts":x?"Alt+ArrowUp Alt+ArrowDown":void 0,onDragStart:un=>{x&&(qt.current=!0,Tt($.id),un.dataTransfer.effectAllowed="move",un.dataTransfer.setData("text/plain",$.id))},onDragEnter:un=>{Pu(un,$.id)},onDragOver:un=>{!Ve||Ve===$.id||(un.preventDefault(),un.dataTransfer.dropEffect="move",Pu(un,$.id))},onDragLeave:un=>{const fr=un.relatedTarget;fr instanceof Node&&un.currentTarget.contains(fr)||rt===$.id&&ut("")},onDrop:un=>{un.preventDefault();const fr=un.dataTransfer.getData("text/plain")||Ve;yh(fr,$.id,Ze),Tt(""),ut(""),_t("before")},onDragEnd:()=>{Tt(""),ut(""),_t("before"),window.setTimeout(()=>{qt.current=!1},0)},onKeyDown:un=>{un.altKey&&(un.key==="ArrowUp"?(un.preventDefault(),Bu($.id,-1)):un.key==="ArrowDown"&&(un.preventDefault(),Bu($.id,1)))},onClick:un=>{if(me){un.preventDefault(),gE($);return}if(qt.current){un.preventDefault(),qt.current=!1;return}H(""),M($.id),F("basic"),_($.id)},children:[me&&o.jsx("span",{className:`aw-select-marker${Ce?" is-checked":""}`,"aria-hidden":"true"}),o.jsxs("span",{className:"aw-agent-copy",children:[o.jsxs("span",{className:"aw-agent-name-row",children:[o.jsx("strong",{children:$.label}),$.currentVersion!=null&&o.jsxs("span",{className:"aw-version-badge",children:["v",$.currentVersion]}),ht&&o.jsx("span",{className:`aw-draft-badge${ht.className}`,children:ht.label})]}),o.jsx("small",{children:bn})]}),o.jsx(Dp,{"aria-hidden":!0})]},$.id)})]})}),o.jsxs("div",{className:"aw-list-count",children:["共 ",L==="library"?e.length+Mu:qn.length," 个"]})]}),L==="evaluation"&&Bi?o.jsx(LSe,{group:Bi,agents:e,cases:bo,onChange:Xg,onRun:yE}):L==="evaluation"?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择评测组"})}):!re&&!wt&&!mn?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择智能体"})}):o.jsxs("main",{className:"aw-main",children:[re&&!nn&&r&&o.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"aw-detail-loading-card",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:"正在加载智能体"}),o.jsx("small",{children:"正在读取配置与运行信息…"})]})]})}),D==="integrations"&&te&&o.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"aw-detail-loading-card",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:"正在探测接入方式"}),o.jsx("small",{children:"正在确认 API Server 与 A2A…"})]})]})}),o.jsxs("div",{className:"aw-agent-head",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"aw-agent-title-row",children:[o.jsx("h2",{children:as}),Ba!=null&&o.jsxs("span",{children:["v",Ba]}),wt&&o.jsx("span",{children:"草稿"}),Ns&&o.jsx("span",{children:"待更新"}),!re&&!wt&&mn&&o.jsx("span",{children:mn.label})]}),o.jsx("p",{children:gi.description||(r||v&&!ne?"正在读取智能体信息…":"暂无描述")})]}),(wt||Ns||(re==null?void 0:re.canDelete))&&o.jsxs("div",{className:"aw-head-actions",children:[(wt||Ns)&&o.jsxs("button",{type:"button",className:"aw-head-delete aw-head-delete--draft",onClick:()=>{const $=wt??Ns;$&&xh($)},disabled:$t,"aria-label":"删除草稿",title:"删除草稿",children:[o.jsx(sc,{"aria-hidden":!0}),o.jsx("span",{children:"删除草稿"})]}),(re==null?void 0:re.canDelete)&&o.jsxs("button",{type:"button",className:"aw-head-delete",onClick:()=>void bE(re),disabled:$t,"aria-label":"删除 Agent",title:"删除 Agent",children:[o.jsx(sc,{"aria-hidden":!0}),o.jsx("span",{children:$t?"删除中…":"删除 Agent"})]})]})]}),ei&&zg&&o.jsx("div",{className:"aw-detail-deployment",children:o.jsx(ISe,{task:ei})}),o.jsx("nav",{className:"aw-agent-tabs","aria-label":"智能体详情",role:"tablist",children:Xu.map($=>o.jsx("button",{type:"button",id:`agent-${$.id}-tab`,className:D===$.id?"is-active":"",role:"tab","aria-selected":D===$.id,"aria-controls":`agent-${$.id}-panel`,tabIndex:D===$.id?0:-1,onClick:()=>F($.id),onKeyDown:oe=>{var ht;if(!["ArrowLeft","ArrowRight","Home","End"].includes(oe.key))return;oe.preventDefault();const fe=Xu.findIndex(bn=>bn.id===$.id),Ce=oe.key==="Home"?0:oe.key==="End"?Xu.length-1:(fe+(oe.key==="ArrowRight"?1:-1)+Xu.length)%Xu.length,nt=Xu[Ce];F(nt.id),(ht=document.getElementById(`agent-${nt.id}-tab`))==null||ht.focus()},children:$.label},$.id))}),o.jsxs("div",{className:"aw-content",id:`agent-${D}-panel`,role:"tabpanel","aria-labelledby":`agent-${D}-tab`,children:[D==="basic"&&o.jsxs("div",{className:"aw-basic-stack",children:[o.jsxs("section",{className:"aw-deployment-panel aw-settings-card",children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:"部署配置"}),o.jsx("p",{children:"配置目标环境与网络访问方式。"})]})}),o.jsxs("dl",{className:"aw-readonly-config",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"运行状态"}),o.jsxs("dd",{className:(R==null?void 0:R.status.toLowerCase())==="ready"?"is-ready":void 0,children:[(R==null?void 0:R.status.toLowerCase())==="ready"&&o.jsx("span",{className:"aw-status-dot"}),(R==null?void 0:R.status)||"读取中…"]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"部署区域"}),o.jsx("dd",{children:(R==null?void 0:R.region)||(re==null?void 0:re.region)||(ei==null?void 0:ei.region)||"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"网络访问"}),o.jsx("dd",{children:R!=null&&R.networkTypes.length?R.networkTypes.join(" / "):"暂未提供"})]})]})]}),o.jsxs("section",{className:"aw-canvas-card",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:"执行流程"})}),o.jsx("div",{className:"aw-canvas",children:o.jsx(Om,{draft:gi,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},Gg)})]}),o.jsxs("section",{className:"aw-details-card",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:"详细信息"})}),o.jsxs("dl",{className:"aw-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"模型"}),o.jsx("dd",{children:(nn==null?void 0:nn.model)||gi.modelName||"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"智能体数量"}),o.jsx("dd",{children:nn!=null&&nn.graph?F$(nn.graph):$$(gi)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"工具"}),o.jsx("dd",{className:"aw-fact-badges",children:Hg.length?Hg.map($=>o.jsx("span",{children:$},$)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"技能"}),o.jsx("dd",{className:"aw-fact-badges",children:po===null?"暂不支持预览":po.length?po.map($=>o.jsx("span",{children:$},$)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:Ba!=null?`v${Ba}`:"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:wt?"草稿":(ei==null?void 0:ei.status)==="error"?"部署失败":(ei==null?void 0:ei.status)==="cancelled"?"已取消":Ns?"待更新":o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"aw-status-dot"}),"可用"]})})]})]})]})]}),D==="integrations"&&o.jsxs("div",{className:"aw-integration-stack",children:[o.jsxs("div",{className:"aw-integration-intro",children:[o.jsx("h3",{children:"接入方式"}),o.jsx("p",{children:"仅展示当前 Runtime 可确认的公开协议与地址。"})]}),V&&o.jsxs("div",{className:"aw-integration-error",role:"alert",children:[o.jsx("span",{children:V}),o.jsx("button",{type:"button",onClick:()=>ue($=>$+1),children:"重试"})]}),!V&&o.jsxs("div",{className:"aw-integration-body",children:[o.jsxs("div",{className:`aw-integration-protocol-tabs${pe==="a2a"?" is-a2a":""}`,role:"tablist","aria-label":"接入协议",children:[o.jsx("span",{className:"aw-integration-protocol-slider","aria-hidden":"true"}),Yh.map(($,oe)=>o.jsx("button",{type:"button",id:`integration-${$.id}-tab`,role:"tab","aria-selected":pe===$.id,"aria-controls":`integration-${$.id}-panel`,tabIndex:pe===$.id?0:-1,onClick:()=>mo($.id),onKeyDown:fe=>{var ht;if(!["ArrowLeft","ArrowRight","Home","End"].includes(fe.key))return;fe.preventDefault();const Ce=fe.key==="Home"?0:fe.key==="End"?Yh.length-1:(oe+(fe.key==="ArrowRight"?1:-1)+Yh.length)%Yh.length,nt=Yh[Ce];mo(nt.id),(ht=document.getElementById(`integration-${nt.id}-tab`))==null||ht.focus()},children:$.label},$.id))]}),pe==="api-server"?o.jsx(QL,{protocol:"api-server",title:"API Server",available:et,fields:[{label:"Agent",value:et?((ks=ze==null?void 0:ze.apiApps)==null?void 0:ks.join("、"))??"":""},{label:"发现接口",value:et?Ew(Me,"/list-apps"):""},{label:"调用接口",value:et?Ew(Me,"/run_sse"):""},{label:"鉴权方式",value:et?WL(R==null?void 0:R.authType):""},{label:"API Key",value:o.jsx(XL,{available:et,authType:R==null?void 0:R.authType,value:Te,visible:Le&&!!Te,loading:ie,error:ve,onToggle:()=>void qg()})}],example:et?pSe(Me,rs,R==null?void 0:R.authType):""}):o.jsx(QL,{protocol:"a2a",title:"A2A",available:gn,fields:[{label:"Agent",value:((wh=ze==null?void 0:ze.a2a)==null?void 0:wh.name)??""},{label:"Agent Card",value:gn?Ew(Me,"/.well-known/agent-card.json"):""},{label:"调用地址",value:Rs},{label:"鉴权方式",value:gn?WL(R==null?void 0:R.authType):""},{label:"API Key",value:o.jsx(XL,{available:gn,authType:R==null?void 0:R.authType,value:Te,visible:Le&&!!Te,loading:ie,error:ve,onToggle:()=>void qg()})}],example:gn?mSe(Rs,R==null?void 0:R.authType):""})]})]}),D==="evaluations"&&o.jsxs("section",{className:"aw-cases",children:[(re==null?void 0:re.runtimeId)&&o.jsx("div",{className:"aw-case-summary",children:["good","bad"].map($=>{const oe=SSe(Fn,$),fe=bo.filter(nt=>nt.kind===$).length,Ce=go?fe:(oe==null?void 0:oe.itemCount)??fe;return o.jsxs("button",{type:"button",onClick:()=>Yn($),children:[o.jsx("strong",{children:Ce}),o.jsx("span",{children:$==="good"?"Good cases":"Bad cases"})]},$)})}),o.jsxs("div",{className:"aw-case-filter-bar",children:[o.jsxs("div",{className:"aw-case-filter-stack",children:[o.jsx("div",{className:"aw-case-filters","aria-label":"案例结果筛选",children:["good","bad"].map($=>o.jsx("button",{type:"button",className:It===$?"is-active":"","aria-pressed":It===$,onClick:()=>ft($),children:$==="good"?"Good case":"Bad case"},$))}),o.jsx("div",{className:"aw-case-source-filters","aria-label":"回流方式筛选",children:["auto","user"].map($=>o.jsx("button",{type:"button",className:Nt===$?"is-active":"","aria-pressed":Nt===$,onClick:()=>Qt($),children:$==="auto"?"自动回流":"手动回流"},$))})]}),o.jsxs("label",{className:"aw-case-search",children:[o.jsx(Fy,{"aria-hidden":!0}),o.jsx("input",{type:"search",value:fn,onChange:$=>Et($.currentTarget.value),placeholder:"搜索用户输入、期望行为或标签","aria-label":"搜索评测案例"})]})]}),Yg&&o.jsx("div",{className:`aw-case-toolbar${bs?" is-active":""}`,children:bs?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"aw-selection-count",children:["已选 ",Ua.length," 条"]}),o.jsx("button",{type:"button",onClick:pE,disabled:ol.length===0||Ae,children:"全选当前"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void Du(Ua),disabled:Ua.length===0||Ae,children:Ae?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:mE,disabled:Ae,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{st(""),On(!0)},disabled:ol.length===0||Ae,children:"选择案例"})}),Je&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:Je}),o.jsx("div",{ref:Pe,children:o.jsx(MSe,{cases:ol,loading:ps&&ol.length===0,error:$s,runtimeBacked:!!(re!=null&&re.runtimeId),selectionMode:bs,selectedCaseIds:Nn,focusedCaseId:ot,expandedCaseIds:Mn,deleting:Ae,canDelete:Yg,onOpenCase:Wg,onToggleCase:hE,onToggleExpanded:Ui,onDeleteCase:$=>void Du([$]),onRetry:()=>Hs($=>$+1)})})]}),D==="optimizations"&&o.jsxs("section",{className:"aw-optimizations",children:[o.jsxs("div",{className:"aw-optimization-intro",children:[o.jsx("h3",{children:"优化项"}),o.jsx("p",{children:"根据评测结果汇总需要优先处理的改进建议。"})]}),_n?o.jsxs("div",{className:"aw-optimization-state",role:"status",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsx("span",{children:"正在读取优化项"})]}):is?o.jsxs("div",{className:"aw-optimization-state is-error",role:"alert",children:[o.jsx("span",{children:is}),o.jsx("button",{type:"button",onClick:()=>zs($=>$+1),children:"重试"})]}):Hn.length>0?o.jsx(RSe,{groups:Hn}):o.jsx("div",{className:"aw-optimization-state",children:"暂无优化项,自动评测完成后会在这里生成建议。"})]})]}),D==="basic"&&(re||wt)&&o.jsxs("div",{className:"aw-basic-actions",children:[re&&o.jsxs("button",{type:"button",className:"aw-talk studio-update-action",onClick:()=>S==null?void 0:S(re),children:[o.jsx(yee,{"aria-hidden":!0}),o.jsx("span",{children:"去对话"})]}),o.jsxs("span",{className:`aw-update-wrap${ho?" is-disabled":""}`,tabIndex:ho?0:void 0,"aria-describedby":ho?bh:void 0,children:[o.jsx("button",{type:"button",className:"aw-update studio-update-action",disabled:!!ho,"aria-busy":Se||void 0,"aria-describedby":ho?bh:void 0,onClick:()=>{var $;return wt?j==null?void 0:j(wt):Ns?j==null?void 0:j({...Ns,deploymentTarget:$g}):Zt?I((($=Zt.agent)==null?void 0:$.draft)??gi,Zt):void 0},children:Se?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"loading-gap-spinner aw-update-spinner","aria-hidden":"true"}),o.jsx("span",{children:"检测中"})]}):wt||Ns?"继续编辑":"更新"}),ho&&o.jsx("span",{id:bh,className:"aw-update-disabled-reason",role:"tooltip",children:ho})]})]})]})]}),L==="evaluation"&&o.jsx("div",{className:"aw-evaluation-glass",role:"status",children:o.jsx("span",{children:"敬请期待"})})]})]}),jt&&o.jsx(qA,{variant:"danger",title:jt.title,description:jt.description,confirmLabel:$t?"删除中...":jt.confirmLabel,closeLabel:"关闭删除确认",busy:$t,onCancel:()=>Sn(null),onConfirm:()=>void e0()})]})}function RSe({groups:e}){return o.jsx("div",{className:"aw-optimization-table-wrap",children:o.jsxs("table",{className:"aw-optimization-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",children:"修复优先级"}),o.jsx("th",{scope:"col",children:"建议优化模块"}),o.jsx("th",{scope:"col",children:"优化建议和理由"})]})}),o.jsx("tbody",{children:e.map(t=>o.jsxs("tr",{children:[o.jsx("td",{children:o.jsx("span",{className:`aw-priority is-${t.priority}`,children:ESe(t.priority)})}),o.jsx("td",{children:o.jsx("span",{className:"aw-optimization-module",children:wSe(t)})}),o.jsx("td",{children:o.jsx("ul",{className:"aw-optimization-list",children:t.items.map(n=>o.jsxs("li",{children:[o.jsx("strong",{children:n.suggestion}),o.jsx("p",{children:n.reason})]},`${n.suggestion}:${n.reason}`))})})]},`${t.priority}:${t.module}:${t.customModule??""}`))})]})})}function OSe(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M4.5 7h15"}),o.jsx("path",{d:"M9 7V4.8h6V7"}),o.jsx("path",{d:"m6.5 7 .8 12h9.4l.8-12"}),o.jsx("path",{d:"M10 10.5v5M14 10.5v5"})]})}function MSe({cases:e,loading:t=!1,error:n="",runtimeBacked:s=!1,selectionMode:i=!1,selectedCaseIds:r,focusedCaseId:a="",expandedCaseIds:l,deleting:c=!1,canDelete:u=!1,onOpenCase:d,onToggleCase:f,onToggleExpanded:h,onDeleteCase:p,onRetry:m}){return o.jsxs("div",{className:"aw-case-table",children:[o.jsxs("div",{className:"aw-case-row aw-case-row-head",children:[o.jsx("span",{children:"用户输入"}),o.jsx("span",{children:"Agent 输出"}),o.jsx("span",{children:"评分"}),o.jsx("span",{children:"评分理由"}),o.jsx("span",{className:"aw-case-action-head",children:"操作"})]}),t?o.jsx("div",{className:"aw-case-empty",children:"正在读取 AgentKit 评测集…"}):n?o.jsxs("div",{className:"aw-case-empty aw-case-error",children:[o.jsx("span",{children:n}),m&&o.jsx("button",{type:"button",onClick:m,children:"重试"})]}):e.length===0?o.jsx("div",{className:"aw-case-empty",children:s?"暂无用户反馈案例":"没有匹配的案例"}):e.map(b=>{var k;const v=b.id.startsWith("local:"),y=(r==null?void 0:r.has(b.id))??!1,x=(l==null?void 0:l.has(b.id))??!1,w=b.output.length+b.referenceOutput.length>220||(((k=b.reason)==null?void 0:k.length)??0)>120,_=u&&!v,S=b.source==="auto";return o.jsxs("div",{className:["aw-case-row",a===b.id?"is-focused":"",i?"is-selecting":"",y?"is-selected-for-delete":""].filter(Boolean).join(" "),role:"row",tabIndex:0,"aria-selected":i?y:void 0,onClick:()=>{if(i){_&&(f==null||f(b));return}d==null||d(b)},onKeyDown:T=>{T.target===T.currentTarget&&(T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),i?_&&(f==null||f(b)):d==null||d(b)))},children:[o.jsxs("div",{className:"aw-case-text aw-case-cell","data-label":"用户输入",children:[o.jsxs("span",{className:"aw-case-title-line",children:[i&&_&&o.jsx("span",{className:`aw-select-marker${y?" is-checked":""}`,"aria-hidden":"true"}),o.jsx("strong",{title:b.input,children:b.input||"无用户输入"})]}),b.comment&&o.jsxs("small",{title:b.comment,children:["备注:",b.comment]}),o.jsx("small",{className:"aw-case-time",children:ySe(b.createdAt)}),(b.userId||b.sessionId)&&o.jsx("small",{title:[b.userId,b.sessionId].filter(Boolean).join(" · "),children:[b.userId,b.sessionId].filter(Boolean).join(" · ")})]}),o.jsxs("div",{className:`aw-case-output aw-case-cell${x?" is-expanded":""}`,"data-label":"Agent 输出",children:[o.jsx("p",{className:"aw-case-output-preview",title:b.output,children:b.output||"无可见回复"}),b.referenceOutput&&o.jsxs("small",{className:"aw-case-output-preview",title:b.referenceOutput,children:["Reference: ",b.referenceOutput]}),w&&o.jsx("button",{type:"button",className:"aw-case-expand",onClick:T=>{T.stopPropagation(),h==null||h(b.id)},children:x?"收起":"展开"})]}),o.jsx("div",{className:"aw-case-score aw-case-cell","data-label":"评分",children:xSe(b)}),o.jsx("div",{className:`aw-case-reason aw-case-cell${x?" is-expanded":""}`,"data-label":"评分理由",children:o.jsx("p",{title:S?b.reason:void 0,children:S?b.reason||"暂无评分理由":"—"})}),o.jsx("div",{className:"aw-case-actions aw-case-cell","data-label":"操作",children:_&&o.jsx("button",{type:"button",className:"aw-case-delete",onClick:T=>{T.stopPropagation(),p==null||p(b)},disabled:c,title:"删除反馈案例","aria-label":"删除反馈案例",children:o.jsx(OSe,{})})})]},b.id)})]})}function LSe({group:e,agents:t,cases:n,onChange:s,onRun:i}){const[r,a]=g.useState("config"),l=e.agentIds.map(f=>t.find(h=>h.id===f)).filter(f=>!!f),c=["回答质量","事实准确性","工具调用","响应效率"];g.useEffect(()=>a("config"),[e.id]);const u=f=>{s({...e,agentIds:e.agentIds.includes(f)?e.agentIds.filter(h=>h!==f):[...e.agentIds,f]})},d=f=>{s({...e,metrics:e.metrics.includes(f)?e.metrics.filter(h=>h!==f):[...e.metrics,f]})};return o.jsxs("main",{className:"aw-main",children:[o.jsxs("div",{className:"aw-eval-head",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"aw-agent-title-row",children:[o.jsx("h2",{children:e.name}),o.jsx("span",{children:"评测组"})]}),o.jsxs("p",{children:[l.length," 个参评智能体 · ",e.caseSet," · ",e.history.length," 次运行"]})]}),o.jsxs("button",{type:"button",className:"aw-run",onClick:()=>i(e),disabled:!0,children:[o.jsx(lee,{"aria-hidden":!0}),"开始评测"]})]}),o.jsxs("nav",{className:"aw-agent-tabs","aria-label":"评测组详情",children:[o.jsx("button",{type:"button",className:r==="config"?"is-active":"","aria-pressed":r==="config",onClick:()=>a("config"),disabled:!0,children:"评测配置"}),o.jsx("button",{type:"button",className:r==="history"?"is-active":"","aria-pressed":r==="history",onClick:()=>a("history"),disabled:!0,children:"历史结果"})]}),o.jsx("div",{className:"aw-content",children:r==="config"?o.jsxs("div",{className:"aw-eval-setup",children:[o.jsxs("section",{className:"aw-eval-block",children:[o.jsxs("div",{className:"aw-card-head",children:[o.jsx("strong",{children:"参评智能体"}),o.jsxs("span",{children:["已选择 ",l.length," 个"]})]}),o.jsx("div",{className:"aw-eval-agent-grid",children:t.map(f=>o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:e.agentIds.includes(f.id),onChange:()=>u(f.id)}),o.jsxs("span",{children:[o.jsx("strong",{children:f.label}),o.jsx("small",{children:f.remote?"远程":"本地"})]})]},f.id))})]}),o.jsxs("div",{className:"aw-eval-setting-grid",children:[o.jsxs("section",{className:"aw-eval-block",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:"评测资源"})}),o.jsxs("div",{className:"aw-eval-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"评测集"}),o.jsxs("select",{value:e.caseSet,onChange:f=>s({...e,caseSet:f.currentTarget.value}),children:[o.jsx("option",{children:"核心回归集"}),o.jsx("option",{children:"安全边界集"}),o.jsx("option",{children:"工具调用集"})]}),o.jsxs("small",{children:[n.length," 条案例"]})]}),o.jsxs("label",{children:[o.jsx("span",{children:"评估器"}),o.jsxs("select",{value:e.evaluator,onChange:f=>s({...e,evaluator:f.currentTarget.value}),children:[o.jsx("option",{children:"综合质量评估器"}),o.jsx("option",{children:"事实一致性评估器"}),o.jsx("option",{children:"工具调用评估器"})]})]}),o.jsxs("label",{children:[o.jsx("span",{children:"并发数"}),o.jsxs("select",{value:e.concurrency,onChange:f=>s({...e,concurrency:f.currentTarget.value}),children:[o.jsx("option",{value:"2",children:"2"}),o.jsx("option",{value:"4",children:"4"}),o.jsx("option",{value:"8",children:"8"})]})]})]})]}),o.jsxs("section",{className:"aw-eval-block",children:[o.jsxs("div",{className:"aw-card-head",children:[o.jsx("strong",{children:"评测指标"}),o.jsxs("span",{children:["已选择 ",e.metrics.length," 项"]})]}),o.jsx("div",{className:"aw-metric-list",children:c.map(f=>o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:e.metrics.includes(f),onChange:()=>d(f)}),o.jsx("span",{children:f})]},f))})]})]})]}):o.jsxs("section",{className:"aw-eval-history",children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:"历史结果"}),o.jsx("p",{children:"查看该评测组历次运行的总体表现。"})]})}),e.history.length===0?o.jsxs("div",{className:"aw-results-empty",children:[o.jsx("strong",{children:"暂无历史结果"}),o.jsx("span",{children:"完成首次评测后,结果会出现在这里。"})]}):o.jsx("div",{className:"aw-history-list",children:e.history.map((f,h)=>o.jsxs("button",{type:"button",children:[o.jsxs("span",{children:[o.jsxs("strong",{children:["评测运行 #",e.history.length-h]}),o.jsxs("small",{children:[f.createdAt," · ",l.length," 个智能体"]})]}),o.jsxs("span",{className:"aw-history-score",children:[o.jsx("strong",{children:f.score}),o.jsx("small",{children:"综合得分"})]}),o.jsxs("span",{className:"aw-complete",children:[o.jsx(ja,{}),"已完成"]}),o.jsx(Dp,{"aria-hidden":!0})]},f.id))})]})})]})}function V$(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{const t=e.currentTarget;if(!(t instanceof HTMLElement))return;const n=t.offsetWidth;let s=.985;n<=80?s=.96:n<=150?s=.97:n<=220?s=.98:n>600&&(s=.995),t.style.setProperty("--scale",s.toString())},gN=(e,t)=>{const n=()=>{const a=setTimeout(e);return()=>{clearTimeout(a)}};if(!FSe||typeof window.requestAnimationFrame!="function"||K$&&document.visibilityState==="hidden")return n();let i=2,r=window.requestAnimationFrame(function a(){i-=1,i===0?e():r=window.requestAnimationFrame(a)});return()=>{typeof window.cancelAnimationFrame=="function"&&window.cancelAnimationFrame(r)}},$Se=e=>Object.keys(e).reduce((n,s)=>{const i=e[s];if(i||i===0){const r=s.startsWith("--")?"":"--",a=typeof i=="number"?`${i}px`:i;n[`${r}${s}`]=a}return n},{}),HSe=e=>{const t=g.Children.toArray(e),n=[];let s="";const i=()=>{s!==""&&(n.push(s),s="")};for(const r of t)if(!(r==null||typeof r=="boolean")){if(typeof r=="string"||typeof r=="number"){s+=String(r);continue}i(),n.push(r)}return i(),n},Y$=e=>{const t=HSe(e),n=g.Children.count(t);return g.Children.map(t,s=>{if(typeof s=="string"&&s.trim())return n<=1?s:o.jsx("span",{children:s});if(g.isValidElement(s)){const i=s,{children:r,...a}=i.props;return r!=null?g.cloneElement(i,a,Y$(r)):i}return s})};g.createContext(null);var zSe=typeof Il=="object"&&Il&&Il.Object===Object&&Il,VSe=typeof self=="object"&&self&&self.Object===Object&&self;zSe||VSe||Function("return this")();var GSe=typeof window<"u"?g.useLayoutEffect:g.useEffect;function KSe(){const e=g.useRef(!1);return g.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),g.useCallback(()=>e.current,[])}var JL={width:void 0,height:void 0};function qSe(e){const{ref:t,box:n="content-box"}=e,[{width:s,height:i},r]=g.useState(JL),a=KSe(),l=g.useRef({...JL}),c=g.useRef(void 0);return c.current=e.onResize,g.useEffect(()=>{if(!t.current||typeof window>"u"||!("ResizeObserver"in window))return;const u=new ResizeObserver(([d])=>{const f=n==="border-box"?"borderBoxSize":n==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",h=e3(d,f,"inlineSize"),p=e3(d,f,"blockSize");if(l.current.width!==h||l.current.height!==p){const b={width:h,height:p};l.current.width=h,l.current.height=p,c.current?c.current(b):a()&&r(b)}});return u.observe(t.current,{box:n}),()=>{u.disconnect()}},[n,t,a]),{width:s,height:i}}function e3(e,t,n){return e[t]?Array.isArray(e[t])?e[t][0][n]:e[t][n]:t==="contentBoxSize"?e.contentRect[n==="inlineSize"?"width":"height"]:void 0}function YSe(e,t){const n=g.useRef(e);GSe(()=>{n.current=e},[e]),g.useEffect(()=>{if(!t&&t!==0)return;const s=setTimeout(()=>{n.current()},t);return()=>{clearTimeout(s)}},[t])}const WSe="_LoadingIndicator_7yl6f_1",XSe={LoadingIndicator:WSe},QSe=({className:e,size:t,strokeWidth:n,style:s,...i})=>o.jsx("div",{...i,className:ra(XSe.LoadingIndicator,e),style:s||$Se({"indicator-size":t,"indicator-stroke":n})});function ZSe(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}const JSe=()=>G$,t3=(e,t=!1,n="TransitionGroup")=>{const s=[];return g.Children.forEach(e,i=>{if(i&&typeof i=="object"&&"key"in i&&i.key)s.push(i);else if(t)throw new Error(`Child elements of <${n} /> must include a \`key\``)}),s},Qu=()=>{},Zu=e=>{const t=g.useRef(e);return t.current=e,g.useCallback(n=>t.current(n),[])};function e_e(e,t,n,s){const i=e.reduce((c,u)=>({...c,[u.key]:1}),{}),r=t.reduce((c,u)=>({...c,[u.component.key]:1}),{}),a=e.filter(c=>!r[c.key]).map(n),l=t.map(c=>({...c,component:e.find(({key:u})=>u===c.component.key)||c.component,shouldRender:!!i[c.component.key]}));return s==="append"?l.concat(a):a.concat(l)}function t_e(e,t,n){if((G$||PSe)&&t&&n>1)throw new Error(`Cannot use forwardRef with multiple children in <${e} />`)}const n_e="_TransitionGroupChild_1hv1z_1",s_e={TransitionGroupChild:n_e},W$={enter:!1,enterActive:!1,exit:!1,exitActive:!1,interrupted:!1},i_e=e=>({...W$,enter:!e}),r_e=(e,t)=>{switch(t.type){case"enter-before":return{enter:!0,enterActive:!1,exit:!1,exitActive:!1,interrupted:e.interrupted||e.exit};case"enter-active":return{enter:!0,enterActive:!0,exit:!1,exitActive:!1,interrupted:!1};case"exit-before":return{enter:!1,enterActive:!1,exit:!0,exitActive:!1,interrupted:e.interrupted||e.enter};case"exit-active":return{enter:!1,enterActive:!1,exit:!0,exitActive:!0,interrupted:!1};case"done":default:return W$}},a_e=({ref:e,as:t,children:n,className:s,transitionId:i,style:r,preventMountTransition:a,shouldRender:l,enterDuration:c,exitDuration:u,removeChild:d,onEnter:f,onEnterActive:h,onEnterComplete:p,onExit:m,onExitActive:b,onExitComplete:v})=>{const[y,x]=g.useReducer(r_e,i_e(a||!1)),E=g.useRef(!1),w=g.useRef(null),_=g.useRef(c);_.current=c;const S=g.useRef(u);S.current=u;const k=g.useRef(null),T=g.useCallback(C=>{const I=w.current;if(!(!I||C===k.current))switch(k.current=C,C){case"enter":f(I);break;case"enter-active":h(I);break;case"enter-complete":p(I);break;case"exit":m(I);break;case"exit-active":b(I);break;case"exit-complete":v(I);break}},[f,h,p,m,b,v]);return Ft.useLayoutEffect(()=>{if(!l){let j;x({type:"exit-before"}),T("exit");const L=gN(()=>{x({type:"exit-active"}),T("exit-active"),j=window.setTimeout(()=>{T("exit-complete"),d()},S.current)});return()=>{L(),j!==void 0&&clearTimeout(j)}}if(a&&!E.current){E.current=!0;return}let C;x({type:"enter-before"}),T("enter");const I=gN(()=>{x({type:"enter-active"}),T("enter-active"),C=window.setTimeout(()=>{x({type:"done"}),T("enter-complete")},_.current)});return()=>{I(),C!==void 0&&clearTimeout(C)}},[l,a,d,T]),g.useEffect(()=>()=>{E.current=!1},[]),o.jsx(t,{ref:ZSe([w,e]),className:ra(s,s_e.TransitionGroupChild),"data-transition-id":i,style:r,"data-entering":y.enter?"":void 0,"data-entering-active":y.enterActive?"":void 0,"data-exiting":y.exit?"":void 0,"data-exiting-active":y.exitActive?"":void 0,"data-interrupted":y.interrupted?"":void 0,children:n})},o_e=e=>{const{enterMountDelay:t,preventMountTransition:n}=e,s=!n&&t!=null?t:null,[i,r]=g.useState(s==null);return YSe(()=>r(!0),i?null:s),i?o.jsx(a_e,{...e}):null},l_e=e=>{const{ref:t,as:n="span",children:s,className:i,transitionId:r,style:a,enterDuration:l=0,exitDuration:c=0,preventInitialTransition:u=!0,enterMountDelay:d,insertMethod:f="append",disableAnimations:h=JSe()}=e,p=Zu(e.onEnter??Qu),m=Zu(e.onEnterActive??Qu),b=Zu(e.onEnterComplete??Qu),v=Zu(e.onExit??Qu),y=Zu(e.onExitActive??Qu),x=Zu(e.onExitComplete??Qu);g.Children.forEach(s,S=>{if(S&&!S.key)throw new Error("Child elements of must include a `key`")});const E=g.useCallback(S=>({component:S,shouldRender:!0,removeChild:()=>{_(k=>k.filter(T=>S.key!==T.component.key))},onEnter:p,onEnterActive:m,onEnterComplete:b,onExit:v,onExitActive:y,onExitComplete:x}),[p,m,b,v,y,x]),[w,_]=g.useState(()=>t3(s).map(S=>({...E(S),preventMountTransition:u})));return g.useLayoutEffect(()=>{_(S=>{const k=t3(s);return e_e(k,S,E,f)})},[s,f,E]),t_e("TransitionGroup",t,g.Children.count(s)),h?o.jsx(o.Fragment,{children:g.Children.map(s,S=>o.jsx(n,{ref:t,className:i,style:a,"data-transition-id":r,children:S}))}):o.jsx(o.Fragment,{children:w.map(({component:S,...k})=>o.jsx(o_e,{...k,as:n,className:i,transitionId:r,enterDuration:l,exitDuration:c,enterMountDelay:d,style:a,ref:t,children:S},S.key))})},c_e="_Button_1864l_1",u_e="_ButtonInner_1864l_4",d_e="_ButtonLoader_1864l_749",vw={Button:c_e,ButtonInner:u_e,ButtonLoader:d_e},n3=e=>{const{type:t="button",color:n="primary",variant:s="solid",pill:i=!0,uniform:r=!1,size:a="md",iconSize:l,gutterSize:c,loading:u,selected:d,block:f,opticallyAlign:h,children:p,className:m,onClick:b,disabled:v,disabledTone:y,inert:x=u,...E}=e,w=v||x,_=g.useCallback(S=>{v||b==null||b(S)},[b,v]);return o.jsxs("button",{type:t,className:ra(vw.Button,m),"data-color":n,"data-variant":s,"data-pill":i?"":void 0,"data-uniform":r?"":void 0,"data-size":a,"data-gutter-size":c,"data-icon-size":l,"data-loading":u?"":void 0,"data-selected":d?"":void 0,"data-block":f?"":void 0,"data-optically-align":h,onPointerEnter:q$,disabled:w,"aria-disabled":w,tabIndex:w?-1:void 0,"data-disabled":v?"":void 0,"data-disabled-tone":v?y:void 0,onClick:_,...E,children:[o.jsx(l_e,{className:vw.ButtonLoader,enterDuration:250,exitDuration:150,children:u&&o.jsx(QSe,{},"loader")}),o.jsx("span",{className:vw.ButtonInner,children:Y$(p)})]})},f_e=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8-10C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2Zm4.465 6.763a1 1 0 0 0-1.228-1.228l-5.5 1.5a1 1 0 0 0-.702.702l-1.5 5.5a1 1 0 0 0 1.228 1.228l5.5-1.5a1 1 0 0 0 .702-.702l1.5-5.5Zm-6.54 5.312.89-3.26 3.26-.89-.89 3.26-3.26.89Z",clipRule:"evenodd"})}),h_e="_EmptyMessage_1r5gu_1",p_e="_IconBadge_1r5gu_16",m_e="_Title_1r5gu_54",g_e="_Description_1r5gu_69",b_e="_ActionRow_1r5gu_77",kg={EmptyMessage:h_e,IconBadge:p_e,Title:m_e,Description:g_e,ActionRow:b_e},Qn=({children:e,className:t,fill:n="static"})=>o.jsx("div",{className:ra(kg.EmptyMessage,t),"data-fill":n,children:e}),y_e=({size:e="md",color:t="secondary",children:n,className:s})=>o.jsx("div",{className:ra(kg.IconBadge,s),"data-size":e,"data-color":t,children:n}),x_e=({children:e,className:t,color:n="secondary"})=>o.jsx("div",{className:ra(kg.Title,t),"data-color":n,children:e}),E_e=({children:e,className:t})=>o.jsx("div",{className:ra(kg.Description,t),children:e}),v_e=({children:e,className:t})=>o.jsx("div",{className:ra(kg.ActionRow,t),children:e});Qn.Icon=y_e;Qn.Title=x_e;Qn.Description=E_e;Qn.ActionRow=v_e;const nr="/web/sandbox/sessions",s3=3e4,i3=33e4,w_e=6e4,S_e=6e5,ww=15e3,Io=6e4,__e=33e4,r3=40;function F1(e){switch(e.trim().toLowerCase()){case"ready":return"就绪";case"creating":return"创建中";case"starting":case"initializing":return"启动中";case"pending":return"等待中";case"running":return"运行中";case"failed":case"error":return"异常";case"stopped":return"已停止";case"expired":return"已过期";case"deleting":return"删除中";case"deleted":return"已删除";default:return"未知状态"}}function ni(e){const t=s1(e);return t.has("Accept")||t.set("Accept","application/json"),t}async function si(e,t){const n=await e.text().catch(()=>"");let s={};try{s=JSON.parse(n)}catch{const c=`${t}(HTTP ${e.status})`;return new Error(n?`${c}:${n}`:c)}const i=s.detail,r=i&&typeof i=="object"&&"message"in i?i.message:i??s.error??s.message,a=typeof r=="string"?r:r==null?"":JSON.stringify(r),l=`${t}(HTTP ${e.status})`;return new Error(a?`${l}:${a}`:l)}function Ju(e,t="codex"){if(!e.sessionId||!e.status)throw new Error("AgentKit 沙箱返回了无效的 Session 信息。");return{id:e.sessionId,toolName:t,userSessionId:e.userSessionId??"",displayName:e.displayName??"",status:e.status,createdAt:e.createdAt??"",expireAt:e.expireAt??"",toolType:e.toolType??"",createdBy:e.createdBy??"",threadId:e.threadId??"",cwd:e.cwd??"",workspaceLocked:e.workspaceLocked===!0,busy:e.busy===!0,...typeof e.model=="string"?{model:e.model}:{},permissions:$1(e.permissions)}}const Wh={approvalPolicy:"on-request",approvalsReviewer:"user",sandboxMode:"workspace-write",networkAccess:!1};function $1(e){if(!e||typeof e!="object")return{...Wh};const t=e,n=t.approvalPolicy,s=t.approvalsReviewer,i=t.sandboxMode;return{approvalPolicy:n==="untrusted"||n==="on-request"||n==="never"?n:Wh.approvalPolicy,approvalsReviewer:s==="user"||s==="auto_review"?s:Wh.approvalsReviewer,sandboxMode:i==="read-only"||i==="workspace-write"||i==="danger-full-access"?i:Wh.sandboxMode,networkAccess:typeof t.networkAccess=="boolean"?t.networkAccess:Wh.networkAccess}}function a3(e){if(!e||typeof e!="object")throw new Error("Sandbox 返回了无效设置。");const t=e;return{threadId:typeof t.threadId=="string"?t.threadId:"",cwd:typeof t.cwd=="string"?t.cwd:"",...typeof t.model=="string"?{model:t.model}:{},workspaceLocked:t.workspaceLocked===!0,busy:t.busy===!0,permissions:$1(t.permissions)}}function Ea(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function N_e(e){const t=Ea(e);if(!(!t||typeof t.id!="string"||!t.id))return{id:t.id,displayName:typeof t.displayName=="string"?t.displayName:t.id,description:typeof t.description=="string"?t.description:"",isDefault:t.isDefault===!0}}function T_e(e){const t=Ea(e);if(!(!t||typeof t.id!="string"||!t.id||typeof t.name!="string"||!t.name))return{id:t.id,name:t.name,description:typeof t.description=="string"?t.description:""}}function X$(e){const t=Ea(e);if(!(!t||typeof t.id!="string"||!t.id))return{id:t.id,...typeof t.name=="string"&&t.name?{name:t.name}:{},preview:typeof t.preview=="string"?t.preview:"",cwd:typeof t.cwd=="string"?t.cwd:"",modelProvider:typeof t.modelProvider=="string"?t.modelProvider:"",createdAt:typeof t.createdAt=="number"&&Number.isFinite(t.createdAt)?t.createdAt:0,updatedAt:typeof t.updatedAt=="number"&&Number.isFinite(t.updatedAt)?t.updatedAt:0,status:typeof t.status=="string"?t.status:"unknown"}}function eb(e){const t=Ea(e),n=X$(t==null?void 0:t.thread);if(!t||!n||typeof t.threadId!="string"||!Array.isArray(t.messages))throw new Error("Sandbox 返回了无效 Thread 快照。");const s=t.messages.flatMap(i=>{const r=Ea(i);if(!r||typeof r.id!="string"||r.role!=="user"&&r.role!=="assistant"||typeof r.content!="string"||typeof r.timestamp!="number")return[];const a=Array.isArray(r.skillNames)?r.skillNames.filter(l=>typeof l=="string"&&!!l):[];return[{id:r.id,role:r.role,content:r.content,timestamp:r.timestamp,...a.length?{skillNames:a}:{}}]});return{thread:n,threadId:t.threadId,messages:s,...typeof t.model=="string"?{model:t.model}:{},...typeof t.cwd=="string"?{cwd:t.cwd}:{},workspaceLocked:t.workspaceLocked===!0,permissions:$1(t.permissions)}}function bN(e){if(!e||typeof e!="object")return;const t=e;if(![t.totalTokens,t.inputTokens,t.cachedInputTokens,t.outputTokens,t.reasoningOutputTokens].some(s=>typeof s!="number"||!Number.isFinite(s)||s<0))return{totalTokens:Math.trunc(t.totalTokens),inputTokens:Math.trunc(t.inputTokens),cachedInputTokens:Math.trunc(t.cachedInputTokens),outputTokens:Math.trunc(t.outputTokens),reasoningOutputTokens:Math.trunc(t.reasoningOutputTokens)}}function k_e(e){const t=bN(e.usage);if(!t||typeof e.turnId!="string")return;const n=bN(e.threadTotal),s=e.modelContextWindow;return{turnId:e.turnId,usage:t,...n?{threadTotal:n}:{},...typeof s=="number"&&Number.isFinite(s)&&s>=0?{modelContextWindow:Math.trunc(s)}:{}}}function A_e(e){return typeof e.id!="string"||e.kind!=="command"&&e.kind!=="file"||typeof e.method!="string"?null:{id:e.id,kind:e.kind,method:e.method,...typeof e.reason=="string"?{reason:e.reason}:{},...typeof e.command=="string"?{command:e.command}:{},...typeof e.cwd=="string"?{cwd:e.cwd}:{},...typeof e.grantRoot=="string"?{grantRoot:e.grantRoot}:{},...e.changes!==void 0?{changes:e.changes}:{},...typeof e.threadId=="string"?{threadId:e.threadId}:{},...typeof e.turnId=="string"?{turnId:e.turnId}:{},...typeof e.itemId=="string"?{itemId:e.itemId}:{}}}async function C_e(e,t={}){if(!e.body)throw new Error("沙箱对话服务未返回内容。");const n=e.body.getReader(),s=new TextDecoder;let i="",r="";const a=[],l=new Map;let c;function u(){var p;(p=t.onBlocks)==null||p.call(t,a.map(m=>({...m})))}function d(p){r+=p;const m=a[a.length-1];(m==null?void 0:m.kind)==="text"?m.text+=p:a.push({kind:"text",text:p}),u()}function f(p){if(typeof p.id!="string"||p.kind!=="thinking"&&p.kind!=="tool"||p.status!=="running"&&p.status!=="done")return;const m=p.status==="done";let b;if(p.kind==="thinking"){if(typeof p.text!="string"||!p.text)return;b={kind:"thinking",text:p.text,done:m}}else{if(typeof p.name!="string"||!p.name)return;b={kind:"tool",name:p.name,args:p.args,response:p.response,done:m}}const v=l.get(p.id);v===void 0?(l.set(p.id,a.length),a.push(b)):a[v]=b,u()}function h(p){var y,x,E;let m="message";const b=[];for(const w of p.split(/\r?\n/))w.startsWith("event:")&&(m=w.slice(6).trim()),w.startsWith("data:")&&b.push(w.slice(5).trimStart());if(b.length===0)return;let v;try{v=JSON.parse(b.join(` +`))}catch{throw new Error("沙箱对话服务返回了无法解析的响应。")}if(m==="error")throw new Error(typeof v.message=="string"&&v.message?v.message:"沙箱对话失败,请稍后重试。");if(m==="activity"&&f(v),m==="approval"){const w=A_e(v);w&&((y=t.onApproval)==null||y.call(t,w))}if(m==="usage"){const w=k_e(v);w&&(c=w,(x=t.onUsage)==null||x.call(t,w))}m==="approval_resolved"&&typeof v.approvalId=="string"&&((E=t.onApprovalResolved)==null||E.call(t,v.approvalId)),m==="delta"&&typeof v.text=="string"&&d(v.text),m==="done"&&!r&&typeof v.text=="string"&&d(v.text)}for(;;){const{done:p,value:m}=await n.read();i+=s.decode(m,{stream:!p});const b=i.split(/\r?\n\r?\n/);if(i=b.pop()??"",b.forEach(h),p)break}if(i.trim()&&h(i),a.length===0)throw new Error("沙箱未返回有效回复,请重试。");return{text:r,blocks:a,...c?{usage:c}:{}}}async function za(e,t,{method:n="GET",body:s,options:i={},fallback:r}){if(!e)throw new Error("缺少要操作的 AgentKit Session。");const a=await fetch(Cn(`${nr}/${encodeURIComponent(e)}/${t}`),{method:n,headers:ni(s===void 0?void 0:{"Content-Type":"application/json"}),...s===void 0?{}:{body:JSON.stringify(s)},signal:Pn(i.signal,Io)});if(!a.ok)throw await si(a,r);return a.json()}const rn={async listSessions(e={}){const t=await fetch(Cn(nr),{method:"GET",headers:ni(),signal:Pn(e.signal,s3)});if(!t.ok)throw await si(t,"无法读取 Codex 智能体,请稍后重试。");const n=await t.json();if(!Array.isArray(n.sessions))throw new Error("AgentKit 沙箱返回了无效的 Session 列表。");return n.sessions.map(s=>Ju(s))},async startSession(e={}){var n;const t=await fetch(Cn(nr),{method:"POST",headers:ni({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((n=e.displayName)==null?void 0:n.trim())??""}),signal:Pn(e.signal,i3)});if(!t.ok)throw await si(t,"无法启动 AgentKit 沙箱,请稍后重试。");return Ju(await t.json())},async listAgentSessions(e,t={}){const n=await fetch(Cn(`/web/${e}/sessions`),{method:"GET",headers:ni(),signal:Pn(t.signal,s3)});if(!n.ok)throw await si(n,`无法读取 ${e} 智能体,请稍后重试。`);const s=await n.json();if(!Array.isArray(s.sessions))throw new Error(`AgentKit 返回了无效的 ${e} Session 列表。`);return s.sessions.map(i=>Ju(i,e))},async startAgentSession(e,t={}){var s;const n=await fetch(Cn(`/web/${e}/sessions`),{method:"POST",headers:ni({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((s=t.displayName)==null?void 0:s.trim())??""}),signal:Pn(t.signal,i3)});if(!n.ok)throw await si(n,`无法创建 ${e} 智能体,请稍后重试。`);return Ju(await n.json(),e)},async openAgentSession(e,t,n={}){if(!t)throw new Error("缺少要打开的 AgentKit Session。");const s=await fetch(Cn(`/web/${e}/sessions/${encodeURIComponent(t)}/open`),{method:"POST",headers:ni(),signal:Pn(n.signal,Io)});if(!s.ok)throw await si(s,`无法打开 ${e} 智能体。`);const i=await s.json();if(typeof i.webuiUrl!="string"||!i.webuiUrl.startsWith("/"))throw new Error(`${e} 智能体返回了无效的主页面地址。`);return{session:Ju(i,e),kind:e,webuiUrl:Cn(i.webuiUrl)}},async launchAgentTerminal(e,t,n={}){if(!t)throw new Error("缺少要打开 Terminal 的 AgentKit Session。");const s=await fetch(Cn(`/web/${e}/sessions/${encodeURIComponent(t)}/terminal`),{method:"POST",headers:ni(),signal:Pn(n.signal,Io)});if(!s.ok)throw await si(s,`无法打开 ${e} Terminal。`);const i=await s.json();return{url:Q$(i.url,`${e} Terminal`),...typeof i.shellSessionId=="string"?{shellSessionId:i.shellSessionId}:{}}},async deleteAgentSession(e,t,n={}){if(!t)return;const s=await fetch(Cn(`/web/${e}/sessions/${encodeURIComponent(t)}`),{method:"DELETE",headers:ni(),signal:Pn(n.signal,ww)});if(!s.ok&&s.status!==404)throw await si(s,`无法删除 ${e} 智能体。`)},async connectSession(e,t={}){if(!e)throw new Error("缺少要连接的 AgentKit Session。");const n=await fetch(Cn(`${nr}/${encodeURIComponent(e)}/connect`),{method:"POST",headers:ni({"Content-Type":"application/json"}),signal:Pn(t.signal,w_e)});if(!n.ok)throw await si(n,"无法连接 Codex 智能体,请稍后重试。");const s=Ju(await n.json());if(s.status.toLowerCase()!=="ready")throw new Error(`AgentKit Session 尚未就绪,当前状态:${s.status}。`);return s},async sendMessage(e,t={}){var s;if(!e.sessionId||!e.text.trim())throw new Error("内置智能体会话缺少有效的消息内容。");const n=await fetch(Cn(`${nr}/${encodeURIComponent(e.sessionId)}/messages`),{method:"POST",headers:ni({Accept:"text/event-stream","Content-Type":"application/json"}),body:JSON.stringify({message:e.text,...(s=e.skillIds)!=null&&s.length?{skillIds:e.skillIds}:{}}),signal:Pn(t.signal,S_e)});if(!n.ok)throw await si(n,"沙箱对话失败,请稍后重试。");return C_e(n,t)},async getStatus(e,t={}){const n=await za(e,"status",{options:t,fallback:"无法读取 Codex 状态。"}),s=a3(n),i=Ea(n),r=bN(i==null?void 0:i.threadTotal),a=i==null?void 0:i.modelContextWindow;return{...s,...r?{threadTotal:r}:{},...typeof a=="number"&&Number.isFinite(a)&&a>=0?{modelContextWindow:Math.trunc(a)}:{}}},async listModels(e,t={}){const n=Ea(await za(e,"models",{options:t,fallback:"无法读取 Codex 模型列表。"}));if(!Array.isArray(n==null?void 0:n.models))throw new Error("Sandbox 返回了无效模型列表。");return n.models.flatMap(s=>{const i=N_e(s);return i?[i]:[]})},async setModel(e,t,n={}){const s=Ea(await za(e,"model",{method:"PUT",body:{model:t},options:n,fallback:"无法切换 Codex 模型。"}));if(typeof(s==null?void 0:s.model)!="string"||!s.model)throw new Error("Sandbox 返回了无效模型。");return s.model},async listSkills(e,t=!1,n={}){const i=Ea(await za(e,`skills${t?"?force_reload=true":""}`,{options:n,fallback:"无法读取 Codex Skills。"}));if(!Array.isArray(i==null?void 0:i.skills))throw new Error("Sandbox 返回了无效 Skill 列表。");return i.skills.flatMap(r=>{const a=T_e(r);return a?[a]:[]})},async listThreads(e,t={},n={}){const s=new URLSearchParams;t.cursor&&s.set("cursor",t.cursor),t.search&&s.set("search",t.search),t.archived&&s.set("archived","true");const i=s.size?`?${s}`:"",r=Ea(await za(e,`threads${i}`,{options:n,fallback:"无法读取 Codex Thread 列表。"}));if(!Array.isArray(r==null?void 0:r.threads))throw new Error("Sandbox 返回了无效 Thread 列表。");return{threads:r.threads.flatMap(a=>{const l=X$(a);return l?[l]:[]}),...typeof r.nextCursor=="string"?{nextCursor:r.nextCursor}:{}}},async newThread(e,t={}){return eb(await za(e,"threads/new",{method:"POST",options:t,fallback:"无法创建新的 Codex Thread。"}))},async resumeThread(e,t,n={}){return eb(await za(e,"threads/resume",{method:"POST",body:{threadId:t},options:n,fallback:"无法恢复 Codex Thread。"}))},async forkThread(e,t={}){return eb(await za(e,"threads/fork",{method:"POST",options:t,fallback:"无法分叉 Codex Thread。"}))},async archiveThread(e,t,n={}){const s=Ea(await za(e,"threads/archive",{method:"POST",body:{threadId:t},options:n,fallback:"无法归档 Codex Thread。"}));if((s==null?void 0:s.archived)!==!0)throw new Error("Sandbox 返回了无效归档结果。");return{archived:!0,...s.thread?{snapshot:eb(s)}:{}}},async compactThread(e,t={}){await za(e,"threads/compact",{method:"POST",options:t,fallback:"无法压缩 Codex Thread。"})},async getSettings(e,t={}){const n=await fetch(Cn(`${nr}/${encodeURIComponent(e)}/settings`),{method:"GET",headers:ni(),signal:Pn(t.signal,Io)});if(!n.ok)throw await si(n,"无法读取 Codex 权限与工作空间。");return a3(await n.json())},async updatePermissions(e,t,n={}){const s=await fetch(Cn(`${nr}/${encodeURIComponent(e)}/permissions`),{method:"PUT",headers:ni({"Content-Type":"application/json"}),body:JSON.stringify(t),signal:Pn(n.signal,Io)});if(!s.ok)throw await si(s,"无法更新 Codex 权限。");const i=await s.json();return $1(i.permissions)},async updateWorkspace(e,t,n={}){const s=await fetch(Cn(`${nr}/${encodeURIComponent(e)}/workspace`),{method:"PUT",headers:ni({"Content-Type":"application/json"}),body:JSON.stringify({cwd:t}),signal:Pn(n.signal,Io)});if(!s.ok)throw await si(s,"无法更新 Codex 工作空间。");const i=await s.json();if(typeof i.cwd!="string"||!i.cwd)throw new Error("Sandbox 返回了无效工作目录。");return i.cwd},async listDirectories(e,t,n={}){const s=new URLSearchParams({path:t}),i=await fetch(Cn(`${nr}/${encodeURIComponent(e)}/directories?${s}`),{method:"GET",headers:ni(),signal:Pn(n.signal,Io)});if(!i.ok)throw await si(i,"无法读取 Sandbox 目录。");const r=await i.json();if(typeof r.path!="string"||!Array.isArray(r.directories)||r.directories.some(a=>!a||typeof a.name!="string"||typeof a.path!="string"))throw new Error("Sandbox 返回了无效目录列表。");return{path:r.path,...typeof r.parent=="string"?{parent:r.parent}:{},directories:r.directories}},async resolveApproval(e,t,n,s={}){const i=await fetch(Cn(`${nr}/${encodeURIComponent(e)}/approvals/${encodeURIComponent(t)}`),{method:"POST",headers:ni({"Content-Type":"application/json"}),body:JSON.stringify({decision:n}),signal:Pn(s.signal,Io)});if(!i.ok)throw await si(i,"无法提交 Codex 审批决定。")},async launchTerminal(e,t={}){return o3(e,"terminal",t)},async launchBrowser(e,t={}){return o3(e,"browser",t)},async uploadFile(e,t,n={}){const s=new FormData;s.set("file",t,t.name);const i=await fetch(Cn(`${nr}/${encodeURIComponent(e)}/files`),{method:"POST",headers:ni(),body:s,signal:Pn(n.signal,__e)});if(!i.ok)throw await si(i,"无法上传文件到 Sandbox。");const r=await i.json();if(typeof r.id!="string"||typeof r.path!="string"||typeof r.name!="string"||typeof r.mimeType!="string"||typeof r.sizeBytes!="number")throw new Error("Sandbox 返回了无效上传结果。");return r},async closeSession(e,t={}){if(!e)return;const n=await fetch(Cn(`${nr}/${encodeURIComponent(e)}/disconnect`),{method:"POST",headers:ni(),signal:Pn(t.signal,ww)});if(!n.ok&&n.status!==404)throw await si(n,"无法断开 Codex 智能体连接。")},async deleteSession(e,t={}){if(!e)return;const n=await fetch(Cn(`${nr}/${encodeURIComponent(e)}`),{method:"DELETE",headers:ni(),signal:Pn(t.signal,ww)});if(!n.ok&&n.status!==404)throw await si(n,"无法删除 Codex 智能体。")}};async function o3(e,t,n){const s=await fetch(Cn(`${nr}/${encodeURIComponent(e)}/${t}`),{method:"POST",headers:ni(),signal:Pn(n.signal,Io)});if(!s.ok)throw await si(s,t==="terminal"?"无法打开 Sandbox Terminal。":"无法打开 Sandbox Browser。");const i=await s.json();return{url:Q$(i.url,"Sandbox 工具"),...typeof i.shellSessionId=="string"?{shellSessionId:i.shellSessionId}:{}}}function Q$(e,t){if(typeof e!="string")throw new Error(`${t} 返回了无效地址。`);if(e.startsWith("/"))return Cn(e);let n;try{n=new URL(e)}catch{throw new Error(`${t} 返回了无效地址。`)}const s=n.protocol==="http:"&&window.location.protocol==="http:";if(n.protocol!=="https:"&&!s)throw new Error(`${t} 返回了不安全的地址。`);return n.toString()}function Ld(e,t,n){const s=e instanceof Error?`${e.name}: ${e.message}`:String(e||"未知错误");return[`${t}失败`,`详细信息:${s}`,n?`请求:${n}`:""].filter(Boolean).join(` +`)}function I_e(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M8.4 18.4H7.2a4.2 4.2 0 0 1-.65-8.35A5.7 5.7 0 0 1 17.3 8.2a4.6 4.6 0 0 1-.4 9.2h-3.2"}),o.jsx("path",{d:"m7.8 12.3 2 2-2 2M12.2 16.3h3.2"})]})}function j_e(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M18.9 6.25A8.4 8.4 0 1 0 19.6 16"}),o.jsx("path",{d:"M19 6.2c.1 2.1-.65 3.75-2.25 4.95-1.2.9-2.75 1.25-4.2.9"}),o.jsx("circle",{cx:"10.6",cy:"12.8",r:"2.45"}),o.jsx("path",{d:"m5.25 18.6 3.65-3.9M14.8 17.9c1.9-.45 3.55-1.65 4.65-3.35"})]})}function R_e(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6.2 20c.55-2.15.75-4.1.75-6.7V9.8A5.35 5.35 0 0 1 12.35 4c3.35 0 5.65 2.35 5.65 5.65v4.6c0 2.35.35 4.25 1.15 5.75"}),o.jsx("path",{d:"M8.05 10.2c1.35-.6 2.2-1.65 2.55-3.15.45 1.55 1.35 2.55 2.7 3.05.1-1 .4-1.95.85-2.75.45 1.25 1.2 2.2 2.15 2.75"}),o.jsx("path",{d:"M9.3 12.65h.01M14.9 12.65h.01M10.8 15.55c.8.5 1.65.5 2.45 0"}),o.jsx("path",{d:"M8.45 19.85c.95-.85 1.45-1.95 1.5-3.25M15.1 16.65c.05 1.2.55 2.3 1.55 3.2"})]})}function Fm({kind:e,...t}){return e==="codex"?o.jsx(I_e,{...t}):e==="openclaw"?o.jsx(j_e,{...t}):o.jsx(R_e,{...t})}const l3="cn-beijing",Sw=[{id:"general",label:"通用智能体"},{id:"codex",label:"Codex 智能体"},{id:"openclaw",label:"OpenClaw 智能体"},{id:"hermes",label:"Hermes 智能体"}],O_e=24,M_e=3e4,Dd=new Map,Jd=new Map,L_e=new Set;function tb(e){if(!e){Dd.clear(),Jd.clear();return}const t=new Set(e);if(t.size!==0){for(const[n,s]of Jd)s.page.runtimes.some(i=>t.has(i.runtimeId))&&Jd.delete(n);Dd.clear()}}function D_e(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"6.2",stroke:"currentColor",strokeWidth:"1.7"}),o.jsx("path",{d:"m15.4 15.4 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function _w(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function P_e({type:e}){return e==="general"?o.jsx(Wc,{}):o.jsx(Fm,{kind:e})}function YA(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(t).replace(/\//g,"-")}function B_e(e){return e==="cn-shanghai"?"上海":e==="cn-beijing"?"北京":e||"—"}function c3(e){var t;return{id:e.runtimeId,name:e.name,description:((t=e.description)==null?void 0:t.trim())||"暂无描述",createdAt:YA(e.createdAt??""),specificationLabel:"创建人",specification:e.author||"—",isMine:e.isMine,runtime:{runtimeId:e.runtimeId,region:e.region,currentVersion:e.currentVersion,canDelete:e.canDelete}}}function U_e(e){return{id:e.id,name:e.displayName||`${e.toolName} 智能体`,description:F1(e.status),createdAt:YA(e.createdAt),specificationLabel:"创建人",specification:e.createdBy||"—",sandbox:e}}function F_e(e){var t;return{id:e.id,name:e.draft.name||"未命名 Agent",description:((t=e.draft.description)==null?void 0:t.trim())||"暂无描述",createdAt:YA(new Date(e.updatedAt).toISOString()),specificationLabel:"存储位置",specification:"当前浏览器",draft:e}}async function $_e(e,t,n){const s=`${e}:all:${t}`,i=Jd.get(s);if(i&&i.expiresAt>Date.now())return n(i.page.runtimes.map(c3)),i.page.nextToken;i&&Jd.delete(s);let r=Dd.get(s);r||(r=l1({scope:e,region:"all",pageSize:O_e,nextToken:t}),Dd.set(s,r),r.then(()=>Dd.delete(s),()=>Dd.delete(s)));const a=await r;return Jd.set(s,{page:a,expiresAt:Date.now()+M_e}),n(a.runtimes.map(c3)),a.nextToken}function H_e({agent:e,onUse:t,onViewDetails:n,connecting:s,connected:i,showOwnership:r,deploymentTask:a,onViewDeploymentTask:l,onEditDraft:c,onDeleteDraft:u}){const d=!!(e.runtime||e.sandbox);return o.jsxs("article",{className:"my-agent-card",children:[o.jsxs("div",{className:"my-agent-card-content",children:[o.jsxs("div",{className:"my-agent-card-title",children:[o.jsxs("div",{className:"my-agent-card-title-copy",children:[o.jsx("h3",{children:e.name}),e.sandbox?o.jsx("span",{className:"my-agent-session-id",title:e.sandbox.id,children:e.sandbox.id}):null]}),e.draft?o.jsx("span",{className:"my-agent-draft-badge",children:a?"部署中":"草稿"}):e.sandbox?o.jsx("span",{className:"my-agent-status-label","data-ready":e.sandbox.status.toLowerCase()==="ready"||void 0,children:e.description}):e.runtime?o.jsxs("div",{className:"my-agent-card-badges",children:[a?o.jsx("span",{className:"my-agent-deploying-badge",children:"部署中"}):null,o.jsx("span",{className:"my-agent-region-badge",children:B_e(e.runtime.region)}),r&&e.isMine?o.jsx("span",{className:"runtime-owner-badge",children:"我创建的"}):null]}):null]}),e.sandbox?null:o.jsx("p",{className:"my-agent-description",children:e.description}),o.jsxs("dl",{className:"my-agent-meta",children:[o.jsxs("div",{className:"my-agent-created-at",children:[o.jsx("dt",{children:e.draft?"更新时间":"创建时间"}),o.jsx("dd",{children:e.createdAt})]}),o.jsxs("div",{className:"my-agent-region",children:[o.jsx("dt",{children:e.specificationLabel}),o.jsx("dd",{children:e.specification})]})]})]}),o.jsx("footer",{className:"my-agent-actions",children:e.draft?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"my-agent-details","aria-label":a?`查看 ${e.name} 部署进度`:`编辑草稿 ${e.name}`,onClick:()=>a?l==null?void 0:l(a):c==null?void 0:c(e.draft),children:a?"查看进度":"编辑"}),o.jsx("button",{type:"button",className:"my-agent-delete","aria-label":`删除草稿 ${e.name}`,onClick:()=>u==null?void 0:u(e.draft),children:"删除"})]}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"my-agent-details",disabled:!d,"aria-label":a?`查看 ${e.name} 部署进度`:`查看 ${e.name} 详情`,onClick:()=>a?l==null?void 0:l(a):n==null?void 0:n(e),children:a?"查看进度":"查看详情"}),o.jsx("button",{type:"button",className:`my-agent-use${i?" is-connected":""}`,disabled:!d||s||i,"aria-busy":s||void 0,"aria-label":i?`${e.name} 已连接`:`使用 ${e.name}`,onClick:()=>void(t==null?void 0:t(e)),children:s?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-use-spinner","aria-hidden":"true"}),o.jsx("span",{children:"连接中"})]}):i?"已连接":"使用"})]})})]})}function z_e({canCreate:e,runtimeScope:t,onCreateAgent:n,onUseAgent:s,onViewAgentDetails:i,onCreateSandboxAgent:r,onUseSandboxAgent:a,onViewSandboxAgentDetails:l,sandboxRefreshKey:c=0,connectedRuntimeId:u="",hiddenRuntimeIds:d=L_e,drafts:f=[],deploymentTasks:h=[],draftDeploymentTaskIds:p={},onViewDeploymentTask:m,onEditDraft:b,onDeleteDraft:v}){const y=g.useRef(null),x=g.useRef(null),E=g.useRef(0),w=g.useRef(0),_=g.useRef(null),[S,k]=g.useState("general"),[T,C]=g.useState(""),[I,j]=g.useState([]),[L,z]=g.useState(""),[D,F]=g.useState(!0),[A,M]=g.useState(""),[P,H]=g.useState([]),[R,Y]=g.useState(!1),[J,U]=g.useState(""),[te,K]=g.useState(""),[V,W]=g.useState(null),q=g.useMemo(()=>f.map(F_e),[f]),ue=g.useMemo(()=>{const Se=new Map,He=new Map;for(const Be of h){if(Be.status!=="running"||(Se.set(Be.id,Be),!Be.runtimeId))continue;const qe=He.get(Be.runtimeId);(!qe||Be.startedAt>qe.startedAt)&&He.set(Be.runtimeId,Be)}return{byId:Se,byRuntimeId:He}},[h]),pe=g.useCallback(Se=>{var Be;if(Se.draft){const qe=p[Se.draft.id];return qe?ue.byId.get(qe):void 0}const He=(Be=Se.runtime)==null?void 0:Be.runtimeId;return He?ue.byRuntimeId.get(He):void 0},[ue,p]),we=g.useCallback((Se,He)=>{const Be=++E.current;return F(!0),M(""),$_e(t,Se,qe=>{E.current===Be&&j(Z=>He?qe:[...Z,...qe])}).then(qe=>{E.current===Be&&z(qe)}).catch(qe=>{E.current===Be&&M(Ld(qe,"加载通用智能体","GET /web/runtimes"))}).finally(()=>{E.current===Be&&F(!1)})},[t]);g.useEffect(()=>{if(S==="general")return j([]),z(""),we("",!0),()=>{E.current+=1}},[S,we]);const de=g.useCallback(async Se=>{var qe,Z;(qe=_.current)==null||qe.abort();const He=new AbortController;_.current=He;const Be=++w.current;Y(!0),U(""),H([]);try{const ae=Se==="codex"?await rn.listSessions({signal:He.signal}):await rn.listAgentSessions(Se,{signal:He.signal});if(w.current!==Be)return;H(ae.map(U_e))}catch(ae){if((ae==null?void 0:ae.name)==="AbortError"||w.current!==Be)return;U(Ld(ae,`加载 ${((Z=Sw.find(ne=>ne.id===Se))==null?void 0:Z.label)??Se}`,`GET /web/${Se==="codex"?"sandbox":Se}/sessions`))}finally{_.current===He&&(_.current=null),w.current===Be&&Y(!1)}},[]);function ge(Se){var He;Se!==S&&(Se==="general"?(E.current+=1,j([]),z(""),M(""),F(!0)):((He=_.current)==null||He.abort(),_.current=null,w.current+=1,H([]),U(""),Y(!0)),k(Se))}g.useEffect(()=>{var Se;if(S==="general"){(Se=_.current)==null||Se.abort(),_.current=null,w.current+=1;return}return de(S),()=>{var He;(He=_.current)==null||He.abort(),_.current=null,w.current+=1}},[S,de,c]),g.useEffect(()=>{const Se=x.current,He=y.current;if(!Se||!He||S!=="general"||!L||D)return;const Be=new IntersectionObserver(([qe])=>{qe.isIntersecting&&we(L,!1)},{root:He,rootMargin:"240px 0px",threshold:.01});return Be.observe(Se),()=>Be.disconnect()},[S,we,D,L]);const Le=g.useCallback(async Se=>{if(!te){K(Se.id);try{await new Promise(He=>requestAnimationFrame(()=>He())),Se.sandbox?await a(Se.sandbox):await s(Se)}finally{K("")}}},[te,s,a]),Ee=g.useMemo(()=>{const Se=T.trim().toLocaleLowerCase(),He=S==="general"?[...q,...I]:P,Be=Se?He.filter(ae=>ae.name.toLocaleLowerCase().includes(Se)):He;if(S!=="general")return Be;const qe=d.size>0?Be.filter(ae=>!ae.runtime||!d.has(ae.runtime.runtimeId)):Be,Z=qe.findIndex(ae=>{var ne;return((ne=ae.runtime)==null?void 0:ne.runtimeId)===u});return Z<=0?qe:[qe[Z],...qe.slice(0,Z),...qe.slice(Z+1)]},[S,u,q,d,T,I,P]),ie=Sw.find(Se=>Se.id===S),Ne=(ie==null?void 0:ie.label)??"智能体",ve=S==="general"?D&&I.length===0&&q.length===0:R&&P.length===0,Qe=!ve&&Ee.length===0,De=e?S==="general"?()=>n(l3):()=>r(S):void 0,Ke=e?void 0:"当前账号没有创建智能体权限";return o.jsxs("div",{className:"my-agents-page",children:[o.jsxs("header",{className:"my-agents-header",children:[o.jsxs("div",{className:"my-agents-heading",children:[o.jsx("div",{className:"my-agents-title-row",children:o.jsx("h1",{children:"智能体"})}),o.jsx("p",{children:t==="all"?"在此处浏览所有智能体":"在此处浏览您的所有智能体"})]}),o.jsxs("label",{className:"my-agent-search",children:[o.jsx(D_e,{}),o.jsx("input",{type:"search","aria-label":"搜索智能体",value:T,onChange:Se=>C(Se.target.value),placeholder:"搜索所有类型智能体名称"})]})]}),o.jsxs("div",{className:"my-agent-type-bar",children:[o.jsx("nav",{className:"my-agent-type-pills","aria-label":"智能体类型",children:Sw.map(Se=>o.jsx("button",{type:"button",className:`my-agent-type-pill${S===Se.id?" is-active":""}`,"aria-pressed":S===Se.id,onClick:()=>ge(Se.id),children:Se.label},Se.id))}),o.jsxs("button",{type:"button",className:"my-agent-create-primary",disabled:!De,title:Ke,onClick:()=>De==null?void 0:De(),children:[o.jsx(_w,{}),o.jsx("span",{children:"创建智能体"})]})]}),o.jsxs("section",{className:"my-agent-results",ref:y,"aria-label":`${Ne}列表`,children:[ve?o.jsxs("div",{className:"my-agent-initial-loading",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载智能体"})]}):(S==="general"?A:J)&&Ee.length===0?o.jsxs("div",{className:"my-agent-empty",role:"alert",children:[o.jsx("p",{children:S==="general"?A:J}),o.jsx("button",{type:"button",onClick:()=>{S==="general"?we("",!0):de(S)},children:"重新加载"})]}):Qe?T.trim()?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(Qn,{fill:"none",children:[o.jsx(Qn.Icon,{children:o.jsx(f_e,{})}),o.jsx(Qn.Title,{children:"没有匹配的智能体"}),o.jsx(Qn.Description,{children:"请尝试搜索其他名称"})]})}):S!=="general"?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(Qn,{fill:"none",children:[o.jsx(Qn.Icon,{children:o.jsx(P_e,{type:S})}),o.jsxs(Qn.Title,{children:["暂无 ",Ne]}),e?o.jsx(Qn.ActionRow,{children:o.jsxs(n3,{color:"primary",size:"lg",onClick:()=>r(S),children:[o.jsx(_w,{}),"创建智能体"]})}):null]})}):o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(Qn,{fill:"none",children:[o.jsx(Qn.Icon,{children:o.jsx(Wc,{})}),o.jsx(Qn.Title,{children:"暂无通用智能体"}),o.jsx(Qn.Description,{children:"创建一个通用智能体,开始构建和对话"}),e?o.jsx(Qn.ActionRow,{children:o.jsxs(n3,{color:"primary",size:"lg",onClick:()=>n(l3),children:[o.jsx(_w,{}),"创建智能体"]})}):null]})}):o.jsxs(o.Fragment,{children:[S==="general"&&A?o.jsxs("div",{className:"my-agent-inline-error",role:"alert",children:[o.jsx("span",{children:A}),o.jsx("button",{type:"button",onClick:()=>void we("",!0),children:"重新加载"})]}):null,o.jsx("div",{className:"my-agent-grid",children:Ee.map(Se=>{var He;return o.jsx(H_e,{agent:Se,deploymentTask:pe(Se),onViewDeploymentTask:m,onUse:Le,onViewDetails:Be=>{Be.sandbox?l(Be.sandbox):i(Be)},connecting:Se.id===te,connected:((He=Se.runtime)==null?void 0:He.runtimeId)===u,showOwnership:t==="all",onEditDraft:b,onDeleteDraft:W},Se.id)})})]}),S==="general"&&!A&&!ve&&(Ee.length>0||!!L)&&o.jsx("div",{className:"my-agent-load-more",ref:x,"aria-live":"polite",children:D?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载更多智能体"})]}):L?o.jsx("span",{children:"继续下滑加载更多"}):o.jsx("span",{children:"已加载全部智能体"})})]}),V?o.jsx(qA,{title:"删除草稿?",description:`删除后将无法恢复“${V.draft.name||"未命名 Agent"}”。`,confirmLabel:"删除草稿",variant:"danger",onCancel:()=>W(null),onConfirm:()=>{v==null||v(V),W(null)}}):null]})}const V_e={id:"coding-agents",kind:"coding-agent",category:"development",icon:"coding-agents",name:"配置 Coding Agents",badge:"本地",badgeTone:"success",description:"将 VeADK 和 AgentKit 内置 Skills 全局配置到 Trae、Claude Code 或 Codex。"},G_e={id:"feishu",kind:"feishu",category:"channels",icon:"feishu",name:"飞书机器人",badge:"Beta",description:"创建飞书机器人,并将消息直接接入 AgentKit Runtime。"},K_e="https://api.github.com",q_e=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,u3=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,199}$/,Y_e=/^[A-Za-z0-9._/-]+$/;function W_e(e,t,n){return e===401||e===403?"GitHub Token 无效或没有仓库写入权限":e===404?"仓库、分支或文件不存在,或 Token 无权访问":e===422?"GitHub 拒绝了提交,请检查分支和文件状态":String((t==null?void 0:t.message)||"").split(n).join("***").trim().slice(0,240)||`GitHub 请求失败(HTTP ${e})`}async function vc(e,t){const n={Accept:"application/vnd.github+json",Authorization:`Bearer ${t.token}`,"X-GitHub-Api-Version":"2022-11-28"};t.body&&(n["Content-Type"]="application/json");let s;try{s=await fetch(`${K_e}${e}`,{method:t.method||"GET",headers:n,body:t.body?JSON.stringify(t.body):void 0,signal:t.signal})}catch(r){throw t.signal.aborted?r:new Error("连接 GitHub 失败,请检查网络后重试")}const i=await s.json().catch(()=>null);if(!t.expected.includes(s.status))throw new Error(W_e(s.status,i,t.token));return{status:s.status,payload:i}}function Nw(e){return e.split("/").map(encodeURIComponent).join("/")}function X_e(e){const t=new TextEncoder().encode(e);let n="";const s=32768;for(let i=0;i({...h,path:WA(h.path,"")})),r=AbortSignal.any([t,AbortSignal.timeout(6e4)]),a=`/repos/${n}`;await vc(`${a}`,{token:e.token,expected:[200],signal:r});const c=(f=(await vc(`${a}/git/ref/heads/${Nw(s)}`,{token:e.token,expected:[200],signal:r})).payload.object)==null?void 0:f.sha;if(!c)throw new Error("目标分支缺少有效 Git SHA");const u=Q_e(e.branchPrefix);await vc(`${a}/git/refs`,{token:e.token,expected:[201],signal:r,method:"POST",body:{ref:`refs/heads/${u}`,sha:c}});let d=!0;try{for(const p of i){const m=Nw(p.path),b=await vc(`${a}/contents/${m}?ref=${encodeURIComponent(s)}`,{token:e.token,expected:[200,404],signal:r});if(p.mustBeNew&&b.status===200)throw new Error(`目标仓库中已存在 ${p.path},未覆盖现有文件`);if(b.status===200&&!b.payload.sha)throw new Error(`目标路径 ${p.path} 不是可更新的文件`);await vc(`${a}/contents/${m}`,{token:e.token,expected:[200,201],signal:r,method:"PUT",body:{message:p.commitMessage,content:X_e(p.content),branch:u,...b.payload.sha?{sha:b.payload.sha}:{}}})}const h=await vc(`${a}/pulls`,{token:e.token,expected:[201],signal:r,method:"POST",body:{title:e.title,head:u,base:s,body:e.description}});if(!h.payload.number||!h.payload.html_url)throw new Error("GitHub 未返回有效的 Pull Request");return d=!1,{number:h.payload.number,url:h.payload.html_url,branch:u}}finally{d&&await vc(`${a}/git/refs/heads/${Nw(u)}`,{token:e.token,expected:[204],signal:AbortSignal.timeout(15e3),method:"DELETE"}).catch(()=>{})}}const QA={name:"repository",label:"GitHub Repo",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL",required:!0},ZA={name:"baseBranch",label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base",required:!1},J$={name:"runtimeName",label:"Runtime 名称",placeholder:"support-agent",help:"用于 AgentKit 发布配置",required:!0},eH={name:"runtimeId",label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"持续更新的目标 AgentKit Runtime",required:!0};function JA(e={}){return{repository:"",baseBranch:"main",projectPath:".",runtimeName:"",runtimeId:"",sandboxToolId:"",modelName:"",modelBaseUrl:"https://ark.cn-beijing.volces.com/api/coding/v3",region:"cn-beijing",token:"",...e}}function e2(e){return{repository:e.repository.trim(),baseBranch:e.baseBranch.trim()||"main",region:e.region,token:e.token.trim()}}const Z_e=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/,J_e=/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/;function eNe(e){if(!Z_e.test(e.sandboxToolId))throw new Error("Sandbox Tool ID 格式不正确");if(!J_e.test(e.modelName))throw new Error("模型名称格式不正确");let t;try{t=new URL(e.modelBaseUrl)}catch{throw new Error("模型 API 地址必须是安全的 HTTPS URL")}if(t.protocol!=="https:"||!t.hostname||t.username||t.password||t.search||t.hash)throw new Error("模型 API 地址必须是安全的 HTTPS URL")}function tNe(e){eNe(e);const t=String.raw`name: PR Automated Review "on": pull_request: @@ -730,7 +730,7 @@ jobs: gh pr review "__GH__ github.event.pull_request.number }}" \ --comment \ --body-file review-body.md -`,n={__GH__:"${{",__REGION__:JSON.stringify(e.region),__SANDBOX_TOOL_ID__:JSON.stringify(e.sandboxToolId),__MODEL_NAME__:JSON.stringify(e.modelName),__MODEL_BASE_URL__:JSON.stringify(e.modelBaseUrl)};return Object.entries(n).reduce((s,[i,r])=>s.split(i).join(r),t)}const Z_e={id:"review",kind:"github",category:"development",icon:"github",name:"PR 自动评审",description:"在隔离 Sandbox 中评审代码变更,并将结果发布到 Pull Request。",title:"PR 自动评审",subtitle:"在隔离 Sandbox 中检查代码变更并把结果发布到 Pull Request",panel:"工作流仅评审同仓库的非草稿 PR;fork PR 不会读取仓库 Secrets。",submitLabel:"添加评审并提交 PR",fields:[qA,YA,{name:"sandboxToolId",label:"Sandbox Tool ID",placeholder:"tool-xxxxxxxx",help:"用于运行每次评审的 AgentKit CodeEnv",required:!0},{name:"modelName",label:"评审模型",placeholder:"doubao-seed-code-preview",help:"注入 Sandbox 的代码评审模型名称",required:!0},{name:"modelBaseUrl",label:"模型 API 地址",placeholder:"https://ark.cn-beijing.volces.com/api/coding/v3",help:"必须使用 OpenAI 兼容的 HTTPS 地址",required:!0}],initialValues:WA(),regionHelp:"必须与 Sandbox Tool 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","CODEX_MODEL_API_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=XA(e);return KA({...n,files:[{path:".github/workflows/codex-pr-review.yml",content:Q_e({sandboxToolId:e.sandboxToolId.trim(),modelName:e.modelName.trim(),modelBaseUrl:e.modelBaseUrl.trim(),region:n.region}),commitMessage:"chore: configure PR automated review"}],branchPrefix:"chore/pr-automated-review",title:"chore: 配置 PR 自动评审",description:"新增 GitHub Actions 工作流,在隔离 Sandbox 中评审同仓库 PR,并将结果发布为 GitHub Review。合并前请配置工作流所需 Secrets。"},t)}},J_e=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,eNe=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;function tNe(e){if(!J_e.test(e.runtimeName))throw new Error("Runtime 名称需以字母开头,且只能包含字母、数字、下划线和连字符");if(!eNe.test(e.runtimeId))throw new Error("Runtime ID 格式不正确")}function Q$(e){tNe(e);const t=`name: Publish to AgentKit Runtime +`,n={__GH__:"${{",__REGION__:JSON.stringify(e.region),__SANDBOX_TOOL_ID__:JSON.stringify(e.sandboxToolId),__MODEL_NAME__:JSON.stringify(e.modelName),__MODEL_BASE_URL__:JSON.stringify(e.modelBaseUrl)};return Object.entries(n).reduce((s,[i,r])=>s.split(i).join(r),t)}const nNe={id:"review",kind:"github",category:"development",icon:"github",name:"PR 自动评审",description:"在隔离 Sandbox 中评审代码变更,并将结果发布到 Pull Request。",title:"PR 自动评审",subtitle:"在隔离 Sandbox 中检查代码变更并把结果发布到 Pull Request",panel:"工作流仅评审同仓库的非草稿 PR;fork PR 不会读取仓库 Secrets。",submitLabel:"添加评审并提交 PR",fields:[QA,ZA,{name:"sandboxToolId",label:"Sandbox Tool ID",placeholder:"tool-xxxxxxxx",help:"用于运行每次评审的 AgentKit CodeEnv",required:!0},{name:"modelName",label:"评审模型",placeholder:"doubao-seed-code-preview",help:"注入 Sandbox 的代码评审模型名称",required:!0},{name:"modelBaseUrl",label:"模型 API 地址",placeholder:"https://ark.cn-beijing.volces.com/api/coding/v3",help:"必须使用 OpenAI 兼容的 HTTPS 地址",required:!0}],initialValues:JA(),regionHelp:"必须与 Sandbox Tool 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","CODEX_MODEL_API_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=e2(e);return XA({...n,files:[{path:".github/workflows/codex-pr-review.yml",content:tNe({sandboxToolId:e.sandboxToolId.trim(),modelName:e.modelName.trim(),modelBaseUrl:e.modelBaseUrl.trim(),region:n.region}),commitMessage:"chore: configure PR automated review"}],branchPrefix:"chore/pr-automated-review",title:"chore: 配置 PR 自动评审",description:"新增 GitHub Actions 工作流,在隔离 Sandbox 中评审同仓库 PR,并将结果发布为 GitHub Review。合并前请配置工作流所需 Secrets。"},t)}},sNe=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,iNe=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;function rNe(e){if(!sNe.test(e.runtimeName))throw new Error("Runtime 名称需以字母开头,且只能包含字母、数字、下划线和连字符");if(!iNe.test(e.runtimeId))throw new Error("Runtime ID 格式不正确")}function tH(e){rNe(e);const t=`name: Publish to AgentKit Runtime on: push: @@ -826,7 +826,7 @@ jobs: if not result.success: raise SystemExit(f"AgentKit publish failed: {result.error}") PY -`,n={__BASE_BRANCH__:JSON.stringify(e.baseBranch),__PROJECT_PATH__:JSON.stringify(e.projectPath),__RUNTIME_NAME__:JSON.stringify(e.runtimeName),__RUNTIME_ID__:JSON.stringify(e.runtimeId),__REGION__:JSON.stringify(e.region),__CONCURRENCY_GROUP__:JSON.stringify(`agentkit-runtime-${e.runtimeId}`)};return Object.entries(n).reduce((s,[i,r])=>s.split(i).join(r),t)}const nNe={id:"delivery",kind:"github",category:"development",icon:"github",name:"AgentKit Runtime 持续交付",description:"为您的仓库添加持续交付到 AgentKit Runtime 的自动化工作流。",title:"AgentKit Runtime 持续交付",subtitle:"用 Pull Request 把持续发布配置安全地加入代码仓库",panel:"提交后将在目标仓库创建发布分支,并发起包含 GitHub Actions 工作流的 PR。",submitLabel:"确定并提交 PR",fields:[qA,YA,{name:"projectPath",label:"Agent 项目目录",placeholder:".",help:"留空时使用仓库根目录;目录内需包含挂载完整 Studio App Server 的 app.py",required:!1},W$,X$],initialValues:WA(),regionHelp:"必须与目标 Runtime 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=XA(e),s=GA(e.projectPath,".");return KA({...n,files:[{path:".github/workflows/publish-agentkit.yml",content:Q$({baseBranch:n.baseBranch,projectPath:s,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:n.region}),commitMessage:"feat: publish Agent to AgentKit Runtime"}],branchPrefix:"feat/agentkit-release",title:"feat: 持续发布到 AgentKit Runtime",description:"新增 GitHub Actions 工作流,在目标分支更新时持续发布到 AgentKit Runtime。合并前请配置工作流所需的 Volcengine Secrets。"},t)}};function sNe(e,t){return e==="."?t:`${e}/${t}`}function iNe(e){return`.github/workflows/publish-agentkit-${e.replace(/[^A-Za-z0-9]+/g,"-").replace(/^-|-$/g,"").toLowerCase()||"root"}.yml`}function rNe(e){return Object.fromEntries(Object.entries({"app.py":`"""__PROJECT_NAME__ — a VeADK agent with the full Studio App Server.""" +`,n={__BASE_BRANCH__:JSON.stringify(e.baseBranch),__PROJECT_PATH__:JSON.stringify(e.projectPath),__RUNTIME_NAME__:JSON.stringify(e.runtimeName),__RUNTIME_ID__:JSON.stringify(e.runtimeId),__REGION__:JSON.stringify(e.region),__CONCURRENCY_GROUP__:JSON.stringify(`agentkit-runtime-${e.runtimeId}`)};return Object.entries(n).reduce((s,[i,r])=>s.split(i).join(r),t)}const aNe={id:"delivery",kind:"github",category:"development",icon:"github",name:"AgentKit Runtime 持续交付",description:"为您的仓库添加持续交付到 AgentKit Runtime 的自动化工作流。",title:"AgentKit Runtime 持续交付",subtitle:"用 Pull Request 把持续发布配置安全地加入代码仓库",panel:"提交后将在目标仓库创建发布分支,并发起包含 GitHub Actions 工作流的 PR。",submitLabel:"确定并提交 PR",fields:[QA,ZA,{name:"projectPath",label:"Agent 项目目录",placeholder:".",help:"留空时使用仓库根目录;目录内需包含挂载完整 Studio App Server 的 app.py",required:!1},J$,eH],initialValues:JA(),regionHelp:"必须与目标 Runtime 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=e2(e),s=WA(e.projectPath,".");return XA({...n,files:[{path:".github/workflows/publish-agentkit.yml",content:tH({baseBranch:n.baseBranch,projectPath:s,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:n.region}),commitMessage:"feat: publish Agent to AgentKit Runtime"}],branchPrefix:"feat/agentkit-release",title:"feat: 持续发布到 AgentKit Runtime",description:"新增 GitHub Actions 工作流,在目标分支更新时持续发布到 AgentKit Runtime。合并前请配置工作流所需的 Volcengine Secrets。"},t)}};function oNe(e,t){return e==="."?t:`${e}/${t}`}function lNe(e){return`.github/workflows/publish-agentkit-${e.replace(/[^A-Za-z0-9]+/g,"-").replace(/^-|-$/g,"").toLowerCase()||"root"}.yml`}function cNe(e){return Object.fromEntries(Object.entries({"app.py":`"""__PROJECT_NAME__ — a VeADK agent with the full Studio App Server.""" from assistant import root_agent from veadk.integrations.agentkit import create_agentkit_app, run_agentkit_app @@ -934,78 +934,78 @@ __pycache__/ Dockerfile .dockerignore README.md -`}).map(([n,s])=>[n,s.split("__PROJECT_NAME__").join(e)]))}const aNe={id:"template",kind:"github",category:"development",icon:"github",name:"模板项目导入",description:"在您的仓库中创建一个可持续交付到 AgentKit Runtime 的最简智能体",title:"模板项目导入",subtitle:"把可直接启动 Studio 的 basic Agent 和持续交付配置加入仓库",panel:"提交后将创建一个 PR,同时导入 basic 项目和 AgentKit Runtime 发布工作流。",submitLabel:"导入模板并提交 PR",fields:[qA,YA,{name:"projectPath",label:"Agent 项目目录",placeholder:"agentkit-basic-agent",help:"将在此目录新增 basic 项目;app.py 挂载完整 Studio App Server,并作为服务入口启动",required:!0},W$,X$],initialValues:WA({projectPath:"agentkit-basic-agent"}),regionHelp:"必须与目标 Runtime 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=XA(e),s=Y$(n.repository),i=GA(e.projectPath,"agentkit-basic-agent"),r=i==="."?s.split("/").slice(-1)[0]||"agentkit-basic-agent":i.split("/").slice(-1)[0]||"agentkit-basic-agent",a=Object.entries(rNe(r)).map(([l,c])=>({path:sNe(i,l),content:c,commitMessage:"feat: import AgentKit basic template",mustBeNew:!0}));return a.push({path:iNe(i),content:Q$({baseBranch:n.baseBranch,projectPath:i,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:n.region}),commitMessage:"feat: add AgentKit Runtime delivery",mustBeNew:!0}),KA({...n,repository:s,files:a,branchPrefix:"feat/agentkit-basic-template",title:"feat: 导入 AgentKit basic 模板",description:"导入带有 AgentKit Studio App Server 的 basic Agent 项目,并添加持续发布到 AgentKit Runtime 的工作流。合并前请配置 Volcengine Secrets。"},t)}},o3=[{id:"development",label:"研发"},{id:"channels",label:"消息渠道"}],Z$=[F_e,aNe,nNe,Z_e,$_e],oNe=new Map(Z$.map(e=>[e.id,e]));function lNe(e){const t=oNe.get(e);if(!t)throw new Error(`Unknown automation: ${e}`);return t}function cNe(e){const t=lNe(e);if(t.kind!=="github")throw new Error(`Automation is not backed by GitHub: ${e}`);return t}const QA="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2048%2048'%3e%3cimage%20width='48'%20height='48'%20href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAMKADAAQAAAABAAAAMAAAAADbN2wMAAAH7UlEQVRoBdVZWWwbVRQ9492Onc1xTfaWLukq9oSqLKnYBZRSNgn6AagsAgmJRfzxg4SEEDtiER8IBKKAChK0FS1tKYWW0lZQKKV0gxCVJm3ikDiO17EdzrUzSdw4jj1OpeQqNzO237vvnHfvu/e9GWVwcBBDYue1mrqE2kI1UqeSJAnmIHUzNUCNUmGiKtQy6oPUR6geqnw/FSVOUH9R36KupfaDHnBQn6MGqEnqVJcEAfZTBbNL4b+lZPI1VbwwnaSfYO8z8N+TVMd0Qj6EVdbs3eIBP29cVFkL00kk+wSEwHAamgh9bDAJSQWTITZFnF+85J1tBPyOUC9OqqnsVdTIRkVBi70Msy125uriHJ8XAXFRfzKBTQM+rO0/hc54cSQE8iyzAx/XLcEltjIU44uCQijOaHvPfxIv97TjWCzEcMo7+sZ4TGa+2V6KT2rPQ73ZptsPBZE30fVrymvxTvUCtDoqYC0ijhMk/3MkgDd62xFheOqVggjIIAbOVaujEh/ULsaNzioUsxhVAv/A34GD0YBubxZMQJupWpMNr58zHytcHth1ekICsDcRx4u+fxBK6vOCbgKyEIXEK975WOmaoZuErKv1QR8ORQd0eUE3Ac0TNSYrXvI24fZSLxwGfebiDKW3e08gln9J0oYvKoMNG6kmiRdmzMOtTi8sOsJJJfANA93oiseGbeZ7k1EHZAKCEcApu4wCxUsSz3rm4HQiim3B/wpOsBJA2yP/4cZIJYIBFcGwCjWeSKEwm4wosZtR7rKizGXJQJZRB1TuttftAprnAbOrM9rl9UHqwg+s1o+eOow/GNN5CaPOklSgdKq4us+Ji7pt6Dw1AF9vBOGImjJht5lRVWFDY7UL58/3wOt2YPEcN2xWVpPRe6EQC+y9rwINPNKsuRaYX5cXhIxGkks+Y7V+6vQRdLBi5yx1bGwicFebivj+ARgOhZGMJMFyQyWpoV2GRIa2ZXOX2bDyqnPxzEPNKC+1Zj957eDBTbz34PXAwvoMfBN+kGV8Bxf00VgQz/vaEB6nSCnRQVj2h2DZG4TyZwQWlSils3m8RDDEhk2uaqlHaYklVb3Ha42dh4B3eMzZ//eEmMc0kGL3cEU9WksqU4XvzAYKZ9n6fQCOz3thORCGkhgCf2bDMz4bjQpW39yE65Y1QO5FxiUgP+76E3hzI7D1VyBcwP5NTFcZzXjaPRMNZmvGPkfA23YMwLHRD0Mf3ZwTgaBIi8GgYMGsSjx2z3kEP9Jp5E5rOeoqQH75C3htPfDpD4CskXxFvHC5vQKPVjSwPqQfcKTAfxuA/Ws/lBAXwEhUTGjWSAL3r1qYykSju+UkIFbZDx09wPvb0iH1W9uEYw03MHAV3ltew1CqgDkyCNtWgt/cnwY/3GriG5n9hbMrccNljRmzLz0nJCCNJBsEwsCH24E3NgDr96brhfyWS2Sm3EYLVsOL0i0DsG8h+LDkqcLExHhfc9siVDDrjJ59sZJRyHKZFRKybiSkTtIjR08CrXwEdtGcXL2A4+192LOuDeatfqg6wMvsL5lbhWuWysIdO995E9BgSkh19THX7wQOtANXLgKWLQSaarUWI9dNP7bjo68OY9uef6GqhcW8ZkViX2a/nBWYQ4+RggmIBfFGnHgOcD0c7wD2HgOW0xuXk0xN5SDaOwL4cnsb1m05joPHejKK0hgEOb4Q8Muba3H1pXUwZZl96aqLgHSU2RCbEe6/9hzh875OYPdhYF5NDLt/Oohd+46gNxBjm2zzJhZyi/RyV5TggdsvRJnTOm5j3QQ0i9ra6OHj1u9+B/YdNcLXVQdDmYNPy9oZ971IcIPHjUHadVrHHFfZNphtTtx508W4eJEHsg7Gk6IJaIZlDEn3EdUEl7sBg4la2MtqkYgNIOz/F9FgF6IhX6p5mozcjgbGasw/xWCCs7IeN7U24b4VddwZj26jjTZynTQCmknxSBqIETanh7ceWEpmpIiokT7E6JFosBvxaD/iJCeNDQYzTFYnzHY3SsobmfM9eOyucjTO0KyOf510AqOHkl2kiMlSQoAlsPLAk4hHSCaIJMMqmUgfYBQeggxGK4xmOxprXHh8lYK51em+E/0/qwQyBh8iY+Q52pjlOZD8XFcFPHELcGlT3stlbBaymtOROTReBoZJ+0DjZ9pv4SFq9fL0YWqcjJl1+AwP8OSGS+amq6y4P/fyyWqvoC9lDAG7ainPEJcBs7xMBGOLbU6bGQTMJHAnDUlG2biPFZevEM4GCZl9sSsnPgG+bAHfa+l8vZJxpNSo+oPp/c4XP6bPBN0kog2qtdFz1WzIkfXmZuAKVm6JewlbvZKVgGZMilMPwW9ngdr5B3CEG7iEbCY5ffl6RgPtYDGdybS4ogW4YDbgLefTD5s2kv5rTgKaWdlKi1fau4BDJ3jM5I70NDd0J7grzfZEUMg5CM5Tmg4TiW3ZtVYxTKpcgM2iWS7+mhcBbRiZ/TBTd4jPjtSEVF3AxxdUPgkxTrUUMTcBykKUmLZwhQlYPhWBeCBV5DRjk3QtiEC2McUDsjPVCEhWEQ8Umk2y2c7nOyEwrV/ySdbdQo3nw3aKtRHM3wiBtVQu02knISJ+SQh8Q32TyqTJJ6xTXyQzyzb2LeoBWQOy5pjwcDf1YSqzNIooLex99kTCppsq4N+l+oUArylhoku9sb+O18VU8c5UEiZu7KGyrKKTmgr7/wGxhy03aZIycwAAAABJRU5ErkJggg=='%20/%3e%3c/svg%3e";function J$(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91 .58 .11 .79-.25.79-.56v-2.02c-3.2.7-3.88-1.36-3.88-1.36-.52-1.33-1.28-1.69-1.28-1.69-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.77 2.71 1.26 3.37.96.1-.75.4-1.26.73-1.55-2.56-.29-5.25-1.28-5.25-5.7 0-1.26.45-2.29 1.19-3.1-.12-.29-.52-1.47.11-3.06 0 0 .97-.31 3.16 1.18A10.98 10.98 0 0 1 12 6.11c.98 0 1.96.13 2.87.39 2.19-1.49 3.16-1.18 3.16-1.18.63 1.59.23 2.77.11 3.06.74.81 1.19 1.84 1.19 3.1 0 4.43-2.7 5.4-5.27 5.69.42.36.78 1.06.78 2.14v3.04c0 .31.21.67.8.56A11.51 11.51 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z"})})}function l3(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"6.2",stroke:"currentColor",strokeWidth:"1.7"}),o.jsx("path",{d:"m15.4 15.4 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function uNe(e){return o.jsxs("svg",{viewBox:"0 0 36 36",fill:"none","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"18",height:"18",rx:"5",fill:"currentColor",opacity:"0.1"}),o.jsx("rect",{x:"3.5",y:"5",width:"18",height:"18",rx:"5",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("path",{d:"m9.2 11.2-2.8 2.7 2.8 2.7M12.1 17.4h4.3",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("circle",{cx:"26.5",cy:"12",r:"3",fill:"hsl(var(--background))",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("circle",{cx:"27",cy:"26.5",r:"3",fill:"hsl(var(--background))",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("path",{d:"M21.5 12h2M19.3 21l5.6 3.8M27 15v8.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function dNe({onOpen:e}){var c;const[t,n]=g.useState("development"),[s,i]=g.useState(""),r=g.useDeferredValue(s),a=g.useMemo(()=>{const u=r.trim().toLocaleLowerCase();return Z$.filter(d=>d.category===t).filter(d=>!u||`${d.name} ${d.description}`.toLocaleLowerCase().includes(u))},[t,r]),l=(c=o3.find(u=>u.id===t))==null?void 0:c.label;return o.jsxs("div",{className:"applications-page",children:[o.jsxs("header",{className:"applications-header",children:[o.jsxs("div",{children:[o.jsx("h1",{children:"自动化"}),o.jsx("p",{children:"连接研发工具,为智能体扩展自动化工作流"})]}),o.jsxs("label",{className:"applications-search",children:[o.jsx(l3,{}),o.jsx("input",{type:"search","aria-label":"搜索自动化",value:s,onChange:u=>i(u.target.value),placeholder:"搜索自动化"})]})]}),o.jsx("nav",{className:"applications-categories","aria-label":"自动化分类",children:o3.map(u=>o.jsx("button",{type:"button",className:t===u.id?"is-active":"","aria-pressed":t===u.id,onClick:()=>n(u.id),children:u.label},u.id))}),o.jsx("section",{className:"applications-results","aria-label":`${l}自动化列表`,children:a.length?o.jsx("div",{className:"applications-grid",children:a.map(u=>o.jsxs("button",{type:"button",className:"application-card",onClick:()=>e(u.id),"aria-label":`打开${u.name}`,children:[u.icon==="feishu"?o.jsx("img",{className:"application-card-icon application-card-brand-icon",src:QA,alt:"","aria-hidden":"true"}):u.icon==="coding-agents"?o.jsx(uNe,{className:"application-card-icon"}):o.jsx(J$,{className:"application-card-icon"}),o.jsxs("div",{className:"application-card-copy",children:[o.jsxs("div",{className:"application-card-title",children:[o.jsx("h2",{children:u.name}),u.badge?o.jsx("span",{className:`application-card-badge is-${u.badgeTone||"default"}`,children:u.badge}):null]}),o.jsx("p",{children:u.description})]})]},u.id))}):o.jsxs("div",{className:"applications-empty",role:"status",children:[o.jsx(l3,{}),o.jsx("h2",{children:"没有匹配的自动化"}),o.jsx("p",{children:"请尝试搜索其他名称"})]})})]})}function fNe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function hNe({hidden:e,...t}){return o.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[o.jsx("path",{d:"M2.5 10s2.6-4 7.5-4 7.5 4 7.5 4-2.6 4-7.5 4-7.5-4-7.5-4Z"}),o.jsx("circle",{cx:"10",cy:"10",r:"1.8"}),e?o.jsx("path",{d:"m4 4 12 12"}):null]})}function c3(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M6.5 4H4.8A1.8 1.8 0 0 0 3 5.8v5.4A1.8 1.8 0 0 0 4.8 13h5.4a1.8 1.8 0 0 0 1.8-1.8V9.5M9 3h4v4M12.5 3.5 7.2 8.8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function pNe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function mNe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6.2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Sw(e,t,n){const s=t.trim();if(!s)return n?"此项不能为空":"";if(e==="repository"&&!/^(?:https:\/\/github\.com\/)?[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+(?:\.git)?$/.test(s))return"请输入 owner/repository 或完整 GitHub Repo URL";if(e==="baseBranch"&&(!/^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(s)||s.includes("..")))return"目标分支格式不正确";if(e==="projectPath"&&(s.startsWith("/")||s.split("/").includes("..")))return"请输入仓库内的相对目录";if(e==="runtimeName"&&!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(s))return"以字母开头,仅支持字母、数字、下划线和连字符";if(e==="runtimeId"&&!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(s))return"Runtime ID 格式不正确";if(e==="sandboxToolId"&&!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(s))return"Sandbox Tool ID 格式不正确";if(e==="modelName"&&!/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/.test(s))return"模型名称格式不正确";if(e==="modelBaseUrl")try{const i=new URL(s);if(i.protocol!=="https:"||i.username||i.password||i.search||i.hash)return"请输入不含凭据、查询参数或锚点的 HTTPS 地址"}catch{return"请输入有效的 HTTPS 地址"}return""}function gNe({automation:e,onBack:t}){const n=cNe(e),[s,i]=g.useState(()=>({...n.initialValues})),[r,a]=g.useState({}),[l,c]=g.useState(""),[u,d]=g.useState(!1),[f,h]=g.useState(!1),[p,m]=g.useState(!1),[b,v]=g.useState(null),y=g.useRef(null);g.useEffect(()=>()=>{var k;return(k=y.current)==null?void 0:k.abort()},[]);const x=(k,T)=>{i(C=>({...C,[k]:T})),r[k]&&a(C=>({...C,[k]:""}))},E=k=>{var I;const T=k==="token"||((I=n.fields.find(j=>j.name===k))==null?void 0:I.required)===!0,C=Sw(k,s[k],T);a(j=>({...j,[k]:C}))},w=async k=>{var j;k.preventDefault();const T={};for(const L of n.fields){const z=Sw(L.name,s[L.name],L.required);z&&(T[L.name]=z)}const C=Sw("token",s.token,!0);if(C&&(T.token=C),a(T),Object.keys(T).length)return;(j=y.current)==null||j.abort();const I=new AbortController;y.current=I,d(!0),c(""),v(null);try{const L=await n.submit(s,I.signal);if(y.current!==I)return;v(L),i(z=>({...z,token:""}))}catch(L){if(I.signal.aborted||y.current!==I)return;c(L instanceof Error?L.message:String(L))}finally{y.current===I&&(y.current=null,d(!1))}},_=k=>{k.key==="Enter"&&(k.nativeEvent.isComposing||k.nativeEvent.keyCode===229)&&k.preventDefault()},S=k=>{const{name:T,label:C,placeholder:I,help:j,required:L}=k;return o.jsxs("div",{className:"github-field",children:[o.jsxs("label",{htmlFor:`github-${T}`,children:[o.jsx("span",{children:C}),o.jsx("span",{className:`github-field-requirement${L?" is-required":""}`,children:L?"必填":"可选"})]}),o.jsx("input",{id:`github-${T}`,value:s[T],onChange:z=>x(T,z.target.value),onBlur:()=>E(T),placeholder:I,required:L,"aria-invalid":!!r[T],"aria-describedby":`github-${T}-help${r[T]?` github-${T}-error`:""}`}),o.jsx("span",{id:`github-${T}-help`,className:"github-field-help",children:j}),r[T]?o.jsx("span",{id:`github-${T}-error`,className:"github-field-error",role:"alert",children:r[T]}):null]},T)};return o.jsxs("div",{className:"github-integration-page",children:[o.jsxs("header",{className:"github-integration-header",children:[o.jsx("button",{type:"button",className:"github-back",onClick:t,"aria-label":"返回自动化列表",children:o.jsx(fNe,{})}),o.jsx(J$,{className:"github-integration-logo"}),o.jsxs("div",{children:[o.jsx("h1",{children:n.title}),o.jsx("p",{children:n.subtitle})]})]}),o.jsx("div",{className:"github-integration-layout",children:o.jsxs("section",{id:`github-panel-${e}`,className:"github-section-panel",children:[o.jsx("div",{className:"github-panel-heading",children:o.jsx("p",{children:n.panel})}),o.jsxs("form",{className:"github-release-form",onSubmit:w,onKeyDown:_,noValidate:!0,children:[o.jsxs("div",{className:"github-field-grid",children:[n.fields.map(S),o.jsxs("div",{className:"github-field",children:[o.jsxs("label",{id:"github-region-label",children:[o.jsx("span",{children:"地域"}),o.jsx("span",{className:"github-field-requirement is-required",children:"必填"})]}),o.jsxs("div",{className:"pp-network-region github-region-picker",onKeyDown:k=>{k.key==="Escape"&&m(!1)},children:[o.jsxs("button",{type:"button",className:"pp-region-trigger","aria-labelledby":"github-region-label","aria-haspopup":"listbox","aria-expanded":p,onClick:()=>m(k=>!k),children:[o.jsx("span",{children:s.region==="cn-shanghai"?"华东 2(上海)":"华北 2(北京)"}),o.jsx(pNe,{className:`pp-region-chevron${p?" is-open":""}`})]}),p?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>m(!1)}),o.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":"地域",children:[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}].map(k=>{const T=k.value===s.region;return o.jsxs("button",{type:"button",role:"option","aria-selected":T,className:`pp-region-option${T?" is-selected":""}`,onClick:()=>{x("region",k.value),m(!1)},children:[o.jsx("span",{children:k.label}),T?o.jsx(mNe,{}):null]},k.value)})})]}):null]}),o.jsx("span",{className:"github-field-help",children:n.regionHelp})]})]}),o.jsxs("div",{className:"github-field github-token-field",children:[o.jsxs("div",{className:"github-token-label-row",children:[o.jsxs("label",{htmlFor:"github-token",children:[o.jsx("span",{children:"GitHub Token"}),o.jsx("span",{className:"github-field-requirement is-required",children:"必填"})]}),o.jsxs("a",{href:"https://github.com/settings/personal-access-tokens/new?name=VeADK%20Studio&description=Create%20a%20GitHub%20automation%20pull%20request&contents=write&pull_requests=write",target:"_blank",rel:"noreferrer",children:["获取 Token",o.jsx(c3,{})]})]}),o.jsxs("div",{className:"github-token-input",children:[o.jsx("input",{id:"github-token",type:f?"text":"password",value:s.token,onChange:k=>x("token",k.target.value),onBlur:()=>E("token"),autoComplete:"off",required:!0,placeholder:"需要仓库 Contents 与 Pull requests 写权限","aria-invalid":!!r.token,"aria-describedby":`github-token-help${r.token?" github-token-error":""}`}),o.jsx("button",{type:"button",onClick:()=>h(k=>!k),"aria-label":f?"隐藏 Token":"显示 Token",title:f?"隐藏 Token":"显示 Token",children:o.jsx(hNe,{hidden:f})})]}),o.jsx("span",{id:"github-token-help",className:"github-field-help",children:"Token 仅用于本次提交,不会保存在浏览器或写入 PR"}),r.token?o.jsx("span",{id:"github-token-error",className:"github-field-error",role:"alert",children:r.token}):null]}),l?o.jsx("div",{className:"github-submit-message is-error",role:"alert",children:l}):null,b?o.jsxs("div",{className:"github-submit-message is-success",role:"status",children:[o.jsxs("span",{children:["PR #",b.number," 已创建"]}),o.jsxs("a",{href:b.url,target:"_blank",rel:"noreferrer",children:["在 GitHub 查看",o.jsx(c3,{})]})]}):null,o.jsxs("div",{className:"github-form-actions",children:[o.jsxs("div",{className:"github-secrets-note",children:[o.jsx("strong",{children:"合并 PR 前,请在仓库的 GitHub Actions Secrets 中配置:"}),n.secrets.map(k=>o.jsx("span",{children:k},k))]}),o.jsx("button",{type:"submit",disabled:u,children:u?"提交 PR 中…":n.submitLabel})]})]})]})})]})}const bNe=/^[A-Za-z_][A-Za-z0-9_]*$/;function zl(e){return e.trim().length===0?"名称为必填项":e==="user"?"user 是 Google ADK 保留名称,请使用其他名称":bNe.test(e)?null:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"}function eH(e){const t=new Set,n=new Set,s=i=>{zl(i.name)===null&&(t.has(i.name)?n.add(i.name):t.add(i.name)),i.subAgents.forEach(s)};return s(e),n}function yNe(e){return{...wi(),name:e,description:"一个通过飞书接收消息并提供帮助的智能助手。",instruction:"你是一个通过飞书为用户提供帮助的智能助手。准确理解用户问题,给出简洁、可靠的回答;信息不足时先提问澄清,不要臆造事实。",deployment:{feishuEnabled:!0}}}async function xNe(e){const t=yNe(e.agentName),n=await o1(t);return dg(n.name,n.files,{region:e.region,projectName:"default"},{taskId:e.taskId,sessionStorage:"in-memory",minInstance:1,maxInstance:1,description:t.description,im:{feishu:{enabled:!0}},envs:[{key:"FEISHU_APP_ID",value:e.appId},{key:"FEISHU_APP_SECRET",value:e.appSecret}],onStage:e.onStage})}const fa=[{value:"cn-beijing",label:"北京"},{value:"cn-shanghai",label:"上海"}],tH=[{phase:"prepare",label:"生成智能体"},{phase:"build",label:"构建镜像"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}];function ENe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function vNe(e){return o.jsx("svg",{viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5 7 4 4 4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function u3(e){return o.jsx("svg",{viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4 9.2 3.1 3.1L14 5.8",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function wNe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M6.5 4H4.8A1.8 1.8 0 0 0 3 5.8v5.4A1.8 1.8 0 0 0 4.8 13h5.4a1.8 1.8 0 0 0 1.8-1.8V9.5M9 3h4v4M12.5 3.5 7.2 8.8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function SNe(e){if(!e||e==="upload")return 0;const t=tH.findIndex(n=>n.phase===e);return t<0?0:t}function _Ne({onBack:e}){var V;const[t,n]=g.useState("feishu_assistant"),[s,i]=g.useState(""),[r,a]=g.useState(""),[l,c]=g.useState(!1),[u,d]=g.useState("cn-beijing"),[f,h]=g.useState(!1),[p,m]=g.useState(""),[b,v]=g.useState(""),[y,x]=g.useState(""),[E,w]=g.useState("idle"),[_,S]=g.useState(null),[k,T]=g.useState(""),[C,I]=g.useState(null),j=g.useRef(null),L=g.useRef(null),z=g.useRef([]),D=g.useRef(0),F=g.useRef(null),A=g.useRef(!1),O=g.useRef(!0),P=["preparing","running","cancelling"].includes(E);g.useEffect(()=>(O.current=!0,()=>{O.current=!1}),[]),g.useEffect(()=>{var ue;if(!f)return;(ue=z.current[D.current])==null||ue.focus();const W=me=>{me.target instanceof Node&&j.current&&!j.current.contains(me.target)&&h(!1)},q=me=>{var Se;me.key==="Escape"&&(h(!1),(Se=L.current)==null||Se.focus())};return window.addEventListener("pointerdown",W),window.addEventListener("keydown",q),()=>{window.removeEventListener("pointerdown",W),window.removeEventListener("keydown",q)}},[f]);const $=W=>{W.key==="Enter"&&(W.nativeEvent.isComposing||W.nativeEvent.keyCode===229)&&W.preventDefault()},R=()=>{const W=zl(t.trim())??"",q=s.trim()?"":"请输入飞书 App ID",ue=r.trim()?"":"请输入飞书 App Secret";return m(W),v(q),x(ue),!W&&!q&&!ue},Y=async W=>{if(W.preventDefault(),!R()||P)return;const q=crypto.randomUUID();F.current=q,A.current=!1,w("preparing"),S(null),T(""),I(null);try{const ue=await xNe({agentName:t.trim(),appId:s.trim(),appSecret:r.trim(),region:u,taskId:q,onStage:me=>{!O.current||A.current||(w("running"),S(me))}});if(!O.current||A.current)return;I(ue),a(""),c(!1),w("succeeded")}catch(ue){if(!O.current||A.current)return;w("failed"),T(ue instanceof Error?ue.message:String(ue))}finally{F.current===q&&(F.current=null)}},J=async()=>{const W=F.current;if(!(!W||E!=="running")&&window.confirm("取消部署将停止任务并清理已创建的 Runtime,确定继续吗?")){A.current=!0,w("cancelling"),T("");try{await JB(W),O.current&&w("cancelled")}catch(q){if(A.current=!1,!O.current)return;w("failed"),T(q instanceof Error?q.message:String(q))}}},U=SNe((_==null?void 0:_.phase)??null),te=!!(t.trim()&&s.trim()&&r.trim()&&!P),K=fa.find(W=>W.value===u);return o.jsxs("div",{className:"feishu-integration-page",children:[o.jsxs("header",{className:"feishu-integration-header",children:[o.jsx("button",{type:"button",className:"feishu-back",onClick:e,"aria-label":"返回自动化列表",disabled:P,children:o.jsx(ENe,{})}),o.jsx("img",{className:"feishu-integration-logo",src:QA,alt:"","aria-hidden":"true"}),o.jsxs("div",{children:[o.jsx("h1",{children:"飞书机器人"}),o.jsx("p",{children:"创建一个由 AgentKit Runtime 驱动的飞书智能体"})]})]}),o.jsx("div",{className:"feishu-integration-layout",children:o.jsxs("section",{className:"feishu-section-panel",children:[o.jsx("p",{className:"feishu-panel-description",children:"填写已发布飞书应用的凭据,Studio 将生成 basic 智能体、创建独立 Runtime,并启用飞书消息长连接。"}),o.jsxs("form",{className:"feishu-form",onSubmit:Y,onKeyDown:$,noValidate:!0,children:[o.jsxs("div",{className:"feishu-field-grid",children:[o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{htmlFor:"feishu-agent-name",children:"智能体名称"}),o.jsx("input",{id:"feishu-agent-name",value:t,maxLength:64,disabled:P,onChange:W=>{n(W.target.value),p&&m("")},onBlur:()=>m(zl(t.trim())??""),"aria-invalid":!!p,"aria-describedby":`feishu-agent-name-help${p?" feishu-agent-name-error":""}`}),o.jsx("span",{id:"feishu-agent-name-help",className:"feishu-field-help",children:"将作为新 Runtime 中的根智能体名称"}),p?o.jsx("span",{id:"feishu-agent-name-error",className:"feishu-field-error",role:"alert",children:p}):null]}),o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{id:"feishu-region-label",children:"部署地域"}),o.jsxs("div",{className:"feishu-region-picker",ref:j,children:[o.jsxs("button",{ref:L,type:"button",className:"feishu-region-trigger",disabled:P,"aria-haspopup":"listbox","aria-expanded":f,"aria-labelledby":"feishu-region-label feishu-region-value",onClick:()=>{D.current=fa.findIndex(W=>W.value===u),h(W=>!W)},onKeyDown:W=>{W.key!=="ArrowDown"&&W.key!=="ArrowUp"||(W.preventDefault(),D.current=W.key==="ArrowUp"?fa.length-1:fa.findIndex(q=>q.value===u),h(!0))},children:[o.jsx("span",{id:"feishu-region-value",children:K.label}),o.jsx(vNe,{})]}),f?o.jsx("div",{className:"feishu-region-menu",role:"listbox","aria-label":"部署地域",onKeyDown:W=>{var me;const q=z.current.findIndex(Se=>Se===document.activeElement);let ue=null;W.key==="ArrowDown"?ue=(q+1)%fa.length:W.key==="ArrowUp"?ue=(q-1+fa.length)%fa.length:W.key==="Home"?ue=0:W.key==="End"?ue=fa.length-1:W.key==="Tab"&&h(!1),ue!==null&&(W.preventDefault(),(me=z.current[ue])==null||me.focus())},children:fa.map(W=>o.jsx("button",{ref:q=>{const ue=fa.findIndex(me=>me.value===W.value);z.current[ue]=q},type:"button",role:"option","aria-selected":u===W.value,className:`feishu-region-option${u===W.value?" is-selected":""}`,onClick:()=>{var q;d(W.value),h(!1),(q=L.current)==null||q.focus()},children:W.label},W.value))}):null]}),o.jsx("span",{className:"feishu-field-help",children:"Runtime 与构建产物将创建在该地域"})]}),o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{htmlFor:"feishu-app-id",children:"飞书 App ID"}),o.jsx("input",{id:"feishu-app-id",value:s,maxLength:128,autoComplete:"off",disabled:P,placeholder:"cli_xxxxxxxxxxxxxxxx",onChange:W=>{i(W.target.value),b&&v("")},onBlur:()=>v(s.trim()?"":"请输入飞书 App ID"),"aria-invalid":!!b,"aria-describedby":`feishu-app-id-help${b?" feishu-app-id-error":""}`}),o.jsx("span",{id:"feishu-app-id-help",className:"feishu-field-help",children:"来自飞书开放平台的应用凭证"}),b?o.jsx("span",{id:"feishu-app-id-error",className:"feishu-field-error",role:"alert",children:b}):null]}),o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{htmlFor:"feishu-app-secret",children:"飞书 App Secret"}),o.jsxs("div",{className:"feishu-secret-input",children:[o.jsx("input",{id:"feishu-app-secret",type:l?"text":"password",value:r,maxLength:256,autoComplete:"off",disabled:P,placeholder:"请输入 App Secret",onChange:W=>{a(W.target.value),y&&x("")},onBlur:()=>x(r.trim()?"":"请输入飞书 App Secret"),"aria-invalid":!!y,"aria-describedby":`feishu-app-secret-help${y?" feishu-app-secret-error":""}`}),o.jsx("button",{type:"button",disabled:P,onClick:()=>c(W=>!W),"aria-label":l?"隐藏 App Secret":"显示 App Secret",children:l?"隐藏":"显示"})]}),o.jsx("span",{id:"feishu-app-secret-help",className:"feishu-field-help",children:"仅写入新 Runtime 的环境变量"}),y?o.jsx("span",{id:"feishu-app-secret-error",className:"feishu-field-error",role:"alert",children:y}):null]})]}),E!=="idle"?o.jsxs("div",{className:`feishu-deployment-status is-${E}`,role:E==="failed"?"alert":"status",children:[o.jsxs("div",{className:"feishu-deployment-heading",children:[E==="preparing"?o.jsx(ka,{as:"strong",children:"正在生成 basic 智能体"}):null,E==="running"?o.jsx(ka,{as:"strong",children:(_==null?void 0:_.message)||"正在创建 Runtime"}):null,E==="cancelling"?o.jsx(ka,{as:"strong",children:"正在取消部署"}):null,E==="succeeded"?o.jsxs("strong",{children:[o.jsx(u3,{}),"飞书机器人 Runtime 已创建"]}):null,E==="cancelled"?o.jsx("strong",{children:"部署已取消"}):null,E==="failed"?o.jsx("strong",{children:"创建失败"}):null]}),E==="preparing"||E==="running"||E==="cancelling"?o.jsx("ol",{className:"feishu-deployment-steps",children:tH.map((W,q)=>{const ue=E==="running"&&qW.value===(C.region||u)))==null?void 0:V.label)||C.region}),C.consoleUrl?o.jsxs("a",{href:C.consoleUrl,target:"_blank",rel:"noreferrer",children:["打开 Runtime 控制台",o.jsx(wNe,{})]}):null]}):null]}):null,o.jsxs("div",{className:"feishu-form-actions",children:[o.jsxs("div",{className:"feishu-secrets-note",children:[o.jsx("strong",{children:"凭据处理"}),o.jsx("span",{children:"App Secret 仅用于本次部署,不会写入生成源码或浏览器存储。"})]}),o.jsxs("div",{className:"feishu-action-buttons",children:[E==="running"?o.jsx("button",{type:"button",className:"feishu-cancel",onClick:()=>void J(),children:"取消部署"}):null,o.jsx("button",{type:"submit",className:"feishu-submit",disabled:!te,children:P?"正在创建…":"创建飞书机器人 Runtime"})]})]})]})]})})]})}async function ZA(e,t,n,s=rc){var r;const i=await NB(e,{...t,headers:{accept:"application/json",...t.headers},signal:n},s);if(!i.ok){let a="";try{a=((r=(await i.json()).detail)==null?void 0:r.trim())||""}catch{}throw new Error(a||`请求失败 (${i.status})`)}return i.json()}function NNe(e){return ZA("/web/coding-agents/capabilities",{method:"GET"},e,Ck)}function TNe(e,t){return ZA(`/web/coding-agents/skills/${encodeURIComponent(e)}/preview`,{method:"GET"},t)}function kNe(e,t){return ZA("/web/coding-agents/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)},t)}const ANe="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='16'%20height='16'%20rx='3.692'%20fill='%231A1B1D'/%3e%3cpath%20d='M13.235%205.829V4.332H2.758v5.987h1.496v1.496h8.981V5.828Zm-1.497%204.49H4.254V5.83h7.484v4.49Z'%20fill='%2332F08C'/%3e%3cpath%20d='M6.937%206.993%205.88%208.051%206.937%209.11%207.995%208.05%206.937%206.993ZM9.931%206.992%208.873%208.05%209.931%209.11%2010.99%208.05%209.93%206.992Z'%20fill='%2332F08C'/%3e%3c/svg%3e";function CNe(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m4 4 8 8m0-8-8 8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function d3(){return o.jsxs("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[o.jsx("path",{d:"M4 1.8h5l3 3V14H4z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),o.jsx("path",{d:"M9 1.8V5h3M6 8h4M6 10.5h4",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function f3(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"M1.8 4.5h4l1.2-1.3h2.2l1.2 1.3h3.8v8H1.8z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function INe(e){return e instanceof DOMException&&e.name==="AbortError"}function jNe(e){return e instanceof Error&&e.message?e.message:"读取 Skill 文件失败"}function RNe(e){return e<1024?`${e} B`:`${(e/1024).toFixed(e<10*1024?1:0)} KB`}function ONe(e){const t=e.split("/");return t[t.length-1]??e}function MNe(e){const t=new Map;for(const n of e){const s=n.path.split("/"),i=s.length>1?s.slice(0,-1).join("/"):"";t.set(i,[...t.get(i)??[],n])}return Array.from(t,([n,s])=>({directory:n,files:s})).sort((n,s)=>n.directory?s.directory?n.directory.localeCompare(s.directory):1:-1)}function LNe({skill:e,onClose:t}){const n=g.useRef(null),s=g.useRef(null),i=g.useId(),r=g.useId(),[a,l]=g.useState(null),[c,u]=g.useState(""),[d,f]=g.useState(!0),[h,p]=g.useState(""),[m,b]=g.useState(0);g.useEffect(()=>{s.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const x=n.current;return x&&!x.open&&x.showModal(),()=>{var E;x!=null&&x.open&&x.close(),(E=s.current)==null||E.focus()}},[]),g.useEffect(()=>{const x=new AbortController;return f(!0),p(""),l(null),u(""),TNe(e.id,x.signal).then(E=>{if(x.signal.aborted)return;l(E);const w=E.files.find(_=>_.path==="SKILL.md")??E.files[0];u((w==null?void 0:w.path)??"")}).catch(E=>{!x.signal.aborted&&!INe(E)&&p(jNe(E))}).finally(()=>{x.signal.aborted||f(!1)}),()=>x.abort()},[m,e.id]);const v=g.useMemo(()=>MNe((a==null?void 0:a.files)??[]),[a]),y=(a==null?void 0:a.files.find(x=>x.path===c))??null;return o.jsxs("dialog",{ref:n,className:"coding-agents-preview-dialog","aria-labelledby":i,"aria-describedby":r,onCancel:x=>{x.preventDefault(),t()},onMouseDown:x=>{const E=x.currentTarget.getBoundingClientRect();(x.clientXE.right||x.clientYE.bottom)&&t()},children:[o.jsxs("header",{className:"coding-agents-preview-header",children:[o.jsx("span",{className:"coding-agents-preview-mark",children:o.jsx(f3,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:i,children:e.name}),o.jsx("p",{id:r,children:"只读浏览随 Studio 提供的 Skill 文件"})]}),o.jsx("button",{type:"button",autoFocus:!0,"aria-label":"关闭文件预览",onClick:t,children:o.jsx(CNe,{})})]}),d?o.jsxs("div",{className:"coding-agents-preview-state",children:[o.jsx("i",{}),"正在读取文件…"]}):h?o.jsxs("div",{className:"coding-agents-preview-state is-error",role:"alert",children:[o.jsx("span",{children:h}),o.jsx("button",{type:"button",onClick:()=>b(x=>x+1),children:"重试"})]}):o.jsxs("div",{className:"coding-agents-preview-layout",children:[o.jsxs("nav",{className:"coding-agents-preview-tree","aria-label":`${e.name} 文件`,children:[o.jsxs("div",{className:"coding-agents-preview-tree-title",children:[o.jsx("span",{children:"文件"}),o.jsx("small",{children:(a==null?void 0:a.files.length)??0})]}),o.jsx("div",{className:"coding-agents-preview-tree-scroll",children:v.map(x=>x.directory?o.jsxs("details",{open:!0,children:[o.jsxs("summary",{children:[o.jsx(f3,{}),o.jsx("span",{children:x.directory})]}),o.jsx("div",{children:x.files.map(E=>o.jsxs("button",{type:"button",className:c===E.path?"is-selected":"","aria-current":c===E.path?"true":void 0,onClick:()=>u(E.path),children:[o.jsx(d3,{}),o.jsx("span",{children:ONe(E.path)})]},E.path))})]},x.directory):x.files.map(E=>o.jsxs("button",{type:"button",className:c===E.path?"is-selected":"","aria-current":c===E.path?"true":void 0,onClick:()=>u(E.path),children:[o.jsx(d3,{}),o.jsx("span",{children:E.path})]},E.path)))})]}),o.jsx("section",{className:"coding-agents-preview-file","aria-label":"文件内容",children:y?o.jsxs(o.Fragment,{children:[o.jsxs("header",{children:[o.jsx("strong",{children:y.path}),o.jsx("span",{children:RNe(y.size)})]}),y.previewable&&y.content!==null?o.jsx("pre",{tabIndex:0,children:o.jsx("code",{children:y.content})}):o.jsx("div",{className:"coding-agents-preview-unavailable",children:"此文件不是可预览的 UTF-8 文本。"})]}):o.jsx("div",{className:"coding-agents-preview-unavailable",children:"没有可预览的文件。"})})]})]})}function DNe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function PNe(e){return o.jsxs("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"16",height:"16",rx:"4.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"m8.5 11-2.4 2.4 2.4 2.4M11 16.5h3.8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("circle",{cx:"24.5",cy:"10.5",r:"2.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("circle",{cx:"24.5",cy:"24.5",r:"2.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"M19.5 10.5H22M18.2 19l4.3 3.7M24.5 13v9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function BNe(e){return o.jsx("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:o.jsxs("g",{stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",children:[o.jsx("path",{d:"M16 4.5v7M16 20.5v7"}),o.jsx("path",{d:"m9.3 6.3 3.5 6.1M19.2 19.6l3.5 6.1"}),o.jsx("path",{d:"m5.9 11.1 6.2 3.5M19.9 17.4l6.2 3.5"}),o.jsx("path",{d:"M4.7 16h7M20.3 16h7"}),o.jsx("path",{d:"m5.9 20.9 6.2-3.5M19.9 14.6l6.2-3.5"}),o.jsx("path",{d:"m9.3 25.7 3.5-6.1M19.2 12.4l3.5-6.1"})]})})}function UNe(e){return o.jsxs("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M15.8 4.2c2.4 0 4.5 1.2 5.7 3.1 2.2-.3 4.5.8 5.6 2.9 1.1 2 .8 4.4-.5 6.1 1.2 1.8 1.3 4.3.1 6.2-1.2 2-3.4 3-5.6 2.6-1.3 1.8-3.5 2.9-5.8 2.7-2.2-.2-4.1-1.5-5.1-3.4-2.2.1-4.4-1-5.4-3.1-1-2-.6-4.4.8-6.1-1.1-1.9-1.1-4.3.2-6.1 1.3-1.9 3.6-2.7 5.7-2.2 1.1-1.7 2.6-2.7 4.3-2.7Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),o.jsx("path",{d:"m10.7 12.2 3.1 3.8-3.1 3.8M17.1 20h4.3",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function h3(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m3.4 8.2 3 3L12.8 5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function FNe(e){return o.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M2.8 6.3h14.4v8.3a1.6 1.6 0 0 1-1.6 1.6H4.4a1.6 1.6 0 0 1-1.6-1.6V6.3Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"}),o.jsx("path",{d:"M2.8 6.3V5.1a1.4 1.4 0 0 1 1.4-1.4h3.4l1.5 1.6h6.5a1.6 1.6 0 0 1 1.6 1.6",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"})]})}function $Ne({agentId:e}){return e==="trae"?o.jsx("img",{src:ANe,alt:"","aria-hidden":"true"}):e==="claude-code"?o.jsx(BNe,{}):o.jsx(UNe,{})}function p3(e){return e instanceof DOMException&&e.name==="AbortError"}function m3(e,t){return e instanceof Error&&e.message?e.message:t}function HNe({onBack:e}){var I;const[t,n]=g.useState(null),[s,i]=g.useState(!0),[r,a]=g.useState(""),[l,c]=g.useState(0),[u,d]=g.useState(new Set),[f,h]=g.useState(new Set),[p,m]=g.useState(null),[b,v]=g.useState(!1),[y,x]=g.useState(null),E=g.useRef(null);g.useEffect(()=>{const j=new AbortController;return i(!0),a(""),NNe(j.signal).then(L=>{if(j.signal.aborted)return;n(L);const z=L.agents.filter(D=>D.available);d(D=>{const F=z.filter(A=>D.has(A.id));return new Set((F.length?F:z.slice(0,1)).map(A=>A.id))}),h(D=>{const F=L.skills.filter(A=>D.has(A.id));return new Set((F.length?F:L.skills).map(A=>A.id))})}).catch(L=>{!p3(L)&&!j.signal.aborted&&(n(null),a(m3(L,"检测本机客户端失败")))}).finally(()=>{j.signal.aborted||i(!1)}),()=>j.abort()},[l]),g.useEffect(()=>()=>{var j;return(j=E.current)==null?void 0:j.abort()},[]);const w=g.useMemo(()=>(t==null?void 0:t.agents.filter(j=>j.available&&u.has(j.id)))||[],[t,u]),_=g.useMemo(()=>(t==null?void 0:t.skills.filter(j=>f.has(j.id)))||[],[t,f]),S=!!(!b&&w.length&&_.length),k=(j,L)=>{!L||b||(x(null),d(z=>{const D=new Set(z);return D.has(j)?D.delete(j):D.add(j),D}))},T=j=>{b||(x(null),h(L=>{const z=new Set(L);return z.has(j)?z.delete(j):z.add(j),z}))},C=async()=>{var L;if(!S)return;(L=E.current)==null||L.abort();const j=new AbortController;E.current=j,v(!0),x(null);try{const z=await kNe({agents:w.map(F=>F.id),skills:_.map(F=>F.id)},j.signal);if(j.signal.aborted)return;const D=z.installations;x({tone:"success",message:`已为 ${w.length} 个客户端配置 ${_.length} 个 Skill`,details:D.map(F=>`${F.agentName} · ${F.skill} → ${F.displayPath}`)})}catch(z){!p3(z)&&!j.signal.aborted&&x({tone:"error",message:m3(z,"配置失败,请检查用户目录权限后重试")})}finally{E.current===j&&(E.current=null),j.signal.aborted||v(!1)}};return o.jsxs("section",{className:"coding-agents-page",children:[o.jsxs("header",{className:"coding-agents-header",children:[o.jsx("button",{type:"button",className:"coding-agents-back",onClick:e,disabled:b,"aria-label":"返回自动化列表",children:o.jsx(DNe,{})}),o.jsx(PNe,{className:"coding-agents-logo"}),o.jsxs("div",{children:[o.jsx("h1",{children:"配置 Coding Agents"}),o.jsx("p",{children:"把随 Studio 提供的 AgentKit Skills 全局安装到本地编码客户端。"})]})]}),o.jsx("div",{className:"coding-agents-scroll",children:o.jsxs("div",{className:"coding-agents-content",children:[o.jsxs("section",{className:"coding-agents-section","aria-label":"选择 Coding Agent",children:[o.jsxs("div",{className:"coding-agents-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"1"}),o.jsx("h2",{children:"本机客户端"})]}),o.jsx("button",{type:"button",onClick:()=>c(j=>j+1),disabled:s||b,children:"重新检测"})]}),s?o.jsxs("div",{className:"coding-agents-inline-state",children:[o.jsx("i",{}),"正在检测本机客户端…"]}):r?o.jsxs("div",{className:"coding-agents-error-row",role:"alert",children:[o.jsx("span",{children:r}),o.jsx("button",{type:"button",onClick:()=>c(j=>j+1),children:"重试"})]}):o.jsx("div",{className:"coding-agents-agent-grid",children:t==null?void 0:t.agents.map(j=>o.jsxs("button",{type:"button",className:`coding-agents-agent ${u.has(j.id)?"is-selected":""}`,"aria-pressed":u.has(j.id),disabled:!j.available||b,onClick:()=>k(j.id,j.available),title:j.available?j.name:j.reason,children:[o.jsx("span",{className:`coding-agents-agent-mark is-${j.id}`,children:o.jsx($Ne,{agentId:j.id})}),o.jsxs("span",{className:"coding-agents-agent-copy",children:[o.jsx("strong",{children:j.name}),o.jsx("small",{children:j.available?j.version||"已检测到客户端":j.reason})]}),o.jsx("span",{className:`coding-agents-status ${j.available?"is-ready":""}`,children:j.available?"可用":"未检测到"}),o.jsx("span",{className:"coding-agents-check",children:o.jsx(h3,{})})]},j.id))})]}),o.jsxs("section",{className:"coding-agents-section","aria-label":"选择内置 Skill",children:[o.jsx("div",{className:"coding-agents-section-heading",children:o.jsxs("div",{children:[o.jsx("span",{children:"2"}),o.jsx("h2",{children:"内置 Skills"})]})}),o.jsx("div",{className:"coding-agents-skill-list",children:t==null?void 0:t.skills.map(j=>o.jsxs("div",{className:`coding-agents-skill ${f.has(j.id)?"is-selected":""}`,children:[o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:f.has(j.id),onChange:()=>T(j.id),disabled:b}),o.jsx("span",{className:"coding-agents-skill-check","aria-hidden":"true",children:o.jsx(h3,{})}),o.jsxs("span",{children:[o.jsx("strong",{children:j.name}),o.jsx("small",{children:j.description})]})]}),o.jsx("button",{type:"button",onClick:()=>m(j),children:"查看文件"})]},j.id))}),o.jsxs("div",{className:"coding-agents-global","aria-label":"全局安装目录",children:[o.jsxs("div",{className:"coding-agents-global-heading",children:[o.jsx(FNe,{}),o.jsxs("div",{children:[o.jsx("strong",{children:"全局安装"}),o.jsx("span",{children:"配置后可在本机其他项目中使用"})]})]}),w.length?o.jsx("dl",{children:w.map(j=>o.jsxs("div",{children:[o.jsx("dt",{children:j.name}),o.jsx("dd",{children:j.globalSkillsPath})]},j.id))}):o.jsx("p",{children:"选择客户端后显示对应安装目录。"})]})]}),y?o.jsxs("div",{className:`coding-agents-result is-${y.tone}`,role:y.tone==="error"?"alert":"status",children:[o.jsx("strong",{children:y.message}),(I=y.details)!=null&&I.length?o.jsx("ul",{children:y.details.map(j=>o.jsx("li",{children:j},j))}):null]}):null,o.jsxs("div",{className:"coding-agents-actions",children:[o.jsx("span",{children:w.length?`已选择 ${w.length} 个客户端、${_.length} 个 Skill`:"请先选择客户端"}),o.jsx("button",{type:"button",onClick:()=>void C(),disabled:!S,children:b?"正在配置…":"配置"})]})]})}),p?o.jsx(LNe,{skill:p,onClose:()=>m(null)}):null]})}const zNe={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 VNe(e,t){if(!t||t==="/")return e;const n=t.replace(/^\//,"").split("/").map(i=>i.replace(/~1/g,"/").replace(/~0/g,"~"));let s=e;for(const i of n){if(s==null||typeof s!="object")return;s=s[i]}return s}function GNe(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function KNe(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function JA(e,t){if(GNe(e))return VNe(t,e.path);if(KNe(e)){const n=zNe[e.call],s={};for(const[i,r]of Object.entries(e.args??{}))s[i]=JA(r,t);return n?n(s):`[unknown fn: ${e.call}]`}return e}function qNe(e,t){const n=JA(e,t);return n==null?"":typeof n=="string"?n:String(n)}const nH=new Map;function Cu(e,t){nH.set(e,t)}function YNe(e){return nH.get(e)}function WNe(e,t,n){const s=t.replace(/^\//,"").split("/").map(r=>r.replace(/~1/g,"/").replace(/~0/g,"~"));let i=e;for(let r=0;rJA(s,e.dataModel),resolveString:s=>qNe(s,e.dataModel),dispatchAction:t,render:s=>{if(!s)return null;const i=e.components[s];if(!i)return null;const r=YNe(i.component)??XNe;return o.jsx(r,{node:i,ctx:n},s)}};return o.jsx("div",{className:"a2ui-surface","data-a2ui-surface":e.surfaceId,children:n.render(e.rootId)})}function ZNe(e){const t=g.useRef(null),n=g.useRef(!0),s=28,i=g.useCallback(()=>{const r=t.current;r&&(n.current=r.scrollHeight-r.scrollTop-r.clientHeight{const r=t.current;r&&n.current&&(r.scrollTop=r.scrollHeight)},[e]),{ref:t,onScroll:i}}function F1({value:e,skillPrefix:t="/",onRemoveSkill:n,onRemoveAgent:s}){return e.skills.length===0&&!e.targetAgent?null:o.jsxs("div",{className:"invocation-chips","aria-label":"本轮调用上下文",children:[e.skills.map(i=>o.jsxs("span",{className:"invocation-chip invocation-chip--skill",title:i.description,children:[o.jsx(au,{"aria-hidden":!0}),o.jsxs("span",{children:[t,i.name]}),n?o.jsx("button",{type:"button",onClick:()=>n(i.name),"aria-label":`移除技能 ${i.name}`,children:o.jsx(Ti,{})}):null]},i.name)),e.targetAgent?o.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[o.jsx(fB,{"aria-hidden":!0}),o.jsx("span",{children:e.targetAgent.name}),s?o.jsx("button",{type:"button",onClick:s,"aria-label":`移除 Agent ${e.targetAgent.name}`,children:o.jsx(Ti,{})}):null]}):null]})}function e2(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function iH(e){var n,s,i,r;const t=e2(e.mimeType);return t==="pdf"?"PDF":t==="markdown"?"MD":t==="video"?((s=(n=e.mimeType)==null?void 0:n.split("/")[1])==null?void 0:s.toUpperCase())??"VIDEO":t==="image"?((r=(i=e.mimeType)==null?void 0:i.split("/")[1])==null?void 0:r.toUpperCase())??"IMAGE":"TXT"}function rH(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function aH(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?VB(t,e.uri):""}function JNe({kind:e}){return e==="image"?o.jsx(kk,{}):e==="video"?o.jsx(pB,{}):e==="pdf"?o.jsx(nee,{}):o.jsx(Nk,{})}function $1({appName:e,items:t,compact:n=!1,onRemove:s}){const[i,r]=g.useState(null);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(a=>{const l=e2(a.mimeType),c=aH(a,e),u=a.status==="uploading"||a.status==="error"||!c,d=o.jsxs("button",{type:"button",className:"media-card-main",disabled:u,onClick:()=>r(a),"aria-label":`预览 ${a.name??"附件"}`,children:[l==="image"&&c?o.jsx("img",{className:"media-card-image",src:c,alt:a.name??"图片",loading:"lazy"}):l==="video"&&c?o.jsxs("div",{className:"media-card-video-container",children:[o.jsx("video",{className:"media-card-video",src:c,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}),o.jsx("span",{className:"media-card-video-play",children:o.jsx(See,{})})]}):o.jsx("span",{className:"media-card-icon",children:o.jsx(JNe,{kind:l})}),o.jsxs("span",{className:"media-card-copy",children:[o.jsx("span",{className:"media-card-name",children:a.name??"附件"}),o.jsxs("span",{className:"media-card-meta",children:[o.jsx("span",{className:"media-card-type",children:iH(a)}),a.status==="uploading"?o.jsxs(o.Fragment,{children:[o.jsx(mn,{className:"media-card-spinner"})," 上传中"]}):a.status==="error"?a.error??"上传失败":rH(a.sizeBytes)]})]}),!n&&a.status!=="uploading"&&a.status!=="error"?o.jsx(qc,{className:"media-card-open"}):null]});return o.jsxs(is.div,{className:`media-card media-card--${l}${a.status==="error"?" media-card--error":""}`,layout:!0,initial:{opacity:0,scale:.985,y:4},animate:{opacity:1,scale:1,y:0},children:[l==="image"&&!u?o.jsx(lB,{src:c,children:d}):d,s?o.jsx("button",{type:"button",className:"media-card-remove","aria-label":`移除 ${a.name??"附件"}`,onClick:()=>s(a.id),children:o.jsx(Ti,{})}):null]},a.id)})}),o.jsx(Ro,{children:i?o.jsx(eTe,{appName:e,item:i,onClose:()=>r(null)}):null})]})}function eTe({appName:e,item:t,onClose:n}){const s=g.useMemo(()=>aH(t,e),[e,t]),i=e2(t.mimeType),[r,a]=g.useState(""),[l,c]=g.useState(i==="text"||i==="markdown"),[u,d]=g.useState("");return g.useEffect(()=>{const f=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),g.useEffect(()=>{if(i!=="text"&&i!=="markdown")return;const f=new AbortController;return c(!0),d(""),fetch(s,{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||c(!1)}),()=>f.abort()},[i,s]),o.jsx(is.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:o.jsxs(is.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:[o.jsxs("header",{className:"media-viewer-header",children:[o.jsxs("div",{children:[o.jsx("strong",{children:t.name??"附件"}),o.jsxs("span",{children:[iH(t),t.sizeBytes?` · ${rH(t.sizeBytes)}`:""]})]}),o.jsxs("nav",{children:[o.jsx("a",{href:s,download:t.name,"aria-label":"下载",children:o.jsx(Jx,{})}),o.jsx("button",{type:"button",onClick:n,"aria-label":"关闭",children:o.jsx(Ti,{})})]})]}),o.jsxs("div",{className:`media-viewer-body media-viewer-body--${i}`,children:[i==="image"?o.jsx("img",{src:s,alt:t.name??"图片"}):null,i==="video"?o.jsx("div",{className:"media-viewer-video-wrapper",children:o.jsx("video",{src:s,controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",className:"media-viewer-video"})}):null,i==="pdf"?o.jsx("iframe",{src:s,title:t.name??"PDF"}):null,l?o.jsxs("div",{className:"media-viewer-loading",children:[o.jsx(mn,{})," 正在读取文档…"]}):null,!l&&u?o.jsxs("div",{className:"media-viewer-loading",children:["文档加载失败:",u]}):null,!l&&i==="markdown"?o.jsx("div",{className:"media-document",children:o.jsx(rh,{text:r})}):null,!l&&i==="text"?o.jsx("pre",{className:"media-document media-document--plain",children:r}):null]})]})})}function tTe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.25",cy:"10.25",r:"6.25"}),o.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 nTe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.25",y:"5.25",width:"15.5",height:"13.5",rx:"2.25"}),o.jsx("circle",{cx:"8.1",cy:"9.3",r:"1.35"}),o.jsx("path",{d:"m4.7 16.5 3.65-3.7 2.45 2.25 2.2-2.2 4.35 4.1"}),o.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 oH(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.25",y:"5.25",width:"17.5",height:"13.5",rx:"2.4"}),o.jsx("path",{d:"M3.25 9h17.5M6.75 5.25 9.3 9M12 5.25 14.55 9M17.25 5.25 19.8 9"}),o.jsx("path",{d:"m10.25 11.45 4 2.55-4 2.55v-5.1Z"})]})}function sTe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 5.25h15.5v10.5H4.25zM8.25 19.75h7.5M12 15.75v4"}),o.jsx("path",{d:"m7.25 12.75 2.35-2.4 2.15 1.65 3.4-3.6 1.6 1.55"}),o.jsx("circle",{cx:"7.25",cy:"8.4",r:".7",fill:"currentColor",stroke:"none"})]})}function iTe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.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"}),o.jsx("path",{d:"M8.2 12.25h.01M8.2 16.8h.01"})]})}function rTe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 4.25h4.5v15.5h-4.5zM8.75 5.75h5v14h-5zM13.75 4.25h4.1v10.25h-4.1z"}),o.jsx("path",{d:"M5.75 7h1.5M10.25 8.25h2M10.25 11h2M15.15 7h1.3"}),o.jsx("circle",{cx:"17.45",cy:"17.35",r:"2.45"}),o.jsx("path",{d:"m19.25 19.15 1.55 1.55"})]})}function aTe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 6.25h6.25c1 0 1.5.55 1.5 1.45v11.05c0-.9-.5-1.45-1.5-1.45H4.25V6.25Z"}),o.jsx("path",{d:"M19.75 9.1v8.2H13.5c-1 0-1.5.55-1.5 1.45V7.7c0-.9.5-1.45 1.5-1.45h2.15"}),o.jsx("path",{d:"m19 3.2.58 1.62 1.62.58-1.62.58L19 7.6l-.58-1.62-1.62-.58 1.62-.58L19 3.2Z",fill:"currentColor",stroke:"none"})]})}function oTe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"m4.2 8.4 1.15 10.2h13.3L19.8 8.4"}),o.jsx("path",{d:"M4.2 8.4h15.6L17.9 5H6.1L4.2 8.4Z"}),o.jsx("path",{d:"M7.2 12.2c1.1-1 2.25 1.25 3.4.25 1.05-.9 2.15 1.3 3.3.25"}),o.jsx("path",{d:"m8.2 15.1 1.45 1.35 1.45-1.35M13.55 16.45h2.35"})]})}function lH(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6 3.25 4.5 4.75L6 12.75"})})}function lTe({definition:e,label:t,done:n,open:s,onToggle:i}){const r=e.icon,a=t??(n?e.doneLabel:e.runningLabel);return o.jsxs("button",{type:"button",className:`builtin-tool-head${n?" is-done":" is-running"}`,"data-tool-tone":e.tone,onClick:i,"aria-expanded":s,children:[o.jsx("span",{className:"builtin-tool-icon","aria-hidden":"true",children:o.jsx(r,{})}),n?o.jsx("span",{className:"builtin-tool-label",children:a}):o.jsx(ka,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:a}),o.jsx(lH,{className:`builtin-tool-chevron${s?" is-open":""}`})]})}const cTe={web_search:{name:"web_search",runningLabel:"正在进行网络搜索",doneLabel:"已完成网络搜索",tone:"search",icon:tTe},run_code:{name:"run_code",runningLabel:"正在 AgentKit 沙箱中执行代码",doneLabel:"已在 AgentKit 沙箱中完成代码执行",tone:"sandbox",icon:oTe},image_generate:{name:"image_generate",runningLabel:"正在生成图片",doneLabel:"已完成图片生成",tone:"image",icon:nTe},video_generate:{name:"video_generate",runningLabel:"正在生成视频",doneLabel:"已完成视频生成",tone:"video",icon:oH},ppt_generate:{name:"ppt_generate",runningLabel:"正在生成 PPT",doneLabel:"已完成 PPT 生成",tone:"presentation",icon:sTe},load_memory:{name:"load_memory",runningLabel:"正在检索长期记忆",doneLabel:"已完成记忆检索",tone:"memory",icon:iTe},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"正在检索知识库",doneLabel:"已完成知识库检索",tone:"knowledge",icon:rTe},load_skill:{name:"load_skill",runningLabel:"正在加载技能",doneLabel:"已加载技能",tone:"skill",icon:aTe}};function uTe(e){return cTe[e]}const cH="send_a2ui_json_to_client",dTe=28;function fTe(e,t,n){let s=t;for(let i=0;i65535?2:1}return s}function hTe(e){return e<=4?1:Math.min(18,Math.max(2,Math.ceil(e/6)))}function uH(e,t,n){const[s,i]=g.useState(()=>t?"":e),r=g.useRef(s),a=g.useRef(e),l=g.useRef(null),c=g.useRef(0),u=g.useRef(n);return a.current=e,u.current=n,g.useEffect(()=>{const d=r.current,f=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(!t||f||!e.startsWith(d)){l.current!==null&&window.cancelAnimationFrame(l.current),l.current=null,d!==e&&(r.current=e,i(e));return}if(d===e||l.current!==null)return;const h=p=>{const m=a.current,b=r.current;if(!m.startsWith(b)){r.current=m,i(m),l.current=null;return}if(p-c.current{var d;(d=u.current)==null||d.call(u)},[s]),g.useEffect(()=>()=>{l.current!==null&&(window.cancelAnimationFrame(l.current),l.current=null)},[]),s}function pTe({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:o.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 mTe(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o.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 gTe(e,t){if(e!=="load_skill"||t==null||typeof t!="object"||Array.isArray(t))return;const n=t.skill_name;if(!(typeof n!="string"||!n.trim()))return`使用 ${n.trim()} 技能`}function dH({text:e,done:t,answerStarted:n=!1,streaming:s=!1,onStreamFrame:i}){const[r,a]=g.useState(!(t||n)),l=g.useRef(!1);g.useEffect(()=>{l.current||a(!(t||n))},[n,t]);const c=()=>{l.current=!0,a(p=>!p)},u=e.replace(/^\s+/,""),d=uH(u,!t||s,i),{ref:f,onScroll:h}=ZNe(d);return o.jsxs("div",{className:"block-thinking",children:[o.jsxs("button",{className:"think-head",onClick:c,type:"button",children:[o.jsx("span",{className:"think-icon","aria-hidden":"true",children:o.jsx(pTe,{className:`spark ${t?"":"pulse"}`})}),t?o.jsx("span",{className:"think-label think-label--done",children:"已完成思考"}):o.jsx(ka,{className:"think-label",duration:2.4,spread:18,children:"思考中"}),o.jsx(Ql,{className:`chev ${r?"open":""}`})]}),o.jsx("div",{className:`think-collapse ${r&&d?"open":""}`,children:o.jsx("div",{className:"think-collapse-inner",children:o.jsx("div",{className:"think-body scroll",ref:f,onScroll:h,children:d})})})]})}function fH(){return o.jsx(dH,{text:"",done:!1})}const bTe=g.memo(function({text:t,streaming:n,onStreamFrame:s}){const i=uH(t,n,s);return i?o.jsx("div",{className:"bubble",children:o.jsx(rh,{text:i})}):null});function yTe({name:e,args:t,response:n,done:s}){const[i,r]=g.useState(!1),a=e===cH?"渲染 UI":e,l=uTe(e),c=n==null?null:typeof n=="string"?n:JSON.stringify(n,null,2),u=c&&c.length>2e3?c.slice(0,2e3)+` -…(已截断)`:c;return o.jsxs(is.div,{className:`block-tool${l?" block-tool--builtin":""}`,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[l?o.jsx(lTe,{definition:l,label:gTe(e,t),done:s,open:i,onToggle:()=>r(d=>!d)}):o.jsxs("button",{className:"tool-head tool-head--generic",onClick:()=>r(d=>!d),type:"button","aria-expanded":i,children:[o.jsx("span",{className:"tool-icon tool-icon--generic","aria-hidden":"true",children:o.jsx(mTe,{})}),s?o.jsx("span",{className:"tool-name",children:a}):o.jsx(ka,{className:"tool-name",duration:2.2,spread:15,children:a}),o.jsx(lH,{className:`tool-chevron${i?" is-open":""}`})]}),o.jsx("div",{className:`think-collapse ${i?"open":""}`,children:o.jsx("div",{className:"think-collapse-inner",children:o.jsxs("div",{className:"tool-detail",children:[t!=null&&o.jsxs("div",{className:"tool-section",children:[o.jsx("div",{className:"tool-section-label",children:"参数"}),o.jsx("pre",{className:"tool-args",children:JSON.stringify(t,null,2)})]}),u!=null&&o.jsxs("div",{className:"tool-section",children:[o.jsx("div",{className:"tool-section-label",children:"返回"}),o.jsx("pre",{className:"tool-args tool-result",children:u})]})]})})})]})}function xTe({block:e,onDownload:t,onPreview:n}){const[s,i]=g.useState(""),[r,a]=g.useState(""),[l,c]=g.useState(null);g.useEffect(()=>()=>{l&&URL.revokeObjectURL(l.url)},[l]);const u=()=>c(null),d=async(p,m)=>{if(t){i(`download:${p}`),a("");try{await t(p,m)}catch(b){a(b instanceof Error?b.message:String(b))}finally{i("")}}},f=async(p,m,b)=>{if(n){i(`preview:${b}`),a("");try{const v=await n(p,m);c({name:b,url:v})}catch(v){a(v instanceof Error?v.message:String(v))}finally{i("")}}},h=e.files.filter(p=>!p.filename.endsWith(".preview.webp"));return o.jsxs("div",{className:"artifact-list",children:[h.map(p=>{const m=`${p.filename.replace(/\.pptx$/i,"")}.preview.webp`,b=e.files.find(v=>v.filename===m);return o.jsxs("div",{className:"artifact-card",children:[o.jsx("span",{className:"artifact-card__icon","aria-hidden":"true",children:o.jsx(Nk,{})}),o.jsxs("span",{className:"artifact-card__copy",children:[o.jsx("span",{className:"artifact-card__name",children:p.filename}),o.jsx("span",{className:"artifact-card__hint",children:"PowerPoint 演示文稿"})]}),o.jsxs("span",{className:"artifact-card__actions",children:[b&&o.jsxs("button",{className:"artifact-card__action",type:"button",disabled:!n||s!=="",onClick:()=>void f(b.filename,b.version,p.filename),children:[s===`preview:${p.filename}`?o.jsx(mn,{className:"spin"}):o.jsx(JJ,{}),"预览"]}),o.jsxs("button",{className:"artifact-card__action artifact-card__action--primary",type:"button",disabled:!t||s!=="",onClick:()=>void d(p.filename,p.version),children:[s===`download:${p.filename}`?o.jsx(mn,{className:"spin"}):o.jsx(Jx,{}),"下载"]})]})]},`${p.filename}:${p.version}`)}),r&&o.jsx("div",{className:"artifact-card__error",children:r}),l&&o.jsxs("div",{className:"artifact-preview",role:"dialog","aria-modal":"true","aria-label":`${l.name} 预览`,children:[o.jsx("button",{className:"artifact-preview__backdrop",type:"button","aria-label":"关闭预览",onClick:u}),o.jsxs("div",{className:"artifact-preview__panel",children:[o.jsxs("div",{className:"artifact-preview__header",children:[o.jsx("span",{children:l.name}),o.jsx("button",{type:"button","aria-label":"关闭预览",onClick:u,children:o.jsx(Ti,{})})]}),o.jsx("div",{className:"artifact-preview__canvas",children:o.jsx("img",{src:l.url,alt:`${l.name} 幻灯片预览`})})]})]})]})}function ETe({block:e,onAuth:t}){const[n,s]=g.useState(e.done?"done":"idle"),[i,r]=g.useState(""),a=e.label||"MCP 工具集",l=(()=>{try{return e.authUri?new URL(e.authUri).host:""}catch{return""}})(),c=async()=>{if(t){r(""),s("authorizing");try{await t(e),s("done")}catch(d){r(d instanceof Error?d.message:String(d)),s("idle")}}};return e.done||n==="done"?o.jsxs(is.div,{className:"auth-card-collapsed",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},children:[o.jsx(xR,{className:"auth-card-icon auth-card-icon--done"}),o.jsxs("span",{children:["已授权 · ",a]})]}):o.jsxs(is.div,{className:"auth-card",initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[o.jsxs("div",{className:"auth-card-head",children:[o.jsx(xR,{className:"auth-card-icon"}),o.jsxs("span",{className:"auth-card-title",children:[a," 需要授权"]})]}),o.jsxs("p",{className:"auth-card-desc",children:["工具集 ",o.jsx("code",{className:"auth-card-code",children:a})," 使用 OAuth 保护, 需登录授权后方可调用。",l&&o.jsxs(o.Fragment,{children:[" ","将跳转至 ",o.jsx("code",{className:"auth-card-code",children:l})," 完成登录,"]}),"授权完成后对话自动继续。"]}),o.jsx("button",{className:"auth-card-btn",onClick:c,disabled:n==="authorizing"||!e.authUri,children:n==="authorizing"?o.jsxs(o.Fragment,{children:[o.jsx(mn,{className:"cw-i spin"})," 等待授权…"]}):o.jsx(o.Fragment,{children:"去授权"})}),!e.authUri&&o.jsx("div",{className:"auth-card-err",children:"未在事件中找到授权地址。"}),i&&o.jsx("div",{className:"auth-card-err",children:i})]})}function t2({blocks:e,appName:t="",streaming:n=!1,onStreamFrame:s,onAction:i,onAuth:r,onArtifactDownload:a,onArtifactPreview:l}){return o.jsx(o.Fragment,{children:e.map((c,u)=>{switch(c.kind){case"thinking":{const d=e.slice(u+1).some(f=>f.kind==="text"&&!!f.text.trim());return o.jsx(dH,{text:c.text,done:c.done,answerStarted:d,streaming:n,onStreamFrame:s},u)}case"text":{const d=c.text.replace(/^\s+/,"");return d?o.jsx(bTe,{text:d,streaming:n,onStreamFrame:s},u):null}case"attachment":return o.jsx($1,{appName:t,items:c.files},u);case"artifact":return o.jsx(xTe,{block:c,onDownload:a,onPreview:l},u);case"invocation":return o.jsx(F1,{value:c.value},u);case"tool":return c.name===cH&&c.done?null:o.jsx(yTe,{name:c.name,args:c.args,response:c.response,done:c.done},u);case"agent-transfer":return null;case"auth":return o.jsx(ETe,{block:c,onAuth:r},u);case"a2ui":return sH(c.messages).filter(d=>d.components[d.rootId]).map(d=>o.jsx(is.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",stiffness:380,damping:30},children:o.jsx(QNe,{surface:d,onAction:i})},`${u}-${d.surfaceId}`));default:return null}})})}function n2(e){return e.isComposing||e.keyCode===229}function vTe({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"m10.05 3.7 1.95-1.12 1.95 1.12"}),o.jsx("path",{d:"m16.25 5.03 3.9 2.25v4.5"}),o.jsx("path",{d:"M20.15 15.08v1.64l-3.9 2.25"}),o.jsx("path",{d:"m13.95 20.3-1.95 1.12-1.95-1.12"}),o.jsx("path",{d:"m7.75 18.97-3.9-2.25v-4.5"}),o.jsx("path",{d:"M3.85 8.92V7.28l3.9-2.25"}),o.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"})]})}const ha=[{value:"agent",label:"Agent",description:"与当前选择的 Agent 对话"},{value:"temporary",label:"内置智能体",description:"使用平台提供的智能体"},{value:"skill-create",label:"创建 Skill",description:"使用两个模型生成并对比 Skill"}],wTe=[{label:"ArkClaw",kind:"openclaw"},{label:"Hermes 智能体",kind:"hermes"}];function g3({mode:e}){return e==="skill-create"?o.jsxs("svg",{className:"new-chat-mode__skill-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:[o.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"}),o.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"?o.jsxs("svg",{className:"new-chat-mode__temporary-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("path",{d:"m10 2.8 6.1 3.45v7.5L10 17.2l-6.1-3.45v-7.5L10 2.8Z"}),o.jsx("path",{d:"m3.9 6.25 6.1 3.5 6.1-3.5M10 9.75v7.45"})]}):o.jsx(vTe,{className:"new-chat-mode__agent-icon"})}function STe(){return o.jsx("svg",{className:"new-chat-mode__nested-chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"m4.5 3 3 3-3 3"})})}function _Te({value:e,onChange:t,disabled:n=!1,temporaryEnabled:s,skillCreateEnabled:i}){const[r,a]=g.useState(!1),[l,c]=g.useState(!1),[u,d]=g.useState(()=>ha.findIndex(_=>_.value===e)),f=g.useRef(null),h=g.useRef(null),p=ha.find(_=>_.value===e)??ha[0],m=p.value==="temporary"?"Codex 智能体":p.label;function b(_){return _.value==="temporary"?s:_.value==="skill-create"?i:!0}function v(_){return b(_)!==!0}function y(_){const S=b(_);return S===void 0?"正在检查配置":S?_.description:"管理员未配置"}g.useEffect(()=>{if(!r)return;const _=S=>{var k;(k=f.current)!=null&&k.contains(S.target)||(a(!1),c(!1))};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[r]);function x(_){let S=u;do S=(S+_+ha.length)%ha.length;while(v(ha[S]));d(S),c(ha[S].value==="temporary")}function E(_){var S;if(!v(_)){if(_.value==="temporary"){c(!0);return}t(_.value),a(!1),c(!1),(S=h.current)==null||S.focus()}}function w(){t("temporary"),a(!1),c(!1)}return o.jsxs("div",{className:"new-chat-mode",ref:f,children:[o.jsxs("button",{ref:h,type:"button",className:"new-chat-mode__trigger","aria-label":"选择新会话模式","aria-haspopup":"listbox","aria-expanded":r,disabled:n,onClick:()=>{d(ha.findIndex(_=>_.value===e)),a(_=>(_&&c(!1),!_))},onKeyDown:_=>{_.key==="ArrowDown"||_.key==="ArrowUp"?(_.preventDefault(),r?x(_.key==="ArrowDown"?1:-1):a(!0)):r&&(_.key==="Enter"||_.key===" ")?(_.preventDefault(),E(ha[u])):r&&_.key==="Escape"&&(_.preventDefault(),a(!1),c(!1))},children:[o.jsx("span",{className:"new-chat-mode__icon",children:o.jsx(g3,{mode:p.value})}),o.jsx("span",{className:"new-chat-mode__current",title:m,children:m}),o.jsx("svg",{className:"new-chat-mode__chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"m3 4.5 3 3 3-3"})})]}),r?o.jsxs("div",{className:"new-chat-mode__menus",children:[o.jsx("div",{className:"new-chat-mode__menu",role:"listbox","aria-label":"新会话模式",tabIndex:-1,onKeyDown:_=>{var S;_.key==="ArrowDown"||_.key==="ArrowUp"?(_.preventDefault(),x(_.key==="ArrowDown"?1:-1)):_.key==="Enter"?(_.preventDefault(),E(ha[u])):_.key==="Escape"&&(_.preventDefault(),a(!1),c(!1),(S=h.current)==null||S.focus())},children:ha.map((_,S)=>{const k=_.value==="temporary";return o.jsxs("button",{type:"button",role:"option","aria-selected":e===_.value,"aria-haspopup":k?"menu":void 0,"aria-expanded":k?l:void 0,"aria-disabled":v(_),disabled:v(_),className:`new-chat-mode__option${S===u?" is-active":""}`,onMouseEnter:()=>{d(S),c(_.value==="temporary")},onClick:()=>E(_),children:[o.jsx("span",{className:"new-chat-mode__option-icon",children:o.jsx(g3,{mode:_.value})}),o.jsxs("span",{className:"new-chat-mode__copy",children:[o.jsxs("span",{className:"new-chat-mode__label",children:[_.label,_.value==="skill-create"?o.jsx("span",{className:"new-chat-mode__beta",children:"Beta"}):null]}),o.jsx("span",{children:y(_)})]}),k?o.jsx(STe,{}):e===_.value?o.jsx("svg",{className:"new-chat-mode__check",viewBox:"0 0 16 16","aria-hidden":"true",children:o.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})}):null]},_.value)})}),l?o.jsxs("div",{className:"new-chat-mode__submenu",role:"menu","aria-label":"内置智能体",children:[o.jsxs("button",{type:"button",role:"menuitem",className:"new-chat-mode__submenu-option",onClick:w,children:[o.jsx($m,{kind:"codex",className:"new-chat-mode__builtin-icon"}),o.jsxs("span",{className:"new-chat-mode__copy",children:[o.jsx("span",{className:"new-chat-mode__label",children:"Codex 智能体"}),o.jsx("span",{children:"在沙箱中执行任务"})]})]}),wTe.map(({label:_,kind:S})=>o.jsxs("button",{type:"button",role:"menuitem",className:"new-chat-mode__submenu-option",disabled:!0,children:[o.jsx($m,{kind:S,className:"new-chat-mode__builtin-icon"}),o.jsxs("span",{className:"new-chat-mode__copy",children:[o.jsx("span",{className:"new-chat-mode__label",children:_}),o.jsx("span",{children:"暂不可用"})]})]},_))]}):null]}):null]})}const Zu=[{id:"general",label:"通用智能体"},{id:"codex",label:"Codex 智能体"},{id:"openclaw",label:"OpenClaw 智能体"},{id:"hermes",label:"Hermes 智能体"}],NTe=15,TTe=15e3,kTe=120,ATe=180;function b3(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5.75 3.75 4.25 4.25-4.25 4.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function CTe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m3.25 8.25 3 3 6.5-6.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function _w({type:e,className:t="new-chat-agent-picker__type-icon"}){return e==="general"?o.jsx(Yc,{className:t}):o.jsx($m,{kind:e,className:t})}function ITe({selectedAgentName:e="",selectedRuntimeId:t="",runtimeScope:n,disabled:s=!1,onSelectRuntime:i,onSelectSandboxSession:r}){var ve;const[a,l]=g.useState(!1),[c,u]=g.useState(null),[d,f]=g.useState(0),[h,p]=g.useState(0),[m,b]=g.useState("types"),[v,y]=g.useState(!1),[x,E]=g.useState([]),[w,_]=g.useState([]),[S,k]=g.useState(null),[T,C]=g.useState(""),[I,j]=g.useState(!1),[L,z]=g.useState(""),[D,F]=g.useState(""),A=g.useRef(null),O=g.useRef(null),P=g.useRef(null),$=g.useRef(0),R=g.useRef(null),Y=g.useRef(null),J=g.useRef(null),U=((ve=Zu.find(re=>re.id===c))==null?void 0:ve.label)??"智能体",te=g.useCallback((re=!1)=>{var ke;Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null),J.current!==null&&(window.clearTimeout(J.current),J.current=null),l(!1),u(null),b("types"),y(!1),re&&((ke=O.current)==null||ke.focus())},[]),K=g.useCallback(async(re="",ke=!1)=>{const we=++$.current;let Je;j(!0),z("");try{const Le=await Promise.race([a1({scope:n,region:"all",pageSize:NTe,nextToken:re}),new Promise((Ve,_e)=>{Je=window.setTimeout(()=>{_e(new Error("加载智能体超时(15 秒),请检查网络或 Runtime 服务后重试"))},TTe)})]);if($.current!==we)return;E(Ve=>{const _e=ke?Le.runtimes:[...Ve,...Le.runtimes];return _e.filter((He,Pe)=>_e.findIndex(qe=>qe.runtimeId===He.runtimeId)===Pe)}),C(Le.nextToken),p(0)}catch(Le){if($.current!==we)return;z(Od(Le,"加载通用智能体","GET /web/runtimes"))}finally{window.clearTimeout(Je),$.current===we&&j(!1)}},[n]),V=g.useCallback(async re=>{var Je,Le;(Je=R.current)==null||Je.abort();const ke=new AbortController;R.current=ke;const we=++$.current;j(!0),z(""),_([]);try{const Ve=re==="codex"?await sn.listSessions({signal:ke.signal}):await sn.listAgentSessions(re,{signal:ke.signal});if($.current!==we)return;_(Ve),k(re),p(0)}catch(Ve){if((Ve==null?void 0:Ve.name)==="AbortError"||$.current!==we)return;z(Od(Ve,`加载 ${((Le=Zu.find(_e=>_e.id===re))==null?void 0:Le.label)??re}`,`GET /web/${re==="codex"?"sandbox":re}/sessions`)),k(re)}finally{R.current===ke&&(R.current=null),$.current===we&&j(!1)}},[]);g.useEffect(()=>{!a||c!=="general"||x.length>0||I||L||K("",!0)},[c,L,K,I,a,x.length]),g.useEffect(()=>{!a||c===null||c==="general"||S===c||V(c)},[c,V,S,a]),g.useEffect(()=>{if(!a)return;const re=ke=>{var we;(we=A.current)!=null&&we.contains(ke.target)||te()};return document.addEventListener("mousedown",re),()=>document.removeEventListener("mousedown",re)},[te,a]),g.useEffect(()=>()=>{var re;$.current+=1,(re=R.current)==null||re.abort(),Y.current!==null&&window.clearTimeout(Y.current),J.current!==null&&window.clearTimeout(J.current)},[]);function W(re,ke=!1){Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null),J.current!==null&&(window.clearTimeout(J.current),J.current=null),l(!0),u(ke?"general":null),f(0),b("types"),y(ke),re&&requestAnimationFrame(()=>{var we;return(we=P.current)==null?void 0:we.focus()})}function q(){s||a||Y.current!==null||(Y.current=window.setTimeout(()=>{Y.current=null,W(!1)},kTe))}function ue(){J.current!==null&&(window.clearTimeout(J.current),J.current=null)}function me(){Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null),!(!a||J.current!==null)&&(J.current=window.setTimeout(()=>{J.current=null,te()},ATe))}function Se(re){var Je;const ke=(re+Zu.length)%Zu.length,we=Zu[ke].id;we!==c&&($.current+=1,(Je=R.current)==null||Je.abort(),R.current=null,j(!1),z("")),f(ke),u(we),p(0)}async function de(re){if(!D){F(re.runtimeId),z("");try{await i(re),te(!0)}catch(ke){z(Od(ke,"连接通用智能体"))}finally{F("")}}}async function ge(re){if(!D){F(re.id),z("");try{await r(re),te(!0)}catch(ke){z(Od(ke,`打开 ${U}`))}finally{F("")}}}function Me(re){if(re.key==="Escape"){re.preventDefault(),te(!0);return}if(["ArrowDown","ArrowUp","ArrowRight","ArrowLeft","Enter"].includes(re.key)&&y(!0),m==="types"){re.key==="ArrowDown"||re.key==="ArrowUp"?(re.preventDefault(),Se(d+(re.key==="ArrowDown"?1:-1))):(re.key==="ArrowRight"||re.key==="Enter")&&(re.preventDefault(),c===null&&Se(d),b("runtimes"));return}if(re.key==="ArrowLeft")re.preventDefault(),b("types");else if((c==="general"?x:w).length>0&&(re.key==="ArrowDown"||re.key==="ArrowUp")){re.preventDefault();const ke=re.key==="ArrowDown"?1:-1,we=c==="general"?x.length:w.length;p(Je=>(Je+ke+we)%we)}else re.key==="Enter"&&c==="general"&&x[h]?(re.preventDefault(),de(x[h])):re.key==="Enter"&&c!=="general"&&w[h]&&(re.preventDefault(),ge(w[h]))}return o.jsxs("div",{className:"new-chat-agent-picker",ref:A,onPointerEnter:re=>{re.pointerType==="mouse"&&ue()},onPointerLeave:re=>{re.pointerType==="mouse"&&me()},children:[o.jsxs("button",{ref:O,type:"button",className:"new-chat-agent-picker__trigger","aria-label":"选择智能体","aria-haspopup":"menu","aria-expanded":a,disabled:s,onPointerEnter:re=>{re.pointerType==="mouse"&&q()},onClick:()=>a?te():W(!0),onKeyDown:re=>{re.key==="ArrowDown"||re.key==="ArrowUp"?(re.preventDefault(),a||W(!0,!0)):re.key==="Escape"&&a&&(re.preventDefault(),te(!0))},children:[o.jsx(Yc,{className:"new-chat-agent-picker__trigger-icon"}),o.jsx("span",{title:e||"选择智能体",children:e||"选择智能体"}),o.jsx(b3,{className:"new-chat-agent-picker__trigger-chevron"})]}),a?o.jsxs("div",{ref:P,className:"new-chat-agent-picker__menus",tabIndex:-1,onKeyDown:Me,onPointerMove:re=>{re.pointerType==="mouse"&&y(!1)},children:[o.jsx("div",{className:"new-chat-agent-picker__menu",role:"menu","aria-label":"智能体类型",children:Zu.map((re,ke)=>o.jsxs("button",{type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":c===re.id,className:`new-chat-agent-picker__type${v&&m==="types"&&d===ke?" is-keyboard-active":""}`,onMouseEnter:()=>Se(ke),onClick:()=>{Se(ke),b("runtimes")},children:[o.jsx(_w,{type:re.id}),o.jsx("span",{children:re.label}),o.jsx(b3,{className:"new-chat-agent-picker__nested-chevron"})]},re.id))}),c!==null?o.jsx("div",{className:"new-chat-agent-picker__submenu",role:"listbox","aria-label":`${U}列表`,children:c!=="general"&&I&&w.length===0?o.jsxs("div",{className:"new-chat-agent-picker__status",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"new-chat-agent-picker__spinner","aria-hidden":"true"}),"正在加载智能体"]}):c!=="general"&&L&&w.length===0?o.jsxs("div",{className:"new-chat-agent-picker__error",role:"alert",children:[o.jsx("span",{children:L}),o.jsx("button",{type:"button",onClick:()=>void V(c),children:"重新加载"})]}):c!=="general"&&w.length===0?o.jsxs(ns,{className:"new-chat-agent-picker__empty",fill:"none",children:[o.jsx(ns.Icon,{size:"sm",children:o.jsx(_w,{type:c,className:"new-chat-agent-picker__empty-agent-icon"})}),o.jsx(ns.Title,{children:o.jsxs("span",{className:"new-chat-agent-picker__empty-title",children:["暂无 ",U]})}),o.jsx(ns.Description,{children:"请前往智能体页创建"})]}):c!=="general"?o.jsx("div",{className:"new-chat-agent-picker__runtime-list",children:w.map((re,ke)=>{const we=D===re.id;return o.jsxs("button",{type:"button",role:"option","aria-selected":!1,"aria-busy":we||void 0,className:`new-chat-agent-picker__runtime${v&&m==="runtimes"&&h===ke?" is-keyboard-active":""}`,disabled:!!D,title:`${re.displayName||U} · ${re.id}`,onMouseEnter:()=>p(ke),onClick:()=>void ge(re),children:[o.jsx(_w,{type:c,className:"new-chat-agent-picker__runtime-icon"}),o.jsx("span",{children:re.displayName||U}),o.jsx("small",{children:we?"正在打开":B1(re.status)})]},re.id)})}):I&&x.length===0?o.jsxs("div",{className:"new-chat-agent-picker__status",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"new-chat-agent-picker__spinner","aria-hidden":"true"}),"正在加载智能体"]}):L&&x.length===0?o.jsxs("div",{className:"new-chat-agent-picker__error",role:"alert",children:[o.jsx("span",{children:L}),o.jsx("button",{type:"button",onClick:()=>void K("",!0),children:"重新加载"})]}):x.length===0?o.jsxs(ns,{className:"new-chat-agent-picker__empty",fill:"none",children:[o.jsx(ns.Icon,{size:"sm",children:o.jsx(Yc,{})}),o.jsx(ns.Title,{children:o.jsx("span",{className:"new-chat-agent-picker__empty-title",children:"暂无通用智能体"})}),o.jsx(ns.Description,{children:"请前往智能体页创建"})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"new-chat-agent-picker__runtime-list",children:x.map((re,ke)=>{const we=D===re.runtimeId,Je=re.runtimeId===t;return o.jsxs("button",{type:"button",role:"option","aria-selected":Je,"aria-busy":we||void 0,className:`new-chat-agent-picker__runtime${v&&m==="runtimes"&&h===ke?" is-keyboard-active":""}`,disabled:!!D,title:re.name,onMouseEnter:()=>p(ke),onClick:()=>void de(re),children:[o.jsx(Yc,{className:"new-chat-agent-picker__runtime-icon"}),o.jsx("span",{children:re.name}),we?o.jsx("small",{children:"正在连接"}):Je?o.jsx(CTe,{className:"new-chat-agent-picker__check"}):null]},re.runtimeId)})}),L?o.jsx("div",{className:"new-chat-agent-picker__inline-error",role:"alert",children:L}):null,T?o.jsx("button",{type:"button",className:"new-chat-agent-picker__load-more",disabled:I||!!D,onClick:()=>void K(T),children:I?"加载中":"加载更多"}):null]})}):null]}):null]})}const hH={ppt:["ppt_generate"],image:["image_generate"],video:["video_generate"]},jTe={ppt:[],image:[],video:["video_task_query"]},s2=["doubao-seed-2-0-pro-260215","deepseek-v4-flash-260425"];function y3(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"4.25",y:"6.25",width:"13.5",height:"13.5",rx:"2.5"}),o.jsx("path",{d:"M11 10v6M8 13h6"}),o.jsx("path",{d:"m19.25 2.75.53 1.47 1.47.53-1.47.53-.53 1.47-.53-1.47-1.47-.53 1.47-.53.53-1.47Z",fill:"currentColor",stroke:"none"})]})}const x3=[{value:"ppt",label:"PPT",icon:yee,prompts:["复盘【季度】经营表现,提炼指标差距、原因与行动建议","汇报【项目名称】进展:里程碑、风险、预算和资源诉求","为【客户行业】输出解决方案:痛点、架构、实施路径与收益","分析【行业主题】趋势,给出竞争格局、机会与战略建议"]},{value:"image",label:"图片生成",icon:kk,prompts:["为【品牌或产品】设计【高级科技】风格的发布会主视觉","生成【产品名称】电商海报,突出【核心卖点】与品牌色","呈现【产品或空间】在【使用场景】中的写实概念效果图","围绕【传播主题】制作简洁专业的企业社媒配图"]},{value:"video",label:"视频生成",icon:oH,prompts:["制作【品牌名称】30 秒宣传片,突出【品牌价值】","为【产品名称】制作 45 秒发布视频:痛点、功能、场景与行动号召","制作【培训主题】企业培训视频,讲清【关键操作或规范】","生成【活动名称】20 秒预热视频,包含亮点、时间地点和报名信息"]}];function RTe({sessionId:e,sessionInitializing:t=!1,appName:n,agentName:s,value:i,onChange:r,onSubmit:a,disabled:l,busy:c,showMeta:u,attachments:d,skills:f,agents:h,invocation:p,capabilitiesLoading:m=!1,allowAttachments:b=!0,onInvocationChange:v,onAddFiles:y,onRemoveAttachment:x,newChatMode:E="agent",newChatTask:w=null,newChatLayout:_=!1,showModeSelector:S=!1,onModeChange:k,onTaskChange:T,temporaryEnabled:C,skillCreateEnabled:I,harnessEnabled:j=!1,builtinTools:L=[],showAgentPicker:z=!1,agentPickerDisabled:D=!1,selectedRuntimeId:F="",runtimeScope:A="mine",onSelectRuntime:O,onSelectSandboxSession:P}){const $=g.useRef(null),R=g.useRef(null),Y=g.useRef(null),J=g.useRef(null),[U,te]=g.useState(!1),[K,V]=g.useState(null),[W,q]=g.useState(0),[ue,me]=g.useState(!1);async function Se(){if(e)try{await navigator.clipboard.writeText(e),me(!0),setTimeout(()=>me(!1),1500)}catch{me(!1)}}g.useLayoutEffect(()=>{const ne=$.current;ne&&(ne.style.height="auto",ne.style.height=`${Math.min(ne.scrollHeight,200)}px`)},[i]);const de=E==="skill-create";g.useEffect(()=>{de&&(te(!1),V(null))},[de]);const ge=!de&&d.some(ne=>ne.status!=="ready"),Me=!l&&!c&&!ge&&(i.trim().length>0||!de&&d.length>0),ve=de?`描述你想创建的 Skill,将使用 ${s2.join(" 和 ")} 并行创建…`:l?"请先选择智能体":`向 ${s} 发消息…`,re=(K==null?void 0:K.query.toLocaleLowerCase())??"",ke=(K==null?void 0:K.kind)==="skill"?f.filter(ne=>!p.skills.some(be=>be.name===ne.name)).filter(ne=>`${ne.name} ${ne.description}`.toLocaleLowerCase().includes(re)).map(ne=>({kind:"skill",value:ne})):(K==null?void 0:K.kind)==="agent"?h.filter(ne=>`${ne.name} ${ne.description}`.toLocaleLowerCase().includes(re)).map(ne=>({kind:"agent",value:ne})):[];function we(ne){var be;te(!1),V(null),(be=ne.current)==null||be.click()}function Je(ne){T==null||T(ne.value),te(!1),V(null),requestAnimationFrame(()=>{var be,Fe;(be=$.current)==null||be.focus(),(Fe=$.current)==null||Fe.setSelectionRange(i.length,i.length)})}function Le(ne){r(ne),te(!1),V(null),requestAnimationFrame(()=>{var Ke,bt,dt;(Ke=$.current)==null||Ke.focus();const be=ne.indexOf("【"),Fe=ne.indexOf("】",be+1);be>=0&&Fe>be?(bt=$.current)==null||bt.setSelectionRange(be+1,Fe):(dt=$.current)==null||dt.setSelectionRange(ne.length,ne.length)})}function Ve(){T==null||T(null),r(""),te(!1),V(null),requestAnimationFrame(()=>{var ne,be;(ne=$.current)==null||ne.focus(),(be=$.current)==null||be.setSelectionRange(0,0)})}const _e=x3.find(ne=>ne.value===w),He=x3.filter(ne=>hH[ne.value].every(be=>L.includes(be)));function Pe(ne,be){const Fe=ne.slice(0,be),Ke=/(^|\s)([/@])([^\s/@]*)$/.exec(Fe);if(!Ke){V(null);return}const bt=Ke[2].length+Ke[3].length,dt={kind:Ke[2]==="/"?"skill":"agent",query:Ke[3],start:be-bt,end:be},cn=!K||K.kind!==dt.kind||K.query!==dt.query||K.start!==dt.start||K.end!==dt.end;V(dt),cn&&q(0),te(!1)}function qe(ne){if(!K)return;const be=i.slice(0,K.start)+i.slice(K.end);r(be),ne.kind==="skill"?v({...p,skills:[...p.skills,ne.value]}):v({skills:[],targetAgent:ne.value});const Fe=K.start;V(null),requestAnimationFrame(()=>{var Ke,bt;(Ke=$.current)==null||Ke.focus(),(bt=$.current)==null||bt.setSelectionRange(Fe,Fe)})}function Z(){if(p.targetAgent){v({skills:[]});return}p.skills.length>0&&v({...p,skills:p.skills.slice(0,-1)})}function ae(ne){const be=ne.target.files?Array.from(ne.target.files):[];be.length&&y(be),ne.target.value=""}return o.jsxs("div",{className:`composer${_?" composer--new-chat":""}${de?" composer--skill-mode":""}${_e?` composer--has-task composer--task-${_e.value}`:""}`,children:[de?null:o.jsx(F1,{value:p,onRemoveSkill:ne=>v({...p,skills:p.skills.filter(be=>be.name!==ne)}),onRemoveAgent:()=>v({skills:[]})}),!de&&d.length>0&&o.jsx($1,{appName:n,compact:!0,items:d,onRemove:x}),o.jsxs("div",{className:"composer-box",children:[K?o.jsxs("div",{className:"composer-command-menu",role:"listbox","aria-label":K.kind==="skill"?"可用技能":"可用子 Agent",children:[o.jsxs("div",{className:"composer-command-head",children:[K.kind==="skill"?o.jsx(au,{}):o.jsx(fB,{}),o.jsx("span",{children:K.kind==="skill"?"调用技能":"使用子 Agent"}),o.jsx("kbd",{children:K.kind==="skill"?"/":"@"})]}),m?o.jsxs("div",{className:"composer-command-empty",children:[o.jsx(mn,{className:"spin"})," 正在读取 Agent 能力…"]}):ke.length===0?o.jsx("div",{className:"composer-command-empty",children:K.kind==="skill"?"当前 Agent 没有匹配技能":"当前 Agent 没有匹配子 Agent"}):o.jsx("div",{className:"composer-command-list",children:ke.map((ne,be)=>o.jsxs("button",{type:"button",role:"option","aria-selected":be===W,className:`composer-command-item${be===W?" is-active":""}`,onMouseDown:Fe=>{Fe.preventDefault(),qe(ne)},onMouseEnter:()=>q(be),children:[o.jsx("span",{className:`composer-command-icon composer-command-icon--${ne.kind}`,children:ne.kind==="skill"?o.jsx(au,{}):o.jsx(ru,{})}),o.jsxs("span",{className:"composer-command-copy",children:[o.jsxs("strong",{children:[ne.kind==="skill"?"/":"@",ne.value.name]}),o.jsx("span",{children:ne.value.description||(ne.kind==="skill"?"加载并执行该技能":"将本轮交给该 Agent")})]}),o.jsx("kbd",{children:be===W?"↵":ne.kind==="skill"?"技能":"Agent"})]},`${ne.kind}-${ne.value.name}`))})]}):null,de?null:o.jsxs("div",{className:"composer-menu-wrap",children:[o.jsx("button",{type:"button",className:"comp-icon",title:"添加","aria-label":"添加",disabled:l||!b,onClick:()=>{V(null),te(ne=>!ne)},children:o.jsx(_i,{className:"icon"})}),U&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>te(!1)}),o.jsxs("div",{className:"composer-menu",role:"menu",children:[o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>we(R),children:[o.jsx(kk,{className:"icon"}),"上传图片"]}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>we(Y),children:[o.jsx(Nk,{className:"icon"}),"上传文档或 PDF"]}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>we(J),children:[o.jsx(pB,{className:"icon"}),"上传视频"]})]})]})]}),z&&O&&P?o.jsx(ITe,{selectedAgentName:n?s:"",selectedRuntimeId:F,runtimeScope:A,disabled:D,onSelectRuntime:O,onSelectSandboxSession:P}):null,S&&k?o.jsx(_Te,{value:E,onChange:k,disabled:c,temporaryEnabled:C,skillCreateEnabled:I}):null,_&&E==="agent"&&_e&&T?o.jsxs("button",{type:"button",className:`new-chat-task-chip new-chat-task-chip--${_e.value}`,"aria-label":`取消${_e.label}任务`,disabled:c,onClick:Ve,children:[o.jsxs("span",{className:"new-chat-task-chip__icon","aria-hidden":"true",children:[o.jsx(_e.icon,{className:"new-chat-task-chip__task-icon"}),o.jsx(Ti,{className:"new-chat-task-chip__remove-icon"})]}),o.jsx("span",{children:_e.label})]}):null,_&&de&&k?o.jsxs("button",{type:"button",className:"new-chat-task-chip new-chat-task-chip--skill","aria-label":"退出创建 Skill",disabled:c,onClick:()=>k("agent"),children:[o.jsxs("span",{className:"new-chat-task-chip__icon","aria-hidden":"true",children:[o.jsx(y3,{className:"new-chat-task-chip__task-icon"}),o.jsx(Ti,{className:"new-chat-task-chip__remove-icon"})]}),o.jsx("span",{children:"Skill"})]}):null,o.jsxs("div",{className:"composer-input-stack",children:[o.jsx("textarea",{ref:$,className:"comp-input scroll",rows:_?4:1,value:i,disabled:l,placeholder:ve,"aria-expanded":!!K,onChange:ne=>{r(ne.target.value),de||Pe(ne.target.value,ne.target.selectionStart)},onSelect:ne=>{de||Pe(ne.currentTarget.value,ne.currentTarget.selectionStart)},onBlur:()=>setTimeout(()=>V(null),0),onKeyDown:ne=>{if(!n2(ne.nativeEvent)){if(K){if(ne.key==="ArrowDown"&&ke.length>0){ne.preventDefault(),q(be=>(be+1)%ke.length);return}if(ne.key==="ArrowUp"&&ke.length>0){ne.preventDefault(),q(be=>(be-1+ke.length)%ke.length);return}if((ne.key==="Enter"||ne.key==="Tab")&&ke[W]){ne.preventDefault(),qe(ke[W]);return}if(ne.key==="Escape"){ne.preventDefault(),V(null);return}}if(ne.key==="Backspace"&&!i&&ne.currentTarget.selectionStart===0&&ne.currentTarget.selectionEnd===0){Z();return}ne.key==="Enter"&&!ne.shiftKey&&(ne.preventDefault(),Me&&a())}}}),_&&i.length===0?o.jsx("span",{className:"composer-placeholder-reveal","aria-hidden":"true",children:ve},ve):null]}),o.jsx(is.button,{type:"button",className:"comp-send",disabled:!Me,onClick:a,"aria-label":"发送",whileTap:Me?{scale:.9}:void 0,transition:{type:"spring",stiffness:600,damping:22},children:c?o.jsx(mn,{className:"icon spin"}):o.jsx(dB,{className:"icon"})})]}),_&&E==="agent"&&j&&!_e?o.jsxs("div",{className:"task-shortcuts","aria-label":"选择任务类型",children:[He.map(ne=>{const be=ne.icon;return o.jsxs("button",{type:"button",className:"task-shortcut",disabled:l||c,onClick:()=>Je(ne),children:[o.jsx(be,{}),o.jsx("span",{children:ne.label})]},ne.value)}),I===!0?o.jsxs("button",{type:"button",className:"task-shortcut",disabled:c,onClick:()=>k==null?void 0:k("skill-create"),children:[o.jsx(y3,{}),o.jsx("span",{children:"创建 Skill"})]}):null]}):null,_&&E==="agent"&&_e?o.jsx("div",{className:"prompt-suggestions","aria-label":`${_e.label}企业提示词`,children:_e.prompts.map(ne=>{const be=_e.icon;return o.jsxs("button",{type:"button",className:"prompt-suggestion",disabled:l||c,onClick:()=>Le(ne),children:[o.jsx(be,{}),o.jsx("span",{children:ne})]},ne)})}):null,u&&o.jsxs("div",{className:"composer-meta",children:[o.jsxs("span",{className:"composer-session-line",children:["会话 ID:",o.jsx("span",{className:"composer-session-id",title:e||void 0,"aria-live":"polite",children:t?"初始化中":e||"—"}),e&&o.jsx("button",{type:"button",className:"composer-session-copy",title:ue?"已复制":"复制会话 ID","aria-label":ue?"已复制会话 ID":"复制会话 ID",onClick:()=>void Se(),children:ue?o.jsx(Ra,{}):o.jsx(Zx,{})})]}),o.jsx("span",{className:"composer-meta-separator","aria-hidden":!0,children:"|"}),o.jsx("span",{children:"回答仅供参考"})]}),o.jsx("input",{ref:R,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:ae}),o.jsx("input",{ref:Y,type:"file",accept:".txt,.md,.markdown,.pdf,text/plain,text/markdown,application/pdf",multiple:!0,hidden:!0,onChange:ae}),o.jsx("input",{ref:J,type:"file",accept:"video/mp4,video/webm,video/quicktime",multiple:!0,hidden:!0,onChange:ae})]})}function pH({title:e,sub:t,cards:n,footer:s}){return o.jsxs("div",{className:"stk",children:[o.jsxs("div",{className:"stk-head",children:[o.jsx("h1",{className:"stk-title",children:e}),t&&o.jsx("p",{className:"stk-sub",children:t})]}),o.jsx("div",{className:"stk-list",children:n.map((i,r)=>o.jsxs(is.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:r*.04},children:[o.jsx("span",{className:"stk-card-icon",children:o.jsx(i.icon,{})}),o.jsxs("span",{className:"stk-card-text",children:[o.jsx("span",{className:"stk-card-title",children:i.title}),o.jsx("span",{className:"stk-card-desc",children:i.desc})]}),i.status&&o.jsx("span",{className:"stk-card-status",children:i.status}),o.jsx(Ql,{className:"stk-card-arrow"})]},i.key))}),s&&o.jsx("div",{className:"stk-footer",children:s})]})}const i2=Symbol.for("yaml.alias"),pN=Symbol.for("yaml.document"),Vl=Symbol.for("yaml.map"),mH=Symbol.for("yaml.pair"),io=Symbol.for("yaml.scalar"),oh=Symbol.for("yaml.seq"),ra=Symbol.for("yaml.node.type"),lh=e=>!!e&&typeof e=="object"&&e[ra]===i2,Cg=e=>!!e&&typeof e=="object"&&e[ra]===pN,Ig=e=>!!e&&typeof e=="object"&&e[ra]===Vl,Hs=e=>!!e&&typeof e=="object"&&e[ra]===mH,Yn=e=>!!e&&typeof e=="object"&&e[ra]===io,jg=e=>!!e&&typeof e=="object"&&e[ra]===oh;function Us(e){if(e&&typeof e=="object")switch(e[ra]){case Vl:case oh:return!0}return!1}function $s(e){if(e&&typeof e=="object")switch(e[ra]){case i2:case Vl:case io:case oh:return!0}return!1}const gH=e=>(Yn(e)||Us(e))&&!!e.anchor,jc=Symbol("break visit"),OTe=Symbol("skip children"),Qp=Symbol("remove node");function ch(e,t){const n=MTe(t);Cg(e)?Ld(null,e.contents,n,Object.freeze([e]))===Qp&&(e.contents=null):Ld(null,e,n,Object.freeze([]))}ch.BREAK=jc;ch.SKIP=OTe;ch.REMOVE=Qp;function Ld(e,t,n,s){const i=LTe(e,t,n,s);if($s(i)||Hs(i))return DTe(e,s,i),Ld(e,i,n,s);if(typeof i!="symbol"){if(Us(t)){s=Object.freeze(s.concat(t));for(let r=0;re.replace(/[!,[\]{}]/g,t=>PTe[t]);class Vi{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Vi.defaultYaml,t),this.tags=Object.assign({},Vi.defaultTags,n)}clone(){const t=new Vi(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new Vi(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Vi.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Vi.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:Vi.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Vi.defaultTags),this.atNextDocument=!1);const s=t.trim().split(/[ \t]+/),i=s.shift();switch(i){case"%TAG":{if(s.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;const[r,a]=s;return this.tags[r]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[r]=s;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const a=/^\d+\.\d+$/.test(r);return n(6,`Unsupported YAML version ${r}`,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[,s,i]=t.match(/^(.*!)([^!]*)$/s);i||n(`The ${t} tag has no suffix`);const r=this.tags[s];if(r)try{return r+decodeURIComponent(i)}catch(a){return n(String(a)),null}return s==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,s]of Object.entries(this.tags))if(t.startsWith(s))return n+BTe(t.substring(s.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags);let i;if(t&&s.length>0&&$s(t.contents)){const r={};ch(t.contents,(a,l)=>{$s(l)&&l.tag&&(r[l.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,a]of s)r==="!!"&&a==="tag:yaml.org,2002:"||(!t||i.some(l=>l.startsWith(a)))&&n.push(`%TAG ${r} ${a}`);return n.join(` -`)}}Vi.defaultYaml={explicit:!1,version:"1.2"};Vi.defaultTags={"!!":"tag:yaml.org,2002:"};function bH(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 yH(e){const t=new Set;return ch(e,{Value(n,s){s.anchor&&t.add(s.anchor)}}),t}function xH(e,t){for(let n=1;;++n){const s=`${e}${n}`;if(!t.has(s))return s}}function UTe(e,t){const n=[],s=new Map;let i=null;return{onAnchor:r=>{n.push(r),i??(i=yH(e));const a=xH(t,i);return i.add(a),a},setAnchors:()=>{for(const r of n){const a=s.get(r);if(typeof a=="object"&&a.anchor&&(Yn(a.node)||Us(a.node)))a.node.anchor=a.anchor;else{const l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=r,l}}},sourceObjects:s}}function Dd(e,t,n,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let i=0,r=s.length;isa(s,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!gH(e))return e.toJSON(t,n);const s={aliasCount:0,count:1,res:void 0};n.anchors.set(e,s),n.onCreate=r=>{s.res=r,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 r2{constructor(t){Object.defineProperty(this,ra,{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:s,onAnchor:i,reviver:r}={}){if(!Cg(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 s=="number"?s:100},l=sa(this,"",a);if(typeof i=="function")for(const{count:c,res:u}of a.anchors.values())i(u,c);return typeof r=="function"?Dd(r,{"":l},"",l):l}}class a2 extends r2{constructor(t){super(i2),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 s;n!=null&&n.aliasResolveCache?s=n.aliasResolveCache:(s=[],ch(t,{Node:(r,a)=>{(lh(a)||gH(a))&&s.push(a)}}),n&&(n.aliasResolveCache=s));let i;for(const r of s){if(r===this)break;r.anchor===this.source&&(i=r)}return i}toJSON(t,n){if(!n)return{source:this.source};const{anchors:s,doc:i,maxAliasCount:r}=n,a=this.resolve(i,n);if(!a){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let l=s.get(a);if(l||(sa(a,null,n),l=s.get(a)),(l==null?void 0:l.res)===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(r>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=Wb(i,a,s)),l.count*l.aliasCount>r)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return l.res}toString(t,n,s){const i=`*${this.source}`;if(t){if(bH(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(t.implicitKey)return`${i} `}return i}}function Wb(e,t,n){if(lh(t)){const s=t.resolve(e),i=n&&s&&n.get(s);return i?i.count*i.aliasCount:0}else if(Us(t)){let s=0;for(const i of t.items){const r=Wb(e,i,n);r>s&&(s=r)}return s}else if(Hs(t)){const s=Wb(e,t.key,n),i=Wb(e,t.value,n);return Math.max(s,i)}return 1}const EH=e=>!e||typeof e!="function"&&typeof e!="object";class It extends r2{constructor(t){super(io),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:sa(this.value,t,n)}toString(){return String(this.value)}}It.BLOCK_FOLDED="BLOCK_FOLDED";It.BLOCK_LITERAL="BLOCK_LITERAL";It.PLAIN="PLAIN";It.QUOTE_DOUBLE="QUOTE_DOUBLE";It.QUOTE_SINGLE="QUOTE_SINGLE";const FTe="tag:yaml.org,2002:";function $Te(e,t,n){if(t){const s=n.filter(r=>r.tag===t),i=s.find(r=>!r.format)??s[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(s=>{var i;return((i=s.identify)==null?void 0:i.call(s,e))&&!s.format})}function Hm(e,t,n){var f,h,p;if(Cg(e)&&(e=e.contents),$s(e))return e;if(Hs(e)){const m=(h=(f=n.schema[Vl]).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:s,onAnchor:i,onTagObj:r,schema:a,sourceObjects:l}=n;let c;if(s&&e&&typeof e=="object"){if(c=l.get(e),c)return c.anchor??(c.anchor=i(e)),new a2(c.anchor);c={anchor:null,node:null},l.set(e,c)}t!=null&&t.startsWith("!!")&&(t=FTe+t.slice(2));let u=$Te(e,t,a.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const m=new It(e);return c&&(c.node=m),m}u=e instanceof Map?a[Vl]:Symbol.iterator in Object(e)?a[oh]:a[Vl]}r&&(r(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 It(e);return t?d.tag=t:u.default||(d.tag=u.tag),c&&(c.node=d),d}function mx(e,t,n){let s=n;for(let i=t.length-1;i>=0;--i){const r=t[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const a=[];a[r]=s,s=a}else s=new Map([[r,s]])}return Hm(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const mp=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;let vH=class extends r2{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(s=>$s(s)||Hs(s)?s.clone(t):s),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(mp(t))this.add(n);else{const[s,...i]=t,r=this.get(s,!0);if(Us(r))r.addIn(i,n);else if(r===void 0&&this.schema)this.set(s,mx(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}deleteIn(t){const[n,...s]=t;if(s.length===0)return this.delete(n);const i=this.get(n,!0);if(Us(i))return i.deleteIn(s);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}getIn(t,n){const[s,...i]=t,r=this.get(s,!0);return i.length===0?!n&&Yn(r)?r.value:r:Us(r)?r.getIn(i,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Hs(n))return!1;const s=n.value;return s==null||t&&Yn(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(t){const[n,...s]=t;if(s.length===0)return this.has(n);const i=this.get(n,!0);return Us(i)?i.hasIn(s):!1}setIn(t,n){const[s,...i]=t;if(i.length===0)this.set(s,n);else{const r=this.get(s,!0);if(Us(r))r.setIn(i,n);else if(r===void 0&&this.schema)this.set(s,mx(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}};const HTe=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Mo(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Bc=(e,t,n)=>e.endsWith(` -`)?Mo(n,t):n.includes(` +`}).map(([n,s])=>[n,s.split("__PROJECT_NAME__").join(e)]))}const uNe={id:"template",kind:"github",category:"development",icon:"github",name:"模板项目导入",description:"在您的仓库中创建一个可持续交付到 AgentKit Runtime 的最简智能体",title:"模板项目导入",subtitle:"把可直接启动 Studio 的 basic Agent 和持续交付配置加入仓库",panel:"提交后将创建一个 PR,同时导入 basic 项目和 AgentKit Runtime 发布工作流。",submitLabel:"导入模板并提交 PR",fields:[QA,ZA,{name:"projectPath",label:"Agent 项目目录",placeholder:"agentkit-basic-agent",help:"将在此目录新增 basic 项目;app.py 挂载完整 Studio App Server,并作为服务入口启动",required:!0},J$,eH],initialValues:JA({projectPath:"agentkit-basic-agent"}),regionHelp:"必须与目标 Runtime 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=e2(e),s=Z$(n.repository),i=WA(e.projectPath,"agentkit-basic-agent"),r=i==="."?s.split("/").slice(-1)[0]||"agentkit-basic-agent":i.split("/").slice(-1)[0]||"agentkit-basic-agent",a=Object.entries(cNe(r)).map(([l,c])=>({path:oNe(i,l),content:c,commitMessage:"feat: import AgentKit basic template",mustBeNew:!0}));return a.push({path:lNe(i),content:tH({baseBranch:n.baseBranch,projectPath:i,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:n.region}),commitMessage:"feat: add AgentKit Runtime delivery",mustBeNew:!0}),XA({...n,repository:s,files:a,branchPrefix:"feat/agentkit-basic-template",title:"feat: 导入 AgentKit basic 模板",description:"导入带有 AgentKit Studio App Server 的 basic Agent 项目,并添加持续发布到 AgentKit Runtime 的工作流。合并前请配置 Volcengine Secrets。"},t)}},d3=[{id:"development",label:"研发"},{id:"channels",label:"消息渠道"}],nH=[V_e,uNe,aNe,nNe,G_e],dNe=new Map(nH.map(e=>[e.id,e]));function fNe(e){const t=dNe.get(e);if(!t)throw new Error(`Unknown automation: ${e}`);return t}function hNe(e){const t=fNe(e);if(t.kind!=="github")throw new Error(`Automation is not backed by GitHub: ${e}`);return t}const t2="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2048%2048'%3e%3cimage%20width='48'%20height='48'%20href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAMKADAAQAAAABAAAAMAAAAADbN2wMAAAH7UlEQVRoBdVZWWwbVRQ9492Onc1xTfaWLukq9oSqLKnYBZRSNgn6AagsAgmJRfzxg4SEEDtiER8IBKKAChK0FS1tKYWW0lZQKKV0gxCVJm3ikDiO17EdzrUzSdw4jj1OpeQqNzO237vvnHfvu/e9GWVwcBBDYue1mrqE2kI1UqeSJAnmIHUzNUCNUmGiKtQy6oPUR6geqnw/FSVOUH9R36KupfaDHnBQn6MGqEnqVJcEAfZTBbNL4b+lZPI1VbwwnaSfYO8z8N+TVMd0Qj6EVdbs3eIBP29cVFkL00kk+wSEwHAamgh9bDAJSQWTITZFnF+85J1tBPyOUC9OqqnsVdTIRkVBi70Msy125uriHJ8XAXFRfzKBTQM+rO0/hc54cSQE8iyzAx/XLcEltjIU44uCQijOaHvPfxIv97TjWCzEcMo7+sZ4TGa+2V6KT2rPQ73ZptsPBZE30fVrymvxTvUCtDoqYC0ijhMk/3MkgDd62xFheOqVggjIIAbOVaujEh/ULsaNzioUsxhVAv/A34GD0YBubxZMQJupWpMNr58zHytcHth1ekICsDcRx4u+fxBK6vOCbgKyEIXEK975WOmaoZuErKv1QR8ORQd0eUE3Ac0TNSYrXvI24fZSLxwGfebiDKW3e08gln9J0oYvKoMNG6kmiRdmzMOtTi8sOsJJJfANA93oiseGbeZ7k1EHZAKCEcApu4wCxUsSz3rm4HQiim3B/wpOsBJA2yP/4cZIJYIBFcGwCjWeSKEwm4wosZtR7rKizGXJQJZRB1TuttftAprnAbOrM9rl9UHqwg+s1o+eOow/GNN5CaPOklSgdKq4us+Ji7pt6Dw1AF9vBOGImjJht5lRVWFDY7UL58/3wOt2YPEcN2xWVpPRe6EQC+y9rwINPNKsuRaYX5cXhIxGkks+Y7V+6vQRdLBi5yx1bGwicFebivj+ARgOhZGMJMFyQyWpoV2GRIa2ZXOX2bDyqnPxzEPNKC+1Zj957eDBTbz34PXAwvoMfBN+kGV8Bxf00VgQz/vaEB6nSCnRQVj2h2DZG4TyZwQWlSils3m8RDDEhk2uaqlHaYklVb3Ha42dh4B3eMzZ//eEmMc0kGL3cEU9WksqU4XvzAYKZ9n6fQCOz3thORCGkhgCf2bDMz4bjQpW39yE65Y1QO5FxiUgP+76E3hzI7D1VyBcwP5NTFcZzXjaPRMNZmvGPkfA23YMwLHRD0Mf3ZwTgaBIi8GgYMGsSjx2z3kEP9Jp5E5rOeoqQH75C3htPfDpD4CskXxFvHC5vQKPVjSwPqQfcKTAfxuA/Ws/lBAXwEhUTGjWSAL3r1qYykSju+UkIFbZDx09wPvb0iH1W9uEYw03MHAV3ltew1CqgDkyCNtWgt/cnwY/3GriG5n9hbMrccNljRmzLz0nJCCNJBsEwsCH24E3NgDr96brhfyWS2Sm3EYLVsOL0i0DsG8h+LDkqcLExHhfc9siVDDrjJ59sZJRyHKZFRKybiSkTtIjR08CrXwEdtGcXL2A4+192LOuDeatfqg6wMvsL5lbhWuWysIdO995E9BgSkh19THX7wQOtANXLgKWLQSaarUWI9dNP7bjo68OY9uef6GqhcW8ZkViX2a/nBWYQ4+RggmIBfFGnHgOcD0c7wD2HgOW0xuXk0xN5SDaOwL4cnsb1m05joPHejKK0hgEOb4Q8Muba3H1pXUwZZl96aqLgHSU2RCbEe6/9hzh875OYPdhYF5NDLt/Oohd+46gNxBjm2zzJhZyi/RyV5TggdsvRJnTOm5j3QQ0i9ra6OHj1u9+B/YdNcLXVQdDmYNPy9oZ971IcIPHjUHadVrHHFfZNphtTtx508W4eJEHsg7Gk6IJaIZlDEn3EdUEl7sBg4la2MtqkYgNIOz/F9FgF6IhX6p5mozcjgbGasw/xWCCs7IeN7U24b4VddwZj26jjTZynTQCmknxSBqIETanh7ceWEpmpIiokT7E6JFosBvxaD/iJCeNDQYzTFYnzHY3SsobmfM9eOyucjTO0KyOf510AqOHkl2kiMlSQoAlsPLAk4hHSCaIJMMqmUgfYBQeggxGK4xmOxprXHh8lYK51em+E/0/qwQyBh8iY+Q52pjlOZD8XFcFPHELcGlT3stlbBaymtOROTReBoZJ+0DjZ9pv4SFq9fL0YWqcjJl1+AwP8OSGS+amq6y4P/fyyWqvoC9lDAG7ainPEJcBs7xMBGOLbU6bGQTMJHAnDUlG2biPFZevEM4GCZl9sSsnPgG+bAHfa+l8vZJxpNSo+oPp/c4XP6bPBN0kog2qtdFz1WzIkfXmZuAKVm6JewlbvZKVgGZMilMPwW9ngdr5B3CEG7iEbCY5ffl6RgPtYDGdybS4ogW4YDbgLefTD5s2kv5rTgKaWdlKi1fau4BDJ3jM5I70NDd0J7grzfZEUMg5CM5Tmg4TiW3ZtVYxTKpcgM2iWS7+mhcBbRiZ/TBTd4jPjtSEVF3AxxdUPgkxTrUUMTcBykKUmLZwhQlYPhWBeCBV5DRjk3QtiEC2McUDsjPVCEhWEQ8Umk2y2c7nOyEwrV/ySdbdQo3nw3aKtRHM3wiBtVQu02knISJ+SQh8Q32TyqTJJ6xTXyQzyzb2LeoBWQOy5pjwcDf1YSqzNIooLex99kTCppsq4N+l+oUArylhoku9sb+O18VU8c5UEiZu7KGyrKKTmgr7/wGxhy03aZIycwAAAABJRU5ErkJggg=='%20/%3e%3c/svg%3e";function sH(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91 .58 .11 .79-.25.79-.56v-2.02c-3.2.7-3.88-1.36-3.88-1.36-.52-1.33-1.28-1.69-1.28-1.69-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.77 2.71 1.26 3.37.96.1-.75.4-1.26.73-1.55-2.56-.29-5.25-1.28-5.25-5.7 0-1.26.45-2.29 1.19-3.1-.12-.29-.52-1.47.11-3.06 0 0 .97-.31 3.16 1.18A10.98 10.98 0 0 1 12 6.11c.98 0 1.96.13 2.87.39 2.19-1.49 3.16-1.18 3.16-1.18.63 1.59.23 2.77.11 3.06.74.81 1.19 1.84 1.19 3.1 0 4.43-2.7 5.4-5.27 5.69.42.36.78 1.06.78 2.14v3.04c0 .31.21.67.8.56A11.51 11.51 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z"})})}function f3(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"6.2",stroke:"currentColor",strokeWidth:"1.7"}),o.jsx("path",{d:"m15.4 15.4 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function pNe(e){return o.jsxs("svg",{viewBox:"0 0 36 36",fill:"none","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"18",height:"18",rx:"5",fill:"currentColor",opacity:"0.1"}),o.jsx("rect",{x:"3.5",y:"5",width:"18",height:"18",rx:"5",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("path",{d:"m9.2 11.2-2.8 2.7 2.8 2.7M12.1 17.4h4.3",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("circle",{cx:"26.5",cy:"12",r:"3",fill:"hsl(var(--background))",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("circle",{cx:"27",cy:"26.5",r:"3",fill:"hsl(var(--background))",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("path",{d:"M21.5 12h2M19.3 21l5.6 3.8M27 15v8.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function mNe({onOpen:e}){var c;const[t,n]=g.useState("development"),[s,i]=g.useState(""),r=g.useDeferredValue(s),a=g.useMemo(()=>{const u=r.trim().toLocaleLowerCase();return nH.filter(d=>d.category===t).filter(d=>!u||`${d.name} ${d.description}`.toLocaleLowerCase().includes(u))},[t,r]),l=(c=d3.find(u=>u.id===t))==null?void 0:c.label;return o.jsxs("div",{className:"applications-page",children:[o.jsxs("header",{className:"applications-header",children:[o.jsxs("div",{children:[o.jsx("h1",{children:"自动化"}),o.jsx("p",{children:"连接研发工具,为智能体扩展自动化工作流"})]}),o.jsxs("label",{className:"applications-search",children:[o.jsx(f3,{}),o.jsx("input",{type:"search","aria-label":"搜索自动化",value:s,onChange:u=>i(u.target.value),placeholder:"搜索自动化"})]})]}),o.jsx("nav",{className:"applications-categories","aria-label":"自动化分类",children:d3.map(u=>o.jsx("button",{type:"button",className:t===u.id?"is-active":"","aria-pressed":t===u.id,onClick:()=>n(u.id),children:u.label},u.id))}),o.jsx("section",{className:"applications-results","aria-label":`${l}自动化列表`,children:a.length?o.jsx("div",{className:"applications-grid",children:a.map(u=>o.jsxs("button",{type:"button",className:"application-card",onClick:()=>e(u.id),"aria-label":`打开${u.name}`,children:[u.icon==="feishu"?o.jsx("img",{className:"application-card-icon application-card-brand-icon",src:t2,alt:"","aria-hidden":"true"}):u.icon==="coding-agents"?o.jsx(pNe,{className:"application-card-icon"}):o.jsx(sH,{className:"application-card-icon"}),o.jsxs("div",{className:"application-card-copy",children:[o.jsxs("div",{className:"application-card-title",children:[o.jsx("h2",{children:u.name}),u.badge?o.jsx("span",{className:`application-card-badge is-${u.badgeTone||"default"}`,children:u.badge}):null]}),o.jsx("p",{children:u.description})]})]},u.id))}):o.jsxs("div",{className:"applications-empty",role:"status",children:[o.jsx(f3,{}),o.jsx("h2",{children:"没有匹配的自动化"}),o.jsx("p",{children:"请尝试搜索其他名称"})]})})]})}function gNe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function bNe({hidden:e,...t}){return o.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[o.jsx("path",{d:"M2.5 10s2.6-4 7.5-4 7.5 4 7.5 4-2.6 4-7.5 4-7.5-4-7.5-4Z"}),o.jsx("circle",{cx:"10",cy:"10",r:"1.8"}),e?o.jsx("path",{d:"m4 4 12 12"}):null]})}function h3(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M6.5 4H4.8A1.8 1.8 0 0 0 3 5.8v5.4A1.8 1.8 0 0 0 4.8 13h5.4a1.8 1.8 0 0 0 1.8-1.8V9.5M9 3h4v4M12.5 3.5 7.2 8.8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function yNe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function xNe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6.2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Tw(e,t,n){const s=t.trim();if(!s)return n?"此项不能为空":"";if(e==="repository"&&!/^(?:https:\/\/github\.com\/)?[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+(?:\.git)?$/.test(s))return"请输入 owner/repository 或完整 GitHub Repo URL";if(e==="baseBranch"&&(!/^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(s)||s.includes("..")))return"目标分支格式不正确";if(e==="projectPath"&&(s.startsWith("/")||s.split("/").includes("..")))return"请输入仓库内的相对目录";if(e==="runtimeName"&&!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(s))return"以字母开头,仅支持字母、数字、下划线和连字符";if(e==="runtimeId"&&!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(s))return"Runtime ID 格式不正确";if(e==="sandboxToolId"&&!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(s))return"Sandbox Tool ID 格式不正确";if(e==="modelName"&&!/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/.test(s))return"模型名称格式不正确";if(e==="modelBaseUrl")try{const i=new URL(s);if(i.protocol!=="https:"||i.username||i.password||i.search||i.hash)return"请输入不含凭据、查询参数或锚点的 HTTPS 地址"}catch{return"请输入有效的 HTTPS 地址"}return""}function ENe({automation:e,onBack:t}){const n=hNe(e),[s,i]=g.useState(()=>({...n.initialValues})),[r,a]=g.useState({}),[l,c]=g.useState(""),[u,d]=g.useState(!1),[f,h]=g.useState(!1),[p,m]=g.useState(!1),[b,v]=g.useState(null),y=g.useRef(null);g.useEffect(()=>()=>{var k;return(k=y.current)==null?void 0:k.abort()},[]);const x=(k,T)=>{i(C=>({...C,[k]:T})),r[k]&&a(C=>({...C,[k]:""}))},E=k=>{var I;const T=k==="token"||((I=n.fields.find(j=>j.name===k))==null?void 0:I.required)===!0,C=Tw(k,s[k],T);a(j=>({...j,[k]:C}))},w=async k=>{var j;k.preventDefault();const T={};for(const L of n.fields){const z=Tw(L.name,s[L.name],L.required);z&&(T[L.name]=z)}const C=Tw("token",s.token,!0);if(C&&(T.token=C),a(T),Object.keys(T).length)return;(j=y.current)==null||j.abort();const I=new AbortController;y.current=I,d(!0),c(""),v(null);try{const L=await n.submit(s,I.signal);if(y.current!==I)return;v(L),i(z=>({...z,token:""}))}catch(L){if(I.signal.aborted||y.current!==I)return;c(L instanceof Error?L.message:String(L))}finally{y.current===I&&(y.current=null,d(!1))}},_=k=>{k.key==="Enter"&&(k.nativeEvent.isComposing||k.nativeEvent.keyCode===229)&&k.preventDefault()},S=k=>{const{name:T,label:C,placeholder:I,help:j,required:L}=k;return o.jsxs("div",{className:"github-field",children:[o.jsxs("label",{htmlFor:`github-${T}`,children:[o.jsx("span",{children:C}),o.jsx("span",{className:`github-field-requirement${L?" is-required":""}`,children:L?"必填":"可选"})]}),o.jsx("input",{id:`github-${T}`,value:s[T],onChange:z=>x(T,z.target.value),onBlur:()=>E(T),placeholder:I,required:L,"aria-invalid":!!r[T],"aria-describedby":`github-${T}-help${r[T]?` github-${T}-error`:""}`}),o.jsx("span",{id:`github-${T}-help`,className:"github-field-help",children:j}),r[T]?o.jsx("span",{id:`github-${T}-error`,className:"github-field-error",role:"alert",children:r[T]}):null]},T)};return o.jsxs("div",{className:"github-integration-page",children:[o.jsxs("header",{className:"github-integration-header",children:[o.jsx("button",{type:"button",className:"github-back",onClick:t,"aria-label":"返回自动化列表",children:o.jsx(gNe,{})}),o.jsx(sH,{className:"github-integration-logo"}),o.jsxs("div",{children:[o.jsx("h1",{children:n.title}),o.jsx("p",{children:n.subtitle})]})]}),o.jsx("div",{className:"github-integration-layout",children:o.jsxs("section",{id:`github-panel-${e}`,className:"github-section-panel",children:[o.jsx("div",{className:"github-panel-heading",children:o.jsx("p",{children:n.panel})}),o.jsxs("form",{className:"github-release-form",onSubmit:w,onKeyDown:_,noValidate:!0,children:[o.jsxs("div",{className:"github-field-grid",children:[n.fields.map(S),o.jsxs("div",{className:"github-field",children:[o.jsxs("label",{id:"github-region-label",children:[o.jsx("span",{children:"地域"}),o.jsx("span",{className:"github-field-requirement is-required",children:"必填"})]}),o.jsxs("div",{className:"pp-network-region github-region-picker",onKeyDown:k=>{k.key==="Escape"&&m(!1)},children:[o.jsxs("button",{type:"button",className:"pp-region-trigger","aria-labelledby":"github-region-label","aria-haspopup":"listbox","aria-expanded":p,onClick:()=>m(k=>!k),children:[o.jsx("span",{children:s.region==="cn-shanghai"?"华东 2(上海)":"华北 2(北京)"}),o.jsx(yNe,{className:`pp-region-chevron${p?" is-open":""}`})]}),p?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>m(!1)}),o.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":"地域",children:[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}].map(k=>{const T=k.value===s.region;return o.jsxs("button",{type:"button",role:"option","aria-selected":T,className:`pp-region-option${T?" is-selected":""}`,onClick:()=>{x("region",k.value),m(!1)},children:[o.jsx("span",{children:k.label}),T?o.jsx(xNe,{}):null]},k.value)})})]}):null]}),o.jsx("span",{className:"github-field-help",children:n.regionHelp})]})]}),o.jsxs("div",{className:"github-field github-token-field",children:[o.jsxs("div",{className:"github-token-label-row",children:[o.jsxs("label",{htmlFor:"github-token",children:[o.jsx("span",{children:"GitHub Token"}),o.jsx("span",{className:"github-field-requirement is-required",children:"必填"})]}),o.jsxs("a",{href:"https://github.com/settings/personal-access-tokens/new?name=VeADK%20Studio&description=Create%20a%20GitHub%20automation%20pull%20request&contents=write&pull_requests=write",target:"_blank",rel:"noreferrer",children:["获取 Token",o.jsx(h3,{})]})]}),o.jsxs("div",{className:"github-token-input",children:[o.jsx("input",{id:"github-token",type:f?"text":"password",value:s.token,onChange:k=>x("token",k.target.value),onBlur:()=>E("token"),autoComplete:"off",required:!0,placeholder:"需要仓库 Contents 与 Pull requests 写权限","aria-invalid":!!r.token,"aria-describedby":`github-token-help${r.token?" github-token-error":""}`}),o.jsx("button",{type:"button",onClick:()=>h(k=>!k),"aria-label":f?"隐藏 Token":"显示 Token",title:f?"隐藏 Token":"显示 Token",children:o.jsx(bNe,{hidden:f})})]}),o.jsx("span",{id:"github-token-help",className:"github-field-help",children:"Token 仅用于本次提交,不会保存在浏览器或写入 PR"}),r.token?o.jsx("span",{id:"github-token-error",className:"github-field-error",role:"alert",children:r.token}):null]}),l?o.jsx("div",{className:"github-submit-message is-error",role:"alert",children:l}):null,b?o.jsxs("div",{className:"github-submit-message is-success",role:"status",children:[o.jsxs("span",{children:["PR #",b.number," 已创建"]}),o.jsxs("a",{href:b.url,target:"_blank",rel:"noreferrer",children:["在 GitHub 查看",o.jsx(h3,{})]})]}):null,o.jsxs("div",{className:"github-form-actions",children:[o.jsxs("div",{className:"github-secrets-note",children:[o.jsx("strong",{children:"合并 PR 前,请在仓库的 GitHub Actions Secrets 中配置:"}),n.secrets.map(k=>o.jsx("span",{children:k},k))]}),o.jsx("button",{type:"submit",disabled:u,children:u?"提交 PR 中…":n.submitLabel})]})]})]})})]})}const vNe=/^[A-Za-z_][A-Za-z0-9_]*$/;function Yl(e){return e.trim().length===0?"名称为必填项":e==="user"?"user 是 Google ADK 保留名称,请使用其他名称":vNe.test(e)?null:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"}function iH(e){const t=new Set,n=new Set,s=i=>{Yl(i.name)===null&&(t.has(i.name)?n.add(i.name):t.add(i.name)),i.subAgents.forEach(s)};return s(e),n}function wNe(e){return{...wi(),name:e,description:"一个通过飞书接收消息并提供帮助的智能助手。",instruction:"你是一个通过飞书为用户提供帮助的智能助手。准确理解用户问题,给出简洁、可靠的回答;信息不足时先提问澄清,不要臆造事实。",deployment:{feishuEnabled:!0}}}async function SNe(e){const t=wNe(e.agentName),n=await c1(t);return ug(n.name,n.files,{region:e.region,projectName:"default"},{taskId:e.taskId,sessionStorage:"in-memory",minInstance:1,maxInstance:1,description:t.description,im:{feishu:{enabled:!0}},envs:[{key:"FEISHU_APP_ID",value:e.appId},{key:"FEISHU_APP_SECRET",value:e.appSecret}],onStage:e.onStage})}const da=[{value:"cn-beijing",label:"北京"},{value:"cn-shanghai",label:"上海"}],rH=[{phase:"prepare",label:"生成智能体"},{phase:"build",label:"构建镜像"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}];function _Ne(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function NNe(e){return o.jsx("svg",{viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5 7 4 4 4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function p3(e){return o.jsx("svg",{viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4 9.2 3.1 3.1L14 5.8",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function TNe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M6.5 4H4.8A1.8 1.8 0 0 0 3 5.8v5.4A1.8 1.8 0 0 0 4.8 13h5.4a1.8 1.8 0 0 0 1.8-1.8V9.5M9 3h4v4M12.5 3.5 7.2 8.8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function kNe(e){if(!e||e==="upload")return 0;const t=rH.findIndex(n=>n.phase===e);return t<0?0:t}function ANe({onBack:e}){var V;const[t,n]=g.useState("feishu_assistant"),[s,i]=g.useState(""),[r,a]=g.useState(""),[l,c]=g.useState(!1),[u,d]=g.useState("cn-beijing"),[f,h]=g.useState(!1),[p,m]=g.useState(""),[b,v]=g.useState(""),[y,x]=g.useState(""),[E,w]=g.useState("idle"),[_,S]=g.useState(null),[k,T]=g.useState(""),[C,I]=g.useState(null),j=g.useRef(null),L=g.useRef(null),z=g.useRef([]),D=g.useRef(0),F=g.useRef(null),A=g.useRef(!1),M=g.useRef(!0),P=["preparing","running","cancelling"].includes(E);g.useEffect(()=>(M.current=!0,()=>{M.current=!1}),[]),g.useEffect(()=>{var ue;if(!f)return;(ue=z.current[D.current])==null||ue.focus();const W=pe=>{pe.target instanceof Node&&j.current&&!j.current.contains(pe.target)&&h(!1)},q=pe=>{var we;pe.key==="Escape"&&(h(!1),(we=L.current)==null||we.focus())};return window.addEventListener("pointerdown",W),window.addEventListener("keydown",q),()=>{window.removeEventListener("pointerdown",W),window.removeEventListener("keydown",q)}},[f]);const H=W=>{W.key==="Enter"&&(W.nativeEvent.isComposing||W.nativeEvent.keyCode===229)&&W.preventDefault()},R=()=>{const W=Yl(t.trim())??"",q=s.trim()?"":"请输入飞书 App ID",ue=r.trim()?"":"请输入飞书 App Secret";return m(W),v(q),x(ue),!W&&!q&&!ue},Y=async W=>{if(W.preventDefault(),!R()||P)return;const q=crypto.randomUUID();F.current=q,A.current=!1,w("preparing"),S(null),T(""),I(null);try{const ue=await SNe({agentName:t.trim(),appId:s.trim(),appSecret:r.trim(),region:u,taskId:q,onStage:pe=>{!M.current||A.current||(w("running"),S(pe))}});if(!M.current||A.current)return;I(ue),a(""),c(!1),w("succeeded")}catch(ue){if(!M.current||A.current)return;w("failed"),T(ue instanceof Error?ue.message:String(ue))}finally{F.current===q&&(F.current=null)}},J=async()=>{const W=F.current;if(!(!W||E!=="running")&&window.confirm("取消部署将停止任务并清理已创建的 Runtime,确定继续吗?")){A.current=!0,w("cancelling"),T("");try{await s8(W),M.current&&w("cancelled")}catch(q){if(A.current=!1,!M.current)return;w("failed"),T(q instanceof Error?q.message:String(q))}}},U=kNe((_==null?void 0:_.phase)??null),te=!!(t.trim()&&s.trim()&&r.trim()&&!P),K=da.find(W=>W.value===u);return o.jsxs("div",{className:"feishu-integration-page",children:[o.jsxs("header",{className:"feishu-integration-header",children:[o.jsx("button",{type:"button",className:"feishu-back",onClick:e,"aria-label":"返回自动化列表",disabled:P,children:o.jsx(_Ne,{})}),o.jsx("img",{className:"feishu-integration-logo",src:t2,alt:"","aria-hidden":"true"}),o.jsxs("div",{children:[o.jsx("h1",{children:"飞书机器人"}),o.jsx("p",{children:"创建一个由 AgentKit Runtime 驱动的飞书智能体"})]})]}),o.jsx("div",{className:"feishu-integration-layout",children:o.jsxs("section",{className:"feishu-section-panel",children:[o.jsx("p",{className:"feishu-panel-description",children:"填写已发布飞书应用的凭据,Studio 将生成 basic 智能体、创建独立 Runtime,并启用飞书消息长连接。"}),o.jsxs("form",{className:"feishu-form",onSubmit:Y,onKeyDown:H,noValidate:!0,children:[o.jsxs("div",{className:"feishu-field-grid",children:[o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{htmlFor:"feishu-agent-name",children:"智能体名称"}),o.jsx("input",{id:"feishu-agent-name",value:t,maxLength:64,disabled:P,onChange:W=>{n(W.target.value),p&&m("")},onBlur:()=>m(Yl(t.trim())??""),"aria-invalid":!!p,"aria-describedby":`feishu-agent-name-help${p?" feishu-agent-name-error":""}`}),o.jsx("span",{id:"feishu-agent-name-help",className:"feishu-field-help",children:"将作为新 Runtime 中的根智能体名称"}),p?o.jsx("span",{id:"feishu-agent-name-error",className:"feishu-field-error",role:"alert",children:p}):null]}),o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{id:"feishu-region-label",children:"部署地域"}),o.jsxs("div",{className:"feishu-region-picker",ref:j,children:[o.jsxs("button",{ref:L,type:"button",className:"feishu-region-trigger",disabled:P,"aria-haspopup":"listbox","aria-expanded":f,"aria-labelledby":"feishu-region-label feishu-region-value",onClick:()=>{D.current=da.findIndex(W=>W.value===u),h(W=>!W)},onKeyDown:W=>{W.key!=="ArrowDown"&&W.key!=="ArrowUp"||(W.preventDefault(),D.current=W.key==="ArrowUp"?da.length-1:da.findIndex(q=>q.value===u),h(!0))},children:[o.jsx("span",{id:"feishu-region-value",children:K.label}),o.jsx(NNe,{})]}),f?o.jsx("div",{className:"feishu-region-menu",role:"listbox","aria-label":"部署地域",onKeyDown:W=>{var pe;const q=z.current.findIndex(we=>we===document.activeElement);let ue=null;W.key==="ArrowDown"?ue=(q+1)%da.length:W.key==="ArrowUp"?ue=(q-1+da.length)%da.length:W.key==="Home"?ue=0:W.key==="End"?ue=da.length-1:W.key==="Tab"&&h(!1),ue!==null&&(W.preventDefault(),(pe=z.current[ue])==null||pe.focus())},children:da.map(W=>o.jsx("button",{ref:q=>{const ue=da.findIndex(pe=>pe.value===W.value);z.current[ue]=q},type:"button",role:"option","aria-selected":u===W.value,className:`feishu-region-option${u===W.value?" is-selected":""}`,onClick:()=>{var q;d(W.value),h(!1),(q=L.current)==null||q.focus()},children:W.label},W.value))}):null]}),o.jsx("span",{className:"feishu-field-help",children:"Runtime 与构建产物将创建在该地域"})]}),o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{htmlFor:"feishu-app-id",children:"飞书 App ID"}),o.jsx("input",{id:"feishu-app-id",value:s,maxLength:128,autoComplete:"off",disabled:P,placeholder:"cli_xxxxxxxxxxxxxxxx",onChange:W=>{i(W.target.value),b&&v("")},onBlur:()=>v(s.trim()?"":"请输入飞书 App ID"),"aria-invalid":!!b,"aria-describedby":`feishu-app-id-help${b?" feishu-app-id-error":""}`}),o.jsx("span",{id:"feishu-app-id-help",className:"feishu-field-help",children:"来自飞书开放平台的应用凭证"}),b?o.jsx("span",{id:"feishu-app-id-error",className:"feishu-field-error",role:"alert",children:b}):null]}),o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{htmlFor:"feishu-app-secret",children:"飞书 App Secret"}),o.jsxs("div",{className:"feishu-secret-input",children:[o.jsx("input",{id:"feishu-app-secret",type:l?"text":"password",value:r,maxLength:256,autoComplete:"off",disabled:P,placeholder:"请输入 App Secret",onChange:W=>{a(W.target.value),y&&x("")},onBlur:()=>x(r.trim()?"":"请输入飞书 App Secret"),"aria-invalid":!!y,"aria-describedby":`feishu-app-secret-help${y?" feishu-app-secret-error":""}`}),o.jsx("button",{type:"button",disabled:P,onClick:()=>c(W=>!W),"aria-label":l?"隐藏 App Secret":"显示 App Secret",children:l?"隐藏":"显示"})]}),o.jsx("span",{id:"feishu-app-secret-help",className:"feishu-field-help",children:"仅写入新 Runtime 的环境变量"}),y?o.jsx("span",{id:"feishu-app-secret-error",className:"feishu-field-error",role:"alert",children:y}):null]})]}),E!=="idle"?o.jsxs("div",{className:`feishu-deployment-status is-${E}`,role:E==="failed"?"alert":"status",children:[o.jsxs("div",{className:"feishu-deployment-heading",children:[E==="preparing"?o.jsx(Ta,{as:"strong",children:"正在生成 basic 智能体"}):null,E==="running"?o.jsx(Ta,{as:"strong",children:(_==null?void 0:_.message)||"正在创建 Runtime"}):null,E==="cancelling"?o.jsx(Ta,{as:"strong",children:"正在取消部署"}):null,E==="succeeded"?o.jsxs("strong",{children:[o.jsx(p3,{}),"飞书机器人 Runtime 已创建"]}):null,E==="cancelled"?o.jsx("strong",{children:"部署已取消"}):null,E==="failed"?o.jsx("strong",{children:"创建失败"}):null]}),E==="preparing"||E==="running"||E==="cancelling"?o.jsx("ol",{className:"feishu-deployment-steps",children:rH.map((W,q)=>{const ue=E==="running"&&qW.value===(C.region||u)))==null?void 0:V.label)||C.region}),C.consoleUrl?o.jsxs("a",{href:C.consoleUrl,target:"_blank",rel:"noreferrer",children:["打开 Runtime 控制台",o.jsx(TNe,{})]}):null]}):null]}):null,o.jsxs("div",{className:"feishu-form-actions",children:[o.jsxs("div",{className:"feishu-secrets-note",children:[o.jsx("strong",{children:"凭据处理"}),o.jsx("span",{children:"App Secret 仅用于本次部署,不会写入生成源码或浏览器存储。"})]}),o.jsxs("div",{className:"feishu-action-buttons",children:[E==="running"?o.jsx("button",{type:"button",className:"feishu-cancel",onClick:()=>void J(),children:"取消部署"}):null,o.jsx("button",{type:"submit",className:"feishu-submit",disabled:!te,children:P?"正在创建…":"创建飞书机器人 Runtime"})]})]})]})]})})]})}async function n2(e,t,n,s=uc){var r;const i=await CB(e,{...t,headers:{accept:"application/json",...t.headers},signal:n},s);if(!i.ok){let a="";try{a=((r=(await i.json()).detail)==null?void 0:r.trim())||""}catch{}throw new Error(a||`请求失败 (${i.status})`)}return i.json()}function CNe(e){return n2("/web/coding-agents/capabilities",{method:"GET"},e,Ok)}function INe(e,t){return n2(`/web/coding-agents/skills/${encodeURIComponent(e)}/preview`,{method:"GET"},t)}function jNe(e,t){return n2("/web/coding-agents/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)},t)}const RNe="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='16'%20height='16'%20rx='3.692'%20fill='%231A1B1D'/%3e%3cpath%20d='M13.235%205.829V4.332H2.758v5.987h1.496v1.496h8.981V5.828Zm-1.497%204.49H4.254V5.83h7.484v4.49Z'%20fill='%2332F08C'/%3e%3cpath%20d='M6.937%206.993%205.88%208.051%206.937%209.11%207.995%208.05%206.937%206.993ZM9.931%206.992%208.873%208.05%209.931%209.11%2010.99%208.05%209.93%206.992Z'%20fill='%2332F08C'/%3e%3c/svg%3e";function ONe(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m4 4 8 8m0-8-8 8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function m3(){return o.jsxs("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[o.jsx("path",{d:"M4 1.8h5l3 3V14H4z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),o.jsx("path",{d:"M9 1.8V5h3M6 8h4M6 10.5h4",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function g3(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"M1.8 4.5h4l1.2-1.3h2.2l1.2 1.3h3.8v8H1.8z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function MNe(e){return e instanceof DOMException&&e.name==="AbortError"}function LNe(e){return e instanceof Error&&e.message?e.message:"读取 Skill 文件失败"}function DNe(e){return e<1024?`${e} B`:`${(e/1024).toFixed(e<10*1024?1:0)} KB`}function PNe(e){const t=e.split("/");return t[t.length-1]??e}function BNe(e){const t=new Map;for(const n of e){const s=n.path.split("/"),i=s.length>1?s.slice(0,-1).join("/"):"";t.set(i,[...t.get(i)??[],n])}return Array.from(t,([n,s])=>({directory:n,files:s})).sort((n,s)=>n.directory?s.directory?n.directory.localeCompare(s.directory):1:-1)}function UNe({skill:e,onClose:t}){const n=g.useRef(null),s=g.useRef(null),i=g.useId(),r=g.useId(),[a,l]=g.useState(null),[c,u]=g.useState(""),[d,f]=g.useState(!0),[h,p]=g.useState(""),[m,b]=g.useState(0);g.useEffect(()=>{s.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const x=n.current;return x&&!x.open&&x.showModal(),()=>{var E;x!=null&&x.open&&x.close(),(E=s.current)==null||E.focus()}},[]),g.useEffect(()=>{const x=new AbortController;return f(!0),p(""),l(null),u(""),INe(e.id,x.signal).then(E=>{if(x.signal.aborted)return;l(E);const w=E.files.find(_=>_.path==="SKILL.md")??E.files[0];u((w==null?void 0:w.path)??"")}).catch(E=>{!x.signal.aborted&&!MNe(E)&&p(LNe(E))}).finally(()=>{x.signal.aborted||f(!1)}),()=>x.abort()},[m,e.id]);const v=g.useMemo(()=>BNe((a==null?void 0:a.files)??[]),[a]),y=(a==null?void 0:a.files.find(x=>x.path===c))??null;return o.jsxs("dialog",{ref:n,className:"coding-agents-preview-dialog","aria-labelledby":i,"aria-describedby":r,onCancel:x=>{x.preventDefault(),t()},onMouseDown:x=>{const E=x.currentTarget.getBoundingClientRect();(x.clientXE.right||x.clientYE.bottom)&&t()},children:[o.jsxs("header",{className:"coding-agents-preview-header",children:[o.jsx("span",{className:"coding-agents-preview-mark",children:o.jsx(g3,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:i,children:e.name}),o.jsx("p",{id:r,children:"只读浏览随 Studio 提供的 Skill 文件"})]}),o.jsx("button",{type:"button",autoFocus:!0,"aria-label":"关闭文件预览",onClick:t,children:o.jsx(ONe,{})})]}),d?o.jsxs("div",{className:"coding-agents-preview-state",children:[o.jsx("i",{}),"正在读取文件…"]}):h?o.jsxs("div",{className:"coding-agents-preview-state is-error",role:"alert",children:[o.jsx("span",{children:h}),o.jsx("button",{type:"button",onClick:()=>b(x=>x+1),children:"重试"})]}):o.jsxs("div",{className:"coding-agents-preview-layout",children:[o.jsxs("nav",{className:"coding-agents-preview-tree","aria-label":`${e.name} 文件`,children:[o.jsxs("div",{className:"coding-agents-preview-tree-title",children:[o.jsx("span",{children:"文件"}),o.jsx("small",{children:(a==null?void 0:a.files.length)??0})]}),o.jsx("div",{className:"coding-agents-preview-tree-scroll",children:v.map(x=>x.directory?o.jsxs("details",{open:!0,children:[o.jsxs("summary",{children:[o.jsx(g3,{}),o.jsx("span",{children:x.directory})]}),o.jsx("div",{children:x.files.map(E=>o.jsxs("button",{type:"button",className:c===E.path?"is-selected":"","aria-current":c===E.path?"true":void 0,onClick:()=>u(E.path),children:[o.jsx(m3,{}),o.jsx("span",{children:PNe(E.path)})]},E.path))})]},x.directory):x.files.map(E=>o.jsxs("button",{type:"button",className:c===E.path?"is-selected":"","aria-current":c===E.path?"true":void 0,onClick:()=>u(E.path),children:[o.jsx(m3,{}),o.jsx("span",{children:E.path})]},E.path)))})]}),o.jsx("section",{className:"coding-agents-preview-file","aria-label":"文件内容",children:y?o.jsxs(o.Fragment,{children:[o.jsxs("header",{children:[o.jsx("strong",{children:y.path}),o.jsx("span",{children:DNe(y.size)})]}),y.previewable&&y.content!==null?o.jsx("pre",{tabIndex:0,children:o.jsx("code",{children:y.content})}):o.jsx("div",{className:"coding-agents-preview-unavailable",children:"此文件不是可预览的 UTF-8 文本。"})]}):o.jsx("div",{className:"coding-agents-preview-unavailable",children:"没有可预览的文件。"})})]})]})}function FNe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function $Ne(e){return o.jsxs("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"16",height:"16",rx:"4.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"m8.5 11-2.4 2.4 2.4 2.4M11 16.5h3.8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("circle",{cx:"24.5",cy:"10.5",r:"2.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("circle",{cx:"24.5",cy:"24.5",r:"2.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"M19.5 10.5H22M18.2 19l4.3 3.7M24.5 13v9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function HNe(e){return o.jsx("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:o.jsxs("g",{stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",children:[o.jsx("path",{d:"M16 4.5v7M16 20.5v7"}),o.jsx("path",{d:"m9.3 6.3 3.5 6.1M19.2 19.6l3.5 6.1"}),o.jsx("path",{d:"m5.9 11.1 6.2 3.5M19.9 17.4l6.2 3.5"}),o.jsx("path",{d:"M4.7 16h7M20.3 16h7"}),o.jsx("path",{d:"m5.9 20.9 6.2-3.5M19.9 14.6l6.2-3.5"}),o.jsx("path",{d:"m9.3 25.7 3.5-6.1M19.2 12.4l3.5-6.1"})]})})}function zNe(e){return o.jsxs("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M15.8 4.2c2.4 0 4.5 1.2 5.7 3.1 2.2-.3 4.5.8 5.6 2.9 1.1 2 .8 4.4-.5 6.1 1.2 1.8 1.3 4.3.1 6.2-1.2 2-3.4 3-5.6 2.6-1.3 1.8-3.5 2.9-5.8 2.7-2.2-.2-4.1-1.5-5.1-3.4-2.2.1-4.4-1-5.4-3.1-1-2-.6-4.4.8-6.1-1.1-1.9-1.1-4.3.2-6.1 1.3-1.9 3.6-2.7 5.7-2.2 1.1-1.7 2.6-2.7 4.3-2.7Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),o.jsx("path",{d:"m10.7 12.2 3.1 3.8-3.1 3.8M17.1 20h4.3",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function b3(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m3.4 8.2 3 3L12.8 5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function VNe(e){return o.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M2.8 6.3h14.4v8.3a1.6 1.6 0 0 1-1.6 1.6H4.4a1.6 1.6 0 0 1-1.6-1.6V6.3Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"}),o.jsx("path",{d:"M2.8 6.3V5.1a1.4 1.4 0 0 1 1.4-1.4h3.4l1.5 1.6h6.5a1.6 1.6 0 0 1 1.6 1.6",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"})]})}function GNe({agentId:e}){return e==="trae"?o.jsx("img",{src:RNe,alt:"","aria-hidden":"true"}):e==="claude-code"?o.jsx(HNe,{}):o.jsx(zNe,{})}function y3(e){return e instanceof DOMException&&e.name==="AbortError"}function x3(e,t){return e instanceof Error&&e.message?e.message:t}function KNe({onBack:e}){var I;const[t,n]=g.useState(null),[s,i]=g.useState(!0),[r,a]=g.useState(""),[l,c]=g.useState(0),[u,d]=g.useState(new Set),[f,h]=g.useState(new Set),[p,m]=g.useState(null),[b,v]=g.useState(!1),[y,x]=g.useState(null),E=g.useRef(null);g.useEffect(()=>{const j=new AbortController;return i(!0),a(""),CNe(j.signal).then(L=>{if(j.signal.aborted)return;n(L);const z=L.agents.filter(D=>D.available);d(D=>{const F=z.filter(A=>D.has(A.id));return new Set((F.length?F:z.slice(0,1)).map(A=>A.id))}),h(D=>{const F=L.skills.filter(A=>D.has(A.id));return new Set((F.length?F:L.skills).map(A=>A.id))})}).catch(L=>{!y3(L)&&!j.signal.aborted&&(n(null),a(x3(L,"检测本机客户端失败")))}).finally(()=>{j.signal.aborted||i(!1)}),()=>j.abort()},[l]),g.useEffect(()=>()=>{var j;return(j=E.current)==null?void 0:j.abort()},[]);const w=g.useMemo(()=>(t==null?void 0:t.agents.filter(j=>j.available&&u.has(j.id)))||[],[t,u]),_=g.useMemo(()=>(t==null?void 0:t.skills.filter(j=>f.has(j.id)))||[],[t,f]),S=!!(!b&&w.length&&_.length),k=(j,L)=>{!L||b||(x(null),d(z=>{const D=new Set(z);return D.has(j)?D.delete(j):D.add(j),D}))},T=j=>{b||(x(null),h(L=>{const z=new Set(L);return z.has(j)?z.delete(j):z.add(j),z}))},C=async()=>{var L;if(!S)return;(L=E.current)==null||L.abort();const j=new AbortController;E.current=j,v(!0),x(null);try{const z=await jNe({agents:w.map(F=>F.id),skills:_.map(F=>F.id)},j.signal);if(j.signal.aborted)return;const D=z.installations;x({tone:"success",message:`已为 ${w.length} 个客户端配置 ${_.length} 个 Skill`,details:D.map(F=>`${F.agentName} · ${F.skill} → ${F.displayPath}`)})}catch(z){!y3(z)&&!j.signal.aborted&&x({tone:"error",message:x3(z,"配置失败,请检查用户目录权限后重试")})}finally{E.current===j&&(E.current=null),j.signal.aborted||v(!1)}};return o.jsxs("section",{className:"coding-agents-page",children:[o.jsxs("header",{className:"coding-agents-header",children:[o.jsx("button",{type:"button",className:"coding-agents-back",onClick:e,disabled:b,"aria-label":"返回自动化列表",children:o.jsx(FNe,{})}),o.jsx($Ne,{className:"coding-agents-logo"}),o.jsxs("div",{children:[o.jsx("h1",{children:"配置 Coding Agents"}),o.jsx("p",{children:"把随 Studio 提供的 AgentKit Skills 全局安装到本地编码客户端。"})]})]}),o.jsx("div",{className:"coding-agents-scroll",children:o.jsxs("div",{className:"coding-agents-content",children:[o.jsxs("section",{className:"coding-agents-section","aria-label":"选择 Coding Agent",children:[o.jsxs("div",{className:"coding-agents-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"1"}),o.jsx("h2",{children:"本机客户端"})]}),o.jsx("button",{type:"button",onClick:()=>c(j=>j+1),disabled:s||b,children:"重新检测"})]}),s?o.jsxs("div",{className:"coding-agents-inline-state",children:[o.jsx("i",{}),"正在检测本机客户端…"]}):r?o.jsxs("div",{className:"coding-agents-error-row",role:"alert",children:[o.jsx("span",{children:r}),o.jsx("button",{type:"button",onClick:()=>c(j=>j+1),children:"重试"})]}):o.jsx("div",{className:"coding-agents-agent-grid",children:t==null?void 0:t.agents.map(j=>o.jsxs("button",{type:"button",className:`coding-agents-agent ${u.has(j.id)?"is-selected":""}`,"aria-pressed":u.has(j.id),disabled:!j.available||b,onClick:()=>k(j.id,j.available),title:j.available?j.name:j.reason,children:[o.jsx("span",{className:`coding-agents-agent-mark is-${j.id}`,children:o.jsx(GNe,{agentId:j.id})}),o.jsxs("span",{className:"coding-agents-agent-copy",children:[o.jsx("strong",{children:j.name}),o.jsx("small",{children:j.available?j.version||"已检测到客户端":j.reason})]}),o.jsx("span",{className:`coding-agents-status ${j.available?"is-ready":""}`,children:j.available?"可用":"未检测到"}),o.jsx("span",{className:"coding-agents-check",children:o.jsx(b3,{})})]},j.id))})]}),o.jsxs("section",{className:"coding-agents-section","aria-label":"选择内置 Skill",children:[o.jsx("div",{className:"coding-agents-section-heading",children:o.jsxs("div",{children:[o.jsx("span",{children:"2"}),o.jsx("h2",{children:"内置 Skills"})]})}),o.jsx("div",{className:"coding-agents-skill-list",children:t==null?void 0:t.skills.map(j=>o.jsxs("div",{className:`coding-agents-skill ${f.has(j.id)?"is-selected":""}`,children:[o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:f.has(j.id),onChange:()=>T(j.id),disabled:b}),o.jsx("span",{className:"coding-agents-skill-check","aria-hidden":"true",children:o.jsx(b3,{})}),o.jsxs("span",{children:[o.jsx("strong",{children:j.name}),o.jsx("small",{children:j.description})]})]}),o.jsx("button",{type:"button",onClick:()=>m(j),children:"查看文件"})]},j.id))}),o.jsxs("div",{className:"coding-agents-global","aria-label":"全局安装目录",children:[o.jsxs("div",{className:"coding-agents-global-heading",children:[o.jsx(VNe,{}),o.jsxs("div",{children:[o.jsx("strong",{children:"全局安装"}),o.jsx("span",{children:"配置后可在本机其他项目中使用"})]})]}),w.length?o.jsx("dl",{children:w.map(j=>o.jsxs("div",{children:[o.jsx("dt",{children:j.name}),o.jsx("dd",{children:j.globalSkillsPath})]},j.id))}):o.jsx("p",{children:"选择客户端后显示对应安装目录。"})]})]}),y?o.jsxs("div",{className:`coding-agents-result is-${y.tone}`,role:y.tone==="error"?"alert":"status",children:[o.jsx("strong",{children:y.message}),(I=y.details)!=null&&I.length?o.jsx("ul",{children:y.details.map(j=>o.jsx("li",{children:j},j))}):null]}):null,o.jsxs("div",{className:"coding-agents-actions",children:[o.jsx("span",{children:w.length?`已选择 ${w.length} 个客户端、${_.length} 个 Skill`:"请先选择客户端"}),o.jsx("button",{type:"button",onClick:()=>void C(),disabled:!S,children:b?"正在配置…":"配置"})]})]})}),p?o.jsx(UNe,{skill:p,onClose:()=>m(null)}):null]})}const qNe={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 YNe(e,t){if(!t||t==="/")return e;const n=t.replace(/^\//,"").split("/").map(i=>i.replace(/~1/g,"/").replace(/~0/g,"~"));let s=e;for(const i of n){if(s==null||typeof s!="object")return;s=s[i]}return s}function WNe(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function XNe(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function s2(e,t){if(WNe(e))return YNe(t,e.path);if(XNe(e)){const n=qNe[e.call],s={};for(const[i,r]of Object.entries(e.args??{}))s[i]=s2(r,t);return n?n(s):`[unknown fn: ${e.call}]`}return e}function QNe(e,t){const n=s2(e,t);return n==null?"":typeof n=="string"?n:String(n)}const aH=new Map;function Iu(e,t){aH.set(e,t)}function ZNe(e){return aH.get(e)}function JNe(e,t,n){const s=t.replace(/^\//,"").split("/").map(r=>r.replace(/~1/g,"/").replace(/~0/g,"~"));let i=e;for(let r=0;rs2(s,e.dataModel),resolveString:s=>QNe(s,e.dataModel),dispatchAction:t,render:s=>{if(!s)return null;const i=e.components[s];if(!i)return null;const r=ZNe(i.component)??eTe;return o.jsx(r,{node:i,ctx:n},s)}};return o.jsx("div",{className:"a2ui-surface","data-a2ui-surface":e.surfaceId,children:n.render(e.rootId)})}function nTe(e){const t=g.useRef(null),n=g.useRef(!0),s=28,i=g.useCallback(()=>{const r=t.current;r&&(n.current=r.scrollHeight-r.scrollTop-r.clientHeight{const r=t.current;r&&n.current&&(r.scrollTop=r.scrollHeight)},[e]),{ref:t,onScroll:i}}function H1({value:e,skillPrefix:t="/",onRemoveSkill:n,onRemoveAgent:s}){return e.skills.length===0&&!e.targetAgent?null:o.jsxs("div",{className:"invocation-chips","aria-label":"本轮调用上下文",children:[e.skills.map(i=>o.jsxs("span",{className:"invocation-chip invocation-chip--skill",title:i.description,children:[o.jsx(ou,{"aria-hidden":!0}),o.jsxs("span",{children:[t,i.name]}),n?o.jsx("button",{type:"button",onClick:()=>n(i.name),"aria-label":`移除技能 ${i.name}`,children:o.jsx(Ti,{})}):null]},i.name)),e.targetAgent?o.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[o.jsx(gB,{"aria-hidden":!0}),o.jsx("span",{children:e.targetAgent.name}),s?o.jsx("button",{type:"button",onClick:s,"aria-label":`移除 Agent ${e.targetAgent.name}`,children:o.jsx(Ti,{})}):null]}):null]})}function i2(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function lH(e){var n,s,i,r;const t=i2(e.mimeType);return t==="pdf"?"PDF":t==="markdown"?"MD":t==="video"?((s=(n=e.mimeType)==null?void 0:n.split("/")[1])==null?void 0:s.toUpperCase())??"VIDEO":t==="image"?((r=(i=e.mimeType)==null?void 0:i.split("/")[1])==null?void 0:r.toUpperCase())??"IMAGE":"TXT"}function cH(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function uH(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?YB(t,e.uri):""}function sTe({kind:e}){return e==="image"?o.jsx(jk,{}):e==="video"?o.jsx(yB,{}):e==="pdf"?o.jsx(aee,{}):o.jsx(Ck,{})}function z1({appName:e,items:t,compact:n=!1,onRemove:s}){const[i,r]=g.useState(null);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(a=>{const l=i2(a.mimeType),c=uH(a,e),u=a.status==="uploading"||a.status==="error"||!c,d=o.jsxs("button",{type:"button",className:"media-card-main",disabled:u,onClick:l==="image"?void 0:()=>r(a),"aria-label":`预览 ${a.name??"附件"}`,children:[l==="image"&&c?o.jsx("img",{className:"media-card-image",src:c,alt:a.name??"图片",loading:"lazy"}):l==="video"&&c?o.jsxs("div",{className:"media-card-video-container",children:[o.jsx("video",{className:"media-card-video",src:c,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}),o.jsx("span",{className:"media-card-video-play",children:o.jsx(kee,{})})]}):o.jsx("span",{className:"media-card-icon",children:o.jsx(sTe,{kind:l})}),o.jsxs("span",{className:"media-card-copy",children:[o.jsx("span",{className:"media-card-name",children:a.name??"附件"}),o.jsxs("span",{className:"media-card-meta",children:[o.jsx("span",{className:"media-card-type",children:lH(a)}),a.status==="uploading"?o.jsxs(o.Fragment,{children:[o.jsx(dn,{className:"media-card-spinner"})," 上传中"]}):a.status==="error"?a.error??"上传失败":cH(a.sizeBytes)]})]}),!n&&a.status!=="uploading"&&a.status!=="error"?o.jsx(Yc,{className:"media-card-open"}):null]});return o.jsxs(Jn.div,{className:`media-card media-card--${l}${a.status==="error"?" media-card--error":""}`,layout:!0,initial:{opacity:0,scale:.985,y:4},animate:{opacity:1,scale:1,y:0},children:[l==="image"&&!u?o.jsx(fB,{src:c,children:d}):d,s?o.jsx("button",{type:"button",className:"media-card-remove","aria-label":`移除 ${a.name??"附件"}`,onClick:()=>s(a.id),children:o.jsx(Ti,{})}):null]},a.id)})}),o.jsx(Po,{children:i?o.jsx(iTe,{appName:e,item:i,onClose:()=>r(null)}):null})]})}function iTe({appName:e,item:t,onClose:n}){const s=g.useMemo(()=>uH(t,e),[e,t]),i=i2(t.mimeType),[r,a]=g.useState(""),[l,c]=g.useState(i==="text"||i==="markdown"),[u,d]=g.useState("");return g.useEffect(()=>{const f=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),g.useEffect(()=>{if(i!=="text"&&i!=="markdown")return;const f=new AbortController;return c(!0),d(""),fetch(s,{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||c(!1)}),()=>f.abort()},[i,s]),o.jsx(Jn.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:o.jsxs(Jn.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:[o.jsxs("header",{className:"media-viewer-header",children:[o.jsxs("div",{children:[o.jsx("strong",{children:t.name??"附件"}),o.jsxs("span",{children:[lH(t),t.sizeBytes?` · ${cH(t.sizeBytes)}`:""]})]}),o.jsxs("nav",{children:[o.jsx("a",{href:s,download:t.name,"aria-label":"下载",children:o.jsx(t1,{})}),o.jsx("button",{type:"button",onClick:n,"aria-label":"关闭",children:o.jsx(Ti,{})})]})]}),o.jsxs("div",{className:`media-viewer-body media-viewer-body--${i}`,children:[i==="image"?o.jsx("img",{src:s,alt:t.name??"图片"}):null,i==="video"?o.jsx("div",{className:"media-viewer-video-wrapper",children:o.jsx("video",{src:s,controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",className:"media-viewer-video"})}):null,i==="pdf"?o.jsx("iframe",{src:s,title:t.name??"PDF"}):null,l?o.jsxs("div",{className:"media-viewer-loading",children:[o.jsx(dn,{})," 正在读取文档…"]}):null,!l&&u?o.jsxs("div",{className:"media-viewer-loading",children:["文档加载失败:",u]}):null,!l&&i==="markdown"?o.jsx("div",{className:"media-document",children:o.jsx(oh,{text:r})}):null,!l&&i==="text"?o.jsx("pre",{className:"media-document media-document--plain",children:r}):null]})]})})}function rTe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.25",cy:"10.25",r:"6.25"}),o.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 aTe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.25",y:"5.25",width:"15.5",height:"13.5",rx:"2.25"}),o.jsx("circle",{cx:"8.1",cy:"9.3",r:"1.35"}),o.jsx("path",{d:"m4.7 16.5 3.65-3.7 2.45 2.25 2.2-2.2 4.35 4.1"}),o.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 dH(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.25",y:"5.25",width:"17.5",height:"13.5",rx:"2.4"}),o.jsx("path",{d:"M3.25 9h17.5M6.75 5.25 9.3 9M12 5.25 14.55 9M17.25 5.25 19.8 9"}),o.jsx("path",{d:"m10.25 11.45 4 2.55-4 2.55v-5.1Z"})]})}function oTe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 5.25h15.5v10.5H4.25zM8.25 19.75h7.5M12 15.75v4"}),o.jsx("path",{d:"m7.25 12.75 2.35-2.4 2.15 1.65 3.4-3.6 1.6 1.55"}),o.jsx("circle",{cx:"7.25",cy:"8.4",r:".7",fill:"currentColor",stroke:"none"})]})}function lTe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.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"}),o.jsx("path",{d:"M8.2 12.25h.01M8.2 16.8h.01"})]})}function cTe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 4.25h4.5v15.5h-4.5zM8.75 5.75h5v14h-5zM13.75 4.25h4.1v10.25h-4.1z"}),o.jsx("path",{d:"M5.75 7h1.5M10.25 8.25h2M10.25 11h2M15.15 7h1.3"}),o.jsx("circle",{cx:"17.45",cy:"17.35",r:"2.45"}),o.jsx("path",{d:"m19.25 19.15 1.55 1.55"})]})}function uTe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 6.25h6.25c1 0 1.5.55 1.5 1.45v11.05c0-.9-.5-1.45-1.5-1.45H4.25V6.25Z"}),o.jsx("path",{d:"M19.75 9.1v8.2H13.5c-1 0-1.5.55-1.5 1.45V7.7c0-.9.5-1.45 1.5-1.45h2.15"}),o.jsx("path",{d:"m19 3.2.58 1.62 1.62.58-1.62.58L19 7.6l-.58-1.62-1.62-.58 1.62-.58L19 3.2Z",fill:"currentColor",stroke:"none"})]})}function dTe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"m4.2 8.4 1.15 10.2h13.3L19.8 8.4"}),o.jsx("path",{d:"M4.2 8.4h15.6L17.9 5H6.1L4.2 8.4Z"}),o.jsx("path",{d:"M7.2 12.2c1.1-1 2.25 1.25 3.4.25 1.05-.9 2.15 1.3 3.3.25"}),o.jsx("path",{d:"m8.2 15.1 1.45 1.35 1.45-1.35M13.55 16.45h2.35"})]})}function fH(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6 3.25 4.5 4.75L6 12.75"})})}function fTe({definition:e,label:t,done:n,open:s,onToggle:i}){const r=e.icon,a=t??(n?e.doneLabel:e.runningLabel);return o.jsxs("button",{type:"button",className:`builtin-tool-head${n?" is-done":" is-running"}`,"data-tool-tone":e.tone,onClick:i,"aria-expanded":s,children:[o.jsx("span",{className:"builtin-tool-icon","aria-hidden":"true",children:o.jsx(r,{})}),n?o.jsx("span",{className:"builtin-tool-label",children:a}):o.jsx(Ta,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:a}),o.jsx(fH,{className:`builtin-tool-chevron${s?" is-open":""}`})]})}const hTe={web_search:{name:"web_search",runningLabel:"正在进行网络搜索",doneLabel:"已完成网络搜索",tone:"search",icon:rTe},run_code:{name:"run_code",runningLabel:"正在 AgentKit 沙箱中执行代码",doneLabel:"已在 AgentKit 沙箱中完成代码执行",tone:"sandbox",icon:dTe},image_generate:{name:"image_generate",runningLabel:"正在生成图片",doneLabel:"已完成图片生成",tone:"image",icon:aTe},video_generate:{name:"video_generate",runningLabel:"正在生成视频",doneLabel:"已完成视频生成",tone:"video",icon:dH},ppt_generate:{name:"ppt_generate",runningLabel:"正在生成 PPT",doneLabel:"已完成 PPT 生成",tone:"presentation",icon:oTe},load_memory:{name:"load_memory",runningLabel:"正在检索长期记忆",doneLabel:"已完成记忆检索",tone:"memory",icon:lTe},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"正在检索知识库",doneLabel:"已完成知识库检索",tone:"knowledge",icon:cTe},load_skill:{name:"load_skill",runningLabel:"正在加载技能",doneLabel:"已加载技能",tone:"skill",icon:uTe}};function pTe(e){return hTe[e]}const hH="send_a2ui_json_to_client",mTe=28;function gTe(e,t,n){let s=t;for(let i=0;i65535?2:1}return s}function bTe(e){return e<=4?1:Math.min(18,Math.max(2,Math.ceil(e/6)))}function pH(e,t,n){const[s,i]=g.useState(()=>t?"":e),r=g.useRef(s),a=g.useRef(e),l=g.useRef(null),c=g.useRef(0),u=g.useRef(n);return a.current=e,u.current=n,g.useEffect(()=>{const d=r.current,f=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(!t||f||!e.startsWith(d)){l.current!==null&&window.cancelAnimationFrame(l.current),l.current=null,d!==e&&(r.current=e,i(e));return}if(d===e||l.current!==null)return;const h=p=>{const m=a.current,b=r.current;if(!m.startsWith(b)){r.current=m,i(m),l.current=null;return}if(p-c.current{var d;(d=u.current)==null||d.call(u)},[s]),g.useEffect(()=>()=>{l.current!==null&&(window.cancelAnimationFrame(l.current),l.current=null)},[]),s}function yTe({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:o.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 xTe(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o.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 ETe(e,t){if(e!=="load_skill"||t==null||typeof t!="object"||Array.isArray(t))return;const n=t.skill_name;if(!(typeof n!="string"||!n.trim()))return`使用 ${n.trim()} 技能`}function mH({text:e,done:t,answerStarted:n=!1,streaming:s=!1,onStreamFrame:i}){const[r,a]=g.useState(!(t||n)),l=g.useRef(!1);g.useEffect(()=>{l.current||a(!(t||n))},[n,t]);const c=()=>{l.current=!0,a(p=>!p)},u=e.replace(/^\s+/,""),d=pH(u,!t||s,i),{ref:f,onScroll:h}=nTe(d);return o.jsxs("div",{className:"block-thinking",children:[o.jsxs("button",{className:"think-head",onClick:c,type:"button",children:[o.jsx("span",{className:"think-icon","aria-hidden":"true",children:o.jsx(yTe,{className:`spark ${t?"":"pulse"}`})}),t?o.jsx("span",{className:"think-label think-label--done",children:"已完成思考"}):o.jsx(Ta,{className:"think-label",duration:2.4,spread:18,children:"思考中"}),o.jsx(nc,{className:`chev ${r?"open":""}`})]}),o.jsx("div",{className:`think-collapse ${r&&d?"open":""}`,children:o.jsx("div",{className:"think-collapse-inner",children:o.jsx("div",{className:"think-body scroll",ref:f,onScroll:h,children:d})})})]})}function gH(){return o.jsx(mH,{text:"",done:!1})}const vTe=g.memo(function({text:t,streaming:n,onStreamFrame:s}){const i=pH(t,n,s);return i?o.jsx("div",{className:"bubble",children:o.jsx(oh,{text:i})}):null});function wTe({name:e,args:t,response:n,done:s}){const[i,r]=g.useState(!1),a=e===hH?"渲染 UI":e,l=pTe(e),c=n==null?null:typeof n=="string"?n:JSON.stringify(n,null,2),u=c&&c.length>2e3?c.slice(0,2e3)+` +…(已截断)`:c;return o.jsxs(Jn.div,{className:`block-tool${l?" block-tool--builtin":""}`,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[l?o.jsx(fTe,{definition:l,label:ETe(e,t),done:s,open:i,onToggle:()=>r(d=>!d)}):o.jsxs("button",{className:"tool-head tool-head--generic",onClick:()=>r(d=>!d),type:"button","aria-expanded":i,children:[o.jsx("span",{className:"tool-icon tool-icon--generic","aria-hidden":"true",children:o.jsx(xTe,{})}),s?o.jsx("span",{className:"tool-name",children:a}):o.jsx(Ta,{className:"tool-name",duration:2.2,spread:15,children:a}),o.jsx(fH,{className:`tool-chevron${i?" is-open":""}`})]}),o.jsx("div",{className:`think-collapse ${i?"open":""}`,children:o.jsx("div",{className:"think-collapse-inner",children:o.jsxs("div",{className:"tool-detail",children:[t!=null&&o.jsxs("div",{className:"tool-section",children:[o.jsx("div",{className:"tool-section-label",children:"参数"}),o.jsx("pre",{className:"tool-args",children:JSON.stringify(t,null,2)})]}),u!=null&&o.jsxs("div",{className:"tool-section",children:[o.jsx("div",{className:"tool-section-label",children:"返回"}),o.jsx("pre",{className:"tool-args tool-result",children:u})]})]})})})]})}function STe({block:e,onDownload:t,onPreview:n}){const[s,i]=g.useState(""),[r,a]=g.useState(""),[l,c]=g.useState(null);g.useEffect(()=>()=>{l&&URL.revokeObjectURL(l.url)},[l]);const u=()=>c(null),d=async(p,m)=>{if(t){i(`download:${p}`),a("");try{await t(p,m)}catch(b){a(b instanceof Error?b.message:String(b))}finally{i("")}}},f=async(p,m,b)=>{if(n){i(`preview:${b}`),a("");try{const v=await n(p,m);c({name:b,url:v})}catch(v){a(v instanceof Error?v.message:String(v))}finally{i("")}}},h=e.files.filter(p=>!p.filename.endsWith(".preview.webp"));return o.jsxs("div",{className:"artifact-list",children:[h.map(p=>{const m=`${p.filename.replace(/\.pptx$/i,"")}.preview.webp`,b=e.files.find(v=>v.filename===m);return o.jsxs("div",{className:"artifact-card",children:[o.jsx("span",{className:"artifact-card__icon","aria-hidden":"true",children:o.jsx(Ck,{})}),o.jsxs("span",{className:"artifact-card__copy",children:[o.jsx("span",{className:"artifact-card__name",children:p.filename}),o.jsx("span",{className:"artifact-card__hint",children:"PowerPoint 演示文稿"})]}),o.jsxs("span",{className:"artifact-card__actions",children:[b&&o.jsxs("button",{className:"artifact-card__action",type:"button",disabled:!n||s!=="",onClick:()=>void f(b.filename,b.version,p.filename),children:[s===`preview:${p.filename}`?o.jsx(dn,{className:"spin"}):o.jsx(see,{}),"预览"]}),o.jsxs("button",{className:"artifact-card__action artifact-card__action--primary",type:"button",disabled:!t||s!=="",onClick:()=>void d(p.filename,p.version),children:[s===`download:${p.filename}`?o.jsx(dn,{className:"spin"}):o.jsx(t1,{}),"下载"]})]})]},`${p.filename}:${p.version}`)}),r&&o.jsx("div",{className:"artifact-card__error",children:r}),l&&o.jsxs("div",{className:"artifact-preview",role:"dialog","aria-modal":"true","aria-label":`${l.name} 预览`,children:[o.jsx("button",{className:"artifact-preview__backdrop",type:"button","aria-label":"关闭预览",onClick:u}),o.jsxs("div",{className:"artifact-preview__panel",children:[o.jsxs("div",{className:"artifact-preview__header",children:[o.jsx("span",{children:l.name}),o.jsx("button",{type:"button","aria-label":"关闭预览",onClick:u,children:o.jsx(Ti,{})})]}),o.jsx("div",{className:"artifact-preview__canvas",children:o.jsx("img",{src:l.url,alt:`${l.name} 幻灯片预览`})})]})]})]})}function _Te({block:e,onAuth:t}){const[n,s]=g.useState(e.done?"done":"idle"),[i,r]=g.useState(""),a=e.label||"MCP 工具集",l=(()=>{try{return e.authUri?new URL(e.authUri).host:""}catch{return""}})(),c=async()=>{if(t){r(""),s("authorizing");try{await t(e),s("done")}catch(d){r(d instanceof Error?d.message:String(d)),s("idle")}}};return e.done||n==="done"?o.jsxs(Jn.div,{className:"auth-card-collapsed",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},children:[o.jsx(SR,{className:"auth-card-icon auth-card-icon--done"}),o.jsxs("span",{children:["已授权 · ",a]})]}):o.jsxs(Jn.div,{className:"auth-card",initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[o.jsxs("div",{className:"auth-card-head",children:[o.jsx(SR,{className:"auth-card-icon"}),o.jsxs("span",{className:"auth-card-title",children:[a," 需要授权"]})]}),o.jsxs("p",{className:"auth-card-desc",children:["工具集 ",o.jsx("code",{className:"auth-card-code",children:a})," 使用 OAuth 保护, 需登录授权后方可调用。",l&&o.jsxs(o.Fragment,{children:[" ","将跳转至 ",o.jsx("code",{className:"auth-card-code",children:l})," 完成登录,"]}),"授权完成后对话自动继续。"]}),o.jsx("button",{className:"auth-card-btn",onClick:c,disabled:n==="authorizing"||!e.authUri,children:n==="authorizing"?o.jsxs(o.Fragment,{children:[o.jsx(dn,{className:"cw-i spin"})," 等待授权…"]}):o.jsx(o.Fragment,{children:"去授权"})}),!e.authUri&&o.jsx("div",{className:"auth-card-err",children:"未在事件中找到授权地址。"}),i&&o.jsx("div",{className:"auth-card-err",children:i})]})}function r2({blocks:e,appName:t="",streaming:n=!1,onStreamFrame:s,onAction:i,onAuth:r,onArtifactDownload:a,onArtifactPreview:l}){return o.jsx(o.Fragment,{children:e.map((c,u)=>{switch(c.kind){case"thinking":{const d=e.slice(u+1).some(f=>f.kind==="text"&&!!f.text.trim());return o.jsx(mH,{text:c.text,done:c.done,answerStarted:d,streaming:n,onStreamFrame:s},u)}case"text":{const d=c.text.replace(/^\s+/,"");return d?o.jsx(vTe,{text:d,streaming:n,onStreamFrame:s},u):null}case"attachment":return o.jsx(z1,{appName:t,items:c.files},u);case"artifact":return o.jsx(STe,{block:c,onDownload:a,onPreview:l},u);case"invocation":return o.jsx(H1,{value:c.value},u);case"tool":return c.name===hH&&c.done?null:o.jsx(wTe,{name:c.name,args:c.args,response:c.response,done:c.done},u);case"agent-transfer":return null;case"auth":return o.jsx(_Te,{block:c,onAuth:r},u);case"a2ui":return oH(c.messages).filter(d=>d.components[d.rootId]).map(d=>o.jsx(Jn.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",stiffness:380,damping:30},children:o.jsx(tTe,{surface:d,onAction:i})},`${u}-${d.surfaceId}`));default:return null}})})}function a2(e){return e.isComposing||e.keyCode===229}function NTe({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"m10.05 3.7 1.95-1.12 1.95 1.12"}),o.jsx("path",{d:"m16.25 5.03 3.9 2.25v4.5"}),o.jsx("path",{d:"M20.15 15.08v1.64l-3.9 2.25"}),o.jsx("path",{d:"m13.95 20.3-1.95 1.12-1.95-1.12"}),o.jsx("path",{d:"m7.75 18.97-3.9-2.25v-4.5"}),o.jsx("path",{d:"M3.85 8.92V7.28l3.9-2.25"}),o.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"})]})}const fa=[{value:"agent",label:"Agent",description:"与当前选择的 Agent 对话"},{value:"temporary",label:"内置智能体",description:"使用平台提供的智能体"},{value:"skill-create",label:"创建 Skill",description:"使用两个模型生成并对比 Skill"}],TTe=[{label:"ArkClaw",kind:"openclaw"},{label:"Hermes 智能体",kind:"hermes"}];function E3({mode:e}){return e==="skill-create"?o.jsxs("svg",{className:"new-chat-mode__skill-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:[o.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"}),o.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"?o.jsxs("svg",{className:"new-chat-mode__temporary-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("path",{d:"m10 2.8 6.1 3.45v7.5L10 17.2l-6.1-3.45v-7.5L10 2.8Z"}),o.jsx("path",{d:"m3.9 6.25 6.1 3.5 6.1-3.5M10 9.75v7.45"})]}):o.jsx(NTe,{className:"new-chat-mode__agent-icon"})}function kTe(){return o.jsx("svg",{className:"new-chat-mode__nested-chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"m4.5 3 3 3-3 3"})})}function ATe({value:e,onChange:t,disabled:n=!1,temporaryEnabled:s,skillCreateEnabled:i}){const[r,a]=g.useState(!1),[l,c]=g.useState(!1),[u,d]=g.useState(()=>fa.findIndex(_=>_.value===e)),f=g.useRef(null),h=g.useRef(null),p=fa.find(_=>_.value===e)??fa[0],m=p.value==="temporary"?"Codex 智能体":p.label;function b(_){return _.value==="temporary"?s:_.value==="skill-create"?i:!0}function v(_){return b(_)!==!0}function y(_){const S=b(_);return S===void 0?"正在检查配置":S?_.description:"管理员未配置"}g.useEffect(()=>{if(!r)return;const _=S=>{var k;(k=f.current)!=null&&k.contains(S.target)||(a(!1),c(!1))};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[r]);function x(_){let S=u;do S=(S+_+fa.length)%fa.length;while(v(fa[S]));d(S),c(fa[S].value==="temporary")}function E(_){var S;if(!v(_)){if(_.value==="temporary"){c(!0);return}t(_.value),a(!1),c(!1),(S=h.current)==null||S.focus()}}function w(){t("temporary"),a(!1),c(!1)}return o.jsxs("div",{className:"new-chat-mode",ref:f,children:[o.jsxs("button",{ref:h,type:"button",className:"new-chat-mode__trigger","aria-label":"选择新会话模式","aria-haspopup":"listbox","aria-expanded":r,disabled:n,onClick:()=>{d(fa.findIndex(_=>_.value===e)),a(_=>(_&&c(!1),!_))},onKeyDown:_=>{_.key==="ArrowDown"||_.key==="ArrowUp"?(_.preventDefault(),r?x(_.key==="ArrowDown"?1:-1):a(!0)):r&&(_.key==="Enter"||_.key===" ")?(_.preventDefault(),E(fa[u])):r&&_.key==="Escape"&&(_.preventDefault(),a(!1),c(!1))},children:[o.jsx("span",{className:"new-chat-mode__icon",children:o.jsx(E3,{mode:p.value})}),o.jsx("span",{className:"new-chat-mode__current",title:m,children:m}),o.jsx("svg",{className:"new-chat-mode__chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"m3 4.5 3 3 3-3"})})]}),r?o.jsxs("div",{className:"new-chat-mode__menus",children:[o.jsx("div",{className:"new-chat-mode__menu",role:"listbox","aria-label":"新会话模式",tabIndex:-1,onKeyDown:_=>{var S;_.key==="ArrowDown"||_.key==="ArrowUp"?(_.preventDefault(),x(_.key==="ArrowDown"?1:-1)):_.key==="Enter"?(_.preventDefault(),E(fa[u])):_.key==="Escape"&&(_.preventDefault(),a(!1),c(!1),(S=h.current)==null||S.focus())},children:fa.map((_,S)=>{const k=_.value==="temporary";return o.jsxs("button",{type:"button",role:"option","aria-selected":e===_.value,"aria-haspopup":k?"menu":void 0,"aria-expanded":k?l:void 0,"aria-disabled":v(_),disabled:v(_),className:`new-chat-mode__option${S===u?" is-active":""}`,onMouseEnter:()=>{d(S),c(_.value==="temporary")},onClick:()=>E(_),children:[o.jsx("span",{className:"new-chat-mode__option-icon",children:o.jsx(E3,{mode:_.value})}),o.jsxs("span",{className:"new-chat-mode__copy",children:[o.jsxs("span",{className:"new-chat-mode__label",children:[_.label,_.value==="skill-create"?o.jsx("span",{className:"new-chat-mode__beta",children:"Beta"}):null]}),o.jsx("span",{children:y(_)})]}),k?o.jsx(kTe,{}):e===_.value?o.jsx("svg",{className:"new-chat-mode__check",viewBox:"0 0 16 16","aria-hidden":"true",children:o.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})}):null]},_.value)})}),l?o.jsxs("div",{className:"new-chat-mode__submenu",role:"menu","aria-label":"内置智能体",children:[o.jsxs("button",{type:"button",role:"menuitem",className:"new-chat-mode__submenu-option",onClick:w,children:[o.jsx(Fm,{kind:"codex",className:"new-chat-mode__builtin-icon"}),o.jsxs("span",{className:"new-chat-mode__copy",children:[o.jsx("span",{className:"new-chat-mode__label",children:"Codex 智能体"}),o.jsx("span",{children:"在沙箱中执行任务"})]})]}),TTe.map(({label:_,kind:S})=>o.jsxs("button",{type:"button",role:"menuitem",className:"new-chat-mode__submenu-option",disabled:!0,children:[o.jsx(Fm,{kind:S,className:"new-chat-mode__builtin-icon"}),o.jsxs("span",{className:"new-chat-mode__copy",children:[o.jsx("span",{className:"new-chat-mode__label",children:_}),o.jsx("span",{children:"暂不可用"})]})]},_))]}):null]}):null]})}const ed=[{id:"general",label:"通用智能体"},{id:"codex",label:"Codex 智能体"},{id:"openclaw",label:"OpenClaw 智能体"},{id:"hermes",label:"Hermes 智能体"}],CTe=15,ITe=15e3,jTe=120,RTe=180;function v3(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5.75 3.75 4.25 4.25-4.25 4.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function OTe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m3.25 8.25 3 3 6.5-6.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function kw({type:e,className:t="new-chat-agent-picker__type-icon"}){return e==="general"?o.jsx(Wc,{className:t}):o.jsx(Fm,{kind:e,className:t})}function MTe({selectedAgentName:e="",selectedRuntimeId:t="",runtimeScope:n,disabled:s=!1,onSelectRuntime:i,onSelectSandboxSession:r}){var Ee;const[a,l]=g.useState(!1),[c,u]=g.useState(null),[d,f]=g.useState(0),[h,p]=g.useState(0),[m,b]=g.useState("types"),[v,y]=g.useState(!1),[x,E]=g.useState([]),[w,_]=g.useState([]),[S,k]=g.useState(null),[T,C]=g.useState(""),[I,j]=g.useState(!1),[L,z]=g.useState(""),[D,F]=g.useState(""),A=g.useRef(null),M=g.useRef(null),P=g.useRef(null),H=g.useRef(0),R=g.useRef(null),Y=g.useRef(null),J=g.useRef(null),U=((Ee=ed.find(ie=>ie.id===c))==null?void 0:Ee.label)??"智能体",te=g.useCallback((ie=!1)=>{var Ne;Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null),J.current!==null&&(window.clearTimeout(J.current),J.current=null),l(!1),u(null),b("types"),y(!1),ie&&((Ne=M.current)==null||Ne.focus())},[]),K=g.useCallback(async(ie="",Ne=!1)=>{const ve=++H.current;let Qe;j(!0),z("");try{const De=await Promise.race([l1({scope:n,region:"all",pageSize:CTe,nextToken:ie}),new Promise((Ke,Se)=>{Qe=window.setTimeout(()=>{Se(new Error("加载智能体超时(15 秒),请检查网络或 Runtime 服务后重试"))},ITe)})]);if(H.current!==ve)return;E(Ke=>{const Se=Ne?De.runtimes:[...Ke,...De.runtimes];return Se.filter((He,Be)=>Se.findIndex(qe=>qe.runtimeId===He.runtimeId)===Be)}),C(De.nextToken),p(0)}catch(De){if(H.current!==ve)return;z(Ld(De,"加载通用智能体","GET /web/runtimes"))}finally{window.clearTimeout(Qe),H.current===ve&&j(!1)}},[n]),V=g.useCallback(async ie=>{var Qe,De;(Qe=R.current)==null||Qe.abort();const Ne=new AbortController;R.current=Ne;const ve=++H.current;j(!0),z(""),_([]);try{const Ke=ie==="codex"?await rn.listSessions({signal:Ne.signal}):await rn.listAgentSessions(ie,{signal:Ne.signal});if(H.current!==ve)return;_(Ke),k(ie),p(0)}catch(Ke){if((Ke==null?void 0:Ke.name)==="AbortError"||H.current!==ve)return;z(Ld(Ke,`加载 ${((De=ed.find(Se=>Se.id===ie))==null?void 0:De.label)??ie}`,`GET /web/${ie==="codex"?"sandbox":ie}/sessions`)),k(ie)}finally{R.current===Ne&&(R.current=null),H.current===ve&&j(!1)}},[]);g.useEffect(()=>{!a||c!=="general"||x.length>0||I||L||K("",!0)},[c,L,K,I,a,x.length]),g.useEffect(()=>{!a||c===null||c==="general"||S===c||V(c)},[c,V,S,a]),g.useEffect(()=>{if(!a)return;const ie=Ne=>{var ve;(ve=A.current)!=null&&ve.contains(Ne.target)||te()};return document.addEventListener("mousedown",ie),()=>document.removeEventListener("mousedown",ie)},[te,a]),g.useEffect(()=>()=>{var ie;H.current+=1,(ie=R.current)==null||ie.abort(),Y.current!==null&&window.clearTimeout(Y.current),J.current!==null&&window.clearTimeout(J.current)},[]);function W(ie,Ne=!1){Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null),J.current!==null&&(window.clearTimeout(J.current),J.current=null),l(!0),u(Ne?"general":null),f(0),b("types"),y(Ne),ie&&requestAnimationFrame(()=>{var ve;return(ve=P.current)==null?void 0:ve.focus()})}function q(){s||a||Y.current!==null||(Y.current=window.setTimeout(()=>{Y.current=null,W(!1)},jTe))}function ue(){J.current!==null&&(window.clearTimeout(J.current),J.current=null)}function pe(){Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null),!(!a||J.current!==null)&&(J.current=window.setTimeout(()=>{J.current=null,te()},RTe))}function we(ie){var Qe;const Ne=(ie+ed.length)%ed.length,ve=ed[Ne].id;ve!==c&&(H.current+=1,(Qe=R.current)==null||Qe.abort(),R.current=null,j(!1),z("")),f(Ne),u(ve),p(0)}async function de(ie){if(!D){F(ie.runtimeId),z("");try{await i(ie),te(!0)}catch(Ne){z(Ld(Ne,"连接通用智能体"))}finally{F("")}}}async function ge(ie){if(!D){F(ie.id),z("");try{await r(ie),te(!0)}catch(Ne){z(Ld(Ne,`打开 ${U}`))}finally{F("")}}}function Le(ie){if(ie.key==="Escape"){ie.preventDefault(),te(!0);return}if(["ArrowDown","ArrowUp","ArrowRight","ArrowLeft","Enter"].includes(ie.key)&&y(!0),m==="types"){ie.key==="ArrowDown"||ie.key==="ArrowUp"?(ie.preventDefault(),we(d+(ie.key==="ArrowDown"?1:-1))):(ie.key==="ArrowRight"||ie.key==="Enter")&&(ie.preventDefault(),c===null&&we(d),b("runtimes"));return}if(ie.key==="ArrowLeft")ie.preventDefault(),b("types");else if((c==="general"?x:w).length>0&&(ie.key==="ArrowDown"||ie.key==="ArrowUp")){ie.preventDefault();const Ne=ie.key==="ArrowDown"?1:-1,ve=c==="general"?x.length:w.length;p(Qe=>(Qe+Ne+ve)%ve)}else ie.key==="Enter"&&c==="general"&&x[h]?(ie.preventDefault(),de(x[h])):ie.key==="Enter"&&c!=="general"&&w[h]&&(ie.preventDefault(),ge(w[h]))}return o.jsxs("div",{className:"new-chat-agent-picker",ref:A,onPointerEnter:ie=>{ie.pointerType==="mouse"&&ue()},onPointerLeave:ie=>{ie.pointerType==="mouse"&&pe()},children:[o.jsxs("button",{ref:M,type:"button",className:"new-chat-agent-picker__trigger","aria-label":"选择智能体","aria-haspopup":"menu","aria-expanded":a,disabled:s,onPointerEnter:ie=>{ie.pointerType==="mouse"&&q()},onClick:()=>a?te():W(!0),onKeyDown:ie=>{ie.key==="ArrowDown"||ie.key==="ArrowUp"?(ie.preventDefault(),a||W(!0,!0)):ie.key==="Escape"&&a&&(ie.preventDefault(),te(!0))},children:[o.jsx(Wc,{className:"new-chat-agent-picker__trigger-icon"}),o.jsx("span",{title:e||"选择智能体",children:e||"选择智能体"}),o.jsx(v3,{className:"new-chat-agent-picker__trigger-chevron"})]}),a?o.jsxs("div",{ref:P,className:"new-chat-agent-picker__menus",tabIndex:-1,onKeyDown:Le,onPointerMove:ie=>{ie.pointerType==="mouse"&&y(!1)},children:[o.jsx("div",{className:"new-chat-agent-picker__menu",role:"menu","aria-label":"智能体类型",children:ed.map((ie,Ne)=>o.jsxs("button",{type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":c===ie.id,className:`new-chat-agent-picker__type${v&&m==="types"&&d===Ne?" is-keyboard-active":""}`,onMouseEnter:()=>we(Ne),onClick:()=>{we(Ne),b("runtimes")},children:[o.jsx(kw,{type:ie.id}),o.jsx("span",{children:ie.label}),o.jsx(v3,{className:"new-chat-agent-picker__nested-chevron"})]},ie.id))}),c!==null?o.jsx("div",{className:"new-chat-agent-picker__submenu",role:"listbox","aria-label":`${U}列表`,children:c!=="general"&&I&&w.length===0?o.jsxs("div",{className:"new-chat-agent-picker__status",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"new-chat-agent-picker__spinner","aria-hidden":"true"}),"正在加载智能体"]}):c!=="general"&&L&&w.length===0?o.jsxs("div",{className:"new-chat-agent-picker__error",role:"alert",children:[o.jsx("span",{children:L}),o.jsx("button",{type:"button",onClick:()=>void V(c),children:"重新加载"})]}):c!=="general"&&w.length===0?o.jsxs(Qn,{className:"new-chat-agent-picker__empty",fill:"none",children:[o.jsx(Qn.Icon,{size:"sm",children:o.jsx(kw,{type:c,className:"new-chat-agent-picker__empty-agent-icon"})}),o.jsx(Qn.Title,{children:o.jsxs("span",{className:"new-chat-agent-picker__empty-title",children:["暂无 ",U]})}),o.jsx(Qn.Description,{children:"请前往智能体页创建"})]}):c!=="general"?o.jsx("div",{className:"new-chat-agent-picker__runtime-list",children:w.map((ie,Ne)=>{const ve=D===ie.id;return o.jsxs("button",{type:"button",role:"option","aria-selected":!1,"aria-busy":ve||void 0,className:`new-chat-agent-picker__runtime${v&&m==="runtimes"&&h===Ne?" is-keyboard-active":""}`,disabled:!!D,title:`${ie.displayName||U} · ${ie.id}`,onMouseEnter:()=>p(Ne),onClick:()=>void ge(ie),children:[o.jsx(kw,{type:c,className:"new-chat-agent-picker__runtime-icon"}),o.jsx("span",{children:ie.displayName||U}),o.jsx("small",{children:ve?"正在打开":F1(ie.status)})]},ie.id)})}):I&&x.length===0?o.jsxs("div",{className:"new-chat-agent-picker__status",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"new-chat-agent-picker__spinner","aria-hidden":"true"}),"正在加载智能体"]}):L&&x.length===0?o.jsxs("div",{className:"new-chat-agent-picker__error",role:"alert",children:[o.jsx("span",{children:L}),o.jsx("button",{type:"button",onClick:()=>void K("",!0),children:"重新加载"})]}):x.length===0?o.jsxs(Qn,{className:"new-chat-agent-picker__empty",fill:"none",children:[o.jsx(Qn.Icon,{size:"sm",children:o.jsx(Wc,{})}),o.jsx(Qn.Title,{children:o.jsx("span",{className:"new-chat-agent-picker__empty-title",children:"暂无通用智能体"})}),o.jsx(Qn.Description,{children:"请前往智能体页创建"})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"new-chat-agent-picker__runtime-list",children:x.map((ie,Ne)=>{const ve=D===ie.runtimeId,Qe=ie.runtimeId===t;return o.jsxs("button",{type:"button",role:"option","aria-selected":Qe,"aria-busy":ve||void 0,className:`new-chat-agent-picker__runtime${v&&m==="runtimes"&&h===Ne?" is-keyboard-active":""}`,disabled:!!D,title:ie.name,onMouseEnter:()=>p(Ne),onClick:()=>void de(ie),children:[o.jsx(Wc,{className:"new-chat-agent-picker__runtime-icon"}),o.jsx("span",{children:ie.name}),ve?o.jsx("small",{children:"正在连接"}):Qe?o.jsx(OTe,{className:"new-chat-agent-picker__check"}):null]},ie.runtimeId)})}),L?o.jsx("div",{className:"new-chat-agent-picker__inline-error",role:"alert",children:L}):null,T?o.jsx("button",{type:"button",className:"new-chat-agent-picker__load-more",disabled:I||!!D,onClick:()=>void K(T),children:I?"加载中":"加载更多"}):null]})}):null]}):null]})}const bH={ppt:["ppt_generate"],image:["image_generate"],video:["video_generate"]},LTe={ppt:[],image:[],video:["video_task_query"]},o2=["doubao-seed-2-0-pro-260215","deepseek-v4-flash-260425"];function w3(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"4.25",y:"6.25",width:"13.5",height:"13.5",rx:"2.5"}),o.jsx("path",{d:"M11 10v6M8 13h6"}),o.jsx("path",{d:"m19.25 2.75.53 1.47 1.47.53-1.47.53-.53 1.47-.53-1.47-1.47-.53 1.47-.53.53-1.47Z",fill:"currentColor",stroke:"none"})]})}const S3=[{value:"ppt",label:"PPT",icon:wee,prompts:["复盘【季度】经营表现,提炼指标差距、原因与行动建议","汇报【项目名称】进展:里程碑、风险、预算和资源诉求","为【客户行业】输出解决方案:痛点、架构、实施路径与收益","分析【行业主题】趋势,给出竞争格局、机会与战略建议"]},{value:"image",label:"图片生成",icon:jk,prompts:["为【品牌或产品】设计【高级科技】风格的发布会主视觉","生成【产品名称】电商海报,突出【核心卖点】与品牌色","呈现【产品或空间】在【使用场景】中的写实概念效果图","围绕【传播主题】制作简洁专业的企业社媒配图"]},{value:"video",label:"视频生成",icon:dH,prompts:["制作【品牌名称】30 秒宣传片,突出【品牌价值】","为【产品名称】制作 45 秒发布视频:痛点、功能、场景与行动号召","制作【培训主题】企业培训视频,讲清【关键操作或规范】","生成【活动名称】20 秒预热视频,包含亮点、时间地点和报名信息"]}];function DTe({sessionId:e,sessionInitializing:t=!1,appName:n,agentName:s,value:i,onChange:r,onSubmit:a,disabled:l,busy:c,showMeta:u,attachments:d,skills:f,agents:h,invocation:p,capabilitiesLoading:m=!1,allowAttachments:b=!0,onInvocationChange:v,onAddFiles:y,onRemoveAttachment:x,newChatMode:E="agent",newChatTask:w=null,newChatLayout:_=!1,showModeSelector:S=!1,onModeChange:k,onTaskChange:T,temporaryEnabled:C,skillCreateEnabled:I,harnessEnabled:j=!1,builtinTools:L=[],showAgentPicker:z=!1,agentPickerDisabled:D=!1,selectedRuntimeId:F="",runtimeScope:A="mine",onSelectRuntime:M,onSelectSandboxSession:P}){const H=g.useRef(null),R=g.useRef(null),Y=g.useRef(null),J=g.useRef(null),[U,te]=g.useState(!1),[K,V]=g.useState(null),[W,q]=g.useState(0),[ue,pe]=g.useState(!1);async function we(){if(e)try{await navigator.clipboard.writeText(e),pe(!0),setTimeout(()=>pe(!1),1500)}catch{pe(!1)}}g.useLayoutEffect(()=>{const ne=H.current;ne&&(ne.style.height="auto",ne.style.height=`${Math.min(ne.scrollHeight,200)}px`)},[i]);const de=E==="skill-create";g.useEffect(()=>{de&&(te(!1),V(null))},[de]);const ge=!de&&d.some(ne=>ne.status!=="ready"),Le=!l&&!c&&!ge&&(i.trim().length>0||!de&&d.length>0),Ee=de?`描述你想创建的 Skill,将使用 ${o2.join(" 和 ")} 并行创建…`:l?"请先选择智能体":`向 ${s} 发消息…`,ie=(K==null?void 0:K.query.toLocaleLowerCase())??"",Ne=(K==null?void 0:K.kind)==="skill"?f.filter(ne=>!p.skills.some(xe=>xe.name===ne.name)).filter(ne=>`${ne.name} ${ne.description}`.toLocaleLowerCase().includes(ie)).map(ne=>({kind:"skill",value:ne})):(K==null?void 0:K.kind)==="agent"?h.filter(ne=>`${ne.name} ${ne.description}`.toLocaleLowerCase().includes(ie)).map(ne=>({kind:"agent",value:ne})):[];function ve(ne){var xe;te(!1),V(null),(xe=ne.current)==null||xe.click()}function Qe(ne){T==null||T(ne.value),te(!1),V(null),requestAnimationFrame(()=>{var xe,Fe;(xe=H.current)==null||xe.focus(),(Fe=H.current)==null||Fe.setSelectionRange(i.length,i.length)})}function De(ne){r(ne),te(!1),V(null),requestAnimationFrame(()=>{var at,It,ft;(at=H.current)==null||at.focus();const xe=ne.indexOf("【"),Fe=ne.indexOf("】",xe+1);xe>=0&&Fe>xe?(It=H.current)==null||It.setSelectionRange(xe+1,Fe):(ft=H.current)==null||ft.setSelectionRange(ne.length,ne.length)})}function Ke(){T==null||T(null),r(""),te(!1),V(null),requestAnimationFrame(()=>{var ne,xe;(ne=H.current)==null||ne.focus(),(xe=H.current)==null||xe.setSelectionRange(0,0)})}const Se=S3.find(ne=>ne.value===w),He=S3.filter(ne=>bH[ne.value].every(xe=>L.includes(xe)));function Be(ne,xe){const Fe=ne.slice(0,xe),at=/(^|\s)([/@])([^\s/@]*)$/.exec(Fe);if(!at){V(null);return}const It=at[2].length+at[3].length,ft={kind:at[2]==="/"?"skill":"agent",query:at[3],start:xe-It,end:xe},fn=!K||K.kind!==ft.kind||K.query!==ft.query||K.start!==ft.start||K.end!==ft.end;V(ft),fn&&q(0),te(!1)}function qe(ne){if(!K)return;const xe=i.slice(0,K.start)+i.slice(K.end);r(xe),ne.kind==="skill"?v({...p,skills:[...p.skills,ne.value]}):v({skills:[],targetAgent:ne.value});const Fe=K.start;V(null),requestAnimationFrame(()=>{var at,It;(at=H.current)==null||at.focus(),(It=H.current)==null||It.setSelectionRange(Fe,Fe)})}function Z(){if(p.targetAgent){v({skills:[]});return}p.skills.length>0&&v({...p,skills:p.skills.slice(0,-1)})}function ae(ne){const xe=ne.target.files?Array.from(ne.target.files):[];xe.length&&y(xe),ne.target.value=""}return o.jsxs("div",{className:`composer${_?" composer--new-chat":""}${de?" composer--skill-mode":""}${Se?` composer--has-task composer--task-${Se.value}`:""}`,children:[de?null:o.jsx(H1,{value:p,onRemoveSkill:ne=>v({...p,skills:p.skills.filter(xe=>xe.name!==ne)}),onRemoveAgent:()=>v({skills:[]})}),!de&&d.length>0&&o.jsx(z1,{appName:n,compact:!0,items:d,onRemove:x}),o.jsxs("div",{className:"composer-box",children:[K?o.jsxs("div",{className:"composer-command-menu",role:"listbox","aria-label":K.kind==="skill"?"可用技能":"可用子 Agent",children:[o.jsxs("div",{className:"composer-command-head",children:[K.kind==="skill"?o.jsx(ou,{}):o.jsx(gB,{}),o.jsx("span",{children:K.kind==="skill"?"调用技能":"使用子 Agent"}),o.jsx("kbd",{children:K.kind==="skill"?"/":"@"})]}),m?o.jsxs("div",{className:"composer-command-empty",children:[o.jsx(dn,{className:"spin"})," 正在读取 Agent 能力…"]}):Ne.length===0?o.jsx("div",{className:"composer-command-empty",children:K.kind==="skill"?"当前 Agent 没有匹配技能":"当前 Agent 没有匹配子 Agent"}):o.jsx("div",{className:"composer-command-list",children:Ne.map((ne,xe)=>o.jsxs("button",{type:"button",role:"option","aria-selected":xe===W,className:`composer-command-item${xe===W?" is-active":""}`,onMouseDown:Fe=>{Fe.preventDefault(),qe(ne)},onMouseEnter:()=>q(xe),children:[o.jsx("span",{className:`composer-command-icon composer-command-icon--${ne.kind}`,children:ne.kind==="skill"?o.jsx(ou,{}):o.jsx(au,{})}),o.jsxs("span",{className:"composer-command-copy",children:[o.jsxs("strong",{children:[ne.kind==="skill"?"/":"@",ne.value.name]}),o.jsx("span",{children:ne.value.description||(ne.kind==="skill"?"加载并执行该技能":"将本轮交给该 Agent")})]}),o.jsx("kbd",{children:xe===W?"↵":ne.kind==="skill"?"技能":"Agent"})]},`${ne.kind}-${ne.value.name}`))})]}):null,de?null:o.jsxs("div",{className:"composer-menu-wrap",children:[o.jsx("button",{type:"button",className:"comp-icon",title:"添加","aria-label":"添加",disabled:l||!b,onClick:()=>{V(null),te(ne=>!ne)},children:o.jsx(_i,{className:"icon"})}),U&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>te(!1)}),o.jsxs("div",{className:"composer-menu",role:"menu",children:[o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ve(R),children:[o.jsx(jk,{className:"icon"}),"上传图片"]}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ve(Y),children:[o.jsx(Ck,{className:"icon"}),"上传文档或 PDF"]}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ve(J),children:[o.jsx(yB,{className:"icon"}),"上传视频"]})]})]})]}),z&&M&&P?o.jsx(MTe,{selectedAgentName:n?s:"",selectedRuntimeId:F,runtimeScope:A,disabled:D,onSelectRuntime:M,onSelectSandboxSession:P}):null,S&&k?o.jsx(ATe,{value:E,onChange:k,disabled:c,temporaryEnabled:C,skillCreateEnabled:I}):null,_&&E==="agent"&&Se&&T?o.jsxs("button",{type:"button",className:`new-chat-task-chip new-chat-task-chip--${Se.value}`,"aria-label":`取消${Se.label}任务`,disabled:c,onClick:Ke,children:[o.jsxs("span",{className:"new-chat-task-chip__icon","aria-hidden":"true",children:[o.jsx(Se.icon,{className:"new-chat-task-chip__task-icon"}),o.jsx(Ti,{className:"new-chat-task-chip__remove-icon"})]}),o.jsx("span",{children:Se.label})]}):null,_&&de&&k?o.jsxs("button",{type:"button",className:"new-chat-task-chip new-chat-task-chip--skill","aria-label":"退出创建 Skill",disabled:c,onClick:()=>k("agent"),children:[o.jsxs("span",{className:"new-chat-task-chip__icon","aria-hidden":"true",children:[o.jsx(w3,{className:"new-chat-task-chip__task-icon"}),o.jsx(Ti,{className:"new-chat-task-chip__remove-icon"})]}),o.jsx("span",{children:"Skill"})]}):null,o.jsxs("div",{className:"composer-input-stack",children:[o.jsx("textarea",{ref:H,className:"comp-input scroll",rows:_?4:1,value:i,disabled:l,placeholder:Ee,"aria-expanded":!!K,onChange:ne=>{r(ne.target.value),de||Be(ne.target.value,ne.target.selectionStart)},onSelect:ne=>{de||Be(ne.currentTarget.value,ne.currentTarget.selectionStart)},onBlur:()=>setTimeout(()=>V(null),0),onKeyDown:ne=>{if(!a2(ne.nativeEvent)){if(K){if(ne.key==="ArrowDown"&&Ne.length>0){ne.preventDefault(),q(xe=>(xe+1)%Ne.length);return}if(ne.key==="ArrowUp"&&Ne.length>0){ne.preventDefault(),q(xe=>(xe-1+Ne.length)%Ne.length);return}if((ne.key==="Enter"||ne.key==="Tab")&&Ne[W]){ne.preventDefault(),qe(Ne[W]);return}if(ne.key==="Escape"){ne.preventDefault(),V(null);return}}if(ne.key==="Backspace"&&!i&&ne.currentTarget.selectionStart===0&&ne.currentTarget.selectionEnd===0){Z();return}ne.key==="Enter"&&!ne.shiftKey&&(ne.preventDefault(),Le&&a())}}}),_&&i.length===0?o.jsx("span",{className:"composer-placeholder-reveal","aria-hidden":"true",children:Ee},Ee):null]}),o.jsx(Jn.button,{type:"button",className:"comp-send",disabled:!Le,onClick:a,"aria-label":"发送",whileTap:Le?{scale:.9}:void 0,transition:{type:"spring",stiffness:600,damping:22},children:c?o.jsx(dn,{className:"icon spin"}):o.jsx(mB,{className:"icon"})})]}),_&&E==="agent"&&j&&!Se?o.jsxs("div",{className:"task-shortcuts","aria-label":"选择任务类型",children:[He.map(ne=>{const xe=ne.icon;return o.jsxs("button",{type:"button",className:"task-shortcut",disabled:l||c,onClick:()=>Qe(ne),children:[o.jsx(xe,{}),o.jsx("span",{children:ne.label})]},ne.value)}),I===!0?o.jsxs("button",{type:"button",className:"task-shortcut",disabled:c,onClick:()=>k==null?void 0:k("skill-create"),children:[o.jsx(w3,{}),o.jsx("span",{children:"创建 Skill"})]}):null]}):null,_&&E==="agent"&&Se?o.jsx("div",{className:"prompt-suggestions","aria-label":`${Se.label}企业提示词`,children:Se.prompts.map(ne=>{const xe=Se.icon;return o.jsxs("button",{type:"button",className:"prompt-suggestion",disabled:l||c,onClick:()=>De(ne),children:[o.jsx(xe,{}),o.jsx("span",{children:ne})]},ne)})}):null,u&&o.jsxs("div",{className:"composer-meta",children:[o.jsxs("span",{className:"composer-session-line",children:["会话 ID:",o.jsx("span",{className:"composer-session-id",title:e||void 0,"aria-live":"polite",children:t?"初始化中":e||"—"}),e&&o.jsx("button",{type:"button",className:"composer-session-copy",title:ue?"已复制":"复制会话 ID","aria-label":ue?"已复制会话 ID":"复制会话 ID",onClick:()=>void we(),children:ue?o.jsx(ja,{}):o.jsx(e1,{})})]}),o.jsx("span",{className:"composer-meta-separator","aria-hidden":!0,children:"|"}),o.jsx("span",{children:"回答仅供参考"})]}),o.jsx("input",{ref:R,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:ae}),o.jsx("input",{ref:Y,type:"file",accept:".txt,.md,.markdown,.pdf,text/plain,text/markdown,application/pdf",multiple:!0,hidden:!0,onChange:ae}),o.jsx("input",{ref:J,type:"file",accept:"video/mp4,video/webm,video/quicktime",multiple:!0,hidden:!0,onChange:ae})]})}function yH({title:e,sub:t,cards:n,footer:s}){return o.jsxs("div",{className:"stk",children:[o.jsxs("div",{className:"stk-head",children:[o.jsx("h1",{className:"stk-title",children:e}),t&&o.jsx("p",{className:"stk-sub",children:t})]}),o.jsx("div",{className:"stk-list",children:n.map((i,r)=>o.jsxs(Jn.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:r*.04},children:[o.jsx("span",{className:"stk-card-icon",children:o.jsx(i.icon,{})}),o.jsxs("span",{className:"stk-card-text",children:[o.jsx("span",{className:"stk-card-title",children:i.title}),o.jsx("span",{className:"stk-card-desc",children:i.desc})]}),i.status&&o.jsx("span",{className:"stk-card-status",children:i.status}),o.jsx(nc,{className:"stk-card-arrow"})]},i.key))}),s&&o.jsx("div",{className:"stk-footer",children:s})]})}const l2=Symbol.for("yaml.alias"),yN=Symbol.for("yaml.document"),Wl=Symbol.for("yaml.map"),xH=Symbol.for("yaml.pair"),io=Symbol.for("yaml.scalar"),ch=Symbol.for("yaml.seq"),na=Symbol.for("yaml.node.type"),uh=e=>!!e&&typeof e=="object"&&e[na]===l2,Ag=e=>!!e&&typeof e=="object"&&e[na]===yN,Cg=e=>!!e&&typeof e=="object"&&e[na]===Wl,Fs=e=>!!e&&typeof e=="object"&&e[na]===xH,Gn=e=>!!e&&typeof e=="object"&&e[na]===io,Ig=e=>!!e&&typeof e=="object"&&e[na]===ch;function Ps(e){if(e&&typeof e=="object")switch(e[na]){case Wl:case ch:return!0}return!1}function Us(e){if(e&&typeof e=="object")switch(e[na]){case l2:case Wl:case io:case ch:return!0}return!1}const EH=e=>(Gn(e)||Ps(e))&&!!e.anchor,Rc=Symbol("break visit"),PTe=Symbol("skip children"),Xp=Symbol("remove node");function dh(e,t){const n=BTe(t);Ag(e)?Pd(null,e.contents,n,Object.freeze([e]))===Xp&&(e.contents=null):Pd(null,e,n,Object.freeze([]))}dh.BREAK=Rc;dh.SKIP=PTe;dh.REMOVE=Xp;function Pd(e,t,n,s){const i=UTe(e,t,n,s);if(Us(i)||Fs(i))return FTe(e,s,i),Pd(e,i,n,s);if(typeof i!="symbol"){if(Ps(t)){s=Object.freeze(s.concat(t));for(let r=0;re.replace(/[!,[\]{}]/g,t=>$Te[t]);class zi{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},zi.defaultYaml,t),this.tags=Object.assign({},zi.defaultTags,n)}clone(){const t=new zi(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new zi(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:zi.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},zi.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:zi.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},zi.defaultTags),this.atNextDocument=!1);const s=t.trim().split(/[ \t]+/),i=s.shift();switch(i){case"%TAG":{if(s.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;const[r,a]=s;return this.tags[r]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[r]=s;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const a=/^\d+\.\d+$/.test(r);return n(6,`Unsupported YAML version ${r}`,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[,s,i]=t.match(/^(.*!)([^!]*)$/s);i||n(`The ${t} tag has no suffix`);const r=this.tags[s];if(r)try{return r+decodeURIComponent(i)}catch(a){return n(String(a)),null}return s==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,s]of Object.entries(this.tags))if(t.startsWith(s))return n+HTe(t.substring(s.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags);let i;if(t&&s.length>0&&Us(t.contents)){const r={};dh(t.contents,(a,l)=>{Us(l)&&l.tag&&(r[l.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,a]of s)r==="!!"&&a==="tag:yaml.org,2002:"||(!t||i.some(l=>l.startsWith(a)))&&n.push(`%TAG ${r} ${a}`);return n.join(` +`)}}zi.defaultYaml={explicit:!1,version:"1.2"};zi.defaultTags={"!!":"tag:yaml.org,2002:"};function vH(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 wH(e){const t=new Set;return dh(e,{Value(n,s){s.anchor&&t.add(s.anchor)}}),t}function SH(e,t){for(let n=1;;++n){const s=`${e}${n}`;if(!t.has(s))return s}}function zTe(e,t){const n=[],s=new Map;let i=null;return{onAnchor:r=>{n.push(r),i??(i=wH(e));const a=SH(t,i);return i.add(a),a},setAnchors:()=>{for(const r of n){const a=s.get(r);if(typeof a=="object"&&a.anchor&&(Gn(a.node)||Ps(a.node)))a.node.anchor=a.anchor;else{const l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=r,l}}},sourceObjects:s}}function Bd(e,t,n,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let i=0,r=s.length;iea(s,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!EH(e))return e.toJSON(t,n);const s={aliasCount:0,count:1,res:void 0};n.anchors.set(e,s),n.onCreate=r=>{s.res=r,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 c2{constructor(t){Object.defineProperty(this,na,{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:s,onAnchor:i,reviver:r}={}){if(!Ag(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 s=="number"?s:100},l=ea(this,"",a);if(typeof i=="function")for(const{count:c,res:u}of a.anchors.values())i(u,c);return typeof r=="function"?Bd(r,{"":l},"",l):l}}class u2 extends c2{constructor(t){super(l2),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 s;n!=null&&n.aliasResolveCache?s=n.aliasResolveCache:(s=[],dh(t,{Node:(r,a)=>{(uh(a)||EH(a))&&s.push(a)}}),n&&(n.aliasResolveCache=s));let i;for(const r of s){if(r===this)break;r.anchor===this.source&&(i=r)}return i}toJSON(t,n){if(!n)return{source:this.source};const{anchors:s,doc:i,maxAliasCount:r}=n,a=this.resolve(i,n);if(!a){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let l=s.get(a);if(l||(ea(a,null,n),l=s.get(a)),(l==null?void 0:l.res)===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(r>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=Qb(i,a,s)),l.count*l.aliasCount>r)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return l.res}toString(t,n,s){const i=`*${this.source}`;if(t){if(vH(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(t.implicitKey)return`${i} `}return i}}function Qb(e,t,n){if(uh(t)){const s=t.resolve(e),i=n&&s&&n.get(s);return i?i.count*i.aliasCount:0}else if(Ps(t)){let s=0;for(const i of t.items){const r=Qb(e,i,n);r>s&&(s=r)}return s}else if(Fs(t)){const s=Qb(e,t.key,n),i=Qb(e,t.value,n);return Math.max(s,i)}return 1}const _H=e=>!e||typeof e!="function"&&typeof e!="object";class Ot extends c2{constructor(t){super(io),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:ea(this.value,t,n)}toString(){return String(this.value)}}Ot.BLOCK_FOLDED="BLOCK_FOLDED";Ot.BLOCK_LITERAL="BLOCK_LITERAL";Ot.PLAIN="PLAIN";Ot.QUOTE_DOUBLE="QUOTE_DOUBLE";Ot.QUOTE_SINGLE="QUOTE_SINGLE";const VTe="tag:yaml.org,2002:";function GTe(e,t,n){if(t){const s=n.filter(r=>r.tag===t),i=s.find(r=>!r.format)??s[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(s=>{var i;return((i=s.identify)==null?void 0:i.call(s,e))&&!s.format})}function $m(e,t,n){var f,h,p;if(Ag(e)&&(e=e.contents),Us(e))return e;if(Fs(e)){const m=(h=(f=n.schema[Wl]).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:s,onAnchor:i,onTagObj:r,schema:a,sourceObjects:l}=n;let c;if(s&&e&&typeof e=="object"){if(c=l.get(e),c)return c.anchor??(c.anchor=i(e)),new u2(c.anchor);c={anchor:null,node:null},l.set(e,c)}t!=null&&t.startsWith("!!")&&(t=VTe+t.slice(2));let u=GTe(e,t,a.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const m=new Ot(e);return c&&(c.node=m),m}u=e instanceof Map?a[Wl]:Symbol.iterator in Object(e)?a[ch]:a[Wl]}r&&(r(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 Ot(e);return t?d.tag=t:u.default||(d.tag=u.tag),c&&(c.node=d),d}function bx(e,t,n){let s=n;for(let i=t.length-1;i>=0;--i){const r=t[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const a=[];a[r]=s,s=a}else s=new Map([[r,s]])}return $m(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const pp=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;let NH=class extends c2{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(s=>Us(s)||Fs(s)?s.clone(t):s),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(pp(t))this.add(n);else{const[s,...i]=t,r=this.get(s,!0);if(Ps(r))r.addIn(i,n);else if(r===void 0&&this.schema)this.set(s,bx(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}deleteIn(t){const[n,...s]=t;if(s.length===0)return this.delete(n);const i=this.get(n,!0);if(Ps(i))return i.deleteIn(s);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}getIn(t,n){const[s,...i]=t,r=this.get(s,!0);return i.length===0?!n&&Gn(r)?r.value:r:Ps(r)?r.getIn(i,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Fs(n))return!1;const s=n.value;return s==null||t&&Gn(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(t){const[n,...s]=t;if(s.length===0)return this.has(n);const i=this.get(n,!0);return Ps(i)?i.hasIn(s):!1}setIn(t,n){const[s,...i]=t;if(i.length===0)this.set(s,n);else{const r=this.get(s,!0);if(Ps(r))r.setIn(i,n);else if(r===void 0&&this.schema)this.set(s,bx(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}};const KTe=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Uo(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Uc=(e,t,n)=>e.endsWith(` +`)?Uo(n,t):n.includes(` `)?` -`+Mo(n,t):(e.endsWith(" ")?"":" ")+n,wH="flow",mN="block",Xb="quoted";function H1(e,t,n="flow",{indentAtStart:s,lineWidth:i=80,minContentWidth:r=20,onFold:a,onOverflow:l}={}){if(!i||i<0)return e;ii-Math.max(2,r)?u.push(0):f=i-s);let h,p,m=!1,b=-1,v=-1,y=-1;n===mN&&(b=E3(e,b,t.length),b!==-1&&(f=b+c));for(let E;E=e[b+=1];){if(n===Xb&&E==="\\"){switch(v=b,e[b+1]){case"x":b+=3;break;case"u":b+=5;break;case"U":b+=9;break;default:b+=1}y=b}if(E===` -`)n===mN&&(b=E3(e,b,t.length)),f=b+t.length+c,h=void 0;else{if(E===" "&&p&&p!==" "&&p!==` +`+Uo(n,t):(e.endsWith(" ")?"":" ")+n,TH="flow",xN="block",Zb="quoted";function V1(e,t,n="flow",{indentAtStart:s,lineWidth:i=80,minContentWidth:r=20,onFold:a,onOverflow:l}={}){if(!i||i<0)return e;ii-Math.max(2,r)?u.push(0):f=i-s);let h,p,m=!1,b=-1,v=-1,y=-1;n===xN&&(b=_3(e,b,t.length),b!==-1&&(f=b+c));for(let E;E=e[b+=1];){if(n===Zb&&E==="\\"){switch(v=b,e[b+1]){case"x":b+=3;break;case"u":b+=5;break;case"U":b+=9;break;default:b+=1}y=b}if(E===` +`)n===xN&&(b=_3(e,b,t.length)),f=b+t.length+c,h=void 0;else{if(E===" "&&p&&p!==" "&&p!==` `&&p!==" "){const w=e[b+1];w&&w!==" "&&w!==` -`&&w!==" "&&(h=b)}if(b>=f)if(h)u.push(h),f=h+c,h=void 0;else if(n===Xb){for(;p===" "||p===" ";)p=E,E=e[b+=1],m=!0;const w=b>y+1?b-2:v-1;if(d[w])return e;u.push(w),d[w]=!0,f=w+c,h=void 0}else m=!0}p=E}if(m&&l&&l(),u.length===0)return e;a&&a();let x=e.slice(0,u[0]);for(let E=0;E({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),V1=e=>/^(%|---|\.\.\.)/m.test(e);function zTe(e,t,n){if(!t||t<0)return!1;const s=t-n,i=e.length;if(i<=s)return!1;for(let r=0,a=0;rs)return!0;if(a=r+1,i-a<=s)return!1}return!0}function Zp(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:s}=t,i=t.options.doubleQuotedMinMultiLineLength,r=t.indent||(V1(e)?" ":"");let a="",l=0;for(let c=0,u=n[c];u;u=n[++c])if(u===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(a+=n.slice(l,c)+"\\ ",c+=1,l=c,u="\\"),u==="\\")switch(n[c+1]){case"u":{a+=n.slice(l,c);const d=n.substr(c+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(c,6)}c+=5,l=c+1}break;case"n":if(s||n[c+2]==='"'||n.length=f)if(h)u.push(h),f=h+c,h=void 0;else if(n===Zb){for(;p===" "||p===" ";)p=E,E=e[b+=1],m=!0;const w=b>y+1?b-2:v-1;if(d[w])return e;u.push(w),d[w]=!0,f=w+c,h=void 0}else m=!0}p=E}if(m&&l&&l(),u.length===0)return e;a&&a();let x=e.slice(0,u[0]);for(let E=0;E({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),K1=e=>/^(%|---|\.\.\.)/m.test(e);function qTe(e,t,n){if(!t||t<0)return!1;const s=t-n,i=e.length;if(i<=s)return!1;for(let r=0,a=0;rs)return!0;if(a=r+1,i-a<=s)return!1}return!0}function Qp(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:s}=t,i=t.options.doubleQuotedMinMultiLineLength,r=t.indent||(K1(e)?" ":"");let a="",l=0;for(let c=0,u=n[c];u;u=n[++c])if(u===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(a+=n.slice(l,c)+"\\ ",c+=1,l=c,u="\\"),u==="\\")switch(n[c+1]){case"u":{a+=n.slice(l,c);const d=n.substr(c+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(c,6)}c+=5,l=c+1}break;case"n":if(s||n[c+2]==='"'||n.length `;let f,h;for(h=n.length;h>0;--h){const _=n[h-1];if(_!==` `&&_!==" "&&_!==" ")break}let p=n.substring(h);const m=p.indexOf(` `);m===-1?f="-":n===p||m!==p.length-1?(f="+",r&&r()):f="",p&&(n=n.slice(0,-p.length),p[p.length-1]===` -`&&(p=p.slice(0,-1)),p=p.replace(bN,`$&${u}`));let b=!1,v,y=-1;for(v=0;v{S=!0});const T=H1(`${x}${_}${p}`,u,mN,k);if(!S)return`>${w} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`);let S=!1;const k=G1(s,!0);a!=="folded"&&t!==Ot.BLOCK_FOLDED&&(k.onOverflow=()=>{S=!0});const T=V1(`${x}${_}${p}`,u,xN,k);if(!S)return`>${w} ${u}${T}`}return n=n.replace(/\n+/g,`$&${u}`),`|${w} -${u}${x}${n}${p}`}function VTe(e,t,n,s){const{type:i,value:r}=e,{actualString:a,implicitKey:l,indent:c,indentStep:u,inFlow:d}=t;if(l&&r.includes(` -`)||d&&/[[\]{},]/.test(r))return Pd(r,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return l||d||!r.includes(` -`)?Pd(r,t):Qb(e,t,n,s);if(!l&&!d&&i!==It.PLAIN&&r.includes(` -`))return Qb(e,t,n,s);if(V1(r)){if(c==="")return t.forceBlockIndent=!0,Qb(e,t,n,s);if(l&&c===u)return Pd(r,t)}const f=r.replace(/\n+/g,`$& -${c}`);if(a){const h=b=>{var v;return b.default&&b.tag!=="tag:yaml.org,2002:str"&&((v=b.test)==null?void 0:v.test(f))},{compat:p,tags:m}=t.doc.schema;if(m.some(h)||p!=null&&p.some(h))return Pd(r,t)}return l?f:H1(f,c,wH,z1(t,!1))}function o2(e,t,n,s){const{implicitKey:i,inFlow:r}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:l}=e;l!==It.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(l=It.QUOTE_DOUBLE);const c=d=>{switch(d){case It.BLOCK_FOLDED:case It.BLOCK_LITERAL:return i||r?Pd(a.value,t):Qb(a,t,n,s);case It.QUOTE_DOUBLE:return Zp(a.value,t);case It.QUOTE_SINGLE:return gN(a.value,t);case It.PLAIN:return VTe(a,t,n,s);default:return null}};let u=c(l);if(u===null){const{defaultKeyType:d,defaultStringType:f}=t.options,h=i&&d||f;if(u=c(h),u===null)throw new Error(`Unsupported default string type ${h}`)}return u}function SH(e,t){const n=Object.assign({blockQuote:!0,commentString:HTe,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 s;switch(n.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:s,options:n}}function GTe(e,t){var i;if(t.tag){const r=e.filter(a=>a.tag===t.tag);if(r.length>0)return r.find(a=>a.format===t.format)??r[0]}let n,s;if(Yn(t)){s=t.value;let r=e.filter(a=>{var l;return(l=a.identify)==null?void 0:l.call(a,s)});if(r.length>1){const a=r.filter(l=>l.test);a.length>0&&(r=a)}n=r.find(a=>a.format===t.format)??r.find(a=>!a.format)}else s=t,n=e.find(r=>r.nodeClass&&s instanceof r.nodeClass);if(!n){const r=((i=s==null?void 0:s.constructor)==null?void 0:i.name)??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${r} value`)}return n}function KTe(e,t,{anchors:n,doc:s}){if(!s.directives)return"";const i=[],r=(Yn(e)||Us(e))&&e.anchor;r&&bH(r)&&(n.add(r),i.push(`&${r}`));const a=e.tag??(t.default?null:t.tag);return a&&i.push(s.directives.tagString(a)),i.join(" ")}function Rf(e,t,n,s){var c;if(Hs(e))return e.toString(t,n,s);if(lh(e)){if(t.doc.directives)return e.toString(t);if((c=t.resolvedAliases)!=null&&c.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 r=$s(e)?e:t.doc.createNode(e,{onTagObj:u=>i=u});i??(i=GTe(t.doc.schema.tags,r));const a=KTe(r,i,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);const l=typeof i.stringify=="function"?i.stringify(r,t,n,s):Yn(r)?o2(r,t,n,s):r.toString(t,n,s);return a?Yn(r)||l[0]==="{"||l[0]==="["?`${a} ${l}`:`${a} -${t.indent}${l}`:l}function qTe({key:e,value:t},n,s,i){const{allNullValues:r,doc:a,indent:l,indentStep:c,options:{commentString:u,indentSeq:d,simpleKeys:f}}=n;let h=$s(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(Us(e)||!$s(e)&&typeof e=="object"){const k="With simple keys, collection cannot be used as a key value";throw new Error(k)}}let p=!f&&(!e||h&&t==null&&!n.inFlow||Us(e)||(Yn(e)?e.type===It.BLOCK_FOLDED||e.type===It.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!r),indent:l+c});let m=!1,b=!1,v=Rf(e,n,()=>m=!0,()=>b=!0);if(!p&&!n.inFlow&&v.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(r||t==null)return m&&s&&s(),v===""?"?":p?`? ${v}`:v}else if(r&&!f||t==null&&p)return v=`? ${v}`,h&&!m?v+=Bc(v,n.indent,u(h)):b&&i&&i(),v;m&&(h=null),p?(h&&(v+=Bc(v,n.indent,u(h))),v=`? ${v} -${l}:`):(v=`${v}:`,h&&(v+=Bc(v,n.indent,u(h))));let y,x,E;$s(t)?(y=!!t.spaceBefore,x=t.commentBefore,E=t.comment):(y=!1,x=null,E=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!p&&!h&&Yn(t)&&(n.indentAtStart=v.length+1),b=!1,!d&&c.length>=2&&!n.inFlow&&!p&&jg(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let w=!1;const _=Rf(t,n,()=>w=!0,()=>b=!0);let S=" ";if(h||y||x){if(S=y?` +${u}${x}${n}${p}`}function YTe(e,t,n,s){const{type:i,value:r}=e,{actualString:a,implicitKey:l,indent:c,indentStep:u,inFlow:d}=t;if(l&&r.includes(` +`)||d&&/[[\]{},]/.test(r))return Ud(r,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return l||d||!r.includes(` +`)?Ud(r,t):Jb(e,t,n,s);if(!l&&!d&&i!==Ot.PLAIN&&r.includes(` +`))return Jb(e,t,n,s);if(K1(r)){if(c==="")return t.forceBlockIndent=!0,Jb(e,t,n,s);if(l&&c===u)return Ud(r,t)}const f=r.replace(/\n+/g,`$& +${c}`);if(a){const h=b=>{var v;return b.default&&b.tag!=="tag:yaml.org,2002:str"&&((v=b.test)==null?void 0:v.test(f))},{compat:p,tags:m}=t.doc.schema;if(m.some(h)||p!=null&&p.some(h))return Ud(r,t)}return l?f:V1(f,c,TH,G1(t,!1))}function d2(e,t,n,s){const{implicitKey:i,inFlow:r}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:l}=e;l!==Ot.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(l=Ot.QUOTE_DOUBLE);const c=d=>{switch(d){case Ot.BLOCK_FOLDED:case Ot.BLOCK_LITERAL:return i||r?Ud(a.value,t):Jb(a,t,n,s);case Ot.QUOTE_DOUBLE:return Qp(a.value,t);case Ot.QUOTE_SINGLE:return EN(a.value,t);case Ot.PLAIN:return YTe(a,t,n,s);default:return null}};let u=c(l);if(u===null){const{defaultKeyType:d,defaultStringType:f}=t.options,h=i&&d||f;if(u=c(h),u===null)throw new Error(`Unsupported default string type ${h}`)}return u}function kH(e,t){const n=Object.assign({blockQuote:!0,commentString:KTe,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 s;switch(n.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:s,options:n}}function WTe(e,t){var i;if(t.tag){const r=e.filter(a=>a.tag===t.tag);if(r.length>0)return r.find(a=>a.format===t.format)??r[0]}let n,s;if(Gn(t)){s=t.value;let r=e.filter(a=>{var l;return(l=a.identify)==null?void 0:l.call(a,s)});if(r.length>1){const a=r.filter(l=>l.test);a.length>0&&(r=a)}n=r.find(a=>a.format===t.format)??r.find(a=>!a.format)}else s=t,n=e.find(r=>r.nodeClass&&s instanceof r.nodeClass);if(!n){const r=((i=s==null?void 0:s.constructor)==null?void 0:i.name)??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${r} value`)}return n}function XTe(e,t,{anchors:n,doc:s}){if(!s.directives)return"";const i=[],r=(Gn(e)||Ps(e))&&e.anchor;r&&vH(r)&&(n.add(r),i.push(`&${r}`));const a=e.tag??(t.default?null:t.tag);return a&&i.push(s.directives.tagString(a)),i.join(" ")}function Mf(e,t,n,s){var c;if(Fs(e))return e.toString(t,n,s);if(uh(e)){if(t.doc.directives)return e.toString(t);if((c=t.resolvedAliases)!=null&&c.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 r=Us(e)?e:t.doc.createNode(e,{onTagObj:u=>i=u});i??(i=WTe(t.doc.schema.tags,r));const a=XTe(r,i,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);const l=typeof i.stringify=="function"?i.stringify(r,t,n,s):Gn(r)?d2(r,t,n,s):r.toString(t,n,s);return a?Gn(r)||l[0]==="{"||l[0]==="["?`${a} ${l}`:`${a} +${t.indent}${l}`:l}function QTe({key:e,value:t},n,s,i){const{allNullValues:r,doc:a,indent:l,indentStep:c,options:{commentString:u,indentSeq:d,simpleKeys:f}}=n;let h=Us(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(Ps(e)||!Us(e)&&typeof e=="object"){const k="With simple keys, collection cannot be used as a key value";throw new Error(k)}}let p=!f&&(!e||h&&t==null&&!n.inFlow||Ps(e)||(Gn(e)?e.type===Ot.BLOCK_FOLDED||e.type===Ot.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!r),indent:l+c});let m=!1,b=!1,v=Mf(e,n,()=>m=!0,()=>b=!0);if(!p&&!n.inFlow&&v.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(r||t==null)return m&&s&&s(),v===""?"?":p?`? ${v}`:v}else if(r&&!f||t==null&&p)return v=`? ${v}`,h&&!m?v+=Uc(v,n.indent,u(h)):b&&i&&i(),v;m&&(h=null),p?(h&&(v+=Uc(v,n.indent,u(h))),v=`? ${v} +${l}:`):(v=`${v}:`,h&&(v+=Uc(v,n.indent,u(h))));let y,x,E;Us(t)?(y=!!t.spaceBefore,x=t.commentBefore,E=t.comment):(y=!1,x=null,E=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!p&&!h&&Gn(t)&&(n.indentAtStart=v.length+1),b=!1,!d&&c.length>=2&&!n.inFlow&&!p&&Ig(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let w=!1;const _=Mf(t,n,()=>w=!0,()=>b=!0);let S=" ";if(h||y||x){if(S=y?` `:"",x){const k=u(x);S+=` -${Mo(k,n.indent)}`}_===""&&!n.inFlow?S===` +${Uo(k,n.indent)}`}_===""&&!n.inFlow?S===` `&&E&&(S=` `):S+=` -${n.indent}`}else if(!p&&Us(t)){const k=_[0],T=_.indexOf(` +${n.indent}`}else if(!p&&Ps(t)){const k=_[0],T=_.indexOf(` `),C=T!==-1,I=n.inFlow??t.flow??t.items.length===0;if(C||!I){let j=!1;if(C&&(k==="&"||k==="!")){let L=_.indexOf(" ");k==="&"&&L!==-1&&Le===eb||typeof e=="symbol"&&e.description===eb,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new It(Symbol(eb)),{addToJSMap:NH}),stringify:()=>eb},YTe=(e,t)=>(Fo.identify(t)||Yn(t)&&(!t.type||t.type===It.PLAIN)&&Fo.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===Fo.tag&&n.default));function NH(e,t,n){const s=TH(e,n);if(jg(s))for(const i of s.items)Nw(e,t,i);else if(Array.isArray(s))for(const i of s)Nw(e,t,i);else Nw(e,t,s)}function Nw(e,t,n){const s=TH(e,n);if(!Ig(s))throw new Error("Merge sources must be maps or map aliases");const i=s.toJSON(null,e,Map);for(const[r,a]of i)t instanceof Map?t.has(r)||t.set(r,a):t instanceof Set?t.add(r):Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function TH(e,t){return e&&lh(t)?t.resolve(e.doc,e):t}function kH(e,t,{key:n,value:s}){if($s(n)&&n.addToJSMap)n.addToJSMap(e,t,s);else if(YTe(e,n))NH(e,t,s);else{const i=sa(n,"",e);if(t instanceof Map)t.set(i,sa(s,i,e));else if(t instanceof Set)t.add(i);else{const r=WTe(n,i,e),a=sa(s,r,e);r in t?Object.defineProperty(t,r,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[r]=a}}return t}function WTe(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if($s(e)&&(n!=null&&n.doc)){const s=SH(n.doc,{});s.anchors=new Set;for(const r of n.anchors.keys())s.anchors.add(r.anchor);s.inFlow=!0,s.inStringifyKey=!0;const i=e.toString(s);if(!n.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),_H(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(t)}function l2(e,t,n){const s=Hm(e,void 0,n),i=Hm(t,void 0,n);return new qi(s,i)}class qi{constructor(t,n=null){Object.defineProperty(this,ra,{value:mH}),this.key=t,this.value=n}clone(t){let{key:n,value:s}=this;return $s(n)&&(n=n.clone(t)),$s(s)&&(s=s.clone(t)),new qi(n,s)}toJSON(t,n){const s=n!=null&&n.mapAsMap?new Map:{};return kH(n,s,this)}toString(t,n,s){return t!=null&&t.doc?qTe(this,t,n,s):JSON.stringify(this)}}function AH(e,t,n){return(t.inFlow??e.flow?QTe:XTe)(e,t,n)}function XTe({comment:e,items:t},n,{blockItemPrefix:s,flowChars:i,itemIndent:r,onChompKeep:a,onComment:l}){const{indent:c,options:{commentString:u}}=n,d=Object.assign({},n,{indent:r,type:null});let f=!1;const h=[];for(let m=0;mv=null,()=>f=!0);v&&(y+=Bc(y,r,u(v))),f&&v&&(f=!1),h.push(s+y)}let p;if(h.length===0)p=i.start+i.end;else{p=h[0];for(let m=1;me===nb||typeof e=="symbol"&&e.description===nb,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Ot(Symbol(nb)),{addToJSMap:CH}),stringify:()=>nb},ZTe=(e,t)=>(Go.identify(t)||Gn(t)&&(!t.type||t.type===Ot.PLAIN)&&Go.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===Go.tag&&n.default));function CH(e,t,n){const s=IH(e,n);if(Ig(s))for(const i of s.items)Aw(e,t,i);else if(Array.isArray(s))for(const i of s)Aw(e,t,i);else Aw(e,t,s)}function Aw(e,t,n){const s=IH(e,n);if(!Cg(s))throw new Error("Merge sources must be maps or map aliases");const i=s.toJSON(null,e,Map);for(const[r,a]of i)t instanceof Map?t.has(r)||t.set(r,a):t instanceof Set?t.add(r):Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function IH(e,t){return e&&uh(t)?t.resolve(e.doc,e):t}function jH(e,t,{key:n,value:s}){if(Us(n)&&n.addToJSMap)n.addToJSMap(e,t,s);else if(ZTe(e,n))CH(e,t,s);else{const i=ea(n,"",e);if(t instanceof Map)t.set(i,ea(s,i,e));else if(t instanceof Set)t.add(i);else{const r=JTe(n,i,e),a=ea(s,r,e);r in t?Object.defineProperty(t,r,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[r]=a}}return t}function JTe(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(Us(e)&&(n!=null&&n.doc)){const s=kH(n.doc,{});s.anchors=new Set;for(const r of n.anchors.keys())s.anchors.add(r.anchor);s.inFlow=!0,s.inStringifyKey=!0;const i=e.toString(s);if(!n.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),AH(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(t)}function f2(e,t,n){const s=$m(e,void 0,n),i=$m(t,void 0,n);return new Ki(s,i)}class Ki{constructor(t,n=null){Object.defineProperty(this,na,{value:xH}),this.key=t,this.value=n}clone(t){let{key:n,value:s}=this;return Us(n)&&(n=n.clone(t)),Us(s)&&(s=s.clone(t)),new Ki(n,s)}toJSON(t,n){const s=n!=null&&n.mapAsMap?new Map:{};return jH(n,s,this)}toString(t,n,s){return t!=null&&t.doc?QTe(this,t,n,s):JSON.stringify(this)}}function RH(e,t,n){return(t.inFlow??e.flow?tke:eke)(e,t,n)}function eke({comment:e,items:t},n,{blockItemPrefix:s,flowChars:i,itemIndent:r,onChompKeep:a,onComment:l}){const{indent:c,options:{commentString:u}}=n,d=Object.assign({},n,{indent:r,type:null});let f=!1;const h=[];for(let m=0;mv=null,()=>f=!0);v&&(y+=Uc(y,r,u(v))),f&&v&&(f=!1),h.push(s+y)}let p;if(h.length===0)p=i.start+i.end;else{p=h[0];for(let m=1;mv=null);u||(u=f.length>d||y.includes(` -`)),m0&&(u||(u=f.reduce((x,E)=>x+E.length+2,2)+(y.length+2)>t.options.lineWidth)),u&&(y+=",")),v&&(y+=Bc(y,s,l(v))),f.push(y),d=f.length}const{start:h,end:p}=n;if(f.length===0)return h+p;if(!u){const m=f.reduce((b,v)=>b+v.length+2,2);u=t.options.lineWidth>0&&m>t.options.lineWidth}if(u){let m=h;for(const b of f)m+=b?` +`+Uo(u(e),c),l&&l()):f&&a&&a(),p}function tke({items:e},t,{flowChars:n,itemIndent:s}){const{indent:i,indentStep:r,flowCollectionPadding:a,options:{commentString:l}}=t;s+=r;const c=Object.assign({},t,{indent:s,inFlow:!0,type:null});let u=!1,d=0;const f=[];for(let m=0;mv=null);u||(u=f.length>d||y.includes(` +`)),m0&&(u||(u=f.reduce((x,E)=>x+E.length+2,2)+(y.length+2)>t.options.lineWidth)),u&&(y+=",")),v&&(y+=Uc(y,s,l(v))),f.push(y),d=f.length}const{start:h,end:p}=n;if(f.length===0)return h+p;if(!u){const m=f.reduce((b,v)=>b+v.length+2,2);u=t.options.lineWidth>0&&m>t.options.lineWidth}if(u){let m=h;for(const b of f)m+=b?` ${r}${i}${b}`:` `;return`${m} -${i}${p}`}else return`${h}${a}${f.join(" ")}${a}${p}`}function gx({indent:e,options:{commentString:t}},n,s,i){if(s&&i&&(s=s.replace(/^\n+/,"")),s){const r=Mo(t(s),e);n.push(r.trimStart())}}function Uc(e,t){const n=Yn(t)?t.value:t;for(const s of e)if(Hs(s)&&(s.key===t||s.key===n||Yn(s.key)&&s.key.value===n))return s}class Jr extends vH{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Vl,t),this.items=[]}static from(t,n,s){const{keepUndefined:i,replacer:r}=s,a=new this(t),l=(c,u)=>{if(typeof r=="function")u=r.call(n,c,u);else if(Array.isArray(r)&&!r.includes(c))return;(u!==void 0||i)&&a.items.push(l2(c,u,s))};if(n instanceof Map)for(const[c,u]of n)l(c,u);else if(n&&typeof n=="object")for(const c of Object.keys(n))l(c,n[c]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){var a;let s;Hs(t)?s=t:!t||typeof t!="object"||!("key"in t)?s=new qi(t,t==null?void 0:t.value):s=new qi(t.key,t.value);const i=Uc(this.items,s.key),r=(a=this.schema)==null?void 0:a.sortMapEntries;if(i){if(!n)throw new Error(`Key ${s.key} already set`);Yn(i.value)&&EH(s.value)?i.value.value=s.value:i.value=s.value}else if(r){const l=this.items.findIndex(c=>r(s,c)<0);l===-1?this.items.push(s):this.items.splice(l,0,s)}else this.items.push(s)}delete(t){const n=Uc(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const s=Uc(this.items,t),i=s==null?void 0:s.value;return(!n&&Yn(i)?i.value:i)??void 0}has(t){return!!Uc(this.items,t)}set(t,n){this.add(new qi(t,n),!0)}toJSON(t,n,s){const i=s?new s:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(i);for(const r of this.items)kH(n,i,r);return i}toString(t,n,s){if(!t)return JSON.stringify(this);for(const i of this.items)if(!Hs(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})),AH(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:s,onComment:n})}}const uh={collection:"map",default:!0,nodeClass:Jr,tag:"tag:yaml.org,2002:map",resolve(e,t){return Ig(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Jr.from(e,t,n)};class pu extends vH{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(oh,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=tb(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const s=tb(t);if(typeof s!="number")return;const i=this.items[s];return!n&&Yn(i)?i.value:i}has(t){const n=tb(t);return typeof n=="number"&&n=0?t:null}const dh={collection:"seq",default:!0,nodeClass:pu,tag:"tag:yaml.org,2002:seq",resolve(e,t){return jg(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>pu.from(e,t,n)},G1={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,s){return t=Object.assign({actualString:!0},t),o2(e,t,n,s)}},K1={identify:e=>e==null,createNode:()=>new It(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new It(null),stringify:({source:e},t)=>typeof e=="string"&&K1.test.test(e)?e:t.options.nullStr},c2={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new It(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&c2.test.test(e)){const s=e[0]==="t"||e[0]==="T";if(t===s)return e}return t?n.options.trueStr:n.options.falseStr}};function La({format:e,minFractionDigits:t,tag:n,value:s}){if(typeof s=="bigint")return String(s);const i=typeof s=="number"?s:Number(s);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=Object.is(s,-0)?"-0":JSON.stringify(s);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(r)&&!r.includes("e")){let a=r.indexOf(".");a<0&&(a=r.length,r+=".");let l=t-(r.length-a-1);for(;l-- >0;)r+="0"}return r}const CH={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:La},IH={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():La(e)}},jH={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 It(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:La},q1=e=>typeof e=="bigint"||Number.isInteger(e),u2=(e,t,n,{intAsBigInt:s})=>s?BigInt(e):parseInt(e.substring(t),n);function RH(e,t,n){const{value:s}=e;return q1(s)&&s>=0?n+s.toString(t):La(e)}const OH={identify:e=>q1(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>u2(e,2,8,n),stringify:e=>RH(e,8,"0o")},MH={identify:q1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>u2(e,0,10,n),stringify:La},LH={identify:e=>q1(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>u2(e,2,16,n),stringify:e=>RH(e,16,"0x")},ZTe=[uh,dh,G1,K1,c2,OH,MH,LH,CH,IH,jH];function v3(e){return typeof e=="bigint"||Number.isInteger(e)}const nb=({value:e})=>JSON.stringify(e),JTe=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:nb},{identify:e=>e==null,createNode:()=>new It(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:nb},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:nb},{identify:v3,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})=>v3(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:nb}],eke={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},tke=[uh,dh].concat(JTe,eke),d2={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,"")),s=new Uint8Array(n.length);for(let i=0;i1&&t("Each pair must have its own sequence indicator");const i=s.items[0]||new qi(new It(null));if(s.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${s.commentBefore} +${i}${p}`}else return`${h}${a}${f.join(" ")}${a}${p}`}function yx({indent:e,options:{commentString:t}},n,s,i){if(s&&i&&(s=s.replace(/^\n+/,"")),s){const r=Uo(t(s),e);n.push(r.trimStart())}}function Fc(e,t){const n=Gn(t)?t.value:t;for(const s of e)if(Fs(s)&&(s.key===t||s.key===n||Gn(s.key)&&s.key.value===n))return s}class Xr extends NH{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Wl,t),this.items=[]}static from(t,n,s){const{keepUndefined:i,replacer:r}=s,a=new this(t),l=(c,u)=>{if(typeof r=="function")u=r.call(n,c,u);else if(Array.isArray(r)&&!r.includes(c))return;(u!==void 0||i)&&a.items.push(f2(c,u,s))};if(n instanceof Map)for(const[c,u]of n)l(c,u);else if(n&&typeof n=="object")for(const c of Object.keys(n))l(c,n[c]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){var a;let s;Fs(t)?s=t:!t||typeof t!="object"||!("key"in t)?s=new Ki(t,t==null?void 0:t.value):s=new Ki(t.key,t.value);const i=Fc(this.items,s.key),r=(a=this.schema)==null?void 0:a.sortMapEntries;if(i){if(!n)throw new Error(`Key ${s.key} already set`);Gn(i.value)&&_H(s.value)?i.value.value=s.value:i.value=s.value}else if(r){const l=this.items.findIndex(c=>r(s,c)<0);l===-1?this.items.push(s):this.items.splice(l,0,s)}else this.items.push(s)}delete(t){const n=Fc(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const s=Fc(this.items,t),i=s==null?void 0:s.value;return(!n&&Gn(i)?i.value:i)??void 0}has(t){return!!Fc(this.items,t)}set(t,n){this.add(new Ki(t,n),!0)}toJSON(t,n,s){const i=s?new s:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(i);for(const r of this.items)jH(n,i,r);return i}toString(t,n,s){if(!t)return JSON.stringify(this);for(const i of this.items)if(!Fs(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})),RH(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:s,onComment:n})}}const fh={collection:"map",default:!0,nodeClass:Xr,tag:"tag:yaml.org,2002:map",resolve(e,t){return Cg(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Xr.from(e,t,n)};class mu extends NH{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(ch,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=sb(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const s=sb(t);if(typeof s!="number")return;const i=this.items[s];return!n&&Gn(i)?i.value:i}has(t){const n=sb(t);return typeof n=="number"&&n=0?t:null}const hh={collection:"seq",default:!0,nodeClass:mu,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Ig(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>mu.from(e,t,n)},q1={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,s){return t=Object.assign({actualString:!0},t),d2(e,t,n,s)}},Y1={identify:e=>e==null,createNode:()=>new Ot(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ot(null),stringify:({source:e},t)=>typeof e=="string"&&Y1.test.test(e)?e:t.options.nullStr},h2={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Ot(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&h2.test.test(e)){const s=e[0]==="t"||e[0]==="T";if(t===s)return e}return t?n.options.trueStr:n.options.falseStr}};function Ma({format:e,minFractionDigits:t,tag:n,value:s}){if(typeof s=="bigint")return String(s);const i=typeof s=="number"?s:Number(s);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=Object.is(s,-0)?"-0":JSON.stringify(s);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(r)&&!r.includes("e")){let a=r.indexOf(".");a<0&&(a=r.length,r+=".");let l=t-(r.length-a-1);for(;l-- >0;)r+="0"}return r}const OH={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:Ma},MH={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():Ma(e)}},LH={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 Ot(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:Ma},W1=e=>typeof e=="bigint"||Number.isInteger(e),p2=(e,t,n,{intAsBigInt:s})=>s?BigInt(e):parseInt(e.substring(t),n);function DH(e,t,n){const{value:s}=e;return W1(s)&&s>=0?n+s.toString(t):Ma(e)}const PH={identify:e=>W1(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>p2(e,2,8,n),stringify:e=>DH(e,8,"0o")},BH={identify:W1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>p2(e,0,10,n),stringify:Ma},UH={identify:e=>W1(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>p2(e,2,16,n),stringify:e=>DH(e,16,"0x")},nke=[fh,hh,q1,Y1,h2,PH,BH,UH,OH,MH,LH];function N3(e){return typeof e=="bigint"||Number.isInteger(e)}const ib=({value:e})=>JSON.stringify(e),ske=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:ib},{identify:e=>e==null,createNode:()=>new Ot(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:ib},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:ib},{identify:N3,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})=>N3(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:ib}],ike={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},rke=[fh,hh].concat(ske,ike),m2={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,"")),s=new Uint8Array(n.length);for(let i=0;i1&&t("Each pair must have its own sequence indicator");const i=s.items[0]||new Ki(new Ot(null));if(s.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${s.commentBefore} ${i.key.commentBefore}`:s.commentBefore),s.comment){const r=i.value??i.key;r.comment=r.comment?`${s.comment} -${r.comment}`:s.comment}s=i}e.items[n]=Hs(s)?s:new qi(s)}}else t("Expected a sequence for this tag");return e}function PH(e,t,n){const{replacer:s}=n,i=new pu(e);i.tag="tag:yaml.org,2002:pairs";let r=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof s=="function"&&(a=s.call(t,String(r++),a));let l,c;if(Array.isArray(a))if(a.length===2)l=a[0],c=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)l=u[0],c=a[l];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else l=a;i.items.push(l2(l,c,n))}return i}const f2={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:DH,createNode:PH};class Zd extends pu{constructor(){super(),this.add=Jr.prototype.add.bind(this),this.delete=Jr.prototype.delete.bind(this),this.get=Jr.prototype.get.bind(this),this.has=Jr.prototype.has.bind(this),this.set=Jr.prototype.set.bind(this),this.tag=Zd.tag}toJSON(t,n){if(!n)return super.toJSON(t);const s=new Map;n!=null&&n.onCreate&&n.onCreate(s);for(const i of this.items){let r,a;if(Hs(i)?(r=sa(i.key,"",n),a=sa(i.value,r,n)):r=sa(i,"",n),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,a)}return s}static from(t,n,s){const i=PH(t,n,s),r=new this;return r.items=i.items,r}}Zd.tag="tag:yaml.org,2002:omap";const h2={collection:"seq",identify:e=>e instanceof Map,nodeClass:Zd,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=DH(e,t),s=[];for(const{key:i}of n.items)Yn(i)&&(s.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new Zd,n)},createNode:(e,t,n)=>Zd.from(e,t,n)};function BH({value:e,source:t},n){return t&&(e?UH:FH).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const UH={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 It(!0),stringify:BH},FH={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 It(!1),stringify:BH},nke={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:La},ske={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():La(e)}},ike={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 It(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const s=e.substring(n+1).replace(/_/g,"");s[s.length-1]==="0"&&(t.minFractionDigits=s.length)}return t},stringify:La},Rg=e=>typeof e=="bigint"||Number.isInteger(e);function Y1(e,t,n,{intAsBigInt:s}){const i=e[0];if((i==="-"||i==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),s){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 r=parseInt(e,n);return i==="-"?-1*r:r}function p2(e,t,n){const{value:s}=e;if(Rg(s)){const i=s.toString(t);return s<0?"-"+n+i.substr(1):n+i}return La(e)}const rke={identify:Rg,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Y1(e,2,2,n),stringify:e=>p2(e,2,"0b")},ake={identify:Rg,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Y1(e,1,8,n),stringify:e=>p2(e,8,"0")},oke={identify:Rg,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Y1(e,0,10,n),stringify:La},lke={identify:Rg,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Y1(e,2,16,n),stringify:e=>p2(e,16,"0x")};class Jd extends Jr{constructor(t){super(t),this.tag=Jd.tag}add(t){let n;Hs(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new qi(t.key,null):n=new qi(t,null),Uc(this.items,n.key)||this.items.push(n)}get(t,n){const s=Uc(this.items,t);return!n&&Hs(s)?Yn(s.key)?s.key.value:s.key:s}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 s=Uc(this.items,t);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new qi(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,s){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,s);throw new Error("Set items must all have null values")}static from(t,n,s){const{replacer:i}=s,r=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof i=="function"&&(a=i.call(n,a,a)),r.items.push(l2(a,null,s));return r}}Jd.tag="tag:yaml.org,2002:set";const m2={collection:"map",identify:e=>e instanceof Set,nodeClass:Jd,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Jd.from(e,t,n),resolve(e,t){if(Ig(e)){if(e.hasAllNullValues(!0))return Object.assign(new Jd,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function g2(e,t){const n=e[0],s=n==="-"||n==="+"?e.substring(1):e,i=a=>t?BigInt(a):Number(a),r=s.replace(/_/g,"").split(":").reduce((a,l)=>a*i(60)+i(l),i(0));return n==="-"?i(-1)*r:r}function $H(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return La(e);let s="";t<0&&(s="-",t*=n(-1));const i=n(60),r=[t%i];return t<60?r.unshift(0):(t=(t-r[0])/i,r.unshift(t%i),t>=60&&(t=(t-r[0])/i,r.unshift(t))),s+r.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const HH={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})=>g2(e,n),stringify:$H},zH={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=>g2(e,!1),stringify:$H},W1={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(W1.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,s,i,r,a,l]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0;let u=Date.UTC(n,s-1,i,r||0,a||0,l||0,c);const d=t[8];if(d&&d!=="Z"){let f=g2(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$/,""))??""},w3=[uh,dh,G1,K1,UH,FH,rke,ake,oke,lke,nke,ske,ike,d2,Fo,h2,f2,m2,HH,zH,W1],S3=new Map([["core",ZTe],["failsafe",[uh,dh,G1]],["json",tke],["yaml11",w3],["yaml-1.1",w3]]),_3={binary:d2,bool:c2,float:jH,floatExp:IH,floatNaN:CH,floatTime:zH,int:MH,intHex:LH,intOct:OH,intTime:HH,map:uh,merge:Fo,null:K1,omap:h2,pairs:f2,seq:dh,set:m2,timestamp:W1},cke={"tag:yaml.org,2002:binary":d2,"tag:yaml.org,2002:merge":Fo,"tag:yaml.org,2002:omap":h2,"tag:yaml.org,2002:pairs":f2,"tag:yaml.org,2002:set":m2,"tag:yaml.org,2002:timestamp":W1};function Tw(e,t,n){const s=S3.get(t);if(s&&!e)return n&&!s.includes(Fo)?s.concat(Fo):s.slice();let i=s;if(!i)if(Array.isArray(e))i=[];else{const r=Array.from(S3.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${r} or define customTags array`)}if(Array.isArray(e))for(const r of e)i=i.concat(r);else typeof e=="function"&&(i=e(i.slice()));return n&&(i=i.concat(Fo)),i.reduce((r,a)=>{const l=typeof a=="string"?_3[a]:a;if(!l){const c=JSON.stringify(a),u=Object.keys(_3).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${u}`)}return r.includes(l)||r.push(l),r},[])}const uke=(e,t)=>e.keyt.key?1:0;class b2{constructor({compat:t,customTags:n,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:a,toStringDefaults:l}){this.compat=Array.isArray(t)?Tw(t,"compat"):t?Tw(null,t):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?cke:{},this.tags=Tw(n,this.name,s),this.toStringOptions=l??null,Object.defineProperty(this,Vl,{value:uh}),Object.defineProperty(this,io,{value:G1}),Object.defineProperty(this,oh,{value:dh}),this.sortMapEntries=typeof a=="function"?a:a===!0?uke:null}clone(){const t=Object.create(b2.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}function dke(e,t){var c;const n=[];let s=t.directives===!0;if(t.directives!==!1&&e.directives){const u=e.directives.toString(e);u?(n.push(u),s=!0):e.directives.docStart&&(s=!0)}s&&n.push("---");const i=SH(e,t),{commentString:r}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=r(e.commentBefore);n.unshift(Mo(u,""))}let a=!1,l=null;if(e.contents){if($s(e.contents)){if(e.contents.spaceBefore&&s&&n.push(""),e.contents.commentBefore){const f=r(e.contents.commentBefore);n.push(Mo(f,""))}i.forceBlockIndent=!!e.comment,l=e.contents.comment}const u=l?void 0:()=>a=!0;let d=Rf(e.contents,i,()=>l=null,u);l&&(d+=Bc(d,"",r(l))),(d[0]==="|"||d[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${d}`:n.push(d)}else n.push(Rf(e.contents,i));if((c=e.directives)!=null&&c.docEnd)if(e.comment){const u=r(e.comment);u.includes(` -`)?(n.push("..."),n.push(Mo(u,""))):n.push(`... ${u}`)}else n.push("...");else{let u=e.comment;u&&a&&(u=u.replace(/^\n+/,"")),u&&((!a||l)&&n[n.length-1]!==""&&n.push(""),n.push(Mo(r(u),"")))}return n.join(` +${r.comment}`:s.comment}s=i}e.items[n]=Fs(s)?s:new Ki(s)}}else t("Expected a sequence for this tag");return e}function $H(e,t,n){const{replacer:s}=n,i=new mu(e);i.tag="tag:yaml.org,2002:pairs";let r=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof s=="function"&&(a=s.call(t,String(r++),a));let l,c;if(Array.isArray(a))if(a.length===2)l=a[0],c=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)l=u[0],c=a[l];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else l=a;i.items.push(f2(l,c,n))}return i}const g2={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:FH,createNode:$H};class ef extends mu{constructor(){super(),this.add=Xr.prototype.add.bind(this),this.delete=Xr.prototype.delete.bind(this),this.get=Xr.prototype.get.bind(this),this.has=Xr.prototype.has.bind(this),this.set=Xr.prototype.set.bind(this),this.tag=ef.tag}toJSON(t,n){if(!n)return super.toJSON(t);const s=new Map;n!=null&&n.onCreate&&n.onCreate(s);for(const i of this.items){let r,a;if(Fs(i)?(r=ea(i.key,"",n),a=ea(i.value,r,n)):r=ea(i,"",n),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,a)}return s}static from(t,n,s){const i=$H(t,n,s),r=new this;return r.items=i.items,r}}ef.tag="tag:yaml.org,2002:omap";const b2={collection:"seq",identify:e=>e instanceof Map,nodeClass:ef,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=FH(e,t),s=[];for(const{key:i}of n.items)Gn(i)&&(s.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new ef,n)},createNode:(e,t,n)=>ef.from(e,t,n)};function HH({value:e,source:t},n){return t&&(e?zH:VH).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const zH={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 Ot(!0),stringify:HH},VH={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 Ot(!1),stringify:HH},ake={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:Ma},oke={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():Ma(e)}},lke={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 Ot(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const s=e.substring(n+1).replace(/_/g,"");s[s.length-1]==="0"&&(t.minFractionDigits=s.length)}return t},stringify:Ma},jg=e=>typeof e=="bigint"||Number.isInteger(e);function X1(e,t,n,{intAsBigInt:s}){const i=e[0];if((i==="-"||i==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),s){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 r=parseInt(e,n);return i==="-"?-1*r:r}function y2(e,t,n){const{value:s}=e;if(jg(s)){const i=s.toString(t);return s<0?"-"+n+i.substr(1):n+i}return Ma(e)}const cke={identify:jg,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>X1(e,2,2,n),stringify:e=>y2(e,2,"0b")},uke={identify:jg,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>X1(e,1,8,n),stringify:e=>y2(e,8,"0")},dke={identify:jg,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>X1(e,0,10,n),stringify:Ma},fke={identify:jg,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>X1(e,2,16,n),stringify:e=>y2(e,16,"0x")};class tf extends Xr{constructor(t){super(t),this.tag=tf.tag}add(t){let n;Fs(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new Ki(t.key,null):n=new Ki(t,null),Fc(this.items,n.key)||this.items.push(n)}get(t,n){const s=Fc(this.items,t);return!n&&Fs(s)?Gn(s.key)?s.key.value:s.key:s}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 s=Fc(this.items,t);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new Ki(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,s){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,s);throw new Error("Set items must all have null values")}static from(t,n,s){const{replacer:i}=s,r=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof i=="function"&&(a=i.call(n,a,a)),r.items.push(f2(a,null,s));return r}}tf.tag="tag:yaml.org,2002:set";const x2={collection:"map",identify:e=>e instanceof Set,nodeClass:tf,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>tf.from(e,t,n),resolve(e,t){if(Cg(e)){if(e.hasAllNullValues(!0))return Object.assign(new tf,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function E2(e,t){const n=e[0],s=n==="-"||n==="+"?e.substring(1):e,i=a=>t?BigInt(a):Number(a),r=s.replace(/_/g,"").split(":").reduce((a,l)=>a*i(60)+i(l),i(0));return n==="-"?i(-1)*r:r}function GH(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return Ma(e);let s="";t<0&&(s="-",t*=n(-1));const i=n(60),r=[t%i];return t<60?r.unshift(0):(t=(t-r[0])/i,r.unshift(t%i),t>=60&&(t=(t-r[0])/i,r.unshift(t))),s+r.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const KH={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})=>E2(e,n),stringify:GH},qH={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=>E2(e,!1),stringify:GH},Q1={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(Q1.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,s,i,r,a,l]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0;let u=Date.UTC(n,s-1,i,r||0,a||0,l||0,c);const d=t[8];if(d&&d!=="Z"){let f=E2(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$/,""))??""},T3=[fh,hh,q1,Y1,zH,VH,cke,uke,dke,fke,ake,oke,lke,m2,Go,b2,g2,x2,KH,qH,Q1],k3=new Map([["core",nke],["failsafe",[fh,hh,q1]],["json",rke],["yaml11",T3],["yaml-1.1",T3]]),A3={binary:m2,bool:h2,float:LH,floatExp:MH,floatNaN:OH,floatTime:qH,int:BH,intHex:UH,intOct:PH,intTime:KH,map:fh,merge:Go,null:Y1,omap:b2,pairs:g2,seq:hh,set:x2,timestamp:Q1},hke={"tag:yaml.org,2002:binary":m2,"tag:yaml.org,2002:merge":Go,"tag:yaml.org,2002:omap":b2,"tag:yaml.org,2002:pairs":g2,"tag:yaml.org,2002:set":x2,"tag:yaml.org,2002:timestamp":Q1};function Cw(e,t,n){const s=k3.get(t);if(s&&!e)return n&&!s.includes(Go)?s.concat(Go):s.slice();let i=s;if(!i)if(Array.isArray(e))i=[];else{const r=Array.from(k3.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${r} or define customTags array`)}if(Array.isArray(e))for(const r of e)i=i.concat(r);else typeof e=="function"&&(i=e(i.slice()));return n&&(i=i.concat(Go)),i.reduce((r,a)=>{const l=typeof a=="string"?A3[a]:a;if(!l){const c=JSON.stringify(a),u=Object.keys(A3).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${u}`)}return r.includes(l)||r.push(l),r},[])}const pke=(e,t)=>e.keyt.key?1:0;class v2{constructor({compat:t,customTags:n,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:a,toStringDefaults:l}){this.compat=Array.isArray(t)?Cw(t,"compat"):t?Cw(null,t):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?hke:{},this.tags=Cw(n,this.name,s),this.toStringOptions=l??null,Object.defineProperty(this,Wl,{value:fh}),Object.defineProperty(this,io,{value:q1}),Object.defineProperty(this,ch,{value:hh}),this.sortMapEntries=typeof a=="function"?a:a===!0?pke:null}clone(){const t=Object.create(v2.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}function mke(e,t){var c;const n=[];let s=t.directives===!0;if(t.directives!==!1&&e.directives){const u=e.directives.toString(e);u?(n.push(u),s=!0):e.directives.docStart&&(s=!0)}s&&n.push("---");const i=kH(e,t),{commentString:r}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=r(e.commentBefore);n.unshift(Uo(u,""))}let a=!1,l=null;if(e.contents){if(Us(e.contents)){if(e.contents.spaceBefore&&s&&n.push(""),e.contents.commentBefore){const f=r(e.contents.commentBefore);n.push(Uo(f,""))}i.forceBlockIndent=!!e.comment,l=e.contents.comment}const u=l?void 0:()=>a=!0;let d=Mf(e.contents,i,()=>l=null,u);l&&(d+=Uc(d,"",r(l))),(d[0]==="|"||d[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${d}`:n.push(d)}else n.push(Mf(e.contents,i));if((c=e.directives)!=null&&c.docEnd)if(e.comment){const u=r(e.comment);u.includes(` +`)?(n.push("..."),n.push(Uo(u,""))):n.push(`... ${u}`)}else n.push("...");else{let u=e.comment;u&&a&&(u=u.replace(/^\n+/,"")),u&&((!a||l)&&n[n.length-1]!==""&&n.push(""),n.push(Uo(r(u),"")))}return n.join(` `)+` -`}class Og{constructor(t,n,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ra,{value:pN});let i=null;typeof n=="function"||Array.isArray(n)?i=n:s===void 0&&n&&(s=n,n=void 0);const r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=r;let{version:a}=r;s!=null&&s._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new Vi({version:a}),this.setSchema(a,s),this.contents=t===void 0?null:this.createNode(t,i,s)}clone(){const t=Object.create(Og.prototype,{[ra]:{value:pN}});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=$s(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Ju(this.contents)&&this.contents.add(t)}addIn(t,n){Ju(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const s=yH(this);t.anchor=!n||s.has(n)?xH(n||"a",s):n}return new a2(t.anchor)}createNode(t,n,s){let i;if(typeof n=="function")t=n.call({"":t},"",t),i=n;else if(Array.isArray(n)){const v=x=>typeof x=="number"||x instanceof String||x instanceof Number,y=n.filter(v).map(String);y.length>0&&(n=n.concat(y)),i=n}else s===void 0&&n&&(s=n,n=void 0);const{aliasDuplicateObjects:r,anchorPrefix:a,flow:l,keepUndefined:c,onTagObj:u,tag:d}=s??{},{onAnchor:f,setAnchors:h,sourceObjects:p}=UTe(this,a||"a"),m={aliasDuplicateObjects:r??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:u,replacer:i,schema:this.schema,sourceObjects:p},b=Hm(t,d,m);return l&&Us(b)&&(b.flow=!0),h(),b}createPair(t,n,s={}){const i=this.createNode(t,null,s),r=this.createNode(n,null,s);return new qi(i,r)}delete(t){return Ju(this.contents)?this.contents.delete(t):!1}deleteIn(t){return mp(t)?this.contents==null?!1:(this.contents=null,!0):Ju(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return Us(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return mp(t)?!n&&Yn(this.contents)?this.contents.value:this.contents:Us(this.contents)?this.contents.getIn(t,n):void 0}has(t){return Us(this.contents)?this.contents.has(t):!1}hasIn(t){return mp(t)?this.contents!==void 0:Us(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=mx(this.schema,[t],n):Ju(this.contents)&&this.contents.set(t,n)}setIn(t,n){mp(t)?this.contents=n:this.contents==null?this.contents=mx(this.schema,Array.from(t),n):Ju(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let s;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Vi({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new Vi({version:t}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=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(s)this.schema=new b2(Object.assign(s,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:s,maxAliasCount:i,onAnchor:r,reviver:a}={}){const l={anchors:new Map,doc:this,keep:!t,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=sa(this.contents,n??"",l);if(typeof r=="function")for(const{count:u,res:d}of l.anchors.values())r(d,u);return typeof a=="function"?Dd(a,{"":c},"",c):c}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 dke(this,t)}}function Ju(e){if(Us(e))return!0;throw new Error("Expected a YAML collection as document contents")}class VH extends Error{constructor(t,n,s,i){super(),this.name=t,this.code=s,this.message=i,this.pos=n}}class gp extends VH{constructor(t,n,s){super("YAMLParseError",t,n,s)}}class fke extends VH{constructor(t,n,s){super("YAMLWarning",t,n,s)}}const N3=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(l=>t.linePos(l));const{line:s,col:i}=n.linePos[0];n.message+=` at line ${s}, column ${i}`;let r=i-1,a=e.substring(t.lineStarts[s-1],t.lineStarts[s]).replace(/[\n\r]+$/,"");if(r>=60&&a.length>80){const l=Math.min(r-39,a.length-79);a="…"+a.substring(l),r-=l-1}if(a.length>80&&(a=a.substring(0,79)+"…"),s>1&&/^ *$/.test(a.substring(0,r))){let l=e.substring(t.lineStarts[s-2],t.lineStarts[s-1]);l.length>80&&(l=l.substring(0,79)+`… +`}class Rg{constructor(t,n,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,na,{value:yN});let i=null;typeof n=="function"||Array.isArray(n)?i=n:s===void 0&&n&&(s=n,n=void 0);const r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=r;let{version:a}=r;s!=null&&s._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new zi({version:a}),this.setSchema(a,s),this.contents=t===void 0?null:this.createNode(t,i,s)}clone(){const t=Object.create(Rg.prototype,{[na]:{value:yN}});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=Us(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){td(this.contents)&&this.contents.add(t)}addIn(t,n){td(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const s=wH(this);t.anchor=!n||s.has(n)?SH(n||"a",s):n}return new u2(t.anchor)}createNode(t,n,s){let i;if(typeof n=="function")t=n.call({"":t},"",t),i=n;else if(Array.isArray(n)){const v=x=>typeof x=="number"||x instanceof String||x instanceof Number,y=n.filter(v).map(String);y.length>0&&(n=n.concat(y)),i=n}else s===void 0&&n&&(s=n,n=void 0);const{aliasDuplicateObjects:r,anchorPrefix:a,flow:l,keepUndefined:c,onTagObj:u,tag:d}=s??{},{onAnchor:f,setAnchors:h,sourceObjects:p}=zTe(this,a||"a"),m={aliasDuplicateObjects:r??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:u,replacer:i,schema:this.schema,sourceObjects:p},b=$m(t,d,m);return l&&Ps(b)&&(b.flow=!0),h(),b}createPair(t,n,s={}){const i=this.createNode(t,null,s),r=this.createNode(n,null,s);return new Ki(i,r)}delete(t){return td(this.contents)?this.contents.delete(t):!1}deleteIn(t){return pp(t)?this.contents==null?!1:(this.contents=null,!0):td(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return Ps(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return pp(t)?!n&&Gn(this.contents)?this.contents.value:this.contents:Ps(this.contents)?this.contents.getIn(t,n):void 0}has(t){return Ps(this.contents)?this.contents.has(t):!1}hasIn(t){return pp(t)?this.contents!==void 0:Ps(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=bx(this.schema,[t],n):td(this.contents)&&this.contents.set(t,n)}setIn(t,n){pp(t)?this.contents=n:this.contents==null?this.contents=bx(this.schema,Array.from(t),n):td(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let s;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new zi({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new zi({version:t}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=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(s)this.schema=new v2(Object.assign(s,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:s,maxAliasCount:i,onAnchor:r,reviver:a}={}){const l={anchors:new Map,doc:this,keep:!t,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=ea(this.contents,n??"",l);if(typeof r=="function")for(const{count:u,res:d}of l.anchors.values())r(d,u);return typeof a=="function"?Bd(a,{"":c},"",c):c}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 mke(this,t)}}function td(e){if(Ps(e))return!0;throw new Error("Expected a YAML collection as document contents")}class YH extends Error{constructor(t,n,s,i){super(),this.name=t,this.code=s,this.message=i,this.pos=n}}class mp extends YH{constructor(t,n,s){super("YAMLParseError",t,n,s)}}class gke extends YH{constructor(t,n,s){super("YAMLWarning",t,n,s)}}const C3=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(l=>t.linePos(l));const{line:s,col:i}=n.linePos[0];n.message+=` at line ${s}, column ${i}`;let r=i-1,a=e.substring(t.lineStarts[s-1],t.lineStarts[s]).replace(/[\n\r]+$/,"");if(r>=60&&a.length>80){const l=Math.min(r-39,a.length-79);a="…"+a.substring(l),r-=l-1}if(a.length>80&&(a=a.substring(0,79)+"…"),s>1&&/^ *$/.test(a.substring(0,r))){let l=e.substring(t.lineStarts[s-2],t.lineStarts[s-1]);l.length>80&&(l=l.substring(0,79)+`… `),a=l+a}if(/[^ ]/.test(a)){let l=1;const c=n.linePos[1];(c==null?void 0:c.line)===s&&c.col>i&&(l=Math.max(1,Math.min(c.col-i,80-r)));const u=" ".repeat(r)+"^".repeat(l);n.message+=`: ${a} ${u} -`}};function Of(e,{flow:t,indicator:n,next:s,offset:i,onError:r,parentIndent:a,startOnNewline:l}){let c=!1,u=l,d=l,f="",h="",p=!1,m=!1,b=null,v=null,y=null,x=null,E=null,w=null,_=null;for(const T of e)switch(m&&(T.type!=="space"&&T.type!=="newline"&&T.type!=="comma"&&r(T.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),b&&(u&&T.type!=="comment"&&T.type!=="newline"&&r(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),b=null),T.type){case"space":!t&&(n!=="doc-start"||(s==null?void 0:s.type)!=="flow-collection")&&T.source.includes(" ")&&(b=T),d=!0;break;case"comment":{d||r(T,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const C=T.source.substring(1)||" ";f?f+=h+C:f=C,h="",u=!1;break}case"newline":u?f?f+=T.source:(!w||n!=="seq-item-ind")&&(c=!0):h+=T.source,u=!0,p=!0,(v||y)&&(x=T),d=!0;break;case"anchor":v&&r(T,"MULTIPLE_ANCHORS","A node can have at most one anchor"),T.source.endsWith(":")&&r(T.offset+T.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),v=T,_??(_=T.offset),u=!1,d=!1,m=!0;break;case"tag":{y&&r(T,"MULTIPLE_TAGS","A node can have at most one tag"),y=T,_??(_=T.offset),u=!1,d=!1,m=!0;break}case n:(v||y)&&r(T,"BAD_PROP_ORDER",`Anchors and tags must be after the ${T.source} indicator`),w&&r(T,"UNEXPECTED_TOKEN",`Unexpected ${T.source} in ${t??"collection"}`),w=T,u=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){E&&r(T,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),E=T,u=!1,d=!1;break}default:r(T,"UNEXPECTED_TOKEN",`Unexpected ${T.type} token`),u=!1,d=!1}const S=e[e.length-1],k=S?S.offset+S.source.length:i;return m&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&r(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b&&(u&&b.indent<=a||(s==null?void 0:s.type)==="block-map"||(s==null?void 0:s.type)==="block-seq")&&r(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:E,found:w,spaceBefore:c,comment:f,hasNewline:p,anchor:v,tag:y,newlineAfterProp:x,end:k,start:_??k}}function zm(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(zm(t.key)||zm(t.value))return!0}return!1;default:return!0}}function yN(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const s=t.end[0];s.indent===e&&(s.source==="]"||s.source==="}")&&zm(t)&&n(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function GH(e,t,n){const{uniqueKeys:s}=e.options;if(s===!1)return!1;const i=typeof s=="function"?s:(r,a)=>r===a||Yn(r)&&Yn(a)&&r.value===a.value;return t.some(r=>i(r.key,n))}const T3="All mapping items must start at the same column";function hke({composeNode:e,composeEmptyNode:t},n,s,i,r){var d;const a=(r==null?void 0:r.nodeClass)??Jr,l=new a(n.schema);n.atRoot&&(n.atRoot=!1);let c=s.offset,u=null;for(const f of s.items){const{start:h,key:p,sep:m,value:b}=f,v=Of(h,{indicator:"explicit-key-ind",next:p??(m==null?void 0:m[0]),offset:c,onError:i,parentIndent:s.indent,startOnNewline:!0}),y=!v.found;if(y){if(p&&(p.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==s.indent&&i(c,"BAD_INDENT",T3)),!v.anchor&&!v.tag&&!m){u=v.end,v.comment&&(l.comment?l.comment+=` -`+v.comment:l.comment=v.comment);continue}(v.newlineAfterProp||zm(p))&&i(p??h[h.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((d=v.found)==null?void 0:d.indent)!==s.indent&&i(c,"BAD_INDENT",T3);n.atKey=!0;const x=v.end,E=p?e(n,p,v,i):t(n,x,h,null,v,i);n.schema.compat&&yN(s.indent,p,i),n.atKey=!1,GH(n,l.items,E)&&i(x,"DUPLICATE_KEY","Map keys must be unique");const w=Of(m??[],{indicator:"map-value-ind",next:b,offset:E.range[2],onError:i,parentIndent:s.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=w.end,w.found){y&&((b==null?void 0:b.type)==="block-map"&&!w.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&v.starte&&(e.type==="block-map"||e.type==="block-seq");function mke({composeNode:e,composeEmptyNode:t},n,s,i,r){var v;const a=s.start.source==="{",l=a?"flow map":"flow sequence",c=(r==null?void 0:r.nodeClass)??(a?Jr:pu),u=new c(n.schema);u.flow=!0;const d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=s.offset+s.start.source.length;for(let y=0;y0){const y=Mg(m,b,n.options.strict,i);y.comment&&(u.comment?u.comment+=` -`+y.comment:u.comment=y.comment),u.range=[s.offset,b,y.offset]}else u.range=[s.offset,b,b];return u}function Cw(e,t,n,s,i,r){const a=n.type==="block-map"?hke(e,t,n,s,r):n.type==="block-seq"?pke(e,t,n,s,r):mke(e,t,n,s,r),l=a.constructor;return i==="!"||i===l.tagName?(a.tag=l.tagName,a):(i&&(a.tag=i),a)}function gke(e,t,n,s,i){var h;const r=s.tag,a=r?t.directives.tagName(r.source,p=>i(r,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){const{anchor:p,newlineAfterProp:m}=s,b=p&&r?p.offset>r.offset?p:r:p??r;b&&(!m||m.offsetp.tag===a&&p.collection===l);if(!c){const p=t.schema.knownTags[a];if((p==null?void 0:p.collection)===l)t.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else return p?i(r,"BAD_COLLECTION_TYPE",`${p.tag} used for ${l} collection, but expects ${p.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),Cw(e,t,n,i,a)}const u=Cw(e,t,n,i,a,c),d=((h=c.resolve)==null?void 0:h.call(c,u,p=>i(r,"TAG_RESOLVE_FAILED",p),t.options))??u,f=$s(d)?d:new It(d);return f.range=u.range,f.tag=a,c!=null&&c.format&&(f.format=c.format),f}function bke(e,t,n){const s=t.offset,i=yke(t,e.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[s,s,s]};const r=i.mode===">"?It.BLOCK_FOLDED:It.BLOCK_LITERAL,a=t.source?xke(t.source):[];let l=a.length;for(let b=a.length-1;b>=0;--b){const v=a[b][1];if(v===""||v==="\r")l=b;else break}if(l===0){const b=i.chomp==="+"&&a.length>0?` +`}};function Lf(e,{flow:t,indicator:n,next:s,offset:i,onError:r,parentIndent:a,startOnNewline:l}){let c=!1,u=l,d=l,f="",h="",p=!1,m=!1,b=null,v=null,y=null,x=null,E=null,w=null,_=null;for(const T of e)switch(m&&(T.type!=="space"&&T.type!=="newline"&&T.type!=="comma"&&r(T.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),b&&(u&&T.type!=="comment"&&T.type!=="newline"&&r(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),b=null),T.type){case"space":!t&&(n!=="doc-start"||(s==null?void 0:s.type)!=="flow-collection")&&T.source.includes(" ")&&(b=T),d=!0;break;case"comment":{d||r(T,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const C=T.source.substring(1)||" ";f?f+=h+C:f=C,h="",u=!1;break}case"newline":u?f?f+=T.source:(!w||n!=="seq-item-ind")&&(c=!0):h+=T.source,u=!0,p=!0,(v||y)&&(x=T),d=!0;break;case"anchor":v&&r(T,"MULTIPLE_ANCHORS","A node can have at most one anchor"),T.source.endsWith(":")&&r(T.offset+T.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),v=T,_??(_=T.offset),u=!1,d=!1,m=!0;break;case"tag":{y&&r(T,"MULTIPLE_TAGS","A node can have at most one tag"),y=T,_??(_=T.offset),u=!1,d=!1,m=!0;break}case n:(v||y)&&r(T,"BAD_PROP_ORDER",`Anchors and tags must be after the ${T.source} indicator`),w&&r(T,"UNEXPECTED_TOKEN",`Unexpected ${T.source} in ${t??"collection"}`),w=T,u=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){E&&r(T,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),E=T,u=!1,d=!1;break}default:r(T,"UNEXPECTED_TOKEN",`Unexpected ${T.type} token`),u=!1,d=!1}const S=e[e.length-1],k=S?S.offset+S.source.length:i;return m&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&r(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b&&(u&&b.indent<=a||(s==null?void 0:s.type)==="block-map"||(s==null?void 0:s.type)==="block-seq")&&r(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:E,found:w,spaceBefore:c,comment:f,hasNewline:p,anchor:v,tag:y,newlineAfterProp:x,end:k,start:_??k}}function Hm(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(Hm(t.key)||Hm(t.value))return!0}return!1;default:return!0}}function wN(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const s=t.end[0];s.indent===e&&(s.source==="]"||s.source==="}")&&Hm(t)&&n(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function WH(e,t,n){const{uniqueKeys:s}=e.options;if(s===!1)return!1;const i=typeof s=="function"?s:(r,a)=>r===a||Gn(r)&&Gn(a)&&r.value===a.value;return t.some(r=>i(r.key,n))}const I3="All mapping items must start at the same column";function bke({composeNode:e,composeEmptyNode:t},n,s,i,r){var d;const a=(r==null?void 0:r.nodeClass)??Xr,l=new a(n.schema);n.atRoot&&(n.atRoot=!1);let c=s.offset,u=null;for(const f of s.items){const{start:h,key:p,sep:m,value:b}=f,v=Lf(h,{indicator:"explicit-key-ind",next:p??(m==null?void 0:m[0]),offset:c,onError:i,parentIndent:s.indent,startOnNewline:!0}),y=!v.found;if(y){if(p&&(p.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==s.indent&&i(c,"BAD_INDENT",I3)),!v.anchor&&!v.tag&&!m){u=v.end,v.comment&&(l.comment?l.comment+=` +`+v.comment:l.comment=v.comment);continue}(v.newlineAfterProp||Hm(p))&&i(p??h[h.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((d=v.found)==null?void 0:d.indent)!==s.indent&&i(c,"BAD_INDENT",I3);n.atKey=!0;const x=v.end,E=p?e(n,p,v,i):t(n,x,h,null,v,i);n.schema.compat&&wN(s.indent,p,i),n.atKey=!1,WH(n,l.items,E)&&i(x,"DUPLICATE_KEY","Map keys must be unique");const w=Lf(m??[],{indicator:"map-value-ind",next:b,offset:E.range[2],onError:i,parentIndent:s.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=w.end,w.found){y&&((b==null?void 0:b.type)==="block-map"&&!w.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&v.starte&&(e.type==="block-map"||e.type==="block-seq");function xke({composeNode:e,composeEmptyNode:t},n,s,i,r){var v;const a=s.start.source==="{",l=a?"flow map":"flow sequence",c=(r==null?void 0:r.nodeClass)??(a?Xr:mu),u=new c(n.schema);u.flow=!0;const d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=s.offset+s.start.source.length;for(let y=0;y0){const y=Og(m,b,n.options.strict,i);y.comment&&(u.comment?u.comment+=` +`+y.comment:u.comment=y.comment),u.range=[s.offset,b,y.offset]}else u.range=[s.offset,b,b];return u}function Rw(e,t,n,s,i,r){const a=n.type==="block-map"?bke(e,t,n,s,r):n.type==="block-seq"?yke(e,t,n,s,r):xke(e,t,n,s,r),l=a.constructor;return i==="!"||i===l.tagName?(a.tag=l.tagName,a):(i&&(a.tag=i),a)}function Eke(e,t,n,s,i){var h;const r=s.tag,a=r?t.directives.tagName(r.source,p=>i(r,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){const{anchor:p,newlineAfterProp:m}=s,b=p&&r?p.offset>r.offset?p:r:p??r;b&&(!m||m.offsetp.tag===a&&p.collection===l);if(!c){const p=t.schema.knownTags[a];if((p==null?void 0:p.collection)===l)t.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else return p?i(r,"BAD_COLLECTION_TYPE",`${p.tag} used for ${l} collection, but expects ${p.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),Rw(e,t,n,i,a)}const u=Rw(e,t,n,i,a,c),d=((h=c.resolve)==null?void 0:h.call(c,u,p=>i(r,"TAG_RESOLVE_FAILED",p),t.options))??u,f=Us(d)?d:new Ot(d);return f.range=u.range,f.tag=a,c!=null&&c.format&&(f.format=c.format),f}function vke(e,t,n){const s=t.offset,i=wke(t,e.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[s,s,s]};const r=i.mode===">"?Ot.BLOCK_FOLDED:Ot.BLOCK_LITERAL,a=t.source?Ske(t.source):[];let l=a.length;for(let b=a.length-1;b>=0;--b){const v=a[b][1];if(v===""||v==="\r")l=b;else break}if(l===0){const b=i.chomp==="+"&&a.length>0?` `.repeat(Math.max(1,a.length-1)):"";let v=s+i.length;return t.source&&(v+=t.source.length),{value:b,type:r,comment:i.comment,range:[s,v,v]}}let c=t.indent+i.indent,u=t.offset+i.length,d=0;for(let b=0;bc&&(c=v.length);else{v.length=l;--b)a[b][0].length>c&&(l=b+1);let f="",h="",p=!1;for(let b=0;bc||y[0]===" "?(h===" "?h=` `:!p&&h===` `&&(h=` @@ -1018,78 +1018,78 @@ ${u} `+a[b][0].slice(c);f[f.length-1]!==` `&&(f+=` `);break;default:f+=` -`}const m=s+i.length+t.source.length;return{value:f,type:r,comment:i.comment,range:[s,m,m]}}function yke({offset:e,props:t},n,s){if(t[0].type!=="block-scalar-header")return s(t[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:i}=t[0],r=i[0];let a=0,l="",c=-1;for(let h=1;hn(s+h,p,m);switch(i){case"scalar":l=It.PLAIN,c=vke(r,u);break;case"single-quoted-scalar":l=It.QUOTE_SINGLE,c=wke(r,u);break;case"double-quoted-scalar":l=It.QUOTE_DOUBLE,c=Ske(r,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[s,s+r.length,s+r.length]}}const d=s+r.length,f=Mg(a,d,t,n);return{value:c,type:l,comment:f.comment,range:[s,d,f.offset]}}function vke(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}`),KH(e)}function wke(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),KH(e.slice(1,-1)).replace(/''/g,"'")}function KH(e){let t,n;try{t=new RegExp(`(.*?)(?n(s+h,p,m);switch(i){case"scalar":l=Ot.PLAIN,c=Nke(r,u);break;case"single-quoted-scalar":l=Ot.QUOTE_SINGLE,c=Tke(r,u);break;case"double-quoted-scalar":l=Ot.QUOTE_DOUBLE,c=kke(r,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[s,s+r.length,s+r.length]}}const d=s+r.length,f=Og(a,d,t,n);return{value:c,type:l,comment:f.comment,range:[s,d,f.offset]}}function Nke(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}`),XH(e)}function Tke(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),XH(e.slice(1,-1)).replace(/''/g,"'")}function XH(e){let t,n;try{t=new RegExp(`(.*?)(?r?e.slice(r,s+1):i)}else n+=i}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function _ke(e,t){let n="",s=e[t+1];for(;(s===" "||s===" "||s===` +`)&&(n+=s>r?e.slice(r,s+1):i)}else n+=i}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function Ake(e,t){let n="",s=e[t+1];for(;(s===" "||s===" "||s===` `||s==="\r")&&!(s==="\r"&&e[t+2]!==` `);)s===` `&&(n+=` -`),t+=1,s=e[t+1];return n||(n=" "),{fold:n,offset:t}}const Nke={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Tke(e,t,n,s){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 l=e.substr(t-2,n+2);return s(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),l}}function qH(e,t,n,s){const{value:i,type:r,comment:a,range:l}=t.type==="block-scalar"?bke(e,t,s):Eke(t,e.options.strict,s),c=n?e.directives.tagName(n.source,f=>s(n,"TAG_RESOLVE_FAILED",f)):null;let u;e.options.stringKeys&&e.atKey?u=e.schema[io]:c?u=kke(e.schema,i,c,n,s):t.type==="scalar"?u=Ake(e,i,t,s):u=e.schema[io];let d;try{const f=u.resolve(i,h=>s(n??t,"TAG_RESOLVE_FAILED",h),e.options);d=Yn(f)?f:new It(f)}catch(f){const h=f instanceof Error?f.message:String(f);s(n??t,"TAG_RESOLVE_FAILED",h),d=new It(i)}return d.range=l,d.source=i,r&&(d.type=r),c&&(d.tag=c),u.format&&(d.format=u.format),a&&(d.comment=a),d}function kke(e,t,n,s,i){var l;if(n==="!")return e[io];const r=[];for(const c of e.tags)if(!c.collection&&c.tag===n)if(c.default&&c.test)r.push(c);else return c;for(const c of r)if((l=c.test)!=null&&l.test(t))return c;const a=e.knownTags[n];return a&&!a.collection?(e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[io])}function Ake({atKey:e,directives:t,schema:n},s,i,r){const a=n.tags.find(l=>{var c;return(l.default===!0||e&&l.default==="key")&&((c=l.test)==null?void 0:c.test(s))})||n[io];if(n.compat){const l=n.compat.find(c=>{var u;return c.default&&((u=c.test)==null?void 0:u.test(s))})??n[io];if(a.tag!==l.tag){const c=t.tagString(a.tag),u=t.tagString(l.tag),d=`Value may be parsed as either ${c} or ${u}`;r(i,"TAG_RESOLVE_FAILED",d,!0)}}return a}function Cke(e,t,n){if(t){n??(n=t.length);for(let s=n-1;s>=0;--s){let i=t[s];switch(i.type){case"space":case"comment":case"newline":e-=i.source.length;continue}for(i=t[++s];(i==null?void 0:i.type)==="space";)e+=i.source.length,i=t[++s];break}}return e}const Ike={composeNode:YH,composeEmptyNode:y2};function YH(e,t,n,s){const i=e.atKey,{spaceBefore:r,comment:a,anchor:l,tag:c}=n;let u,d=!0;switch(t.type){case"alias":u=jke(e,t,s),(l||c)&&s(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=qH(e,t,c,s),l&&(u.anchor=l.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=gke(Ike,e,t,n,s),l&&(u.anchor=l.source.substring(1))}catch(f){const h=f instanceof Error?f.message:String(f);s(t,"RESOURCE_EXHAUSTION",h)}break;default:{const f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;s(t,"UNEXPECTED_TOKEN",f),d=!1}}return u??(u=y2(e,t.offset,void 0,null,n,s)),l&&u.anchor===""&&s(l,"BAD_ALIAS","Anchor cannot be an empty string"),i&&e.options.stringKeys&&(!Yn(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&s(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(u.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?u.comment=a:u.commentBefore=a),e.options.keepSourceTokens&&d&&(u.srcToken=t),u}function y2(e,t,n,s,{spaceBefore:i,comment:r,anchor:a,tag:l,end:c},u){const d={type:"scalar",offset:Cke(t,n,s),indent:-1,source:""},f=qH(e,d,l,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),r&&(f.comment=r,f.range[2]=c),f}function jke({options:e},{offset:t,source:n,end:s},i){const r=new a2(n.substring(1));r.source===""&&i(t,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const a=t+n.length,l=Mg(s,a,e.strict,i);return r.range=[t,a,l.offset],l.comment&&(r.comment=l.comment),r}function Rke(e,t,{offset:n,start:s,value:i,end:r},a){const l=Object.assign({_directives:t},e),c=new Og(void 0,l),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=Of(s,{indicator:"doc-start",next:i??(r==null?void 0:r[0]),offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(c.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")),c.contents=i?YH(u,i,d,a):y2(u,d.end,s,null,d,a);const f=c.contents.range[2],h=Mg(r,f,!1,a);return h.comment&&(c.comment=h.comment),c.range=[n,f,h.offset],c}function Qh(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 k3(e){var i;let t="",n=!1,s=!1;for(let r=0;rs(n,"TAG_RESOLVE_FAILED",f)):null;let u;e.options.stringKeys&&e.atKey?u=e.schema[io]:c?u=jke(e.schema,i,c,n,s):t.type==="scalar"?u=Rke(e,i,t,s):u=e.schema[io];let d;try{const f=u.resolve(i,h=>s(n??t,"TAG_RESOLVE_FAILED",h),e.options);d=Gn(f)?f:new Ot(f)}catch(f){const h=f instanceof Error?f.message:String(f);s(n??t,"TAG_RESOLVE_FAILED",h),d=new Ot(i)}return d.range=l,d.source=i,r&&(d.type=r),c&&(d.tag=c),u.format&&(d.format=u.format),a&&(d.comment=a),d}function jke(e,t,n,s,i){var l;if(n==="!")return e[io];const r=[];for(const c of e.tags)if(!c.collection&&c.tag===n)if(c.default&&c.test)r.push(c);else return c;for(const c of r)if((l=c.test)!=null&&l.test(t))return c;const a=e.knownTags[n];return a&&!a.collection?(e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[io])}function Rke({atKey:e,directives:t,schema:n},s,i,r){const a=n.tags.find(l=>{var c;return(l.default===!0||e&&l.default==="key")&&((c=l.test)==null?void 0:c.test(s))})||n[io];if(n.compat){const l=n.compat.find(c=>{var u;return c.default&&((u=c.test)==null?void 0:u.test(s))})??n[io];if(a.tag!==l.tag){const c=t.tagString(a.tag),u=t.tagString(l.tag),d=`Value may be parsed as either ${c} or ${u}`;r(i,"TAG_RESOLVE_FAILED",d,!0)}}return a}function Oke(e,t,n){if(t){n??(n=t.length);for(let s=n-1;s>=0;--s){let i=t[s];switch(i.type){case"space":case"comment":case"newline":e-=i.source.length;continue}for(i=t[++s];(i==null?void 0:i.type)==="space";)e+=i.source.length,i=t[++s];break}}return e}const Mke={composeNode:ZH,composeEmptyNode:w2};function ZH(e,t,n,s){const i=e.atKey,{spaceBefore:r,comment:a,anchor:l,tag:c}=n;let u,d=!0;switch(t.type){case"alias":u=Lke(e,t,s),(l||c)&&s(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=QH(e,t,c,s),l&&(u.anchor=l.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=Eke(Mke,e,t,n,s),l&&(u.anchor=l.source.substring(1))}catch(f){const h=f instanceof Error?f.message:String(f);s(t,"RESOURCE_EXHAUSTION",h)}break;default:{const f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;s(t,"UNEXPECTED_TOKEN",f),d=!1}}return u??(u=w2(e,t.offset,void 0,null,n,s)),l&&u.anchor===""&&s(l,"BAD_ALIAS","Anchor cannot be an empty string"),i&&e.options.stringKeys&&(!Gn(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&s(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(u.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?u.comment=a:u.commentBefore=a),e.options.keepSourceTokens&&d&&(u.srcToken=t),u}function w2(e,t,n,s,{spaceBefore:i,comment:r,anchor:a,tag:l,end:c},u){const d={type:"scalar",offset:Oke(t,n,s),indent:-1,source:""},f=QH(e,d,l,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),r&&(f.comment=r,f.range[2]=c),f}function Lke({options:e},{offset:t,source:n,end:s},i){const r=new u2(n.substring(1));r.source===""&&i(t,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const a=t+n.length,l=Og(s,a,e.strict,i);return r.range=[t,a,l.offset],l.comment&&(r.comment=l.comment),r}function Dke(e,t,{offset:n,start:s,value:i,end:r},a){const l=Object.assign({_directives:t},e),c=new Rg(void 0,l),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=Lf(s,{indicator:"doc-start",next:i??(r==null?void 0:r[0]),offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(c.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")),c.contents=i?ZH(u,i,d,a):w2(u,d.end,s,null,d,a);const f=c.contents.range[2],h=Og(r,f,!1,a);return h.comment&&(c.comment=h.comment),c.range=[n,f,h.offset],c}function Xh(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 j3(e){var i;let t="",n=!1,s=!1;for(let r=0;r{const a=Qh(n);r?this.warnings.push(new fke(a,s,i)):this.errors.push(new gp(a,s,i))},this.directives=new Vi({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:s,afterEmptyLine:i}=k3(this.prelude);if(s){const r=t.contents;if(n)t.comment=t.comment?`${t.comment} -${s}`:s;else if(i||t.directives.docStart||!r)t.commentBefore=s;else if(Us(r)&&!r.flow&&r.items.length>0){let a=r.items[0];Hs(a)&&(a=a.key);const l=a.commentBefore;a.commentBefore=l?`${s} +`)+(a.substring(1)||" "),n=!0,s=!1;break;case"%":((i=e[r+1])==null?void 0:i[0])!=="#"&&(r+=1),n=!1;break;default:n||(s=!0),n=!1}}return{comment:t,afterEmptyLine:s}}class Pke{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,s,i,r)=>{const a=Xh(n);r?this.warnings.push(new gke(a,s,i)):this.errors.push(new mp(a,s,i))},this.directives=new zi({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:s,afterEmptyLine:i}=j3(this.prelude);if(s){const r=t.contents;if(n)t.comment=t.comment?`${t.comment} +${s}`:s;else if(i||t.directives.docStart||!r)t.commentBefore=s;else if(Ps(r)&&!r.flow&&r.items.length>0){let a=r.items[0];Fs(a)&&(a=a.key);const l=a.commentBefore;a.commentBefore=l?`${s} ${l}`:s}else{const a=r.commentBefore;r.commentBefore=a?`${s} -${a}`:s}}if(n){for(let r=0;r{const r=Qh(t);r[0]+=n,this.onError(r,"BAD_DIRECTIVE",s,i)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=Rke(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,s=new gp(Qh(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(s):this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){const s="Unexpected doc-end without preceding document";this.errors.push(new gp(Qh(t),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;const n=Mg(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const s=this.doc.comment;this.doc.comment=s?`${s} -${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new gp(Qh(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 s=Object.assign({_directives:this.directives},this.options),i=new Og(void 0,s);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}}const WH="\uFEFF",XH="",QH="",xN="";function Mke(e){switch(e){case WH:return"byte-order-mark";case XH:return"doc-mode";case QH:return"flow-error-end";case xN:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +${a}`:s}}if(n){for(let r=0;r{const r=Xh(t);r[0]+=n,this.onError(r,"BAD_DIRECTIVE",s,i)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=Dke(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,s=new mp(Xh(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(s):this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){const s="Unexpected doc-end without preceding document";this.errors.push(new mp(Xh(t),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;const n=Og(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const s=this.doc.comment;this.doc.comment=s?`${s} +${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new mp(Xh(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 s=Object.assign({_directives:this.directives},this.options),i=new Rg(void 0,s);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}}const JH="\uFEFF",ez="",tz="",SN="";function Bke(e){switch(e){case JH:return"byte-order-mark";case ez:return"doc-mode";case tz:return"flow-error-end";case SN: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 pa(e){switch(e){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}const A3=new Set("0123456789ABCDEFabcdef"),Lke=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),sb=new Set(",[]{}"),Dke=new Set(` ,[]{} -\r `),Iw=e=>!e||Dke.has(e);class Pke{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 s=this.next??"stream";for(;s&&(n||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===` +`: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 ha(e){switch(e){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}const R3=new Set("0123456789ABCDEFabcdef"),Uke=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),rb=new Set(",[]{}"),Fke=new Set(` ,[]{} +\r `),Ow=e=>!e||Fke.has(e);class $ke{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 s=this.next??"stream";for(;s&&(n||this.hasChars(1));)s=yield*this.parseNext(s)}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 s=0;for(;n===" ";)n=this.buffer[++s+t];if(n==="\r"){const i=this.buffer[s+t+1];if(i===` `||!i&&!this.atEnd)return t+s+1}return n===` -`||s>=this.indentNext||!n&&!this.atEnd?t+s:-1}if(n==="-"||n==="."){const s=this.buffer.substr(t,3);if((s==="---"||s==="...")&&pa(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&tthis.indentValue&&!pa(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===":")&&pa(n)){const s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,"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(Iw),"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,s=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=s=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);const i=this.getLine();if(i===null)return this.setNext("flow");if((s!==-1&&s=this.indentNext||!n&&!this.atEnd?t+s:-1}if(n==="-"||n==="."){const s=this.buffer.substr(t,3);if((s==="---"||s==="...")&&ha(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&tthis.indentValue&&!ha(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===":")&&ha(n)){const s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,"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(Ow),"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,s=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=s=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);const i=this.getLine();if(i===null)return this.setNext("flow");if((s!==-1&&s"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>pa(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,s;e:for(let r=this.pos;s=this.buffer[r];++r)switch(s){case" ":n+=1;break;case` +`,r)}i!==-1&&(n=i-(s[i-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){const n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>ha(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,s;e:for(let r=this.pos;s=this.buffer[r];++r)switch(s){case" ":n+=1;break;case` `:t=r,n=0;break;case"\r":{const a=this.buffer[r+1];if(!a&&!this.atEnd)return this.setNext("block-scalar");if(a===` `)break}default:break e}if(!s&&!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 r=this.continueScalar(t+1);if(r===-1)break;t=this.buffer.indexOf(` `,r)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let i=t+1;for(s=this.buffer[i];s===" ";)s=this.buffer[++i];if(s===" "){for(;s===" "||s===" "||s==="\r"||s===` `;)s=this.buffer[++i];t=i-1}else if(!this.blockScalarKeep)do{let r=t-1,a=this.buffer[r];a==="\r"&&(a=this.buffer[--r]);const l=r;for(;a===" ";)a=this.buffer[--r];if(a===` -`&&r>=this.pos&&r+1+n>l)t=r;else break}while(!0);return yield xN,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,s=this.pos-1,i;for(;i=this.buffer[++s];)if(i===":"){const r=this.buffer[s+1];if(pa(r)||t&&sb.has(r))break;n=s}else if(pa(i)){let r=this.buffer[s+1];if(i==="\r"&&(r===` +`&&r>=this.pos&&r+1+n>l)t=r;else break}while(!0);return yield SN,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,s=this.pos-1,i;for(;i=this.buffer[++s];)if(i===":"){const r=this.buffer[s+1];if(ha(r)||t&&rb.has(r))break;n=s}else if(ha(i)){let r=this.buffer[s+1];if(i==="\r"&&(r===` `?(s+=1,i=` -`,r=this.buffer[s+1]):n=s),r==="#"||t&&sb.has(r))break;if(i===` -`){const a=this.continueScalar(s+1);if(a===-1)break;s=Math.max(s,a-2)}}else{if(t&&sb.has(i))break;n=s}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield xN,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 s=this.buffer.slice(this.pos,t);return s?(yield s,this.pos+=s.length,s.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(Iw),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const n=this.flowLevel>0,s=this.charAt(1);if(pa(s)||n&&sb.has(s)){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(;!pa(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(Lke.has(n))n=this.buffer[++t];else if(n==="%"&&A3.has(this.buffer[t+1])&&A3.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===` +`,r=this.buffer[s+1]):n=s),r==="#"||t&&rb.has(r))break;if(i===` +`){const a=this.continueScalar(s+1);if(a===-1)break;s=Math.max(s,a-2)}}else{if(t&&rb.has(i))break;n=s}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield SN,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 s=this.buffer.slice(this.pos,t);return s?(yield s,this.pos+=s.length,s.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(Ow),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const n=this.flowLevel>0,s=this.charAt(1);if(ha(s)||n&&rb.has(s)){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(;!ha(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(Uke.has(n))n=this.buffer[++t];else if(n==="%"&&R3.has(this.buffer[t+1])&&R3.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,s;do s=this.buffer[++n];while(s===" "||t&&s===" ");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,s=this.buffer[n];for(;!t(s);)s=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class Bke{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,s=this.lineStarts.length;for(;n>1;this.lineStarts[r]=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 bx(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 s=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in s?s.indent:0:n.type==="flow-collection"&&s.type==="document"&&(n.indent=0),n.type==="flow-collection"&&I3(n),s.type){case"document":s.value=n;break;case"block-scalar":s.props.push(n);break;case"block-map":{const i=s.items[s.items.length-1];if(i.value){s.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=s.items[s.items.length-1];i.value?s.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{const i=s.items[s.items.length-1];!i||i.value?s.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((s.type==="document"||s.type==="block-map"||s.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&&C3(i.start)===-1&&(n.indent===0||i.start.every(r=>r.type!=="comment"||r.indent0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(t){let n=this.pos,s=this.buffer[n];for(;!t(s);)s=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class Hke{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,s=this.lineStarts.length;for(;n>1;this.lineStarts[r]=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 xx(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 s=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in s?s.indent:0:n.type==="flow-collection"&&s.type==="document"&&(n.indent=0),n.type==="flow-collection"&&M3(n),s.type){case"document":s.value=n;break;case"block-scalar":s.props.push(n);break;case"block-map":{const i=s.items[s.items.length-1];if(i.value){s.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=s.items[s.items.length-1];i.value?s.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{const i=s.items[s.items.length-1];!i||i.value?s.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((s.type==="document"||s.type==="block-map"||s.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&&O3(i.start)===-1&&(n.indent===0||i.start.every(r=>r.type!=="comment"||r.indent=t.indent){const i=!this.onKeyLine&&this.indent===t.indent,r=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let a=[];if(r&&n.sep&&!n.value){const l=[];for(let c=0;ct.indent&&(l.length=0);break;default:l.length=0}}l.length>=2&&(a=n.sep.splice(l[1]))}switch(this.type){case"anchor":case"tag":r||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):r||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(xl(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(ZH(n.key)&&!xl(n.sep,"newline")){const l=ed(n.start),c=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:l,key:c,sep:u}]})}else a.length>0?n.sep=n.sep.concat(a,this.sourceToken):n.sep.push(this.sourceToken);else if(xl(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const l=ed(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||r?t.items.push({start:a,key:null,sep:[this.sourceToken]}):xl(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 l=this.flowScalar(this.type);r||n.value?(t.items.push({start:a,key:l,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(l):(Object.assign(n,{key:l,sep:[]}),this.onKeyLine=!0);return}default:{const l=this.startBlockValue(t);if(l){if(l.type==="block-seq"){if(!n.explicitKey&&n.sep&&!xl(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(l);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){var s;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,r=Array.isArray(i)?i[i.length-1]:void 0;(r==null?void 0:r.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],r=(s=i==null?void 0:i.value)==null?void 0:s.end;if(Array.isArray(r)){bx(r,n.start),r.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||xl(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 s;do yield*this.pop(),s=this.peek(1);while((s==null?void 0:s.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 s=this.startBlockValue(t);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{const s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===t.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){const i=ib(s),r=ed(i);I3(t);const a=t.end.splice(1,t.end.length);a.push(this.sourceToken);const l={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=l}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(` +`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){var s;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){const i="end"in n.value?n.value.end:void 0,r=Array.isArray(i)?i[i.length-1]:void 0;(r==null?void 0:r.type)==="comment"?i==null||i.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){const i=t.items[t.items.length-2],r=(s=i==null?void 0:i.value)==null?void 0:s.end;if(Array.isArray(r)){xx(r,n.start),r.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){const i=!this.onKeyLine&&this.indent===t.indent,r=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let a=[];if(r&&n.sep&&!n.value){const l=[];for(let c=0;ct.indent&&(l.length=0);break;default:l.length=0}}l.length>=2&&(a=n.sep.splice(l[1]))}switch(this.type){case"anchor":case"tag":r||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):r||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(_l(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(nz(n.key)&&!_l(n.sep,"newline")){const l=nd(n.start),c=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:l,key:c,sep:u}]})}else a.length>0?n.sep=n.sep.concat(a,this.sourceToken):n.sep.push(this.sourceToken);else if(_l(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const l=nd(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||r?t.items.push({start:a,key:null,sep:[this.sourceToken]}):_l(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 l=this.flowScalar(this.type);r||n.value?(t.items.push({start:a,key:l,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(l):(Object.assign(n,{key:l,sep:[]}),this.onKeyLine=!0);return}default:{const l=this.startBlockValue(t);if(l){if(l.type==="block-seq"){if(!n.explicitKey&&n.sep&&!_l(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(l);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){var s;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,r=Array.isArray(i)?i[i.length-1]:void 0;(r==null?void 0:r.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],r=(s=i==null?void 0:i.value)==null?void 0:s.end;if(Array.isArray(r)){xx(r,n.start),r.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||_l(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 s;do yield*this.pop(),s=this.peek(1);while((s==null?void 0:s.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 s=this.startBlockValue(t);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{const s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===t.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){const i=ab(s),r=nd(i);M3(t);const a=t.end.splice(1,t.end.length);a.push(this.sourceToken);const l={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=l}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=ib(t),s=ed(n);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=ib(t),s=ed(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(s=>s.type==="newline"||s.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 Fke(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Bke||null,prettyErrors:t}}function $ke(e,t={}){const{lineCounter:n,prettyErrors:s}=Fke(t),i=new Uke(n==null?void 0:n.addNewLine),r=new Oke(t);let a=null;for(const l of r.compose(i.parse(e),!0,e.length))if(!a)a=l;else if(a.options.logLevel!=="silent"){a.errors.push(new gp(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&n&&(a.errors.forEach(N3(e,n)),a.warnings.forEach(N3(e,n))),a}function Hke(e,t,n){let s;const i=$ke(e,n);if(!i)return null;if(i.warnings.forEach(r=>_H(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:s},n))}function zke(e,t,n){let s=null;if(Array.isArray(t)&&(s=t),e===void 0){const{keepUndefined:i}={};if(!i)return}return Cg(e)&&!s?e.toString(n):new Og(e,s,n).toString(n)}const JH=new Set(["local","sqlite","mysql","postgresql"]),ez=new Set(["local","opensearch","redis","viking","openviking","mem0"]),tz=new Set(["opensearch","viking","context_search"]),nz=new Set(["apmplus","cozeloop","tls"]),sz=new Set(["web_search","parallel_web_search","link_reader","web_scraper","image_generate","image_edit","video_generate","text_to_speech","run_code","vesearch"]),Vke=new Set(HU.map(e=>e.id)),Gke=new Set(["llm","sequential","parallel","loop","a2a"]);function Rt(e,t=""){return typeof e=="string"?e:t}function Wr(e){return e===!0}function Jp(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function Kke(e){return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="string"))}function iz(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"?{name:Rt(t.name),description:Rt(t.description)}:null).filter(t=>!!t&&!!t.name.trim()):[]}function ef(e,t,n){return typeof e=="string"&&t.has(e)?e:n}function rz(e){return typeof e=="string"&&Gke.has(e)?e:"llm"}function az(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):3}function oz(e){const t=e&&typeof e=="object"?e:{};return{enabled:Wr(t.enabled),registrySpaceId:Rt(t.registrySpaceId),registryTopK:Rt(t.registryTopK),registryRegion:Rt(t.registryRegion),registryEndpoint:Rt(t.registryEndpoint)}}function lz(e){return Array.isArray(e)?e.map(t=>{const n=t&&typeof t=="object"?t:{},s=n.memory&&typeof n.memory=="object"?n.memory:{},i=oz(n.a2aRegistry),r=rz(n.agentType),a=i.enabled&&r==="llm"?"a2a":r;return{...wi(),name:Rt(n.name),description:Rt(n.description),instruction:Rt(n.instruction),agentType:a,maxIterations:az(n.maxIterations),a2aUrl:Rt(n.a2aUrl),modelName:Rt(n.modelName),modelProvider:Rt(n.modelProvider),modelApiBase:Rt(n.modelApiBase),builtinTools:Jp(n.builtinTools).filter(l=>sz.has(l)),customTools:iz(n.customTools),memory:{shortTerm:Wr(s.shortTerm),longTerm:Wr(s.longTerm)},shortTermBackend:ef(n.shortTermBackend,JH,"local"),longTermBackend:ef(n.longTermBackend,ez,"local"),autoSaveSession:Wr(n.autoSaveSession),knowledgebase:Wr(n.knowledgebase),knowledgebaseBackend:ef(n.knowledgebaseBackend,tz,fu),knowledgebaseIndex:Rt(n.knowledgebaseIndex),tracing:Wr(n.tracing),tracingExporters:Jp(n.tracingExporters).filter(l=>nz.has(l)),a2aRegistry:a==="a2a"?{...i,enabled:!0}:i,subAgents:lz(n.subAgents),selectedSkills:cz(n)}}):[]}function cz(e){if(!Array.isArray(e.selectedSkills))return[];const t=[];for(const n of e.selectedSkills){const s=n&&typeof n=="object"?n:{},i=Rt(s.source),r=i==="local"||i==="skillspace"||i==="skillhub"?i:"skillhub",a=Rt(s.name)||Rt(s.slug)||Rt(s.skillName)||Rt(s.skillId)||"skill",l=Rt(s.folder)||a,c=Rt(s.description);if(r==="skillhub"){const f=Rt(s.slug);if(!f)continue;t.push({source:r,folder:l,name:a,description:c,slug:f,namespace:Rt(s.namespace)||"public"});continue}if(r==="local"){const h=(Array.isArray(s.localFiles)?s.localFiles:[]).map(p=>{const m=p&&typeof p=="object"?p:{},b=Rt(m.path),v=Rt(m.content);return b?{path:b,content:v}:null}).filter(p=>p!==null);if(h.length===0)continue;t.push({source:r,folder:l,name:a,description:c,localFiles:h});continue}const u=Rt(s.skillSpaceId),d=Rt(s.skillId);!u||!d||t.push({source:r,folder:l,name:a,description:c,skillSpaceId:u,skillSpaceName:Rt(s.skillSpaceName),skillId:d,version:Rt(s.version)})}return t}function x2(e){const t=e&&typeof e=="object"?e:{},n=t.memory&&typeof t.memory=="object"?t.memory:{},s=t.deployment&&typeof t.deployment=="object"?t.deployment:{},i=Kke(s.envValues),r=oz(t.a2aRegistry),a=rz(t.agentType),l=r.enabled&&a==="llm"?"a2a":a,c=Array.isArray(t.mcpTools)?t.mcpTools.map(u=>{const d=u&&typeof u=="object"?u:{},f=d.transport==="stdio"?"stdio":"http";return{name:Rt(d.name),transport:f,url:Rt(d.url),authToken:Rt(d.authToken),authTokenEnv:Rt(d.authTokenEnv),command:Rt(d.command),args:Jp(d.args)}}).filter(u=>u.transport==="http"?!!u.url:!!u.command):[];return{...wi(),name:Rt(t.name)||"my_agent",description:Rt(t.description),instruction:Rt(t.instruction)||"You are a helpful assistant.",agentType:l,maxIterations:az(t.maxIterations),a2aUrl:Rt(t.a2aUrl),modelName:Rt(t.modelName),modelProvider:Rt(t.modelProvider),modelApiBase:Rt(t.modelApiBase),builtinTools:Jp(t.builtinTools).filter(u=>sz.has(u)),customTools:iz(t.customTools),mcpTools:c,a2aRegistry:l==="a2a"?{...r,enabled:!0}:r,memory:{shortTerm:Wr(n.shortTerm),longTerm:Wr(n.longTerm)},shortTermBackend:ef(t.shortTermBackend,JH,"local"),longTermBackend:ef(t.longTermBackend,ez,"local"),autoSaveSession:Wr(t.autoSaveSession),knowledgebase:Wr(t.knowledgebase),knowledgebaseBackend:ef(t.knowledgebaseBackend,tz,fu),knowledgebaseIndex:Rt(t.knowledgebaseIndex),tracing:Wr(t.tracing),tracingExporters:Jp(t.tracingExporters).filter(u=>nz.has(u)),deployment:{feishuEnabled:Wr(s.feishuEnabled),...Object.keys(i).length>0?{envValues:i}:{}},subAgents:lz(t.subAgents),selectedSkills:cz(t)}}function uz(e){return{...e,builtinTools:(e.builtinTools??[]).filter(t=>Vke.has(t)),tracing:!1,tracingExporters:[],memory:{shortTerm:!1,longTerm:!1},shortTermBackend:"local",longTermBackend:"local",autoSaveSession:!1,knowledgebase:!1,knowledgebaseBackend:fu,knowledgebaseIndex:"",subAgents:e.subAgents.map(uz)}}const qke=/^[A-Za-z_][A-Za-z0-9_]*$/,E2=/^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/;function j3(e,t){return e.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")||t}function Yke(e,t){if(!t.has(e))return e;let n=2;for(;t.has(`${e}_${n}`);)n+=1;return`${e}_${n}`}function dz(e){var n,s,i;const t=(n=e.authTokenEnv)==null?void 0:n.trim();return t&&qke.test(t)?t:((i=(s=e.authToken)==null?void 0:s.trim().match(E2))==null?void 0:i[1])??""}function Wke(e){if(e.authToken)return e.authToken;const t=dz(e);return t?`\${${t}}`:""}function Xke(e,t){if(!t){const s={...e};return delete s.authToken,delete s.authTokenEnv,s}const n=t.trim().match(E2);if(n){const s={...e,authTokenEnv:n[1]};return delete s.authToken,s}return{...e,authToken:t}}function Qke(e){if(!e.trim())return!1;try{return!new URL(e).pathname.replace(/\/+$/,"").endsWith("/mcp")}catch{return!1}}function X1(e){const t=new Set,n={},s=i=>{var u;const r=j3(i.name,"AGENT"),a=(u=i.mcpTools)==null?void 0:u.map((d,f)=>{var y,x;const h=((y=d.authToken)==null?void 0:y.trim())??"",p=((x=h.match(E2))==null?void 0:x[1])??"";let b=dz(d);if(!b&&h){const E=j3(d.name,`TOOL_${f+1}`);b=Yke(`MCP_${r}_${E}_AUTH_TOKEN`,t)}b&&t.add(b),b&&h&&!p&&(n[b]=h);const v={...d};return delete v.authToken,b?v.authTokenEnv=b:delete v.authTokenEnv,v}),l=i.subAgents.map(s),c=i.workflow?{...i.workflow,nodes:i.workflow.nodes.map(d=>({...d,agent:s(d.agent)}))}:void 0;return{...i,subAgents:l,...a?{mcpTools:a}:{},...c?{workflow:c}:{}}};return{draft:s(e),envValues:n}}function fz(e){var n,s,i,r,a,l,c,u,d,f,h,p,m,b,v,y,x,E,w,_,S,k;const t={agentType:e.agentType??"llm"};if(e.agentType==="a2a"){if((n=e.a2aRegistry)!=null&&n.enabled){const T={enabled:!0};(s=e.a2aRegistry.registrySpaceId)!=null&&s.trim()&&(T.registrySpaceId=e.a2aRegistry.registrySpaceId.trim()),T.registryTopK=((i=e.a2aRegistry.registryTopK)==null?void 0:i.trim())||Ta.topK,T.registryRegion=((r=e.a2aRegistry.registryRegion)==null?void 0:r.trim())||Ta.region,T.registryEndpoint=((a=e.a2aRegistry.registryEndpoint)==null?void 0:a.trim())||Ta.endpoint,t.a2aRegistry=T}return t}if(t.name=e.name,t.description=e.description,t.instruction=e.instruction,e.agentType==="loop"&&(t.maxIterations=e.maxIterations??3),(l=e.modelName)!=null&&l.trim()&&(t.modelName=e.modelName.trim()),(c=e.modelProvider)!=null&&c.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(T=>({name:T.name,description:T.description}))),(h=e.mcpTools)!=null&&h.length&&(t.mcpTools=e.mcpTools.map(T=>{var I,j,L,z;const C={name:T.name,transport:T.transport};return(I=T.url)!=null&&I.trim()&&(C.url=T.url.trim()),(j=T.authTokenEnv)!=null&&j.trim()&&(C.authTokenEnv=T.authTokenEnv.trim()),(L=T.command)!=null&&L.trim()&&(C.command=T.command.trim()),(z=T.args)!=null&&z.length&&(C.args=T.args),C})),((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||"viking",(b=e.knowledgebaseIndex)!=null&&b.trim()&&(t.knowledgebaseIndex=e.knowledgebaseIndex.trim())),e.tracing&&((v=e.tracingExporters)!=null&&v.length)&&(t.tracing=!0,t.tracingExporters=[...e.tracingExporters]),(y=e.deployment)!=null&&y.feishuEnabled||Object.keys(((x=e.deployment)==null?void 0:x.envValues)??{}).length>0){const T={feishuEnabled:!!((E=e.deployment)!=null&&E.feishuEnabled)};Object.keys(((w=e.deployment)==null?void 0:w.envValues)??{}).length>0&&(T.envValues={...(_=e.deployment)==null?void 0:_.envValues}),t.deployment=T}return(S=e.selectedSkills)!=null&&S.length&&(t.selectedSkills=e.selectedSkills.map(T=>{const C={source:T.source,name:T.name,folder:T.folder};return T.description&&(C.description=T.description),T.source==="skillhub"?(C.slug=T.slug,C.namespace=T.namespace??"public"):T.source==="local"?C.localFiles=T.localFiles??[]:(C.skillSpaceId=T.skillSpaceId,C.skillSpaceName=T.skillSpaceName,C.skillId=T.skillId,T.version&&(C.version=T.version)),C})),(k=e.subAgents)!=null&&k.length&&(t.subAgents=e.subAgents.map(fz)),t}function Zke(e){var i;const t=X1(e),n={...((i=t.draft.deployment)==null?void 0:i.envValues)??{},...t.envValues},s={...t.draft,deployment:{...t.draft.deployment??{feishuEnabled:!1},envValues:n}};return`# VeADK Agent 结构配置 +`,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=ab(t),s=nd(n);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=ab(t),s=nd(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(s=>s.type==="newline"||s.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 Vke(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Hke||null,prettyErrors:t}}function Gke(e,t={}){const{lineCounter:n,prettyErrors:s}=Vke(t),i=new zke(n==null?void 0:n.addNewLine),r=new Pke(t);let a=null;for(const l of r.compose(i.parse(e),!0,e.length))if(!a)a=l;else if(a.options.logLevel!=="silent"){a.errors.push(new mp(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&n&&(a.errors.forEach(C3(e,n)),a.warnings.forEach(C3(e,n))),a}function Kke(e,t,n){let s;const i=Gke(e,n);if(!i)return null;if(i.warnings.forEach(r=>AH(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:s},n))}function qke(e,t,n){let s=null;if(Array.isArray(t)&&(s=t),e===void 0){const{keepUndefined:i}={};if(!i)return}return Ag(e)&&!s?e.toString(n):new Rg(e,s,n).toString(n)}const sz=new Set(["local","sqlite","mysql","postgresql"]),iz=new Set(["local","opensearch","redis","viking","openviking","mem0"]),rz=new Set(["opensearch","viking","context_search"]),az=new Set(["apmplus","cozeloop","tls"]),oz=new Set(["web_search","parallel_web_search","link_reader","web_scraper","image_generate","image_edit","video_generate","text_to_speech","run_code","vesearch"]),Yke=new Set(KU.map(e=>e.id)),Wke=new Set(["llm","sequential","parallel","loop","a2a"]);function Lt(e,t=""){return typeof e=="string"?e:t}function Kr(e){return e===!0}function Zp(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function Xke(e){return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="string"))}function lz(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 nf(e,t,n){return typeof e=="string"&&t.has(e)?e:n}function cz(e){return typeof e=="string"&&Wke.has(e)?e:"llm"}function uz(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):3}function dz(e){const t=e&&typeof e=="object"?e:{};return{enabled:Kr(t.enabled),registrySpaceId:Lt(t.registrySpaceId),registryTopK:Lt(t.registryTopK),registryRegion:Lt(t.registryRegion),registryEndpoint:Lt(t.registryEndpoint)}}function fz(e){return Array.isArray(e)?e.map(t=>{const n=t&&typeof t=="object"?t:{},s=n.memory&&typeof n.memory=="object"?n.memory:{},i=dz(n.a2aRegistry),r=cz(n.agentType),a=i.enabled&&r==="llm"?"a2a":r;return{...wi(),name:Lt(n.name),description:Lt(n.description),instruction:Lt(n.instruction),agentType:a,maxIterations:uz(n.maxIterations),a2aUrl:Lt(n.a2aUrl),modelName:Lt(n.modelName),modelProvider:Lt(n.modelProvider),modelApiBase:Lt(n.modelApiBase),builtinTools:Zp(n.builtinTools).filter(l=>oz.has(l)),customTools:lz(n.customTools),memory:{shortTerm:Kr(s.shortTerm),longTerm:Kr(s.longTerm)},shortTermBackend:nf(n.shortTermBackend,sz,"local"),longTermBackend:nf(n.longTermBackend,iz,"local"),autoSaveSession:Kr(n.autoSaveSession),knowledgebase:Kr(n.knowledgebase),knowledgebaseBackend:nf(n.knowledgebaseBackend,rz,hu),knowledgebaseIndex:Lt(n.knowledgebaseIndex),tracing:Kr(n.tracing),tracingExporters:Zp(n.tracingExporters).filter(l=>az.has(l)),a2aRegistry:a==="a2a"?{...i,enabled:!0}:i,subAgents:fz(n.subAgents),selectedSkills:hz(n)}}):[]}function hz(e){if(!Array.isArray(e.selectedSkills))return[];const t=[];for(const n of e.selectedSkills){const s=n&&typeof n=="object"?n:{},i=Lt(s.source),r=i==="local"||i==="skillspace"||i==="skillhub"?i:"skillhub",a=Lt(s.name)||Lt(s.slug)||Lt(s.skillName)||Lt(s.skillId)||"skill",l=Lt(s.folder)||a,c=Lt(s.description);if(r==="skillhub"){const f=Lt(s.slug);if(!f)continue;t.push({source:r,folder:l,name:a,description:c,slug:f,namespace:Lt(s.namespace)||"public"});continue}if(r==="local"){const h=(Array.isArray(s.localFiles)?s.localFiles:[]).map(p=>{const m=p&&typeof p=="object"?p:{},b=Lt(m.path),v=Lt(m.content);return b?{path:b,content:v}:null}).filter(p=>p!==null);if(h.length===0)continue;t.push({source:r,folder:l,name:a,description:c,localFiles:h});continue}const u=Lt(s.skillSpaceId),d=Lt(s.skillId);!u||!d||t.push({source:r,folder:l,name:a,description:c,skillSpaceId:u,skillSpaceName:Lt(s.skillSpaceName),skillId:d,version:Lt(s.version)})}return t}function S2(e){const t=e&&typeof e=="object"?e:{},n=t.memory&&typeof t.memory=="object"?t.memory:{},s=t.deployment&&typeof t.deployment=="object"?t.deployment:{},i=Xke(s.envValues),r=dz(t.a2aRegistry),a=cz(t.agentType),l=r.enabled&&a==="llm"?"a2a":a,c=Array.isArray(t.mcpTools)?t.mcpTools.map(u=>{const d=u&&typeof u=="object"?u:{},f=d.transport==="stdio"?"stdio":"http";return{name:Lt(d.name),transport:f,url:Lt(d.url),authToken:Lt(d.authToken),authTokenEnv:Lt(d.authTokenEnv),command:Lt(d.command),args:Zp(d.args)}}).filter(u=>u.transport==="http"?!!u.url:!!u.command):[];return{...wi(),name:Lt(t.name)||"my_agent",description:Lt(t.description),instruction:Lt(t.instruction)||"You are a helpful assistant.",agentType:l,maxIterations:uz(t.maxIterations),a2aUrl:Lt(t.a2aUrl),modelName:Lt(t.modelName),modelProvider:Lt(t.modelProvider),modelApiBase:Lt(t.modelApiBase),builtinTools:Zp(t.builtinTools).filter(u=>oz.has(u)),customTools:lz(t.customTools),mcpTools:c,a2aRegistry:l==="a2a"?{...r,enabled:!0}:r,memory:{shortTerm:Kr(n.shortTerm),longTerm:Kr(n.longTerm)},shortTermBackend:nf(t.shortTermBackend,sz,"local"),longTermBackend:nf(t.longTermBackend,iz,"local"),autoSaveSession:Kr(t.autoSaveSession),knowledgebase:Kr(t.knowledgebase),knowledgebaseBackend:nf(t.knowledgebaseBackend,rz,hu),knowledgebaseIndex:Lt(t.knowledgebaseIndex),tracing:Kr(t.tracing),tracingExporters:Zp(t.tracingExporters).filter(u=>az.has(u)),deployment:{feishuEnabled:Kr(s.feishuEnabled),...Object.keys(i).length>0?{envValues:i}:{}},subAgents:fz(t.subAgents),selectedSkills:hz(t)}}function pz(e){return{...e,builtinTools:(e.builtinTools??[]).filter(t=>Yke.has(t)),tracing:!1,tracingExporters:[],memory:{shortTerm:!1,longTerm:!1},shortTermBackend:"local",longTermBackend:"local",autoSaveSession:!1,knowledgebase:!1,knowledgebaseBackend:hu,knowledgebaseIndex:"",subAgents:e.subAgents.map(pz)}}const Qke=/^[A-Za-z_][A-Za-z0-9_]*$/,_2=/^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/;function L3(e,t){return e.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")||t}function Zke(e,t){if(!t.has(e))return e;let n=2;for(;t.has(`${e}_${n}`);)n+=1;return`${e}_${n}`}function mz(e){var n,s,i;const t=(n=e.authTokenEnv)==null?void 0:n.trim();return t&&Qke.test(t)?t:((i=(s=e.authToken)==null?void 0:s.trim().match(_2))==null?void 0:i[1])??""}function Jke(e){if(e.authToken)return e.authToken;const t=mz(e);return t?`\${${t}}`:""}function eAe(e,t){if(!t){const s={...e};return delete s.authToken,delete s.authTokenEnv,s}const n=t.trim().match(_2);if(n){const s={...e,authTokenEnv:n[1]};return delete s.authToken,s}return{...e,authToken:t}}function tAe(e){if(!e.trim())return!1;try{return!new URL(e).pathname.replace(/\/+$/,"").endsWith("/mcp")}catch{return!1}}function Z1(e){const t=new Set,n={},s=i=>{var u;const r=L3(i.name,"AGENT"),a=(u=i.mcpTools)==null?void 0:u.map((d,f)=>{var y,x;const h=((y=d.authToken)==null?void 0:y.trim())??"",p=((x=h.match(_2))==null?void 0:x[1])??"";let b=mz(d);if(!b&&h){const E=L3(d.name,`TOOL_${f+1}`);b=Zke(`MCP_${r}_${E}_AUTH_TOKEN`,t)}b&&t.add(b),b&&h&&!p&&(n[b]=h);const v={...d};return delete v.authToken,b?v.authTokenEnv=b:delete v.authTokenEnv,v}),l=i.subAgents.map(s),c=i.workflow?{...i.workflow,nodes:i.workflow.nodes.map(d=>({...d,agent:s(d.agent)}))}:void 0;return{...i,subAgents:l,...a?{mcpTools:a}:{},...c?{workflow:c}:{}}};return{draft:s(e),envValues:n}}function gz(e){var n,s,i,r,a,l,c,u,d,f,h,p,m,b,v,y,x,E,w,_,S,k;const t={agentType:e.agentType??"llm"};if(e.agentType==="a2a"){if((n=e.a2aRegistry)!=null&&n.enabled){const T={enabled:!0};(s=e.a2aRegistry.registrySpaceId)!=null&&s.trim()&&(T.registrySpaceId=e.a2aRegistry.registrySpaceId.trim()),T.registryTopK=((i=e.a2aRegistry.registryTopK)==null?void 0:i.trim())||Na.topK,T.registryRegion=((r=e.a2aRegistry.registryRegion)==null?void 0:r.trim())||Na.region,T.registryEndpoint=((a=e.a2aRegistry.registryEndpoint)==null?void 0:a.trim())||Na.endpoint,t.a2aRegistry=T}return t}if(t.name=e.name,t.description=e.description,t.instruction=e.instruction,e.agentType==="loop"&&(t.maxIterations=e.maxIterations??3),(l=e.modelName)!=null&&l.trim()&&(t.modelName=e.modelName.trim()),(c=e.modelProvider)!=null&&c.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(T=>({name:T.name,description:T.description}))),(h=e.mcpTools)!=null&&h.length&&(t.mcpTools=e.mcpTools.map(T=>{var I,j,L,z;const C={name:T.name,transport:T.transport};return(I=T.url)!=null&&I.trim()&&(C.url=T.url.trim()),(j=T.authTokenEnv)!=null&&j.trim()&&(C.authTokenEnv=T.authTokenEnv.trim()),(L=T.command)!=null&&L.trim()&&(C.command=T.command.trim()),(z=T.args)!=null&&z.length&&(C.args=T.args),C})),((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||"viking",(b=e.knowledgebaseIndex)!=null&&b.trim()&&(t.knowledgebaseIndex=e.knowledgebaseIndex.trim())),e.tracing&&((v=e.tracingExporters)!=null&&v.length)&&(t.tracing=!0,t.tracingExporters=[...e.tracingExporters]),(y=e.deployment)!=null&&y.feishuEnabled||Object.keys(((x=e.deployment)==null?void 0:x.envValues)??{}).length>0){const T={feishuEnabled:!!((E=e.deployment)!=null&&E.feishuEnabled)};Object.keys(((w=e.deployment)==null?void 0:w.envValues)??{}).length>0&&(T.envValues={...(_=e.deployment)==null?void 0:_.envValues}),t.deployment=T}return(S=e.selectedSkills)!=null&&S.length&&(t.selectedSkills=e.selectedSkills.map(T=>{const C={source:T.source,name:T.name,folder:T.folder};return T.description&&(C.description=T.description),T.source==="skillhub"?(C.slug=T.slug,C.namespace=T.namespace??"public"):T.source==="local"?C.localFiles=T.localFiles??[]:(C.skillSpaceId=T.skillSpaceId,C.skillSpaceName=T.skillSpaceName,C.skillId=T.skillId,T.version&&(C.version=T.version)),C})),(k=e.subAgents)!=null&&k.length&&(t.subAgents=e.subAgents.map(gz)),t}function nAe(e){var i;const t=Z1(e),n={...((i=t.draft.deployment)==null?void 0:i.envValues)??{},...t.envValues},s={...t.draft,deployment:{...t.draft.deployment??{feishuEnabled:!1},envValues:n}};return`# VeADK Agent 结构配置 # 可在「创建 Agent」页通过「导入 YAML」重新载入。 -`+zke(fz(s))}function Jke(e){const t=Hke(e);return x2(t)}const eAe=[{kind:"custom",icon:Oee,title:"自定义",desc:"分步配置模型、工具、记忆、知识库等组件。"},{kind:"intelligent",icon:mee,title:"智能模式",desc:"敬请期待",disabled:!0},{kind:"template",icon:dee,title:"从模板新建",desc:"敬请期待",disabled:!0},{kind:"workflow",icon:Mee,title:"工作流",desc:"敬请期待",disabled:!0}];function tAe({onSelect:e,onImport:t}){const n=g.useRef(null),[s,i]=g.useState(""),r=eAe.map(l=>({key:l.kind,icon:l.icon,title:l.title,desc:l.desc,disabled:l.disabled,onClick:()=>e(l.kind)})),a=async l=>{var u;const c=(u=l.target.files)==null?void 0:u[0];if(l.target.value="",!!c)try{const d=await c.text();t(Jke(d))}catch(d){i(`导入失败:${d instanceof Error?d.message:String(d)}`)}};return o.jsx(pH,{title:"从 0 快速创建",sub:"选择一种方式开始",cards:r,footer:o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[o.jsxs("button",{className:"stk-import",onClick:()=>{var l;return(l=n.current)==null?void 0:l.click()},children:[o.jsx(jee,{}),"导入 YAML 配置"]}),s&&o.jsx("span",{style:{fontSize:12,color:"hsl(var(--destructive))"},children:s}),o.jsx("input",{ref:n,type:"file",accept:".yaml,.yml,text/yaml",style:{display:"none"},onChange:a})]})})}const nAe="modulepreload",sAe=function(e){return"/"+e},R3={},Jc=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(n.map(c=>{if(c=sAe(c),c in R3)return;R3[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":nAe,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),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 ${c}`)))})}))}function r(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return i.then(a=>{for(const l of a||[])l.status==="rejected"&&r(l.reason);return t().catch(r)})};function Q1(e,t){return t[e.key]??e.defaultValue??""}function hz(e){const t=new Map,n={};for(const s of e){for(const i of s.env){const r=t.get(i.key);(!r||i.required&&!r.required)&&t.set(i.key,i)}s.enableFlag&&(t.set(s.enableFlag,{key:s.enableFlag,required:!0}),n[s.enableFlag]="true")}return{specs:[...t.values()],fixedValues:n}}function iAe(e,t){return hz([{env:e}]).specs.map(s=>({...s,value:Q1(s,t)}))}function pz(e,t){const n=new Map;for(const s of e){const i=Q1(s,t);i.trim()&&n.set(s.key,i)}return[...n].map(([s,i])=>({key:s,value:i}))}function O3(e,t){return e.find(n=>n.required&&!Q1(n,t).trim())}function v2(e,t){if(e.format!=="json")return;const n=Q1(e,t).trim();if(n)try{JSON.parse(n);return}catch{return"JSON 格式不正确"}}function mz(e,t){for(const n of e){const s=v2(n,t);if(s)return{spec:n,error:s}}}function rAe(e){return(e==null?void 0:e.name)==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}function aAe(e,t){return t==="build"?"build_failed":(e==null?void 0:e.name)==="RuntimeProbeError"?"runtime_probe_error":e instanceof DOMException&&e.name==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}const M3=new Set;let yx={enabled:!1},ts,Mf=null,L3=null,Bd="",EN="unknown",gz="unknown",Vm=[];function oAe(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e)}function lAe(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>[t,oAe(n)]))}function cAe(e){return{}}function uAe(){return new Date().toISOString().slice(0,10)}function dAe(e){if(!e)return!0;if(e.dedupeKey){if(M3.has(e.dedupeKey))return!1;M3.add(e.dedupeKey)}if(e.dailyDedupeKey&&typeof localStorage<"u"){const t=`veadk.studio.telemetry.${uAe()}.${e.dailyDedupeKey}`;try{if(localStorage.getItem(t)==="1")return!1;localStorage.setItem(t,"1")}catch{}}return!0}function bz(e){if(Mf){try{Mf("report",{ev_type:"custom",payload:{...e,type:"event"},extra:{timestamp:Date.now()}})}catch(t){console.warn("[telemetry] failed to send Studio event:",t)}return}Vm=[...Vm.slice(-49),e]}function fAe(){if(!Mf)return;const e=Vm;Vm=[];for(const t of e)bz(t)}function hAe(e){if(yx=e,ts=e.studio,!e.enabled||!e.apmplus||L3)return;const t=e.apmplus;L3=Jc(()=>import("./index.esm-Bao40dC4.js"),[]).then(n=>{var i;const s=n.default;s("init",{aid:t.aid,token:t.token,domain:t.domain,env:t.env,release:(i=e.studio)==null?void 0:i.version,userId:Bd||void 0}),s("start"),Mf=s,fAe()}).catch(n=>{console.warn("[telemetry] APMPlus SDK failed to initialize:",n),yx={enabled:!1},Vm=[]})}function fh(e,t={},n,s){if(!yx.enabled||!yx.apmplus||!dAe(s))return;const i=e!=="studio_instance_loaded"?{user_id:Bd,user_role:EN,user_source:gz}:{};bz({name:e,categories:lAe({studio_deploy_id:ts==null?void 0:ts.deployId,user_pool_id:ts==null?void 0:ts.userPoolId,vefaas_application_id:ts==null?void 0:ts.applicationId,vefaas_function_id:ts==null?void 0:ts.functionId,studio_region:ts==null?void 0:ts.region,studio_project:ts==null?void 0:ts.project,studio_version:ts==null?void 0:ts.version,...i,...t}),metrics:cAe()})}function pAe(e){if(Bd=e.userId.trim(),!!Bd){if(EN=e.role??"unknown",gz=e.local?"local":"sso",Mf)try{Mf("config",{userId:Bd})}catch(t){console.warn("[telemetry] failed to update Studio user id:",t)}fh("studio_user_authenticated",{},void 0,{dailyDedupeKey:["studio_user_authenticated",(ts==null?void 0:ts.deployId)??"",Bd,EN].join(":")})}}function yz(e){return{deploy_source:e.source,deploy_action:e.action,deploy_region:e.region,runtime_network_type:e.networkType,feishu_enabled:e.feishuEnabled}}function mAe(e){fh("studio_instance_loaded",{agents_source:e.agentsSource},void 0,{dedupeKey:"studio_instance_loaded"})}function gAe(e){fh("studio_agent_deploy_succeeded",{...yz(e),runtime_id:e.runtimeId})}function bAe(e){fh("studio_agent_deploy_failed",{...yz(e),failed_phase:e.phase,error_kind:aAe(e.error,e.phase)})}function yAe(e){fh("studio_sandbox_create_succeeded",{sandbox_kind:e.kind,sandbox_source:e.source,sandbox_session_id:e.sessionId})}function xAe(e){fh("studio_sandbox_create_failed",{sandbox_kind:e.kind,sandbox_source:e.source,error_kind:rAe(e.error)})}const EAe=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let s=0;s<8;s++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function vAe(e){let t=4294967295;for(let n=0;n>>8;return(t^4294967295)>>>0}function Es(e,t){e.push(t&255,t>>>8&255)}function mr(e,t){e.push(t&255,t>>>8&255,t>>>16&255,t>>>24&255)}const D3=2048,jw=20,P3=0;function wAe(e){const t=new TextEncoder,n=[],s=[];let i=0;for(const p of e){const m=t.encode(p.path),b=t.encode(p.content),v=vAe(b),y=b.length,x=[];mr(x,67324752),Es(x,jw),Es(x,D3),Es(x,P3),Es(x,0),Es(x,0),mr(x,v),mr(x,y),mr(x,y),Es(x,m.length),Es(x,0);const E=Uint8Array.from(x);n.push(E,m,b),s.push({nameBytes:m,dataBytes:b,crc:v,size:y,offset:i}),i+=E.length+m.length+b.length}const r=i,a=[];let l=0;for(const p of s){const m=[];mr(m,33639248),Es(m,jw),Es(m,jw),Es(m,D3),Es(m,P3),Es(m,0),Es(m,0),mr(m,p.crc),mr(m,p.size),mr(m,p.size),Es(m,p.nameBytes.length),Es(m,0),Es(m,0),Es(m,0),Es(m,0),mr(m,0),mr(m,p.offset);const b=Uint8Array.from(m);a.push(b,p.nameBytes),l+=b.length+p.nameBytes.length}const c=[];mr(c,101010256),Es(c,0),Es(c,0),Es(c,s.length),Es(c,s.length),mr(c,l),mr(c,r),Es(c,0);const u=[...n,...a,Uint8Array.from(c)],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 SAe=g.lazy(()=>Jc(()=>import("./CodeEditor-BVx0KMNT.js"),[]));function _Ae(e){const t={name:"",children:new Map};for(const n of e){const s=n.path.split("/").filter(Boolean);let i=t;s.forEach((r,a)=>{let l=i.children.get(r);l||(l={name:r,children:new Map},i.children.set(r,l)),a===s.length-1&&(l.path=n.path),i=l})}return t}function NAe(e){return[...e.children.values()].sort((t,n)=>{const s=t.children.size>0&&t.path===void 0,i=n.children.size>0&&n.path===void 0;return s!==i?s?-1:1:t.name.localeCompare(n.name)})}function xz({project:e,open:t,onClose:n,onChange:s}){var m;const[i,r]=g.useState(((m=e.files[0])==null?void 0:m.path)??null),[a,l]=g.useState(new Set),c=g.useRef(null),u=g.useMemo(()=>_Ae(e.files),[e.files]),d=e.files.find(b=>b.path===i)??null;if(g.useEffect(()=>{var y;if(!t)return;const b=document.body.style.overflow;document.body.style.overflow="hidden",(y=c.current)==null||y.focus();const v=x=>{x.key==="Escape"&&n()};return window.addEventListener("keydown",v),()=>{document.body.style.overflow=b,window.removeEventListener("keydown",v)}},[n,t]),g.useEffect(()=>{d||e.files.length===0||r(e.files[0].path)},[e.files,d]),!t)return null;function f(b){l(v=>{const y=new Set(v);return y.has(b)?y.delete(b):y.add(b),y})}function h(b,v,y){return NAe(b).map(x=>{const E=y?`${y}/${x.name}`:x.name;if(!(x.children.size>0&&x.path===void 0)&&x.path)return o.jsxs("button",{type:"button",className:`code-browser-file${i===x.path?" is-active":""}`,style:{paddingLeft:`${12+v*16}px`},onClick:()=>r(x.path??null),title:x.path,children:[o.jsx(yR,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]},E);const _=a.has(E);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+v*16}px`},onClick:()=>f(E),"aria-expanded":!_,children:[o.jsx(Ql,{className:_?"":"is-open","aria-hidden":"true"}),o.jsx(mB,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]}),!_&&h(x,v+1,E)]},E)})}function p(b){d&&s({...e,files:e.files.map(v=>v.path===d.path?{...v,content:b}:v)})}return hi.createPortal(o.jsx("div",{className:"code-browser-backdrop",onMouseDown:b=>{b.target===b.currentTarget&&n()},children:o.jsxs("section",{className:"code-browser-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"code-browser-title",children:[o.jsxs("header",{className:"code-browser-head",children:[o.jsxs("div",{className:"code-browser-title-wrap",children:[o.jsx("span",{className:"code-browser-title-icon","aria-hidden":"true",children:o.jsx(_k,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:"code-browser-title",children:"项目代码"}),o.jsx("p",{children:e.name||"Agent 项目"})]})]}),o.jsx("button",{ref:c,type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭代码浏览器",children:o.jsx(Ti,{"aria-hidden":"true"})})]}),o.jsxs("div",{className:"code-browser-workspace",children:[o.jsxs("aside",{className:"code-browser-sidebar","aria-label":"项目文件",children:[o.jsxs("div",{className:"code-browser-sidebar-head",children:["文件 ",o.jsx("span",{children:e.files.length})]}),o.jsx("div",{className:"code-browser-tree",children:e.files.length>0?h(u,0,""):o.jsx("div",{className:"code-browser-empty",children:"暂无项目文件"})})]}),o.jsxs("main",{className:"code-browser-main",children:[o.jsxs("div",{className:"code-browser-path",children:[o.jsx(yR,{"aria-hidden":"true"}),o.jsx("span",{children:(d==null?void 0:d.path)??"未选择文件"})]}),o.jsx("div",{className:"code-browser-editor",children:d?o.jsx(g.Suspense,{fallback:o.jsx("div",{className:"code-browser-empty",children:"正在加载编辑器…"}),children:o.jsx(SAe,{value:d.content,path:d.path,onChange:p})}):o.jsx("div",{className:"code-browser-empty",children:"从左侧选择文件以查看代码"})})]})]})]})}),document.body)}function TAe({project:e,onChange:t,className:n="",label:s="查看源码"}){const[i,r]=g.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:`code-browser-trigger ${n}`.trim(),onClick:()=>r(!0),"aria-label":"查看和编辑项目源码",title:s,children:[o.jsx(_k,{"aria-hidden":"true"}),o.jsx("span",{children:s})]}),o.jsx(xz,{project:e,open:i,onClose:()=>r(!1),onChange:t})]})}function xx({message:e,className:t="",onRetry:n,retryLabel:s="重试部署",defaultExpanded:i=!0}){const[r,a]=g.useState(i),[l,c]=g.useState(!1),[u,d]=g.useState(!1),f=async()=>{try{await navigator.clipboard.writeText(e),c(!0),setTimeout(()=>c(!1),1500)}catch{c(!1)}},h=async()=>{if(!(!n||u)){d(!0);try{await n()}finally{d(!1)}}};return o.jsxs("div",{className:`deploy-error-message${r?" is-expanded":""}${t?` ${t}`:""}`,role:"alert",children:[o.jsx("p",{className:"deploy-error-message-text",children:e}),o.jsxs("div",{className:"deploy-error-message-actions",children:[n&&o.jsxs("button",{type:"button",className:"deploy-error-retry",disabled:u,onClick:()=>void h(),children:[u?o.jsx(mn,{className:"spin"}):o.jsx(Tee,{}),u?"重试中…":s]}),o.jsx("button",{type:"button",title:r?"收起错误信息":"展开完整错误信息","aria-label":r?"收起错误信息":"展开完整错误信息",onClick:()=>a(p=>!p),children:r?o.jsx(bee,{}):o.jsx(qc,{})}),o.jsx("button",{type:"button",title:l?"已复制":"复制完整错误信息","aria-label":l?"已复制":"复制完整错误信息",onClick:()=>void f(),children:l?o.jsx(Ra,{}):o.jsx(Zx,{})})]})]})}const kAe=5e4;function AAe(e,t){if(!e)return t;if(!t||e.endsWith(t))return e;if(t.startsWith(e))return t;const n=e.split(` +`+qke(gz(s))}function sAe(e){const t=Kke(e);return S2(t)}const iAe=[{kind:"custom",icon:Pee,title:"自定义",desc:"分步配置模型、工具、记忆、知识库等组件。"},{kind:"intelligent",icon:xee,title:"智能模式",desc:"敬请期待",disabled:!0},{kind:"template",icon:mee,title:"从模板新建",desc:"敬请期待",disabled:!0},{kind:"workflow",icon:Bee,title:"工作流",desc:"敬请期待",disabled:!0}];function rAe({onSelect:e,onImport:t}){const n=g.useRef(null),[s,i]=g.useState(""),r=iAe.map(l=>({key:l.kind,icon:l.icon,title:l.title,desc:l.desc,disabled:l.disabled,onClick:()=>e(l.kind)})),a=async l=>{var u;const c=(u=l.target.files)==null?void 0:u[0];if(l.target.value="",!!c)try{const d=await c.text();t(sAe(d))}catch(d){i(`导入失败:${d instanceof Error?d.message:String(d)}`)}};return o.jsx(yH,{title:"从 0 快速创建",sub:"选择一种方式开始",cards:r,footer:o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[o.jsxs("button",{className:"stk-import",onClick:()=>{var l;return(l=n.current)==null?void 0:l.click()},children:[o.jsx(Lee,{}),"导入 YAML 配置"]}),s&&o.jsx("span",{style:{fontSize:12,color:"hsl(var(--destructive))"},children:s}),o.jsx("input",{ref:n,type:"file",accept:".yaml,.yml,text/yaml",style:{display:"none"},onChange:a})]})})}const aAe="modulepreload",oAe=function(e){return"/"+e},D3={},eu=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(n.map(c=>{if(c=oAe(c),c in D3)return;D3[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":aAe,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),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 ${c}`)))})}))}function r(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return i.then(a=>{for(const l of a||[])l.status==="rejected"&&r(l.reason);return t().catch(r)})};function J1(e,t){return t[e.key]??e.defaultValue??""}function bz(e){const t=new Map,n={};for(const s of e){for(const i of s.env){const r=t.get(i.key);(!r||i.required&&!r.required)&&t.set(i.key,i)}s.enableFlag&&(t.set(s.enableFlag,{key:s.enableFlag,required:!0}),n[s.enableFlag]="true")}return{specs:[...t.values()],fixedValues:n}}function lAe(e,t){return bz([{env:e}]).specs.map(s=>({...s,value:J1(s,t)}))}function yz(e,t){const n=new Map;for(const s of e){const i=J1(s,t);i.trim()&&n.set(s.key,i)}return[...n].map(([s,i])=>({key:s,value:i}))}function P3(e,t){return e.find(n=>n.required&&!J1(n,t).trim())}function N2(e,t){if(e.format!=="json")return;const n=J1(e,t).trim();if(n)try{JSON.parse(n);return}catch{return"JSON 格式不正确"}}function xz(e,t){for(const n of e){const s=N2(n,t);if(s)return{spec:n,error:s}}}function cAe(e){return(e==null?void 0:e.name)==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}function uAe(e,t){return t==="build"?"build_failed":(e==null?void 0:e.name)==="RuntimeProbeError"?"runtime_probe_error":e instanceof DOMException&&e.name==="AbortError"?"abort":e instanceof Error&&e.name&&e.name!=="Error"?e.name:"unknown"}const B3=new Set;let Ex={enabled:!1},Xn,Df=null,U3=null,Fd="",_N="unknown",Ez="unknown",zm=[];function dAe(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e)}function fAe(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>[t,dAe(n)]))}function hAe(e){return{}}function pAe(){return new Date().toISOString().slice(0,10)}function mAe(e){if(!e)return!0;if(e.dedupeKey){if(B3.has(e.dedupeKey))return!1;B3.add(e.dedupeKey)}if(e.dailyDedupeKey&&typeof localStorage<"u"){const t=`veadk.studio.telemetry.${pAe()}.${e.dailyDedupeKey}`;try{if(localStorage.getItem(t)==="1")return!1;localStorage.setItem(t,"1")}catch{}}return!0}function vz(e){if(Df){try{Df("report",{ev_type:"custom",payload:{...e,type:"event"},extra:{timestamp:Date.now()}})}catch(t){console.warn("[telemetry] failed to send Studio event:",t)}return}zm=[...zm.slice(-49),e]}function gAe(){if(!Df)return;const e=zm;zm=[];for(const t of e)vz(t)}function bAe(e){if(Ex=e,Xn=e.studio,!e.enabled||!e.apmplus||U3)return;const t=e.apmplus;U3=eu(()=>import("./index.esm-Bao40dC4.js"),[]).then(n=>{var i;const s=n.default;s("init",{aid:t.aid,token:t.token,domain:t.domain,env:t.env,release:(i=e.studio)==null?void 0:i.version,userId:Fd||void 0}),s("start"),Df=s,gAe()}).catch(n=>{console.warn("[telemetry] APMPlus SDK failed to initialize:",n),Ex={enabled:!1},zm=[]})}function ph(e,t={},n,s){if(!Ex.enabled||!Ex.apmplus||!mAe(s))return;const i=e!=="studio_instance_loaded"?{user_id:Fd,user_role:_N,user_source:Ez}:{};vz({name:e,categories:fAe({studio_deploy_id:Xn==null?void 0:Xn.deployId,user_pool_id:Xn==null?void 0:Xn.userPoolId,vefaas_application_id:Xn==null?void 0:Xn.applicationId,vefaas_function_id:Xn==null?void 0:Xn.functionId,studio_region:Xn==null?void 0:Xn.region,studio_project:Xn==null?void 0:Xn.project,studio_version:Xn==null?void 0:Xn.version,...i,...t}),metrics:hAe()})}function yAe(e){if(Fd=e.userId.trim(),!!Fd){if(_N=e.role??"unknown",Ez=e.local?"local":"sso",Df)try{Df("config",{userId:Fd})}catch(t){console.warn("[telemetry] failed to update Studio user id:",t)}ph("studio_user_authenticated",{},void 0,{dailyDedupeKey:["studio_user_authenticated",(Xn==null?void 0:Xn.deployId)??"",Fd,_N].join(":")})}}function wz(e){return{deploy_source:e.source,deploy_action:e.action,deploy_region:e.region,runtime_network_type:e.networkType,feishu_enabled:e.feishuEnabled}}function xAe(e){ph("studio_instance_loaded",{agents_source:e.agentsSource},void 0,{dedupeKey:"studio_instance_loaded"})}function EAe(e){ph("studio_agent_deploy_succeeded",{...wz(e),runtime_id:e.runtimeId})}function vAe(e){ph("studio_agent_deploy_failed",{...wz(e),failed_phase:e.phase,error_kind:uAe(e.error,e.phase)})}function wAe(e){ph("studio_sandbox_create_succeeded",{sandbox_kind:e.kind,sandbox_source:e.source,sandbox_session_id:e.sessionId})}function SAe(e){ph("studio_sandbox_create_failed",{sandbox_kind:e.kind,sandbox_source:e.source,error_kind:cAe(e.error)})}const _Ae=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let s=0;s<8;s++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function NAe(e){let t=4294967295;for(let n=0;n>>8;return(t^4294967295)>>>0}function vs(e,t){e.push(t&255,t>>>8&255)}function mr(e,t){e.push(t&255,t>>>8&255,t>>>16&255,t>>>24&255)}const F3=2048,Mw=20,$3=0;function TAe(e){const t=new TextEncoder,n=[],s=[];let i=0;for(const p of e){const m=t.encode(p.path),b=t.encode(p.content),v=NAe(b),y=b.length,x=[];mr(x,67324752),vs(x,Mw),vs(x,F3),vs(x,$3),vs(x,0),vs(x,0),mr(x,v),mr(x,y),mr(x,y),vs(x,m.length),vs(x,0);const E=Uint8Array.from(x);n.push(E,m,b),s.push({nameBytes:m,dataBytes:b,crc:v,size:y,offset:i}),i+=E.length+m.length+b.length}const r=i,a=[];let l=0;for(const p of s){const m=[];mr(m,33639248),vs(m,Mw),vs(m,Mw),vs(m,F3),vs(m,$3),vs(m,0),vs(m,0),mr(m,p.crc),mr(m,p.size),mr(m,p.size),vs(m,p.nameBytes.length),vs(m,0),vs(m,0),vs(m,0),vs(m,0),mr(m,0),mr(m,p.offset);const b=Uint8Array.from(m);a.push(b,p.nameBytes),l+=b.length+p.nameBytes.length}const c=[];mr(c,101010256),vs(c,0),vs(c,0),vs(c,s.length),vs(c,s.length),mr(c,l),mr(c,r),vs(c,0);const u=[...n,...a,Uint8Array.from(c)],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 kAe=g.lazy(()=>eu(()=>import("./CodeEditor-CCfFnG8t.js"),[]));function AAe(e){const t={name:"",children:new Map};for(const n of e){const s=n.path.split("/").filter(Boolean);let i=t;s.forEach((r,a)=>{let l=i.children.get(r);l||(l={name:r,children:new Map},i.children.set(r,l)),a===s.length-1&&(l.path=n.path),i=l})}return t}function CAe(e){return[...e.children.values()].sort((t,n)=>{const s=t.children.size>0&&t.path===void 0,i=n.children.size>0&&n.path===void 0;return s!==i?s?-1:1:t.name.localeCompare(n.name)})}function Sz({project:e,open:t,onClose:n,onChange:s}){var m;const[i,r]=g.useState(((m=e.files[0])==null?void 0:m.path)??null),[a,l]=g.useState(new Set),c=g.useRef(null),u=g.useMemo(()=>AAe(e.files),[e.files]),d=e.files.find(b=>b.path===i)??null;if(g.useEffect(()=>{var y;if(!t)return;const b=document.body.style.overflow;document.body.style.overflow="hidden",(y=c.current)==null||y.focus();const v=x=>{x.key==="Escape"&&n()};return window.addEventListener("keydown",v),()=>{document.body.style.overflow=b,window.removeEventListener("keydown",v)}},[n,t]),g.useEffect(()=>{d||e.files.length===0||r(e.files[0].path)},[e.files,d]),!t)return null;function f(b){l(v=>{const y=new Set(v);return y.has(b)?y.delete(b):y.add(b),y})}function h(b,v,y){return CAe(b).map(x=>{const E=y?`${y}/${x.name}`:x.name;if(!(x.children.size>0&&x.path===void 0)&&x.path)return o.jsxs("button",{type:"button",className:`code-browser-file${i===x.path?" is-active":""}`,style:{paddingLeft:`${12+v*16}px`},onClick:()=>r(x.path??null),title:x.path,children:[o.jsx(wR,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]},E);const _=a.has(E);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+v*16}px`},onClick:()=>f(E),"aria-expanded":!_,children:[o.jsx(nc,{className:_?"":"is-open","aria-hidden":"true"}),o.jsx(xB,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]}),!_&&h(x,v+1,E)]},E)})}function p(b){d&&s({...e,files:e.files.map(v=>v.path===d.path?{...v,content:b}:v)})}return hi.createPortal(o.jsx("div",{className:"code-browser-backdrop",onMouseDown:b=>{b.target===b.currentTarget&&n()},children:o.jsxs("section",{className:"code-browser-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"code-browser-title",children:[o.jsxs("header",{className:"code-browser-head",children:[o.jsxs("div",{className:"code-browser-title-wrap",children:[o.jsx("span",{className:"code-browser-title-icon","aria-hidden":"true",children:o.jsx(Ak,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:"code-browser-title",children:"项目代码"}),o.jsx("p",{children:e.name||"Agent 项目"})]})]}),o.jsx("button",{ref:c,type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭代码浏览器",children:o.jsx(Ti,{"aria-hidden":"true"})})]}),o.jsxs("div",{className:"code-browser-workspace",children:[o.jsxs("aside",{className:"code-browser-sidebar","aria-label":"项目文件",children:[o.jsxs("div",{className:"code-browser-sidebar-head",children:["文件 ",o.jsx("span",{children:e.files.length})]}),o.jsx("div",{className:"code-browser-tree",children:e.files.length>0?h(u,0,""):o.jsx("div",{className:"code-browser-empty",children:"暂无项目文件"})})]}),o.jsxs("main",{className:"code-browser-main",children:[o.jsxs("div",{className:"code-browser-path",children:[o.jsx(wR,{"aria-hidden":"true"}),o.jsx("span",{children:(d==null?void 0:d.path)??"未选择文件"})]}),o.jsx("div",{className:"code-browser-editor",children:d?o.jsx(g.Suspense,{fallback:o.jsx("div",{className:"code-browser-empty",children:"正在加载编辑器…"}),children:o.jsx(kAe,{value:d.content,path:d.path,onChange:p})}):o.jsx("div",{className:"code-browser-empty",children:"从左侧选择文件以查看代码"})})]})]})]})}),document.body)}function IAe({project:e,onChange:t,className:n="",label:s="查看源码"}){const[i,r]=g.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:`code-browser-trigger ${n}`.trim(),onClick:()=>r(!0),"aria-label":"查看和编辑项目源码",title:s,children:[o.jsx(Ak,{"aria-hidden":"true"}),o.jsx("span",{children:s})]}),o.jsx(Sz,{project:e,open:i,onClose:()=>r(!1),onChange:t})]})}function vx({message:e,className:t="",onRetry:n,retryLabel:s="重试部署",defaultExpanded:i=!0}){const[r,a]=g.useState(i),[l,c]=g.useState(!1),[u,d]=g.useState(!1),f=async()=>{try{await navigator.clipboard.writeText(e),c(!0),setTimeout(()=>c(!1),1500)}catch{c(!1)}},h=async()=>{if(!(!n||u)){d(!0);try{await n()}finally{d(!1)}}};return o.jsxs("div",{className:`deploy-error-message${r?" is-expanded":""}${t?` ${t}`:""}`,role:"alert",children:[o.jsx("p",{className:"deploy-error-message-text",children:e}),o.jsxs("div",{className:"deploy-error-message-actions",children:[n&&o.jsxs("button",{type:"button",className:"deploy-error-retry",disabled:u,onClick:()=>void h(),children:[u?o.jsx(dn,{className:"spin"}):o.jsx(Iee,{}),u?"重试中…":s]}),o.jsx("button",{type:"button",title:r?"收起错误信息":"展开完整错误信息","aria-label":r?"收起错误信息":"展开完整错误信息",onClick:()=>a(p=>!p),children:r?o.jsx(vee,{}):o.jsx(Yc,{})}),o.jsx("button",{type:"button",title:l?"已复制":"复制完整错误信息","aria-label":l?"已复制":"复制完整错误信息",onClick:()=>void f(),children:l?o.jsx(ja,{}):o.jsx(e1,{})})]})]})}const jAe=5e4;function RAe(e,t){if(!e)return t;if(!t||e.endsWith(t))return e;if(t.startsWith(e))return t;const n=e.split(` `),s=t.split(` `),i=Math.min(n.length,s.length,260);for(let r=i;r>0;r-=1){const a=n.slice(-r).join(` `),l=s.slice(0,r).join(` `);if(a===l){const c=s.slice(r).join(` `);return c?`${e} ${c}`:e}}return`${e} -${t}`}function CAe(e,t){if(e.length<=t)return{text:e,omitted:!1};let n=e.slice(-t);const s=n.indexOf(` -`);return s>=0&&(n=n.slice(s+1)),{text:n,omitted:!0}}function B3(e,t,n=kAe){const s=AAe((e==null?void 0:e.text)??"",t.text??""),i=CAe(s,n),r=i.text?i.text.split(` -`).length:0,a=!!(t.snapshotTruncated||t.truncated),l=!!(e!=null&&e.omittedEarly||i.omitted);return{...t,text:i.text,lineCount:r,truncated:!!(e!=null&&e.truncated||t.truncated||l),omittedEarly:l,snapshotTruncated:!!(e!=null&&e.snapshotTruncated||a)}}lr.registerLanguage("python",EF);lr.registerLanguage("typescript",RF);lr.registerLanguage("javascript",pF);lr.registerLanguage("json",mF);lr.registerLanguage("yaml",OF);lr.registerLanguage("markdown",xF);lr.registerLanguage("bash",lF);lr.registerLanguage("ini",cF);lr.registerLanguage("dockerfile",Sye);lr.registerLanguage("makefile",yF);const IAe=g.lazy(()=>Jc(()=>import("./CodeEditor-BVx0KMNT.js"),[])),fl=()=>{};function jAe({open:e,isUpdate:t,onCancel:n,onConfirm:s}){const i=g.useRef(null);return g.useEffect(()=>{var l;if(!e)return;const r=document.body.style.overflow;document.body.style.overflow="hidden",(l=i.current)==null||l.focus();const a=c=>{c.key==="Escape"&&n()};return window.addEventListener("keydown",a),()=>{document.body.style.overflow=r,window.removeEventListener("keydown",a)}},[n,e]),e?hi.createPortal(o.jsx("div",{className:"code-browser-backdrop pp-confirm-backdrop",onMouseDown:r=>{r.target===r.currentTarget&&n()},children:o.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:[o.jsxs("header",{className:"code-browser-head pp-confirm-head",children:[o.jsxs("div",{className:"code-browser-title-wrap",children:[o.jsx("span",{className:"code-browser-title-icon pp-confirm-icon","aria-hidden":"true",children:o.jsx(Iee,{})}),o.jsx("h2",{id:"pp-confirm-title",children:t?"确认更新":"确认部署"})]}),o.jsx("button",{type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭部署确认",children:o.jsx(Ti,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"pp-confirm-body",children:o.jsx("p",{id:"pp-confirm-description",children:t?"将更新并发布到当前云端 Runtime,过程可能需要几分钟。确定继续吗?":"将创建新的云端 Runtime,部署过程可能需要几分钟。确定继续吗?"})}),o.jsxs("footer",{className:"pp-confirm-actions",children:[o.jsx("button",{ref:i,type:"button",onClick:n,children:"取消"}),o.jsx("button",{type:"button",className:"is-primary",onClick:s,children:t?"确定更新":"确定部署"})]})]})}),document.body):null}function Ez({ariaLabel:e,value:t,placeholder:n,options:s,disabled:i=!1,onChange:r}){const a=g.useId(),l=g.useRef(null),c=g.useRef(null),u=g.useRef([]),[d,f]=g.useState(!1),[h,p]=g.useState(0),m=s.find(x=>x.value===t);g.useEffect(()=>{if(!d)return;const x=E=>{E.target instanceof Node&&l.current&&!l.current.contains(E.target)&&f(!1)};return window.addEventListener("pointerdown",x),()=>window.removeEventListener("pointerdown",x)},[d]),g.useEffect(()=>{var x;d&&((x=u.current[h])==null||x.focus())},[h,d]);const b=(x=1)=>{const E=s.findIndex(_=>_.value===t),w=E>=0?E:x===1?0:Math.max(0,s.length-1);p(w),f(!0)},v=x=>{s.length!==0&&p((x+s.length)%s.length)},y=x=>{var E;r(x.value),f(!1),(E=c.current)==null||E.focus()};return o.jsxs("div",{className:"pp-deployment-select",ref:l,onKeyDown:x=>{var E;if(x.key==="Escape"&&d){x.preventDefault(),f(!1),(E=c.current)==null||E.focus();return}if(x.key==="Tab"){f(!1);return}x.key==="ArrowDown"?(x.preventDefault(),d?v(h+1):b(1)):x.key==="ArrowUp"?(x.preventDefault(),d?v(h-1):b(-1)):d&&x.key==="Home"?(x.preventDefault(),p(0)):d&&x.key==="End"&&(x.preventDefault(),p(Math.max(0,s.length-1)))},children:[o.jsxs("button",{ref:c,type:"button",className:"pp-deployment-select-trigger","aria-label":e,"aria-haspopup":"listbox","aria-expanded":d,"aria-controls":d?a:void 0,disabled:i||s.length===0,onClick:()=>{d?f(!1):b()},children:[o.jsx("span",{className:m?void 0:"is-placeholder",children:(m==null?void 0:m.label)??n}),o.jsx(hB,{"aria-hidden":"true",className:`pp-deployment-select-chevron${d?" is-open":""}`})]}),d&&o.jsx("div",{id:a,className:"pp-deployment-select-menu",role:"listbox","aria-label":e,children:s.map((x,E)=>{const w=x.value===t;return o.jsxs("button",{ref:_=>{u.current[E]=_},type:"button",role:"option","aria-selected":w,tabIndex:E===h?0:-1,className:`pp-deployment-select-option${w?" is-selected":""}`,title:x.description,onFocus:()=>p(E),onClick:()=>y(x),children:[o.jsxs("span",{className:"pp-deployment-select-copy",children:[o.jsxs("span",{className:"pp-deployment-select-name",children:[x.label,x.badge&&o.jsx("span",{className:"pp-deployment-select-badge",children:x.badge})]}),x.description&&o.jsx("small",{children:x.description})]}),w&&o.jsx(Ra,{"aria-hidden":"true"})]},x.value)})})]})}function RAe({value:e,disabled:t,onChange:n}){const[s,i]=g.useState([]),[r,a]=g.useState(!0),[l,c]=g.useState(null),[u,d]=g.useState(0);g.useEffect(()=>{const p=new AbortController;return a(!0),c(null),ZB(p.signal).then(m=>i(m)).catch(m=>{m instanceof DOMException&&m.name==="AbortError"||(i([]),c(m instanceof Error?m.message:String(m)))}).finally(()=>{p.signal.aborted||a(!1)}),()=>p.abort()},[u]);const f=g.useMemo(()=>[...s].sort((p,m)=>Number(m.isCurrent)-Number(p.isCurrent)).map(p=>({value:p.uid,label:p.name.trim()||"未命名用户池",description:p.domain||p.uid,badge:p.isCurrent?"当前用户池":void 0})),[s]),h=s.find(p=>p.uid===e);return o.jsxs("div",{className:"pp-user-pool-picker",children:[o.jsx(Ez,{ariaLabel:"部署用户池",value:e,placeholder:r?"正在加载用户池…":"请选择用户池",options:f,disabled:t||r||!!l,onChange:n}),l?o.jsxs("div",{className:"pp-user-pool-error",role:"alert",children:[o.jsx("span",{children:l}),o.jsx("button",{type:"button",onClick:()=>d(p=>p+1),children:"重试"})]}):r?o.jsxs("span",{className:"pp-user-pool-status","aria-live":"polite",children:[o.jsx(mn,{"aria-hidden":"true",className:"pp-user-pool-spinner"}),"正在加载 Identity 用户池…"]}):s.length===0?o.jsx("span",{className:"pp-user-pool-status",children:"当前账号下暂无 Identity 用户池。"}):h!=null&&h.isCurrent?o.jsx("span",{className:"pp-user-pool-status",children:"当前 Studio 的登录 JWT 将透传访问此 Runtime。"}):h?o.jsx("div",{className:"pp-user-pool-error",role:"alert",children:o.jsx("span",{children:"所选用户池不是当前 Studio 使用的用户池,部署后无法从 Studio 调用此 Runtime。"})}):o.jsx("span",{className:"pp-user-pool-status",children:"当前 Studio 使用的用户池已在列表中标注。"})]})}const OAe=[{value:"api_key",label:"API Key",description:"默认方式,使用 Runtime API Key 访问"},{value:"user_pool",label:"用户池",description:"使用 Identity 用户池签发的 JWT"}],MAe={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"},U3={dockerfile:"dockerfile","requirements.txt":"plaintext","requirements-dev.txt":"plaintext",".env":"ini",".gitignore":"plaintext",makefile:"makefile"};function F3(e){return e.replace(/&/g,"&").replace(//g,">")}function LAe(e){const n=(e.split("/").pop()??e).toLowerCase();if(U3[n])return U3[n];if(n.startsWith("dockerfile"))return"dockerfile";if(n.startsWith(".env"))return"ini";const s=n.lastIndexOf(".");if(s===-1)return null;const i=n.slice(s+1);return MAe[i]??null}function DAe(e,t){try{const n=LAe(t);return n&&lr.getLanguage(n)?lr.highlight(e,{language:n,ignoreIllegals:!0}).value:n===null?lr.highlightAuto(e).value:F3(e)}catch{return F3(e)}}const PAe=[{phase:"build",label:"构建镜像"},{phase:"deploy",label:"部署"},{phase:"publish",label:"发布"}],BAe=[{phase:"upload",label:"上传代码包"},{phase:"build",label:"镜像打包"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}],UAe={phase:"update",label:"更新实例配置"},FAe={phase:"evaluation",label:"创建评测集"};function $Ae(e){return e?!e.memory.shortTerm||(e.shortTermBackend||"local")==="local":!1}function HAe(e,t){const n=Number(e),s=Number(t);return!e.trim()||!t.trim()||!Number.isSafeInteger(n)||!Number.isSafeInteger(s)||n<1||s<1?{valid:!1,error:"实例数必须为大于 0 的整数。"}:n>s?{valid:!1,error:"最小实例数不能大于最大实例数。"}:{valid:!0,min:n,max:s}}function zAe(e){const t={name:"",children:new Map};for(const n of e){const s=n.path.split("/").filter(Boolean);let i=t;s.forEach((r,a)=>{let l=i.children.get(r);l||(l={name:r,children:new Map},i.children.set(r,l)),a===s.length-1&&(l.path=n.path),i=l})}return t}function VAe(e){return[...e.children.values()].sort((t,n)=>{const s=t.children.size>0&&t.path===void 0,i=n.children.size>0&&n.path===void 0;return s!==i?s?-1:1:t.name.localeCompare(n.name)})}function GAe(e="",t=""){return{id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,key:e,value:t}}function KAe({left:e,right:t}){const[n,s]=g.useState(null);return g.useLayoutEffect(()=>{const i=document.getElementById("veadk-page-header-left"),r=document.getElementById("veadk-page-header-actions");i&&r&&s({left:i,right:r})},[]),n?o.jsxs(o.Fragment,{children:[hi.createPortal(e,n.left),hi.createPortal(t,n.right)]}):o.jsxs("header",{className:"pp-toolbar",children:[e,t]})}function Z1({project:e,embedded:t=!1,deployDisabledReason:n,agentDraft:s,agentName:i,agentCount:r,releaseConfiguration:a,onChange:l,onDeploy:c,onAgentAdded:u,onDeploymentComplete:d,deploymentActionLabel:f="部署",deploymentActionTargetId:h,deploymentRuntimeId:p,onDeploymentStarted:m,onDeploymentTaskChange:b,feishuEnabled:v=!1,onFeishuEnabledChange:y,deploymentEnv:x=[],deploymentEnvValues:E={},onDeploymentEnvChange:w,network:_,onNetworkChange:S,deployRegion:k="cn-beijing",onDeployRegionChange:T,deploymentTelemetrySource:C="unknown",onBack:I,backLabel:j="返回配置",onExportYaml:L,deploymentPrimaryPane:z,deployDisabled:D=!1}){var un,on,dn;const F=typeof l=="function",A=f.includes("更新"),O=$Ae(s),[P,$]=g.useState(((on=(un=e==null?void 0:e.files)==null?void 0:un[0])==null?void 0:on.path)??null),[R,Y]=g.useState(new Set),[J,U]=g.useState(!1),[te,K]=g.useState(""),[V,W]=g.useState(!1),[q,ue]=g.useState(!1),[me,Se]=g.useState(!1),[de,ge]=g.useState(!1),[Me,ve]=g.useState(null),[re,ke]=g.useState(null),[we,Je]=g.useState({}),[Le,Ve]=g.useState(null),[_e,He]=g.useState(!1),[Pe,qe]=g.useState([]),[Z,ae]=g.useState(!1),ne=g.useId(),[be,Fe]=g.useState("api_key"),[Ke,bt]=g.useState(""),[dt,cn]=g.useState("1"),[Ut,wt]=g.useState(O?"1":"5"),[$t,Ge]=g.useState(!0),[Yt,it]=g.useState(null),ct=g.useRef(!0),Qe=HAe(dt,Ut),vt=!A&&Qe.valid&&(Qe.min!==1||Qe.max!==5),ye=z?BAe:PAe,Ze=vt?[...ye,UAe]:ye,xt=$t?[...Ze,FAe]:Ze;g.useEffect(()=>{if(!h){it(null);return}it(document.getElementById(h))},[h]);const rn=ce=>o.jsxs("div",{className:"pp-network-region",onKeyDown:Ie=>{Ie.key==="Escape"&&ae(!1)},children:[ce&&o.jsx("span",{children:"发布区域"}),o.jsxs("button",{type:"button",className:"pp-region-trigger","aria-label":"部署区域","aria-haspopup":"listbox","aria-expanded":Z,"aria-describedby":A?ne:void 0,disabled:V||A||!T,onClick:()=>ae(Ie=>!Ie),children:[o.jsx("span",{children:k==="cn-shanghai"?"华东 2(上海)":"华北 2(北京)"}),o.jsx(hB,{className:`pp-region-chevron${Z?" is-open":""}`})]}),Z&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>ae(!1)}),o.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":"部署区域",children:[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}].map(Ie=>{const Ue=Ie.value===k;return o.jsxs("button",{type:"button",role:"option","aria-selected":Ue,className:`pp-region-option${Ue?" is-selected":""}`,onClick:()=>{T==null||T(Ie.value),ae(!1)},children:[o.jsx("span",{children:Ie.label}),Ue&&o.jsx(Ra,{"aria-hidden":"true"})]},Ie.value)})})]}),A&&o.jsx("span",{id:ne,className:"pp-region-help",children:"更新时沿用现有 Runtime 的部署区域,无法修改。"})]});g.useEffect(()=>(ct.current=!0,()=>{ct.current=!1}),[]),g.useEffect(()=>{cn("1"),wt(O?"1":"5")},[O]),g.useEffect(()=>{if(!me)return;const ce=document.body.style.overflow;document.body.style.overflow="hidden";const Ie=Ue=>{Ue.key==="Escape"&&Se(!1)};return window.addEventListener("keydown",Ie),()=>{document.body.style.overflow=ce,window.removeEventListener("keydown",Ie)}},[me]);const Hn=g.useMemo(()=>!(e!=null&&e.files)||!Array.isArray(e.files)?{name:"",children:new Map}:zAe(e.files),[e==null?void 0:e.files]);if(!e||!Array.isArray(e.files))return o.jsx("div",{className:"pp-error",children:"项目数据无效"});const ut=e.files.find(ce=>ce.path===P)??null,pt=(_==null?void 0:_.mode)??"public",gn=()=>({source:C,action:p?"update":"create",region:k,networkType:pt,feishuEnabled:v}),en=iAe(v?[...x,...zh]:x,E),St=en.length+Pe.length;function an(ce){Y(Ie=>{const Ue=new Set(Ie);return Ue.has(ce)?Ue.delete(ce):Ue.add(ce),Ue})}function ls(ce,Ie){l&&(l({...e,files:ce}),Ie!==void 0&&$(Ie))}function Rs(ce){ut&&ls(e.files.map(Ie=>Ie.path===ut.path?{...Ie,content:ce}:Ie))}function Rn(){const ce=te.trim();if(U(!1),K(""),!!ce){if(e.files.some(Ie=>Ie.path===ce)){$(ce);return}ls([...e.files,{path:ce,content:""}],ce)}}function Wn(){if(!ut)return;const ce=window.prompt("重命名文件",ut.path),Ie=ce==null?void 0:ce.trim();!Ie||Ie===ut.path||e.files.some(Ue=>Ue.path===Ie)||ls(e.files.map(Ue=>Ue.path===ut.path?{...Ue,path:Ie}:Ue),Ie)}function bn(){var Ie;if(!ut)return;const ce=e.files.filter(Ue=>Ue.path!==ut.path);ls(ce,((Ie=ce[0])==null?void 0:Ie.path)??null)}function yn(ce,Ie){qe(Ue=>Ue.map(nt=>nt.id===ce?{...nt,...Ie}:nt))}function Xn(ce){qe(Ie=>Ie.filter(Ue=>Ue.id!==ce))}function zs(){qe(ce=>[...ce,GAe()])}function pi(ce){S&&S(ce==="public"?void 0:{..._??{mode:ce},mode:ce})}function bs(ce){S==null||S({..._??{mode:"private"},...ce})}function Js(){const ce=new Map(Pe.map(Ue=>({key:Ue.key.trim(),value:Ue.value})).filter(Ue=>Ue.key.length>0).map(Ue=>[Ue.key,Ue.value])),Ie=v?[...x,...zh]:x;for(const Ue of pz(Ie,E))ce.set(Ue.key,Ue.value);return[...ce].map(([Ue,nt])=>({key:Ue,value:nt}))}async function On(){if(!(!y||V||de)){ve(null),ge(!0);try{await y(!v)}catch(ce){ct.current&&ve(`更新飞书配置失败:${ce instanceof Error?ce.message:String(ce)}`)}finally{ct.current&&ge(!1)}}}async function cs(){var Ue;if(!c||V||D)return;if(!Qe.valid){ve(Qe.error);return}if(!A&&be==="user_pool"&&!Ke){ve("请选择用于 Runtime 鉴权的用户池。");return}if(pt!=="public"&&!((Ue=_==null?void 0:_.vpcId)!=null&&Ue.trim())){ve("使用 VPC 网络时,请填写 VPC ID。");return}const ce=O3(x,E);if(ce){const nt=x.find(at=>at.key===ce.key);ve(`请返回配置页填写 ${(nt==null?void 0:nt.comment)||(nt==null?void 0:nt.key)}(${nt==null?void 0:nt.key})。`);return}const Ie=mz(x,E);if(Ie){ve(`${Ie.spec.comment||Ie.spec.key}:${Ie.error}`);return}if(v){const nt=O3(zh,E);if(nt){const at=zh.find(We=>We.key===nt.key);ve(`启用飞书后,请填写${(at==null?void 0:at.comment)||(at==null?void 0:at.key)}。`);return}}ue(!0)}async function Qn(){var zn;if(!c||V)return;if(!Qe.valid){ue(!1),ve(Qe.error);return}ue(!1);const ce=Js();ct.current&&(ve(null),ke(null),Je({}),Ve(null),W(!0));const Ie=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;let Ue=(i==null?void 0:i.trim())||e.name||"生成中…";const nt=Date.now(),at={id:Ie,runtimeName:Ue,runtimeId:p,region:k,startedAt:nt,status:"running",phase:"prepare",label:"准备部署",agentDraft:s,instanceRange:vt?{min:Qe.min,max:Qe.max}:void 0,createEvaluationSets:$t};b==null||b(at),m==null||m(at);let We,_t=at.phase??"prepare";const De=Ht=>We?{...We,status:Ht,updatedAt:Date.now()}:void 0,xn=Ht=>{const Nt=De(Ht);return Nt?{buildLog:Nt}:{}},Zn=()=>({source:"code-pipeline",status:"running",text:"",lineCount:0,truncated:!1,updatedAt:Date.now(),pendingMessage:"正在等待构建日志…"}),ki=Ht=>{if(_t!=="build")return;const Nt=["","----- 构建失败 -----",Ht].join(` -`);return We=B3(We,{source:"code-pipeline",status:"error",text:Nt,lineCount:Nt.split(` -`).length,truncated:!1,updatedAt:Date.now()}),We};try{const Ht=await c(e,Nt=>{var En;Nt.runtimeName&&(Ue=Nt.runtimeName),_t=Nt.phase,Nt.buildLog?We=B3(We,Nt.buildLog):Nt.phase==="build"&&!We&&(We=Zn()),ct.current&&(Je(Vn=>({...Vn,[Nt.phase]:Nt})),Ve(Nt.phase)),b==null||b({id:Ie,runtimeName:Ue,runtimeId:p,region:k,startedAt:nt,status:"running",phase:Nt.phase,label:((En=xt.find(Vn=>Vn.phase===Nt.phase))==null?void 0:En.label)??Nt.phase,message:Nt.message,pct:Nt.pct,...We?{buildLog:We}:{}})},{taskId:Ie,sessionStorage:O?"in-memory":"persistent",minInstance:Qe.min,maxInstance:Qe.max,...A?{}:{authentication:be==="user_pool"?{type:"user_pool",userPoolUid:Ke}:{type:"api_key"}},createEvaluationSets:$t,...v?{im:{feishu:{enabled:!0}}}:{},envs:ce});ct.current&&(ke(Ht),Ve(null)),gAe({...gn(),runtimeId:Ht.runtimeId||p||""}),b==null||b({id:Ie,runtimeName:Ht.agentName||Ue,runtimeId:Ht.runtimeId||p,region:Ht.region||k,startedAt:nt,status:"success",phase:"complete",label:"部署完成",message:(zn=Ht.warnings)==null?void 0:zn.join(";"),...xn("complete")});try{await(d==null?void 0:d(Ht))}catch(Nt){if(!(Nt instanceof Sr))throw Nt;b==null||b({id:Ie,runtimeName:Ht.agentName||Ue,runtimeId:Ht.runtimeId||p,region:Ht.region||k,startedAt:nt,status:"success",phase:"complete",label:"部署完成,暂未连接",message:Nt.message,...xn("complete")})}}catch(Ht){const Nt=Ht instanceof Error?Ht.message:String(Ht);if(Ht instanceof DOMException&&Ht.name==="AbortError"){ct.current&&(ve(null),Ve(null)),b==null||b({id:Ie,runtimeName:Ue,runtimeId:p,region:k,startedAt:nt,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。",...xn("complete")});return}ct.current&&ve(Nt);const En=ki(Nt),Vn=!!En;bAe({...gn(),phase:_t,error:Ht}),b==null||b({id:Ie,runtimeName:Ue,runtimeId:p,region:k,startedAt:nt,status:"error",phase:_t,label:"部署失败",message:Vn?"构建镜像失败,详见构建日志。":Nt,...En?{buildLog:En}:xn("complete"),retry:cs})}finally{ct.current&&W(!1)}}function us(){ue(!1)}async function Os(){if(!(!re||_e)){He(!0),ve(null);try{const{addConnection:ce,addRuntimeConnection:Ie,remoteAppId:Ue,loadConnections:nt}=await Jc(async()=>{const{addConnection:_t,addRuntimeConnection:De,remoteAppId:xn,loadConnections:Zn}=await Promise.resolve().then(()=>VL);return{addConnection:_t,addRuntimeConnection:De,remoteAppId:xn,loadConnections:Zn}},void 0),{probeRuntimeApps:at}=await Jc(async()=>{const{probeRuntimeApps:_t}=await Promise.resolve().then(()=>pte);return{probeRuntimeApps:_t}},void 0);let We;if(re.runtimeId){const _t=re.region??k,De=await at(re.runtimeId,_t,{retryProbe:!0})??[];We=Ie(re.runtimeId,re.agentName,_t,De,De.length>0?{[De[0]]:re.agentName}:void 0,re.version)}else We=await ce(re.agentName,re.url,re.apikey,"");if(We.apps.length===0)ve("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。");else{const _t={[We.apps[0]]:re.agentName},De={...We,appLabels:{...We.appLabels??{},..._t}},Zn=nt().map(zn=>zn.id===We.id?De:zn);localStorage.setItem("veadk_agentkit_connections",JSON.stringify(Zn));const{registerConnections:ki}=await Jc(async()=>{const{registerConnections:zn}=await Promise.resolve().then(()=>VL);return{registerConnections:zn}},void 0);if(ki(Zn),u){const zn=Ue(We.id,We.apps[0]);u(zn,re.agentName)}else alert(`🎉 Agent "${re.agentName}" 已添加到左上角下拉列表!`)}}catch(ce){ve(`添加 Agent 失败:${ce instanceof Error?ce.message:String(ce)}`)}finally{He(!1)}}}function Ms(){const ce=wAe(e.files),Ie=URL.createObjectURL(ce),Ue=document.createElement("a");Ue.href=Ie,Ue.download=`${e.name||"project"}.zip`,document.body.appendChild(Ue),Ue.click(),document.body.removeChild(Ue),URL.revokeObjectURL(Ie)}const Ss=o.jsxs("div",{className:`pp-artifact-actions${t?" is-rail":""}`,"aria-label":"发布产物操作",children:[L&&o.jsxs("button",{type:"button",className:"pp-secondary",onClick:L,children:[o.jsx(eee,{className:"pp-ic"}),"导出 YAML"]}),F&&l&&o.jsx(TAe,{project:e,onChange:l,className:"pp-artifact-source",label:"查看源代码"}),e.files.length>0&&o.jsxs("button",{type:"button",className:"pp-secondary",onClick:Ms,children:[o.jsx(Jx,{className:"pp-ic"}),"下载源代码"]})]});function _s(ce,Ie,Ue){return VAe(ce).map(nt=>{const at=Ue?`${Ue}/${nt.name}`:nt.name,We=nt.path!==void 0,_t={paddingLeft:8+Ie*14};if(We){const xn=nt.path===P;return o.jsxs("button",{type:"button",className:`pp-row pp-file${xn?" pp-active":""}`,style:_t,onClick:()=>$(nt.path),title:nt.path,children:[o.jsx(see,{className:"pp-ic"}),o.jsx("span",{className:"pp-label",children:nt.name})]},at)}const De=R.has(at);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"pp-row pp-folder",style:_t,onClick:()=>an(at),children:[o.jsx(Ql,{className:`pp-ic pp-chevron${De?"":" pp-open"}`}),o.jsx(mB,{className:"pp-ic"}),o.jsx("span",{className:"pp-label",children:nt.name})]}),!De&&_s(nt,Ie+1,at)]},at)})}return o.jsxs("div",{className:`pp-root${c?" is-deploy":""}${t?" is-embedded":""}${z?" has-primary-pane":""}`,children:[c&&!t&&o.jsx(KAe,{left:o.jsxs("div",{className:"pp-toolbar-left",children:[I&&o.jsxs("button",{type:"button",className:"pp-toolbar-back",onClick:I,children:[o.jsx(wk,{className:"pp-ic"}),j]}),o.jsxs("span",{className:"pp-toolbar-title",children:["部署 ",i||e.name||"未命名 Agent",r&&r>1?` 等 ${r} 个智能体`:""]})]}),right:null}),o.jsxs("div",{className:"pp-body",children:[c&&!z&&o.jsx("section",{className:"pp-release-overview","aria-label":"发布概览",children:o.jsxs("div",{className:`pp-release-preview${t?" is-embedded":""}`,children:[o.jsxs("div",{className:"pp-flow-thumbnail",children:[s&&o.jsx(Mm,{draft:s,direction:"horizontal",selectedPath:[],onSelect:fl,onAdd:fl,onInsert:fl,onDelete:fl,readOnly:!0,interactivePreview:!0}),o.jsx("button",{type:"button",className:"pp-flow-expand",onClick:()=>Se(!0),"aria-label":"放大查看执行流程",title:"放大查看",children:o.jsx(qc,{"aria-hidden":!0})})]}),t&&Ss,!t&&o.jsxs("div",{className:"pp-release-info",children:[o.jsx("div",{className:"pp-release-card-head",children:"Agent 概览"}),o.jsxs("div",{className:"pp-release-info-body",children:[o.jsxs("div",{className:"pp-release-info-main",children:[o.jsx("h2",{children:i||e.name||"未命名 Agent"}),(s==null?void 0:s.description)&&o.jsx("p",{className:"pp-release-description",title:s.description,children:s.description}),o.jsxs("dl",{className:"pp-release-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"Agent 数量"}),o.jsx("dd",{children:r??1})]}),a&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("dt",{children:"模型"}),o.jsx("dd",{children:a.modelName})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"描述"}),o.jsx("dd",{className:"pp-release-fact-long",children:a.description})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"系统提示词"}),o.jsx("dd",{className:"pp-release-fact-long pp-release-prompt",children:a.instruction})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"优化选项"}),o.jsx("dd",{children:a.optimizations.length>0?a.optimizations.join("、"):"未启用"})]})]})]})]}),Ss]})]})]})}),o.jsxs("div",{className:"pp-files-area",children:[o.jsxs("div",{className:"pp-sidebar",children:[o.jsxs("div",{className:"pp-sidebar-head",children:[o.jsx("span",{className:"pp-project-name",title:e.name,children:"文件预览"}),F&&o.jsx("button",{type:"button",className:"pp-icon-btn",title:"新建文件",onClick:()=>{U(!0),K("")},children:o.jsx(tee,{className:"pp-ic"})})]}),o.jsxs("div",{className:"pp-tree",children:[J&&o.jsx("input",{className:"pp-new-input",autoFocus:!0,placeholder:"path/to/file.py",value:te,onChange:ce=>K(ce.target.value),onBlur:Rn,onKeyDown:ce=>{ce.key==="Enter"&&Rn(),ce.key==="Escape"&&(U(!1),K(""))}}),e.files.length===0&&!J?o.jsx("div",{className:"pp-empty",children:"暂无文件"}):_s(Hn,0,"")]})]}),o.jsxs("div",{className:"pp-main",children:[o.jsxs("div",{className:"pp-main-head",children:[o.jsx("span",{className:"pp-path",title:ut==null?void 0:ut.path,children:(ut==null?void 0:ut.path)??"未选择文件"}),o.jsx("div",{className:"pp-actions",children:F&&ut&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"pp-icon-btn",title:"重命名",onClick:Wn,children:o.jsx(wee,{className:"pp-ic"})}),o.jsx("button",{type:"button",className:"pp-icon-btn pp-danger",title:"删除",onClick:bn,children:o.jsx(Zl,{className:"pp-ic"})})]})})]}),o.jsx("div",{className:"pp-content",children:ut==null?o.jsx("div",{className:"pp-placeholder",children:"选择左侧文件以查看内容"}):F?o.jsx("div",{className:"pp-codemirror",children:o.jsx(g.Suspense,{fallback:o.jsx("div",{className:"pp-editor-loading",children:"加载编辑器…"}),children:o.jsx(IAe,{value:ut.content,path:ut.path,onChange:Rs})})}):o.jsx("pre",{className:"pp-pre hljs",dangerouslySetInnerHTML:{__html:DAe(ut.content,ut.path)}})})]})]}),c&&o.jsxs("aside",{className:"pp-config","aria-label":"部署配置",children:[o.jsx("div",{className:"pp-config-head",children:o.jsx("div",{className:"pp-config-title",children:"部署配置"})}),o.jsxs("div",{className:"pp-config-scroll",children:[z,!z&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"发布区域"}),rn(!1)]}),!z&&o.jsxs("section",{className:"pp-config-section pp-auth-section",children:[o.jsx("div",{className:"pp-config-label",children:"访问鉴权"}),A?o.jsx("p",{className:"pp-config-note pp-auth-preserved-note",children:"更新时保持现有 Runtime 的鉴权方式不变。"}):o.jsxs("div",{className:"pp-auth-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"鉴权方式"}),o.jsx(Ez,{ariaLabel:"部署鉴权方式",value:be,placeholder:"请选择鉴权方式",options:OAe,disabled:V,onChange:ce=>{ve(null),Fe(ce)}})]}),be==="user_pool"&&o.jsxs("label",{children:[o.jsx("span",{children:"用户池"}),o.jsx(RAe,{value:Ke,disabled:V,onChange:ce=>{ve(null),bt(ce)}})]})]})]}),!z&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"消息渠道"}),o.jsx("div",{className:`pp-channel-card${v?" is-flipped":""}`,children:o.jsxs("div",{className:"pp-channel-card-inner",children:[o.jsxs("button",{type:"button",className:"pp-channel-card-face pp-channel-card-front","aria-pressed":v,"aria-hidden":v,tabIndex:v?-1:0,onClick:()=>void On(),disabled:v||V||de||!y,children:[o.jsx("span",{className:"pp-channel-logo",children:o.jsx("img",{src:QA,alt:""})}),o.jsxs("span",{className:"pp-channel-card-copy",children:[o.jsx("strong",{children:"飞书"}),o.jsx("small",{children:de?"正在启用并更新配置…":"接收消息并通过飞书机器人回复"})]})]}),o.jsxs("div",{className:"pp-channel-card-face pp-channel-card-back","aria-hidden":!v,children:[o.jsxs("div",{className:"pp-channel-card-head",children:[o.jsx("strong",{children:"飞书配置"}),o.jsx("button",{type:"button",className:"pp-channel-remove",tabIndex:v?0:-1,onClick:()=>void On(),disabled:!v||V||de||!y,children:de?"取消中…":"取消"})]}),o.jsx("div",{className:"pp-channel-fields",children:zh.map(ce=>o.jsxs("label",{children:[o.jsxs("span",{children:[ce.comment||ce.key,ce.required&&o.jsx("small",{children:"必填"})]}),o.jsx("input",{type:ce.key.includes("SECRET")?"password":"text",value:E[ce.key]??"",placeholder:ce.placeholder,tabIndex:v?0:-1,disabled:!v||V||!w,autoComplete:"off",onChange:Ie=>w==null?void 0:w(ce.key,Ie.currentTarget.value)})]},ce.key))})]})]})})]}),!A&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"实例设置"}),o.jsxs("div",{className:"pp-instance-fields",children:[o.jsxs("label",{htmlFor:"runtime-min-instance",children:[o.jsx("span",{children:"最小实例数"}),o.jsx("input",{id:"runtime-min-instance",type:"number",min:"1",step:"1",inputMode:"numeric",value:dt,disabled:V,"aria-invalid":!Qe.valid,onChange:ce=>cn(ce.currentTarget.value)})]}),o.jsxs("label",{htmlFor:"runtime-max-instance",children:[o.jsx("span",{children:"最大实例数"}),o.jsx("input",{id:"runtime-max-instance",type:"number",min:"1",step:"1",inputMode:"numeric",value:Ut,disabled:V,"aria-invalid":!Qe.valid,onChange:ce=>wt(ce.currentTarget.value)})]})]}),O&&o.jsx("p",{className:"pp-instance-note",role:"note",children:"为避免多实例间会话丢失,推荐将 Runtime 固定为 1~1"}),!Qe.valid&&o.jsx("p",{className:"pp-instance-error",role:"alert",children:Qe.error})]}),o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"网络"}),z&&rn(!0),A&&o.jsx("p",{className:"pp-config-note",children:"现有 Runtime 的区域与网络模式保持不变。"}),o.jsxs("div",{className:"pp-network-layout",children:[o.jsx("div",{className:"pp-network-modes",role:"radiogroup","aria-label":"网络模式",children:["public","private","both"].map(ce=>o.jsxs("label",{className:"pp-network-option",children:[o.jsx("input",{type:"radio",name:"deployment-network-mode",value:ce,checked:pt===ce,onChange:()=>pi(ce),disabled:V||A||!S}),o.jsx("span",{children:ce==="public"?"公网":ce==="private"?"VPC":"公网 + VPC"})]},ce))}),pt!=="public"&&o.jsxs("div",{className:"pp-network-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"VPC ID"}),o.jsx("input",{value:(_==null?void 0:_.vpcId)??"",placeholder:"vpc-xxxxxxxx",disabled:V||A,onChange:ce=>bs({vpcId:ce.target.value})})]}),o.jsxs("label",{children:[o.jsxs("span",{children:["子网 ID ",o.jsx("small",{children:"可选,多个用逗号分隔"})]}),o.jsx("input",{value:(_==null?void 0:_.subnetIds)??"",placeholder:"subnet-xxx, subnet-yyy",disabled:V||A,onChange:ce=>bs({subnetIds:ce.target.value})})]}),o.jsxs("label",{className:"pp-network-check",children:[o.jsx("input",{type:"checkbox",checked:!!(_!=null&&_.enableSharedInternetAccess),disabled:V||A,onChange:ce=>bs({enableSharedInternetAccess:ce.target.checked})}),"VPC 内共享公网出口"]})]})]})]}),o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"评测集"}),o.jsxs("label",{className:"pp-evaluation-set-option",children:[o.jsx("input",{type:"checkbox",checked:$t,disabled:V,onChange:ce=>Ge(ce.currentTarget.checked)}),o.jsxs("span",{children:[o.jsx("strong",{children:"自动创建评测集"}),o.jsx("small",{children:"部署成功后,自动创建 Good Case 和 Bad Case 评测集。"})]})]})]}),o.jsxs("section",{className:"pp-config-section pp-env-section",children:[o.jsx("div",{className:"pp-env-head",children:o.jsxs("div",{children:[o.jsxs("div",{className:"pp-config-label",children:["环境变量",o.jsxs("span",{className:"pp-agent-child-count pp-env-count",children:[St," 项"]})]}),o.jsx("div",{className:"pp-env-sub",children:"组件配置会自动同步到这里,部署前可核对最终值。"})]})}),o.jsxs("button",{type:"button",className:"pp-env-add",onClick:zs,disabled:V,children:[o.jsx(_i,{className:"pp-ic"}),"添加变量"]}),(en.length>0||Pe.length>0)&&o.jsxs("div",{className:"pp-env-table",children:[en.length>0&&o.jsxs("div",{className:"pp-env-group",children:[o.jsxs("div",{className:"pp-env-group-head",children:[o.jsx("span",{children:"组件自动生成"}),o.jsxs("small",{children:[en.length," 项"]})]}),en.map(ce=>{const Ie=ce.key.startsWith("ENABLE_"),Ue=v2(ce,E),nt=ce.multiline||ce.format==="json";return o.jsxs("div",{className:`pp-env-row pp-env-row-derived${nt?" is-multiline":""}`,children:[o.jsxs("div",{className:"pp-env-key-fixed pp-env-key-cell","aria-label":`${ce.key} 环境变量名`,"aria-disabled":V,children:[o.jsx("span",{title:ce.key,children:ce.key}),(ce.help||ce.comment)&&o.jsxs("span",{className:"pp-env-help",tabIndex:0,"data-help":ce.help||ce.comment,"aria-label":`${ce.key}说明:${ce.help||ce.comment}`,children:["?",o.jsx("span",{className:"pp-env-help-popover",role:"tooltip",children:ce.help||ce.comment})]}),ce.link&&o.jsx("a",{className:"pp-env-link",href:ce.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开 OpenViking ${ce.link.label}`,"aria-label":`${ce.key}:打开 OpenViking ${ce.link.label}`,children:o.jsx(vm,{"aria-hidden":"true"})})]}),o.jsxs("div",{className:"pp-env-value-wrap",children:[nt?o.jsx("textarea",{className:"pp-env-value pp-env-json-value",value:ce.value,placeholder:ce.required?"必填,尚未填写":"可选,尚未填写",readOnly:Ie,disabled:V||!Ie&&!w,autoComplete:"off",spellCheck:!1,"aria-invalid":!!Ue,"aria-label":`${ce.key} 环境变量值`,onChange:at=>w==null?void 0:w(ce.key,at.currentTarget.value)}):o.jsx("input",{className:"pp-env-value",type:"text",value:ce.value,placeholder:ce.required?"必填,尚未填写":"可选,尚未填写",readOnly:Ie,disabled:V||!Ie&&!w,autoComplete:"off","aria-invalid":!!Ue,"aria-label":`${ce.key} 环境变量值`,onChange:at=>w==null?void 0:w(ce.key,at.currentTarget.value)}),Ue&&o.jsx("span",{className:"pp-env-error",children:Ue})]}),o.jsx("span",{className:"pp-env-source",children:Ie?"自动":"同步"})]},ce.key)})]}),Pe.length>0&&o.jsxs("div",{className:"pp-env-group-head pp-env-group-head-custom",children:[o.jsx("span",{children:"自定义变量"}),o.jsxs("small",{children:[Pe.length," 项"]})]}),Pe.map(ce=>o.jsxs("div",{className:"pp-env-row",children:[o.jsx("input",{value:ce.key,placeholder:"名称",disabled:V,autoComplete:"off",onChange:Ie=>yn(ce.id,{key:Ie.currentTarget.value})}),o.jsx("input",{type:"text",value:ce.value,placeholder:"值",disabled:V,autoComplete:"off",onChange:Ie=>yn(ce.id,{value:Ie.currentTarget.value})}),o.jsx("button",{type:"button",className:"pp-icon-btn pp-env-remove",title:"删除变量",disabled:V,onClick:()=>Xn(ce.id),children:o.jsx(Ti,{className:"pp-ic"})})]},ce.id))]})]}),(V||re||Object.keys(we).length>0)&&o.jsxs("section",{className:"pp-config-section pp-progress-section",children:[o.jsx("div",{className:"pp-config-label",children:"部署进度"}),o.jsx("ol",{className:"pp-steps",children:xt.map((ce,Ie)=>{const Ue=Le?xt.findIndex(_t=>_t.phase===Le):-1,nt=!!Me&&(Ue===-1?Ie===0:Ie===Ue);let at;re?at="done":nt?at="failed":Ue===-1?at=V?"active":"pending":Iece.phase===Le))==null?void 0:dn.label)??Le}阶段):`:""}${Me}`,onRetry:cs,retryLabel:A?"重试更新":"重试部署"}),re&&o.jsxs("section",{className:"pp-deploy-result",children:[o.jsx("div",{className:"pp-deploy-result-header",children:A?"更新成功":"部署成功"}),o.jsxs("div",{className:"pp-deploy-result-body",children:[re.warnings&&re.warnings.length>0&&o.jsx("div",{className:"pp-deploy-result-warning",role:"status",children:re.warnings.map(ce=>o.jsx("span",{children:ce},ce))}),re.region&&o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"区域"}),o.jsx("code",{children:re.region==="cn-shanghai"?"上海 (cn-shanghai)":"北京 (cn-beijing)"})]}),o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"Agent 名称"}),o.jsx("code",{children:re.agentName})]}),o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"API 端点"}),o.jsx("code",{className:"pp-deploy-result-url",children:re.url})]})]}),o.jsxs("div",{className:"pp-deploy-result-actions",children:[o.jsxs("button",{type:"button",className:"pp-deploy-result-btn",onClick:Os,disabled:_e,children:[_e?o.jsx(mn,{className:"pp-ic spin"}):o.jsx(yB,{className:"pp-ic"}),_e?"连接中…":"立即对话"]}),re.consoleUrl&&o.jsxs("a",{href:re.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"pp-console-link pp-console-link-btn",children:[o.jsx(vm,{className:"pp-ic"}),"控制台"]})]})]})]}),o.jsx("div",{className:`pp-config-actions${Yt?" is-external":""}`,children:Yt?hi.createPortal(o.jsx("button",{type:"button",className:"pp-deploy studio-update-action",onClick:cs,disabled:V||de||D||!!n,title:n,children:V?`${f}中…`:Me?`重试${f}`:f}),Yt):o.jsx("button",{type:"button",className:"pp-deploy studio-update-action",onClick:cs,disabled:V||de||D||!!n,title:n,children:V?`${f}中…`:Me?`重试${f}`:f})})]})]}),me&&s&&hi.createPortal(o.jsx("div",{className:"pp-flow-backdrop",onMouseDown:ce=>{ce.target===ce.currentTarget&&Se(!1)},children:o.jsxs("section",{className:"pp-flow-dialog",role:"dialog","aria-modal":"true","aria-label":"执行流程预览",children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("strong",{children:"执行流程"}),o.jsx("span",{children:"只读预览,可缩放与拖动画布"})]}),o.jsx("button",{type:"button",onClick:()=>Se(!1),"aria-label":"关闭执行流程预览",children:o.jsx(Ti,{"aria-hidden":!0})})]}),o.jsx("div",{className:"pp-flow-dialog-canvas",children:o.jsx(Mm,{draft:s,direction:"horizontal",selectedPath:[],onSelect:fl,onAdd:fl,onInsert:fl,onDelete:fl,readOnly:!0,interactivePreview:!0})})]})}),document.body),o.jsx(jAe,{open:q,isUpdate:A,onCancel:us,onConfirm:()=>void Qn()})]})}const $3="dogfooding",Rw="dogfooding",Ow="dogfooding_b";let qAe=0;const Mw=()=>++qAe;function H3(e){return e.blocks.filter(t=>t.kind==="text").map(t=>t.text).join("")}function YAe(e){const t=e.trim(),n=t.match(/^```(?:json)?\s*\n?([\s\S]*?)\n?```$/i);return(n?n[1]:t).trim()}async function z3(e){const t=[],n=YAe(e);t.push(n);const s=n.indexOf("{"),i=n.lastIndexOf("}");s>=0&&i>s&&t.push(n.slice(s,i+1));for(const r of t)try{const a=JSON.parse(r);if(a&&typeof a=="object"&&(typeof a.name=="string"||typeof a.instruction=="string"))return await o1(x2(a))}catch{}return null}function WAe({userId:e,onBack:t,onCreate:n,onAgentAdded:s,onDeploymentTaskChange:i}){const[r,a]=g.useState([{id:Mw(),role:"assistant",text:"你好,我是 VeADK 的智能构建助手。用自然语言描述你想要的 Agent,我会直接帮你生成一个可运行的 VeADK 项目,并在右侧实时预览。"}]),[l,c]=g.useState(""),[u,d]=g.useState(!1),[f,h]=g.useState(null),[p,m]=g.useState(null),[b,v]=g.useState(!1),[y,x]=g.useState(null),[E,w]=g.useState(null),[_,S]=g.useState(!1),[k,T]=g.useState(!1),[C,I]=g.useState({}),j=g.useRef(null),L=g.useRef(null),z=g.useRef(null),D=g.useRef(null),F=g.useRef(null);g.useEffect(()=>{const K=D.current;K&&K.scrollTo({top:K.scrollHeight,behavior:"smooth"})},[r,u]),g.useEffect(()=>{const K=F.current;K&&(K.style.height="auto",K.style.height=Math.min(K.scrollHeight,160)+"px")},[l]);const A=K=>a(V=>[...V,{id:Mw(),role:"assistant",text:K}]);async function O(){if(j.current)return j.current;const K=await $y($3,e);return j.current=K,K}async function P(K,V){if(V.current)return V.current;const W=await $y(K,e);return V.current=W,W}async function $(K,V){if(!C[K])try{const W=await Fk(V);I(q=>({...q,[K]:W.model||V}))}catch{I(W=>({...W,[K]:V}))}}async function R(K,V,W){const q=await P(K,V);let ue=Sa();for await(const Se of wm({appName:K,userId:e,sessionId:q,text:W}))ue=gf(ue,Se);const me=H3(ue).trim();return{project:await z3(me),finalText:me}}const Y=async(K,V,W)=>dg(K.name,K.files,{region:"cn-beijing",projectName:"default"},{...W,onStage:V}),J=async()=>{const K=l.trim();if(!(!K||u)){if(a(V=>[...V,{id:Mw(),role:"user",text:K}]),c(""),h(null),d(!0),b){x(null),w(null),S(!0),T(!0),$("a",Rw),$("b",Ow);const V=R(Rw,L,K).then(({project:q})=>(x(q),q)).catch(q=>{const ue=q instanceof Error?q.message:String(q);return h(ue),null}).finally(()=>S(!1)),W=R(Ow,z,K).then(({project:q})=>(w(q),q)).catch(q=>{const ue=q instanceof Error?q.message:String(q);return h(ue),null}).finally(()=>T(!1));try{const[q,ue]=await Promise.all([V,W]),me=[q?`方案 A:${q.name}`:null,ue?`方案 B:${ue.name}`:null].filter(Boolean);me.length?A(`已生成两个方案(${me.join(",")}),请在右侧对比后采用其一。`):A("(两个方案都没有返回可用的项目,请再描述一下你的需求。)")}finally{d(!1)}return}try{const V=await O();let W=Sa();for await(const me of wm({appName:$3,userId:e,sessionId:V,text:K}))W=gf(W,me);const q=H3(W).trim(),ue=await z3(q);ue?(m(ue),A(`已生成项目:${ue.name}(${ue.files.length} 个文件),可在右侧预览和编辑。`)):A(q||"(助手没有返回内容,请再描述一下你的需求。)")}catch(V){const W=V instanceof Error?V.message:String(V);h(W),A(`抱歉,调用智能构建助手失败:${W}`)}finally{d(!1)}}},U=K=>{const V=K==="a"?y:E;if(!V)return;m(V),v(!1),x(null),w(null),S(!1),T(!1);const W=K==="a"?"A":"B",q=K==="a"?C.a:C.b;A(`已采用方案 ${W}(${q??(K==="a"?Rw:Ow)}),可继续编辑。`)},te=K=>{K.key==="Enter"&&!K.shiftKey&&!K.nativeEvent.isComposing&&(K.preventDefault(),J())};return o.jsx("div",{className:"ic-root",children:o.jsxs("div",{className:"ic-body",children:[o.jsxs("div",{className:"ic-chat",children:[o.jsxs("div",{className:"ic-transcript",ref:D,children:[o.jsx(Ro,{initial:!1,children:r.map(K=>o.jsxs(is.div,{className:`ic-turn ic-turn--${K.role}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.22,ease:"easeOut"},children:[K.role==="assistant"&&o.jsx("div",{className:"ic-avatar",children:o.jsx(ru,{className:"ic-avatar-icon"})}),o.jsx("div",{className:"ic-bubble",children:K.role==="assistant"?o.jsx(rh,{text:K.text}):K.text})]},K.id))}),u&&o.jsxs(is.div,{className:"ic-turn ic-turn--assistant",initial:{opacity:0,y:8},animate:{opacity:1,y:0},children:[o.jsx("div",{className:"ic-avatar",children:o.jsx(ru,{className:"ic-avatar-icon"})}),o.jsxs("div",{className:"ic-bubble ic-bubble--typing",children:[o.jsx("span",{className:"ic-dot"}),o.jsx("span",{className:"ic-dot"}),o.jsx("span",{className:"ic-dot"})]})]})]}),f&&o.jsxs("div",{className:"ic-error",children:[o.jsx(Sk,{className:"ic-error-icon"}),f]}),o.jsxs("div",{className:"ic-composer",children:[o.jsxs("div",{className:"ic-composer-box",children:[o.jsx("textarea",{ref:F,className:"ic-input",rows:1,placeholder:"描述你想要的 Agent,例如「一个帮我整理周报的写作助手」…",value:l,onChange:K=>c(K.target.value),onKeyDown:te,disabled:u}),o.jsx("button",{className:"ic-send",onClick:()=>void J(),disabled:!l.trim()||u,title:"发送 (Enter)",children:o.jsx(kee,{className:"ic-send-icon"})})]}),o.jsxs("div",{className:"ic-composer-foot",children:[o.jsxs("label",{className:"ic-ab-toggle",title:"同时用两个模型生成方案进行对比",children:[o.jsx("input",{type:"checkbox",className:"ic-ab-checkbox",checked:b,disabled:u,onChange:K=>v(K.target.checked)}),o.jsx("span",{className:"ic-ab-track",children:o.jsx("span",{className:"ic-ab-thumb"})}),o.jsx("span",{className:"ic-ab-label",children:"A/B 对比"})]}),o.jsx("div",{className:"ic-composer-hint",children:"Enter 发送 · Shift+Enter 换行"})]})]})]}),o.jsx("aside",{className:"ic-preview",children:b?o.jsxs("div",{className:"ic-compare",children:[o.jsx(V3,{side:"a",project:y,loading:_,model:C.a,onAdopt:()=>U("a")}),o.jsx("div",{className:"ic-compare-divider"}),o.jsx(V3,{side:"b",project:E,loading:k,model:C.b,onAdopt:()=>U("b")})]}):p?o.jsx(Z1,{project:p,onChange:m,onDeploy:Y,onAgentAdded:s,onDeploymentTaskChange:i,deploymentTelemetrySource:"intelligent_create"}):o.jsxs("div",{className:"ic-preview-empty",children:[o.jsxs("div",{className:"ic-preview-empty-icon",children:[o.jsx(ree,{className:"ic-preview-empty-glyph"}),o.jsx(au,{className:"ic-preview-empty-spark"})]}),o.jsx("div",{className:"ic-preview-empty-title",children:"还没有项目"}),o.jsx("div",{className:"ic-preview-empty-sub",children:"描述你的需求,我会帮你生成 VeADK 项目"})]})})]})})}function V3({side:e,project:t,loading:n,model:s,onAdopt:i}){const r=e==="a"?"方案 A":"方案 B";return o.jsxs("div",{className:"ic-pane",children:[o.jsxs("div",{className:"ic-pane-head",children:[o.jsxs("div",{className:"ic-pane-title",children:[o.jsx("span",{className:`ic-pane-tag ic-pane-tag--${e}`,children:r}),s&&o.jsx("span",{className:"ic-pane-model",children:s})]}),o.jsxs("button",{className:"ic-adopt",onClick:i,disabled:!t||n,title:`采用${r}`,children:["采用",e==="a"?"方案 A":"方案 B"]})]}),o.jsx("div",{className:"ic-pane-body",children:n?o.jsxs("div",{className:"ic-pane-loading",children:[o.jsx(mn,{className:"ic-pane-spinner"}),o.jsx("span",{children:"正在生成…"})]}):t?o.jsx(Z1,{project:t}):o.jsx("div",{className:"ic-pane-empty",children:"该方案未返回可用项目"})})]})}var XAe=Object.defineProperty,w2=(e,t)=>XAe(e,"name",{value:t,configurable:!0});function vN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}w2(vN,"setRef");function vz(...e){return t=>{let n=!1;const s=e.map(i=>{const r=vN(i,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let i=0;iQAe(e,"name",{value:t,configurable:!0});function Lf(e){const t=g.forwardRef((n,s)=>{let{children:i,...r}=n,a=null,l=!1;const c=[];wN(i)&&typeof rb=="function"&&(i=rb(i._payload)),g.Children.forEach(i,h=>{var p;if(Nz(h)){l=!0;const m=h;let b="child"in m.props?m.props.child:m.props.children;wN(b)&&typeof rb=="function"&&(b=rb(b._payload)),a=JAe(m,b),c.push((p=a==null?void 0:a.props)==null?void 0:p.children)}else c.push(h)}),a?a=g.cloneElement(a,void 0,c):!l&&g.Children.count(i)===1&&g.isValidElement(i)&&(a=i);const u=a?_z(a):void 0,d=cr(s,u);if(!a){if(i||i===0)throw new Error(l?n2e(e):t2e(e));return i}const f=Sz(r,a.props??{});return a.type!==g.Fragment&&(f.ref=s?d:u),g.cloneElement(a,f)});return t.displayName=`${e}.Slot`,t}Da(Lf,"createSlot");var wz=Symbol.for("radix.slottable");function ZAe(e){const t=Da(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=wz,t}Da(ZAe,"createSlottable");var JAe=Da((e,t)=>{if("child"in e.props){const n=e.props.child;return g.isValidElement(n)?g.cloneElement(n,void 0,e.props.children(n.props.children)):null}return g.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function Sz(e,t){const n={...t};for(const s in t){const i=e[s],r=t[s];/^on[A-Z]/.test(s)?i&&r?n[s]=(...l)=>{const c=r(...l);return i(...l),c}:i&&(n[s]=i):s==="style"?n[s]={...i,...r}:s==="className"&&(n[s]=[i,r].filter(Boolean).join(" "))}return{...e,...n}}Da(Sz,"mergeProps");function _z(e){var s,i;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Da(_z,"getElementRef");function Nz(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===wz}Da(Nz,"isSlottable");var e2e=Symbol.for("react.lazy");function wN(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===e2e&&"_payload"in e&&Tz(e._payload)}Da(wN,"isLazyComponent");function Tz(e){return typeof e=="object"&&e!==null&&"then"in e}Da(Tz,"isPromiseLike");var t2e=Da(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),n2e=Da(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),rb=Bf[" use ".trim().toString()],s2e=Object.defineProperty,i2e=(e,t)=>s2e(e,"name",{value:t,configurable:!0}),r2e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],aa=r2e.reduce((e,t)=>{const n=Lf(`Primitive.${t}`),s=g.forwardRef((i,r)=>{const{asChild:a,...l}=i,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:r})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function a2e(e,t){e&&hi.flushSync(()=>e.dispatchEvent(t))}i2e(a2e,"dispatchDiscreteCustomEvent");var o2e=Object.defineProperty,ea=(e,t)=>o2e(e,"name",{value:t,configurable:!0});function l2e(e,t){const n=g.createContext(t);n.displayName=e+"Context";const s=ea(r=>{const{children:a,...l}=r,c=g.useMemo(()=>l,Object.values(l));return o.jsx(n.Provider,{value:c,children:a})},"Provider");s.displayName=e+"Provider";function i(r,a={}){const{optional:l=!1}=a,c=g.useContext(n);if(c)return c;if(t!==void 0)return t;if(!l)throw new Error(`\`${r}\` must be used within \`${e}\``)}return ea(i,"useContext"),[s,i]}ea(l2e,"createContext");function lc(e,t=[]){let n=[];function s(r,a){const l=g.createContext(a);l.displayName=r+"Context";const c=n.length;n=[...n,a];const u=ea(f=>{var y;const{scope:h,children:p,...m}=f,b=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=g.useMemo(()=>m,Object.values(m));return o.jsx(b.Provider,{value:v,children:p})},"Provider");u.displayName=r+"Provider";function d(f,h,p={}){var y;const{optional:m=!1}=p,b=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=g.useContext(b);if(v)return v;if(a!==void 0)return a;if(!m)throw new Error(`\`${f}\` must be used within \`${r}\``)}return ea(d,"useContext"),[u,d]}ea(s,"createContext");const i=ea(()=>{const r=n.map(a=>g.createContext(a));return ea(function(l){const c=(l==null?void 0:l[e])||r;return g.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])},"useScope")},"createScope");return i.scopeName=e,[s,kz(i,...t)]}ea(lc,"createContextScope");function kz(...e){const t=e[0];if(e.length===1)return t;const n=ea(()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return ea(function(r){const a=s.reduce((l,{useScope:c,scopeName:u})=>{const f=c(r)[`__scope${u}`];return{...l,...f}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}ea(kz,"composeContextScopes");var c2e=Object.defineProperty,ui=(e,t)=>c2e(e,"name",{value:t,configurable:!0});function Az(e){const t=e+"CollectionProvider",[n,s]=lc(t),[i,r]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=ui(b=>{const{scope:v,children:y}=b,x=g.useRef(null),E=g.useRef(new Map).current;return o.jsx(i,{scope:v,itemMap:E,collectionRef:x,children:y})},"CollectionProvider");a.displayName=t;const l=e+"CollectionSlot",c=Lf(l),u=g.forwardRef((b,v)=>{const{scope:y,children:x}=b,E=r(l,y),w=cr(v,E.collectionRef);return o.jsx(c,{ref:w,children:x})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=Lf(d),p=g.forwardRef((b,v)=>{const{scope:y,children:x,...E}=b,w=g.useRef(null),_=cr(v,w),S=r(d,y);return g.useEffect(()=>(S.itemMap.set(w,{ref:w,...E}),()=>void S.itemMap.delete(w))),o.jsx(h,{[f]:"",ref:_,children:x})});p.displayName=d;function m(b){const v=r(e+"CollectionConsumer",b);return g.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const E=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((S,k)=>E.indexOf(S.ref.current)-E.indexOf(k.ref.current))},[v.collectionRef,v.itemMap])}return ui(m,"useCollection"),[{Provider:a,Slot:u,ItemSlot:p},m,s]}ui(Az,"createCollection");var G3=new WeakMap,Gs,yr,Lw=(yr=class extends Map{constructor(n){super(n);SC(this,Gs);RE(this,Gs,[...super.keys()]),G3.set(this,!0)}set(n,s){return G3.get(this)&&(this.has(n)?ji(this,Gs)[ji(this,Gs).indexOf(n)]=n:ji(this,Gs).push(n)),super.set(n,s),this}insert(n,s,i){const r=this.has(s),a=ji(this,Gs).length,l=S2(n);let c=l>=0?l:a+l;const u=c<0||c>=a?-1:c;if(u===this.size||r&&u===this.size-1||u===-1)return this.set(s,i),this;const d=this.size+(r?0:1);l<0&&c++;const f=[...ji(this,Gs)];let h,p=!1;for(let m=c;m=this.size&&(r=this.size-1),this.at(r)}keyFrom(n,s){const i=this.indexOf(n);if(i===-1)return;let r=i+s;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(n,s){let i=0;for(const r of this){if(Reflect.apply(n,s,[r,i,this]))return r;i++}}findIndex(n,s){let i=0;for(const r of this){if(Reflect.apply(n,s,[r,i,this]))return i;i++}return-1}filter(n,s){const i=[];let r=0;for(const a of this)Reflect.apply(n,s,[a,r,this])&&i.push(a),r++;return new yr(i)}map(n,s){const i=[];let r=0;for(const a of this)i.push([a[0],Reflect.apply(n,s,[a,r,this])]),r++;return new yr(i)}reduce(...n){const[s,i]=n;let r=0,a=i??this.at(0);for(const l of this)r===0&&n.length===1?a=l:a=Reflect.apply(s,this,[a,l,r,this]),r++;return a}reduceRight(...n){const[s,i]=n;let r=i??this.at(-1);for(let a=this.size-1;a>=0;a--){const l=this.at(a);a===this.size-1&&n.length===1?r=l:r=Reflect.apply(s,this,[r,l,a,this])}return r}toSorted(n){const s=[...this.entries()].sort(n);return new yr(s)}toReversed(){const n=new yr;for(let s=this.size-1;s>=0;s--){const i=this.keyAt(s),r=this.get(i);n.set(i,r)}return n}toSpliced(...n){const s=[...this.entries()];return s.splice(...n),new yr(s)}slice(n,s){const i=new yr;let r=this.size-1;if(n===void 0)return i;n<0&&(n=n+this.size),s!==void 0&&s>0&&(r=s-1);for(let a=n;a<=r;a++){const l=this.keyAt(a),c=this.get(l);i.set(l,c)}return i}every(n,s){let i=0;for(const r of this){if(!Reflect.apply(n,s,[r,i,this]))return!1;i++}return!0}some(n,s){let i=0;for(const r of this){if(Reflect.apply(n,s,[r,i,this]))return!0;i++}return!1}},Gs=new WeakMap,ui(yr,"OrderedDict"),yr);function Zb(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=Cz(e,t);return n===-1?void 0:e[n]}ui(Zb,"at");function Cz(e,t){const n=e.length,s=S2(t),i=s>=0?s:n+s;return i<0||i>=n?-1:i}ui(Cz,"toSafeIndex");function S2(e){return e!==e||e===0?0:Math.trunc(e)}ui(S2,"toSafeInteger");function u2e(e){const t=e+"CollectionProvider",[n,s]=lc(t),[i,r]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Lw,setItemMap:ui(()=>{},"setItemMap")}),a=ui(({state:E,...w})=>E?o.jsx(c,{...w,state:E}):o.jsx(l,{...w}),"CollectionProvider");a.displayName=t;const l=ui(E=>{const w=v();return o.jsx(c,{...E,state:w})},"CollectionInit");l.displayName=t+"Init";const c=ui(E=>{const{scope:w,children:_,state:S}=E,k=g.useRef(null),[T,C]=g.useState(null),I=cr(k,C),[j,L]=S;return g.useEffect(()=>{if(!T)return;const z=Rz(()=>{});return z.observe(T,{childList:!0,subtree:!0}),()=>{z.disconnect()}},[T]),o.jsx(i,{scope:w,itemMap:j,setItemMap:L,collectionRef:I,collectionRefObject:k,collectionElement:T,children:_})},"CollectionProviderImpl");c.displayName=t+"Impl";const u=e+"CollectionSlot",d=Lf(u),f=g.forwardRef((E,w)=>{const{scope:_,children:S}=E,k=r(u,_),T=cr(w,k.collectionRef);return o.jsx(d,{ref:T,children:S})});f.displayName=u;const h=e+"CollectionItemSlot",p="data-radix-collection-item",m=Lf(h),b=g.forwardRef((E,w)=>{const{scope:_,children:S,...k}=E,T=g.useRef(null),[C,I]=g.useState(null),j=cr(w,T,I),L=r(h,_),{setItemMap:z}=L,D=g.useRef(k);Iz(D.current,k)||(D.current=k);const F=D.current;return g.useEffect(()=>{const A=F;return z(O=>C?O.has(C)?O.set(C,{...A,element:C}).toSorted(SN):(O.set(C,{...A,element:C}),O.toSorted(SN)):O),()=>{z(O=>!C||!O.has(C)?O:(O.delete(C),new Lw(O)))}},[C,F,z]),o.jsx(m,{[p]:"",ref:j,children:S})});b.displayName=h;function v(){return g.useState(new Lw)}ui(v,"useInitCollection");function y(E){const{itemMap:w}=r(e+"CollectionConsumer",E);return w}return ui(y,"useCollection"),[{Provider:a,Slot:f,ItemSlot:b},{createCollectionScope:s,useCollection:y,useInitCollection:v}]}ui(u2e,"createCollection");function Iz(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||e[i]!==t[i])return!1;return!0}ui(Iz,"shallowEqual");function jz(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}ui(jz,"isElementPreceding");function SN(e,t){return!e[1].element||!t[1].element?0:jz(e[1].element,t[1].element)?-1:1}ui(SN,"sortByDocumentPosition");function Rz(e){return new MutationObserver(n=>{for(const s of n)if(s.type==="childList"){e();return}})}ui(Rz,"getChildListObserver");var d2e=Object.defineProperty,hh=(e,t)=>d2e(e,"name",{value:t,configurable:!0}),Oz=!!(typeof window<"u"&&window.document&&window.document.createElement);function Yi(e,t,{checkForDefaultPrevented:n=!0}={}){return hh(function(i){if(e==null||e(i),n===!1||!i||!i.defaultPrevented)return t==null?void 0:t(i)},"handleEvent")}hh(Yi,"composeEventHandlers");function f2e(e){var t;if(!Oz)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}hh(f2e,"getOwnerWindow");function _N(e){if(!Oz)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}hh(_N,"getOwnerDocument");function Mz(e,t=!1){const{activeElement:n}=_N(e);if(!(n!=null&&n.nodeName))return null;if(Lz(n)&&n.contentDocument)return Mz(n.contentDocument.body,t);if(t){const s=n.getAttribute("aria-activedescendant");if(s){const i=_N(n).getElementById(s);if(i)return i}}return n}hh(Mz,"getActiveElement");function Lz(e){return e.tagName==="IFRAME"}hh(Lz,"isFrame");var mu=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},h2e=Object.defineProperty,p2e=(e,t)=>h2e(e,"name",{value:t,configurable:!0}),K3=Bf[" useEffectEvent ".trim().toString()],q3=Bf[" useInsertionEffect ".trim().toString()];function Dz(e){if(typeof K3=="function")return K3(e);const t=g.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof q3=="function"?q3(()=>{t.current=e}):mu(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}p2e(Dz,"useEffectEvent");var m2e=Object.defineProperty,Lg=(e,t)=>m2e(e,"name",{value:t,configurable:!0}),g2e=Bf[" useInsertionEffect ".trim().toString()]||mu;function Iu({prop:e,defaultProp:t,onChange:n=Lg(()=>{},"onChange"),caller:s}){const[i,r,a]=Pz({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:i,u=g.useCallback(d=>{var f;if(l){const h=Bz(d)?d(e):d;h!==e&&((f=a.current)==null||f.call(a,h))}else r(d)},[l,e,r,a]);return[c,u]}Lg(Iu,"useControllableState");function Pz({defaultProp:e,onChange:t}){const[n,s]=g.useState(e),i=g.useRef(n),r=g.useRef(t);return g2e(()=>{r.current=t},[t]),g.useEffect(()=>{var a;i.current!==n&&((a=r.current)==null||a.call(r,n),i.current=n)},[n,i]),[n,s,r]}Lg(Pz,"useUncontrolledState");function Bz(e){return typeof e=="function"}Lg(Bz,"isFunction");var Y3=Symbol("RADIX:SYNC_STATE");function b2e(e,t,n,s){const{prop:i,defaultProp:r,onChange:a,caller:l}=t,c=i!==void 0,u=Dz(a),d=[{...n,state:r}];s&&d.push(s);const[f,h]=g.useReducer((v,y)=>{if(y.type===Y3)return{...v,state:y.state};const x=e(v,y);return c&&!Object.is(x.state,v.state)&&u(x.state),x},...d),p=f.state,m=g.useRef(p);g.useEffect(()=>{m.current!==p&&(m.current=p,c||u(p))},[p,m,c]);const b=g.useMemo(()=>i!==void 0?{...f,state:i}:f,[f,i]);return g.useEffect(()=>{c&&!Object.is(i,f.state)&&h({type:Y3,state:i})},[i,f.state,c]),[b,h]}Lg(b2e,"useControllableStateReducer");var y2e=Object.defineProperty,Xo=(e,t)=>y2e(e,"name",{value:t,configurable:!0});function Uz(e,t){return g.useReducer((n,s)=>t[n][s]??n,e)}Xo(Uz,"useStateMachine");var Fz=Xo(e=>{const{present:t,children:n}=e,s=$z(t),i=typeof n=="function"?n({present:s.isPresent}):g.Children.only(n),r=Hz(s.ref,zz(i));return typeof n=="function"||s.isPresent?g.cloneElement(i,{ref:r}):null},"Presence");function $z(e){const[t,n]=g.useState(),s=g.useRef(null),i=g.useRef(e),r=g.useRef("none"),a=g.useRef(void 0),l=e?"mounted":"unmounted",[c,u]=Uz(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{c==="mounted"?(r.current=a.current??ud(s.current),a.current=void 0):r.current="none"},[c]),mu(()=>{const d=s.current,f=i.current;if(f!==e){const p=r.current,m=ud(d);e?(a.current=m,u("MOUNT")):m==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(f&&p!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),mu(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=Xo(m=>{const v=ud(s.current).includes(CSS.escape(m.animationName));if(m.target===t&&v&&(u("ANIMATION_END"),!i.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},"handleAnimationEnd"),p=Xo(m=>{m.target===t&&(r.current=ud(s.current))},"handleAnimationStart");return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:g.useCallback(d=>{if(d){const f=getComputedStyle(d);s.current=f,a.current=ud(f)}else s.current=null;n(d)},[])}}Xo($z,"usePresence");function NN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Xo(NN,"setRef");function Hz(...e){const t=g.useRef(e);return t.current=e,g.useCallback(n=>{const s=t.current;let i=!1;const r=s.map(a=>{const l=NN(a,n);return!i&&typeof l=="function"&&(i=!0),l});if(i)return()=>{for(let a=0;ax2e(e,"name",{value:t,configurable:!0}),v2e=Bf[" useId ".trim().toString()]||(()=>{}),w2e=0;function Vz(e){const[t,n]=g.useState(v2e());return mu(()=>{e||n(s=>s??String(w2e++))},[e]),e||(t?`radix-${t}`:"")}E2e(Vz,"useId");var S2e=Object.defineProperty,_2e=(e,t)=>S2e(e,"name",{value:t,configurable:!0}),N2e=g.createContext(void 0);function J1(e){const t=g.useContext(N2e);return e||t||"ltr"}_2e(J1,"useDirection");var T2e=Object.defineProperty,k2e=(e,t)=>T2e(e,"name",{value:t,configurable:!0});function Gz(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}k2e(Gz,"useCallbackRef");var A2e=Object.defineProperty,C2e=(e,t)=>A2e(e,"name",{value:t,configurable:!0});function _2(e){const[t,n]=g.useState(void 0);return mu(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const r=i[0];let a,l;if("borderBoxSize"in r){const c=r.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}C2e(_2,"useSize");var I2e=Object.defineProperty,Qo=(e,t)=>I2e(e,"name",{value:t,configurable:!0}),N2="Checkbox",[j2e,xMe]=lc(N2),[R2e,T2]=j2e(N2);function Kz(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:i,disabled:r,form:a,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,p]=Iu({prop:n,defaultProp:i??!1,onChange:c,caller:N2}),[m,b]=g.useState(null),[v,y]=g.useState(null),x=g.useRef(!1),[E,w]=g.useReducer(k=>k+1,0),_=m?!!a||!!m.closest("form"):!0,S={checked:h,disabled:r,setChecked:p,control:m,setControl:b,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:x,userInteractionCount:E,onUserInteraction:w,required:u,defaultChecked:$o(i)?!1:i,isFormControl:_,bubbleInput:v,setBubbleInput:y};return o.jsx(R2e,{scope:t,...S,children:qz(f)?f(S):s})}Qo(Kz,"CheckboxProvider");var O2e="CheckboxTrigger",M2e=g.forwardRef(Qo(function({__scopeCheckbox:t,onKeyDown:n,onClick:s,...i},r){const{control:a,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:p,onUserInteraction:m,isFormControl:b,bubbleInput:v}=T2(O2e,t),y=cr(r,f),x=g.useRef(u);return g.useEffect(()=>{const E=a==null?void 0:a.form;if(E){const w=Qo(()=>h(x.current),"reset");return E.addEventListener("reset",w),()=>E.removeEventListener("reset",w)}},[a,h]),o.jsx(aa.button,{type:"button",role:"checkbox","aria-checked":$o(u)?"mixed":u,"aria-required":d,"data-state":k2(u),"data-disabled":c?"":void 0,disabled:c,value:l,...i,ref:y,onKeyDown:Yi(n,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:Yi(s,E=>{m(),h(w=>$o(w)?!0:!w),v&&b&&(p.current=E.isPropagationStopped(),p.current||E.stopPropagation())})})},"CheckboxTrigger")),L2e=g.forwardRef(Qo(function(t,n){const{__scopeCheckbox:s,name:i,checked:r,defaultChecked:a,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return o.jsx(Kz,{__scopeCheckbox:s,checked:r,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:i,form:f,value:u,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(M2e,{...h,ref:n,__scopeCheckbox:s}),p&&o.jsx(U2e,{__scopeCheckbox:s})]})})},"Checkbox")),D2e="CheckboxIndicator",P2e=g.forwardRef(Qo(function(t,n){const{__scopeCheckbox:s,forceMount:i,...r}=t,a=T2(D2e,s);return o.jsx(Fz,{present:i||$o(a.checked)||a.checked===!0,children:o.jsx(aa.span,{"data-state":k2(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:n,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),B2e="CheckboxBubbleInput",U2e=g.forwardRef(Qo(function({__scopeCheckbox:t,onClick:n,...s},i){const{control:r,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:p,form:m,bubbleInput:b,setBubbleInput:v}=T2(B2e,t),y=cr(i,v),x=_2(r),E=g.useRef(!1),w=g.useRef(c),_=g.useRef(l);g.useEffect(()=>{const k=b;if(!k)return;const T=window.HTMLInputElement.prototype,I=Object.getOwnPropertyDescriptor(T,"checked").set,j=l!==_.current;_.current=l;const L=w.current!==c;w.current=c;const z=!(j&&a.current);if(L&&I){E.current=!j;const D=new Event("click",{bubbles:z});k.indeterminate=$o(c),I.call(k,$o(c)?!1:c),k.dispatchEvent(D),E.current=!1}},[b,c,a,l]);const S=g.useRef($o(c)?!1:c);return o.jsx(aa.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??S.current,required:d,disabled:f,name:h,value:p,form:m,...s,tabIndex:-1,ref:y,onClick:Yi(n,k=>{E.current&&k.stopPropagation()}),style:{...s.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function qz(e){return typeof e=="function"}Qo(qz,"isFunction");function $o(e){return e==="indeterminate"}Qo($o,"isIndeterminate");function k2(e){return $o(e)?"indeterminate":e?"checked":"unchecked"}Qo(k2,"getState");var F2e=Object.defineProperty,A2=(e,t)=>F2e(e,"name",{value:t,configurable:!0}),Dw=!1;function Yz(){const[e,t]=g.useState(Dw);return g.useEffect(()=>{Dw||(Dw=!0,t(!0))},[]),e}A2(Yz,"useIsHydrated");var Wz=Bf[" useSyncExternalStore ".trim().toString()];function Xz(){return()=>{}}A2(Xz,"subscribe");function Qz(){return Wz(Xz,()=>!0,()=>!1)}A2(Qz,"useIsHydratedModern");var $2e=typeof Wz=="function"?Qz:Yz,H2e=Object.defineProperty,ju=(e,t)=>H2e(e,"name",{value:t,configurable:!0}),Pw="rovingFocusGroup.onEntryFocus",z2e={bubbles:!1,cancelable:!0},eE="RovingFocusGroup",[TN,Zz,V2e]=Az(eE),[G2e,tE]=lc(eE,[V2e]),[K2e,q2e]=G2e(eE),Y2e=g.forwardRef(ju(function(t,n){return o.jsx(TN.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(TN.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(W2e,{...t,ref:n})})})},"RovingFocusGroup")),W2e=g.forwardRef(ju(function(t,n){const{__scopeRovingFocusGroup:s,orientation:i,loop:r=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=t,p=g.useRef(null),m=cr(n,p),b=J1(a),[v,y]=Iu({prop:l,defaultProp:c??null,onChange:u,caller:eE}),[x,E]=g.useState(!1),w=Gz(d),_=Zz(s),S=g.useRef(!1),[k,T]=g.useState(0);return g.useEffect(()=>{const C=p.current;if(C)return C.addEventListener(Pw,w),()=>C.removeEventListener(Pw,w)},[w]),o.jsx(K2e,{scope:s,orientation:i,dir:b,loop:r,currentTabStopId:v,onItemFocus:g.useCallback(C=>y(C),[y]),onItemShiftTab:g.useCallback(()=>E(!0),[]),onFocusableItemAdd:g.useCallback(()=>T(C=>C+1),[]),onFocusableItemRemove:g.useCallback(()=>T(C=>C-1),[]),children:o.jsx(aa.div,{tabIndex:x||k===0?-1:0,"data-orientation":i,...h,ref:m,style:{outline:"none",...t.style},onMouseDown:Yi(t.onMouseDown,()=>{S.current=!0}),onFocus:Yi(t.onFocus,C=>{const I=!S.current;if(C.target===C.currentTarget&&I&&!x){const j=new CustomEvent(Pw,z2e);if(C.currentTarget.dispatchEvent(j),!j.defaultPrevented){const L=_().filter(O=>O.focusable),z=L.find(O=>O.active),D=L.find(O=>O.id===v),A=[z,D,...L].filter(Boolean).map(O=>O.ref.current);C2(A,f)}}S.current=!1}),onBlur:Yi(t.onBlur,()=>E(!1))})})},"RovingFocusGroupImpl")),X2e="RovingFocusGroupItem",Q2e=g.forwardRef(ju(function(t,n){const{__scopeRovingFocusGroup:s,focusable:i=!0,active:r=!1,tabStopId:a,children:l,...c}=t,u=Vz(),d=a||u,f=q2e(X2e,s),h=f.currentTabStopId===d,p=Zz(s),{onFocusableItemAdd:m,onFocusableItemRemove:b,currentTabStopId:v}=f,y=$2e();return mu(()=>{if(!(!y||!i))return m(),()=>b()},[y,i,m,b]),g.useEffect(()=>{if(!(y||!i))return m(),()=>b()},[y,i,m,b]),o.jsx(TN.ItemSlot,{scope:s,id:d,focusable:i,active:r,children:o.jsx(aa.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...c,ref:n,onMouseDown:Yi(t.onMouseDown,x=>{i?f.onItemFocus(d):x.preventDefault()}),onFocus:Yi(t.onFocus,()=>f.onItemFocus(d)),onKeyDown:Yi(t.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const E=eV(x,f.orientation,f.dir);if(E!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let _=p().filter(S=>S.focusable).map(S=>S.ref.current);if(E==="last")_.reverse();else if(E==="prev"||E==="next"){E==="prev"&&_.reverse();const S=_.indexOf(x.currentTarget);_=f.loop?tV(_,S+1):_.slice(S+1)}setTimeout(()=>C2(_))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:v!=null}):l})})},"RovingFocusGroupItem")),Z2e={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Jz(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}ju(Jz,"getDirectionAwareKey");function eV(e,t,n){const s=Jz(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return Z2e[s]}ju(eV,"getFocusIntent");function C2(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}ju(C2,"focusFirst");function tV(e,t){return e.map((n,s)=>e[(t+s)%e.length])}ju(tV,"wrapArray");var nV=Y2e,sV=Q2e,J2e=Object.defineProperty,Di=(e,t)=>J2e(e,"name",{value:t,configurable:!0}),iV="Radio",[eCe,rV]=lc(iV),[tCe,nE]=eCe(iV);function aV(e){const{__scopeRadio:t,checked:n=!1,children:s,disabled:i,form:r,name:a,onCheck:l,required:c,value:u="on",internal_do_not_use_render:d}=e,[f,h]=g.useState(null),[p,m]=g.useState(null),b=g.useRef(!1),[v,y]=g.useReducer(w=>w+1,0),x=f?!!r||!!f.closest("form"):!0,E={checked:n,disabled:i,required:c,name:a,form:r,value:u,control:f,setControl:h,hasConsumerStoppedPropagationRef:b,userInteractionCount:v,onUserInteraction:y,isFormControl:x,bubbleInput:p,setBubbleInput:m,onCheck:Di(()=>l==null?void 0:l(),"onCheck")};return o.jsx(tCe,{scope:t,...E,children:oV(d)?d(E):s})}Di(aV,"RadioProvider");var nCe="RadioTrigger",sCe=g.forwardRef(Di(function({__scopeRadio:t,onClick:n,...s},i){const{checked:r,disabled:a,value:l,setControl:c,onCheck:u,hasConsumerStoppedPropagationRef:d,onUserInteraction:f,isFormControl:h,bubbleInput:p}=nE(nCe,t),m=cr(i,c);return o.jsx(aa.button,{type:"button",role:"radio","aria-checked":r,"data-state":I2(r),"data-disabled":a?"":void 0,disabled:a,value:l,...s,ref:m,onClick:Yi(n,b=>{r||(f(),u()),p&&h&&(d.current=b.isPropagationStopped(),d.current||b.stopPropagation())})})},"RadioTrigger")),iCe="RadioIndicator",rCe=g.forwardRef(Di(function(t,n){const{__scopeRadio:s,forceMount:i,...r}=t,a=nE(iCe,s);return o.jsx(Fz,{present:i||a.checked,children:o.jsx(aa.span,{"data-state":I2(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:n})})},"RadioIndicator")),aCe="RadioBubbleInput",oCe=g.forwardRef(Di(function({__scopeRadio:t,onClick:n,...s},i){const{control:r,checked:a,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:h,setBubbleInput:p,hasConsumerStoppedPropagationRef:m,userInteractionCount:b}=nE(aCe,t),v=cr(i,p),y=_2(r),x=g.useRef(!1),E=g.useRef(a),w=g.useRef(b);g.useEffect(()=>{const S=h;if(!S)return;const k=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(k,"checked").set,I=b!==w.current;w.current=b;const j=E.current!==a;E.current=a;const L=!(I&&m.current);if(j&&C){x.current=!I;const z=new Event("click",{bubbles:L});C.call(S,a),S.dispatchEvent(z),x.current=!1}},[h,a,m,b]);const _=g.useRef(a);return o.jsx(aa.input,{type:"radio","aria-hidden":!0,defaultChecked:_.current,required:l,disabled:c,name:u,value:d,form:f,...s,tabIndex:-1,ref:v,onClick:Yi(n,S=>{x.current&&S.stopPropagation()}),style:{...s.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function oV(e){return typeof e=="function"}Di(oV,"isFunction");function I2(e){return e?"checked":"unchecked"}Di(I2,"getState");var lCe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],j2="RadioGroup",[cCe,EMe]=lc(j2,[tE,rV]),lV=tE(),sE=rV(),[uCe,dCe]=cCe(j2),fCe=g.forwardRef(Di(function(t,n){const{__scopeRadioGroup:s,name:i,form:r,defaultValue:a,value:l,required:c=!1,disabled:u=!1,orientation:d,dir:f,loop:h=!0,onValueChange:p,...m}=t,b=lV(s),v=J1(f),[y,x]=Iu({prop:l,defaultProp:a??null,onChange:p,caller:j2}),[E,w]=g.useState(null),_=cr(n,w),S=g.useRef(y);return g.useEffect(()=>{const k=r?E==null?void 0:E.ownerDocument.getElementById(r):E==null?void 0:E.closest("form");if(k instanceof HTMLFormElement){const T=Di(()=>x(S.current),"reset");return k.addEventListener("reset",T),()=>k.removeEventListener("reset",T)}},[E,r,x]),o.jsx(uCe,{scope:s,name:i,form:r,required:c,disabled:u,value:y,onValueChange:x,children:o.jsx(nV,{asChild:!0,...b,orientation:d,dir:v,loop:h,children:o.jsx(aa.div,{role:"radiogroup","aria-required":c,"aria-orientation":d,"data-disabled":u?"":void 0,dir:v,...m,ref:_})})})},"RadioGroup")),hCe="RadioGroupItemProvider",pCe="RadioGroupItemTrigger";function cV(e){const{__scopeRadioGroup:t,value:n,disabled:s,children:i,internal_do_not_use_render:r}=e,a=dCe(hCe,t),l=sE(t),c=a.disabled||s;return o.jsx(aV,{...l,checked:a.value===n,disabled:c,required:a.required,name:a.name,form:a.form,value:n,onCheck:()=>a.onValueChange(n),internal_do_not_use_render:r,children:i})}Di(cV,"RadioGroupItemProvider");var mCe=g.forwardRef(Di(function(t,n){const{__scopeRadioGroup:s,...i}=t,r=lV(s),a=sE(s),{checked:l,disabled:c}=nE(pCe,a.__scopeRadio),u=g.useRef(null),d=cr(n,u),f=g.useRef(!1);return g.useEffect(()=>{const h=Di(m=>{lCe.includes(m.key)&&(f.current=!0)},"handleKeyDown"),p=Di(()=>f.current=!1,"handleKeyUp");return document.addEventListener("keydown",h),document.addEventListener("keyup",p),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",p)}},[]),o.jsx(sV,{asChild:!0,...r,focusable:!c,active:l,children:o.jsx(sCe,{...a,...i,ref:d,onKeyDown:Yi(i.onKeyDown,h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:Yi(i.onFocus,()=>{var h;f.current&&((h=u.current)==null||h.click())})})})},"RadioGroupItemTrigger")),gCe=g.forwardRef(Di(function(t,n){const{__scopeRadioGroup:s,value:i,disabled:r,...a}=t;return o.jsx(cV,{__scopeRadioGroup:s,value:i,disabled:r,internal_do_not_use_render:({isFormControl:l})=>o.jsxs(o.Fragment,{children:[o.jsx(mCe,{...a,ref:n,__scopeRadioGroup:s}),l&&o.jsx(bCe,{__scopeRadioGroup:s})]})})},"RadioGroupItem")),bCe=g.forwardRef(Di(function(t,n){const{__scopeRadioGroup:s,...i}=t,r=sE(s);return o.jsx(oCe,{...r,...i,ref:n})},"RadioGroupItemBubbleInput")),yCe=g.forwardRef(Di(function(t,n){const{__scopeRadioGroup:s,...i}=t,r=sE(s);return o.jsx(rCe,{...r,...i,ref:n})},"RadioGroupIndicator")),xCe=Object.defineProperty,ECe=(e,t)=>xCe(e,"name",{value:t,configurable:!0}),vCe="Toggle",wCe=g.forwardRef(ECe(function(t,n){const{pressed:s,defaultPressed:i,onPressedChange:r,...a}=t,[l,c]=Iu({prop:s,onChange:r,defaultProp:i??!1,caller:vCe});return o.jsx(aa.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":t.disabled?"":void 0,...a,ref:n,onClick:Yi(t.onClick,()=>{t.disabled||c(!l)})})},"Toggle")),SCe=Object.defineProperty,Jl=(e,t)=>SCe(e,"name",{value:t,configurable:!0}),ph="ToggleGroup",[uV,vMe]=lc(ph,[tE]),dV=tE(),_Ce=g.forwardRef(Jl(function(t,n){const{type:s,...i}=t;if(s==="single"){const r=i;return o.jsx(NCe,{role:"radiogroup",...r,ref:n})}if(s==="multiple"){const r=i;return o.jsx(TCe,{role:"toolbar",...r,ref:n})}throw new Error(`Missing prop \`type\` expected on \`${ph}\``)},"ToggleGroup")),[fV,hV]=uV(ph),NCe=g.forwardRef(Jl(function(t,n){const{value:s,defaultValue:i,onValueChange:r=Jl(()=>{},"onValueChange"),...a}=t,[l,c]=Iu({prop:s,defaultProp:i??"",onChange:r,caller:ph});return o.jsx(fV,{scope:t.__scopeToggleGroup,type:"single",value:g.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:g.useCallback(()=>c(""),[c]),children:o.jsx(pV,{...a,ref:n})})},"ToggleGroupImplSingle")),TCe=g.forwardRef(Jl(function(t,n){const{value:s,defaultValue:i,onValueChange:r=Jl(()=>{},"onValueChange"),...a}=t,[l,c]=Iu({prop:s,defaultProp:i??[],onChange:r,caller:ph}),u=g.useCallback(f=>c((h=[])=>[...h,f]),[c]),d=g.useCallback(f=>c((h=[])=>h.filter(p=>p!==f)),[c]);return o.jsx(fV,{scope:t.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:d,children:o.jsx(pV,{...a,ref:n})})},"ToggleGroupImplMultiple")),[kCe,ACe]=uV(ph),pV=g.forwardRef(Jl(function(t,n){const{__scopeToggleGroup:s,disabled:i=!1,rovingFocus:r=!0,orientation:a,dir:l,loop:c=!0,...u}=t,d=dV(s),f=J1(l),h={dir:f,...u};return o.jsx(kCe,{scope:s,rovingFocus:r,disabled:i,children:r?o.jsx(nV,{asChild:!0,...d,orientation:a,dir:f,loop:c,children:o.jsx(aa.div,{...h,ref:n})}):o.jsx(aa.div,{...h,ref:n})})},"ToggleGroupImpl")),kN="ToggleGroupItem",CCe=g.forwardRef(Jl(function(t,n){const s=hV(kN,t.__scopeToggleGroup),i=ACe(kN,t.__scopeToggleGroup),r=dV(t.__scopeToggleGroup),a=s.value.includes(t.value),l=i.disabled||t.disabled,c={...t,pressed:a,disabled:l},u=g.useRef(null);return i.rovingFocus?o.jsx(sV,{asChild:!0,...r,focusable:!l,active:a,ref:u,children:o.jsx(W3,{...c,ref:n})}):o.jsx(W3,{...c,ref:n})},"ToggleGroupItem")),W3=g.forwardRef(Jl(function(t,n){const{__scopeToggleGroup:s,value:i,...r}=t,a=hV(kN,s),l={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},c=a.type==="single"?l:void 0;return o.jsx(wCe,{...c,...r,ref:n,onPressedChange:u=>{u?a.onItemActivate(i):a.onItemDeactivate(i)}})},"ToggleGroupItemImpl"));const ICe="_Container_1tuad_1",jCe="_Checkbox_1tuad_22",RCe="_CheckMark_1tuad_92",OCe="_Label_1tuad_162",ab={Container:ICe,Checkbox:jCe,CheckMark:RCe,Label:OCe},mV=({className:e,label:t,id:n,disabled:s,orientation:i="left",...r})=>{const a=g.useId(),l=n??a;return o.jsxs("div",{"data-disabled":s?"":void 0,"data-has-label":t?"":void 0,"data-orientation":i,className:la(e,ab.Container),children:[o.jsx(L2e,{className:ab.Checkbox,id:l,disabled:s,...r,children:o.jsx(P2e,{className:ab.CheckMark})}),t&&o.jsx("label",{htmlFor:l,className:ab.Label,onMouseDown:c=>{!c.defaultPrevented&&c.detail>1&&c.preventDefault()},children:t})]})},MCe="_RadioGroup_onrfm_1",LCe="_RadioLabel_onrfm_9",DCe="_RadioIndicatorWrapper_onrfm_26",PCe="_RadioItem_onrfm_43",BCe="_RadioIndicator_onrfm_26",bp={RadioGroup:MCe,RadioLabel:LCe,RadioIndicatorWrapper:DCe,RadioItem:PCe,RadioIndicator:BCe},gV=g.createContext(null),UCe=()=>{const e=g.use(gV);if(!e)throw new Error("RadioGroup components must be wrapped in ");return e},AN=({onChange:e,children:t,className:n,direction:s="row",disabled:i=!1,...r})=>{const a=g.useMemo(()=>({disabled:i,direction:s}),[i,s]);return o.jsx(gV,{value:a,children:o.jsx(fCe,{className:la(bp.RadioGroup,n),"data-direction":s,onValueChange:e,disabled:i,...r,children:t})})},FCe=({value:e,disabled:t=!1,required:n,children:s,className:i,block:r=!1,...a})=>{const{disabled:l}=UCe(),c=l||t,u=g.useId(),d=`${e}-${u}`;return o.jsx("div",{className:"flex",...a,children:o.jsxs("label",{htmlFor:d,className:la(bp.RadioLabel,i),"data-disabled":c?"":void 0,"data-block":r?"":void 0,onMouseDown:f=>{!f.defaultPrevented&&f.detail>1&&f.preventDefault()},children:[o.jsx("div",{className:bp.RadioIndicatorWrapper,children:o.jsx(gCe,{id:d,value:e,disabled:c,required:n,className:bp.RadioItem,children:o.jsx(yCe,{className:bp.RadioIndicator})})}),s]})})};AN.Item=FCe;function $Ce({className:e,...t}){return o.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:[o.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"}),o.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 dd={llm:{id:"llm",label:"LLM 智能体",desc:"大模型驱动,自主完成任务",icon:$Ce},sequential:{id:"sequential",label:"顺序型智能体",desc:"子 Agent 按顺序依次执行",icon:aee},parallel:{id:"parallel",label:"并行型智能体",desc:"子 Agent 并行执行后汇总",icon:Cee},loop:{id:"loop",label:"循环型智能体",desc:"子 Agent 循环执行到满足条件",icon:Ak},a2a:{id:"a2a",label:"远程智能体",desc:"通过 A2A 协议调用远程 Agent",icon:e1}},HCe=[dd.llm,dd.sequential,dd.parallel,dd.loop,dd.a2a];function bV(e){return dd[e??"llm"]}const yV=e=>e==="sequential"||e==="parallel"||e==="loop",iE=e=>e==="a2a";function ec(e){return e.trimEnd().replace(/[。.]+$/,"")}function Ex(e,t){const n=e.trim().toLocaleLowerCase();return n?t.some(s=>s==null?void 0:s.toLocaleLowerCase().includes(n)):!0}function vc(e,t){return e[t]|e[t+1]<<8}function td(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function zCe(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 xV(e,t={}){let s=-1;for(let u=e.length-22;u>=0&&u>e.length-65557;u--)if(td(e,u)===101010256){s=u;break}if(s<0)throw new Error("无效的 zip:找不到 EOCD");const i=vc(e,s+10);if(t.maxEntries!==void 0&&i>t.maxEntries)throw new Error(`zip 文件数不能超过 ${t.maxEntries} 个`);let r=td(e,s+16);const a=new TextDecoder("utf-8"),l=[];let c=0;for(let u=0;ut.maxUncompressedBytes)throw new Error("zip 解压后的内容过大");const x=vc(e,v+26),E=vc(e,v+28),w=v+30+x+E,_=e.subarray(w,w+f);let S;if(d===0)S=_;else if(d===8)S=await zCe(_);else{r+=46+p+m+b;continue}l.push({name:y,text:a.decode(S)}),r+=46+p+m+b}return l}const VCe="/skillhub/v1/skills";async function GCe(e,t="public"){const n=e.trim(),s=`${VCe}?query=${encodeURIComponent(n)}&namespace=${encodeURIComponent(t)}`,i=await fetch(s,{headers:{accept:"application/json"},signal:Un(void 0,rc)});if(!i.ok)throw new Error(`搜索失败 (${i.status})`);return((await i.json()).Skills??[]).map(a=>{var l;return{source:"skillhub",id:a.Id??a.Slug??"",slug:a.Slug??"",name:a.Name??a.Slug??"",description:((l=a.Metadata)==null?void 0:l.DisplayDescription)||a.Description||"",namespace:a.Namespace??t,sourceRepo:a.SourceRepo,downloadCount:a.DownloadCount}})}function KCe({selected:e,onChange:t}){const[n,s]=g.useState(""),[i,r]=g.useState([]),[a,l]=g.useState(!1),[c,u]=g.useState(null),[d,f]=g.useState(!1),h=b=>e.some(v=>v.source==="skillhub"&&v.slug===b),p=b=>{b.slug&&(h(b.slug)?t(e.filter(v=>!(v.source==="skillhub"&&v.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=>{l(!0),u(null),f(!0);try{const v=await GCe(b);r(v)}catch(v){u(v instanceof Error?v.message:"搜索失败,请稍后重试。"),r([])}finally{l(!1)}};return g.useEffect(()=>{const b=n.trim();if(!b){r([]),f(!1),u(null);return}const v=setTimeout(()=>m(b),300);return()=>clearTimeout(v)},[n]),o.jsxs("div",{className:"cw-skillhub",children:[o.jsxs("div",{className:"cw-skill-searchrow",children:[o.jsxs("div",{className:"cw-skill-searchbox",children:[o.jsx(By,{className:"cw-i cw-skill-searchicon","aria-hidden":!0}),o.jsx("input",{className:"cw-input cw-skill-input",value:n,placeholder:"搜索火山 Find Skill 技能广场,例如 数据分析、PDF…",onChange:b=>s(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),n.trim()&&m(n))}})]}),o.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft",onClick:()=>n.trim()&&m(n),disabled:!n.trim()||a,children:[a?o.jsx(mn,{className:"cw-i cw-spin"}):o.jsx(By,{className:"cw-i"}),"搜索"]})]}),c&&o.jsxs("div",{className:"cw-banner",children:[o.jsx(ic,{className:"cw-i"}),o.jsx("span",{children:c})]}),a&&i.length===0?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(mn,{className:"cw-i cw-spin"})," 正在搜索…"]}):i.length>0?o.jsx("div",{className:"cw-skill-results",children:i.map(b=>{const v=h(b.slug||"");return o.jsxs("button",{type:"button",className:`cw-skill-result ${v?"is-on":""}`,onClick:()=>p(b),"aria-pressed":v,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:v?o.jsx(Ra,{className:"cw-i cw-i-sm"}):o.jsx(_i,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsx("span",{className:"cw-skill-result-name",children:b.name}),b.description&&o.jsx("span",{className:"cw-skill-result-desc",children:ec(b.description)}),b.sourceRepo&&o.jsx("span",{className:"cw-skill-result-repo",children:b.sourceRepo})]})]},b.id||b.slug)})}):d&&!c?o.jsx("p",{className:"cw-empty-line",children:"没有找到匹配的技能,换个关键词试试。"}):!d&&o.jsx("p",{className:"cw-empty-line",children:"输入关键词搜索火山 Find Skill 技能广场,所选技能会在生成项目时下载到 skills/ 目录。"})]})}const CN=/(^|\/)skill\.md$/i;function qCe(e){const t=(e??"").replace(/\r\n?/g,` +${t}`}function OAe(e,t){if(e.length<=t)return{text:e,omitted:!1};let n=e.slice(-t);const s=n.indexOf(` +`);return s>=0&&(n=n.slice(s+1)),{text:n,omitted:!0}}function H3(e,t,n=jAe){const s=RAe((e==null?void 0:e.text)??"",t.text??""),i=OAe(s,n),r=i.text?i.text.split(` +`).length:0,a=!!(t.snapshotTruncated||t.truncated),l=!!(e!=null&&e.omittedEarly||i.omitted);return{...t,text:i.text,lineCount:r,truncated:!!(e!=null&&e.truncated||t.truncated||l),omittedEarly:l,snapshotTruncated:!!(e!=null&&e.snapshotTruncated||a)}}or.registerLanguage("python",_F);or.registerLanguage("typescript",DF);or.registerLanguage("javascript",yF);or.registerLanguage("json",xF);or.registerLanguage("yaml",PF);or.registerLanguage("markdown",SF);or.registerLanguage("bash",fF);or.registerLanguage("ini",hF);or.registerLanguage("dockerfile",kye);or.registerLanguage("makefile",wF);const MAe=g.lazy(()=>eu(()=>import("./CodeEditor-CCfFnG8t.js"),[])),bl=()=>{};function LAe({open:e,isUpdate:t,onCancel:n,onConfirm:s}){const i=g.useRef(null);return g.useEffect(()=>{var l;if(!e)return;const r=document.body.style.overflow;document.body.style.overflow="hidden",(l=i.current)==null||l.focus();const a=c=>{c.key==="Escape"&&n()};return window.addEventListener("keydown",a),()=>{document.body.style.overflow=r,window.removeEventListener("keydown",a)}},[n,e]),e?hi.createPortal(o.jsx("div",{className:"code-browser-backdrop pp-confirm-backdrop",onMouseDown:r=>{r.target===r.currentTarget&&n()},children:o.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:[o.jsxs("header",{className:"code-browser-head pp-confirm-head",children:[o.jsxs("div",{className:"code-browser-title-wrap",children:[o.jsx("span",{className:"code-browser-title-icon pp-confirm-icon","aria-hidden":"true",children:o.jsx(Mee,{})}),o.jsx("h2",{id:"pp-confirm-title",children:t?"确认更新":"确认部署"})]}),o.jsx("button",{type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭部署确认",children:o.jsx(Ti,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"pp-confirm-body",children:o.jsx("p",{id:"pp-confirm-description",children:t?"将更新并发布到当前云端 Runtime,过程可能需要几分钟。确定继续吗?":"将创建新的云端 Runtime,部署过程可能需要几分钟。确定继续吗?"})}),o.jsxs("footer",{className:"pp-confirm-actions",children:[o.jsx("button",{ref:i,type:"button",onClick:n,children:"取消"}),o.jsx("button",{type:"button",className:"is-primary",onClick:s,children:t?"确定更新":"确定部署"})]})]})}),document.body):null}function _z({ariaLabel:e,value:t,placeholder:n,options:s,disabled:i=!1,onChange:r}){const a=g.useId(),l=g.useRef(null),c=g.useRef(null),u=g.useRef([]),[d,f]=g.useState(!1),[h,p]=g.useState(0),m=s.find(x=>x.value===t);g.useEffect(()=>{if(!d)return;const x=E=>{E.target instanceof Node&&l.current&&!l.current.contains(E.target)&&f(!1)};return window.addEventListener("pointerdown",x),()=>window.removeEventListener("pointerdown",x)},[d]),g.useEffect(()=>{var x;d&&((x=u.current[h])==null||x.focus())},[h,d]);const b=(x=1)=>{const E=s.findIndex(_=>_.value===t),w=E>=0?E:x===1?0:Math.max(0,s.length-1);p(w),f(!0)},v=x=>{s.length!==0&&p((x+s.length)%s.length)},y=x=>{var E;r(x.value),f(!1),(E=c.current)==null||E.focus()};return o.jsxs("div",{className:"pp-deployment-select",ref:l,onKeyDown:x=>{var E;if(x.key==="Escape"&&d){x.preventDefault(),f(!1),(E=c.current)==null||E.focus();return}if(x.key==="Tab"){f(!1);return}x.key==="ArrowDown"?(x.preventDefault(),d?v(h+1):b(1)):x.key==="ArrowUp"?(x.preventDefault(),d?v(h-1):b(-1)):d&&x.key==="Home"?(x.preventDefault(),p(0)):d&&x.key==="End"&&(x.preventDefault(),p(Math.max(0,s.length-1)))},children:[o.jsxs("button",{ref:c,type:"button",className:"pp-deployment-select-trigger","aria-label":e,"aria-haspopup":"listbox","aria-expanded":d,"aria-controls":d?a:void 0,disabled:i||s.length===0,onClick:()=>{d?f(!1):b()},children:[o.jsx("span",{className:m?void 0:"is-placeholder",children:(m==null?void 0:m.label)??n}),o.jsx(bB,{"aria-hidden":"true",className:`pp-deployment-select-chevron${d?" is-open":""}`})]}),d&&o.jsx("div",{id:a,className:"pp-deployment-select-menu",role:"listbox","aria-label":e,children:s.map((x,E)=>{const w=x.value===t;return o.jsxs("button",{ref:_=>{u.current[E]=_},type:"button",role:"option","aria-selected":w,tabIndex:E===h?0:-1,className:`pp-deployment-select-option${w?" is-selected":""}`,title:x.description,onFocus:()=>p(E),onClick:()=>y(x),children:[o.jsxs("span",{className:"pp-deployment-select-copy",children:[o.jsxs("span",{className:"pp-deployment-select-name",children:[x.label,x.badge&&o.jsx("span",{className:"pp-deployment-select-badge",children:x.badge})]}),x.description&&o.jsx("small",{children:x.description})]}),w&&o.jsx(ja,{"aria-hidden":"true"})]},x.value)})})]})}function DAe({value:e,disabled:t,onChange:n}){const[s,i]=g.useState([]),[r,a]=g.useState(!0),[l,c]=g.useState(null),[u,d]=g.useState(0);g.useEffect(()=>{const p=new AbortController;return a(!0),c(null),n8(p.signal).then(m=>i(m)).catch(m=>{m instanceof DOMException&&m.name==="AbortError"||(i([]),c(m instanceof Error?m.message:String(m)))}).finally(()=>{p.signal.aborted||a(!1)}),()=>p.abort()},[u]);const f=g.useMemo(()=>[...s].sort((p,m)=>Number(m.isCurrent)-Number(p.isCurrent)).map(p=>({value:p.uid,label:p.name.trim()||"未命名用户池",description:p.domain||p.uid,badge:p.isCurrent?"当前用户池":void 0})),[s]),h=s.find(p=>p.uid===e);return o.jsxs("div",{className:"pp-user-pool-picker",children:[o.jsx(_z,{ariaLabel:"部署用户池",value:e,placeholder:r?"正在加载用户池…":"请选择用户池",options:f,disabled:t||r||!!l,onChange:n}),l?o.jsxs("div",{className:"pp-user-pool-error",role:"alert",children:[o.jsx("span",{children:l}),o.jsx("button",{type:"button",onClick:()=>d(p=>p+1),children:"重试"})]}):r?o.jsxs("span",{className:"pp-user-pool-status","aria-live":"polite",children:[o.jsx(dn,{"aria-hidden":"true",className:"pp-user-pool-spinner"}),"正在加载 Identity 用户池…"]}):s.length===0?o.jsx("span",{className:"pp-user-pool-status",children:"当前账号下暂无 Identity 用户池。"}):h!=null&&h.isCurrent?o.jsx("span",{className:"pp-user-pool-status",children:"当前 Studio 的登录 JWT 将透传访问此 Runtime。"}):h?o.jsx("div",{className:"pp-user-pool-error",role:"alert",children:o.jsx("span",{children:"所选用户池不是当前 Studio 使用的用户池,部署后无法从 Studio 调用此 Runtime。"})}):o.jsx("span",{className:"pp-user-pool-status",children:"当前 Studio 使用的用户池已在列表中标注。"})]})}const PAe=[{value:"api_key",label:"API Key",description:"默认方式,使用 Runtime API Key 访问"},{value:"user_pool",label:"用户池",description:"使用 Identity 用户池签发的 JWT"}],BAe={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"},z3={dockerfile:"dockerfile","requirements.txt":"plaintext","requirements-dev.txt":"plaintext",".env":"ini",".gitignore":"plaintext",makefile:"makefile"};function V3(e){return e.replace(/&/g,"&").replace(//g,">")}function UAe(e){const n=(e.split("/").pop()??e).toLowerCase();if(z3[n])return z3[n];if(n.startsWith("dockerfile"))return"dockerfile";if(n.startsWith(".env"))return"ini";const s=n.lastIndexOf(".");if(s===-1)return null;const i=n.slice(s+1);return BAe[i]??null}function FAe(e,t){try{const n=UAe(t);return n&&or.getLanguage(n)?or.highlight(e,{language:n,ignoreIllegals:!0}).value:n===null?or.highlightAuto(e).value:V3(e)}catch{return V3(e)}}const $Ae=[{phase:"build",label:"构建镜像"},{phase:"deploy",label:"部署"},{phase:"publish",label:"发布"}],HAe=[{phase:"upload",label:"上传代码包"},{phase:"build",label:"镜像打包"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}],zAe={phase:"update",label:"更新实例配置"},VAe={phase:"evaluation",label:"创建评测集"};function GAe(e){return e?!e.memory.shortTerm||(e.shortTermBackend||"local")==="local":!1}function KAe(e,t){const n=Number(e),s=Number(t);return!e.trim()||!t.trim()||!Number.isSafeInteger(n)||!Number.isSafeInteger(s)||n<1||s<1?{valid:!1,error:"实例数必须为大于 0 的整数。"}:n>s?{valid:!1,error:"最小实例数不能大于最大实例数。"}:{valid:!0,min:n,max:s}}function qAe(e){const t={name:"",children:new Map};for(const n of e){const s=n.path.split("/").filter(Boolean);let i=t;s.forEach((r,a)=>{let l=i.children.get(r);l||(l={name:r,children:new Map},i.children.set(r,l)),a===s.length-1&&(l.path=n.path),i=l})}return t}function YAe(e){return[...e.children.values()].sort((t,n)=>{const s=t.children.size>0&&t.path===void 0,i=n.children.size>0&&n.path===void 0;return s!==i?s?-1:1:t.name.localeCompare(n.name)})}function WAe(e="",t=""){return{id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,key:e,value:t}}function XAe({left:e,right:t}){const[n,s]=g.useState(null);return g.useLayoutEffect(()=>{const i=document.getElementById("veadk-page-header-left"),r=document.getElementById("veadk-page-header-actions");i&&r&&s({left:i,right:r})},[]),n?o.jsxs(o.Fragment,{children:[hi.createPortal(e,n.left),hi.createPortal(t,n.right)]}):o.jsxs("header",{className:"pp-toolbar",children:[e,t]})}function eE({project:e,embedded:t=!1,deployDisabledReason:n,agentDraft:s,agentName:i,agentCount:r,releaseConfiguration:a,onChange:l,onDeploy:c,onAgentAdded:u,onDeploymentComplete:d,deploymentActionLabel:f="部署",deploymentActionTargetId:h,deploymentRuntimeId:p,onDeploymentStarted:m,onDeploymentTaskChange:b,feishuEnabled:v=!1,onFeishuEnabledChange:y,deploymentEnv:x=[],deploymentEnvValues:E={},onDeploymentEnvChange:w,network:_,onNetworkChange:S,deployRegion:k="cn-beijing",onDeployRegionChange:T,deploymentTelemetrySource:C="unknown",onBack:I,backLabel:j="返回配置",onExportYaml:L,deploymentPrimaryPane:z,deployDisabled:D=!1}){var bs,On,Nn;const F=typeof l=="function",A=f.includes("更新"),M=GAe(s),[P,H]=g.useState(((On=(bs=e==null?void 0:e.files)==null?void 0:bs[0])==null?void 0:On.path)??null),[R,Y]=g.useState(new Set),[J,U]=g.useState(!1),[te,K]=g.useState(""),[V,W]=g.useState(!1),[q,ue]=g.useState(!1),[pe,we]=g.useState(!1),[de,ge]=g.useState(!1),[Le,Ee]=g.useState(null),[ie,Ne]=g.useState(null),[ve,Qe]=g.useState({}),[De,Ke]=g.useState(null),[Se,He]=g.useState(!1),[Be,qe]=g.useState([]),[Z,ae]=g.useState(!1),ne=g.useId(),[xe,Fe]=g.useState("api_key"),[at,It]=g.useState(""),[ft,fn]=g.useState("1"),[Et,Nt]=g.useState(M?"1":"5"),[Qt,Ve]=g.useState(!0),[Tt,rt]=g.useState(null),ut=g.useRef(!0),Ze=KAe(ft,Et),_t=!A&&Ze.valid&&(Ze.min!==1||Ze.max!==5),me=z?HAe:$Ae,We=_t?[...me,zAe]:me,bt=Qt?[...We,VAe]:We;g.useEffect(()=>{if(!h){rt(null);return}rt(document.getElementById(h))},[h]);const an=ce=>o.jsxs("div",{className:"pp-network-region",onKeyDown:Ae=>{Ae.key==="Escape"&&ae(!1)},children:[ce&&o.jsx("span",{children:"发布区域"}),o.jsxs("button",{type:"button",className:"pp-region-trigger","aria-label":"部署区域","aria-haspopup":"listbox","aria-expanded":Z,"aria-describedby":A?ne:void 0,disabled:V||A||!T,onClick:()=>ae(Ae=>!Ae),children:[o.jsx("span",{children:k==="cn-shanghai"?"华东 2(上海)":"华北 2(北京)"}),o.jsx(bB,{className:`pp-region-chevron${Z?" is-open":""}`})]}),Z&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>ae(!1)}),o.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":"部署区域",children:[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}].map(Ae=>{const Re=Ae.value===k;return o.jsxs("button",{type:"button",role:"option","aria-selected":Re,className:`pp-region-option${Re?" is-selected":""}`,onClick:()=>{T==null||T(Ae.value),ae(!1)},children:[o.jsx("span",{children:Ae.label}),Re&&o.jsx(ja,{"aria-hidden":"true"})]},Ae.value)})})]}),A&&o.jsx("span",{id:ne,className:"pp-region-help",children:"更新时沿用现有 Runtime 的部署区域,无法修改。"})]});g.useEffect(()=>(ut.current=!0,()=>{ut.current=!1}),[]),g.useEffect(()=>{fn("1"),Nt(M?"1":"5")},[M]),g.useEffect(()=>{if(!pe)return;const ce=document.body.style.overflow;document.body.style.overflow="hidden";const Ae=Re=>{Re.key==="Escape"&&we(!1)};return window.addEventListener("keydown",Ae),()=>{document.body.style.overflow=ce,window.removeEventListener("keydown",Ae)}},[pe]);const Kn=g.useMemo(()=>!(e!=null&&e.files)||!Array.isArray(e.files)?{name:"",children:new Map}:qAe(e.files),[e==null?void 0:e.files]);if(!e||!Array.isArray(e.files))return o.jsx("div",{className:"pp-error",children:"项目数据无效"});const xt=e.files.find(ce=>ce.path===P)??null,$t=(_==null?void 0:_.mode)??"public",hn=()=>({source:C,action:p?"update":"create",region:k,networkType:$t,feishuEnabled:v}),cn=lAe(v?[...x,...Hh]:x,E),Pt=cn.length+Be.length;function jt(ce){Y(Ae=>{const Re=new Set(Ae);return Re.has(ce)?Re.delete(ce):Re.add(ce),Re})}function Sn(ce,Ae){l&&(l({...e,files:ce}),Ae!==void 0&&H(Ae))}function pn(ce){xt&&Sn(e.files.map(Ae=>Ae.path===xt.path?{...Ae,content:ce}:Ae))}function zt(){const ce=te.trim();if(U(!1),K(""),!!ce){if(e.files.some(Ae=>Ae.path===ce)){H(ce);return}Sn([...e.files,{path:ce,content:""}],ce)}}function Fn(){if(!xt)return;const ce=window.prompt("重命名文件",xt.path),Ae=ce==null?void 0:ce.trim();!Ae||Ae===xt.path||e.files.some(Re=>Re.path===Ae)||Sn(e.files.map(Re=>Re.path===xt.path?{...Re,path:Ae}:Re),Ae)}function hs(){var Ae;if(!xt)return;const ce=e.files.filter(Re=>Re.path!==xt.path);Sn(ce,((Ae=ce[0])==null?void 0:Ae.path)??null)}function ps(ce,Ae){qe(Re=>Re.map(Je=>Je.id===ce?{...Je,...Ae}:Je))}function Rn(ce){qe(Ae=>Ae.filter(Re=>Re.id!==ce))}function $s(){qe(ce=>[...ce,WAe()])}function ms(ce){S&&S(ce==="public"?void 0:{..._??{mode:ce},mode:ce})}function $n(ce){S==null||S({..._??{mode:"private"},...ce})}function Hs(){const ce=new Map(Be.map(Re=>({key:Re.key.trim(),value:Re.value})).filter(Re=>Re.key.length>0).map(Re=>[Re.key,Re.value])),Ae=v?[...x,...Hh]:x;for(const Re of yz(Ae,E))ce.set(Re.key,Re.value);return[...ce].map(([Re,Je])=>({key:Re,value:Je}))}async function Hn(){if(!(!y||V||de)){Ee(null),ge(!0);try{await y(!v)}catch(ce){ut.current&&Ee(`更新飞书配置失败:${ce instanceof Error?ce.message:String(ce)}`)}finally{ut.current&&ge(!1)}}}async function js(){var Re;if(!c||V||D)return;if(!Ze.valid){Ee(Ze.error);return}if(!A&&xe==="user_pool"&&!at){Ee("请选择用于 Runtime 鉴权的用户池。");return}if($t!=="public"&&!((Re=_==null?void 0:_.vpcId)!=null&&Re.trim())){Ee("使用 VPC 网络时,请填写 VPC ID。");return}const ce=P3(x,E);if(ce){const Je=x.find(st=>st.key===ce.key);Ee(`请返回配置页填写 ${(Je==null?void 0:Je.comment)||(Je==null?void 0:Je.key)}(${Je==null?void 0:Je.key})。`);return}const Ae=xz(x,E);if(Ae){Ee(`${Ae.spec.comment||Ae.spec.key}:${Ae.error}`);return}if(v){const Je=P3(Hh,E);if(Je){const st=Hh.find(ot=>ot.key===Je.key);Ee(`启用飞书后,请填写${(st==null?void 0:st.comment)||(st==null?void 0:st.key)}。`);return}}ue(!0)}async function _n(){var Pe;if(!c||V)return;if(!Ze.valid){ue(!1),Ee(Ze.error);return}ue(!1);const ce=Hs();ut.current&&(Ee(null),Ne(null),Qe({}),Ke(null),W(!0));const Ae=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;let Re=(i==null?void 0:i.trim())||e.name||"生成中…";const Je=Date.now(),st={id:Ae,runtimeName:Re,runtimeId:p,region:k,startedAt:Je,status:"running",phase:"prepare",label:"准备部署",agentDraft:s,instanceRange:_t?{min:Ze.min,max:Ze.max}:void 0,createEvaluationSets:Qt};b==null||b(st),m==null||m(st);let ot,kt=st.phase??"prepare";const Mn=Vt=>ot?{...ot,status:Vt,updatedAt:Date.now()}:void 0,Tn=Vt=>{const vt=Mn(Vt);return vt?{buildLog:vt}:{}},qt=()=>({source:"code-pipeline",status:"running",text:"",lineCount:0,truncated:!1,updatedAt:Date.now(),pendingMessage:"正在等待构建日志…"}),pi=Vt=>{if(kt!=="build")return;const vt=["","----- 构建失败 -----",Vt].join(` +`);return ot=H3(ot,{source:"code-pipeline",status:"error",text:vt,lineCount:vt.split(` +`).length,truncated:!1,updatedAt:Date.now()}),ot};try{const Vt=await c(e,vt=>{var qn;vt.runtimeName&&(Re=vt.runtimeName),kt=vt.phase,vt.buildLog?ot=H3(ot,vt.buildLog):vt.phase==="build"&&!ot&&(ot=qt()),ut.current&&(Qe(ys=>({...ys,[vt.phase]:vt})),Ke(vt.phase)),b==null||b({id:Ae,runtimeName:Re,runtimeId:p,region:k,startedAt:Je,status:"running",phase:vt.phase,label:((qn=bt.find(ys=>ys.phase===vt.phase))==null?void 0:qn.label)??vt.phase,message:vt.message,pct:vt.pct,...ot?{buildLog:ot}:{}})},{taskId:Ae,sessionStorage:M?"in-memory":"persistent",minInstance:Ze.min,maxInstance:Ze.max,...A?{}:{authentication:xe==="user_pool"?{type:"user_pool",userPoolUid:at}:{type:"api_key"}},createEvaluationSets:Qt,...v?{im:{feishu:{enabled:!0}}}:{},envs:ce});ut.current&&(Ne(Vt),Ke(null)),EAe({...hn(),runtimeId:Vt.runtimeId||p||""}),b==null||b({id:Ae,runtimeName:Vt.agentName||Re,runtimeId:Vt.runtimeId||p,region:Vt.region||k,startedAt:Je,status:"success",phase:"complete",label:"部署完成",message:(Pe=Vt.warnings)==null?void 0:Pe.join(";"),...Tn("complete")});try{await(d==null?void 0:d(Vt))}catch(vt){if(!(vt instanceof Sr))throw vt;b==null||b({id:Ae,runtimeName:Vt.agentName||Re,runtimeId:Vt.runtimeId||p,region:Vt.region||k,startedAt:Je,status:"success",phase:"complete",label:"部署完成,暂未连接",message:vt.message,...Tn("complete")})}}catch(Vt){const vt=Vt instanceof Error?Vt.message:String(Vt);if(Vt instanceof DOMException&&Vt.name==="AbortError"){ut.current&&(Ee(null),Ke(null)),b==null||b({id:Ae,runtimeName:Re,runtimeId:p,region:k,startedAt:Je,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。",...Tn("complete")});return}ut.current&&Ee(vt);const qn=pi(vt),ys=!!qn;vAe({...hn(),phase:kt,error:Vt}),b==null||b({id:Ae,runtimeName:Re,runtimeId:p,region:k,startedAt:Je,status:"error",phase:kt,label:"部署失败",message:ys?"构建镜像失败,详见构建日志。":vt,...qn?{buildLog:qn}:Tn("complete"),retry:js})}finally{ut.current&&W(!1)}}function ss(){ue(!1)}async function is(){if(!(!ie||Se)){He(!0),Ee(null);try{const{addConnection:ce,addRuntimeConnection:Ae,remoteAppId:Re,loadConnections:Je}=await eu(async()=>{const{addConnection:kt,addRuntimeConnection:Mn,remoteAppId:Tn,loadConnections:qt}=await Promise.resolve().then(()=>YL);return{addConnection:kt,addRuntimeConnection:Mn,remoteAppId:Tn,loadConnections:qt}},void 0),{probeRuntimeApps:st}=await eu(async()=>{const{probeRuntimeApps:kt}=await Promise.resolve().then(()=>yte);return{probeRuntimeApps:kt}},void 0);let ot;if(ie.runtimeId){const kt=ie.region??k,Mn=await st(ie.runtimeId,kt,{retryProbe:!0})??[];ot=Ae(ie.runtimeId,ie.agentName,kt,Mn,Mn.length>0?{[Mn[0]]:ie.agentName}:void 0,ie.version)}else ot=await ce(ie.agentName,ie.url,ie.apikey,"");if(ot.apps.length===0)Ee("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。");else{const kt={[ot.apps[0]]:ie.agentName},Mn={...ot,appLabels:{...ot.appLabels??{},...kt}},qt=Je().map(Pe=>Pe.id===ot.id?Mn:Pe);localStorage.setItem("veadk_agentkit_connections",JSON.stringify(qt));const{registerConnections:pi}=await eu(async()=>{const{registerConnections:Pe}=await Promise.resolve().then(()=>YL);return{registerConnections:Pe}},void 0);if(pi(qt),u){const Pe=Re(ot.id,ot.apps[0]);u(Pe,ie.agentName)}else alert(`🎉 Agent "${ie.agentName}" 已添加到左上角下拉列表!`)}}catch(ce){Ee(`添加 Agent 失败:${ce instanceof Error?ce.message:String(ce)}`)}finally{He(!1)}}}function _s(){const ce=TAe(e.files),Ae=URL.createObjectURL(ce),Re=document.createElement("a");Re.href=Ae,Re.download=`${e.name||"project"}.zip`,document.body.appendChild(Re),Re.click(),document.body.removeChild(Re),URL.revokeObjectURL(Ae)}const gs=o.jsxs("div",{className:`pp-artifact-actions${t?" is-rail":""}`,"aria-label":"发布产物操作",children:[L&&o.jsxs("button",{type:"button",className:"pp-secondary",onClick:L,children:[o.jsx(iee,{className:"pp-ic"}),"导出 YAML"]}),F&&l&&o.jsx(IAe,{project:e,onChange:l,className:"pp-artifact-source",label:"查看源代码"}),e.files.length>0&&o.jsxs("button",{type:"button",className:"pp-secondary",onClick:_s,children:[o.jsx(t1,{className:"pp-ic"}),"下载源代码"]})]});function zs(ce,Ae,Re){return YAe(ce).map(Je=>{const st=Re?`${Re}/${Je.name}`:Je.name,ot=Je.path!==void 0,kt={paddingLeft:8+Ae*14};if(ot){const Tn=Je.path===P;return o.jsxs("button",{type:"button",className:`pp-row pp-file${Tn?" pp-active":""}`,style:kt,onClick:()=>H(Je.path),title:Je.path,children:[o.jsx(oee,{className:"pp-ic"}),o.jsx("span",{className:"pp-label",children:Je.name})]},st)}const Mn=R.has(st);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"pp-row pp-folder",style:kt,onClick:()=>jt(st),children:[o.jsx(nc,{className:`pp-ic pp-chevron${Mn?"":" pp-open"}`}),o.jsx(xB,{className:"pp-ic"}),o.jsx("span",{className:"pp-label",children:Je.name})]}),!Mn&&zs(Je,Ae+1,st)]},st)})}return o.jsxs("div",{className:`pp-root${c?" is-deploy":""}${t?" is-embedded":""}${z?" has-primary-pane":""}`,children:[c&&!t&&o.jsx(XAe,{left:o.jsxs("div",{className:"pp-toolbar-left",children:[I&&o.jsxs("button",{type:"button",className:"pp-toolbar-back",onClick:I,children:[o.jsx(Tk,{className:"pp-ic"}),j]}),o.jsxs("span",{className:"pp-toolbar-title",children:["部署 ",i||e.name||"未命名 Agent",r&&r>1?` 等 ${r} 个智能体`:""]})]}),right:null}),o.jsxs("div",{className:"pp-body",children:[c&&!z&&o.jsx("section",{className:"pp-release-overview","aria-label":"发布概览",children:o.jsxs("div",{className:`pp-release-preview${t?" is-embedded":""}`,children:[o.jsxs("div",{className:"pp-flow-thumbnail",children:[s&&o.jsx(Om,{draft:s,direction:"horizontal",selectedPath:[],onSelect:bl,onAdd:bl,onInsert:bl,onDelete:bl,readOnly:!0,interactivePreview:!0}),o.jsx("button",{type:"button",className:"pp-flow-expand",onClick:()=>we(!0),"aria-label":"放大查看执行流程",title:"放大查看",children:o.jsx(Yc,{"aria-hidden":!0})})]}),t&&gs,!t&&o.jsxs("div",{className:"pp-release-info",children:[o.jsx("div",{className:"pp-release-card-head",children:"Agent 概览"}),o.jsxs("div",{className:"pp-release-info-body",children:[o.jsxs("div",{className:"pp-release-info-main",children:[o.jsx("h2",{children:i||e.name||"未命名 Agent"}),(s==null?void 0:s.description)&&o.jsx("p",{className:"pp-release-description",title:s.description,children:s.description}),o.jsxs("dl",{className:"pp-release-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"Agent 数量"}),o.jsx("dd",{children:r??1})]}),a&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("dt",{children:"模型"}),o.jsx("dd",{children:a.modelName})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"描述"}),o.jsx("dd",{className:"pp-release-fact-long",children:a.description})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"系统提示词"}),o.jsx("dd",{className:"pp-release-fact-long pp-release-prompt",children:a.instruction})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"优化选项"}),o.jsx("dd",{children:a.optimizations.length>0?a.optimizations.join("、"):"未启用"})]})]})]})]}),gs]})]})]})}),o.jsxs("div",{className:"pp-files-area",children:[o.jsxs("div",{className:"pp-sidebar",children:[o.jsxs("div",{className:"pp-sidebar-head",children:[o.jsx("span",{className:"pp-project-name",title:e.name,children:"文件预览"}),F&&o.jsx("button",{type:"button",className:"pp-icon-btn",title:"新建文件",onClick:()=>{U(!0),K("")},children:o.jsx(ree,{className:"pp-ic"})})]}),o.jsxs("div",{className:"pp-tree",children:[J&&o.jsx("input",{className:"pp-new-input",autoFocus:!0,placeholder:"path/to/file.py",value:te,onChange:ce=>K(ce.target.value),onBlur:zt,onKeyDown:ce=>{ce.key==="Enter"&&zt(),ce.key==="Escape"&&(U(!1),K(""))}}),e.files.length===0&&!J?o.jsx("div",{className:"pp-empty",children:"暂无文件"}):zs(Kn,0,"")]})]}),o.jsxs("div",{className:"pp-main",children:[o.jsxs("div",{className:"pp-main-head",children:[o.jsx("span",{className:"pp-path",title:xt==null?void 0:xt.path,children:(xt==null?void 0:xt.path)??"未选择文件"}),o.jsx("div",{className:"pp-actions",children:F&&xt&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"pp-icon-btn",title:"重命名",onClick:Fn,children:o.jsx(Tee,{className:"pp-ic"})}),o.jsx("button",{type:"button",className:"pp-icon-btn pp-danger",title:"删除",onClick:hs,children:o.jsx(sc,{className:"pp-ic"})})]})})]}),o.jsx("div",{className:"pp-content",children:xt==null?o.jsx("div",{className:"pp-placeholder",children:"选择左侧文件以查看内容"}):F?o.jsx("div",{className:"pp-codemirror",children:o.jsx(g.Suspense,{fallback:o.jsx("div",{className:"pp-editor-loading",children:"加载编辑器…"}),children:o.jsx(MAe,{value:xt.content,path:xt.path,onChange:pn})})}):o.jsx("pre",{className:"pp-pre hljs",dangerouslySetInnerHTML:{__html:FAe(xt.content,xt.path)}})})]})]}),c&&o.jsxs("aside",{className:"pp-config","aria-label":"部署配置",children:[o.jsx("div",{className:"pp-config-head",children:o.jsx("div",{className:"pp-config-title",children:"部署配置"})}),o.jsxs("div",{className:"pp-config-scroll",children:[z,!z&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"发布区域"}),an(!1)]}),!z&&o.jsxs("section",{className:"pp-config-section pp-auth-section",children:[o.jsx("div",{className:"pp-config-label",children:"访问鉴权"}),A?o.jsx("p",{className:"pp-config-note pp-auth-preserved-note",children:"更新时保持现有 Runtime 的鉴权方式不变。"}):o.jsxs("div",{className:"pp-auth-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"鉴权方式"}),o.jsx(_z,{ariaLabel:"部署鉴权方式",value:xe,placeholder:"请选择鉴权方式",options:PAe,disabled:V,onChange:ce=>{Ee(null),Fe(ce)}})]}),xe==="user_pool"&&o.jsxs("label",{children:[o.jsx("span",{children:"用户池"}),o.jsx(DAe,{value:at,disabled:V,onChange:ce=>{Ee(null),It(ce)}})]})]})]}),!z&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"消息渠道"}),o.jsx("div",{className:`pp-channel-card${v?" is-flipped":""}`,children:o.jsxs("div",{className:"pp-channel-card-inner",children:[o.jsxs("button",{type:"button",className:"pp-channel-card-face pp-channel-card-front","aria-pressed":v,"aria-hidden":v,tabIndex:v?-1:0,onClick:()=>void Hn(),disabled:v||V||de||!y,children:[o.jsx("span",{className:"pp-channel-logo",children:o.jsx("img",{src:t2,alt:""})}),o.jsxs("span",{className:"pp-channel-card-copy",children:[o.jsx("strong",{children:"飞书"}),o.jsx("small",{children:de?"正在启用并更新配置…":"接收消息并通过飞书机器人回复"})]})]}),o.jsxs("div",{className:"pp-channel-card-face pp-channel-card-back","aria-hidden":!v,children:[o.jsxs("div",{className:"pp-channel-card-head",children:[o.jsx("strong",{children:"飞书配置"}),o.jsx("button",{type:"button",className:"pp-channel-remove",tabIndex:v?0:-1,onClick:()=>void Hn(),disabled:!v||V||de||!y,children:de?"取消中…":"取消"})]}),o.jsx("div",{className:"pp-channel-fields",children:Hh.map(ce=>o.jsxs("label",{children:[o.jsxs("span",{children:[ce.comment||ce.key,ce.required&&o.jsx("small",{children:"必填"})]}),o.jsx("input",{type:ce.key.includes("SECRET")?"password":"text",value:E[ce.key]??"",placeholder:ce.placeholder,tabIndex:v?0:-1,disabled:!v||V||!w,autoComplete:"off",onChange:Ae=>w==null?void 0:w(ce.key,Ae.currentTarget.value)})]},ce.key))})]})]})})]}),!A&&o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"实例设置"}),o.jsxs("div",{className:"pp-instance-fields",children:[o.jsxs("label",{htmlFor:"runtime-min-instance",children:[o.jsx("span",{children:"最小实例数"}),o.jsx("input",{id:"runtime-min-instance",type:"number",min:"1",step:"1",inputMode:"numeric",value:ft,disabled:V,"aria-invalid":!Ze.valid,onChange:ce=>fn(ce.currentTarget.value)})]}),o.jsxs("label",{htmlFor:"runtime-max-instance",children:[o.jsx("span",{children:"最大实例数"}),o.jsx("input",{id:"runtime-max-instance",type:"number",min:"1",step:"1",inputMode:"numeric",value:Et,disabled:V,"aria-invalid":!Ze.valid,onChange:ce=>Nt(ce.currentTarget.value)})]})]}),M&&o.jsx("p",{className:"pp-instance-note",role:"note",children:"为避免多实例间会话丢失,推荐将 Runtime 固定为 1~1"}),!Ze.valid&&o.jsx("p",{className:"pp-instance-error",role:"alert",children:Ze.error})]}),o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"网络"}),z&&an(!0),A&&o.jsx("p",{className:"pp-config-note",children:"现有 Runtime 的区域与网络模式保持不变。"}),o.jsxs("div",{className:"pp-network-layout",children:[o.jsx("div",{className:"pp-network-modes",role:"radiogroup","aria-label":"网络模式",children:["public","private","both"].map(ce=>o.jsxs("label",{className:"pp-network-option",children:[o.jsx("input",{type:"radio",name:"deployment-network-mode",value:ce,checked:$t===ce,onChange:()=>ms(ce),disabled:V||A||!S}),o.jsx("span",{children:ce==="public"?"公网":ce==="private"?"VPC":"公网 + VPC"})]},ce))}),$t!=="public"&&o.jsxs("div",{className:"pp-network-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"VPC ID"}),o.jsx("input",{value:(_==null?void 0:_.vpcId)??"",placeholder:"vpc-xxxxxxxx",disabled:V||A,onChange:ce=>$n({vpcId:ce.target.value})})]}),o.jsxs("label",{children:[o.jsxs("span",{children:["子网 ID ",o.jsx("small",{children:"可选,多个用逗号分隔"})]}),o.jsx("input",{value:(_==null?void 0:_.subnetIds)??"",placeholder:"subnet-xxx, subnet-yyy",disabled:V||A,onChange:ce=>$n({subnetIds:ce.target.value})})]}),o.jsxs("label",{className:"pp-network-check",children:[o.jsx("input",{type:"checkbox",checked:!!(_!=null&&_.enableSharedInternetAccess),disabled:V||A,onChange:ce=>$n({enableSharedInternetAccess:ce.target.checked})}),"VPC 内共享公网出口"]})]})]})]}),o.jsxs("section",{className:"pp-config-section",children:[o.jsx("div",{className:"pp-config-label",children:"评测集"}),o.jsxs("label",{className:"pp-evaluation-set-option",children:[o.jsx("input",{type:"checkbox",checked:Qt,disabled:V,onChange:ce=>Ve(ce.currentTarget.checked)}),o.jsxs("span",{children:[o.jsx("strong",{children:"自动创建评测集"}),o.jsx("small",{children:"部署成功后,自动创建 Good Case 和 Bad Case 评测集。"})]})]})]}),o.jsxs("section",{className:"pp-config-section pp-env-section",children:[o.jsx("div",{className:"pp-env-head",children:o.jsxs("div",{children:[o.jsxs("div",{className:"pp-config-label",children:["环境变量",o.jsxs("span",{className:"pp-agent-child-count pp-env-count",children:[Pt," 项"]})]}),o.jsx("div",{className:"pp-env-sub",children:"组件配置会自动同步到这里,部署前可核对最终值。"})]})}),o.jsxs("button",{type:"button",className:"pp-env-add",onClick:$s,disabled:V,children:[o.jsx(_i,{className:"pp-ic"}),"添加变量"]}),(cn.length>0||Be.length>0)&&o.jsxs("div",{className:"pp-env-table",children:[cn.length>0&&o.jsxs("div",{className:"pp-env-group",children:[o.jsxs("div",{className:"pp-env-group-head",children:[o.jsx("span",{children:"组件自动生成"}),o.jsxs("small",{children:[cn.length," 项"]})]}),cn.map(ce=>{const Ae=ce.key.startsWith("ENABLE_"),Re=N2(ce,E),Je=ce.multiline||ce.format==="json";return o.jsxs("div",{className:`pp-env-row pp-env-row-derived${Je?" is-multiline":""}`,children:[o.jsxs("div",{className:"pp-env-key-fixed pp-env-key-cell","aria-label":`${ce.key} 环境变量名`,"aria-disabled":V,children:[o.jsx("span",{title:ce.key,children:ce.key}),(ce.help||ce.comment)&&o.jsxs("span",{className:"pp-env-help",tabIndex:0,"data-help":ce.help||ce.comment,"aria-label":`${ce.key}说明:${ce.help||ce.comment}`,children:["?",o.jsx("span",{className:"pp-env-help-popover",role:"tooltip",children:ce.help||ce.comment})]}),ce.link&&o.jsx("a",{className:"pp-env-link",href:ce.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开 OpenViking ${ce.link.label}`,"aria-label":`${ce.key}:打开 OpenViking ${ce.link.label}`,children:o.jsx(Em,{"aria-hidden":"true"})})]}),o.jsxs("div",{className:"pp-env-value-wrap",children:[Je?o.jsx("textarea",{className:"pp-env-value pp-env-json-value",value:ce.value,placeholder:ce.required?"必填,尚未填写":"可选,尚未填写",readOnly:Ae,disabled:V||!Ae&&!w,autoComplete:"off",spellCheck:!1,"aria-invalid":!!Re,"aria-label":`${ce.key} 环境变量值`,onChange:st=>w==null?void 0:w(ce.key,st.currentTarget.value)}):o.jsx("input",{className:"pp-env-value",type:"text",value:ce.value,placeholder:ce.required?"必填,尚未填写":"可选,尚未填写",readOnly:Ae,disabled:V||!Ae&&!w,autoComplete:"off","aria-invalid":!!Re,"aria-label":`${ce.key} 环境变量值`,onChange:st=>w==null?void 0:w(ce.key,st.currentTarget.value)}),Re&&o.jsx("span",{className:"pp-env-error",children:Re})]}),o.jsx("span",{className:"pp-env-source",children:Ae?"自动":"同步"})]},ce.key)})]}),Be.length>0&&o.jsxs("div",{className:"pp-env-group-head pp-env-group-head-custom",children:[o.jsx("span",{children:"自定义变量"}),o.jsxs("small",{children:[Be.length," 项"]})]}),Be.map(ce=>o.jsxs("div",{className:"pp-env-row",children:[o.jsx("input",{value:ce.key,placeholder:"名称",disabled:V,autoComplete:"off",onChange:Ae=>ps(ce.id,{key:Ae.currentTarget.value})}),o.jsx("input",{type:"text",value:ce.value,placeholder:"值",disabled:V,autoComplete:"off",onChange:Ae=>ps(ce.id,{value:Ae.currentTarget.value})}),o.jsx("button",{type:"button",className:"pp-icon-btn pp-env-remove",title:"删除变量",disabled:V,onClick:()=>Rn(ce.id),children:o.jsx(Ti,{className:"pp-ic"})})]},ce.id))]})]}),(V||ie||Object.keys(ve).length>0)&&o.jsxs("section",{className:"pp-config-section pp-progress-section",children:[o.jsx("div",{className:"pp-config-label",children:"部署进度"}),o.jsx("ol",{className:"pp-steps",children:bt.map((ce,Ae)=>{const Re=De?bt.findIndex(kt=>kt.phase===De):-1,Je=!!Le&&(Re===-1?Ae===0:Ae===Re);let st;ie?st="done":Je?st="failed":Re===-1?st=V?"active":"pending":Aece.phase===De))==null?void 0:Nn.label)??De}阶段):`:""}${Le}`,onRetry:js,retryLabel:A?"重试更新":"重试部署"}),ie&&o.jsxs("section",{className:"pp-deploy-result",children:[o.jsx("div",{className:"pp-deploy-result-header",children:A?"更新成功":"部署成功"}),o.jsxs("div",{className:"pp-deploy-result-body",children:[ie.warnings&&ie.warnings.length>0&&o.jsx("div",{className:"pp-deploy-result-warning",role:"status",children:ie.warnings.map(ce=>o.jsx("span",{children:ce},ce))}),ie.region&&o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"区域"}),o.jsx("code",{children:ie.region==="cn-shanghai"?"上海 (cn-shanghai)":"北京 (cn-beijing)"})]}),o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"Agent 名称"}),o.jsx("code",{children:ie.agentName})]}),o.jsxs("div",{className:"pp-deploy-result-field",children:[o.jsx("label",{children:"API 端点"}),o.jsx("code",{className:"pp-deploy-result-url",children:ie.url})]})]}),o.jsxs("div",{className:"pp-deploy-result-actions",children:[o.jsxs("button",{type:"button",className:"pp-deploy-result-btn",onClick:is,disabled:Se,children:[Se?o.jsx(dn,{className:"pp-ic spin"}):o.jsx(wB,{className:"pp-ic"}),Se?"连接中…":"立即对话"]}),ie.consoleUrl&&o.jsxs("a",{href:ie.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"pp-console-link pp-console-link-btn",children:[o.jsx(Em,{className:"pp-ic"}),"控制台"]})]})]})]}),o.jsx("div",{className:`pp-config-actions${Tt?" is-external":""}`,children:Tt?hi.createPortal(o.jsx("button",{type:"button",className:"pp-deploy studio-update-action",onClick:js,disabled:V||de||D||!!n,title:n,children:V?`${f}中…`:Le?`重试${f}`:f}),Tt):o.jsx("button",{type:"button",className:"pp-deploy studio-update-action",onClick:js,disabled:V||de||D||!!n,title:n,children:V?`${f}中…`:Le?`重试${f}`:f})})]})]}),pe&&s&&hi.createPortal(o.jsx("div",{className:"pp-flow-backdrop",onMouseDown:ce=>{ce.target===ce.currentTarget&&we(!1)},children:o.jsxs("section",{className:"pp-flow-dialog",role:"dialog","aria-modal":"true","aria-label":"执行流程预览",children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("strong",{children:"执行流程"}),o.jsx("span",{children:"只读预览,可缩放与拖动画布"})]}),o.jsx("button",{type:"button",onClick:()=>we(!1),"aria-label":"关闭执行流程预览",children:o.jsx(Ti,{"aria-hidden":!0})})]}),o.jsx("div",{className:"pp-flow-dialog-canvas",children:o.jsx(Om,{draft:s,direction:"horizontal",selectedPath:[],onSelect:bl,onAdd:bl,onInsert:bl,onDelete:bl,readOnly:!0,interactivePreview:!0})})]})}),document.body),o.jsx(LAe,{open:q,isUpdate:A,onCancel:ss,onConfirm:()=>void _n()})]})}const G3="dogfooding",Lw="dogfooding",Dw="dogfooding_b";let QAe=0;const Pw=()=>++QAe;function K3(e){return e.blocks.filter(t=>t.kind==="text").map(t=>t.text).join("")}function ZAe(e){const t=e.trim(),n=t.match(/^```(?:json)?\s*\n?([\s\S]*?)\n?```$/i);return(n?n[1]:t).trim()}async function q3(e){const t=[],n=ZAe(e);t.push(n);const s=n.indexOf("{"),i=n.lastIndexOf("}");s>=0&&i>s&&t.push(n.slice(s,i+1));for(const r of t)try{const a=JSON.parse(r);if(a&&typeof a=="object"&&(typeof a.name=="string"||typeof a.instruction=="string"))return await c1(S2(a))}catch{}return null}function JAe({userId:e,onBack:t,onCreate:n,onAgentAdded:s,onDeploymentTaskChange:i}){const[r,a]=g.useState([{id:Pw(),role:"assistant",text:"你好,我是 VeADK 的智能构建助手。用自然语言描述你想要的 Agent,我会直接帮你生成一个可运行的 VeADK 项目,并在右侧实时预览。"}]),[l,c]=g.useState(""),[u,d]=g.useState(!1),[f,h]=g.useState(null),[p,m]=g.useState(null),[b,v]=g.useState(!1),[y,x]=g.useState(null),[E,w]=g.useState(null),[_,S]=g.useState(!1),[k,T]=g.useState(!1),[C,I]=g.useState({}),j=g.useRef(null),L=g.useRef(null),z=g.useRef(null),D=g.useRef(null),F=g.useRef(null);g.useEffect(()=>{const K=D.current;K&&K.scrollTo({top:K.scrollHeight,behavior:"smooth"})},[r,u]),g.useEffect(()=>{const K=F.current;K&&(K.style.height="auto",K.style.height=Math.min(K.scrollHeight,160)+"px")},[l]);const A=K=>a(V=>[...V,{id:Pw(),role:"assistant",text:K}]);async function M(){if(j.current)return j.current;const K=await zy(G3,e);return j.current=K,K}async function P(K,V){if(V.current)return V.current;const W=await zy(K,e);return V.current=W,W}async function H(K,V){if(!C[K])try{const W=await Vk(V);I(q=>({...q,[K]:W.model||V}))}catch{I(W=>({...W,[K]:V}))}}async function R(K,V,W){const q=await P(K,V);let ue=wa();for await(const we of vm({appName:K,userId:e,sessionId:q,text:W}))ue=yf(ue,we);const pe=K3(ue).trim();return{project:await q3(pe),finalText:pe}}const Y=async(K,V,W)=>ug(K.name,K.files,{region:"cn-beijing",projectName:"default"},{...W,onStage:V}),J=async()=>{const K=l.trim();if(!(!K||u)){if(a(V=>[...V,{id:Pw(),role:"user",text:K}]),c(""),h(null),d(!0),b){x(null),w(null),S(!0),T(!0),H("a",Lw),H("b",Dw);const V=R(Lw,L,K).then(({project:q})=>(x(q),q)).catch(q=>{const ue=q instanceof Error?q.message:String(q);return h(ue),null}).finally(()=>S(!1)),W=R(Dw,z,K).then(({project:q})=>(w(q),q)).catch(q=>{const ue=q instanceof Error?q.message:String(q);return h(ue),null}).finally(()=>T(!1));try{const[q,ue]=await Promise.all([V,W]),pe=[q?`方案 A:${q.name}`:null,ue?`方案 B:${ue.name}`:null].filter(Boolean);pe.length?A(`已生成两个方案(${pe.join(",")}),请在右侧对比后采用其一。`):A("(两个方案都没有返回可用的项目,请再描述一下你的需求。)")}finally{d(!1)}return}try{const V=await M();let W=wa();for await(const pe of vm({appName:G3,userId:e,sessionId:V,text:K}))W=yf(W,pe);const q=K3(W).trim(),ue=await q3(q);ue?(m(ue),A(`已生成项目:${ue.name}(${ue.files.length} 个文件),可在右侧预览和编辑。`)):A(q||"(助手没有返回内容,请再描述一下你的需求。)")}catch(V){const W=V instanceof Error?V.message:String(V);h(W),A(`抱歉,调用智能构建助手失败:${W}`)}finally{d(!1)}}},U=K=>{const V=K==="a"?y:E;if(!V)return;m(V),v(!1),x(null),w(null),S(!1),T(!1);const W=K==="a"?"A":"B",q=K==="a"?C.a:C.b;A(`已采用方案 ${W}(${q??(K==="a"?Lw:Dw)}),可继续编辑。`)},te=K=>{K.key==="Enter"&&!K.shiftKey&&!K.nativeEvent.isComposing&&(K.preventDefault(),J())};return o.jsx("div",{className:"ic-root",children:o.jsxs("div",{className:"ic-body",children:[o.jsxs("div",{className:"ic-chat",children:[o.jsxs("div",{className:"ic-transcript",ref:D,children:[o.jsx(Po,{initial:!1,children:r.map(K=>o.jsxs(Jn.div,{className:`ic-turn ic-turn--${K.role}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.22,ease:"easeOut"},children:[K.role==="assistant"&&o.jsx("div",{className:"ic-avatar",children:o.jsx(au,{className:"ic-avatar-icon"})}),o.jsx("div",{className:"ic-bubble",children:K.role==="assistant"?o.jsx(oh,{text:K.text}):K.text})]},K.id))}),u&&o.jsxs(Jn.div,{className:"ic-turn ic-turn--assistant",initial:{opacity:0,y:8},animate:{opacity:1,y:0},children:[o.jsx("div",{className:"ic-avatar",children:o.jsx(au,{className:"ic-avatar-icon"})}),o.jsxs("div",{className:"ic-bubble ic-bubble--typing",children:[o.jsx("span",{className:"ic-dot"}),o.jsx("span",{className:"ic-dot"}),o.jsx("span",{className:"ic-dot"})]})]})]}),f&&o.jsxs("div",{className:"ic-error",children:[o.jsx(kk,{className:"ic-error-icon"}),f]}),o.jsxs("div",{className:"ic-composer",children:[o.jsxs("div",{className:"ic-composer-box",children:[o.jsx("textarea",{ref:F,className:"ic-input",rows:1,placeholder:"描述你想要的 Agent,例如「一个帮我整理周报的写作助手」…",value:l,onChange:K=>c(K.target.value),onKeyDown:te,disabled:u}),o.jsx("button",{className:"ic-send",onClick:()=>void J(),disabled:!l.trim()||u,title:"发送 (Enter)",children:o.jsx(jee,{className:"ic-send-icon"})})]}),o.jsxs("div",{className:"ic-composer-foot",children:[o.jsxs("label",{className:"ic-ab-toggle",title:"同时用两个模型生成方案进行对比",children:[o.jsx("input",{type:"checkbox",className:"ic-ab-checkbox",checked:b,disabled:u,onChange:K=>v(K.target.checked)}),o.jsx("span",{className:"ic-ab-track",children:o.jsx("span",{className:"ic-ab-thumb"})}),o.jsx("span",{className:"ic-ab-label",children:"A/B 对比"})]}),o.jsx("div",{className:"ic-composer-hint",children:"Enter 发送 · Shift+Enter 换行"})]})]})]}),o.jsx("aside",{className:"ic-preview",children:b?o.jsxs("div",{className:"ic-compare",children:[o.jsx(Y3,{side:"a",project:y,loading:_,model:C.a,onAdopt:()=>U("a")}),o.jsx("div",{className:"ic-compare-divider"}),o.jsx(Y3,{side:"b",project:E,loading:k,model:C.b,onAdopt:()=>U("b")})]}):p?o.jsx(eE,{project:p,onChange:m,onDeploy:Y,onAgentAdded:s,onDeploymentTaskChange:i,deploymentTelemetrySource:"intelligent_create"}):o.jsxs("div",{className:"ic-preview-empty",children:[o.jsxs("div",{className:"ic-preview-empty-icon",children:[o.jsx(cee,{className:"ic-preview-empty-glyph"}),o.jsx(ou,{className:"ic-preview-empty-spark"})]}),o.jsx("div",{className:"ic-preview-empty-title",children:"还没有项目"}),o.jsx("div",{className:"ic-preview-empty-sub",children:"描述你的需求,我会帮你生成 VeADK 项目"})]})})]})})}function Y3({side:e,project:t,loading:n,model:s,onAdopt:i}){const r=e==="a"?"方案 A":"方案 B";return o.jsxs("div",{className:"ic-pane",children:[o.jsxs("div",{className:"ic-pane-head",children:[o.jsxs("div",{className:"ic-pane-title",children:[o.jsx("span",{className:`ic-pane-tag ic-pane-tag--${e}`,children:r}),s&&o.jsx("span",{className:"ic-pane-model",children:s})]}),o.jsxs("button",{className:"ic-adopt",onClick:i,disabled:!t||n,title:`采用${r}`,children:["采用",e==="a"?"方案 A":"方案 B"]})]}),o.jsx("div",{className:"ic-pane-body",children:n?o.jsxs("div",{className:"ic-pane-loading",children:[o.jsx(dn,{className:"ic-pane-spinner"}),o.jsx("span",{children:"正在生成…"})]}):t?o.jsx(eE,{project:t}):o.jsx("div",{className:"ic-pane-empty",children:"该方案未返回可用项目"})})]})}var e2e=Object.defineProperty,T2=(e,t)=>e2e(e,"name",{value:t,configurable:!0});function NN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}T2(NN,"setRef");function Nz(...e){return t=>{let n=!1;const s=e.map(i=>{const r=NN(i,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let i=0;it2e(e,"name",{value:t,configurable:!0});function Pf(e){const t=g.forwardRef((n,s)=>{let{children:i,...r}=n,a=null,l=!1;const c=[];TN(i)&&typeof ob=="function"&&(i=ob(i._payload)),g.Children.forEach(i,h=>{var p;if(Cz(h)){l=!0;const m=h;let b="child"in m.props?m.props.child:m.props.children;TN(b)&&typeof ob=="function"&&(b=ob(b._payload)),a=s2e(m,b),c.push((p=a==null?void 0:a.props)==null?void 0:p.children)}else c.push(h)}),a?a=g.cloneElement(a,void 0,c):!l&&g.Children.count(i)===1&&g.isValidElement(i)&&(a=i);const u=a?Az(a):void 0,d=lr(s,u);if(!a){if(i||i===0)throw new Error(l?a2e(e):r2e(e));return i}const f=kz(r,a.props??{});return a.type!==g.Fragment&&(f.ref=s?d:u),g.cloneElement(a,f)});return t.displayName=`${e}.Slot`,t}La(Pf,"createSlot");var Tz=Symbol.for("radix.slottable");function n2e(e){const t=La(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=Tz,t}La(n2e,"createSlottable");var s2e=La((e,t)=>{if("child"in e.props){const n=e.props.child;return g.isValidElement(n)?g.cloneElement(n,void 0,e.props.children(n.props.children)):null}return g.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function kz(e,t){const n={...t};for(const s in t){const i=e[s],r=t[s];/^on[A-Z]/.test(s)?i&&r?n[s]=(...l)=>{const c=r(...l);return i(...l),c}:i&&(n[s]=i):s==="style"?n[s]={...i,...r}:s==="className"&&(n[s]=[i,r].filter(Boolean).join(" "))}return{...e,...n}}La(kz,"mergeProps");function Az(e){var s,i;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}La(Az,"getElementRef");function Cz(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Tz}La(Cz,"isSlottable");var i2e=Symbol.for("react.lazy");function TN(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===i2e&&"_payload"in e&&Iz(e._payload)}La(TN,"isLazyComponent");function Iz(e){return typeof e=="object"&&e!==null&&"then"in e}La(Iz,"isPromiseLike");var r2e=La(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),a2e=La(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),ob=Ff[" use ".trim().toString()],o2e=Object.defineProperty,l2e=(e,t)=>o2e(e,"name",{value:t,configurable:!0}),c2e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],sa=c2e.reduce((e,t)=>{const n=Pf(`Primitive.${t}`),s=g.forwardRef((i,r)=>{const{asChild:a,...l}=i,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:r})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function u2e(e,t){e&&hi.flushSync(()=>e.dispatchEvent(t))}l2e(u2e,"dispatchDiscreteCustomEvent");var d2e=Object.defineProperty,Qr=(e,t)=>d2e(e,"name",{value:t,configurable:!0});function f2e(e,t){const n=g.createContext(t);n.displayName=e+"Context";const s=Qr(r=>{const{children:a,...l}=r,c=g.useMemo(()=>l,Object.values(l));return o.jsx(n.Provider,{value:c,children:a})},"Provider");s.displayName=e+"Provider";function i(r,a={}){const{optional:l=!1}=a,c=g.useContext(n);if(c)return c;if(t!==void 0)return t;if(!l)throw new Error(`\`${r}\` must be used within \`${e}\``)}return Qr(i,"useContext"),[s,i]}Qr(f2e,"createContext");function hc(e,t=[]){let n=[];function s(r,a){const l=g.createContext(a);l.displayName=r+"Context";const c=n.length;n=[...n,a];const u=Qr(f=>{var y;const{scope:h,children:p,...m}=f,b=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=g.useMemo(()=>m,Object.values(m));return o.jsx(b.Provider,{value:v,children:p})},"Provider");u.displayName=r+"Provider";function d(f,h,p={}){var y;const{optional:m=!1}=p,b=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,v=g.useContext(b);if(v)return v;if(a!==void 0)return a;if(!m)throw new Error(`\`${f}\` must be used within \`${r}\``)}return Qr(d,"useContext"),[u,d]}Qr(s,"createContext");const i=Qr(()=>{const r=n.map(a=>g.createContext(a));return Qr(function(l){const c=(l==null?void 0:l[e])||r;return g.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])},"useScope")},"createScope");return i.scopeName=e,[s,jz(i,...t)]}Qr(hc,"createContextScope");function jz(...e){const t=e[0];if(e.length===1)return t;const n=Qr(()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return Qr(function(r){const a=s.reduce((l,{useScope:c,scopeName:u})=>{const f=c(r)[`__scope${u}`];return{...l,...f}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Qr(jz,"composeContextScopes");var h2e=Object.defineProperty,ui=(e,t)=>h2e(e,"name",{value:t,configurable:!0});function Rz(e){const t=e+"CollectionProvider",[n,s]=hc(t),[i,r]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=ui(b=>{const{scope:v,children:y}=b,x=g.useRef(null),E=g.useRef(new Map).current;return o.jsx(i,{scope:v,itemMap:E,collectionRef:x,children:y})},"CollectionProvider");a.displayName=t;const l=e+"CollectionSlot",c=Pf(l),u=g.forwardRef((b,v)=>{const{scope:y,children:x}=b,E=r(l,y),w=lr(v,E.collectionRef);return o.jsx(c,{ref:w,children:x})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=Pf(d),p=g.forwardRef((b,v)=>{const{scope:y,children:x,...E}=b,w=g.useRef(null),_=lr(v,w),S=r(d,y);return g.useEffect(()=>(S.itemMap.set(w,{ref:w,...E}),()=>void S.itemMap.delete(w))),o.jsx(h,{[f]:"",ref:_,children:x})});p.displayName=d;function m(b){const v=r(e+"CollectionConsumer",b);return g.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const E=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((S,k)=>E.indexOf(S.ref.current)-E.indexOf(k.ref.current))},[v.collectionRef,v.itemMap])}return ui(m,"useCollection"),[{Provider:a,Slot:u,ItemSlot:p},m,s]}ui(Rz,"createCollection");var W3=new WeakMap,Gs,yr,Bw=(yr=class extends Map{constructor(n){super(n);kC(this,Gs);LE(this,Gs,[...super.keys()]),W3.set(this,!0)}set(n,s){return W3.get(this)&&(this.has(n)?Ii(this,Gs)[Ii(this,Gs).indexOf(n)]=n:Ii(this,Gs).push(n)),super.set(n,s),this}insert(n,s,i){const r=this.has(s),a=Ii(this,Gs).length,l=k2(n);let c=l>=0?l:a+l;const u=c<0||c>=a?-1:c;if(u===this.size||r&&u===this.size-1||u===-1)return this.set(s,i),this;const d=this.size+(r?0:1);l<0&&c++;const f=[...Ii(this,Gs)];let h,p=!1;for(let m=c;m=this.size&&(r=this.size-1),this.at(r)}keyFrom(n,s){const i=this.indexOf(n);if(i===-1)return;let r=i+s;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(n,s){let i=0;for(const r of this){if(Reflect.apply(n,s,[r,i,this]))return r;i++}}findIndex(n,s){let i=0;for(const r of this){if(Reflect.apply(n,s,[r,i,this]))return i;i++}return-1}filter(n,s){const i=[];let r=0;for(const a of this)Reflect.apply(n,s,[a,r,this])&&i.push(a),r++;return new yr(i)}map(n,s){const i=[];let r=0;for(const a of this)i.push([a[0],Reflect.apply(n,s,[a,r,this])]),r++;return new yr(i)}reduce(...n){const[s,i]=n;let r=0,a=i??this.at(0);for(const l of this)r===0&&n.length===1?a=l:a=Reflect.apply(s,this,[a,l,r,this]),r++;return a}reduceRight(...n){const[s,i]=n;let r=i??this.at(-1);for(let a=this.size-1;a>=0;a--){const l=this.at(a);a===this.size-1&&n.length===1?r=l:r=Reflect.apply(s,this,[r,l,a,this])}return r}toSorted(n){const s=[...this.entries()].sort(n);return new yr(s)}toReversed(){const n=new yr;for(let s=this.size-1;s>=0;s--){const i=this.keyAt(s),r=this.get(i);n.set(i,r)}return n}toSpliced(...n){const s=[...this.entries()];return s.splice(...n),new yr(s)}slice(n,s){const i=new yr;let r=this.size-1;if(n===void 0)return i;n<0&&(n=n+this.size),s!==void 0&&s>0&&(r=s-1);for(let a=n;a<=r;a++){const l=this.keyAt(a),c=this.get(l);i.set(l,c)}return i}every(n,s){let i=0;for(const r of this){if(!Reflect.apply(n,s,[r,i,this]))return!1;i++}return!0}some(n,s){let i=0;for(const r of this){if(Reflect.apply(n,s,[r,i,this]))return!0;i++}return!1}},Gs=new WeakMap,ui(yr,"OrderedDict"),yr);function ey(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=Oz(e,t);return n===-1?void 0:e[n]}ui(ey,"at");function Oz(e,t){const n=e.length,s=k2(t),i=s>=0?s:n+s;return i<0||i>=n?-1:i}ui(Oz,"toSafeIndex");function k2(e){return e!==e||e===0?0:Math.trunc(e)}ui(k2,"toSafeInteger");function p2e(e){const t=e+"CollectionProvider",[n,s]=hc(t),[i,r]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Bw,setItemMap:ui(()=>{},"setItemMap")}),a=ui(({state:E,...w})=>E?o.jsx(c,{...w,state:E}):o.jsx(l,{...w}),"CollectionProvider");a.displayName=t;const l=ui(E=>{const w=v();return o.jsx(c,{...E,state:w})},"CollectionInit");l.displayName=t+"Init";const c=ui(E=>{const{scope:w,children:_,state:S}=E,k=g.useRef(null),[T,C]=g.useState(null),I=lr(k,C),[j,L]=S;return g.useEffect(()=>{if(!T)return;const z=Dz(()=>{});return z.observe(T,{childList:!0,subtree:!0}),()=>{z.disconnect()}},[T]),o.jsx(i,{scope:w,itemMap:j,setItemMap:L,collectionRef:I,collectionRefObject:k,collectionElement:T,children:_})},"CollectionProviderImpl");c.displayName=t+"Impl";const u=e+"CollectionSlot",d=Pf(u),f=g.forwardRef((E,w)=>{const{scope:_,children:S}=E,k=r(u,_),T=lr(w,k.collectionRef);return o.jsx(d,{ref:T,children:S})});f.displayName=u;const h=e+"CollectionItemSlot",p="data-radix-collection-item",m=Pf(h),b=g.forwardRef((E,w)=>{const{scope:_,children:S,...k}=E,T=g.useRef(null),[C,I]=g.useState(null),j=lr(w,T,I),L=r(h,_),{setItemMap:z}=L,D=g.useRef(k);Mz(D.current,k)||(D.current=k);const F=D.current;return g.useEffect(()=>{const A=F;return z(M=>C?M.has(C)?M.set(C,{...A,element:C}).toSorted(kN):(M.set(C,{...A,element:C}),M.toSorted(kN)):M),()=>{z(M=>!C||!M.has(C)?M:(M.delete(C),new Bw(M)))}},[C,F,z]),o.jsx(m,{[p]:"",ref:j,children:S})});b.displayName=h;function v(){return g.useState(new Bw)}ui(v,"useInitCollection");function y(E){const{itemMap:w}=r(e+"CollectionConsumer",E);return w}return ui(y,"useCollection"),[{Provider:a,Slot:f,ItemSlot:b},{createCollectionScope:s,useCollection:y,useInitCollection:v}]}ui(p2e,"createCollection");function Mz(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||e[i]!==t[i])return!1;return!0}ui(Mz,"shallowEqual");function Lz(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}ui(Lz,"isElementPreceding");function kN(e,t){return!e[1].element||!t[1].element?0:Lz(e[1].element,t[1].element)?-1:1}ui(kN,"sortByDocumentPosition");function Dz(e){return new MutationObserver(n=>{for(const s of n)if(s.type==="childList"){e();return}})}ui(Dz,"getChildListObserver");var m2e=Object.defineProperty,mh=(e,t)=>m2e(e,"name",{value:t,configurable:!0}),Pz=!!(typeof window<"u"&&window.document&&window.document.createElement);function qi(e,t,{checkForDefaultPrevented:n=!0}={}){return mh(function(i){if(e==null||e(i),n===!1||!i||!i.defaultPrevented)return t==null?void 0:t(i)},"handleEvent")}mh(qi,"composeEventHandlers");function g2e(e){var t;if(!Pz)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}mh(g2e,"getOwnerWindow");function AN(e){if(!Pz)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}mh(AN,"getOwnerDocument");function Bz(e,t=!1){const{activeElement:n}=AN(e);if(!(n!=null&&n.nodeName))return null;if(Uz(n)&&n.contentDocument)return Bz(n.contentDocument.body,t);if(t){const s=n.getAttribute("aria-activedescendant");if(s){const i=AN(n).getElementById(s);if(i)return i}}return n}mh(Bz,"getActiveElement");function Uz(e){return e.tagName==="IFRAME"}mh(Uz,"isFrame");var gu=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},b2e=Object.defineProperty,y2e=(e,t)=>b2e(e,"name",{value:t,configurable:!0}),X3=Ff[" useEffectEvent ".trim().toString()],Q3=Ff[" useInsertionEffect ".trim().toString()];function Fz(e){if(typeof X3=="function")return X3(e);const t=g.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Q3=="function"?Q3(()=>{t.current=e}):gu(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}y2e(Fz,"useEffectEvent");var x2e=Object.defineProperty,Mg=(e,t)=>x2e(e,"name",{value:t,configurable:!0}),E2e=Ff[" useInsertionEffect ".trim().toString()]||gu;function ju({prop:e,defaultProp:t,onChange:n=Mg(()=>{},"onChange"),caller:s}){const[i,r,a]=$z({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:i,u=g.useCallback(d=>{var f;if(l){const h=Hz(d)?d(e):d;h!==e&&((f=a.current)==null||f.call(a,h))}else r(d)},[l,e,r,a]);return[c,u]}Mg(ju,"useControllableState");function $z({defaultProp:e,onChange:t}){const[n,s]=g.useState(e),i=g.useRef(n),r=g.useRef(t);return E2e(()=>{r.current=t},[t]),g.useEffect(()=>{var a;i.current!==n&&((a=r.current)==null||a.call(r,n),i.current=n)},[n,i]),[n,s,r]}Mg($z,"useUncontrolledState");function Hz(e){return typeof e=="function"}Mg(Hz,"isFunction");var Z3=Symbol("RADIX:SYNC_STATE");function v2e(e,t,n,s){const{prop:i,defaultProp:r,onChange:a,caller:l}=t,c=i!==void 0,u=Fz(a),d=[{...n,state:r}];s&&d.push(s);const[f,h]=g.useReducer((v,y)=>{if(y.type===Z3)return{...v,state:y.state};const x=e(v,y);return c&&!Object.is(x.state,v.state)&&u(x.state),x},...d),p=f.state,m=g.useRef(p);g.useEffect(()=>{m.current!==p&&(m.current=p,c||u(p))},[p,m,c]);const b=g.useMemo(()=>i!==void 0?{...f,state:i}:f,[f,i]);return g.useEffect(()=>{c&&!Object.is(i,f.state)&&h({type:Z3,state:i})},[i,f.state,c]),[b,h]}Mg(v2e,"useControllableStateReducer");var w2e=Object.defineProperty,tl=(e,t)=>w2e(e,"name",{value:t,configurable:!0});function zz(e,t){return g.useReducer((n,s)=>t[n][s]??n,e)}tl(zz,"useStateMachine");var Vz=tl(e=>{const{present:t,children:n}=e,s=Gz(t),i=typeof n=="function"?n({present:s.isPresent}):g.Children.only(n),r=Kz(s.ref,qz(i));return typeof n=="function"||s.isPresent?g.cloneElement(i,{ref:r}):null},"Presence");function Gz(e){const[t,n]=g.useState(),s=g.useRef(null),i=g.useRef(e),r=g.useRef("none"),a=g.useRef(void 0),l=e?"mounted":"unmounted",[c,u]=zz(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{c==="mounted"?(r.current=a.current??fd(s.current),a.current=void 0):r.current="none"},[c]),gu(()=>{const d=s.current,f=i.current;if(f!==e){const p=r.current,m=fd(d);e?(a.current=m,u("MOUNT")):m==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(f&&p!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),gu(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=tl(m=>{const v=fd(s.current).includes(CSS.escape(m.animationName));if(m.target===t&&v&&(u("ANIMATION_END"),!i.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},"handleAnimationEnd"),p=tl(m=>{m.target===t&&(r.current=fd(s.current))},"handleAnimationStart");return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:g.useCallback(d=>{if(d){const f=getComputedStyle(d);s.current=f,a.current=fd(f)}else s.current=null;n(d)},[])}}tl(Gz,"usePresence");function CN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}tl(CN,"setRef");function Kz(...e){const t=g.useRef(e);return t.current=e,g.useCallback(n=>{const s=t.current;let i=!1;const r=s.map(a=>{const l=CN(a,n);return!i&&typeof l=="function"&&(i=!0),l});if(i)return()=>{for(let a=0;aS2e(e,"name",{value:t,configurable:!0}),N2e=Ff[" useId ".trim().toString()]||(()=>{}),T2e=0;function Yz(e){const[t,n]=g.useState(N2e());return gu(()=>{e||n(s=>s??String(T2e++))},[e]),e||(t?`radix-${t}`:"")}_2e(Yz,"useId");var k2e=Object.defineProperty,A2e=(e,t)=>k2e(e,"name",{value:t,configurable:!0}),C2e=g.createContext(void 0);function tE(e){const t=g.useContext(C2e);return e||t||"ltr"}A2e(tE,"useDirection");var I2e=Object.defineProperty,j2e=(e,t)=>I2e(e,"name",{value:t,configurable:!0});function Wz(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}j2e(Wz,"useCallbackRef");var R2e=Object.defineProperty,O2e=(e,t)=>R2e(e,"name",{value:t,configurable:!0});function A2(e){const[t,n]=g.useState(void 0);return gu(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const r=i[0];let a,l;if("borderBoxSize"in r){const c=r.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}O2e(A2,"useSize");var M2e=Object.defineProperty,nl=(e,t)=>M2e(e,"name",{value:t,configurable:!0}),C2="Checkbox",[L2e,SMe]=hc(C2),[D2e,I2]=L2e(C2);function Xz(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:i,disabled:r,form:a,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,p]=ju({prop:n,defaultProp:i??!1,onChange:c,caller:C2}),[m,b]=g.useState(null),[v,y]=g.useState(null),x=g.useRef(!1),[E,w]=g.useReducer(k=>k+1,0),_=m?!!a||!!m.closest("form"):!0,S={checked:h,disabled:r,setChecked:p,control:m,setControl:b,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:x,userInteractionCount:E,onUserInteraction:w,required:u,defaultChecked:Ko(i)?!1:i,isFormControl:_,bubbleInput:v,setBubbleInput:y};return o.jsx(D2e,{scope:t,...S,children:Qz(f)?f(S):s})}nl(Xz,"CheckboxProvider");var P2e="CheckboxTrigger",B2e=g.forwardRef(nl(function({__scopeCheckbox:t,onKeyDown:n,onClick:s,...i},r){const{control:a,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:p,onUserInteraction:m,isFormControl:b,bubbleInput:v}=I2(P2e,t),y=lr(r,f),x=g.useRef(u);return g.useEffect(()=>{const E=a==null?void 0:a.form;if(E){const w=nl(()=>h(x.current),"reset");return E.addEventListener("reset",w),()=>E.removeEventListener("reset",w)}},[a,h]),o.jsx(sa.button,{type:"button",role:"checkbox","aria-checked":Ko(u)?"mixed":u,"aria-required":d,"data-state":j2(u),"data-disabled":c?"":void 0,disabled:c,value:l,...i,ref:y,onKeyDown:qi(n,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:qi(s,E=>{m(),h(w=>Ko(w)?!0:!w),v&&b&&(p.current=E.isPropagationStopped(),p.current||E.stopPropagation())})})},"CheckboxTrigger")),U2e=g.forwardRef(nl(function(t,n){const{__scopeCheckbox:s,name:i,checked:r,defaultChecked:a,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return o.jsx(Xz,{__scopeCheckbox:s,checked:r,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:i,form:f,value:u,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(B2e,{...h,ref:n,__scopeCheckbox:s}),p&&o.jsx(z2e,{__scopeCheckbox:s})]})})},"Checkbox")),F2e="CheckboxIndicator",$2e=g.forwardRef(nl(function(t,n){const{__scopeCheckbox:s,forceMount:i,...r}=t,a=I2(F2e,s);return o.jsx(Vz,{present:i||Ko(a.checked)||a.checked===!0,children:o.jsx(sa.span,{"data-state":j2(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:n,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),H2e="CheckboxBubbleInput",z2e=g.forwardRef(nl(function({__scopeCheckbox:t,onClick:n,...s},i){const{control:r,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:p,form:m,bubbleInput:b,setBubbleInput:v}=I2(H2e,t),y=lr(i,v),x=A2(r),E=g.useRef(!1),w=g.useRef(c),_=g.useRef(l);g.useEffect(()=>{const k=b;if(!k)return;const T=window.HTMLInputElement.prototype,I=Object.getOwnPropertyDescriptor(T,"checked").set,j=l!==_.current;_.current=l;const L=w.current!==c;w.current=c;const z=!(j&&a.current);if(L&&I){E.current=!j;const D=new Event("click",{bubbles:z});k.indeterminate=Ko(c),I.call(k,Ko(c)?!1:c),k.dispatchEvent(D),E.current=!1}},[b,c,a,l]);const S=g.useRef(Ko(c)?!1:c);return o.jsx(sa.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??S.current,required:d,disabled:f,name:h,value:p,form:m,...s,tabIndex:-1,ref:y,onClick:qi(n,k=>{E.current&&k.stopPropagation()}),style:{...s.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function Qz(e){return typeof e=="function"}nl(Qz,"isFunction");function Ko(e){return e==="indeterminate"}nl(Ko,"isIndeterminate");function j2(e){return Ko(e)?"indeterminate":e?"checked":"unchecked"}nl(j2,"getState");var V2e=Object.defineProperty,R2=(e,t)=>V2e(e,"name",{value:t,configurable:!0}),Uw=!1;function Zz(){const[e,t]=g.useState(Uw);return g.useEffect(()=>{Uw||(Uw=!0,t(!0))},[]),e}R2(Zz,"useIsHydrated");var Jz=Ff[" useSyncExternalStore ".trim().toString()];function eV(){return()=>{}}R2(eV,"subscribe");function tV(){return Jz(eV,()=>!0,()=>!1)}R2(tV,"useIsHydratedModern");var G2e=typeof Jz=="function"?tV:Zz,K2e=Object.defineProperty,Ru=(e,t)=>K2e(e,"name",{value:t,configurable:!0}),Fw="rovingFocusGroup.onEntryFocus",q2e={bubbles:!1,cancelable:!0},nE="RovingFocusGroup",[IN,nV,Y2e]=Rz(nE),[W2e,sE]=hc(nE,[Y2e]),[X2e,Q2e]=W2e(nE),Z2e=g.forwardRef(Ru(function(t,n){return o.jsx(IN.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(IN.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(J2e,{...t,ref:n})})})},"RovingFocusGroup")),J2e=g.forwardRef(Ru(function(t,n){const{__scopeRovingFocusGroup:s,orientation:i,loop:r=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=t,p=g.useRef(null),m=lr(n,p),b=tE(a),[v,y]=ju({prop:l,defaultProp:c??null,onChange:u,caller:nE}),[x,E]=g.useState(!1),w=Wz(d),_=nV(s),S=g.useRef(!1),[k,T]=g.useState(0);return g.useEffect(()=>{const C=p.current;if(C)return C.addEventListener(Fw,w),()=>C.removeEventListener(Fw,w)},[w]),o.jsx(X2e,{scope:s,orientation:i,dir:b,loop:r,currentTabStopId:v,onItemFocus:g.useCallback(C=>y(C),[y]),onItemShiftTab:g.useCallback(()=>E(!0),[]),onFocusableItemAdd:g.useCallback(()=>T(C=>C+1),[]),onFocusableItemRemove:g.useCallback(()=>T(C=>C-1),[]),children:o.jsx(sa.div,{tabIndex:x||k===0?-1:0,"data-orientation":i,...h,ref:m,style:{outline:"none",...t.style},onMouseDown:qi(t.onMouseDown,()=>{S.current=!0}),onFocus:qi(t.onFocus,C=>{const I=!S.current;if(C.target===C.currentTarget&&I&&!x){const j=new CustomEvent(Fw,q2e);if(C.currentTarget.dispatchEvent(j),!j.defaultPrevented){const L=_().filter(M=>M.focusable),z=L.find(M=>M.active),D=L.find(M=>M.id===v),A=[z,D,...L].filter(Boolean).map(M=>M.ref.current);O2(A,f)}}S.current=!1}),onBlur:qi(t.onBlur,()=>E(!1))})})},"RovingFocusGroupImpl")),eCe="RovingFocusGroupItem",tCe=g.forwardRef(Ru(function(t,n){const{__scopeRovingFocusGroup:s,focusable:i=!0,active:r=!1,tabStopId:a,children:l,...c}=t,u=Yz(),d=a||u,f=Q2e(eCe,s),h=f.currentTabStopId===d,p=nV(s),{onFocusableItemAdd:m,onFocusableItemRemove:b,currentTabStopId:v}=f,y=G2e();return gu(()=>{if(!(!y||!i))return m(),()=>b()},[y,i,m,b]),g.useEffect(()=>{if(!(y||!i))return m(),()=>b()},[y,i,m,b]),o.jsx(IN.ItemSlot,{scope:s,id:d,focusable:i,active:r,children:o.jsx(sa.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...c,ref:n,onMouseDown:qi(t.onMouseDown,x=>{i?f.onItemFocus(d):x.preventDefault()}),onFocus:qi(t.onFocus,()=>f.onItemFocus(d)),onKeyDown:qi(t.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const E=iV(x,f.orientation,f.dir);if(E!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let _=p().filter(S=>S.focusable).map(S=>S.ref.current);if(E==="last")_.reverse();else if(E==="prev"||E==="next"){E==="prev"&&_.reverse();const S=_.indexOf(x.currentTarget);_=f.loop?rV(_,S+1):_.slice(S+1)}setTimeout(()=>O2(_))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:v!=null}):l})})},"RovingFocusGroupItem")),nCe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function sV(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Ru(sV,"getDirectionAwareKey");function iV(e,t,n){const s=sV(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return nCe[s]}Ru(iV,"getFocusIntent");function O2(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}Ru(O2,"focusFirst");function rV(e,t){return e.map((n,s)=>e[(t+s)%e.length])}Ru(rV,"wrapArray");var aV=Z2e,oV=tCe,sCe=Object.defineProperty,Li=(e,t)=>sCe(e,"name",{value:t,configurable:!0}),lV="Radio",[iCe,cV]=hc(lV),[rCe,iE]=iCe(lV);function uV(e){const{__scopeRadio:t,checked:n=!1,children:s,disabled:i,form:r,name:a,onCheck:l,required:c,value:u="on",internal_do_not_use_render:d}=e,[f,h]=g.useState(null),[p,m]=g.useState(null),b=g.useRef(!1),[v,y]=g.useReducer(w=>w+1,0),x=f?!!r||!!f.closest("form"):!0,E={checked:n,disabled:i,required:c,name:a,form:r,value:u,control:f,setControl:h,hasConsumerStoppedPropagationRef:b,userInteractionCount:v,onUserInteraction:y,isFormControl:x,bubbleInput:p,setBubbleInput:m,onCheck:Li(()=>l==null?void 0:l(),"onCheck")};return o.jsx(rCe,{scope:t,...E,children:dV(d)?d(E):s})}Li(uV,"RadioProvider");var aCe="RadioTrigger",oCe=g.forwardRef(Li(function({__scopeRadio:t,onClick:n,...s},i){const{checked:r,disabled:a,value:l,setControl:c,onCheck:u,hasConsumerStoppedPropagationRef:d,onUserInteraction:f,isFormControl:h,bubbleInput:p}=iE(aCe,t),m=lr(i,c);return o.jsx(sa.button,{type:"button",role:"radio","aria-checked":r,"data-state":M2(r),"data-disabled":a?"":void 0,disabled:a,value:l,...s,ref:m,onClick:qi(n,b=>{r||(f(),u()),p&&h&&(d.current=b.isPropagationStopped(),d.current||b.stopPropagation())})})},"RadioTrigger")),lCe="RadioIndicator",cCe=g.forwardRef(Li(function(t,n){const{__scopeRadio:s,forceMount:i,...r}=t,a=iE(lCe,s);return o.jsx(Vz,{present:i||a.checked,children:o.jsx(sa.span,{"data-state":M2(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:n})})},"RadioIndicator")),uCe="RadioBubbleInput",dCe=g.forwardRef(Li(function({__scopeRadio:t,onClick:n,...s},i){const{control:r,checked:a,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:h,setBubbleInput:p,hasConsumerStoppedPropagationRef:m,userInteractionCount:b}=iE(uCe,t),v=lr(i,p),y=A2(r),x=g.useRef(!1),E=g.useRef(a),w=g.useRef(b);g.useEffect(()=>{const S=h;if(!S)return;const k=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(k,"checked").set,I=b!==w.current;w.current=b;const j=E.current!==a;E.current=a;const L=!(I&&m.current);if(j&&C){x.current=!I;const z=new Event("click",{bubbles:L});C.call(S,a),S.dispatchEvent(z),x.current=!1}},[h,a,m,b]);const _=g.useRef(a);return o.jsx(sa.input,{type:"radio","aria-hidden":!0,defaultChecked:_.current,required:l,disabled:c,name:u,value:d,form:f,...s,tabIndex:-1,ref:v,onClick:qi(n,S=>{x.current&&S.stopPropagation()}),style:{...s.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function dV(e){return typeof e=="function"}Li(dV,"isFunction");function M2(e){return e?"checked":"unchecked"}Li(M2,"getState");var fCe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],L2="RadioGroup",[hCe,_Me]=hc(L2,[sE,cV]),fV=sE(),rE=cV(),[pCe,mCe]=hCe(L2),gCe=g.forwardRef(Li(function(t,n){const{__scopeRadioGroup:s,name:i,form:r,defaultValue:a,value:l,required:c=!1,disabled:u=!1,orientation:d,dir:f,loop:h=!0,onValueChange:p,...m}=t,b=fV(s),v=tE(f),[y,x]=ju({prop:l,defaultProp:a??null,onChange:p,caller:L2}),[E,w]=g.useState(null),_=lr(n,w),S=g.useRef(y);return g.useEffect(()=>{const k=r?E==null?void 0:E.ownerDocument.getElementById(r):E==null?void 0:E.closest("form");if(k instanceof HTMLFormElement){const T=Li(()=>x(S.current),"reset");return k.addEventListener("reset",T),()=>k.removeEventListener("reset",T)}},[E,r,x]),o.jsx(pCe,{scope:s,name:i,form:r,required:c,disabled:u,value:y,onValueChange:x,children:o.jsx(aV,{asChild:!0,...b,orientation:d,dir:v,loop:h,children:o.jsx(sa.div,{role:"radiogroup","aria-required":c,"aria-orientation":d,"data-disabled":u?"":void 0,dir:v,...m,ref:_})})})},"RadioGroup")),bCe="RadioGroupItemProvider",yCe="RadioGroupItemTrigger";function hV(e){const{__scopeRadioGroup:t,value:n,disabled:s,children:i,internal_do_not_use_render:r}=e,a=mCe(bCe,t),l=rE(t),c=a.disabled||s;return o.jsx(uV,{...l,checked:a.value===n,disabled:c,required:a.required,name:a.name,form:a.form,value:n,onCheck:()=>a.onValueChange(n),internal_do_not_use_render:r,children:i})}Li(hV,"RadioGroupItemProvider");var xCe=g.forwardRef(Li(function(t,n){const{__scopeRadioGroup:s,...i}=t,r=fV(s),a=rE(s),{checked:l,disabled:c}=iE(yCe,a.__scopeRadio),u=g.useRef(null),d=lr(n,u),f=g.useRef(!1);return g.useEffect(()=>{const h=Li(m=>{fCe.includes(m.key)&&(f.current=!0)},"handleKeyDown"),p=Li(()=>f.current=!1,"handleKeyUp");return document.addEventListener("keydown",h),document.addEventListener("keyup",p),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",p)}},[]),o.jsx(oV,{asChild:!0,...r,focusable:!c,active:l,children:o.jsx(oCe,{...a,...i,ref:d,onKeyDown:qi(i.onKeyDown,h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:qi(i.onFocus,()=>{var h;f.current&&((h=u.current)==null||h.click())})})})},"RadioGroupItemTrigger")),ECe=g.forwardRef(Li(function(t,n){const{__scopeRadioGroup:s,value:i,disabled:r,...a}=t;return o.jsx(hV,{__scopeRadioGroup:s,value:i,disabled:r,internal_do_not_use_render:({isFormControl:l})=>o.jsxs(o.Fragment,{children:[o.jsx(xCe,{...a,ref:n,__scopeRadioGroup:s}),l&&o.jsx(vCe,{__scopeRadioGroup:s})]})})},"RadioGroupItem")),vCe=g.forwardRef(Li(function(t,n){const{__scopeRadioGroup:s,...i}=t,r=rE(s);return o.jsx(dCe,{...r,...i,ref:n})},"RadioGroupItemBubbleInput")),wCe=g.forwardRef(Li(function(t,n){const{__scopeRadioGroup:s,...i}=t,r=rE(s);return o.jsx(cCe,{...r,...i,ref:n})},"RadioGroupIndicator")),SCe=Object.defineProperty,_Ce=(e,t)=>SCe(e,"name",{value:t,configurable:!0}),NCe="Toggle",TCe=g.forwardRef(_Ce(function(t,n){const{pressed:s,defaultPressed:i,onPressedChange:r,...a}=t,[l,c]=ju({prop:s,onChange:r,defaultProp:i??!1,caller:NCe});return o.jsx(sa.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":t.disabled?"":void 0,...a,ref:n,onClick:qi(t.onClick,()=>{t.disabled||c(!l)})})},"Toggle")),kCe=Object.defineProperty,ic=(e,t)=>kCe(e,"name",{value:t,configurable:!0}),gh="ToggleGroup",[pV,NMe]=hc(gh,[sE]),mV=sE(),ACe=g.forwardRef(ic(function(t,n){const{type:s,...i}=t;if(s==="single"){const r=i;return o.jsx(CCe,{role:"radiogroup",...r,ref:n})}if(s==="multiple"){const r=i;return o.jsx(ICe,{role:"toolbar",...r,ref:n})}throw new Error(`Missing prop \`type\` expected on \`${gh}\``)},"ToggleGroup")),[gV,bV]=pV(gh),CCe=g.forwardRef(ic(function(t,n){const{value:s,defaultValue:i,onValueChange:r=ic(()=>{},"onValueChange"),...a}=t,[l,c]=ju({prop:s,defaultProp:i??"",onChange:r,caller:gh});return o.jsx(gV,{scope:t.__scopeToggleGroup,type:"single",value:g.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:g.useCallback(()=>c(""),[c]),children:o.jsx(yV,{...a,ref:n})})},"ToggleGroupImplSingle")),ICe=g.forwardRef(ic(function(t,n){const{value:s,defaultValue:i,onValueChange:r=ic(()=>{},"onValueChange"),...a}=t,[l,c]=ju({prop:s,defaultProp:i??[],onChange:r,caller:gh}),u=g.useCallback(f=>c((h=[])=>[...h,f]),[c]),d=g.useCallback(f=>c((h=[])=>h.filter(p=>p!==f)),[c]);return o.jsx(gV,{scope:t.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:d,children:o.jsx(yV,{...a,ref:n})})},"ToggleGroupImplMultiple")),[jCe,RCe]=pV(gh),yV=g.forwardRef(ic(function(t,n){const{__scopeToggleGroup:s,disabled:i=!1,rovingFocus:r=!0,orientation:a,dir:l,loop:c=!0,...u}=t,d=mV(s),f=tE(l),h={dir:f,...u};return o.jsx(jCe,{scope:s,rovingFocus:r,disabled:i,children:r?o.jsx(aV,{asChild:!0,...d,orientation:a,dir:f,loop:c,children:o.jsx(sa.div,{...h,ref:n})}):o.jsx(sa.div,{...h,ref:n})})},"ToggleGroupImpl")),jN="ToggleGroupItem",OCe=g.forwardRef(ic(function(t,n){const s=bV(jN,t.__scopeToggleGroup),i=RCe(jN,t.__scopeToggleGroup),r=mV(t.__scopeToggleGroup),a=s.value.includes(t.value),l=i.disabled||t.disabled,c={...t,pressed:a,disabled:l},u=g.useRef(null);return i.rovingFocus?o.jsx(oV,{asChild:!0,...r,focusable:!l,active:a,ref:u,children:o.jsx(J3,{...c,ref:n})}):o.jsx(J3,{...c,ref:n})},"ToggleGroupItem")),J3=g.forwardRef(ic(function(t,n){const{__scopeToggleGroup:s,value:i,...r}=t,a=bV(jN,s),l={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},c=a.type==="single"?l:void 0;return o.jsx(TCe,{...c,...r,ref:n,onPressedChange:u=>{u?a.onItemActivate(i):a.onItemDeactivate(i)}})},"ToggleGroupItemImpl"));const MCe="_Container_1tuad_1",LCe="_Checkbox_1tuad_22",DCe="_CheckMark_1tuad_92",PCe="_Label_1tuad_162",lb={Container:MCe,Checkbox:LCe,CheckMark:DCe,Label:PCe},xV=({className:e,label:t,id:n,disabled:s,orientation:i="left",...r})=>{const a=g.useId(),l=n??a;return o.jsxs("div",{"data-disabled":s?"":void 0,"data-has-label":t?"":void 0,"data-orientation":i,className:ra(e,lb.Container),children:[o.jsx(U2e,{className:lb.Checkbox,id:l,disabled:s,...r,children:o.jsx($2e,{className:lb.CheckMark})}),t&&o.jsx("label",{htmlFor:l,className:lb.Label,onMouseDown:c=>{!c.defaultPrevented&&c.detail>1&&c.preventDefault()},children:t})]})},BCe="_RadioGroup_onrfm_1",UCe="_RadioLabel_onrfm_9",FCe="_RadioIndicatorWrapper_onrfm_26",$Ce="_RadioItem_onrfm_43",HCe="_RadioIndicator_onrfm_26",gp={RadioGroup:BCe,RadioLabel:UCe,RadioIndicatorWrapper:FCe,RadioItem:$Ce,RadioIndicator:HCe},EV=g.createContext(null),zCe=()=>{const e=g.use(EV);if(!e)throw new Error("RadioGroup components must be wrapped in ");return e},RN=({onChange:e,children:t,className:n,direction:s="row",disabled:i=!1,...r})=>{const a=g.useMemo(()=>({disabled:i,direction:s}),[i,s]);return o.jsx(EV,{value:a,children:o.jsx(gCe,{className:ra(gp.RadioGroup,n),"data-direction":s,onValueChange:e,disabled:i,...r,children:t})})},VCe=({value:e,disabled:t=!1,required:n,children:s,className:i,block:r=!1,...a})=>{const{disabled:l}=zCe(),c=l||t,u=g.useId(),d=`${e}-${u}`;return o.jsx("div",{className:"flex",...a,children:o.jsxs("label",{htmlFor:d,className:ra(gp.RadioLabel,i),"data-disabled":c?"":void 0,"data-block":r?"":void 0,onMouseDown:f=>{!f.defaultPrevented&&f.detail>1&&f.preventDefault()},children:[o.jsx("div",{className:gp.RadioIndicatorWrapper,children:o.jsx(ECe,{id:d,value:e,disabled:c,required:n,className:gp.RadioItem,children:o.jsx(wCe,{className:gp.RadioIndicator})})}),s]})})};RN.Item=VCe;function GCe({className:e,...t}){return o.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:[o.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"}),o.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 hd={llm:{id:"llm",label:"LLM 智能体",desc:"大模型驱动,自主完成任务",icon:GCe},sequential:{id:"sequential",label:"顺序型智能体",desc:"子 Agent 按顺序依次执行",icon:uee},parallel:{id:"parallel",label:"并行型智能体",desc:"子 Agent 并行执行后汇总",icon:Oee},loop:{id:"loop",label:"循环型智能体",desc:"子 Agent 循环执行到满足条件",icon:Rk},a2a:{id:"a2a",label:"远程智能体",desc:"通过 A2A 协议调用远程 Agent",icon:n1}},KCe=[hd.llm,hd.sequential,hd.parallel,hd.loop,hd.a2a];function vV(e){return hd[e??"llm"]}const wV=e=>e==="sequential"||e==="parallel"||e==="loop",aE=e=>e==="a2a";function rc(e){return e.trimEnd().replace(/[。.]+$/,"")}function wx(e,t){const n=e.trim().toLocaleLowerCase();return n?t.some(s=>s==null?void 0:s.toLocaleLowerCase().includes(n)):!0}function wc(e,t){return e[t]|e[t+1]<<8}function sd(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function qCe(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 SV(e,t={}){let s=-1;for(let u=e.length-22;u>=0&&u>e.length-65557;u--)if(sd(e,u)===101010256){s=u;break}if(s<0)throw new Error("无效的 zip:找不到 EOCD");const i=wc(e,s+10);if(t.maxEntries!==void 0&&i>t.maxEntries)throw new Error(`zip 文件数不能超过 ${t.maxEntries} 个`);let r=sd(e,s+16);const a=new TextDecoder("utf-8"),l=[];let c=0;for(let u=0;ut.maxUncompressedBytes)throw new Error("zip 解压后的内容过大");const x=wc(e,v+26),E=wc(e,v+28),w=v+30+x+E,_=e.subarray(w,w+f);let S;if(d===0)S=_;else if(d===8)S=await qCe(_);else{r+=46+p+m+b;continue}l.push({name:y,text:a.decode(S)}),r+=46+p+m+b}return l}const YCe="/skillhub/v1/skills";async function WCe(e,t="public"){const n=e.trim(),s=`${YCe}?query=${encodeURIComponent(n)}&namespace=${encodeURIComponent(t)}`,i=await fetch(s,{headers:{accept:"application/json"},signal:Pn(void 0,uc)});if(!i.ok)throw new Error(`搜索失败 (${i.status})`);return((await i.json()).Skills??[]).map(a=>{var l;return{source:"skillhub",id:a.Id??a.Slug??"",slug:a.Slug??"",name:a.Name??a.Slug??"",description:((l=a.Metadata)==null?void 0:l.DisplayDescription)||a.Description||"",namespace:a.Namespace??t,sourceRepo:a.SourceRepo,downloadCount:a.DownloadCount}})}function XCe({selected:e,onChange:t}){const[n,s]=g.useState(""),[i,r]=g.useState([]),[a,l]=g.useState(!1),[c,u]=g.useState(null),[d,f]=g.useState(!1),h=b=>e.some(v=>v.source==="skillhub"&&v.slug===b),p=b=>{b.slug&&(h(b.slug)?t(e.filter(v=>!(v.source==="skillhub"&&v.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=>{l(!0),u(null),f(!0);try{const v=await WCe(b);r(v)}catch(v){u(v instanceof Error?v.message:"搜索失败,请稍后重试。"),r([])}finally{l(!1)}};return g.useEffect(()=>{const b=n.trim();if(!b){r([]),f(!1),u(null);return}const v=setTimeout(()=>m(b),300);return()=>clearTimeout(v)},[n]),o.jsxs("div",{className:"cw-skillhub",children:[o.jsxs("div",{className:"cw-skill-searchrow",children:[o.jsxs("div",{className:"cw-skill-searchbox",children:[o.jsx(Fy,{className:"cw-i cw-skill-searchicon","aria-hidden":!0}),o.jsx("input",{className:"cw-input cw-skill-input",value:n,placeholder:"搜索火山 Find Skill 技能广场,例如 数据分析、PDF…",onChange:b=>s(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),n.trim()&&m(n))}})]}),o.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft",onClick:()=>n.trim()&&m(n),disabled:!n.trim()||a,children:[a?o.jsx(dn,{className:"cw-i cw-spin"}):o.jsx(Fy,{className:"cw-i"}),"搜索"]})]}),c&&o.jsxs("div",{className:"cw-banner",children:[o.jsx(cc,{className:"cw-i"}),o.jsx("span",{children:c})]}),a&&i.length===0?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(dn,{className:"cw-i cw-spin"})," 正在搜索…"]}):i.length>0?o.jsx("div",{className:"cw-skill-results",children:i.map(b=>{const v=h(b.slug||"");return o.jsxs("button",{type:"button",className:`cw-skill-result ${v?"is-on":""}`,onClick:()=>p(b),"aria-pressed":v,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:v?o.jsx(ja,{className:"cw-i cw-i-sm"}):o.jsx(_i,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsx("span",{className:"cw-skill-result-name",children:b.name}),b.description&&o.jsx("span",{className:"cw-skill-result-desc",children:rc(b.description)}),b.sourceRepo&&o.jsx("span",{className:"cw-skill-result-repo",children:b.sourceRepo})]})]},b.id||b.slug)})}):d&&!c?o.jsx("p",{className:"cw-empty-line",children:"没有找到匹配的技能,换个关键词试试。"}):!d&&o.jsx("p",{className:"cw-empty-line",children:"输入关键词搜索火山 Find Skill 技能广场,所选技能会在生成项目时下载到 skills/ 目录。"})]})}const ON=/(^|\/)skill\.md$/i;function QCe(e){const t=(e??"").replace(/\r\n?/g,` `).split(` -`);if(!t.length||t[0].trim()!=="---")return{name:"",description:""};let n=-1;for(let i=1;i=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))}function WCe(...e){var t;for(const n of e){const s=(t=n.trim().replace(/\\/g,"/").split("/").filter(Boolean).pop())==null?void 0:t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"");if(s)return s.slice(0,64)}return"local-skill"}function XCe(e,t){return t.trim()||e}function EV(e){const t=e.map(s=>({path:s.path.replace(/\\/g,"/").replace(/^\.\//,""),text:s.text})).filter(s=>s.path.length>0&&!s.path.endsWith("/")),n=new Set(t.map(s=>s.path.split("/")[0]));if(n.size===1&&t.every(s=>s.path.includes("/"))){const s=[...n][0]+"/";return t.map(i=>({path:i.path.slice(s.length),text:i.text}))}return t}function QCe(e){const t=new Map,n=new Set;for(const s of e)if(CN.test("/"+s.path)){const i=s.path.split("/");n.add(i.slice(0,-1).join("/"))}for(const s of e){const i=s.path.split("/");let r="";for(let u=i.length-1;u>=0;u--){const d=i.slice(0,u).join("/");if(n.has(d)){r=d;break}}const a=CN.test("/"+s.path);if(!r&&!a&&!n.has("")||!n.has(r)&&!a)continue;const l=r?s.path.slice(r.length+1):s.path,c=t.get(r)||[];c.push({path:l,text:s.text}),t.set(r,c)}return t}function ZCe(e,t,n){const s=`${n}${e?"/"+e:""}`,i=t.find(c=>CN.test("/"+c.path));if(!i)return{hit:null,error:`${s} 缺少 SKILL.md`};const r=qCe(i.text),a=WCe(r.name,e,n.replace(/\.[^.]+$/,"")),l=[];for(const c of t){if(c.path.split("/").some(f=>f===".."))return{hit:null,error:`${s} 包含非法路径(..):${c.path}`};const d=`skills/${a}/${c.path}`;if(!d.startsWith(`skills/${a}/`))return{hit:null,error:`${s} 包含非法路径:${c.path}`};l.push({path:d,content:c.text})}return{hit:{source:"local",id:`local:${a}:${t.length}`,name:XCe(a,r.name),description:r.description||"本地 Skill",folder:a,localFiles:l},error:null}}async function JCe(e){const t=new Uint8Array(await e.arrayBuffer()),s=(await xV(t)).map(i=>({path:i.name,text:i.text}));return vV(EV(s),e.name)}async function eIe(e,t=new Map){const n=[];for(let s=0;se.file(t,n))}async function nIe(e){const t=e.createReader(),n=[];for(;;){const s=await new Promise((i,r)=>t.readEntries(i,r));if(s.length===0)return n;n.push(...s)}}async function wV(e,t=""){const n=t?`${t}/${e.name}`:e.name;if(e.isFile)return[{file:await tIe(e),path:n}];if(!e.isDirectory)return[];const s=await nIe(e);return(await Promise.all(s.map(i=>wV(i,n)))).flat()}function sIe({selected:e,onChange:t}){const[n,s]=g.useState([]),[i,r]=g.useState([]),[a,l]=g.useState(!1),[c,u]=g.useState(!1),d=g.useRef(0),f=E=>e.some(w=>w.source==="local"&&w.folder===E),h=E=>{E.localFiles&&(f(E.folder||E.name)?t(e.filter(w=>!(w.source==="local"&&w.folder===(E.folder||E.name)))):t([...e,{source:"local",folder:E.folder||E.name,name:E.name,description:E.description,localFiles:E.localFiles}]))},p=g.useRef([]),m=g.useRef(e);g.useEffect(()=>{p.current=i},[i]),g.useEffect(()=>{m.current=e},[e]);const b=E=>{const w=new Set([...p.current.map(T=>T.folder||T.name),...m.current.filter(T=>T.source==="local").map(T=>T.folder)]),_=[],S=[];for(const T of E.hits){const C=T.folder||T.name;if(w.has(C)){_.push(T.name);continue}w.add(C),S.push(T)}r(T=>[...T,...S]);const k=[...E.errors];if(_.length>0&&k.push(`已跳过重复技能:${_.join("、")}`),s(k),S.length===1&&E.errors.length===0&&_.length===0){const T=S[0];T.localFiles&&t([...m.current,{source:"local",folder:T.folder||T.name,name:T.name,description:T.description,localFiles:T.localFiles}])}},v=E=>{E.preventDefault(),d.current+=1,u(!0)},y=E=>{E.preventDefault(),d.current=Math.max(0,d.current-1),d.current===0&&u(!1)},x=async E=>{if(E.preventDefault(),d.current=0,u(!1),a)return;const w=Array.from(E.dataTransfer.items).map(_=>{var S;return(S=_.webkitGetAsEntry)==null?void 0:S.call(_)}).filter(_=>_!==null);if(w.length===0){s(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}l(!0);try{const _=(await Promise.all(w.map(T=>wV(T)))).flat(),S=w.some(T=>T.isDirectory);if(!S&&_.length===1&&_[0].file.name.toLowerCase().endsWith(".zip")){b(await JCe(_[0].file));return}if(!S){s(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}const k=new Map(_.map(({file:T,path:C})=>[T,C]));b(await eIe(_.map(({file:T})=>T),k))}catch(_){s([`读取失败:${_ instanceof Error?_.message:String(_)}`])}finally{l(!1)}};return o.jsxs("div",{className:"cw-local",children:[o.jsxs("div",{className:`cw-local-dropzone ${c?"is-dragging":""}`,role:"group","aria-label":"拖入文件夹或 ZIP,自动识别 Skill",onDragEnter:v,onDragOver:E=>E.preventDefault(),onDragLeave:y,onDrop:E=>void x(E),children:[o.jsx(Tk,{className:"cw-local-drop-icon","aria-hidden":!0}),o.jsx("p",{className:"cw-local-drop-hint",children:"拖入文件夹或 ZIP,自动识别 Skill"})]}),o.jsx("p",{className:"cw-local-hint",children:"每个技能需包含 SKILL.md。支持包含多个技能的目录。"}),a&&o.jsx("p",{className:"cw-empty-line",children:"正在读取文件…"}),n.length>0&&o.jsxs("div",{className:"cw-banner",children:[o.jsx(ic,{className:"cw-i"}),o.jsx("span",{children:n.join(";")})]}),i.length>0&&o.jsx("div",{className:"cw-skill-results",children:i.map(E=>{var _;const w=f(E.folder||E.name);return o.jsxs("button",{type:"button",className:`cw-skill-result ${w?"is-on":""}`,onClick:()=>h(E),"aria-pressed":w,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:w?o.jsx(Ra,{className:"cw-i cw-i-sm"}):o.jsx(_i,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsx("span",{className:"cw-skill-result-name",children:E.name}),E.description&&o.jsx("span",{className:"cw-skill-result-desc",children:ec(E.description)}),o.jsxs("span",{className:"cw-skill-result-repo",children:["本地 · ",((_=E.localFiles)==null?void 0:_.length)??0," 个文件"]})]})]},E.id)})})]})}function iIe(e){return e==="cn-beijing"?"北京":e==="cn-shanghai"?"上海":e}function rIe({selected:e,onChange:t}){const[n,s]=g.useState([]),[i,r]=g.useState([]),[a,l]=g.useState(""),[c,u]=g.useState(!0),[d,f]=g.useState(!1),[h,p]=g.useState(null);g.useEffect(()=>{let y=!1;return(async()=>{u(!0),p(null);try{const x=await zU();y||(s(x),x.length>0&&l(x[0].id))}catch(x){y||p(x instanceof Error?x.message:"加载失败")}finally{y||u(!1)}})(),()=>{y=!0}},[]),g.useEffect(()=>{if(!a){r([]);return}const y=n.find(E=>E.id===a);let x=!1;return(async()=>{f(!0),p(null);try{const E=await VU(a,y==null?void 0:y.region);x||r(E)}catch(E){x||p(E instanceof Error?E.message:"加载失败")}finally{x||f(!1)}})(),()=>{x=!0}},[a,n]);const m=n.find(y=>y.id===a),b=(y,x)=>e.some(E=>E.source==="skillspace"&&E.skillId===y&&(E.version||"")===x),v=y=>{if(m)if(b(y.skillId,y.version))t(e.filter(x=>!(x.source==="skillspace"&&x.skillId===y.skillId&&(x.version||"")===y.version)));else{const x=cfe(m,y);t([...e,{source:"skillspace",folder:x.folder||y.skillName,name:x.name,description:x.description,skillSpaceId:x.skillSpaceId,skillSpaceName:x.skillSpaceName,skillSpaceRegion:x.skillSpaceRegion,skillId:x.skillId,version:x.version}])}};return o.jsx("div",{className:"cw-skillspace",children:c?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(mn,{className:"cw-i cw-spin"})," 正在加载 AgentKit Skills 中心…"]}):h?o.jsxs("div",{className:"cw-banner",children:[o.jsx(ic,{className:"cw-i"}),o.jsx("span",{children:h})]}):n.length===0?o.jsx("p",{className:"cw-empty-line",children:"此账号下没有 AgentKit Skills 中心。"}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cw-skillspace-header",children:[o.jsx("select",{className:"cw-input cw-skillspace-select",value:a,onChange:y=>l(y.target.value),"aria-label":"选择 AgentKit Skills 中心",children:n.map(y=>o.jsxs("option",{value:y.id,children:[y.name||y.id,y.description?` — ${ec(y.description)}`:""]},y.id))}),m&&o.jsxs(o.Fragment,{children:[m.region&&o.jsx("span",{className:"cw-skillspace-region-label",title:m.region,children:iIe(m.region)}),o.jsx("a",{href:ufe(m.id,m.region),target:"_blank",rel:"noopener noreferrer",className:"cw-button cw-button-secondary cw-skillspace-console-link",title:"在火山引擎控制台打开","aria-label":"在火山引擎控制台打开",children:o.jsx(vm,{className:"cw-i cw-i-sm"})})]})]}),d?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(mn,{className:"cw-i cw-spin"})," 正在加载技能列表…"]}):i.length===0?o.jsx("p",{className:"cw-empty-line",children:"此 AgentKit Skills 中心暂无技能。"}):o.jsx("div",{className:"cw-skill-results",children:i.map(y=>{const x=b(y.skillId,y.version);return o.jsxs("button",{type:"button",className:`cw-skill-result ${x?"is-on":""}`,onClick:()=>v(y),"aria-pressed":x,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:x?o.jsx(Ra,{className:"cw-i cw-i-sm"}):o.jsx(_i,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsxs("span",{className:"cw-skill-result-name",children:[y.skillName,y.version&&o.jsxs("span",{className:"cw-skill-result-version",children:[" ","v",y.version]})]}),y.skillDescription&&o.jsx("span",{className:"cw-skill-result-desc",children:ec(y.skillDescription)}),o.jsxs("span",{className:"cw-skill-result-repo",children:[o.jsx(WJ,{className:"cw-i cw-i-sm"})," ",(m==null?void 0:m.name)||a]})]})]},`${y.skillId}/${y.version}`)})})]})})}async function aIe(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Un(void 0,rc)});if(t.status===409)throw new Error("服务端未配置 Volcengine AK/SK,无法访问 AgentKit 智能体中心");if(t.status===401)throw new Error("请先登录以访问 AgentKit 智能体中心");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function oIe(e={}){const t=new URLSearchParams({region:e.region||"cn-beijing",page_size:String(e.pageSize??100),project:e.project||"default"});return(await aIe(`/web/a2a-spaces?${t.toString()}`)).items||[]}async function lIe(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Un(void 0,rc)});if(t.status===409)throw new Error("服务端未配置 Volcengine AK/SK,无法访问 VikingDB 知识库");if(t.status===401)throw new Error("请先登录以访问 VikingDB 知识库");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function cIe(e={}){const t=new URLSearchParams({region:e.region||"cn-beijing",project:e.project||"default"});return(await lIe(`/web/viking-knowledgebases?${t.toString()}`)).items||[]}const X3=["#6366f1","#0ea5e9","#10b981","#f59e0b","#f43f5e","#a855f7","#14b8a6","#f472b6"];function Bw(e){let t=0;for(let n=0;n>>0;return X3[t%X3.length]}function uIe(e){const t=new Map;e.forEach(u=>t.set(u.span_id,u));const n=new Map,s=[];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):s.push(u);const i=(u,d)=>u.start_time-d.start_time,r=(u,d)=>({span:u,depth:d,children:(n.get(u.span_id)??[]).sort(i).map(f=>r(f,d+1))}),a=s.sort(i).map(u=>r(u,0)),l=e.length?Math.min(...e.map(u=>u.start_time)):0,c=e.length?Math.max(...e.map(u=>u.end_time)):1;return{rootNodes:a,min:l,total:c-l||1}}function dIe(e,t){const n=[],s=i=>{n.push(i),t.has(i.span.span_id)||i.children.forEach(s)};return e.forEach(s),n}function Q3(e){const t=e/1e6;return t>=1e3?`${(t/1e3).toFixed(2)} s`:`${t.toFixed(t<10?2:1)} ms`}const fIe=e=>e.replace(/^(gen_ai|a2ui|adk)\./,"");function Z3(e){return Object.entries(e.attributes).filter(([,t])=>t!=null&&typeof t!="object").map(([t,n])=>{const s=String(n);return{key:fIe(t),value:s,long:s.length>80||s.includes(` -`)}}).sort((t,n)=>Number(t.long)-Number(n.long))}function SV({appName:e,testRunId:t,sessionId:n,endTimeMs:s,onClose:i,title:r="调用链路观测"}){const[a,l]=g.useState(null),[c,u]=g.useState(""),[d,f]=g.useState(new Set),[h,p]=g.useState(null);g.useEffect(()=>{l(null),u("");let _;if(t)_=p8(t,n);else if(e)_=zy(e,n,s);else{u("缺少调用链路来源");return}_.then(S=>{l(S),p(S.length?S.reduce((k,T)=>k.start_time<=T.start_time?k:T).span_id:null)}).catch(S=>u(S instanceof Error?S.message:String(S)))},[e,s,n,t]);const{rootNodes:m,min:b,total:v}=g.useMemo(()=>uIe(a??[]),[a]),y=g.useMemo(()=>dIe(m,d),[m,d]),x=(a==null?void 0:a.find(_=>_.span_id===h))??null,E=v/1e6,w=_=>f(S=>{const k=new Set(S);return k.has(_)?k.delete(_):k.add(_),k});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"drawer-scrim",onClick:i}),o.jsxs("aside",{className:"drawer drawer--trace",children:[o.jsxs("header",{className:"drawer-head",children:[o.jsxs("div",{children:[o.jsx("div",{className:"drawer-title",children:r}),o.jsx("div",{className:"drawer-sub",children:a?`${a.length} 个调用 · ${E.toFixed(1)} ms`:"加载中"})]}),o.jsx("button",{className:"drawer-close",onClick:i,"aria-label":"关闭",children:o.jsx(Ti,{className:"icon"})})]}),a==null&&!c&&o.jsxs("div",{className:"drawer-loading",children:[o.jsx(mn,{className:"icon spin"})," 加载调用链路…"]}),c&&o.jsx("div",{className:"error",children:c}),a&&a.length===0&&o.jsx("div",{className:"drawer-empty",children:"该会话暂无调用链路(可能尚未产生调用)。"}),y.length>0&&o.jsxs("div",{className:"trace-split",children:[o.jsx("div",{className:"trace-tree scroll",children:y.map(_=>{const S=_.span,k=(S.start_time-b)/v*100,T=Math.max((S.end_time-S.start_time)/v*100,.6),C=_.children.length>0;return o.jsxs("button",{className:`trace-row ${h===S.span_id?"active":""}`,onClick:()=>p(S.span_id),children:[o.jsxs("span",{className:"trace-label",style:{paddingLeft:_.depth*14},children:[o.jsx("span",{className:`trace-caret ${C?"":"hidden"} ${d.has(S.span_id)?"":"open"}`,onClick:I=>{I.stopPropagation(),C&&w(S.span_id)},children:o.jsx(Ql,{className:"chev"})}),o.jsx("span",{className:"trace-dot",style:{background:Bw(S.name)}}),o.jsx("span",{className:"trace-name",title:S.name,children:S.name})]}),o.jsx("span",{className:"trace-dur",children:Q3(S.end_time-S.start_time)}),o.jsx("span",{className:"trace-track",children:o.jsx("span",{className:"trace-bar",style:{left:`${k}%`,width:`${T}%`,background:Bw(S.name)}})})]},S.span_id)})}),o.jsx("div",{className:"trace-detail scroll",children:x?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"td-title",children:x.name}),o.jsxs("div",{className:"td-dur",children:[o.jsx("span",{className:"td-dot",style:{background:Bw(x.name)}}),Q3(x.end_time-x.start_time)]}),o.jsx("div",{className:"td-section",children:"属性"}),o.jsx("div",{className:"td-props",children:Z3(x).filter(_=>!_.long).map(_=>o.jsxs("div",{className:"td-prop",children:[o.jsx("span",{className:"td-key",children:_.key}),o.jsx("span",{className:"td-val",children:_.value})]},_.key))}),Z3(x).filter(_=>_.long).map(_=>o.jsxs("div",{className:"td-block",children:[o.jsx("div",{className:"td-section",children:_.key}),o.jsx("pre",{className:"td-pre",children:_.value})]},_.key))]}):o.jsx("div",{className:"drawer-empty",children:"选择左侧的一个调用查看详情"})})]})]})]})}const hIe=g.lazy(()=>Jc(()=>import("./MarkdownPromptEditor-CVrkjs41.js"),__vite__mapDeps([0,1]))),IN="veadk.generatedAgentTestRuns",J3=4;function R2(){if(typeof window>"u")return[];try{const e=JSON.parse(window.sessionStorage.getItem(IN)??"[]");return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}catch{return[]}}function _V(e){if(typeof window>"u")return;const t=Array.from(new Set(e)).slice(-20);try{t.length?window.sessionStorage.setItem(IN,JSON.stringify(t)):window.sessionStorage.removeItem(IN)}catch{}}function pIe(e){_V([...R2(),e])}function Zh(e){_V(R2().filter(t=>t!==e))}function mIe(e,t,n="text/plain"){const s=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),i=document.createElement("a");i.href=s,i.download=e,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(s)}const gIe=[{id:"type",label:"Agent 类型",hint:"选择 Agent 类型",icon:Aee,required:!0},{id:"basic",label:"基本信息",hint:"名称、描述与系统提示词",icon:ic,required:!0},{id:"model",label:"模型配置",hint:"模型与服务(可选)",icon:QJ},{id:"tools",label:"工具",hint:"可调用的能力",icon:xB},{id:"skills",label:"技能",hint:"声明式技能",icon:au},{id:"knowledge",label:"知识库",hint:"外部知识检索",icon:Ib},{id:"memory",label:"记忆",hint:"短期与长期记忆",icon:gB},{id:"subagents",label:"子 Agent",hint:"嵌套协作",icon:GJ},{id:"review",label:"完成",hint:"预览并创建",icon:Nee}];function bIe({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.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"}),o.jsx("path",{d:"M5.75 8.25v7.5",opacity:"0.8"}),o.jsx("path",{d:"M3 10v4",opacity:"0.45"}),o.jsx("path",{d:"M17.9 5.25v2.2M19 6.35h-2.2",strokeWidth:"1.55"})]})}function eD({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M4.75 7.25h14.5"}),o.jsx("path",{d:"M9.1 4.75h5.8l.75 2.5h-7.3l.75-2.5Z"}),o.jsx("path",{d:"m6.75 7.25.75 12h9l.75-12"}),o.jsx("path",{d:"M10 10.25v5.75M14 10.25v5.75"})]})}function NV({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o.jsx("path",{d:"m7 9 5 5 5-5"})})}function TV({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M18.25 8.2A7.1 7.1 0 0 0 6.1 6.65L4.5 8.25"}),o.jsx("path",{d:"M4.5 4.75v3.5H8"}),o.jsx("path",{d:"M5.75 15.8A7.1 7.1 0 0 0 17.9 17.35l1.6-1.6"}),o.jsx("path",{d:"M19.5 19.25v-3.5H16"})]})}const yIe={llm:"智能体",sequential:"分步协作",parallel:"同时处理",loop:"循环执行",a2a:"远程智能体"},tD={REGISTRY_SPACE_ID:"registrySpaceId",REGISTRY_TOP_K:"registryTopK",REGISTRY_REGION:"registryRegion",REGISTRY_ENDPOINT:"registryEndpoint"},kV="REGISTRY_SPACE_ID",xIe=$U.filter(e=>e.key!==kV);function AV(e,t){var s,i,r;if(!(e!=null&&e.enabled))return{};const n={REGISTRY_SPACE_ID:e.registrySpaceId??""};return t.includeDefaults?(n.REGISTRY_TOP_K=((s=e.registryTopK)==null?void 0:s.trim())||Ta.topK,n.REGISTRY_REGION=((i=e.registryRegion)==null?void 0:i.trim())||Ta.region,n.REGISTRY_ENDPOINT=((r=e.registryEndpoint)==null?void 0:r.trim())||Ta.endpoint):(n.REGISTRY_TOP_K=e.registryTopK??"",n.REGISTRY_REGION=e.registryRegion??"",n.REGISTRY_ENDPOINT=e.registryEndpoint??""),n}function EIe({items:e,selected:t,onToggle:n,scrollRows:s}){return o.jsx("div",{className:`cw-checklist ${s?"cw-checklist-tools":""}`,style:s?{"--cw-checklist-max-height":`${s*40+(s-1)*8}px`}:void 0,children:e.map(i=>{const r=t.includes(i.id);return o.jsx(mV,{id:`cw-check-${i.id}`,className:`cw-check ${r?"is-on":""}`,checked:r,onCheckedChange:a=>{a!==r&&n(i.id)},label:o.jsx("span",{className:"cw-check-text",children:o.jsx("span",{className:"cw-check-title",children:i.label})})},i.id)})})}function Uw({options:e,value:t,onChange:n}){return o.jsx("div",{className:"cw-segmented",children:e.map(s=>{var r;const i=(t??((r=e[0])==null?void 0:r.id))===s.id;return o.jsx("button",{type:"button",className:`cw-seg ${i?"is-on":""}`,onClick:()=>n(s.id),"aria-pressed":i,children:o.jsx("span",{className:"cw-seg-title",children:s.label})},s.id)})})}function vIe(e){return/(SECRET|PASSWORD|KEY|TOKEN)$/.test(e)}function Jh({env:e,values:t,onChange:n}){return e.length===0?o.jsx("p",{className:"cw-env-empty",children:"此后端无需额外运行参数。"}):o.jsx("div",{className:"cw-env-fields",children:e.map(s=>{const i=t[s.key]??s.defaultValue??"",r=v2(s,t),a=`cw-env-${s.key}`;return o.jsxs("label",{className:"cw-env-field",htmlFor:a,children:[o.jsxs("span",{className:"cw-env-field-head",children:[o.jsxs("span",{className:"cw-env-field-title",children:[o.jsxs("span",{className:"cw-env-field-label",children:[s.comment||s.key,s.required&&o.jsx("span",{className:"cw-req",children:"*"})]}),s.help&&o.jsxs("span",{className:"cw-env-help",tabIndex:0,"data-help":s.help,"aria-label":`${s.comment||s.key}说明:${s.help}`,children:["?",o.jsx("span",{className:"cw-env-help-popover",role:"tooltip",children:s.help})]}),s.link&&o.jsx("a",{className:"cw-env-link",href:s.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开 OpenViking ${s.link.label}`,"aria-label":`打开 OpenViking ${s.link.label}`,onClick:l=>l.stopPropagation(),children:o.jsx(vm,{"aria-hidden":"true"})})]}),s.comment&&o.jsx("code",{title:s.key,children:s.key})]}),s.multiline||s.format==="json"?o.jsx("textarea",{id:a,className:"cw-input cw-env-textarea",value:i,placeholder:s.placeholder||"请输入参数值",autoComplete:"off",spellCheck:!1,"aria-invalid":!!r,onChange:l=>n(s.key,l.currentTarget.value)}):o.jsx("input",{id:a,className:"cw-input",type:vIe(s.key)?"password":"text",value:i,placeholder:s.placeholder||"请输入参数值",autoComplete:"off","aria-invalid":!!r,onChange:l=>n(s.key,l.currentTarget.value)}),r&&o.jsx("span",{className:"cw-env-error",children:r})]},s.key)})})}function Fw(e){return e.name.trim()||"未命名智能体中心"}function $w(e){return e.name.trim()||e.id||"未命名知识库"}function wIe({value:e,region:t,invalid:n,onChange:s}){const i=t.trim()||Ta.region,[r,a]=g.useState([]),[l,c]=g.useState(!1),[u,d]=g.useState(null),[f,h]=g.useState(0),[p,m]=g.useState(!1),[b,v]=g.useState(""),y=g.useRef(null);g.useEffect(()=>{let C=!1;return c(!0),d(null),oIe({region:i}).then(I=>{C||a(I)}).catch(I=>{C||(a([]),d(I instanceof Error?I.message:"加载失败"))}).finally(()=>{C||c(!1)}),()=>{C=!0}},[i,f]);const x=!e||r.some(C=>C.id===e.trim()),E=r.find(C=>C.id===e.trim()),w=E?Fw(E):e&&!x?"已选择的智能体中心":"请选择智能体中心",_=l&&r.length===0,S=g.useMemo(()=>r.filter(C=>Ex(b,[Fw(C),C.id,C.projectName])),[b,r]),k=!!(e&&!x&&Ex(b,["已选择的智能体中心",e]));g.useEffect(()=>{if(!p)return;const C=j=>{const L=j.target;L instanceof Node&&y.current&&!y.current.contains(L)&&m(!1)},I=j=>{j.key==="Escape"&&m(!1)};return window.addEventListener("pointerdown",C),window.addEventListener("keydown",I),()=>{window.removeEventListener("pointerdown",C),window.removeEventListener("keydown",I)}},[p]);const T=C=>{s(C),m(!1)};return o.jsxs("div",{className:"cw-a2a-space-picker",ref:y,children:[o.jsxs("div",{className:"cw-a2a-space-row",children:[o.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[o.jsxs("button",{type:"button",className:`cw-a2a-space-trigger ${n?"is-error":""}`,disabled:_,"aria-haspopup":"listbox","aria-expanded":p,"aria-label":"选择 AgentKit 智能体中心",onClick:()=>{v(""),m(C=>!C)},children:[o.jsx("span",{className:e?void 0:"is-placeholder",children:w}),o.jsx(NV,{className:"cw-a2a-space-trigger-icon"})]}),p&&o.jsxs("div",{className:"cw-a2a-space-menu",children:[o.jsx("div",{className:"cw-picker-search",children:o.jsx("input",{className:"cw-picker-search-input",type:"search",value:b,autoFocus:!0,autoComplete:"off","aria-label":"搜索 AgentKit 智能体中心",placeholder:"搜索名称或 ID",onChange:C=>v(C.currentTarget.value)})}),o.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"AgentKit 智能体中心",children:[k&&o.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>T(e),children:"已选择的智能体中心"}),S.map(C=>{const I=Fw(C),j=C.id===e;return o.jsx("button",{type:"button",role:"option","aria-selected":j,className:`cw-a2a-space-option ${j?"is-selected":""}`,title:`${I} (${C.id})`,onClick:()=>T(C.id),children:I},C.id)}),!k&&S.length===0&&o.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的智能体中心"})]})]})]}),o.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh",title:"刷新智能体中心列表","aria-label":"刷新智能体中心列表",disabled:l,onClick:()=>h(C=>C+1),children:l?o.jsx(mn,{className:"cw-i cw-i-sm cw-spin"}):o.jsx(TV,{className:"cw-i cw-i-sm"})})]}),u?o.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[o.jsx(ic,{className:"cw-i"}),o.jsx("span",{children:u})]}):l?o.jsxs("span",{className:"cw-help cw-a2a-space-status",children:[o.jsx(mn,{className:"cw-i cw-i-sm cw-spin"}),"正在加载 AgentKit 智能体中心…"]}):r.length===0?o.jsx("span",{className:"cw-help",children:"此账号下暂无 AgentKit 智能体中心。"}):o.jsxs("span",{className:"cw-help",children:["已加载 ",r.length," 个智能体中心,列表仅展示中心名称。"]})]})}function SIe({value:e,onChange:t}){const[n,s]=g.useState([]),[i,r]=g.useState(!1),[a,l]=g.useState(null),[c,u]=g.useState(0),[d,f]=g.useState(!1),[h,p]=g.useState(""),m=g.useRef(null);g.useEffect(()=>{let S=!1;return r(!0),l(null),cIe().then(k=>{S||s(k)}).catch(k=>{S||(s([]),l(k instanceof Error?k.message:"加载失败"))}).finally(()=>{S||r(!1)}),()=>{S=!0}},[c]);const b=!e||n.some(S=>S.id===e.trim()),v=n.find(S=>S.id===e.trim()),y=v?$w(v):e&&!b?e:"请选择 VikingDB 知识库",x=i&&n.length===0,E=g.useMemo(()=>n.filter(S=>Ex(h,[$w(S),S.id,S.description,S.projectName])),[n,h]),w=!!(e&&!b&&Ex(h,[e]));g.useEffect(()=>{if(!d)return;const S=T=>{const C=T.target;C instanceof Node&&m.current&&!m.current.contains(C)&&f(!1)},k=T=>{T.key==="Escape"&&f(!1)};return window.addEventListener("pointerdown",S),window.addEventListener("keydown",k),()=>{window.removeEventListener("pointerdown",S),window.removeEventListener("keydown",k)}},[d]);const _=S=>{t(S),f(!1)};return i&&n.length===0?o.jsxs("span",{className:"cw-viking-kb-inline-status",role:"status",children:[o.jsx(mn,{className:"cw-i cw-i-sm cw-spin"}),"正在加载…"]}):o.jsxs("div",{className:"cw-a2a-space-picker cw-viking-kb-picker",ref:m,children:[o.jsxs("div",{className:"cw-a2a-space-row",children:[o.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[o.jsxs("button",{type:"button",className:"cw-a2a-space-trigger",disabled:x,"aria-haspopup":"listbox","aria-expanded":d,"aria-label":"选择 VikingDB 知识库",onClick:()=>{p(""),f(S=>!S)},children:[o.jsx("span",{className:e?void 0:"is-placeholder",children:y}),o.jsx(NV,{className:"cw-a2a-space-trigger-icon"})]}),d&&o.jsxs("div",{className:"cw-a2a-space-menu cw-viking-kb-menu",children:[o.jsx("div",{className:"cw-picker-search",children:o.jsx("input",{className:"cw-picker-search-input",type:"search",value:h,autoFocus:!0,autoComplete:"off","aria-label":"搜索 VikingDB 知识库",placeholder:"搜索名称或 ID",onChange:S=>p(S.currentTarget.value)})}),o.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"VikingDB 知识库",children:[w&&o.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>_(e),children:e}),E.map(S=>{const k=$w(S),T=S.id===e;return o.jsx("button",{type:"button",role:"option","aria-selected":T,className:`cw-a2a-space-option ${T?"is-selected":""}`,title:`${k} (${S.id})`,onClick:()=>_(S.id),children:k},S.id)}),!w&&E.length===0&&o.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的知识库"})]})]})]}),o.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh cw-viking-kb-refresh",title:"刷新知识库列表","aria-label":"刷新知识库列表",disabled:i,onClick:()=>u(S=>S+1),children:i?o.jsx(mn,{className:"cw-i cw-i-sm cw-spin"}):o.jsx(TV,{className:"cw-i cw-i-sm"})})]}),a?o.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[o.jsx(ic,{className:"cw-i"}),o.jsx("span",{children:a})]}):n.length===0?o.jsx("span",{className:"cw-help",children:"此账号下暂无 VikingDB 知识库。"}):o.jsxs("span",{className:"cw-help",children:["已加载 ",n.length," 个知识库,选择的知识库会用于当前 Agent。"]})]})}function _Ie({tools:e,onChange:t}){const n=(r,a)=>t(e.map((l,c)=>c===r?{...l,...a}:l)),s=r=>t(e.filter((a,l)=>l!==r)),i=()=>t([...e,{name:"",transport:"http",url:""}]);return o.jsxs("div",{className:"cw-mcp",children:[e.length>0&&o.jsx("div",{className:"cw-mcp-list",children:o.jsx(Ro,{initial:!1,children:e.map((r,a)=>o.jsxs(is.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:[o.jsxs("div",{className:"cw-mcp-rowhead",children:[o.jsxs("div",{className:"cw-mcp-transport",children:[o.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${r.transport==="http"?"is-on":""}`,onClick:()=>n(a,{transport:"http"}),"aria-pressed":r.transport==="http",children:o.jsx("span",{className:"cw-seg-title",children:"HTTP"})}),o.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${r.transport==="stdio"?"is-on":""}`,onClick:()=>n(a,{transport:"stdio"}),"aria-pressed":r.transport==="stdio",children:o.jsx("span",{className:"cw-seg-title",children:"stdio"})})]}),o.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger",onClick:()=>s(a),"aria-label":"移除 MCP 工具",children:o.jsx(Zl,{className:"cw-i cw-i-sm"})})]}),o.jsx("input",{className:"cw-input",value:r.name,placeholder:"名称(用于命名,可留空)",onChange:l=>n(a,{name:l.target.value})}),r.transport==="http"?o.jsxs(o.Fragment,{children:[o.jsx("input",{className:"cw-input",value:r.url??"",placeholder:"MCP 服务地址(StreamableHTTP)",onChange:l=>n(a,{url:l.target.value})}),Qke(r.url??"")&&o.jsxs("p",{className:"cw-mcp-warning",children:[o.jsx(ic,{"aria-hidden":"true"}),o.jsx("span",{children:"当前地址不是以 /mcp 结尾,请确认它是实际的 MCP Endpoint。Studio 会保留该地址,不会自动补充路径。"})]}),o.jsx("input",{className:"cw-input",value:Wke(r),placeholder:"Bearer Token(可选)",onChange:l=>t(e.map((c,u)=>u===a?Xke(c,l.target.value):c))})]}):o.jsxs(o.Fragment,{children:[o.jsx("input",{className:"cw-input",value:r.command??"",placeholder:"启动命令,例如 npx",onChange:l=>n(a,{command:l.target.value})}),o.jsx("input",{className:"cw-input",value:(r.args??[]).join(" "),placeholder:"参数(用空格分隔),例如 -y @playwright/mcp@latest",onChange:l=>n(a,{args:l.target.value.split(/\s+/).filter(Boolean)})}),o.jsx("p",{className:"cw-mcp-note",children:"stdio MCP 暂不参与调试运行;点击“去部署”时会完整保留这项配置并生成对应代码。"})]})]},a))})}),o.jsxs("button",{type:"button",className:"cw-add-sub",onClick:i,children:[o.jsx(_i,{className:"cw-i"}),"添加 MCP 工具"]}),e.length===0&&o.jsx("p",{className:"cw-empty-line",children:"暂无 MCP 工具,点击「添加 MCP 工具」连接外部 MCP 服务。"})]})}function CV({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.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"}),o.jsx("path",{d:"M7 4.75h9.5a2 2 0 0 1 2 2",opacity:".58"}),o.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"}),o.jsx("path",{d:"M19.25 11.25h1.5M20 10.5V12",opacity:".72"})]})}function NIe({s:e,onRemove:t}){let n=au,s="火山 Find Skill 技能广场";return e.source==="local"?(n=Tk,s="本地"):e.source==="skillspace"&&(n=CV,s="AgentKit Skills 中心"),o.jsxs(is.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:[o.jsx("span",{className:"cw-selected-skill-icon","aria-hidden":!0,children:o.jsx(n,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-selected-skill-meta",children:[o.jsx("span",{className:"cw-selected-skill-name",children:e.name}),o.jsxs("span",{className:"cw-selected-skill-detail",children:[s,e.description?` · ${ec(e.description)}`:""]})]}),o.jsx("button",{type:"button",className:"cw-selected-skill-remove",onClick:t,"aria-label":`移除 ${e.name}`,title:`移除 ${e.name}`,children:o.jsx(Ti,{className:"cw-i cw-i-sm"})})]},`${e.source}:${e.folder}:${e.skillId||e.slug||""}:${e.version||""}`)}const Hw=[{id:"local",label:"本地文件",icon:Tk},{id:"skillspace",label:"AgentKit Skills 中心",icon:CV},{id:"skillhub",label:"火山 Find Skill 技能广场",icon:e1}];function TIe({selected:e,onChange:t}){const[n,s]=g.useState("local"),[i,r]=g.useState(!1),a=Hw.findIndex(c=>c.id===n),l=c=>t(e.filter(u=>zw(u)!==c));return g.useEffect(()=>{if(!i)return;const c=u=>{u.key==="Escape"&&r(!1)};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[i]),o.jsxs("div",{className:"cw-skillspane",children:[o.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",onClick:()=>r(!0),children:[o.jsx("span",{className:"cw-skill-add-icon","aria-hidden":!0,children:o.jsx(_i,{className:"cw-i"})}),o.jsx("span",{children:"添加 Skill"})]}),e.length>0&&o.jsxs("div",{className:"cw-skill-selected",children:[o.jsxs("span",{className:"cw-skill-selected-label",children:["已加入技能 · ",e.length]}),o.jsx("div",{className:"cw-selected-skill-list",children:o.jsx(Ro,{initial:!1,children:e.map(c=>o.jsx(NIe,{s:c,onRemove:()=>l(zw(c))},zw(c)))})})]}),o.jsx(Ro,{children:i&&o.jsx(is.div,{className:"cw-skill-dialog-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},onMouseDown:c=>{c.target===c.currentTarget&&r(!1)},children:o.jsxs(is.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:[o.jsxs("div",{className:"cw-skill-dialog-head",children:[o.jsx("h3",{id:"cw-skill-dialog-title",children:"添加 Skill"}),o.jsx("button",{type:"button",className:"cw-skill-dialog-close","aria-label":"关闭添加 Skill",onClick:()=>r(!1),children:o.jsx(Ti,{className:"cw-i"})})]}),o.jsxs("div",{className:"cw-skill-dialog-body",children:[o.jsxs("div",{className:"cw-skill-sourcetabs",role:"tablist",style:{"--cw-skill-tab-slider-width":`calc((100% - 16px) / ${Hw.length})`,"--cw-active-skill-tab-offset":`calc(${a*100}% + ${a*4}px)`},children:[o.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":!0}),Hw.map(({id:c,label:u,icon:d})=>o.jsxs("button",{type:"button",role:"tab",id:`cw-skill-tab-${c}`,"aria-controls":"cw-skill-tabpanel","aria-selected":n===c,className:`cw-skill-pickertab ${n===c?"is-on":""}`,onClick:()=>s(c),children:[o.jsx(d,{className:"cw-i cw-i-sm"}),u]},c))]}),o.jsxs("div",{id:"cw-skill-tabpanel",className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`cw-skill-tab-${n}`,children:[n==="skillhub"&&o.jsx(KCe,{selected:e,onChange:t}),n==="local"&&o.jsx(sIe,{selected:e,onChange:t}),n==="skillspace"&&o.jsx(rIe,{selected:e,onChange:t})]})]})]})})})]})}function zw(e){return e.source==="skillhub"?`hub:${e.namespace}/${e.slug}`:e.source==="local"?`local:${e.folder}`:`ss:${e.skillSpaceId}/${e.skillId}/${e.version||""}`}function ob({checked:e,onChange:t,title:n}){return o.jsxs("button",{type:"button",className:`cw-toggle ${e?"is-on":""}`,onClick:()=>t(!e),"aria-pressed":e,children:[o.jsx("span",{className:"cw-toggle-text",children:o.jsx("span",{className:"cw-toggle-title",children:n})}),o.jsx("span",{className:"cw-switch","aria-hidden":!0,children:o.jsx(is.span,{className:"cw-switch-knob",layout:!0,transition:{type:"spring",stiffness:520,damping:34}})})]})}function kIe(e,t){var s;let n=e;for(const i of t)if(n=(s=n.subAgents)==null?void 0:s[i],!n)return!1;return!0}function lb(e,t){let n=e;for(const s of t)n=n.subAgents[s];return n}function Dg(e,t,n){if(t.length===0)return n(e);const[s,...i]=t,r=e.subAgents.slice();return r[s]=Dg(r[s],i,n),{...e,subAgents:r}}function AIe(e,t){return Dg(e,t,n=>({...n,subAgents:[...n.subAgents,wi()]}))}function CIe(e,t,n){return Dg(e,t,s=>{const i=s.subAgents.slice();return i.splice(n,0,wi()),{...s,subAgents:i}})}function IIe(e,t){if(t.length===0)return e;const n=t.slice(0,-1),s=t[t.length-1];return Dg(e,n,i=>({...i,subAgents:i.subAgents.filter((r,a)=>a!==s)}))}const jN=e=>!iE(e.agentType),nD=3;function jIe(e,t,n=!1){var i;if(iE(e.agentType))return n?"远程 Agent 只能作为子 Agent":(i=e.a2aRegistry)!=null&&i.registrySpaceId.trim()?null:"缺少 AgentKit 智能体中心";const s=zl(e.name);return s||(t.has(e.name)?"Agent 名称在当前结构中必须唯一":e.description.trim().length===0?"缺少描述":yV(e.agentType)?e.subAgents.length===0?"缺少子 Agent":null:e.instruction.trim().length===0?"缺少系统提示词":null)}function IV(e,t,n=[]){const s=[],i=iE(e.agentType),r=jIe(e,t,n.length===0);return r&&s.push({path:n,name:i?"远程 Agent":e.name.trim()||"未命名",typeLabel:bV(e.agentType).label,problem:r}),jN(e)&&e.subAgents.forEach((a,l)=>s.push(...IV(a,t,[...n,l]))),s}function RIe(e){return`${e.typeLabel}至少需要添加一个子 Agent 后才能调试或发布。`}function jV(e){return 1+e.subAgents.reduce((t,n)=>t+jV(n),0)}function RV(e){const t=X1(e),n=[],s={...t.envValues},i=a=>{var l,c,u,d;for(const f of a.builtinTools??[]){const h=_u.find(p=>p.id===f);h&&n.push({env:h.env})}for(const f of a.mcpTools??[])f.authTokenEnv&&n.push({env:[{key:f.authTokenEnv,required:!1,comment:`${f.name.trim()||"MCP"} Bearer Token`}]});if((l=a.a2aRegistry)!=null&&l.enabled&&(n.push({env:$U}),Object.assign(s,AV(a.a2aRegistry,{includeDefaults:!0}))),a.memory.shortTerm&&n.push({env:((c=$_.find(f=>f.id===(a.shortTermBackend??"local")))==null?void 0:c.env)??[]}),a.memory.longTerm&&n.push({env:((u=H_.find(f=>f.id===(a.longTermBackend??"local")))==null?void 0:u.env)??[]}),a.knowledgebase&&n.push({env:((d=z_.find(f=>f.id===(a.knowledgebaseBackend??fu)))==null?void 0:d.env)??[]}),a.tracing)for(const f of a.tracingExporters??[]){const h=nfe.find(p=>p.id===f);h&&n.push({env:h.env,enableFlag:h.enableFlag})}a.subAgents.forEach(i)};i(t.draft);const r=hz(n);return{specs:r.specs,fixedValues:{...r.fixedValues,...s}}}function OV(e){var n;return{...X1(e).draft,deployment:{feishuEnabled:!!((n=e.deployment)!=null&&n.feishuEnabled)}}}function RN(e){var n;const t=(n=e.modelName)==null?void 0:n.trim();if(t)return t;for(const s of e.subAgents){const i=RN(s);if(i)return i}return""}function MV(e){var s,i;const t=RV(e),n={...((s=e.deployment)==null?void 0:s.envValues)??{},...t.fixedValues};return{...OV(e),deployment:{feishuEnabled:!!((i=e.deployment)!=null&&i.feishuEnabled),envValues:Object.fromEntries(pz(t.specs,n).map(({key:r,value:a})=>[r,a]))}}}function OIe(e){return JSON.stringify(MV(e))}function vx(e,t){return JSON.stringify({draftSnapshot:e,modelName:t.modelName,description:t.description,instruction:t.instruction,optimizations:t.optimizations})}function Ud(e){return JSON.stringify({modelName:e.modelName.trim(),description:e.description.trim(),instruction:e.instruction.trim(),optimizations:e.optimizations})}function MIe({enabled:e,disabledReason:t,variants:n,draftSnapshot:s,input:i,onInput:r,onSend:a,onStartVariant:l,onDeployVariant:c,onAddVariant:u,onRemoveVariant:d,onToggleConfig:f,onCompleteConfig:h,onConfigChange:p,onOpenTrace:m}){const b=n.filter(x=>x.phase!=="ready"?!1:x.runtimeSnapshot===vx(s,x)),v=n.some(x=>x.phase==="sending"),y=b.length>0&&!v;return o.jsxs("section",{className:"cw-ab-workspace","aria-label":"A/B 调试工作台",children:[o.jsx("div",{className:"cw-ab-stage",children:e?o.jsx("div",{className:"cw-ab-grid",style:{"--cw-ab-column-count":n.length},children:n.map((x,E)=>{const w=x.modelName.trim(),_=x.description.trim(),S=x.instruction.trim(),k=Ud(x),T=!!(w&&_&&S&&n.findIndex(P=>Ud(P)===k)!==E),C=!w||!_||!S||T,I=!!(x.runtimeSnapshot&&x.runtimeSnapshot!==vx(s,x)),j=x.phase==="starting",L=x.phase==="ready"&&!I,z=j||x.phase==="sending",D=L&&x.phase!=="sending"&&x.messages.some(P=>P.role==="assistant"),F=z||x.configOpen||C,A=w?_?S?T?"该配置与已有测试组相同":"":"请填写系统提示词":"请填写描述":"请先选择模型",O=j?"正在启动":I?"应用配置并重启":L||x.phase==="error"?"重新启动环境":"启动环境";return o.jsx("article",{className:"cw-ab-card",children:o.jsxs("div",{className:`cw-ab-card-inner${x.configOpen?" is-flipped":""}`,children:[o.jsxs("section",{className:"cw-ab-card-face cw-ab-card-front","aria-hidden":x.configOpen,children:[o.jsxs("header",{className:"cw-ab-card-head",children:[o.jsxs("div",{className:"cw-ab-card-title",children:[o.jsx("strong",{children:x.name}),o.jsx("span",{children:x.modelName||"默认模型"})]}),o.jsxs("div",{className:"cw-ab-card-actions",children:[o.jsx("button",{type:"button",className:"cw-ab-config-trigger",disabled:x.configOpen||z,onClick:()=>f(x.id),children:"测试配置"}),x.id!=="baseline"&&o.jsx("button",{type:"button",className:"cw-ab-remove","aria-label":`删除${x.name}`,disabled:x.configOpen||z,onClick:()=>d(x.id),children:o.jsx(eD,{className:"cw-i"})})]})]}),o.jsx("div",{className:"cw-ab-conversation",children:x.error?o.jsx(xx,{message:x.error,className:"cw-debug-error-detail",defaultExpanded:!0}):j?o.jsxs("div",{className:"cw-ab-empty cw-ab-starting",children:[o.jsx(mn,{className:"cw-i cw-spin"}),o.jsx("span",{children:"正在创建独立测试环境"})]}):I?o.jsx("div",{className:"cw-ab-empty cw-ab-launch",children:o.jsx("span",{children:"配置已变更,请重新启动此环境"})}):x.messages.length===0?o.jsx("div",{className:"cw-ab-empty cw-ab-launch",children:L?o.jsxs(o.Fragment,{children:[o.jsx("strong",{className:"cw-ab-ready-title",children:"已就绪"}),o.jsx("span",{className:"cw-ab-launch-hint",children:"可在下方输入测试消息"})]}):o.jsx("span",{className:"cw-ab-launch-hint",children:A||"启动环境后即可加入本轮测试"})}):x.messages.map((P,$)=>o.jsx("div",{className:`cw-debug-msg cw-debug-msg-${P.role}`,children:o.jsx("div",{className:"cw-debug-content",children:P.role==="user"?P.content:P.error?o.jsx(xx,{message:P.error,className:"cw-debug-msg-error",defaultExpanded:!0}):P.blocks&&P.blocks.length>0?o.jsx(t2,{blocks:P.blocks,onAction:()=>{}}):P.content?P.content:$===x.messages.length-1&&x.phase==="sending"?o.jsx(fH,{}):null})},$))}),o.jsxs("footer",{className:"cw-ab-deploy-footer",children:[o.jsx("button",{type:"button",className:"cw-ab-trace",disabled:!D,title:D?`查看${x.name}调用链路`:"完成一次调试后可查看调用链路",onClick:()=>m(x.id),children:"调用链路"}),o.jsxs("button",{type:"button",className:"cw-ab-start cw-ab-footer-start",disabled:F,title:A||void 0,onClick:()=>l(x.id),children:[L||I||x.phase==="error"?o.jsx(_ee,{className:"cw-i"}):o.jsx(bIe,{className:"cw-i cw-debug-run-icon"}),O]}),o.jsx("button",{type:"button",className:"cw-ab-deploy",disabled:z||!w,onClick:()=>c(x.id),children:"部署该配置"})]})]}),o.jsxs("section",{className:"cw-ab-card-face cw-ab-card-back","aria-hidden":!x.configOpen,children:[o.jsxs("header",{className:"cw-ab-config-head",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"测试配置"}),o.jsx("span",{children:x.name})]}),o.jsxs("div",{className:"cw-ab-config-head-actions",children:[x.id!=="baseline"&&o.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger cw-ab-config-remove","aria-label":`删除${x.name}`,title:"删除配置组",disabled:z,onClick:()=>d(x.id),children:o.jsx(eD,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:`cw-ab-config-done-wrap${A?" is-disabled":""}`,tabIndex:A?0:void 0,children:[o.jsx("button",{type:"button",className:"cw-ab-config-done",disabled:!x.configOpen||C,onClick:()=>h(x.id),children:x.id==="baseline"?"完成配置":"完成并启动"}),A&&o.jsx("span",{className:"cw-ab-config-done-tip",role:"tooltip",children:A})]})]})]}),o.jsxs("div",{className:"cw-ab-config",children:[o.jsxs("label",{children:[o.jsx("span",{children:"模型"}),o.jsx("input",{value:x.modelName,placeholder:"使用 Agent 当前模型",disabled:!x.configOpen,onChange:P=>p(x.id,"modelName",P.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"描述"}),o.jsx("textarea",{rows:2,value:x.description,disabled:!x.configOpen,onChange:P=>p(x.id,"description",P.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"系统提示词"}),o.jsx("textarea",{rows:5,value:x.instruction,disabled:!x.configOpen,onChange:P=>p(x.id,"instruction",P.target.value)})]}),o.jsxs("fieldset",{className:"cw-ab-optimizations-disabled",children:[o.jsxs("legend",{children:[o.jsx("span",{children:"优化选项"}),o.jsx("em",{children:"待开放"})]}),o.jsx("div",{className:"cw-ab-optimization-list",children:LV.map(P=>o.jsx(mV,{checked:x.optimizations.includes(P.id),disabled:!0,label:P.label,className:"cw-ab-optimization-checkbox"},P.id))})]}),o.jsx("p",{children:"设置完成后返回正面,再启动当前测试环境。"})]})]})]})},x.id)})}):o.jsx("div",{className:"cw-debug-empty",children:t})}),o.jsxs("div",{className:"cw-ab-composer",children:[o.jsxs("div",{className:"cw-debug-composerbox",children:[o.jsx("textarea",{className:"cw-debug-input",rows:1,value:i,placeholder:y?"输入测试消息,将发送到所有已启动测试组...":"请先启动至少一个测试组",disabled:!y,onChange:x=>r(x.target.value),onKeyDown:x=>{n2(x.nativeEvent)||x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),a())}}),o.jsx("button",{type:"button",className:"cw-debug-send",title:"发送",disabled:!y||!i.trim(),onClick:a,children:v?o.jsx(mn,{className:"cw-i cw-spin"}):o.jsx(dB,{className:"cw-i"})})]}),e&&n.length<3&&o.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft cw-ab-add",onClick:u,children:[o.jsx(_i,{className:"cw-i"}),"添加对照组"]})]})]})}const cb=[{id:"build",label:"架构"},{id:"validate",label:"调试"},{id:"publish",label:"发布"}],LV=[{id:"context",label:"上下文优化",description:"压缩历史对话,保留与当前任务相关的信息"},{id:"grounding",label:"幻觉抑制",description:"对不确定内容要求依据,并明确表达未知"},{id:"tools",label:"工具调用优化",description:"减少重复调用,优先复用可信的工具结果"},{id:"latency",label:"响应加速",description:"缓存稳定上下文,降低重复推理开销"}];function LIe({mode:e}){const t=e==="validate"?"调试您的智能体":e==="publish"?"准备好部署您的智能体":"个性化您的智能体架构";return o.jsx("header",{className:"cw-workspace-header",children:o.jsx("h1",{children:t})})}function DIe({mode:e,busy:t,onChange:n,assistant:s}){const i=cb.findIndex(l=>l.id===e),r=cb[i-1],a=cb[i+1];return o.jsxs("footer",{className:"cw-workspace-footer",children:[o.jsxs("div",{className:`cw-workspace-nav-actions${s?" has-assistant":""}`,children:[o.jsx("button",{type:"button",className:`cw-workspace-nav-button${e==="build"?" is-placeholder":""}`,"aria-hidden":e==="build"||void 0,tabIndex:e==="build"?-1:0,disabled:!r||t,onClick:()=>r&&n(r.id),children:"上一步"}),o.jsx("span",{"aria-hidden":"true"}),s?o.jsx("div",{className:"cw-workspace-ai-slot",children:s}):null,e==="publish"?o.jsx("div",{id:"cw-publish-primary-action",className:"cw-publish-action-slot"}):o.jsx("button",{type:"button",className:"cw-workspace-nav-button is-primary",disabled:!a||t,onClick:()=>a&&n(a.id),children:"下一步"})]}),o.jsx("nav",{className:"cw-workspace-progress","aria-label":"Agent 创建进度",children:cb.map((l,c)=>{const u=l.id===e;return o.jsx("button",{type:"button",className:`${u?"is-active":""}${cn(l.id),children:o.jsx("span",{"aria-hidden":"true"})},l.id)})})]})}function PIe({onBack:e,onCreate:t,onAgentAdded:n,initialDraft:s,features:i,onDeploymentTaskChange:r,deploymentTarget:a,initialDeployRegion:l="cn-beijing",onDeploymentComplete:c,onDeploymentStarted:u,onDraftChange:d,onDiscard:f}){var Ba,Ui,Mr,ca,cc,Mn,uo,uc,ie,Zt,Ln,Ns,Wt,Jn;const[h,p]=g.useState(()=>s??wi()),[m,b]=g.useState(""),[v,y]=g.useState(!1),[x,E]=g.useState(!1),[w,_]=g.useState(null),S=m.trim(),k=S.length>0&&S.length{L.current=d},[d]),g.useEffect(()=>{var se;I!==C.current&&(C.current=I,(se=L.current)==null||se.call(L,h,j))},[h,j,I]);const[z,D]=g.useState("build"),[F,A]=g.useState(!1),[O,P]=g.useState(0),[$,R]=g.useState(null),[Y,J]=g.useState(!1),[U,te]=g.useState((a==null?void 0:a.region)??l),K=(i==null?void 0:i.generatedAgentTestRun)===!0,V=(i==null?void 0:i.generatedAgentTestRunDisabledReason)||"当前后端暂不支持生成 Agent 调试运行。",[W,q]=g.useState(()=>[{id:"baseline",name:"基准组",modelName:RN(s??wi()),description:(s??wi()).description,instruction:(s??wi()).instruction,optimizations:[],configOpen:!1,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]),[ue,me]=g.useState("baseline"),Se=g.useRef(1),de=g.useRef(!1),ge=g.useRef(new Map),[Me,ve]=g.useState(0),[re,ke]=g.useState(""),[we,Je]=g.useState(null),[Le,Ve]=g.useState(!1),[_e,He]=g.useState(!1),Pe=g.useRef(null),[qe,Z]=g.useState(""),[ae,ne]=g.useState(!1),[be,Fe]=g.useState(!1),[Ke,bt]=g.useState([]),dt=g.useRef(null),cn=g.useRef({});async function Ut(){const se=new Set([...ge.current.values()].map(({run:pe})=>pe.runId)),Te=R2().filter(pe=>!se.has(pe));Te.length&&await Promise.all(Te.map(async pe=>{try{await ad(pe),Zh(pe)}catch(et){console.warn("清理遗留调试运行失败",et)}}))}g.useEffect(()=>(Ut(),()=>{for(const{run:se}of ge.current.values())ad(se.runId).then(()=>Zh(se.runId)).catch(Te=>console.warn("清理调试运行失败",Te));ge.current.clear()}),[]),g.useEffect(()=>()=>{var se;(se=Pe.current)==null||se.call(Pe,!1),Pe.current=null},[]);const wt=g.useRef(null);wt.current||(wt.current=({meta:se,children:Te})=>o.jsxs("section",{ref:pe=>{cn.current[se.id]=pe},id:`cw-sec-${se.id}`,"data-step-id":se.id,className:"cw-section",children:[o.jsx("header",{className:"cw-sec-head",children:o.jsx("h2",{className:"cw-sec-title",children:se.label})}),o.jsx("div",{className:"cw-sec-body",children:Te})]}));const $t=kIe(h,Ke)?Ke:[],Ge=lb(h,$t),Yt=$t.length===0,it=`cw-model-advanced-${$t.join("-")||"root"}`,ct=`cw-a2a-registry-advanced-${$t.join("-")||"root"}`,Qe=se=>p(Te=>Dg(Te,$t,pe=>({...pe,...se}))),vt=(se,Te)=>p(pe=>{var et;return{...pe,deployment:{...pe.deployment??{feishuEnabled:!1},envValues:{...((et=pe.deployment)==null?void 0:et.envValues)??{},[se]:Te}}}}),ye=se=>Qe({a2aRegistry:{...Ge.a2aRegistry??{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},...se}}),Ze=(se,Te)=>{if(!(se in tD))return;const pe=tD[se];ye({[pe]:Te}),vt(se,Te)},xt=se=>{if(!(Yt&&se==="a2a")){if(se==="a2a"){Qe({agentType:se,a2aRegistry:{...Ge.a2aRegistry??{registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},enabled:!0}});return}Qe({agentType:se,a2aRegistry:Ge.a2aRegistry?{...Ge.a2aRegistry,enabled:!1}:void 0})}},rn=(se,Te)=>{p(se),Te&&bt(Te)},Hn=async()=>{const se=m.trim();if(!(!se||v)&&!(se.length{const Te=lb(h,se);if(!jN(Te)||se.length>=nD)return;const pe=AIe(h,se),et=lb(pe,se).subAgents.length-1;rn(pe,[...se,et])},pt=(se,Te)=>{const pe=lb(h,se);if(!jN(pe)||se.length>=nD)return;const et=Math.max(0,Math.min(Te,pe.subAgents.length)),pn=CIe(h,se,et);rn(pn,[...se,et])},gn=()=>{window.confirm("清空根 Agent 的全部配置和子 Agent?此操作无法撤销。")&&(p(wi()),bt([]),A(!1))},en=se=>{if(se.length===0){gn();return}rn(IIe(h,se),se.slice(0,-1))},St=Ge.builtinTools??[],an=Ge.mcpTools??[],ls=Ge.selectedSkills??[],Rs=se=>Qe({builtinTools:St.includes(se)?St.filter(Te=>Te!==se):[...St,se]}),Rn=yV(Ge.agentType),Wn=iE(Ge.agentType),bn=g.useMemo(()=>eH(h),[h]),yn=Wn?null:zl(Ge.name)??(bn.has(Ge.name)?"Agent 名称在当前结构中必须唯一":null),Xn=yn!==null,zs=!Wn&&Ge.description.trim().length===0,pi=Ge.instruction.trim().length===0,bs=Wn&&!((Ba=Ge.a2aRegistry)!=null&&Ba.registrySpaceId.trim()),Js=se=>F&&se?`is-error cw-error-shake-${O%2}`:"",On=g.useMemo(()=>IV(h,bn),[h,bn]),cs=On.length===0,Qn=g.useMemo(()=>OIe(h),[h]),us=W.find(se=>se.id===ue)??W[0],Os=g.useMemo(()=>RV(h),[h]),Ms=se=>{var Te;(Te=cn.current[se])==null||Te.scrollIntoView({behavior:"smooth",block:"start"})},Ss=()=>cs?!0:(A(!0),P(se=>se+1),On[0]&&(bt(On[0].path),window.requestAnimationFrame(()=>Ms(On[0].problem==="缺少子 Agent"?"type":"basic"))),!1),_s=async()=>{Je(null);const se=[...ge.current.values()];ge.current.clear(),ve(0),q(Te=>Te.map(pe=>({...pe,phase:"idle",runtimeSnapshot:"",messages:[],error:null}))),await Promise.all(se.map(async({run:Te})=>{try{await ad(Te.runId),Zh(Te.runId)}catch(pe){console.warn("清理调试运行失败",pe)}}))},un=async se=>{const Te=ge.current.get(se);if(Te){ge.current.delete(se),ve(ge.current.size);try{await ad(Te.run.runId),Zh(Te.run.runId)}catch(pe){console.warn("清理调试运行失败",pe)}}},on=se=>{const Te=ge.current.get(se),pe=W.find(et=>et.id===se);!Te||!pe||Je({runId:Te.run.runId,sessionId:Te.sessionId,variantName:pe.name})},dn=se=>{const Te=Pe.current;Pe.current=null,Te==null||Te(se)},ce=()=>{_e||(Ve(!1),dn(!1))},Ie=async()=>{if(!_e){He(!0);try{await _s(),Ve(!1),dn(!0)}finally{He(!1)}}},Ue=async()=>z!=="validate"||Me===0?!0:Pe.current?!1:new Promise(se=>{Pe.current=se,Ve(!0)}),nt=async se=>{var pe;if(!await Ue())return;if(Z(""),!Ss()){D("build");return}const Te=mz(Os.specs,((pe=h.deployment)==null?void 0:pe.envValues)??{});if(Te){Z(`${Te.spec.comment||Te.spec.key}:${Te.error}`),D("build");return}J(!0);try{const et=se?W.find(Tt=>Tt.id===se):us;et&&me(et.id);const pn=et?{...h,modelName:et.modelName||h.modelName,description:et.description,instruction:et.instruction}:h,Gn=await o1(OV(pn));pn!==h&&p(pn),R(Gn),D("publish")}catch(et){Z(et instanceof Error?et.message:String(et))}finally{J(!1)}},at=async se=>{if(!K||Y||!Ss())return;const Te=W.find(ln=>ln.id===se);if(!Te||Te.phase==="starting"||Te.phase==="sending")return;const pe=Te.modelName.trim(),et=Te.description.trim(),pn=Te.instruction.trim(),Gn=Ud(Te),Tt=W.findIndex(ln=>ln.id===se),ys=W.findIndex(ln=>Ud(ln)===Gn);if(!pe||!et||!pn||ys!==Tt)return;const Ts=vx(Qn,Te);q(ln=>ln.map(ks=>ks.id===se?{...ks,configOpen:!1,phase:"starting",messages:[],error:null}:ks)),ke("");let tn=null;try{await un(se),await Ut();const ln={...h,modelName:Te.modelName||h.modelName,description:Te.description,instruction:Te.instruction};tn=await f8(MV(ln),a?{runtimeId:a.runtimeId,region:a.region}:void 0),pIe(tn.runId);const ks=await h8(tn.runId,"test_user");ge.current.set(se,{run:tn,sessionId:ks}),ve(ge.current.size),q(Xi=>Xi.map(Lr=>Lr.id===se?{...Lr,phase:"ready",runtimeSnapshot:Ts}:Lr))}catch(ln){if(tn)try{await ad(tn.runId),Zh(tn.runId)}catch(ks){console.warn("清理调试运行失败",ks)}q(ks=>ks.map(Xi=>Xi.id===se?{...Xi,phase:"error",runtimeSnapshot:"",error:ln instanceof Error?ln.message:String(ln)}:Xi))}},We=async()=>{const se=re.trim(),Te=W.filter(et=>et.phase==="ready"&&et.runtimeSnapshot===vx(Qn,et)&&ge.current.has(et.id));if(!se||Te.length===0)return;ke("");const pe=new Set(Te.map(et=>et.id));q(et=>et.map(pn=>pe.has(pn.id)?{...pn,phase:"sending",messages:[...pn.messages,{role:"user",content:se},{role:"assistant",content:"",blocks:[]}]}:pn)),await Promise.all(Te.map(async et=>{const pn=ge.current.get(et.id);if(pn)try{let Gn=Sa();for await(const Tt of m8({runId:pn.run.runId,userId:"test_user",sessionId:pn.sessionId,text:se})){const ys=Tt.error||Tt.errorMessage||Tt.error_message;if(ys||(Gn=gf(Gn,Tt)),q(Ts=>Ts.map(tn=>{if(tn.id!==et.id)return tn;const ln=[...tn.messages],ks={...ln[ln.length-1]};return ys?ks.error=String(ys):(ks.content=Gn.blocks.filter(Xi=>Xi.kind==="text").map(Xi=>Xi.text).join(""),ks.blocks=Gn.blocks),ln[ln.length-1]=ks,{...tn,messages:ln}})),ys)break}}catch(Gn){q(Tt=>Tt.map(ys=>{if(ys.id!==et.id)return ys;const Ts=[...ys.messages],tn={...Ts[Ts.length-1]};return tn.error=Gn instanceof Error?Gn.message:String(Gn),Ts[Ts.length-1]=tn,{...ys,messages:Ts}}))}finally{q(Gn=>Gn.map(Tt=>Tt.id===et.id?{...Tt,phase:"ready"}:Tt))}}))},_t=()=>{q(se=>{if(se.length>=3)return se;const Te=Se.current++,pe=`variant-${Te}`;return[...se,{id:pe,name:`对照组 ${Te}`,modelName:h.modelName??"",description:h.description,instruction:h.instruction,optimizations:[],configOpen:!0,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]})},De=async se=>{await un(se),q(Te=>Te.filter(pe=>pe.id!==se)),ue===se&&me("baseline")},xn=(se,Te)=>q(pe=>pe.map(et=>et.id===se?{...et,...Te}:et)),Zn=(se,Te,pe)=>{se==="baseline"&&Te==="modelName"&&(de.current=!0),xn(se,{[Te]:pe}),!(ue!==se||se==="baseline")&&me("baseline")},ki=se=>{const Te=W.find(Ts=>Ts.id===se);if(!Te)return;const pe=Te.modelName.trim(),et=Te.description.trim(),pn=Te.instruction.trim(),Gn=Ud(Te),Tt=W.findIndex(Ts=>Ts.id===se),ys=W.findIndex(Ts=>Ud(Ts)===Gn);if(!(!pe||!et||!pn||ys!==Tt)){if(se==="baseline"){xn(se,{configOpen:!1});return}at(se)}},zn=async(se,Te,pe)=>{var Gn;const et=(Gn=h.deployment)==null?void 0:Gn.network,pn=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 dg(se.name,se.files,{region:(a==null?void 0:a.region)??U,projectName:"default",network:pn},{...pe,onStage:Te,runtimeId:a==null?void 0:a.runtimeId,appName:a==null?void 0:a.appName,description:h.description})},Ht=()=>{Ss()&&(q(se=>se.map(Te=>Te.id==="baseline"&&!ge.current.has(Te.id)?{...Te,modelName:de.current?Te.modelName:RN(h),description:h.description,instruction:h.instruction}:Te)),D("validate"))},Nt=async se=>{if(se==="publish"){if(!Ss())return;$?D("publish"):nt();return}if(se==="validate"){Ht();return}await Ue()&&D(se)},En=wt.current,Vn=se=>gIe.find(Te=>Te.id===se),Pa=o.jsx("section",{className:`cw-ai-compose${v?" is-generating":""}${x?" is-success":""}`,"aria-label":"AI 自动填写 Agent 配置",children:o.jsx(Ro,{initial:!1,mode:"wait",children:x?o.jsxs(is.div,{className:"cw-ai-compose-success",role:"status",initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},transition:{duration:.22,ease:[.22,1,.36,1]},children:[o.jsx("span",{className:"cw-ai-success-check","aria-hidden":!0}),o.jsx("strong",{children:"生成成功"}),o.jsx("button",{type:"button",className:"cw-ai-regenerate",onClick:()=>E(!1),children:"重新生成"})]},"success"):o.jsxs(is.div,{className:"cw-ai-compose-entry",initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},transition:{duration:.2,ease:[.22,1,.36,1]},children:[o.jsxs("form",{className:"cw-ai-compose-form",onSubmit:se=>{se.preventDefault(),Hn()},children:[o.jsx("input",{type:"text",value:m,maxLength:8e3,disabled:v,placeholder:"描述目标,使用 doubao-seed-2-0-lite-260428 模型一键生成配置","aria-invalid":!!k,"aria-describedby":k?"ai-requirement-error":void 0,onChange:se=>b(se.target.value),onKeyDown:se=>{se.key==="Enter"&&(se.preventDefault(),Hn())}}),o.jsx("button",{type:"submit",disabled:v||!S||!!k,"aria-label":v?"正在智能生成":"智能生成",children:v?o.jsx("span",{className:"cw-ai-orb","aria-hidden":!0,children:o.jsx("span",{})}):"智能生成"})]}),k&&o.jsx("p",{className:"cw-ai-requirement-error",id:"ai-requirement-error",role:"alert",children:k})]},"compose")})});return o.jsxs("div",{className:`cw-root is-${z}`,children:[o.jsx(LIe,{mode:z}),qe&&o.jsx(xx,{className:"cw-workspace-alert",message:qe}),o.jsxs("main",{className:"cw-workspace-main",id:"cw-workspace-main",children:[z==="build"&&o.jsx("div",{className:"cw-build-workspace",children:o.jsxs("div",{className:"cw-editor",children:[o.jsx(Mm,{draft:h,direction:"horizontal",selectedPath:$t,onSelect:bt,onAdd:ut,onInsert:pt,onDelete:en}),o.jsx("div",{className:"cw-detail",children:o.jsx("div",{className:"cw-detail-scroll",ref:dt,children:o.jsx("div",{className:"cw-detail-inner",children:o.jsx("div",{className:"cw-lower",children:o.jsxs("div",{className:"cw-form-col",children:[o.jsxs(En,{meta:Vn("type"),children:[o.jsx(AN,{className:"cw-agent-type-options","aria-label":"Agent 类型",value:Ge.agentType??"llm",onChange:xt,children:HCe.map(se=>{const Te=(Ge.agentType??"llm")===se.id,pe=Yt&&se.id==="a2a",et=pe?"cw-remote-agent-disabled-hint":void 0;return o.jsxs("div",{"data-agent-type":se.id,className:`cw-agent-type-option ${Te?"is-on":""} ${pe?"is-disabled":""}`,tabIndex:pe?0:void 0,"aria-describedby":et,children:[o.jsx(AN.Item,{value:se.id,disabled:pe,block:!0,className:"cw-agent-type-control",children:o.jsx("span",{className:"cw-agent-type-copy",children:o.jsx("strong",{children:yIe[se.id]})})}),pe&&o.jsx("span",{id:et,className:"cw-agent-type-disabled-hint",role:"tooltip",children:"远程智能体只能作为子步骤使用"})]},se.id)})}),F&&Rn&&Ge.subAgents.length===0&&o.jsx("span",{className:"cw-error-text",children:RIe({name:Ge.name.trim()||"未命名",typeLabel:bV(Ge.agentType).label})})]}),o.jsx(En,{meta:Vn("basic"),children:o.jsxs("div",{className:"cw-form",children:[!Wn&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:[Yt?"Agent 名称":"名称",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("input",{className:`cw-input ${Js(Xn)}`,value:Ge.name,placeholder:"assistant",onChange:se=>Qe({name:se.target.value})}),F&&yn?o.jsx("span",{className:"cw-error-text",children:yn}):o.jsx("span",{className:"cw-help",children:"遵循 Google ADK 命名规则,且在执行流程中保持唯一。"})]}),o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:[Yt?"描述":"智能体描述",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("textarea",{className:`cw-textarea cw-textarea-sm ${Js(zs)}`,value:Ge.description,placeholder:"简要描述这个 Agent 的用途,便于团队识别…",onChange:se=>Qe({description:se.target.value})}),F&&zs?o.jsx("span",{className:"cw-error-text",children:"描述为必填项"}):o.jsx("span",{className:"cw-help",children:Yt?"完整描述会保留;部署时会自动整理为符合 Runtime 规范的单行描述。":"描述会显示在 Agent 列表与选择器中。"})]})]}),Rn?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"cw-section-desc cw-dependency-hint",children:"这是一个协作容器,本身不生成回答。请在左侧画布中 添加任务步骤,并通过拖拽调整它们的位置。"}),Ge.agentType==="loop"&&o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"最大轮次"}),o.jsx("input",{className:"cw-input",type:"number",min:1,value:Ge.maxIterations??3,onChange:se=>Qe({maxIterations:Math.max(1,Number(se.target.value)||1)})}),o.jsx("span",{className:"cw-help",children:"循环编排反复执行子 Agent,直到满足条件或达到该轮次上限。"})]})]}):Wn?o.jsxs("div",{className:"cw-field cw-remote-center-fields",children:[o.jsxs("div",{className:"cw-remote-center-head",children:[o.jsxs("div",{className:"cw-label",children:["AgentKit 智能体中心",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("p",{className:"cw-help cw-remote-center-description",children:"远程 Agent 的名称、描述和能力来自中心返回的 Agent Card。 系统会根据每轮任务动态发现并挂载匹配的 Agent。"})]}),o.jsx(wIe,{value:((Ui=Ge.a2aRegistry)==null?void 0:Ui.registrySpaceId)??"",region:((Mr=Ge.a2aRegistry)==null?void 0:Mr.registryRegion)||Ta.region,invalid:F&&bs,onChange:se=>Ze(kV,se)}),o.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":be,"aria-controls":ct,onClick:()=>Fe(se=>!se),children:[o.jsx("span",{children:"更多选项"}),o.jsx(Ql,{className:`cw-more-options-chevron ${be?"is-open":""}`,"aria-hidden":!0})]}),o.jsx(Ro,{initial:!1,children:be&&o.jsx(is.div,{id:ct,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:o.jsx(Jh,{env:xIe,values:AV(Ge.a2aRegistry,{includeDefaults:!1}),onChange:Ze})})}),F&&bs&&o.jsx("span",{className:"cw-error-text",children:"请选择 AgentKit 智能体中心"})]}):o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:["系统提示词",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx(g.Suspense,{fallback:o.jsx("div",{className:"cw-markdown-loading",role:"status",children:"正在加载 Markdown 编辑器…"}),children:o.jsx(hIe,{value:Ge.instruction,invalid:pi,onChange:se=>Qe({instruction:se})})}),F&&pi?o.jsx("span",{className:"cw-error-text",children:"系统提示词为必填项"}):o.jsx("span",{className:"cw-help",children:"支持 Markdown 快捷输入,例如键入 ## 加空格创建二级标题。"})]})]})}),!Rn&&!Wn&&o.jsxs(o.Fragment,{children:[o.jsx(En,{meta:Vn("model"),children:o.jsxs("div",{className:"cw-form",children:[o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"模型名称"}),o.jsx("input",{className:"cw-input",value:Ge.modelName??"",placeholder:"doubao-seed-2-1-pro-260628",onChange:se=>Qe({modelName:se.target.value})})]}),o.jsxs("button",{type:"button",className:"cw-more-options cw-model-more-options","aria-expanded":ae,"aria-controls":it,onClick:()=>ne(se=>!se),children:[o.jsx("span",{children:"更多选项"}),o.jsx(Ql,{className:`cw-more-options-chevron ${ae?"is-open":""}`,"aria-hidden":!0})]}),o.jsx(Ro,{initial:!1,children:ae&&o.jsxs(is.div,{id:it,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:[o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"服务商 Provider"}),o.jsx("input",{className:"cw-input",value:Ge.modelProvider??"",placeholder:"openai",onChange:se=>Qe({modelProvider:se.target.value})})]}),o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"API Base"}),o.jsx("input",{className:"cw-input",value:Ge.modelApiBase??"",placeholder:"https://ark.cn-beijing.volces.com/api/v3/",onChange:se=>Qe({modelApiBase:se.target.value})}),o.jsx("span",{className:"cw-help cw-dependency-hint",children:"留空则使用 VeADK 默认模型配置;Ark API Key 会由 Studio 服务端凭据自动获取。其他服务商的 Key 可在部署页添加。"})]})]})})]})}),o.jsx(En,{meta:Vn("tools"),children:o.jsxs("div",{className:"cw-form",children:[o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"内置工具"}),o.jsx("span",{className:"cw-help",children:"勾选 VeADK 提供的内置能力,生成时会自动补全 import 与所需环境变量。"}),o.jsx("div",{className:"cw-tools-list-shell",children:o.jsx(EIe,{items:HU,selected:St,onToggle:Rs,scrollRows:6})}),o.jsx(Ro,{initial:!1,children:St.includes("run_code")&&o.jsxs(is.div,{className:"cw-tool-config",initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.16,ease:"easeOut"},children:[o.jsxs("div",{className:"cw-tool-config-head",children:[o.jsx("span",{className:"cw-label",children:"代码执行配置"}),o.jsx("span",{className:"cw-help",children:"指定 AgentKit 代码执行沙箱。"})]}),o.jsx(Jh,{env:((ca=_u.find(se=>se.id==="run_code"))==null?void 0:ca.env)??[],values:((cc=h.deployment)==null?void 0:cc.envValues)??{},onChange:vt})]})})]}),o.jsxs("div",{className:"cw-field cw-mcp-field",children:[o.jsx("label",{className:"cw-label",children:"MCP 工具"}),o.jsx(_Ie,{tools:an,onChange:se=>Qe({mcpTools:se})})]})]})}),o.jsx(En,{meta:Vn("skills"),children:o.jsx("div",{className:"cw-form",children:o.jsx(TIe,{selected:ls,onChange:se=>Qe({selectedSkills:se})})})}),o.jsx(En,{meta:Vn("knowledge"),children:o.jsxs("div",{className:"cw-form cw-toggle-stack",children:[o.jsx(ob,{checked:Ge.knowledgebase,onChange:se=>Qe({knowledgebase:se}),title:"知识库",desc:"启用外部知识检索(RAG),让 Agent 基于你的资料作答。",icon:Ib}),Ge.knowledgebase&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"知识库后端"}),o.jsx(Uw,{options:z_,value:Ge.knowledgebaseBackend,onChange:se=>Qe({knowledgebaseBackend:se,knowledgebaseIndex:se==="viking"?Ge.knowledgebaseIndex:""})}),(Ge.knowledgebaseBackend??fu)==="viking"&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"VikingDB 知识库"}),o.jsx(SIe,{value:Ge.knowledgebaseIndex??"",onChange:se=>Qe({knowledgebaseIndex:se})})]}),o.jsx(Jh,{env:((Mn=z_.find(se=>se.id===(Ge.knowledgebaseBackend??fu)))==null?void 0:Mn.env)??[],values:((uo=h.deployment)==null?void 0:uo.envValues)??{},onChange:vt})]})]})}),Yt&&o.jsx(En,{meta:Vn("memory"),children:o.jsxs("div",{className:"cw-form cw-toggle-stack",children:[o.jsx(ob,{checked:Ge.memory.shortTerm,onChange:se=>Qe({memory:{...Ge.memory,shortTerm:se}}),title:"短期记忆",desc:"在单次会话内保留上下文,跨轮次记住对话内容。",icon:gB}),Ge.memory.shortTerm&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"短期记忆后端"}),o.jsx(Uw,{options:$_,value:Ge.shortTermBackend,onChange:se=>Qe({shortTermBackend:se})}),o.jsx(Jh,{env:((uc=$_.find(se=>se.id===(Ge.shortTermBackend??"local")))==null?void 0:uc.env)??[],values:((ie=h.deployment)==null?void 0:ie.envValues)??{},onChange:vt})]}),o.jsx(ob,{checked:Ge.memory.longTerm,onChange:se=>Qe({memory:{...Ge.memory,longTerm:se}}),title:"长期记忆",desc:"跨会话持久化关键信息,让 Agent 记住历史偏好。",icon:Ib}),Ge.memory.longTerm&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"长期记忆后端"}),o.jsx(Uw,{options:H_,value:Ge.longTermBackend,onChange:se=>Qe({longTermBackend:se})}),o.jsx(Jh,{env:((Zt=H_.find(se=>se.id===(Ge.longTermBackend??"local")))==null?void 0:Zt.env)??[],values:((Ln=h.deployment)==null?void 0:Ln.envValues)??{},onChange:vt}),o.jsx(ob,{checked:!!Ge.autoSaveSession,onChange:se=>Qe({autoSaveSession:se}),title:"自动保存会话到长期记忆",desc:"会话结束时自动把内容写入长期记忆,无需手动调用。",icon:Ib})]})]})})]})]})})})})})]})}),z==="validate"&&o.jsx("div",{className:"cw-validation-workspace",children:o.jsx("div",{className:"cw-validation-content",children:o.jsx(MIe,{enabled:K,disabledReason:V,variants:W,draftSnapshot:Qn,input:re,onInput:ke,onSend:We,onStartVariant:at,onDeployVariant:se=>void nt(se),onAddVariant:_t,onRemoveVariant:De,onToggleConfig:se=>{const Te=W.find(pe=>pe.id===se);Te&&xn(se,{configOpen:!Te.configOpen})},onCompleteConfig:ki,onConfigChange:Zn,onOpenTrace:on})})}),z==="publish"&&o.jsx("div",{className:"cw-preview-body",children:$?o.jsx(Z1,{embedded:!0,project:$,agentDraft:h,agentName:h.name||"未命名 Agent",agentCount:jV(h),releaseConfiguration:us?{modelName:us.modelName||h.modelName||"默认模型",description:us.description,instruction:us.instruction,optimizations:us.optimizations.flatMap(se=>{const Te=LV.find(pe=>pe.id===se);return Te?[Te.label]:[]})}:void 0,onChange:R,onDeploy:zn,onAgentAdded:n,onDeploymentTaskChange:r,deploymentActionLabel:a?"更新并发布":"部署",deploymentActionTargetId:"cw-publish-primary-action",deploymentRuntimeId:a==null?void 0:a.runtimeId,onDeploymentStarted:u,onDeploymentComplete:c,feishuEnabled:!!((Ns=h.deployment)!=null&&Ns.feishuEnabled),onFeishuEnabledChange:se=>{const Te={...h,deployment:{...h.deployment??{feishuEnabled:!1},feishuEnabled:se}};p(Te)},deploymentEnv:Os.specs,deploymentEnvValues:{...(Wt=h.deployment)==null?void 0:Wt.envValues,...Os.fixedValues},onDeploymentEnvChange:vt,network:(Jn=h.deployment)==null?void 0:Jn.network,onNetworkChange:se=>p(Te=>({...Te,deployment:{...Te.deployment??{feishuEnabled:!1},network:se}})),deployRegion:U,onDeployRegionChange:te,deploymentTelemetrySource:"custom_create",onExportYaml:()=>mIe(`${h.name||"agent"}.yaml`,Zke(h),"text/yaml")}):o.jsxs("div",{className:"cw-publish-loading",role:"status",children:[o.jsx(mn,{className:"cw-i cw-spin"}),o.jsx("strong",{children:"正在生成发布配置"}),o.jsx("span",{children:"校验 Agent 结构并准备部署快照…"})]})})]}),o.jsx(DIe,{mode:z,busy:Y,onChange:Nt,assistant:z==="build"?Pa:void 0}),we&&o.jsx(SV,{testRunId:we.runId,sessionId:we.sessionId,title:`调用链路 · ${we.variantName}`,onClose:()=>Je(null)}),Le&&o.jsx(zA,{variant:"warning",title:"离开调试?",description:"离开调试页面后,当前环境将被清理。您可以通过重新启动环境进行新的测试。",confirmLabel:_e?"清理中...":"确定离开",closeLabel:"关闭离开调试确认",busy:_e,onCancel:ce,onConfirm:()=>void Ie()}),w&&o.jsx("div",{className:"confirm-scrim",onClick:()=>_(null),children:o.jsxs("div",{className:"confirm-box cw-ai-error-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"ai-generate-error-title","aria-describedby":"ai-generate-error-message",onClick:se=>se.stopPropagation(),children:[o.jsx("div",{className:"confirm-title",id:"ai-generate-error-title",children:"智能生成失败"}),o.jsx("div",{className:"cw-ai-error-message",id:"ai-generate-error-message",children:w}),o.jsx("div",{className:"confirm-actions",children:o.jsx("button",{type:"button",className:"confirm-btn cw-ai-error-close",onClick:()=>_(null),children:"关闭"})})]})})]})}function vo(e){return{...wi(),...e}}const BIe=[{id:"support",icon:cee,draft:vo({name:"客服助手",description:"7×24 在线答疑,结合知识库与历史对话,稳定、礼貌地解决用户问题。",instruction:"你是一名专业、耐心的客服助手。请始终保持礼貌、友好的语气,优先依据知识库中的资料回答用户问题;当资料不足以确定答案时,如实告知用户并主动引导其提供更多信息,切勿编造。回答尽量简洁、分点清晰,必要时给出操作步骤。",model:"doubao-1.5-pro-32k",knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"analyst",icon:qJ,draft:vo({name:"数据分析师",description:"运行代码完成统计与可视化,开启链路追踪,分析过程可观测、可复现。",instruction:"你是一名严谨的数据分析师。面对数据问题时,先厘清分析目标与口径,再通过编写并运行代码完成清洗、统计与可视化。每一步都要说明你的假设与方法,给出结论时附上关键数据支撑,并指出潜在的偏差与局限。",model:"doubao-1.5-pro-32k",tools:["code_runner"],tracing:!0})},{id:"translator",icon:uee,draft:vo({name:"翻译助手",description:"中英互译,忠实、通顺、地道,保留原文语气与专业术语。",instruction:"你是一名专业的翻译助手,精通中英互译。请在忠实于原文含义的前提下,使译文自然、地道、符合目标语言表达习惯;保留专有名词与专业术语的准确性,并尽量贴合原文的语气与风格。仅输出译文,除非用户额外要求解释。",model:"doubao-1.5-pro-32k"})},{id:"coder",icon:_k,draft:vo({name:"代码助手",description:"编写、调试与重构代码,可运行代码验证结果,给出清晰可维护的实现。",instruction:"你是一名资深软件工程师。请根据需求编写正确、清晰、可维护的代码,遵循目标语言的惯用风格与最佳实践。在不确定时通过运行代码验证你的实现,给出关键的边界条件与测试思路,并对复杂逻辑附上简要注释。",model:"doubao-1.5-pro-32k",tools:["code_runner","file_reader"],tracing:!0})},{id:"researcher",icon:gee,draft:vo({name:"研究员",description:"联网检索一手资料,结合知识库与长期记忆,输出有据可查的研究结论。",instruction:"你是一名严谨的研究员。面对研究问题时,先拆解关键子问题,再通过联网检索收集多个一手、可信的来源,交叉验证后再下结论。结论需注明出处与不确定性,区分事实与推断,避免以偏概全。",model:"doubao-1.5-pro-32k",tools:["web_search"],knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"research-team",icon:Ree,draft:vo({name:"多智能体研究团队",description:"由检索员、分析员、撰写员协作的研究编排,分工完成端到端调研报告。",instruction:"你是一支研究团队的总协调者。负责拆解用户的研究任务,将检索、分析、撰写分别委派给对应的子 Agent,汇总各子 Agent 的产出,把控整体质量,最终输出结构清晰、有据可查的研究报告。",model:"doubao-1.5-pro-32k",tracing:!0,memory:{shortTerm:!0,longTerm:!0},subAgents:[vo({name:"检索员",description:"联网搜集与课题相关的一手资料与数据。",instruction:"你是研究团队中的检索员。根据课题联网检索多个可信来源,整理出关键事实、数据与原文出处,交付给分析员,不做主观结论。",tools:["web_search"]}),vo({name:"分析员",description:"对检索到的材料做交叉验证与归纳分析。",instruction:"你是研究团队中的分析员。对检索员提供的材料做交叉验证、归纳与对比,提炼洞见、识别矛盾与不确定性,形成结构化的分析要点。",tools:["code_runner"]}),vo({name:"撰写员",description:"将分析结论组织为结构清晰、引用规范的报告。",instruction:"你是研究团队中的撰写员。把分析员的要点组织成结构清晰、语言通顺、引用规范的研究报告,确保每个结论都能追溯到来源。"})]})}];function UIe(e){const t=[];return e.tools.length&&t.push({icon:xB,label:"工具"}),(e.memory.shortTerm||e.memory.longTerm)&&t.push({icon:KJ,label:"记忆"}),e.knowledgebase&&t.push({icon:VJ,label:"知识库"}),e.tracing&&t.push({icon:zJ,label:"观测"}),e.subAgents.length&&t.push({icon:xee,label:`子Agent ${e.subAgents.length}`}),t}function FIe({onBack:e,onCreate:t}){const[n,s]=g.useState(null);return o.jsx("div",{className:"tpl-root",children:n?o.jsx(HIe,{template:n,onBack:()=>s(null),onCreate:t}):o.jsx($Ie,{onPick:s})})}function $Ie({onPick:e}){return o.jsxs("div",{className:"tpl-scroll",children:[o.jsxs("div",{className:"tpl-head",children:[o.jsx("h1",{className:"tpl-title",children:"从模板新建"}),o.jsx("p",{className:"tpl-sub",children:"选择一个预制 agent 模板,按需微调后即可创建。"})]}),o.jsx("div",{className:"tpl-grid",children:BIe.map((t,n)=>o.jsxs(is.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:[o.jsx("span",{className:"tpl-card-icon",children:o.jsx(t.icon,{className:"icon"})}),o.jsx("span",{className:"tpl-card-name",children:t.draft.name}),o.jsx("span",{className:"tpl-card-desc",children:ec(t.draft.description)})]},t.id))})]})}function HIe({template:e,onBack:t,onCreate:n}){const[s,i]=g.useState(e.draft.name),r=e.icon,a=UIe(e.draft);function l(){const c=s.trim()||e.draft.name;n({...e.draft,name:c})}return o.jsxs("div",{className:"tpl-scroll tpl-scroll--detail",children:[o.jsxs("button",{className:"tpl-back",onClick:t,children:[o.jsx(wk,{className:"icon"})," 返回模板列表"]}),o.jsxs(is.div,{className:"tpl-detail",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.28,ease:[.22,1,.36,1]},children:[o.jsxs("div",{className:"tpl-detail-head",children:[o.jsx("span",{className:"tpl-detail-icon",children:o.jsx(r,{className:"icon"})}),o.jsxs("div",{className:"tpl-detail-headtext",children:[o.jsx("div",{className:"tpl-detail-name",children:e.draft.name}),o.jsx("div",{className:"tpl-detail-desc",children:ec(e.draft.description)})]})]}),a.length>0&&o.jsx("div",{className:"tpl-tags tpl-tags--detail",children:a.map(c=>o.jsxs("span",{className:"tpl-tag",children:[o.jsx(c.icon,{className:"tpl-tag-icon"})," ",c.label]},c.label))}),o.jsxs("label",{className:"tpl-field",children:[o.jsx("span",{className:"tpl-field-label",children:"名称"}),o.jsx("input",{className:"tpl-input",value:s,onChange:c=>i(c.target.value),placeholder:e.draft.name})]}),o.jsxs("div",{className:"tpl-field",children:[o.jsx("span",{className:"tpl-field-label",children:"系统提示词"}),o.jsx("p",{className:"tpl-instruction",children:e.draft.instruction})]}),o.jsxs("div",{className:"tpl-meta-grid",children:[e.draft.model&&o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"模型"}),o.jsx("span",{className:"tpl-meta-val tpl-mono",children:e.draft.model})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"工具"}),o.jsx("span",{className:"tpl-meta-val",children:e.draft.tools.length?e.draft.tools.join("、"):"无"})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"记忆"}),o.jsx("span",{className:"tpl-meta-val",children:zIe(e.draft)})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"知识库"}),o.jsx("span",{className:"tpl-meta-val",children:e.draft.knowledgebase?"已开启":"关闭"})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"观测追踪"}),o.jsx("span",{className:"tpl-meta-val",children:e.draft.tracing?"已开启":"关闭"})]})]}),e.draft.subAgents.length>0&&o.jsxs("div",{className:"tpl-field",children:[o.jsxs("span",{className:"tpl-field-label",children:["子 Agent(",e.draft.subAgents.length,")"]}),o.jsx("div",{className:"tpl-subagents",children:e.draft.subAgents.map((c,u)=>o.jsxs("div",{className:"tpl-subagent",children:[o.jsxs("div",{className:"tpl-subagent-top",children:[o.jsx("span",{className:"tpl-subagent-name",children:c.name}),c.tools.length>0&&o.jsx("span",{className:"tpl-subagent-tools",children:c.tools.join("、")})]}),o.jsx("div",{className:"tpl-subagent-desc",children:ec(c.description)})]},u))})]}),o.jsxs("button",{className:"tpl-create",onClick:l,children:["使用此模板创建 ",o.jsx(Ql,{className:"icon"})]})]})]})}function zIe(e){const t=[];return e.memory.shortTerm&&t.push("短期"),e.memory.longTerm&&t.push("长期"),t.length?t.join(" + "):"关闭"}const VIe=[{type:"sequential",label:"顺序",desc:"节点依次执行",Icon:bB},{type:"parallel",label:"并行",desc:"节点同时执行",Icon:uB},{type:"loop",label:"循环",desc:"节点循环执行",Icon:Ak}];let ON=0;function Vw(){return ON+=1,`node_${ON}`}function Gw(e,t,n){const s=wi();return{id:e,type:"agentNode",position:t,data:{agent:{...s,name:(n==null?void 0:n.name)??`agent_${e.replace("node_","")}`,...n}}}}function GIe({data:e,selected:t}){const n=e.agent;return o.jsxs("div",{className:`wfb-node ${t?"wfb-node--selected":""}`,children:[o.jsx(Mi,{type:"target",position:Xe.Left,className:"wfb-handle"}),o.jsx("div",{className:"wfb-node-icon",children:o.jsx(ru,{className:"icon"})}),o.jsxs("div",{className:"wfb-node-body",children:[o.jsx("div",{className:"wfb-node-name",children:n.name||"未命名节点"}),o.jsx("div",{className:"wfb-node-desc",children:n.instruction?n.instruction.slice(0,48):"点击编辑指令…"})]}),o.jsx(Mi,{type:"source",position:Xe.Right,className:"wfb-handle"})]})}const KIe={agentNode:GIe},sD={type:"smoothstep",markerEnd:{type:Ef.ArrowClosed,width:16,height:16}};function qIe({onBack:e,onCreate:t}){const n=g.useRef(null),[s,i]=g.useState(""),[r,a]=g.useState(""),[l,c]=g.useState("sequential"),u=g.useMemo(()=>{ON=0;const A=Vw();return Gw(A,{x:80,y:120},{name:"agent_1"})},[]),[d,f,h]=oU([u]),[p,m,b]=lU([]),[v,y]=g.useState(u.id),x=d.find(A=>A.id===v)??null,E=s.trim()||"workflow_agent",w=g.useMemo(()=>eH({name:E,subAgents:d.map(A=>A.data.agent)}),[E,d]),_=zl(E)??(w.has(E)?"名称须与 Agent 节点名称保持唯一":null),S=x?zl(x.data.agent.name)??(w.has(x.data.agent.name)?"Agent 名称在当前工作流中必须唯一":null):null,k=d.length>0&&_===null&&d.every(A=>zl(A.data.agent.name)===null&&!w.has(A.data.agent.name)),T=g.useCallback(A=>m(O=>L9({...A,...sD},O)),[m]),C=g.useCallback(()=>{const A=Vw(),O=d.length*28,P=Gw(A,{x:80+O,y:120+O});f($=>$.concat(P)),y(A)},[d.length,f]),I=A=>{A.dataTransfer.setData("application/wfb-node","agentNode"),A.dataTransfer.effectAllowed="move"},j=g.useCallback(A=>{A.preventDefault(),A.dataTransfer.dropEffect="move"},[]),L=g.useCallback(A=>{if(A.preventDefault(),A.dataTransfer.getData("application/wfb-node")!=="agentNode"||!n.current)return;const P=n.current.screenToFlowPosition({x:A.clientX,y:A.clientY}),$=Vw(),R=Gw($,P);f(Y=>Y.concat(R)),y($)},[f]),z=g.useCallback(A=>{v&&f(O=>O.map(P=>P.id===v?{...P,data:{...P.data,agent:{...P.data.agent,...A}}}:P))},[v,f]),D=g.useCallback(()=>{v&&(f(A=>A.filter(O=>O.id!==v)),m(A=>A.filter(O=>O.source!==v&&O.target!==v)),y(null))},[v,f,m]),F=g.useCallback(()=>{if(!k)return;const A=d.map(P=>P.data.agent),O={...wi(),name:E,description:r.trim(),instruction:r.trim(),subAgents:A,workflow:{type:l,nodes:d.map(P=>({id:P.id,agent:P.data.agent})),edges:p.map(P=>({from:P.source,to:P.target}))}};t(O)},[k,d,p,E,r,l,t]);return o.jsx("div",{className:"wfb",children:o.jsxs("div",{className:"wfb-grid",children:[o.jsxs("aside",{className:"wfb-palette",children:[o.jsx("div",{className:"wfb-section-label",children:"工作流信息"}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"名称"}),o.jsx("input",{className:`wfb-input ${_?"wfb-input--error":""}`,value:s,onChange:A=>i(A.target.value),placeholder:"my_workflow"}),_&&o.jsx("span",{className:"wfb-field-error",children:_})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"描述"}),o.jsx("textarea",{className:"wfb-input wfb-textarea",value:r,onChange:A=>a(A.target.value),placeholder:"这个工作流做什么…",rows:2})]}),o.jsx("div",{className:"wfb-section-label",children:"执行方式"}),o.jsx("div",{className:"wfb-types",children:VIe.map(({type:A,label:O,desc:P,Icon:$})=>o.jsxs("button",{type:"button",className:`wfb-type ${l===A?"wfb-type--active":""}`,onClick:()=>c(A),children:[o.jsx($,{className:"icon"}),o.jsxs("span",{className:"wfb-type-text",children:[o.jsx("span",{className:"wfb-type-name",children:O}),o.jsx("span",{className:"wfb-type-desc",children:P})]})]},A))}),o.jsx("div",{className:"wfb-section-label",children:"节点"}),o.jsxs("div",{className:"wfb-palette-item",draggable:!0,onDragStart:I,title:"拖拽到画布,或点击下方按钮添加",children:[o.jsx(lee,{className:"icon wfb-grip"}),o.jsx("span",{className:"wfb-node-icon wfb-node-icon--sm",children:o.jsx(ru,{className:"icon"})}),o.jsx("span",{className:"wfb-palette-item-text",children:"Agent 节点"})]}),o.jsxs("button",{className:"wfb-add",type:"button",onClick:C,children:[o.jsx(_i,{className:"icon"}),"添加节点"]}),o.jsx("div",{className:"wfb-hint",children:"拖拽节点的圆点连线以表达执行顺序。"})]}),o.jsxs("div",{className:"wfb-canvas",children:[o.jsxs("button",{className:"wfb-create",onClick:F,disabled:!k,type:"button",children:[o.jsx(au,{className:"icon"}),"创建工作流"]}),o.jsxs(aU,{nodes:d,edges:p,onNodesChange:h,onEdgesChange:b,onConnect:T,onInit:A=>n.current=A,nodeTypes:KIe,defaultEdgeOptions:sD,onDrop:L,onDragOver:j,onNodeClick:(A,O)=>y(O.id),onPaneClick:()=>y(null),fitView:!0,fitViewOptions:{padding:.3,maxZoom:1},proOptions:{hideAttribution:!0},children:[o.jsx(uU,{gap:16,size:1,color:"hsl(240 5.9% 88%)"}),o.jsx(fU,{showInteractive:!1}),o.jsx(uce,{pannable:!0,zoomable:!0,className:"wfb-minimap"})]})]}),o.jsx("aside",{className:"wfb-inspector",children:x?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"wfb-inspector-head",children:[o.jsx("div",{className:"wfb-section-label",children:"节点配置"}),o.jsx("button",{className:"wfb-icon-btn",type:"button",onClick:D,title:"删除节点",children:o.jsx(Zl,{className:"icon"})})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"名称"}),o.jsx("input",{className:`wfb-input ${S?"wfb-input--error":""}`,value:x.data.agent.name,onChange:A=>z({name:A.target.value}),placeholder:"agent_name"}),S?o.jsx("span",{className:"wfb-field-error",children:S}):o.jsx("span",{className:"wfb-field-help",children:"仅使用英文字母、数字和下划线,且名称保持唯一。"})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"描述"}),o.jsx("input",{className:"wfb-input",value:x.data.agent.description,onChange:A=>z({description:A.target.value}),placeholder:"这个 agent 做什么…"})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"指令 (instruction)"}),o.jsx("textarea",{className:"wfb-input wfb-textarea",value:x.data.agent.instruction,onChange:A=>z({instruction:A.target.value}),placeholder:"你是一个…",rows:6})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"工具 (逗号分隔)"}),o.jsx("input",{className:"wfb-input",value:x.data.agent.tools.join(", "),onChange:A=>z({tools:A.target.value.split(",").map(O=>O.trim()).filter(Boolean)}),placeholder:"web_search, calculator"})]}),o.jsxs("div",{className:"wfb-inspector-meta",children:[o.jsx("span",{className:"wfb-meta-key",children:"节点 ID"}),o.jsx("code",{className:"wfb-meta-val",children:x.id})]})]}):o.jsxs("div",{className:"wfb-inspector-empty",children:[o.jsx(ru,{className:"wfb-empty-icon"}),o.jsx("p",{children:"选择一个节点以编辑其配置"}),o.jsxs("p",{className:"wfb-empty-sub",children:["共 ",d.length," 个节点 · ",p.length," 条连线"]})]})})]})})}function YIe(e){return o.jsx(cA,{children:o.jsx(qIe,{...e})})}const iD=50*1024*1024,MN=800,WIe={name:"code_package",files:[]};function XIe(e){let n=e.replace(/\.zip$/i,"").trim().replace(/[^A-Za-z0-9_]+/g,"_").replace(/^_+|_+$/g,"");return n||(n="uploaded_agent"),/^[A-Za-z_]/.test(n)||(n=`agent_${n}`),n==="user"&&(n="uploaded_agent"),n.slice(0,64)}function QIe(e){const t=e.replace(/\\/g,"/").replace(/^\.\//,"");if(!t||t.endsWith("/"))return null;if(t.startsWith("/")||t.includes("\0"))throw new Error(`压缩包包含非法路径:${e}`);const n=t.split("/");if(n.some(s=>!s||s==="."||s===".."))throw new Error(`压缩包包含非法路径:${e}`);return n[0]==="__MACOSX"||n[n.length-1]===".DS_Store"?null:n.join("/")}function ZIe(e){const t=e.flatMap(a=>{const l=QIe(a.name);return l?[{path:l,content:a.text}]:[]});if(t.length===0)throw new Error("压缩包中没有可部署的文件。");if(t.length>MN)throw new Error(`代码包文件数不能超过 ${MN} 个。`);const i=new Set(t.map(a=>a.path.split("/")[0])).size===1&&t.every(a=>a.path.includes("/"))?t.map(a=>({...a,path:a.path.split("/").slice(1).join("/")})):t,r=new Set;for(const a of i){if(r.has(a.path))throw new Error(`代码包包含重复文件:${a.path}`);r.add(a.path)}if(!r.has("app.py"))throw new Error("代码包根目录必须包含 app.py,作为 AgentKit 启动入口。");return i}function JIe({onBack:e,onAgentAdded:t,onDeploymentTaskChange:n,onDeploymentStarted:s,onDeploymentComplete:i,initialDeployRegion:r="cn-beijing"}){const a=g.useRef(null),l=g.useRef(0),[c,u]=g.useState(null),[d,f]=g.useState(""),[h,p]=g.useState(!1),[m,b]=g.useState(!1),[v,y]=g.useState(!1),[x,E]=g.useState(""),[w,_]=g.useState(r),[S,k]=g.useState();g.useEffect(()=>()=>{l.current+=1},[]);async function T(L){const z=++l.current;if(E(""),!L.name.toLowerCase().endsWith(".zip")){E("请选择 .zip 格式的代码包。");return}if(L.size>iD){E("代码包不能超过 50 MB。");return}b(!0);try{const D=await xV(new Uint8Array(await L.arrayBuffer()),{maxEntries:MN,maxUncompressedBytes:iD}),F=ZIe(D);if(z!==l.current)return;f(L.name),u({name:XIe(L.name),files:F})}catch(D){if(z!==l.current)return;f(""),u(null),E(D instanceof Error?D.message:String(D))}finally{z===l.current&&b(!1)}}function C(L){var D;const z=(D=L.currentTarget.files)==null?void 0:D[0];L.currentTarget.value="",z&&T(z)}function I(L){var D;L.preventDefault(),y(!1);const z=(D=L.dataTransfer.files)==null?void 0:D[0];z&&T(z)}async function j(L,z,D){const F=S&&S.mode!=="public"?{mode:S.mode,vpc_id:S.vpcId,subnet_ids:S.subnetIds,enable_shared_internet_access:S.enableSharedInternetAccess}:void 0;return dg(L.name,L.files,{region:w,projectName:"default",network:F},{...D,onStage:z})}return o.jsxs("div",{className:"package-create package-create-preview",children:[o.jsx(Z1,{project:c??WIe,agentName:(c==null?void 0:c.name)||"代码包",onChange:c?u:void 0,onDeploy:j,onAgentAdded:t,onDeploymentTaskChange:n,onDeploymentStarted:s,onDeploymentComplete:i,network:S,onNetworkChange:k,deployRegion:w,onDeployRegionChange:_,deploymentTelemetrySource:"code_package",onBack:e,backLabel:"返回创建方式",deployDisabled:!c||m,deployDisabledReason:m?"正在读取代码包":c?void 0:"请先上传代码包",deploymentPrimaryPane:o.jsxs("section",{className:"package-source-pane","aria-label":"代码包上传",children:[o.jsx("div",{className:"package-source-label",children:"代码包"}),o.jsxs("div",{className:`package-dropzone${v?" is-dragging":""}${c?" is-ready":""}`,onDragEnter:L=>{L.preventDefault(),y(!0)},onDragOver:L=>L.preventDefault(),onDragLeave:L=>{L.currentTarget.contains(L.relatedTarget)||y(!1)},onDrop:I,onClick:()=>{var L;m||(L=a.current)==null||L.click()},onKeyDown:L=>{var z;!m&&(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),(z=a.current)==null||z.click())},role:"button",tabIndex:m?-1:0,"aria-label":c?"重新上传代码包":"上传代码包","aria-disabled":m,children:[o.jsx("strong",{children:m?"正在读取代码包…":c?d:"请上传代码包"}),o.jsx("span",{children:c?`已识别 ${c.files.length} 个文件,点击区域可重新上传`:"点击或拖拽上传,支持 .zip 格式,最大 50 MB,根目录需包含 app.py"}),o.jsx("div",{className:"package-upload-actions",children:c&&o.jsx("button",{type:"button",className:"package-upload-secondary",onClick:L=>{L.stopPropagation(),p(!0)},onKeyDown:L=>L.stopPropagation(),children:"查看文件"})}),o.jsx("input",{ref:a,type:"file",accept:".zip,application/zip","aria-label":"选择代码包",onChange:C})]}),x&&o.jsx("div",{className:"package-create-error",role:"alert",children:x})]})}),c&&o.jsx(xz,{project:c,open:h,onClose:()=>p(!1),onChange:u})]})}const DV=1;function wx(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function eje(e){return wx(e)&&typeof e.id=="string"&&typeof e.updatedAt=="number"&&wx(e.draft)}function rE(e){return`veadk.agentDrafts.${encodeURIComponent(e)}`}function tje(e){var s;const t=X1(e),n={...((s=t.draft.deployment)==null?void 0:s.envValues)??{},...t.envValues};return!t.draft.deployment&&Object.keys(n).length===0?t.draft:{...t.draft,deployment:{...t.draft.deployment??{feishuEnabled:!1},envValues:n}}}function PV(e){return{...e,draft:tje(e.draft)}}function nje(e){const t=Array.isArray(e)?e:wx(e)&&e.version===DV?e.drafts:void 0;if(!Array.isArray(t)||!t.every(eje))throw wx(e)&&typeof e.version=="number"?new Error("本机草稿版本暂不受支持,请升级 Studio 后重试。"):new Error("本机草稿数据格式无效。");return t.map(PV)}function sje(e,t){if(!t)return[];const n=e.getItem(rE(t));if(!n)return[];try{return nje(JSON.parse(n))}catch(s){throw s instanceof Error&&s.message.startsWith("本机草稿")?s:new Error("无法读取本机草稿,浏览器中的草稿数据可能已损坏。")}}function rD(e,t,n){if(!t)return;const s={version:DV,drafts:n.map(PV)};try{e.setItem(rE(t),JSON.stringify(s))}catch(i){throw i instanceof DOMException&&(i.name==="QuotaExceededError"||i.name==="NS_ERROR_DOM_QUOTA_REACHED")?new Error("浏览器存储空间不足,草稿未保存。请删除不需要的草稿或清理此站点的浏览器存储后重试。"):new Error("浏览器拒绝保存草稿,请检查站点存储权限后重试。")}}const ije="/web/skill-creator";class O2 extends Error{constructor(n,s){super(n);vC(this,"status");this.name="SkillCreatorApiError",this.status=s}}function Ru(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} 格式错误`);return e}function ps(e,...t){for(const n of t){const s=e[n];if(typeof s=="string"&&s)return s}}function BV(e,...t){for(const n of t){const s=e[n];if(typeof s=="number"&&Number.isFinite(s))return s}}async function Pg(e,t){return fetch(Cn(`${ije}${e}`),{...t,headers:t1({Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers})})}async function M2(e,t){if((e.headers.get("content-type")??"").includes("application/json")){const i=Ru(await e.json(),"错误响应");return ps(i,"detail","message","error")??t}return(await e.text()).trim()||t}async function L2(e,t){if(!e.ok)throw new O2(await M2(e,t),e.status);if(!(e.headers.get("content-type")??"").includes("application/json"))throw new Error(`${t}:服务端返回了非 JSON 响应`);return e.json()}function rje(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 aje(e){if(e==="provisioning"||e==="generating"||e==="validating"||e==="packaging"||e==="completed"||e==="failed")return e;throw new Error(`未知的 Skill 生成阶段:${String(e)}`)}function oje(e){return Array.isArray(e)?e.map((t,n)=>{const s=Ru(t,`文件 ${n+1}`),i=ps(s,"path");if(!i)throw new Error(`文件 ${n+1} 缺少 path`);const r=BV(s,"size");if(r===void 0)throw new Error(`文件 ${n+1} 缺少 size`);return{path:i,size:r}}):[]}function lje(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=Array.isArray(t.errors)?t.errors.map(String):[],s=Array.isArray(t.warnings)?t.warnings.map(String):[];return{valid:typeof t.valid=="boolean"?t.valid:n.length===0,errors:n,warnings:s}}function cje(e){if(e===void 0)return[];if(!Array.isArray(e))throw new Error("Skill 生成活动记录格式错误");return e.map((t,n)=>{const s=Ru(t,`活动 ${n+1}`),i=ps(s,"id"),r=ps(s,"kind"),a=ps(s,"status");if(!i||!r||!["status","thinking","tool","message"].includes(r))throw new Error(`活动 ${n+1} 格式错误`);if(a!=="running"&&a!=="done")throw new Error(`活动 ${n+1} 状态错误`);if(r==="tool"){const c=ps(s,"name");if(!c)throw new Error(`活动 ${n+1} 缺少工具名称`);return{id:i,kind:r,name:c,args:s.input,response:s.output,status:a}}const l=ps(s,"text");if(!l)throw new Error(`活动 ${n+1} 缺少文本`);return{id:i,kind:r,text:l,status:a}})}function uje(e,t){const n=Ru(e,`候选方案 ${t+1}`),s=ps(n,"id","candidate_id","candidateId"),i=ps(n,"model","model_id","modelId");if(!s||!i)throw new Error(`候选方案 ${t+1} 缺少 id 或 model`);return{id:s,model:i,modelLabel:ps(n,"modelLabel","model_label")??i,status:rje(n.status),stage:aje(n.stage),name:ps(n,"name","skill_name","skillName"),description:ps(n,"description"),skillMd:ps(n,"skillMd","skill_md"),files:oje(n.files),activities:cje(n.activities),validation:lje(n.validation),durationMs:BV(n,"elapsedMs","elapsed_ms"),error:ps(n,"error","error_message","errorMessage"),published:n.published===!0,skillId:ps(n,"skill_id","skillId"),version:ps(n,"version")}}function LN(e,t=""){const n=Ru(e,"Skill 创建任务"),s=ps(n,"id","job_id","jobId");if(!s)throw new Error("Skill 创建任务缺少 id");const i=Array.isArray(n.candidates)?n.candidates.map(uje):[],r=ps(n,"status")??"running";if(r!=="provisioning"&&r!=="running"&&r!=="completed")throw new Error(`未知的 Skill 任务状态:${r}`);return{id:s,prompt:ps(n,"prompt")??t,status:r,candidates:i}}async function dje(e,t){const n=await Pg("/jobs",{method:"POST",body:JSON.stringify({prompt:e})});if(!n.ok)throw new O2(await M2(n,"创建 Skill 任务失败"),n.status);const s=n.headers.get("content-type")??"";if(s.includes("application/json")){const u=LN(await n.json(),e);return t==null||t(u),u}if(!s.includes("application/x-ndjson")||!n.body)throw new Error("创建 Skill 任务失败:服务端返回了非流式响应");const i=n.body.getReader(),r=new TextDecoder;let a="",l;const c=u=>{if(!u.trim())return;const d=Ru(JSON.parse(u),"Skill 创建进度");if(d.type==="error")throw new Error(ps(d,"error")??"创建 Skill 任务失败");if(d.type!=="progress"&&d.type!=="complete")throw new Error("未知的 Skill 创建进度事件");l=LN(d.job,e),t==null||t(l)};for(;;){const{done:u,value:d}=await i.read();a+=r.decode(d,{stream:!u});const f=a.split(` -`);if(a=f.pop()??"",f.forEach(c),u)break}if(c(a),!l)throw new Error("创建 Skill 任务失败:服务端未返回任务");return l}async function fje(e){const t=await Pg(`/jobs/${encodeURIComponent(e)}`);return LN(await L2(t,"读取 Skill 任务失败"))}async function hje(e){const t=await Pg(`/jobs/${encodeURIComponent(e)}`,{method:"DELETE"});await L2(t,"清理 Skill 任务失败")}async function pje(e,t){var l;const n=await Pg(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/download`);if(!n.ok)throw new Error(await M2(n,"下载 Skill 失败"));const i=((l=(n.headers.get("content-disposition")??"").match(/filename="([^"]+)"/))==null?void 0:l[1])??"skill.zip",r=URL.createObjectURL(await n.blob()),a=document.createElement("a");a.href=r,a.download=i,a.click(),URL.revokeObjectURL(r)}async function mje(e,t,n){const s=await Pg(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/publish`,{method:"POST",body:JSON.stringify(n)}),i=Ru(await L2(s,"添加到 AgentKit 失败"),"发布结果"),r=ps(i,"skill_id","skillId","id");if(!r)throw new Error("发布结果缺少 skill_id");return{skillId:r,name:ps(i,"name"),version:ps(i,"version"),skillSpaceIds:Array.isArray(i.skillSpaceIds)?i.skillSpaceIds.map(String):Array.isArray(i.skill_space_ids)?i.skill_space_ids.map(String):[],message:ps(i,"message")}}const gje=()=>{};function bje(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 yje({activities:e}){const t=g.useMemo(()=>e.filter(n=>n.kind!=="status").map(bje),[e]);return t.length===0?null:o.jsx("div",{className:"skill-conversation","aria-label":"Skill 生成对话","aria-live":"polite",children:o.jsx(t2,{blocks:t,onAction:gje})})}const aD={provisioning:"正在准备 Sandbox",generating:"正在生成 Skill",validating:"正在校验结构",packaging:"正在打包",completed:"生成完成",failed:"生成失败"},oD=12e4;function xje({status:e}){return e==="succeeded"?o.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("circle",{cx:"10",cy:"10",r:"7"}),o.jsx("path",{d:"m6.7 10.1 2.1 2.2 4.6-4.8"})]}):e==="failed"?o.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("circle",{cx:"10",cy:"10",r:"7"}),o.jsx("path",{d:"M10 6.2v4.5M10 13.6h.01"})]}):o.jsxs("svg",{className:"skill-candidate__spinner",viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("circle",{cx:"10",cy:"10",r:"7"}),o.jsx("path",{d:"M10 3a7 7 0 0 1 7 7"})]})}function Eje(){return o.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("path",{d:"M4.2 3.5h7.1l4.5 4.6v8.4H4.2z"}),o.jsx("path",{d:"M11.3 3.5v4.6h4.5M7 11h6M7 13.8h4.2"})]})}function vje(){return o.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:o.jsx("path",{d:"m9 5-5 5 5 5M4.5 10H16"})})}function wje({candidate:e}){var c,u;const[t,n]=g.useState("SKILL.md"),s=e.files.find(d=>d.path.endsWith("SKILL.md")),i=e.skillMd&&!s?[{path:"SKILL.md",size:new Blob([e.skillMd]).size},...e.files]:e.files,r=i.find(d=>d.path===t)??i[0],a=(c=e.skillMd)==null?void 0:c.slice(0,oD),l=(((u=e.skillMd)==null?void 0:u.length)??0)>oD;return i.length===0?null:o.jsxs("div",{className:"skill-files",children:[o.jsx("div",{className:"skill-files__tabs",role:"tablist","aria-label":`${e.name??"Skill"} 文件`,children:i.map(d=>o.jsx("button",{type:"button",role:"tab","aria-selected":(r==null?void 0:r.path)===d.path,className:(r==null?void 0:r.path)===d.path?"is-active":"",onClick:()=>n(d.path),children:d.path},d.path))}),e.skillMd&&(r!=null&&r.path.endsWith("SKILL.md"))?o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:"skill-files__content",children:o.jsx("code",{children:a})}),l?o.jsx("p",{className:"skill-files__truncated",children:"预览内容较长,完整文件请下载 ZIP 查看。"}):null]}):o.jsx("div",{className:"skill-files__unavailable",children:r?`${r.path} · ${r.size.toLocaleString()} bytes`:"文件内容将在下载包中提供"})]})}function Sje({label:e,jobId:t,candidate:n,selected:s,publishing:i,publishDisabled:r,publishError:a,onSelect:l,onPublish:c}){const[u,d]=g.useState("conversation"),[f,h]=g.useState(!1),[p,m]=g.useState(!1),[b,v]=g.useState(""),[y,x]=g.useState(""),[E,w]=g.useState(""),[_,S]=g.useState(""),k=g.useRef(null),T=g.useRef(null),C=n.status==="queued"||n.status==="running",I=n.status==="succeeded",j=n.validation;return o.jsxs("article",{className:`skill-candidate skill-candidate--${n.status}${s?" is-selected":""}`,"aria-label":`${e} ${n.model}`,children:[o.jsxs("header",{className:"skill-candidate__header",children:[o.jsx("h2",{children:n.model}),s?o.jsx("span",{className:"skill-candidate__selected",children:"已选方案"}):null]}),u==="conversation"?o.jsxs("div",{className:"skill-candidate__view skill-candidate__view--conversation",children:[o.jsxs("div",{className:"skill-candidate__status","aria-live":"polite",children:[o.jsx("span",{className:"skill-candidate__status-icon",children:o.jsx(xje,{status:n.status})}),C?o.jsx(ka,{duration:2.2,spread:16,children:aD[n.stage]}):o.jsx("span",{children:aD[n.stage]}),n.durationMs!==void 0&&I?o.jsxs("span",{className:"skill-candidate__duration",children:[(n.durationMs/1e3).toFixed(1)," 秒"]}):null]}),o.jsx(yje,{activities:n.activities}),n.error?o.jsx("div",{className:"skill-candidate__error",children:n.error}):null,I?o.jsx("div",{className:"skill-candidate__view-actions",children:o.jsxs("button",{ref:k,type:"button",className:"skill-action skill-action--preview",onClick:()=>{d("preview"),requestAnimationFrame(()=>{var L;return(L=T.current)==null?void 0:L.focus()})},children:[o.jsx(Eje,{}),"查看 Skill"]})}):null]}):o.jsxs("div",{className:"skill-candidate__view skill-candidate__view--preview",children:[o.jsx("div",{className:"skill-candidate__preview-nav",children:o.jsxs("button",{ref:T,type:"button",className:"skill-candidate__back",onClick:()=>{d("conversation"),requestAnimationFrame(()=>{var L;return(L=k.current)==null?void 0:L.focus()})},children:[o.jsx(vje,{}),"返回对话"]})}),o.jsxs("div",{className:"skill-candidate__result",children:[o.jsxs("div",{className:"skill-candidate__summary",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Skill"}),o.jsx("strong",{children:n.name??"未命名 Skill"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"文件"}),o.jsx("strong",{children:n.files.length})]}),o.jsxs("div",{children:[o.jsx("span",{children:"校验"}),o.jsx("strong",{className:(j==null?void 0:j.valid)===!1?"is-invalid":"is-valid",children:(j==null?void 0:j.valid)===!1?"未通过":"已通过"})]})]}),n.description?o.jsx("p",{className:"skill-candidate__description",children:n.description}):null,j&&(j.errors.length>0||j.warnings.length>0)?o.jsxs("details",{className:"skill-validation",children:[o.jsx("summary",{children:"查看校验详情"}),[...j.errors,...j.warnings].map((L,z)=>o.jsx("div",{children:L},`${L}-${z}`))]}):null,o.jsx(wje,{candidate:n}),o.jsxs("div",{className:"skill-candidate__actions",children:[o.jsx("button",{type:"button",className:"skill-action skill-action--select","aria-pressed":s,onClick:l,children:s?"已采用此方案":"采用此方案"}),o.jsx("button",{type:"button",className:"skill-action",disabled:p,onClick:()=>{m(!0),v(""),pje(t,n.id).catch(L=>{v(L instanceof Error?L.message:String(L))}).finally(()=>m(!1))},children:p?"正在下载…":"下载 ZIP"}),o.jsx("button",{type:"button",className:"skill-action",disabled:!s||i||r||n.published,title:s?void 0:"请先采用此方案",onClick:()=>h(L=>!L),children:n.published?"已添加到 AgentKit":i?"正在添加…":"添加到 AgentKit"})]}),b?o.jsx("div",{className:"skill-candidate__error",children:b}):null,f&&s&&!n.published?o.jsxs("form",{className:"skill-publish-form",onSubmit:L=>{L.preventDefault();const z=y.split(",").map(D=>D.trim()).filter(Boolean);c({skillSpaceIds:z,...E.trim()?{projectName:E.trim()}:{},..._.trim()?{skillId:_.trim()}:{}})},children:[o.jsxs("label",{children:[o.jsx("span",{children:"SkillSpace ID(可选)"}),o.jsx("input",{value:y,onChange:L=>x(L.target.value),placeholder:"多个 ID 用英文逗号分隔"})]}),o.jsxs("div",{className:"skill-publish-form__optional",children:[o.jsxs("label",{children:[o.jsx("span",{children:"项目名称(可选)"}),o.jsx("input",{value:E,onChange:L=>w(L.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"已有 Skill ID(可选)"}),o.jsx("input",{value:_,onChange:L=>S(L.target.value)})]})]}),o.jsx("button",{type:"submit",className:"skill-action skill-action--select",disabled:i,children:i?"正在添加…":"确认添加"})]}):null,a?o.jsx("div",{className:"skill-candidate__error",children:a}):null]})]})]})}const lD=new Set(["completed"]),ub=1100,_je=3e4;function Nje(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 Tje({initialJob:e}){const[t,n]=g.useState(e),[s,i]=g.useState(""),[r,a]=g.useState(!1),[l,c]=g.useState(),[u,d]=g.useState(),[f,h]=g.useState(()=>new Set),[p,m]=g.useState({});g.useEffect(()=>{n(e),i(""),a(!1)},[e]),g.useEffect(()=>{if(lD.has(e.status)||e.id.startsWith("pending-"))return;let y=!1,x;const E=Date.now()+_je,w=async()=>{try{const _=await fje(e.id);y||(n({..._,prompt:_.prompt||e.prompt}),i(""),lD.has(_.status)||(x=window.setTimeout(w,ub)))}catch(_){if(!y){const S=_ instanceof O2?_:void 0;if((S==null?void 0:S.status)===404&&Date.now(){y=!0,x!==void 0&&window.clearTimeout(x)}},[e.id,e.status]);const b=s2.map((y,x)=>t.candidates.find(E=>E.model===y)??t.candidates[x]??Nje(y,x));async function v(y,x){d(y.id),m(E=>({...E,[y.id]:""}));try{await mje(t.id,y.id,x),h(E=>new Set(E).add(y.id))}catch(E){m(w=>({...w,[y.id]:E instanceof Error?E.message:String(E)}))}finally{d(void 0)}}return o.jsxs("section",{className:"skill-workspace",children:[o.jsx("header",{className:"skill-workspace__intro",children:o.jsx("h1",{children:"正在把需求变成可运行的 Skill"})}),s?o.jsxs("div",{className:"skill-workspace__poll-error",role:"alert",children:["状态刷新失败:",s,"。",r?"":"页面会继续重试。"]}):null,o.jsx("div",{className:"skill-workspace__grid",children:b.map((y,x)=>{const w=f.has(y.id)||y.published?{...y,published:!0}:y;return o.jsx(Sje,{label:`方案 ${x===0?"A":"B"}`,jobId:t.id,candidate:w,selected:l===y.id,publishing:u===y.id,publishDisabled:u!==void 0&&u!==y.id,publishError:p[y.id],onSelect:()=>c(y.id),onPublish:_=>void v(y,_)},`${y.model}-${y.id}`)})})]})}function kje(e){return Object.prototype.toString.call(e)==="[object Object]"}function cD(e){return kje(e)||Array.isArray(e)}function Aje(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function D2(e,t){const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;const i=JSON.stringify(Object.keys(e.breakpoints||{})),r=JSON.stringify(Object.keys(t.breakpoints||{}));return i!==r?!1:n.every(a=>{const l=e[a],c=t[a];return typeof l=="function"?`${l}`==`${c}`:!cD(l)||!cD(c)?l===c:D2(l,c)})}function uD(e){return e.concat().sort((t,n)=>t.name>n.name?1:-1).map(t=>t.options)}function Cje(e,t){if(e.length!==t.length)return!1;const n=uD(e),s=uD(t);return n.every((i,r)=>{const a=s[r];return D2(i,a)})}function P2(e){return typeof e=="number"}function DN(e){return typeof e=="string"}function aE(e){return typeof e=="boolean"}function dD(e){return Object.prototype.toString.call(e)==="[object Object]"}function ws(e){return Math.abs(e)}function B2(e){return Math.sign(e)}function em(e,t){return ws(e-t)}function Ije(e,t){if(e===0||t===0||ws(e)<=ws(t))return 0;const n=em(ws(e),ws(t));return ws(n/e)}function jje(e){return Math.round(e*100)/100}function Gm(e){return Km(e).map(Number)}function Ca(e){return e[Bg(e)]}function Bg(e){return Math.max(0,e.length-1)}function U2(e,t){return t===Bg(e)}function fD(e,t=0){return Array.from(Array(e),(n,s)=>t+s)}function Km(e){return Object.keys(e)}function UV(e,t){return[e,t].reduce((n,s)=>(Km(s).forEach(i=>{const r=n[i],a=s[i],l=dD(r)&&dD(a);n[i]=l?UV(r,a):a}),n),{})}function PN(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function Rje(e,t){const n={start:s,center:i,end:r};function s(){return 0}function i(c){return r(c)/2}function r(c){return t-c}function a(c,u){return DN(e)?n[e](c):e(t,c,u)}return{measure:a}}function qm(){let e=[];function t(i,r,a,l={passive:!0}){let c;if("addEventListener"in i)i.addEventListener(r,a,l),c=()=>i.removeEventListener(r,a,l);else{const u=i;u.addListener(a),c=()=>u.removeListener(a)}return e.push(c),s}function n(){e=e.filter(i=>i())}const s={add:t,clear:n};return s}function Oje(e,t,n,s){const i=qm(),r=1e3/60;let a=null,l=0,c=0;function u(){i.add(e,"visibilitychange",()=>{e.hidden&&m()})}function d(){p(),i.clear()}function f(v){if(!c)return;a||(a=v,n(),n());const y=v-a;for(a=v,l+=y;l>=r;)n(),l-=r;const x=l/r;s(x),c&&(c=t.requestAnimationFrame(f))}function h(){c||(c=t.requestAnimationFrame(f))}function p(){t.cancelAnimationFrame(c),a=null,l=0,c=0}function m(){a=null,l=0}return{init:u,destroy:d,start:h,stop:p,update:n,render:s}}function Mje(e,t){const n=t==="rtl",s=e==="y",i=s?"y":"x",r=s?"x":"y",a=!s&&n?-1:1,l=d(),c=f();function u(m){const{height:b,width:v}=m;return s?b:v}function d(){return s?"top":n?"right":"left"}function f(){return s?"bottom":n?"left":"right"}function h(m){return m*a}return{scroll:i,cross:r,startEdge:l,endEdge:c,measureSize:u,direction:h}}function gu(e=0,t=0){const n=ws(e-t);function s(u){return ut}function r(u){return s(u)||i(u)}function a(u){return r(u)?s(u)?e:t:u}function l(u){return n?u-n*Math.ceil((u-t)/n):u}return{length:n,max:t,min:e,constrain:a,reachedAny:r,reachedMax:i,reachedMin:s,removeOffset:l}}function FV(e,t,n){const{constrain:s}=gu(0,e),i=e+1;let r=a(t);function a(h){return n?ws((i+h)%i):s(h)}function l(){return r}function c(h){return r=a(h),f}function u(h){return d().set(l()+h)}function d(){return FV(e,l(),n)}const f={get:l,set:c,add:u,clone:d};return f}function Lje(e,t,n,s,i,r,a,l,c,u,d,f,h,p,m,b,v,y,x){const{cross:E,direction:w}=e,_=["INPUT","SELECT","TEXTAREA"],S={passive:!1},k=qm(),T=qm(),C=gu(50,225).constrain(p.measure(20)),I={mouse:300,touch:400},j={mouse:500,touch:600},L=m?43:25;let z=!1,D=0,F=0,A=!1,O=!1,P=!1,$=!1;function R(de){if(!x)return;function ge(ve){(aE(x)||x(de,ve))&&V(ve)}const Me=t;k.add(Me,"dragstart",ve=>ve.preventDefault(),S).add(Me,"touchmove",()=>{},S).add(Me,"touchend",()=>{}).add(Me,"touchstart",ge).add(Me,"mousedown",ge).add(Me,"touchcancel",q).add(Me,"contextmenu",q).add(Me,"click",ue,!0)}function Y(){k.clear(),T.clear()}function J(){const de=$?n:t;T.add(de,"touchmove",W,S).add(de,"touchend",q).add(de,"mousemove",W,S).add(de,"mouseup",q)}function U(de){const ge=de.nodeName||"";return _.includes(ge)}function te(){return(m?j:I)[$?"mouse":"touch"]}function K(de,ge){const Me=f.add(B2(de)*-1),ve=d.byDistance(de,!m).distance;return m||ws(de)=2,!(ge&&de.button!==0)&&(U(de.target)||(A=!0,r.pointerDown(de),u.useFriction(0).useDuration(0),i.set(a),J(),D=r.readPoint(de),F=r.readPoint(de,E),h.emit("pointerDown")))}function W(de){if(!PN(de,s)&&de.touches.length>=2)return q(de);const Me=r.readPoint(de),ve=r.readPoint(de,E),re=em(Me,D),ke=em(ve,F);if(!O&&!$&&(!de.cancelable||(O=re>ke,!O)))return q(de);const we=r.pointerMove(de);re>b&&(P=!0),u.useFriction(.3).useDuration(.75),l.start(),i.add(w(we)),de.preventDefault()}function q(de){const Me=d.byDistance(0,!1).index!==f.get(),ve=r.pointerUp(de)*te(),re=K(w(ve),Me),ke=Ije(ve,re),we=L-10*ke,Je=y+ke/50;O=!1,A=!1,T.clear(),u.useDuration(we).useFriction(Je),c.distance(re,!m),$=!1,h.emit("pointerUp")}function ue(de){P&&(de.stopPropagation(),de.preventDefault(),P=!1)}function me(){return A}return{init:R,destroy:Y,pointerDown:me}}function Dje(e,t){let s,i;function r(f){return f.timeStamp}function a(f,h){const m=`client${(h||e.scroll)==="x"?"X":"Y"}`;return(PN(f,t)?f:f.touches[0])[m]}function l(f){return s=f,i=f,a(f)}function c(f){const h=a(f)-a(i),p=r(f)-r(s)>170;return i=f,p&&(s=f),h}function u(f){if(!s||!i)return 0;const h=a(i)-a(s),p=r(f)-r(s),m=r(f)-r(i)>170,b=h/p;return p&&!m&&ws(b)>.1?b:0}return{pointerDown:l,pointerMove:c,pointerUp:u,readPoint:a}}function Pje(){function e(n){const{offsetTop:s,offsetLeft:i,offsetWidth:r,offsetHeight:a}=n;return{top:s,right:i+r,bottom:s+a,left:i,width:r,height:a}}return{measure:e}}function Bje(e){function t(s){return e*(s/100)}return{measure:t}}function Uje(e,t,n,s,i,r,a){const l=[e].concat(s);let c,u,d=[],f=!1;function h(v){return i.measureSize(a.measure(v))}function p(v){if(!r)return;u=h(e),d=s.map(h);function y(x){for(const E of x){if(f)return;const w=E.target===e,_=s.indexOf(E.target),S=w?u:d[_],k=h(w?e:s[_]);if(ws(k-S)>=.5){v.reInit(),t.emit("resize");break}}}c=new ResizeObserver(x=>{(aE(r)||r(v,x))&&y(x)}),n.requestAnimationFrame(()=>{l.forEach(x=>c.observe(x))})}function m(){f=!0,c&&c.disconnect()}return{init:p,destroy:m}}function Fje(e,t,n,s,i,r){let a=0,l=0,c=i,u=r,d=e.get(),f=0;function h(){const S=s.get()-e.get(),k=!c;let T=0;return k?(a=0,n.set(s),e.set(s),T=S):(n.set(e),a+=S/c,a*=u,d+=a,e.add(a),T=d-f),l=B2(T),f=d,_}function p(){const S=s.get()-t.get();return ws(S)<.001}function m(){return c}function b(){return l}function v(){return a}function y(){return E(i)}function x(){return w(r)}function E(S){return c=S,_}function w(S){return u=S,_}const _={direction:b,duration:m,velocity:v,seek:h,settled:p,useBaseFriction:x,useBaseDuration:y,useFriction:w,useDuration:E};return _}function $je(e,t,n,s,i){const r=i.measure(10),a=i.measure(50),l=gu(.1,.99);let c=!1;function u(){return!(c||!e.reachedAny(n.get())||!e.reachedAny(t.get()))}function d(p){if(!u())return;const m=e.reachedMin(t.get())?"min":"max",b=ws(e[m]-t.get()),v=n.get()-t.get(),y=l.constrain(b/a);n.subtract(v*y),!p&&ws(v){const{min:v,max:y}=r,x=r.constrain(m),E=!b,w=U2(n,b);return E?y:w||u(v,x)?v:u(y,x)?y:x}).map(m=>parseFloat(m.toFixed(3)))}function h(){if(t<=e+i)return[r.max];if(s==="keepSnaps")return a;const{min:m,max:b}=l;return a.slice(m,b)}return{snapsContained:c,scrollContainLimit:l}}function zje(e,t,n){const s=t[0],i=n?s-e:Ca(t);return{limit:gu(i,s)}}function Vje(e,t,n,s){const r=t.min+.1,a=t.max+.1,{reachedMin:l,reachedMax:c}=gu(r,a);function u(h){return h===1?c(n.get()):h===-1?l(n.get()):!1}function d(h){if(!u(h))return;const p=e*(h*-1);s.forEach(m=>m.add(p))}return{loop:d}}function Gje(e){const{max:t,length:n}=e;function s(r){const a=r-t;return n?a/-n:0}return{get:s}}function Kje(e,t,n,s,i){const{startEdge:r,endEdge:a}=e,{groupSlides:l}=i,c=f().map(t.measure),u=h(),d=p();function f(){return l(s).map(b=>Ca(b)[a]-b[0][r]).map(ws)}function h(){return s.map(b=>n[r]-b[r]).map(b=>-ws(b))}function p(){return l(u).map(b=>b[0]).map((b,v)=>b+c[v])}return{snaps:u,snapsAligned:d}}function qje(e,t,n,s,i,r){const{groupSlides:a}=i,{min:l,max:c}=s,u=d();function d(){const h=a(r),p=!e||t==="keepSnaps";return n.length===1?[r]:p?h:h.slice(l,c).map((m,b,v)=>{const y=!b,x=U2(v,b);if(y){const E=Ca(v[0])+1;return fD(E)}if(x){const E=Bg(r)-Ca(v)[0]+1;return fD(E,Ca(v)[0])}return m})}return{slideRegistry:u}}function Yje(e,t,n,s,i){const{reachedAny:r,removeOffset:a,constrain:l}=s;function c(m){return m.concat().sort((b,v)=>ws(b)-ws(v))[0]}function u(m){const b=e?a(m):l(m),v=t.map((x,E)=>({diff:d(x-b,0),index:E})).sort((x,E)=>ws(x.diff)-ws(E.diff)),{index:y}=v[0];return{index:y,distance:b}}function d(m,b){const v=[m,m+n,m-n];if(!e)return m;if(!b)return c(v);const y=v.filter(x=>B2(x)===b);return y.length?c(y):Ca(v)-n}function f(m,b){const v=t[m]-i.get(),y=d(v,b);return{index:m,distance:y}}function h(m,b){const v=i.get()+m,{index:y,distance:x}=u(v),E=!e&&r(v);if(!b||E)return{index:y,distance:m};const w=t[y]-x,_=m+d(w,0);return{index:y,distance:_}}return{byDistance:h,byIndex:f,shortcut:d}}function Wje(e,t,n,s,i,r,a){function l(f){const h=f.distance,p=f.index!==t.get();r.add(h),h&&(s.duration()?e.start():(e.update(),e.render(1),e.update())),p&&(n.set(t.get()),t.set(f.index),a.emit("select"))}function c(f,h){const p=i.byDistance(f,h);l(p)}function u(f,h){const p=t.clone().set(f),m=i.byIndex(p.get(),h);l(m)}return{distance:c,index:u}}function Xje(e,t,n,s,i,r,a,l){const c={passive:!0,capture:!0};let u=0;function d(p){if(!l)return;function m(b){if(new Date().getTime()-u>10)return;a.emit("slideFocusStart"),e.scrollLeft=0;const x=n.findIndex(E=>E.includes(b));P2(x)&&(i.useDuration(0),s.index(x,0),a.emit("slideFocus"))}r.add(document,"keydown",f,!1),t.forEach((b,v)=>{r.add(b,"focus",y=>{(aE(l)||l(p,y))&&m(v)},c)})}function f(p){p.code==="Tab"&&(u=new Date().getTime())}return{init:d}}function yp(e){let t=e;function n(){return t}function s(c){t=a(c)}function i(c){t+=a(c)}function r(c){t-=a(c)}function a(c){return P2(c)?c:c.get()}return{get:n,set:s,add:i,subtract:r}}function $V(e,t){const n=e.scroll==="x"?a:l,s=t.style;let i=null,r=!1;function a(h){return`translate3d(${h}px,0px,0px)`}function l(h){return`translate3d(0px,${h}px,0px)`}function c(h){if(r)return;const p=jje(e.direction(h));p!==i&&(s.transform=n(p),i=p)}function u(h){r=!h}function d(){r||(s.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:d,to:c,toggleActive:u}}function Qje(e,t,n,s,i,r,a,l,c){const d=Gm(i),f=Gm(i).reverse(),h=y().concat(x());function p(k,T){return k.reduce((C,I)=>C-i[I],T)}function m(k,T){return k.reduce((C,I)=>p(C,T)>0?C.concat([I]):C,[])}function b(k){return r.map((T,C)=>({start:T-s[C]+.5+k,end:T+t-.5+k}))}function v(k,T,C){const I=b(T);return k.map(j=>{const L=C?0:-n,z=C?n:0,D=C?"end":"start",F=I[j][D];return{index:j,loopPoint:F,slideLocation:yp(-1),translate:$V(e,c[j]),target:()=>l.get()>F?L:z}})}function y(){const k=a[0],T=m(f,k);return v(T,n,!1)}function x(){const k=t-a[0]-1,T=m(d,k);return v(T,-n,!0)}function E(){return h.every(({index:k})=>{const T=d.filter(C=>C!==k);return p(T,t)<=.1})}function w(){h.forEach(k=>{const{target:T,translate:C,slideLocation:I}=k,j=T();j!==I.get()&&(C.to(j),I.set(j))})}function _(){h.forEach(k=>k.translate.clear())}return{canLoop:E,clear:_,loop:w,loopPoints:h}}function Zje(e,t,n){let s,i=!1;function r(c){if(!n)return;function u(d){for(const f of d)if(f.type==="childList"){c.reInit(),t.emit("slidesChanged");break}}s=new MutationObserver(d=>{i||(aE(n)||n(c,d))&&u(d)}),s.observe(e,{childList:!0})}function a(){s&&s.disconnect(),i=!0}return{init:r,destroy:a}}function Jje(e,t,n,s){const i={};let r=null,a=null,l,c=!1;function u(){l=new IntersectionObserver(m=>{c||(m.forEach(b=>{const v=t.indexOf(b.target);i[v]=b}),r=null,a=null,n.emit("slidesInView"))},{root:e.parentElement,threshold:s}),t.forEach(m=>l.observe(m))}function d(){l&&l.disconnect(),c=!0}function f(m){return Km(i).reduce((b,v)=>{const y=parseInt(v),{isIntersecting:x}=i[y];return(m&&x||!m&&!x)&&b.push(y),b},[])}function h(m=!0){if(m&&r)return r;if(!m&&a)return a;const b=f(m);return m&&(r=b),m||(a=b),b}return{init:u,destroy:d,get:h}}function eRe(e,t,n,s,i,r){const{measureSize:a,startEdge:l,endEdge:c}=e,u=n[0]&&i,d=m(),f=b(),h=n.map(a),p=v();function m(){if(!u)return 0;const x=n[0];return ws(t[l]-x[l])}function b(){if(!u)return 0;const x=r.getComputedStyle(Ca(s));return parseFloat(x.getPropertyValue(`margin-${c}`))}function v(){return n.map((x,E,w)=>{const _=!E,S=U2(w,E);return _?h[E]+d:S?h[E]+f:w[E+1][l]-x[l]}).map(ws)}return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:f}}function tRe(e,t,n,s,i,r,a,l,c){const{startEdge:u,endEdge:d,direction:f}=e,h=P2(n);function p(y,x){return Gm(y).filter(E=>E%x===0).map(E=>y.slice(E,E+x))}function m(y){return y.length?Gm(y).reduce((x,E,w)=>{const _=Ca(x)||0,S=_===0,k=E===Bg(y),T=i[u]-r[_][u],C=i[u]-r[E][d],I=!s&&S?f(a):0,j=!s&&k?f(l):0,L=ws(C-j-(T+I));return w&&L>t+c&&x.push(E),k&&x.push(y.length),x},[]).map((x,E,w)=>{const _=Math.max(w[E-1]||0);return y.slice(_,x)}):[]}function b(y){return h?p(y,n):m(y)}return{groupSlides:b}}function nRe(e,t,n,s,i,r,a){const{align:l,axis:c,direction:u,startIndex:d,loop:f,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:b,slidesToScroll:v,skipSnaps:y,containScroll:x,watchResize:E,watchSlides:w,watchDrag:_,watchFocus:S}=r,k=2,T=Pje(),C=T.measure(t),I=n.map(T.measure),j=Mje(c,u),L=j.measureSize(C),z=Bje(L),D=Rje(l,L),F=!f&&!!x,A=f||!!x,{slideSizes:O,slideSizesWithGaps:P,startGap:$,endGap:R}=eRe(j,C,I,n,A,i),Y=tRe(j,L,v,f,C,I,$,R,k),{snaps:J,snapsAligned:U}=Kje(j,D,C,I,Y),te=-Ca(J)+Ca(P),{snapsContained:K,scrollContainLimit:V}=Hje(L,te,U,x,k),W=F?K:U,{limit:q}=zje(te,W,f),ue=FV(Bg(W),d,f),me=ue.clone(),Se=Gm(n),de=({dragHandler:Fe,scrollBody:Ke,scrollBounds:bt,options:{loop:dt}})=>{dt||bt.constrain(Fe.pointerDown()),Ke.seek()},ge=({scrollBody:Fe,translate:Ke,location:bt,offsetLocation:dt,previousLocation:cn,scrollLooper:Ut,slideLooper:wt,dragHandler:$t,animation:Ge,eventHandler:Yt,scrollBounds:it,options:{loop:ct}},Qe)=>{const vt=Fe.settled(),ye=!it.shouldConstrain(),Ze=ct?vt:vt&&ye,xt=Ze&&!$t.pointerDown();xt&&Ge.stop();const rn=bt.get()*Qe+cn.get()*(1-Qe);dt.set(rn),ct&&(Ut.loop(Fe.direction()),wt.loop()),Ke.to(dt.get()),xt&&Yt.emit("settle"),Ze||Yt.emit("scroll")},Me=Oje(s,i,()=>de(be),Fe=>ge(be,Fe)),ve=.68,re=W[ue.get()],ke=yp(re),we=yp(re),Je=yp(re),Le=yp(re),Ve=Fje(ke,Je,we,Le,h,ve),_e=Yje(f,W,te,q,Le),He=Wje(Me,ue,me,Ve,_e,Le,a),Pe=Gje(q),qe=qm(),Z=Jje(t,n,a,b),{slideRegistry:ae}=qje(F,x,W,V,Y,Se),ne=Xje(e,n,ae,He,Ve,qe,a,S),be={ownerDocument:s,ownerWindow:i,eventHandler:a,containerRect:C,slideRects:I,animation:Me,axis:j,dragHandler:Lje(j,e,s,i,Le,Dje(j,i),ke,Me,He,Ve,_e,ue,a,z,p,m,y,ve,_),eventStore:qe,percentOfView:z,index:ue,indexPrevious:me,limit:q,location:ke,offsetLocation:Je,previousLocation:we,options:r,resizeHandler:Uje(t,a,i,n,j,E,T),scrollBody:Ve,scrollBounds:$je(q,Je,Le,Ve,z),scrollLooper:Vje(te,q,Je,[ke,Je,we,Le]),scrollProgress:Pe,scrollSnapList:W.map(Pe.get),scrollSnaps:W,scrollTarget:_e,scrollTo:He,slideLooper:Qje(j,L,te,O,P,J,W,Je,n),slideFocus:ne,slidesHandler:Zje(t,a,w),slidesInView:Z,slideIndexes:Se,slideRegistry:ae,slidesToScroll:Y,target:Le,translate:$V(j,t)};return be}function sRe(){let e={},t;function n(u){t=u}function s(u){return e[u]||[]}function i(u){return s(u).forEach(d=>d(t,u)),c}function r(u,d){return e[u]=s(u).concat([d]),c}function a(u,d){return e[u]=s(u).filter(f=>f!==d),c}function l(){e={}}const c={init:n,emit:i,off:a,on:r,clear:l};return c}const iRe={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function rRe(e){function t(r,a){return UV(r,a||{})}function n(r){const a=r.breakpoints||{},l=Km(a).filter(c=>e.matchMedia(c).matches).map(c=>a[c]).reduce((c,u)=>t(c,u),{});return t(r,l)}function s(r){return r.map(a=>Km(a.breakpoints||{})).reduce((a,l)=>a.concat(l),[]).map(e.matchMedia)}return{mergeOptions:t,optionsAtMedia:n,optionsMediaQueries:s}}function aRe(e){let t=[];function n(r,a){return t=a.filter(({options:l})=>e.optionsAtMedia(l).active!==!1),t.forEach(l=>l.init(r,e)),a.reduce((l,c)=>Object.assign(l,{[c.name]:c}),{})}function s(){t=t.filter(r=>r.destroy())}return{init:n,destroy:s}}function Sx(e,t,n){const s=e.ownerDocument,i=s.defaultView,r=rRe(i),a=aRe(r),l=qm(),c=sRe(),{mergeOptions:u,optionsAtMedia:d,optionsMediaQueries:f}=r,{on:h,off:p,emit:m}=c,b=j;let v=!1,y,x=u(iRe,Sx.globalOptions),E=u(x),w=[],_,S,k;function T(){const{container:Se,slides:de}=E;S=(DN(Se)?e.querySelector(Se):Se)||e.children[0];const Me=DN(de)?S.querySelectorAll(de):de;k=[].slice.call(Me||S.children)}function C(Se){const de=nRe(e,S,k,s,i,Se,c);if(Se.loop&&!de.slideLooper.canLoop()){const ge=Object.assign({},Se,{loop:!1});return C(ge)}return de}function I(Se,de){v||(x=u(x,Se),E=d(x),w=de||w,T(),y=C(E),f([x,...w.map(({options:ge})=>ge)]).forEach(ge=>l.add(ge,"change",j)),E.active&&(y.translate.to(y.location.get()),y.animation.init(),y.slidesInView.init(),y.slideFocus.init(me),y.eventHandler.init(me),y.resizeHandler.init(me),y.slidesHandler.init(me),y.options.loop&&y.slideLooper.loop(),S.offsetParent&&k.length&&y.dragHandler.init(me),_=a.init(me,w)))}function j(Se,de){const ge=Y();L(),I(u({startIndex:ge},Se),de),c.emit("reInit")}function L(){y.dragHandler.destroy(),y.eventStore.clear(),y.translate.clear(),y.slideLooper.clear(),y.resizeHandler.destroy(),y.slidesHandler.destroy(),y.slidesInView.destroy(),y.animation.destroy(),a.destroy(),l.clear()}function z(){v||(v=!0,l.clear(),L(),c.emit("destroy"),c.clear())}function D(Se,de,ge){!E.active||v||(y.scrollBody.useBaseFriction().useDuration(de===!0?0:E.duration),y.scrollTo.index(Se,ge||0))}function F(Se){const de=y.index.add(1).get();D(de,Se,-1)}function A(Se){const de=y.index.add(-1).get();D(de,Se,1)}function O(){return y.index.add(1).get()!==Y()}function P(){return y.index.add(-1).get()!==Y()}function $(){return y.scrollSnapList}function R(){return y.scrollProgress.get(y.offsetLocation.get())}function Y(){return y.index.get()}function J(){return y.indexPrevious.get()}function U(){return y.slidesInView.get()}function te(){return y.slidesInView.get(!1)}function K(){return _}function V(){return y}function W(){return e}function q(){return S}function ue(){return k}const me={canScrollNext:O,canScrollPrev:P,containerNode:q,internalEngine:V,destroy:z,off:p,on:h,emit:m,plugins:K,previousScrollSnap:J,reInit:b,rootNode:W,scrollNext:F,scrollPrev:A,scrollProgress:R,scrollSnapList:$,scrollTo:D,selectedScrollSnap:Y,slideNodes:ue,slidesInView:U,slidesNotInView:te};return I(t,n),setTimeout(()=>c.emit("init"),0),me}Sx.globalOptions=void 0;function F2(e={},t=[]){const n=g.useRef(e),s=g.useRef(t),[i,r]=g.useState(),[a,l]=g.useState(),c=g.useCallback(()=>{i&&i.reInit(n.current,s.current)},[i]);return g.useEffect(()=>{D2(n.current,e)||(n.current=e,c())},[e,c]),g.useEffect(()=>{Cje(s.current,t)||(s.current=t,c())},[t,c]),g.useEffect(()=>{if(Aje()&&a){Sx.globalOptions=F2.globalOptions;const u=Sx(a,n.current,s.current);return r(u),()=>u.destroy()}else r(void 0)},[a,r]),[l,i]}F2.globalOptions=void 0;const HV=g.createContext(null);function Ug(...e){return e.filter(Boolean).join(" ")}function oE(){const e=g.useContext(HV);if(!e)throw new Error("useCarousel must be used within a ");return e}function oRe({orientation:e="horizontal",opts:t,setApi:n,plugins:s,className:i,children:r,...a}){const[l,c]=F2({...t,axis:e==="horizontal"?"x":"y"},s),[u,d]=g.useState(!1),[f,h]=g.useState(!1),p=g.useCallback(y=>{y&&(d(y.canScrollPrev()),h(y.canScrollNext()))},[]),m=g.useCallback(()=>c==null?void 0:c.scrollPrev(),[c]),b=g.useCallback(()=>c==null?void 0:c.scrollNext(),[c]),v=g.useCallback(y=>{y.key==="ArrowLeft"?(y.preventDefault(),m()):y.key==="ArrowRight"&&(y.preventDefault(),b())},[b,m]);return g.useEffect(()=>{c&&n&&n(c)},[c,n]),g.useEffect(()=>{if(c)return p(c),c.on("reInit",p),c.on("select",p),()=>{c.off("reInit",p),c.off("select",p)}},[c,p]),o.jsx(HV.Provider,{value:{carouselRef:l,api:c,opts:t,orientation:e,plugins:s,setApi:n,scrollPrev:m,scrollNext:b,canScrollPrev:u,canScrollNext:f},children:o.jsx("div",{onKeyDownCapture:v,className:Ug("ui-carousel",i),role:"region","aria-roledescription":"carousel","aria-orientation":e,"data-slot":"carousel",...a,children:r})})}function lRe({className:e,...t}){const{carouselRef:n,orientation:s}=oE();return o.jsx("div",{ref:n,className:"ui-carousel__viewport","data-slot":"carousel-content",children:o.jsx("div",{className:Ug("ui-carousel__track",s==="vertical"?"is-vertical":void 0,e),...t})})}function cRe({className:e,...t}){const{orientation:n}=oE();return o.jsx("div",{role:"group","aria-roledescription":"slide","data-slot":"carousel-item",className:Ug("ui-carousel__item",n==="vertical"?"is-vertical":void 0,e),...t})}function zV({direction:e}){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:e==="left"?"m10 3.75-4.25 4.25L10 12.25":"m6 3.75 4.25 4.25L6 12.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function uRe({className:e,...t}){const{orientation:n,scrollPrev:s,canScrollPrev:i}=oE();return o.jsx("button",{type:"button","data-slot":"carousel-previous",className:Ug("ui-carousel__control ui-carousel__control--previous",n==="vertical"?"is-vertical":void 0,e),disabled:!i,onClick:s,"aria-label":"上一张",...t,children:o.jsx(zV,{direction:"left"})})}function dRe({className:e,...t}){const{orientation:n,scrollNext:s,canScrollNext:i}=oE();return o.jsx("button",{type:"button","data-slot":"carousel-next",className:Ug("ui-carousel__control ui-carousel__control--next",n==="vertical"?"is-vertical":void 0,e),disabled:!i,onClick:s,"aria-label":"下一张",...t,children:o.jsx(zV,{direction:"right"})})}const hD=[{title:"随心应变",description:"支持多类 Agent",illustration:"agents"},{title:"一键成型",description:"自动构建 Agent",illustration:"build"},{title:"一搜即达",description:"全局搜索",illustration:"search"},{title:"开箱即用",description:"丰富内置工具",illustration:"tools"}];function fRe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4.25 4.25 7.5 7.5m0-7.5-7.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function hRe({kind:e}){return e==="agents"?o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsx("g",{className:"new-chat-feature-card__illustration-connectors",children:o.jsx("path",{d:"M43 27.5V33.5H22V38.5M43 33.5H64V38.5"})}),o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"33",y:"6.5",width:"20",height:"21",rx:"6"}),o.jsx("rect",{x:"9",y:"38.5",width:"26",height:"19",rx:"6"}),o.jsx("rect",{x:"51",y:"38.5",width:"26",height:"19",rx:"6"})]}),o.jsxs("g",{className:"new-chat-feature-card__illustration-details",children:[o.jsx("circle",{className:"new-chat-feature-card__illustration-dot",cx:"40",cy:"14.5",r:"1.25"}),o.jsx("circle",{className:"new-chat-feature-card__illustration-dot",cx:"46",cy:"14.5",r:"1.25"}),o.jsx("path",{d:"M39.5 21h7M17 46.5h10M17 51.5h7M59 46.5h10M59 51.5h7"})]})]}):e==="build"?o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsx("g",{className:"new-chat-feature-card__illustration-connectors",children:o.jsx("path",{d:"M26.5 39H36M50 39h9.5"})}),o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"5.5",y:"7.5",width:"75",height:"49",rx:"7.5"}),o.jsx("rect",{x:"12.5",y:"31.5",width:"14",height:"15",rx:"4"}),o.jsx("rect",{x:"36",y:"31.5",width:"14",height:"15",rx:"4"}),o.jsx("rect",{x:"59.5",y:"31.5",width:"14",height:"15",rx:"4"})]}),o.jsx("g",{className:"new-chat-feature-card__illustration-details",children:o.jsx("path",{d:"M6 20.5h74M13.5 14h.01m6 0h.01m6 0h.01M17 39h5m18.5 0h5m18-1 2.5 2.5 4-5"})})]}):e==="search"?o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"7.5",y:"9.5",width:"41",height:"16",rx:"5"}),o.jsx("rect",{x:"7.5",y:"35.5",width:"34",height:"18",rx:"5"}),o.jsx("circle",{cx:"61",cy:"33",r:"10.5"})]}),o.jsx("g",{className:"new-chat-feature-card__illustration-details",children:o.jsx("path",{d:"M14.5 16h21M14.5 21h14M14.5 42.5h17M14.5 47.5h11M68.5 40.5 77 49"})})]}):o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"8.5",y:"7.5",width:"29",height:"21",rx:"6"}),o.jsx("rect",{x:"48.5",y:"7.5",width:"29",height:"21",rx:"6"}),o.jsx("rect",{x:"8.5",y:"35.5",width:"29",height:"21",rx:"6"}),o.jsx("rect",{x:"48.5",y:"35.5",width:"29",height:"21",rx:"6"})]}),o.jsx("g",{className:"new-chat-feature-card__illustration-details",children:o.jsx("path",{d:"M23 13.5v9m-4.5-4.5h9M56.5 14.5h13M56.5 21.5h13M16.5 42.5h13M16.5 49.5h9M56.5 42.5h13M56.5 49.5h13"})})]})}function pRe(){const[e,t]=g.useState(),[n,s]=g.useState(!1),[i,r]=g.useState(!1),[a,l]=g.useState(!1),[c,u]=g.useState(!0);return g.useEffect(()=>{if(!c)return;const d=window.matchMedia("(prefers-reduced-motion: reduce)"),f=()=>l(d.matches);return f(),d.addEventListener("change",f),()=>d.removeEventListener("change",f)},[c]),g.useEffect(()=>{if(!c||!e||n||i||a)return;const d=window.setInterval(()=>e.scrollNext(),6e3);return()=>window.clearInterval(d)},[e,i,n,a,c]),c?o.jsxs(oRe,{className:"new-chat-feature-carousel",opts:{align:"start",loop:!0},setApi:t,"aria-label":"新特性预览",onPointerEnter:()=>s(!0),onPointerLeave:()=>s(!1),onFocusCapture:()=>r(!0),onBlurCapture:d=>{d.currentTarget.contains(d.relatedTarget)||r(!1)},children:[o.jsx(uRe,{"aria-label":"上一张新特性"}),o.jsx(lRe,{children:hD.map((d,f)=>o.jsx(cRe,{"aria-label":`${f+1} / ${hD.length}`,children:o.jsxs("article",{className:"new-chat-feature-card",children:[o.jsxs("div",{className:"new-chat-feature-card__copy",children:[o.jsx("strong",{children:d.title}),o.jsx("span",{children:d.description})]}),o.jsx(hRe,{kind:d.illustration})]})},d.title))}),o.jsx("button",{type:"button",className:"new-chat-feature-carousel__close","aria-label":"关闭新特性轮播",onClick:()=>u(!1),children:o.jsx(fRe,{})}),o.jsx(dRe,{"aria-label":"下一张新特性"})]}):null}const mRe=3*60*1e3,gRe=3e3,bRe=10*60*1e3,_x="veadk.studio.pending-update",pD=[{id:"resolving",label:"读取目标版本信息"},{id:"downloading",label:"下载并校验完整更新包"},{id:"preparing",label:"准备 VeFaaS Function 代码"},{id:"submitting",label:"提交 Function 更新"},{id:"publishing",label:"发布新 Revision 并重启服务"}],yRe={resolving:"读取版本信息",downloading:"下载更新包",preparing:"准备 Function 代码",submitting:"提交 Function 更新",publishing:"发布 Revision",checking:"检查更新",unknown:"未知阶段"};function xRe(e){return e<60?`${e} 秒`:`${Math.floor(e/60)} 分 ${e%60} 秒`}function ERe(e,t){return e===t?!0:/^\d{14}$/.test(e)&&/^\d{14}$/.test(t)&&e>t}function vRe(){if(typeof window>"u")return null;const e=window.localStorage.getItem(_x);if(!e)return null;try{const t=JSON.parse(e);if(typeof t.targetVersion=="string"&&typeof t.startedAt=="number")return{targetVersion:t.targetVersion,startedAt:t.startedAt}}catch{}return window.localStorage.removeItem(_x),null}function Kw(e,t){window.localStorage.setItem(_x,JSON.stringify({targetVersion:e,startedAt:t}))}function db(){window.localStorage.removeItem(_x)}function mD({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M19.2 8.3A8 8 0 1 0 20 13"}),o.jsx("path",{d:"M19.2 4.8v3.5h-3.5"}),o.jsx("path",{d:"M12 7.8v7.7"}),o.jsx("path",{d:"m9.2 12.7 2.8 2.8 2.8-2.8"})]})}function wRe(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:"m4 6 4 4 4-4"})})}function SRe(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})})}function gD({lines:e,phase:t,copyState:n,onCopy:s}){const i=g.useRef(null),r=g.useRef(!0);return g.useEffect(()=>{const a=i.current;a&&r.current&&(a.scrollTop=a.scrollHeight)},[e]),o.jsxs("section",{className:"studio-update-live-log","aria-label":"VeFaaS 更新日志",children:[o.jsxs("div",{className:"studio-update-log-header",children:[o.jsxs("span",{children:[o.jsx("i",{className:`is-${t}`,"aria-hidden":!0}),"VeFaaS 更新日志",o.jsx("small",{children:t==="active"?"实时":t==="complete"?"已完成":"已停止"})]}),o.jsx("button",{type:"button",onClick:s,disabled:!e.length,children:n==="copied"?"已复制":n==="error"?"复制失败":"复制日志"})]}),o.jsx("div",{ref:i,className:"studio-update-log-lines",role:"log","aria-live":"off",tabIndex:0,onScroll:a=>{const l=a.currentTarget;r.current=l.scrollHeight-l.scrollTop-l.clientHeight<24},children:e.length?e.map((a,l)=>o.jsx("div",{children:a},`${l}-${a}`)):o.jsx("p",{children:t==="active"?"等待 VeFaaS 返回更新日志…":"本次更新未返回发布日志"})})]})}function _Re({variant:e="default"}){var D,F;const[t]=g.useState(vRe),[n,s]=g.useState(null),[i,r]=g.useState(t?"submitting":"idle"),[a,l]=g.useState(!1),[c,u]=g.useState(""),[d,f]=g.useState((t==null?void 0:t.targetVersion)??""),[h,p]=g.useState(!1),[m,b]=g.useState("idle"),[v,y]=g.useState(0),x=g.useRef(null),E=g.useRef((t==null?void 0:t.targetVersion)??""),w=g.useRef((t==null?void 0:t.startedAt)??0);g.useEffect(()=>{if(!h)return;const A=P=>{var $;P.target instanceof Node&&!(($=x.current)!=null&&$.contains(P.target))&&p(!1)},O=P=>{P.key==="Escape"&&p(!1)};return window.addEventListener("pointerdown",A),window.addEventListener("keydown",O),()=>{window.removeEventListener("pointerdown",A),window.removeEventListener("keydown",O)}},[h]);const _=g.useCallback(async()=>{const A=await s8(E.current||void 0,w.current||void 0);return s(A),A},[]);if(g.useEffect(()=>{let A=!0;const O=()=>{_().catch(()=>{A&&s($=>$)})};O();const P=window.setInterval(O,mRe);return()=>{A=!1,window.clearInterval(P)}},[_]),g.useEffect(()=>{if(i!=="submitting")return;const A=window.setInterval(()=>{_().then(O=>{const P=E.current;if(P&&ERe(O.currentVersion,P)||!P&&!O.available&&O.latestVersion){window.clearInterval(A),db(),r("published"),u("Studio 已更新,刷新页面即可使用新版本");return}if(O.state==="error"){window.clearInterval(A),db(),r("error"),u(O.message||"Studio 更新失败");return}Date.now()-w.current>bRe&&(window.clearInterval(A),db(),r("error"),u("等待 VeFaaS 发布超时,请稍后重新检查版本"))}).catch(()=>{})},gRe);return()=>window.clearInterval(A)},[i,_]),g.useEffect(()=>{i!=="idle"||(n==null?void 0:n.state)!=="updating"||(E.current=n.targetVersion,w.current=n.startedAt||Date.now(),Kw(n.targetVersion,w.current),f(n.targetVersion),r("submitting"))},[i,n]),g.useEffect(()=>{if(i!=="submitting"){y(0);return}const A=()=>{const P=w.current||Date.now();y(Math.max(0,Math.floor((Date.now()-P)/1e3)))};A();const O=window.setInterval(A,1e3);return()=>window.clearInterval(O)},[i]),!(n!=null&&n.enabled)||!(n.available||n.state==="updating"||i!=="idle"))return null;const k=n.releases??[],T=d||((D=k[0])==null?void 0:D.version)||n.latestVersion,C=k.find(A=>A.version===T),I=async()=>{E.current=T,w.current=Date.now(),Kw(T,w.current),r("submitting"),u(""),b("idle");try{const A=await i8(T);E.current=A.version,Kw(A.version,w.current),u("更新已提交,正在等待 VeFaaS 发布新版本")}catch(A){if(A instanceof TypeError){u("连接已切换,正在确认新版本状态");return}db(),r("error");const O=A instanceof Error?A.message:"Studio 更新失败";try{const P=await _();u(P.message||O)}catch{u(O)}}},j=(F=n.updateLogs)!=null&&F.length?n.updateLogs:(n.errorLog||n.progressMessage||c).split(` +`);if(!t.length||t[0].trim()!=="---")return{name:"",description:""};let n=-1;for(let i=1;i=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))}function JCe(...e){var t;for(const n of e){const s=(t=n.trim().replace(/\\/g,"/").split("/").filter(Boolean).pop())==null?void 0:t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"");if(s)return s.slice(0,64)}return"local-skill"}function eIe(e,t){return t.trim()||e}function _V(e){const t=e.map(s=>({path:s.path.replace(/\\/g,"/").replace(/^\.\//,""),text:s.text})).filter(s=>s.path.length>0&&!s.path.endsWith("/")),n=new Set(t.map(s=>s.path.split("/")[0]));if(n.size===1&&t.every(s=>s.path.includes("/"))){const s=[...n][0]+"/";return t.map(i=>({path:i.path.slice(s.length),text:i.text}))}return t}function tIe(e){const t=new Map,n=new Set;for(const s of e)if(ON.test("/"+s.path)){const i=s.path.split("/");n.add(i.slice(0,-1).join("/"))}for(const s of e){const i=s.path.split("/");let r="";for(let u=i.length-1;u>=0;u--){const d=i.slice(0,u).join("/");if(n.has(d)){r=d;break}}const a=ON.test("/"+s.path);if(!r&&!a&&!n.has("")||!n.has(r)&&!a)continue;const l=r?s.path.slice(r.length+1):s.path,c=t.get(r)||[];c.push({path:l,text:s.text}),t.set(r,c)}return t}function nIe(e,t,n){const s=`${n}${e?"/"+e:""}`,i=t.find(c=>ON.test("/"+c.path));if(!i)return{hit:null,error:`${s} 缺少 SKILL.md`};const r=QCe(i.text),a=JCe(r.name,e,n.replace(/\.[^.]+$/,"")),l=[];for(const c of t){if(c.path.split("/").some(f=>f===".."))return{hit:null,error:`${s} 包含非法路径(..):${c.path}`};const d=`skills/${a}/${c.path}`;if(!d.startsWith(`skills/${a}/`))return{hit:null,error:`${s} 包含非法路径:${c.path}`};l.push({path:d,content:c.text})}return{hit:{source:"local",id:`local:${a}:${t.length}`,name:eIe(a,r.name),description:r.description||"本地 Skill",folder:a,localFiles:l},error:null}}async function sIe(e){const t=new Uint8Array(await e.arrayBuffer()),s=(await SV(t)).map(i=>({path:i.name,text:i.text}));return NV(_V(s),e.name)}async function iIe(e,t=new Map){const n=[];for(let s=0;se.file(t,n))}async function aIe(e){const t=e.createReader(),n=[];for(;;){const s=await new Promise((i,r)=>t.readEntries(i,r));if(s.length===0)return n;n.push(...s)}}async function TV(e,t=""){const n=t?`${t}/${e.name}`:e.name;if(e.isFile)return[{file:await rIe(e),path:n}];if(!e.isDirectory)return[];const s=await aIe(e);return(await Promise.all(s.map(i=>TV(i,n)))).flat()}function oIe({selected:e,onChange:t}){const[n,s]=g.useState([]),[i,r]=g.useState([]),[a,l]=g.useState(!1),[c,u]=g.useState(!1),d=g.useRef(0),f=E=>e.some(w=>w.source==="local"&&w.folder===E),h=E=>{E.localFiles&&(f(E.folder||E.name)?t(e.filter(w=>!(w.source==="local"&&w.folder===(E.folder||E.name)))):t([...e,{source:"local",folder:E.folder||E.name,name:E.name,description:E.description,localFiles:E.localFiles}]))},p=g.useRef([]),m=g.useRef(e);g.useEffect(()=>{p.current=i},[i]),g.useEffect(()=>{m.current=e},[e]);const b=E=>{const w=new Set([...p.current.map(T=>T.folder||T.name),...m.current.filter(T=>T.source==="local").map(T=>T.folder)]),_=[],S=[];for(const T of E.hits){const C=T.folder||T.name;if(w.has(C)){_.push(T.name);continue}w.add(C),S.push(T)}r(T=>[...T,...S]);const k=[...E.errors];if(_.length>0&&k.push(`已跳过重复技能:${_.join("、")}`),s(k),S.length===1&&E.errors.length===0&&_.length===0){const T=S[0];T.localFiles&&t([...m.current,{source:"local",folder:T.folder||T.name,name:T.name,description:T.description,localFiles:T.localFiles}])}},v=E=>{E.preventDefault(),d.current+=1,u(!0)},y=E=>{E.preventDefault(),d.current=Math.max(0,d.current-1),d.current===0&&u(!1)},x=async E=>{if(E.preventDefault(),d.current=0,u(!1),a)return;const w=Array.from(E.dataTransfer.items).map(_=>{var S;return(S=_.webkitGetAsEntry)==null?void 0:S.call(_)}).filter(_=>_!==null);if(w.length===0){s(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}l(!0);try{const _=(await Promise.all(w.map(T=>TV(T)))).flat(),S=w.some(T=>T.isDirectory);if(!S&&_.length===1&&_[0].file.name.toLowerCase().endsWith(".zip")){b(await sIe(_[0].file));return}if(!S){s(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}const k=new Map(_.map(({file:T,path:C})=>[T,C]));b(await iIe(_.map(({file:T})=>T),k))}catch(_){s([`读取失败:${_ instanceof Error?_.message:String(_)}`])}finally{l(!1)}};return o.jsxs("div",{className:"cw-local",children:[o.jsxs("div",{className:`cw-local-dropzone ${c?"is-dragging":""}`,role:"group","aria-label":"拖入文件夹或 ZIP,自动识别 Skill",onDragEnter:v,onDragOver:E=>E.preventDefault(),onDragLeave:y,onDrop:E=>void x(E),children:[o.jsx(Ik,{className:"cw-local-drop-icon","aria-hidden":!0}),o.jsx("p",{className:"cw-local-drop-hint",children:"拖入文件夹或 ZIP,自动识别 Skill"})]}),o.jsx("p",{className:"cw-local-hint",children:"每个技能需包含 SKILL.md。支持包含多个技能的目录。"}),a&&o.jsx("p",{className:"cw-empty-line",children:"正在读取文件…"}),n.length>0&&o.jsxs("div",{className:"cw-banner",children:[o.jsx(cc,{className:"cw-i"}),o.jsx("span",{children:n.join(";")})]}),i.length>0&&o.jsx("div",{className:"cw-skill-results",children:i.map(E=>{var _;const w=f(E.folder||E.name);return o.jsxs("button",{type:"button",className:`cw-skill-result ${w?"is-on":""}`,onClick:()=>h(E),"aria-pressed":w,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:w?o.jsx(ja,{className:"cw-i cw-i-sm"}):o.jsx(_i,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsx("span",{className:"cw-skill-result-name",children:E.name}),E.description&&o.jsx("span",{className:"cw-skill-result-desc",children:rc(E.description)}),o.jsxs("span",{className:"cw-skill-result-repo",children:["本地 · ",((_=E.localFiles)==null?void 0:_.length)??0," 个文件"]})]})]},E.id)})})]})}function lIe(e){return e==="cn-beijing"?"北京":e==="cn-shanghai"?"上海":e}function cIe({selected:e,onChange:t}){const[n,s]=g.useState([]),[i,r]=g.useState([]),[a,l]=g.useState(""),[c,u]=g.useState(!0),[d,f]=g.useState(!1),[h,p]=g.useState(null);g.useEffect(()=>{let y=!1;return(async()=>{u(!0),p(null);try{const x=await qU();y||(s(x),x.length>0&&l(x[0].id))}catch(x){y||p(x instanceof Error?x.message:"加载失败")}finally{y||u(!1)}})(),()=>{y=!0}},[]),g.useEffect(()=>{if(!a){r([]);return}const y=n.find(E=>E.id===a);let x=!1;return(async()=>{f(!0),p(null);try{const E=await YU(a,y==null?void 0:y.region);x||r(E)}catch(E){x||p(E instanceof Error?E.message:"加载失败")}finally{x||f(!1)}})(),()=>{x=!0}},[a,n]);const m=n.find(y=>y.id===a),b=(y,x)=>e.some(E=>E.source==="skillspace"&&E.skillId===y&&(E.version||"")===x),v=y=>{if(m)if(b(y.skillId,y.version))t(e.filter(x=>!(x.source==="skillspace"&&x.skillId===y.skillId&&(x.version||"")===y.version)));else{const x=hfe(m,y);t([...e,{source:"skillspace",folder:x.folder||y.skillName,name:x.name,description:x.description,skillSpaceId:x.skillSpaceId,skillSpaceName:x.skillSpaceName,skillSpaceRegion:x.skillSpaceRegion,skillId:x.skillId,version:x.version}])}};return o.jsx("div",{className:"cw-skillspace",children:c?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(dn,{className:"cw-i cw-spin"})," 正在加载 AgentKit Skills 中心…"]}):h?o.jsxs("div",{className:"cw-banner",children:[o.jsx(cc,{className:"cw-i"}),o.jsx("span",{children:h})]}):n.length===0?o.jsx("p",{className:"cw-empty-line",children:"此账号下没有 AgentKit Skills 中心。"}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cw-skillspace-header",children:[o.jsx("select",{className:"cw-input cw-skillspace-select",value:a,onChange:y=>l(y.target.value),"aria-label":"选择 AgentKit Skills 中心",children:n.map(y=>o.jsxs("option",{value:y.id,children:[y.name||y.id,y.description?` — ${rc(y.description)}`:""]},y.id))}),m&&o.jsxs(o.Fragment,{children:[m.region&&o.jsx("span",{className:"cw-skillspace-region-label",title:m.region,children:lIe(m.region)}),o.jsx("a",{href:pfe(m.id,m.region),target:"_blank",rel:"noopener noreferrer",className:"cw-button cw-button-secondary cw-skillspace-console-link",title:"在火山引擎控制台打开","aria-label":"在火山引擎控制台打开",children:o.jsx(Em,{className:"cw-i cw-i-sm"})})]})]}),d?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(dn,{className:"cw-i cw-spin"})," 正在加载技能列表…"]}):i.length===0?o.jsx("p",{className:"cw-empty-line",children:"此 AgentKit Skills 中心暂无技能。"}):o.jsx("div",{className:"cw-skill-results",children:i.map(y=>{const x=b(y.skillId,y.version);return o.jsxs("button",{type:"button",className:`cw-skill-result ${x?"is-on":""}`,onClick:()=>v(y),"aria-pressed":x,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:x?o.jsx(ja,{className:"cw-i cw-i-sm"}):o.jsx(_i,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsxs("span",{className:"cw-skill-result-name",children:[y.skillName,y.version&&o.jsxs("span",{className:"cw-skill-result-version",children:[" ","v",y.version]})]}),y.skillDescription&&o.jsx("span",{className:"cw-skill-result-desc",children:rc(y.skillDescription)}),o.jsxs("span",{className:"cw-skill-result-repo",children:[o.jsx(JJ,{className:"cw-i cw-i-sm"})," ",(m==null?void 0:m.name)||a]})]})]},`${y.skillId}/${y.version}`)})})]})})}async function uIe(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Pn(void 0,uc)});if(t.status===409)throw new Error("服务端未配置 Volcengine AK/SK,无法访问 AgentKit 智能体中心");if(t.status===401)throw new Error("请先登录以访问 AgentKit 智能体中心");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function dIe(e={}){const t=new URLSearchParams({region:e.region||"cn-beijing",page_size:String(e.pageSize??100),project:e.project||"default"});return(await uIe(`/web/a2a-spaces?${t.toString()}`)).items||[]}async function fIe(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Pn(void 0,uc)});if(t.status===409)throw new Error("服务端未配置 Volcengine AK/SK,无法访问 VikingDB 知识库");if(t.status===401)throw new Error("请先登录以访问 VikingDB 知识库");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function hIe(e={}){const t=new URLSearchParams({region:e.region||"cn-beijing",project:e.project||"default"});return(await fIe(`/web/viking-knowledgebases?${t.toString()}`)).items||[]}const eD=["#6366f1","#0ea5e9","#10b981","#f59e0b","#f43f5e","#a855f7","#14b8a6","#f472b6"];function $w(e){let t=0;for(let n=0;n>>0;return eD[t%eD.length]}function pIe(e){const t=new Map;e.forEach(u=>t.set(u.span_id,u));const n=new Map,s=[];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):s.push(u);const i=(u,d)=>u.start_time-d.start_time,r=(u,d)=>({span:u,depth:d,children:(n.get(u.span_id)??[]).sort(i).map(f=>r(f,d+1))}),a=s.sort(i).map(u=>r(u,0)),l=e.length?Math.min(...e.map(u=>u.start_time)):0,c=e.length?Math.max(...e.map(u=>u.end_time)):1;return{rootNodes:a,min:l,total:c-l||1}}function mIe(e,t){const n=[],s=i=>{n.push(i),t.has(i.span.span_id)||i.children.forEach(s)};return e.forEach(s),n}function tD(e){const t=e/1e6;return t>=1e3?`${(t/1e3).toFixed(2)} s`:`${t.toFixed(t<10?2:1)} ms`}const gIe=e=>e.replace(/^(gen_ai|a2ui|adk)\./,"");function nD(e){return Object.entries(e.attributes).filter(([,t])=>t!=null&&typeof t!="object").map(([t,n])=>{const s=String(n);return{key:gIe(t),value:s,long:s.length>80||s.includes(` +`)}}).sort((t,n)=>Number(t.long)-Number(n.long))}function kV({appName:e,testRunId:t,sessionId:n,endTimeMs:s,onClose:i,title:r="调用链路观测"}){const[a,l]=g.useState(null),[c,u]=g.useState(""),[d,f]=g.useState(new Set),[h,p]=g.useState(null);g.useEffect(()=>{l(null),u("");let _;if(t)_=y8(t,n);else if(e)_=Gy(e,n,s);else{u("缺少调用链路来源");return}_.then(S=>{l(S),p(S.length?S.reduce((k,T)=>k.start_time<=T.start_time?k:T).span_id:null)}).catch(S=>u(S instanceof Error?S.message:String(S)))},[e,s,n,t]);const{rootNodes:m,min:b,total:v}=g.useMemo(()=>pIe(a??[]),[a]),y=g.useMemo(()=>mIe(m,d),[m,d]),x=(a==null?void 0:a.find(_=>_.span_id===h))??null,E=v/1e6,w=_=>f(S=>{const k=new Set(S);return k.has(_)?k.delete(_):k.add(_),k});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"drawer-scrim",onClick:i}),o.jsxs("aside",{className:"drawer drawer--trace",children:[o.jsxs("header",{className:"drawer-head",children:[o.jsxs("div",{children:[o.jsx("div",{className:"drawer-title",children:r}),o.jsx("div",{className:"drawer-sub",children:a?`${a.length} 个调用 · ${E.toFixed(1)} ms`:"加载中"})]}),o.jsx("button",{className:"drawer-close",onClick:i,"aria-label":"关闭",children:o.jsx(Ti,{className:"icon"})})]}),a==null&&!c&&o.jsxs("div",{className:"drawer-loading",children:[o.jsx(dn,{className:"icon spin"})," 加载调用链路…"]}),c&&o.jsx("div",{className:"error",children:c}),a&&a.length===0&&o.jsx("div",{className:"drawer-empty",children:"该会话暂无调用链路(可能尚未产生调用)。"}),y.length>0&&o.jsxs("div",{className:"trace-split",children:[o.jsx("div",{className:"trace-tree scroll",children:y.map(_=>{const S=_.span,k=(S.start_time-b)/v*100,T=Math.max((S.end_time-S.start_time)/v*100,.6),C=_.children.length>0;return o.jsxs("button",{className:`trace-row ${h===S.span_id?"active":""}`,onClick:()=>p(S.span_id),children:[o.jsxs("span",{className:"trace-label",style:{paddingLeft:_.depth*14},children:[o.jsx("span",{className:`trace-caret ${C?"":"hidden"} ${d.has(S.span_id)?"":"open"}`,onClick:I=>{I.stopPropagation(),C&&w(S.span_id)},children:o.jsx(nc,{className:"chev"})}),o.jsx("span",{className:"trace-dot",style:{background:$w(S.name)}}),o.jsx("span",{className:"trace-name",title:S.name,children:S.name})]}),o.jsx("span",{className:"trace-dur",children:tD(S.end_time-S.start_time)}),o.jsx("span",{className:"trace-track",children:o.jsx("span",{className:"trace-bar",style:{left:`${k}%`,width:`${T}%`,background:$w(S.name)}})})]},S.span_id)})}),o.jsx("div",{className:"trace-detail scroll",children:x?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"td-title",children:x.name}),o.jsxs("div",{className:"td-dur",children:[o.jsx("span",{className:"td-dot",style:{background:$w(x.name)}}),tD(x.end_time-x.start_time)]}),o.jsx("div",{className:"td-section",children:"属性"}),o.jsx("div",{className:"td-props",children:nD(x).filter(_=>!_.long).map(_=>o.jsxs("div",{className:"td-prop",children:[o.jsx("span",{className:"td-key",children:_.key}),o.jsx("span",{className:"td-val",children:_.value})]},_.key))}),nD(x).filter(_=>_.long).map(_=>o.jsxs("div",{className:"td-block",children:[o.jsx("div",{className:"td-section",children:_.key}),o.jsx("pre",{className:"td-pre",children:_.value})]},_.key))]}):o.jsx("div",{className:"drawer-empty",children:"选择左侧的一个调用查看详情"})})]})]})]})}const bIe=g.lazy(()=>eu(()=>import("./MarkdownPromptEditor-CL92_Aob.js"),__vite__mapDeps([0,1]))),MN="veadk.generatedAgentTestRuns",sD=4;function D2(){if(typeof window>"u")return[];try{const e=JSON.parse(window.sessionStorage.getItem(MN)??"[]");return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}catch{return[]}}function AV(e){if(typeof window>"u")return;const t=Array.from(new Set(e)).slice(-20);try{t.length?window.sessionStorage.setItem(MN,JSON.stringify(t)):window.sessionStorage.removeItem(MN)}catch{}}function yIe(e){AV([...D2(),e])}function Qh(e){AV(D2().filter(t=>t!==e))}function xIe(e,t,n="text/plain"){const s=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),i=document.createElement("a");i.href=s,i.download=e,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(s)}const EIe=[{id:"type",label:"Agent 类型",hint:"选择 Agent 类型",icon:Ree,required:!0},{id:"basic",label:"基本信息",hint:"名称、描述与系统提示词",icon:cc,required:!0},{id:"model",label:"模型配置",hint:"模型与服务(可选)",icon:tee},{id:"tools",label:"工具",hint:"可调用的能力",icon:SB},{id:"skills",label:"技能",hint:"声明式技能",icon:ou},{id:"knowledge",label:"知识库",hint:"外部知识检索",icon:Rb},{id:"memory",label:"记忆",hint:"短期与长期记忆",icon:EB},{id:"subagents",label:"子 Agent",hint:"嵌套协作",icon:WJ},{id:"review",label:"完成",hint:"预览并创建",icon:Cee}];function vIe({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.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"}),o.jsx("path",{d:"M5.75 8.25v7.5",opacity:"0.8"}),o.jsx("path",{d:"M3 10v4",opacity:"0.45"}),o.jsx("path",{d:"M17.9 5.25v2.2M19 6.35h-2.2",strokeWidth:"1.55"})]})}function iD({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M4.75 7.25h14.5"}),o.jsx("path",{d:"M9.1 4.75h5.8l.75 2.5h-7.3l.75-2.5Z"}),o.jsx("path",{d:"m6.75 7.25.75 12h9l.75-12"}),o.jsx("path",{d:"M10 10.25v5.75M14 10.25v5.75"})]})}function CV({className:e}){return o.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o.jsx("path",{d:"m7 9 5 5 5-5"})})}function IV({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M18.25 8.2A7.1 7.1 0 0 0 6.1 6.65L4.5 8.25"}),o.jsx("path",{d:"M4.5 4.75v3.5H8"}),o.jsx("path",{d:"M5.75 15.8A7.1 7.1 0 0 0 17.9 17.35l1.6-1.6"}),o.jsx("path",{d:"M19.5 19.25v-3.5H16"})]})}const wIe={llm:"智能体",sequential:"分步协作",parallel:"同时处理",loop:"循环执行",a2a:"远程智能体"},rD={REGISTRY_SPACE_ID:"registrySpaceId",REGISTRY_TOP_K:"registryTopK",REGISTRY_REGION:"registryRegion",REGISTRY_ENDPOINT:"registryEndpoint"},jV="REGISTRY_SPACE_ID",SIe=GU.filter(e=>e.key!==jV);function RV(e,t){var s,i,r;if(!(e!=null&&e.enabled))return{};const n={REGISTRY_SPACE_ID:e.registrySpaceId??""};return t.includeDefaults?(n.REGISTRY_TOP_K=((s=e.registryTopK)==null?void 0:s.trim())||Na.topK,n.REGISTRY_REGION=((i=e.registryRegion)==null?void 0:i.trim())||Na.region,n.REGISTRY_ENDPOINT=((r=e.registryEndpoint)==null?void 0:r.trim())||Na.endpoint):(n.REGISTRY_TOP_K=e.registryTopK??"",n.REGISTRY_REGION=e.registryRegion??"",n.REGISTRY_ENDPOINT=e.registryEndpoint??""),n}function _Ie({items:e,selected:t,onToggle:n,scrollRows:s}){return o.jsx("div",{className:`cw-checklist ${s?"cw-checklist-tools":""}`,style:s?{"--cw-checklist-max-height":`${s*40+(s-1)*8}px`}:void 0,children:e.map(i=>{const r=t.includes(i.id);return o.jsx(xV,{id:`cw-check-${i.id}`,className:`cw-check ${r?"is-on":""}`,checked:r,onCheckedChange:a=>{a!==r&&n(i.id)},label:o.jsx("span",{className:"cw-check-text",children:o.jsx("span",{className:"cw-check-title",children:i.label})})},i.id)})})}function Hw({options:e,value:t,onChange:n}){return o.jsx("div",{className:"cw-segmented",children:e.map(s=>{var r;const i=(t??((r=e[0])==null?void 0:r.id))===s.id;return o.jsx("button",{type:"button",className:`cw-seg ${i?"is-on":""}`,onClick:()=>n(s.id),"aria-pressed":i,children:o.jsx("span",{className:"cw-seg-title",children:s.label})},s.id)})})}function NIe(e){return/(SECRET|PASSWORD|KEY|TOKEN)$/.test(e)}function Zh({env:e,values:t,onChange:n}){return e.length===0?o.jsx("p",{className:"cw-env-empty",children:"此后端无需额外运行参数。"}):o.jsx("div",{className:"cw-env-fields",children:e.map(s=>{const i=t[s.key]??s.defaultValue??"",r=N2(s,t),a=`cw-env-${s.key}`;return o.jsxs("label",{className:"cw-env-field",htmlFor:a,children:[o.jsxs("span",{className:"cw-env-field-head",children:[o.jsxs("span",{className:"cw-env-field-title",children:[o.jsxs("span",{className:"cw-env-field-label",children:[s.comment||s.key,s.required&&o.jsx("span",{className:"cw-req",children:"*"})]}),s.help&&o.jsxs("span",{className:"cw-env-help",tabIndex:0,"data-help":s.help,"aria-label":`${s.comment||s.key}说明:${s.help}`,children:["?",o.jsx("span",{className:"cw-env-help-popover",role:"tooltip",children:s.help})]}),s.link&&o.jsx("a",{className:"cw-env-link",href:s.link.url,target:"_blank",rel:"noopener noreferrer",title:`打开 OpenViking ${s.link.label}`,"aria-label":`打开 OpenViking ${s.link.label}`,onClick:l=>l.stopPropagation(),children:o.jsx(Em,{"aria-hidden":"true"})})]}),s.comment&&o.jsx("code",{title:s.key,children:s.key})]}),s.multiline||s.format==="json"?o.jsx("textarea",{id:a,className:"cw-input cw-env-textarea",value:i,placeholder:s.placeholder||"请输入参数值",autoComplete:"off",spellCheck:!1,"aria-invalid":!!r,onChange:l=>n(s.key,l.currentTarget.value)}):o.jsx("input",{id:a,className:"cw-input",type:NIe(s.key)?"password":"text",value:i,placeholder:s.placeholder||"请输入参数值",autoComplete:"off","aria-invalid":!!r,onChange:l=>n(s.key,l.currentTarget.value)}),r&&o.jsx("span",{className:"cw-env-error",children:r})]},s.key)})})}function zw(e){return e.name.trim()||"未命名智能体中心"}function Vw(e){return e.name.trim()||e.id||"未命名知识库"}function TIe({value:e,region:t,invalid:n,onChange:s}){const i=t.trim()||Na.region,[r,a]=g.useState([]),[l,c]=g.useState(!1),[u,d]=g.useState(null),[f,h]=g.useState(0),[p,m]=g.useState(!1),[b,v]=g.useState(""),y=g.useRef(null);g.useEffect(()=>{let C=!1;return c(!0),d(null),dIe({region:i}).then(I=>{C||a(I)}).catch(I=>{C||(a([]),d(I instanceof Error?I.message:"加载失败"))}).finally(()=>{C||c(!1)}),()=>{C=!0}},[i,f]);const x=!e||r.some(C=>C.id===e.trim()),E=r.find(C=>C.id===e.trim()),w=E?zw(E):e&&!x?"已选择的智能体中心":"请选择智能体中心",_=l&&r.length===0,S=g.useMemo(()=>r.filter(C=>wx(b,[zw(C),C.id,C.projectName])),[b,r]),k=!!(e&&!x&&wx(b,["已选择的智能体中心",e]));g.useEffect(()=>{if(!p)return;const C=j=>{const L=j.target;L instanceof Node&&y.current&&!y.current.contains(L)&&m(!1)},I=j=>{j.key==="Escape"&&m(!1)};return window.addEventListener("pointerdown",C),window.addEventListener("keydown",I),()=>{window.removeEventListener("pointerdown",C),window.removeEventListener("keydown",I)}},[p]);const T=C=>{s(C),m(!1)};return o.jsxs("div",{className:"cw-a2a-space-picker",ref:y,children:[o.jsxs("div",{className:"cw-a2a-space-row",children:[o.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[o.jsxs("button",{type:"button",className:`cw-a2a-space-trigger ${n?"is-error":""}`,disabled:_,"aria-haspopup":"listbox","aria-expanded":p,"aria-label":"选择 AgentKit 智能体中心",onClick:()=>{v(""),m(C=>!C)},children:[o.jsx("span",{className:e?void 0:"is-placeholder",children:w}),o.jsx(CV,{className:"cw-a2a-space-trigger-icon"})]}),p&&o.jsxs("div",{className:"cw-a2a-space-menu",children:[o.jsx("div",{className:"cw-picker-search",children:o.jsx("input",{className:"cw-picker-search-input",type:"search",value:b,autoFocus:!0,autoComplete:"off","aria-label":"搜索 AgentKit 智能体中心",placeholder:"搜索名称或 ID",onChange:C=>v(C.currentTarget.value)})}),o.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"AgentKit 智能体中心",children:[k&&o.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>T(e),children:"已选择的智能体中心"}),S.map(C=>{const I=zw(C),j=C.id===e;return o.jsx("button",{type:"button",role:"option","aria-selected":j,className:`cw-a2a-space-option ${j?"is-selected":""}`,title:`${I} (${C.id})`,onClick:()=>T(C.id),children:I},C.id)}),!k&&S.length===0&&o.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的智能体中心"})]})]})]}),o.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh",title:"刷新智能体中心列表","aria-label":"刷新智能体中心列表",disabled:l,onClick:()=>h(C=>C+1),children:l?o.jsx(dn,{className:"cw-i cw-i-sm cw-spin"}):o.jsx(IV,{className:"cw-i cw-i-sm"})})]}),u?o.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[o.jsx(cc,{className:"cw-i"}),o.jsx("span",{children:u})]}):l?o.jsxs("span",{className:"cw-help cw-a2a-space-status",children:[o.jsx(dn,{className:"cw-i cw-i-sm cw-spin"}),"正在加载 AgentKit 智能体中心…"]}):r.length===0?o.jsx("span",{className:"cw-help",children:"此账号下暂无 AgentKit 智能体中心。"}):o.jsxs("span",{className:"cw-help",children:["已加载 ",r.length," 个智能体中心,列表仅展示中心名称。"]})]})}function kIe({value:e,onChange:t}){const[n,s]=g.useState([]),[i,r]=g.useState(!1),[a,l]=g.useState(null),[c,u]=g.useState(0),[d,f]=g.useState(!1),[h,p]=g.useState(""),m=g.useRef(null);g.useEffect(()=>{let S=!1;return r(!0),l(null),hIe().then(k=>{S||s(k)}).catch(k=>{S||(s([]),l(k instanceof Error?k.message:"加载失败"))}).finally(()=>{S||r(!1)}),()=>{S=!0}},[c]);const b=!e||n.some(S=>S.id===e.trim()),v=n.find(S=>S.id===e.trim()),y=v?Vw(v):e&&!b?e:"请选择 VikingDB 知识库",x=i&&n.length===0,E=g.useMemo(()=>n.filter(S=>wx(h,[Vw(S),S.id,S.description,S.projectName])),[n,h]),w=!!(e&&!b&&wx(h,[e]));g.useEffect(()=>{if(!d)return;const S=T=>{const C=T.target;C instanceof Node&&m.current&&!m.current.contains(C)&&f(!1)},k=T=>{T.key==="Escape"&&f(!1)};return window.addEventListener("pointerdown",S),window.addEventListener("keydown",k),()=>{window.removeEventListener("pointerdown",S),window.removeEventListener("keydown",k)}},[d]);const _=S=>{t(S),f(!1)};return i&&n.length===0?o.jsxs("span",{className:"cw-viking-kb-inline-status",role:"status",children:[o.jsx(dn,{className:"cw-i cw-i-sm cw-spin"}),"正在加载…"]}):o.jsxs("div",{className:"cw-a2a-space-picker cw-viking-kb-picker",ref:m,children:[o.jsxs("div",{className:"cw-a2a-space-row",children:[o.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[o.jsxs("button",{type:"button",className:"cw-a2a-space-trigger",disabled:x,"aria-haspopup":"listbox","aria-expanded":d,"aria-label":"选择 VikingDB 知识库",onClick:()=>{p(""),f(S=>!S)},children:[o.jsx("span",{className:e?void 0:"is-placeholder",children:y}),o.jsx(CV,{className:"cw-a2a-space-trigger-icon"})]}),d&&o.jsxs("div",{className:"cw-a2a-space-menu cw-viking-kb-menu",children:[o.jsx("div",{className:"cw-picker-search",children:o.jsx("input",{className:"cw-picker-search-input",type:"search",value:h,autoFocus:!0,autoComplete:"off","aria-label":"搜索 VikingDB 知识库",placeholder:"搜索名称或 ID",onChange:S=>p(S.currentTarget.value)})}),o.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"VikingDB 知识库",children:[w&&o.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>_(e),children:e}),E.map(S=>{const k=Vw(S),T=S.id===e;return o.jsx("button",{type:"button",role:"option","aria-selected":T,className:`cw-a2a-space-option ${T?"is-selected":""}`,title:`${k} (${S.id})`,onClick:()=>_(S.id),children:k},S.id)}),!w&&E.length===0&&o.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的知识库"})]})]})]}),o.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh cw-viking-kb-refresh",title:"刷新知识库列表","aria-label":"刷新知识库列表",disabled:i,onClick:()=>u(S=>S+1),children:i?o.jsx(dn,{className:"cw-i cw-i-sm cw-spin"}):o.jsx(IV,{className:"cw-i cw-i-sm"})})]}),a?o.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[o.jsx(cc,{className:"cw-i"}),o.jsx("span",{children:a})]}):n.length===0?o.jsx("span",{className:"cw-help",children:"此账号下暂无 VikingDB 知识库。"}):o.jsxs("span",{className:"cw-help",children:["已加载 ",n.length," 个知识库,选择的知识库会用于当前 Agent。"]})]})}function AIe({tools:e,onChange:t}){const n=(r,a)=>t(e.map((l,c)=>c===r?{...l,...a}:l)),s=r=>t(e.filter((a,l)=>l!==r)),i=()=>t([...e,{name:"",transport:"http",url:""}]);return o.jsxs("div",{className:"cw-mcp",children:[e.length>0&&o.jsx("div",{className:"cw-mcp-list",children:o.jsx(Po,{initial:!1,children:e.map((r,a)=>o.jsxs(Jn.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:[o.jsxs("div",{className:"cw-mcp-rowhead",children:[o.jsxs("div",{className:"cw-mcp-transport",children:[o.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${r.transport==="http"?"is-on":""}`,onClick:()=>n(a,{transport:"http"}),"aria-pressed":r.transport==="http",children:o.jsx("span",{className:"cw-seg-title",children:"HTTP"})}),o.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${r.transport==="stdio"?"is-on":""}`,onClick:()=>n(a,{transport:"stdio"}),"aria-pressed":r.transport==="stdio",children:o.jsx("span",{className:"cw-seg-title",children:"stdio"})})]}),o.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger",onClick:()=>s(a),"aria-label":"移除 MCP 工具",children:o.jsx(sc,{className:"cw-i cw-i-sm"})})]}),o.jsx("input",{className:"cw-input",value:r.name,placeholder:"名称(用于命名,可留空)",onChange:l=>n(a,{name:l.target.value})}),r.transport==="http"?o.jsxs(o.Fragment,{children:[o.jsx("input",{className:"cw-input",value:r.url??"",placeholder:"MCP 服务地址(StreamableHTTP)",onChange:l=>n(a,{url:l.target.value})}),tAe(r.url??"")&&o.jsxs("p",{className:"cw-mcp-warning",children:[o.jsx(cc,{"aria-hidden":"true"}),o.jsx("span",{children:"当前地址不是以 /mcp 结尾,请确认它是实际的 MCP Endpoint。Studio 会保留该地址,不会自动补充路径。"})]}),o.jsx("input",{className:"cw-input",value:Jke(r),placeholder:"Bearer Token(可选)",onChange:l=>t(e.map((c,u)=>u===a?eAe(c,l.target.value):c))})]}):o.jsxs(o.Fragment,{children:[o.jsx("input",{className:"cw-input",value:r.command??"",placeholder:"启动命令,例如 npx",onChange:l=>n(a,{command:l.target.value})}),o.jsx("input",{className:"cw-input",value:(r.args??[]).join(" "),placeholder:"参数(用空格分隔),例如 -y @playwright/mcp@latest",onChange:l=>n(a,{args:l.target.value.split(/\s+/).filter(Boolean)})}),o.jsx("p",{className:"cw-mcp-note",children:"stdio MCP 暂不参与调试运行;点击“去部署”时会完整保留这项配置并生成对应代码。"})]})]},a))})}),o.jsxs("button",{type:"button",className:"cw-add-sub",onClick:i,children:[o.jsx(_i,{className:"cw-i"}),"添加 MCP 工具"]}),e.length===0&&o.jsx("p",{className:"cw-empty-line",children:"暂无 MCP 工具,点击「添加 MCP 工具」连接外部 MCP 服务。"})]})}function OV({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.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"}),o.jsx("path",{d:"M7 4.75h9.5a2 2 0 0 1 2 2",opacity:".58"}),o.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"}),o.jsx("path",{d:"M19.25 11.25h1.5M20 10.5V12",opacity:".72"})]})}function CIe({s:e,onRemove:t}){let n=ou,s="火山 Find Skill 技能广场";return e.source==="local"?(n=Ik,s="本地"):e.source==="skillspace"&&(n=OV,s="AgentKit Skills 中心"),o.jsxs(Jn.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:[o.jsx("span",{className:"cw-selected-skill-icon","aria-hidden":!0,children:o.jsx(n,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-selected-skill-meta",children:[o.jsx("span",{className:"cw-selected-skill-name",children:e.name}),o.jsxs("span",{className:"cw-selected-skill-detail",children:[s,e.description?` · ${rc(e.description)}`:""]})]}),o.jsx("button",{type:"button",className:"cw-selected-skill-remove",onClick:t,"aria-label":`移除 ${e.name}`,title:`移除 ${e.name}`,children:o.jsx(Ti,{className:"cw-i cw-i-sm"})})]},`${e.source}:${e.folder}:${e.skillId||e.slug||""}:${e.version||""}`)}const Gw=[{id:"local",label:"本地文件",icon:Ik},{id:"skillspace",label:"AgentKit Skills 中心",icon:OV},{id:"skillhub",label:"火山 Find Skill 技能广场",icon:n1}];function IIe({selected:e,onChange:t}){const[n,s]=g.useState("local"),[i,r]=g.useState(!1),a=Gw.findIndex(c=>c.id===n),l=c=>t(e.filter(u=>Kw(u)!==c));return g.useEffect(()=>{if(!i)return;const c=u=>{u.key==="Escape"&&r(!1)};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[i]),o.jsxs("div",{className:"cw-skillspane",children:[o.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",onClick:()=>r(!0),children:[o.jsx("span",{className:"cw-skill-add-icon","aria-hidden":!0,children:o.jsx(_i,{className:"cw-i"})}),o.jsx("span",{children:"添加 Skill"})]}),e.length>0&&o.jsxs("div",{className:"cw-skill-selected",children:[o.jsxs("span",{className:"cw-skill-selected-label",children:["已加入技能 · ",e.length]}),o.jsx("div",{className:"cw-selected-skill-list",children:o.jsx(Po,{initial:!1,children:e.map(c=>o.jsx(CIe,{s:c,onRemove:()=>l(Kw(c))},Kw(c)))})})]}),o.jsx(Po,{children:i&&o.jsx(Jn.div,{className:"cw-skill-dialog-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},onMouseDown:c=>{c.target===c.currentTarget&&r(!1)},children:o.jsxs(Jn.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:[o.jsxs("div",{className:"cw-skill-dialog-head",children:[o.jsx("h3",{id:"cw-skill-dialog-title",children:"添加 Skill"}),o.jsx("button",{type:"button",className:"cw-skill-dialog-close","aria-label":"关闭添加 Skill",onClick:()=>r(!1),children:o.jsx(Ti,{className:"cw-i"})})]}),o.jsxs("div",{className:"cw-skill-dialog-body",children:[o.jsxs("div",{className:"cw-skill-sourcetabs",role:"tablist",style:{"--cw-skill-tab-slider-width":`calc((100% - 16px) / ${Gw.length})`,"--cw-active-skill-tab-offset":`calc(${a*100}% + ${a*4}px)`},children:[o.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":!0}),Gw.map(({id:c,label:u,icon:d})=>o.jsxs("button",{type:"button",role:"tab",id:`cw-skill-tab-${c}`,"aria-controls":"cw-skill-tabpanel","aria-selected":n===c,className:`cw-skill-pickertab ${n===c?"is-on":""}`,onClick:()=>s(c),children:[o.jsx(d,{className:"cw-i cw-i-sm"}),u]},c))]}),o.jsxs("div",{id:"cw-skill-tabpanel",className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`cw-skill-tab-${n}`,children:[n==="skillhub"&&o.jsx(XCe,{selected:e,onChange:t}),n==="local"&&o.jsx(oIe,{selected:e,onChange:t}),n==="skillspace"&&o.jsx(cIe,{selected:e,onChange:t})]})]})]})})})]})}function Kw(e){return e.source==="skillhub"?`hub:${e.namespace}/${e.slug}`:e.source==="local"?`local:${e.folder}`:`ss:${e.skillSpaceId}/${e.skillId}/${e.version||""}`}function cb({checked:e,onChange:t,title:n}){return o.jsxs("button",{type:"button",className:`cw-toggle ${e?"is-on":""}`,onClick:()=>t(!e),"aria-pressed":e,children:[o.jsx("span",{className:"cw-toggle-text",children:o.jsx("span",{className:"cw-toggle-title",children:n})}),o.jsx("span",{className:"cw-switch","aria-hidden":!0,children:o.jsx(Jn.span,{className:"cw-switch-knob",layout:!0,transition:{type:"spring",stiffness:520,damping:34}})})]})}function jIe(e,t){var s;let n=e;for(const i of t)if(n=(s=n.subAgents)==null?void 0:s[i],!n)return!1;return!0}function ub(e,t){let n=e;for(const s of t)n=n.subAgents[s];return n}function Lg(e,t,n){if(t.length===0)return n(e);const[s,...i]=t,r=e.subAgents.slice();return r[s]=Lg(r[s],i,n),{...e,subAgents:r}}function RIe(e,t){return Lg(e,t,n=>({...n,subAgents:[...n.subAgents,wi()]}))}function OIe(e,t,n){return Lg(e,t,s=>{const i=s.subAgents.slice();return i.splice(n,0,wi()),{...s,subAgents:i}})}function MIe(e,t){if(t.length===0)return e;const n=t.slice(0,-1),s=t[t.length-1];return Lg(e,n,i=>({...i,subAgents:i.subAgents.filter((r,a)=>a!==s)}))}const LN=e=>!aE(e.agentType),aD=3;function LIe(e,t,n=!1){var i;if(aE(e.agentType))return n?"远程 Agent 只能作为子 Agent":(i=e.a2aRegistry)!=null&&i.registrySpaceId.trim()?null:"缺少 AgentKit 智能体中心";const s=Yl(e.name);return s||(t.has(e.name)?"Agent 名称在当前结构中必须唯一":e.description.trim().length===0?"缺少描述":wV(e.agentType)?e.subAgents.length===0?"缺少子 Agent":null:e.instruction.trim().length===0?"缺少系统提示词":null)}function MV(e,t,n=[]){const s=[],i=aE(e.agentType),r=LIe(e,t,n.length===0);return r&&s.push({path:n,name:i?"远程 Agent":e.name.trim()||"未命名",typeLabel:vV(e.agentType).label,problem:r}),LN(e)&&e.subAgents.forEach((a,l)=>s.push(...MV(a,t,[...n,l]))),s}function DIe(e){return`${e.typeLabel}至少需要添加一个子 Agent 后才能调试或发布。`}function LV(e){return 1+e.subAgents.reduce((t,n)=>t+LV(n),0)}function DV(e){const t=Z1(e),n=[],s={...t.envValues},i=a=>{var l,c,u,d;for(const f of a.builtinTools??[]){const h=Nu.find(p=>p.id===f);h&&n.push({env:h.env})}for(const f of a.mcpTools??[])f.authTokenEnv&&n.push({env:[{key:f.authTokenEnv,required:!1,comment:`${f.name.trim()||"MCP"} Bearer Token`}]});if((l=a.a2aRegistry)!=null&&l.enabled&&(n.push({env:GU}),Object.assign(s,RV(a.a2aRegistry,{includeDefaults:!0}))),a.memory.shortTerm&&n.push({env:((c=G_.find(f=>f.id===(a.shortTermBackend??"local")))==null?void 0:c.env)??[]}),a.memory.longTerm&&n.push({env:((u=K_.find(f=>f.id===(a.longTermBackend??"local")))==null?void 0:u.env)??[]}),a.knowledgebase&&n.push({env:((d=q_.find(f=>f.id===(a.knowledgebaseBackend??hu)))==null?void 0:d.env)??[]}),a.tracing)for(const f of a.tracingExporters??[]){const h=afe.find(p=>p.id===f);h&&n.push({env:h.env,enableFlag:h.enableFlag})}a.subAgents.forEach(i)};i(t.draft);const r=bz(n);return{specs:r.specs,fixedValues:{...r.fixedValues,...s}}}function PV(e){var n;return{...Z1(e).draft,deployment:{feishuEnabled:!!((n=e.deployment)!=null&&n.feishuEnabled)}}}function DN(e){var n;const t=(n=e.modelName)==null?void 0:n.trim();if(t)return t;for(const s of e.subAgents){const i=DN(s);if(i)return i}return""}function BV(e){var s,i;const t=DV(e),n={...((s=e.deployment)==null?void 0:s.envValues)??{},...t.fixedValues};return{...PV(e),deployment:{feishuEnabled:!!((i=e.deployment)!=null&&i.feishuEnabled),envValues:Object.fromEntries(yz(t.specs,n).map(({key:r,value:a})=>[r,a]))}}}function PIe(e){return JSON.stringify(BV(e))}function Sx(e,t){return JSON.stringify({draftSnapshot:e,modelName:t.modelName,description:t.description,instruction:t.instruction,optimizations:t.optimizations})}function $d(e){return JSON.stringify({modelName:e.modelName.trim(),description:e.description.trim(),instruction:e.instruction.trim(),optimizations:e.optimizations})}function BIe({enabled:e,disabledReason:t,variants:n,draftSnapshot:s,input:i,onInput:r,onSend:a,onStartVariant:l,onDeployVariant:c,onAddVariant:u,onRemoveVariant:d,onToggleConfig:f,onCompleteConfig:h,onConfigChange:p,onOpenTrace:m}){const b=n.filter(x=>x.phase!=="ready"?!1:x.runtimeSnapshot===Sx(s,x)),v=n.some(x=>x.phase==="sending"),y=b.length>0&&!v;return o.jsxs("section",{className:"cw-ab-workspace","aria-label":"A/B 调试工作台",children:[o.jsx("div",{className:"cw-ab-stage",children:e?o.jsx("div",{className:"cw-ab-grid",style:{"--cw-ab-column-count":n.length},children:n.map((x,E)=>{const w=x.modelName.trim(),_=x.description.trim(),S=x.instruction.trim(),k=$d(x),T=!!(w&&_&&S&&n.findIndex(P=>$d(P)===k)!==E),C=!w||!_||!S||T,I=!!(x.runtimeSnapshot&&x.runtimeSnapshot!==Sx(s,x)),j=x.phase==="starting",L=x.phase==="ready"&&!I,z=j||x.phase==="sending",D=L&&x.phase!=="sending"&&x.messages.some(P=>P.role==="assistant"),F=z||x.configOpen||C,A=w?_?S?T?"该配置与已有测试组相同":"":"请填写系统提示词":"请填写描述":"请先选择模型",M=j?"正在启动":I?"应用配置并重启":L||x.phase==="error"?"重新启动环境":"启动环境";return o.jsx("article",{className:"cw-ab-card",children:o.jsxs("div",{className:`cw-ab-card-inner${x.configOpen?" is-flipped":""}`,children:[o.jsxs("section",{className:"cw-ab-card-face cw-ab-card-front","aria-hidden":x.configOpen,children:[o.jsxs("header",{className:"cw-ab-card-head",children:[o.jsxs("div",{className:"cw-ab-card-title",children:[o.jsx("strong",{children:x.name}),o.jsx("span",{children:x.modelName||"默认模型"})]}),o.jsxs("div",{className:"cw-ab-card-actions",children:[o.jsx("button",{type:"button",className:"cw-ab-config-trigger",disabled:x.configOpen||z,onClick:()=>f(x.id),children:"测试配置"}),x.id!=="baseline"&&o.jsx("button",{type:"button",className:"cw-ab-remove","aria-label":`删除${x.name}`,disabled:x.configOpen||z,onClick:()=>d(x.id),children:o.jsx(iD,{className:"cw-i"})})]})]}),o.jsx("div",{className:"cw-ab-conversation",children:x.error?o.jsx(vx,{message:x.error,className:"cw-debug-error-detail",defaultExpanded:!0}):j?o.jsxs("div",{className:"cw-ab-empty cw-ab-starting",children:[o.jsx(dn,{className:"cw-i cw-spin"}),o.jsx("span",{children:"正在创建独立测试环境"})]}):I?o.jsx("div",{className:"cw-ab-empty cw-ab-launch",children:o.jsx("span",{children:"配置已变更,请重新启动此环境"})}):x.messages.length===0?o.jsx("div",{className:"cw-ab-empty cw-ab-launch",children:L?o.jsxs(o.Fragment,{children:[o.jsx("strong",{className:"cw-ab-ready-title",children:"已就绪"}),o.jsx("span",{className:"cw-ab-launch-hint",children:"可在下方输入测试消息"})]}):o.jsx("span",{className:"cw-ab-launch-hint",children:A||"启动环境后即可加入本轮测试"})}):x.messages.map((P,H)=>o.jsx("div",{className:`cw-debug-msg cw-debug-msg-${P.role}`,children:o.jsx("div",{className:"cw-debug-content",children:P.role==="user"?P.content:P.error?o.jsx(vx,{message:P.error,className:"cw-debug-msg-error",defaultExpanded:!0}):P.blocks&&P.blocks.length>0?o.jsx(r2,{blocks:P.blocks,onAction:()=>{}}):P.content?P.content:H===x.messages.length-1&&x.phase==="sending"?o.jsx(gH,{}):null})},H))}),o.jsxs("footer",{className:"cw-ab-deploy-footer",children:[o.jsx("button",{type:"button",className:"cw-ab-trace",disabled:!D,title:D?`查看${x.name}调用链路`:"完成一次调试后可查看调用链路",onClick:()=>m(x.id),children:"调用链路"}),o.jsxs("button",{type:"button",className:"cw-ab-start cw-ab-footer-start",disabled:F,title:A||void 0,onClick:()=>l(x.id),children:[L||I||x.phase==="error"?o.jsx(Aee,{className:"cw-i"}):o.jsx(vIe,{className:"cw-i cw-debug-run-icon"}),M]}),o.jsx("button",{type:"button",className:"cw-ab-deploy",disabled:z||!w,onClick:()=>c(x.id),children:"部署该配置"})]})]}),o.jsxs("section",{className:"cw-ab-card-face cw-ab-card-back","aria-hidden":!x.configOpen,children:[o.jsxs("header",{className:"cw-ab-config-head",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"测试配置"}),o.jsx("span",{children:x.name})]}),o.jsxs("div",{className:"cw-ab-config-head-actions",children:[x.id!=="baseline"&&o.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger cw-ab-config-remove","aria-label":`删除${x.name}`,title:"删除配置组",disabled:z,onClick:()=>d(x.id),children:o.jsx(iD,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:`cw-ab-config-done-wrap${A?" is-disabled":""}`,tabIndex:A?0:void 0,children:[o.jsx("button",{type:"button",className:"cw-ab-config-done",disabled:!x.configOpen||C,onClick:()=>h(x.id),children:x.id==="baseline"?"完成配置":"完成并启动"}),A&&o.jsx("span",{className:"cw-ab-config-done-tip",role:"tooltip",children:A})]})]})]}),o.jsxs("div",{className:"cw-ab-config",children:[o.jsxs("label",{children:[o.jsx("span",{children:"模型"}),o.jsx("input",{value:x.modelName,placeholder:"使用 Agent 当前模型",disabled:!x.configOpen,onChange:P=>p(x.id,"modelName",P.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"描述"}),o.jsx("textarea",{rows:2,value:x.description,disabled:!x.configOpen,onChange:P=>p(x.id,"description",P.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"系统提示词"}),o.jsx("textarea",{rows:5,value:x.instruction,disabled:!x.configOpen,onChange:P=>p(x.id,"instruction",P.target.value)})]}),o.jsxs("fieldset",{className:"cw-ab-optimizations-disabled",children:[o.jsxs("legend",{children:[o.jsx("span",{children:"优化选项"}),o.jsx("em",{children:"待开放"})]}),o.jsx("div",{className:"cw-ab-optimization-list",children:UV.map(P=>o.jsx(xV,{checked:x.optimizations.includes(P.id),disabled:!0,label:P.label,className:"cw-ab-optimization-checkbox"},P.id))})]}),o.jsx("p",{children:"设置完成后返回正面,再启动当前测试环境。"})]})]})]})},x.id)})}):o.jsx("div",{className:"cw-debug-empty",children:t})}),o.jsxs("div",{className:"cw-ab-composer",children:[o.jsxs("div",{className:"cw-debug-composerbox",children:[o.jsx("textarea",{className:"cw-debug-input",rows:1,value:i,placeholder:y?"输入测试消息,将发送到所有已启动测试组...":"请先启动至少一个测试组",disabled:!y,onChange:x=>r(x.target.value),onKeyDown:x=>{a2(x.nativeEvent)||x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),a())}}),o.jsx("button",{type:"button",className:"cw-debug-send",title:"发送",disabled:!y||!i.trim(),onClick:a,children:v?o.jsx(dn,{className:"cw-i cw-spin"}):o.jsx(mB,{className:"cw-i"})})]}),e&&n.length<3&&o.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft cw-ab-add",onClick:u,children:[o.jsx(_i,{className:"cw-i"}),"添加对照组"]})]})]})}const db=[{id:"build",label:"架构"},{id:"validate",label:"调试"},{id:"publish",label:"发布"}],UV=[{id:"context",label:"上下文优化",description:"压缩历史对话,保留与当前任务相关的信息"},{id:"grounding",label:"幻觉抑制",description:"对不确定内容要求依据,并明确表达未知"},{id:"tools",label:"工具调用优化",description:"减少重复调用,优先复用可信的工具结果"},{id:"latency",label:"响应加速",description:"缓存稳定上下文,降低重复推理开销"}];function UIe({mode:e}){const t=e==="validate"?"调试您的智能体":e==="publish"?"准备好部署您的智能体":"个性化您的智能体架构";return o.jsx("header",{className:"cw-workspace-header",children:o.jsx("h1",{children:t})})}function FIe({mode:e,busy:t,onChange:n,assistant:s}){const i=db.findIndex(l=>l.id===e),r=db[i-1],a=db[i+1];return o.jsxs("footer",{className:"cw-workspace-footer",children:[o.jsxs("div",{className:`cw-workspace-nav-actions${s?" has-assistant":""}`,children:[o.jsx("button",{type:"button",className:`cw-workspace-nav-button${e==="build"?" is-placeholder":""}`,"aria-hidden":e==="build"||void 0,tabIndex:e==="build"?-1:0,disabled:!r||t,onClick:()=>r&&n(r.id),children:"上一步"}),o.jsx("span",{"aria-hidden":"true"}),s?o.jsx("div",{className:"cw-workspace-ai-slot",children:s}):null,e==="publish"?o.jsx("div",{id:"cw-publish-primary-action",className:"cw-publish-action-slot"}):o.jsx("button",{type:"button",className:"cw-workspace-nav-button is-primary",disabled:!a||t,onClick:()=>a&&n(a.id),children:"下一步"})]}),o.jsx("nav",{className:"cw-workspace-progress","aria-label":"Agent 创建进度",children:db.map((l,c)=>{const u=l.id===e;return o.jsx("button",{type:"button",className:`${u?"is-active":""}${cn(l.id),children:o.jsx("span",{"aria-hidden":"true"})},l.id)})})]})}function $Ie({onBack:e,onCreate:t,onAgentAdded:n,initialDraft:s,features:i,onDeploymentTaskChange:r,deploymentTarget:a,initialDeployRegion:l="cn-beijing",onDeploymentComplete:c,onDeploymentStarted:u,onDraftChange:d,onDiscard:f}){var Da,Js,mi,oa,al,Wi,Mu,pc,re,wt,mn,Ns,nn,Ts;const[h,p]=g.useState(()=>s??wi()),[m,b]=g.useState(""),[v,y]=g.useState(!1),[x,E]=g.useState(!1),[w,_]=g.useState(null),S=m.trim(),k=S.length>0&&S.length{L.current=d},[d]),g.useEffect(()=>{var se;I!==C.current&&(C.current=I,(se=L.current)==null||se.call(L,h,j))},[h,j,I]);const[z,D]=g.useState("build"),[F,A]=g.useState(!1),[M,P]=g.useState(0),[H,R]=g.useState(null),[Y,J]=g.useState(!1),[U,te]=g.useState((a==null?void 0:a.region)??l),K=(i==null?void 0:i.generatedAgentTestRun)===!0,V=(i==null?void 0:i.generatedAgentTestRunDisabledReason)||"当前后端暂不支持生成 Agent 调试运行。",[W,q]=g.useState(()=>[{id:"baseline",name:"基准组",modelName:DN(s??wi()),description:(s??wi()).description,instruction:(s??wi()).instruction,optimizations:[],configOpen:!1,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]),[ue,pe]=g.useState("baseline"),we=g.useRef(1),de=g.useRef(!1),ge=g.useRef(new Map),[Le,Ee]=g.useState(0),[ie,Ne]=g.useState(""),[ve,Qe]=g.useState(null),[De,Ke]=g.useState(!1),[Se,He]=g.useState(!1),Be=g.useRef(null),[qe,Z]=g.useState(""),[ae,ne]=g.useState(!1),[xe,Fe]=g.useState(!1),[at,It]=g.useState([]),ft=g.useRef(null),fn=g.useRef({});async function Et(){const se=new Set([...ge.current.values()].map(({run:ze})=>ze.runId)),Te=D2().filter(ze=>!se.has(ze));Te.length&&await Promise.all(Te.map(async ze=>{try{await ld(ze),Qh(ze)}catch(et){console.warn("清理遗留调试运行失败",et)}}))}g.useEffect(()=>(Et(),()=>{for(const{run:se}of ge.current.values())ld(se.runId).then(()=>Qh(se.runId)).catch(Te=>console.warn("清理调试运行失败",Te));ge.current.clear()}),[]),g.useEffect(()=>()=>{var se;(se=Be.current)==null||se.call(Be,!1),Be.current=null},[]);const Nt=g.useRef(null);Nt.current||(Nt.current=({meta:se,children:Te})=>o.jsxs("section",{ref:ze=>{fn.current[se.id]=ze},id:`cw-sec-${se.id}`,"data-step-id":se.id,className:"cw-section",children:[o.jsx("header",{className:"cw-sec-head",children:o.jsx("h2",{className:"cw-sec-title",children:se.label})}),o.jsx("div",{className:"cw-sec-body",children:Te})]}));const Qt=jIe(h,at)?at:[],Ve=ub(h,Qt),Tt=Qt.length===0,rt=`cw-model-advanced-${Qt.join("-")||"root"}`,ut=`cw-a2a-registry-advanced-${Qt.join("-")||"root"}`,Ze=se=>p(Te=>Lg(Te,Qt,ze=>({...ze,...se}))),_t=(se,Te)=>p(ze=>{var et;return{...ze,deployment:{...ze.deployment??{feishuEnabled:!1},envValues:{...((et=ze.deployment)==null?void 0:et.envValues)??{},[se]:Te}}}}),me=se=>Ze({a2aRegistry:{...Ve.a2aRegistry??{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},...se}}),We=(se,Te)=>{if(!(se in rD))return;const ze=rD[se];me({[ze]:Te}),_t(se,Te)},bt=se=>{if(!(Tt&&se==="a2a")){if(se==="a2a"){Ze({agentType:se,a2aRegistry:{...Ve.a2aRegistry??{registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},enabled:!0}});return}Ze({agentType:se,a2aRegistry:Ve.a2aRegistry?{...Ve.a2aRegistry,enabled:!1}:void 0})}},an=(se,Te)=>{p(se),Te&&It(Te)},Kn=async()=>{const se=m.trim();if(!(!se||v)&&!(se.length{const Te=ub(h,se);if(!LN(Te)||se.length>=aD)return;const ze=RIe(h,se),et=ub(ze,se).subAgents.length-1;an(ze,[...se,et])},$t=(se,Te)=>{const ze=ub(h,se);if(!LN(ze)||se.length>=aD)return;const et=Math.max(0,Math.min(Te,ze.subAgents.length)),gn=OIe(h,se,et);an(gn,[...se,et])},hn=()=>{window.confirm("清空根 Agent 的全部配置和子 Agent?此操作无法撤销。")&&(p(wi()),It([]),A(!1))},cn=se=>{if(se.length===0){hn();return}an(MIe(h,se),se.slice(0,-1))},Pt=Ve.builtinTools??[],jt=Ve.mcpTools??[],Sn=Ve.selectedSkills??[],pn=se=>Ze({builtinTools:Pt.includes(se)?Pt.filter(Te=>Te!==se):[...Pt,se]}),zt=wV(Ve.agentType),Fn=aE(Ve.agentType),hs=g.useMemo(()=>iH(h),[h]),ps=Fn?null:Yl(Ve.name)??(hs.has(Ve.name)?"Agent 名称在当前结构中必须唯一":null),Rn=ps!==null,$s=!Fn&&Ve.description.trim().length===0,ms=Ve.instruction.trim().length===0,$n=Fn&&!((Da=Ve.a2aRegistry)!=null&&Da.registrySpaceId.trim()),Hs=se=>F&&se?`is-error cw-error-shake-${M%2}`:"",Hn=g.useMemo(()=>MV(h,hs),[h,hs]),js=Hn.length===0,_n=g.useMemo(()=>PIe(h),[h]),ss=W.find(se=>se.id===ue)??W[0],is=g.useMemo(()=>DV(h),[h]),_s=se=>{var Te;(Te=fn.current[se])==null||Te.scrollIntoView({behavior:"smooth",block:"start"})},gs=()=>js?!0:(A(!0),P(se=>se+1),Hn[0]&&(It(Hn[0].path),window.requestAnimationFrame(()=>_s(Hn[0].problem==="缺少子 Agent"?"type":"basic"))),!1),zs=async()=>{Qe(null);const se=[...ge.current.values()];ge.current.clear(),Ee(0),q(Te=>Te.map(ze=>({...ze,phase:"idle",runtimeSnapshot:"",messages:[],error:null}))),await Promise.all(se.map(async({run:Te})=>{try{await ld(Te.runId),Qh(Te.runId)}catch(ze){console.warn("清理调试运行失败",ze)}}))},bs=async se=>{const Te=ge.current.get(se);if(Te){ge.current.delete(se),Ee(ge.current.size);try{await ld(Te.run.runId),Qh(Te.run.runId)}catch(ze){console.warn("清理调试运行失败",ze)}}},On=se=>{const Te=ge.current.get(se),ze=W.find(et=>et.id===se);!Te||!ze||Qe({runId:Te.run.runId,sessionId:Te.sessionId,variantName:ze.name})},Nn=se=>{const Te=Be.current;Be.current=null,Te==null||Te(se)},ce=()=>{Se||(Ke(!1),Nn(!1))},Ae=async()=>{if(!Se){He(!0);try{await zs(),Ke(!1),Nn(!0)}finally{He(!1)}}},Re=async()=>z!=="validate"||Le===0?!0:Be.current?!1:new Promise(se=>{Be.current=se,Ke(!0)}),Je=async se=>{var ze;if(!await Re())return;if(Z(""),!gs()){D("build");return}const Te=xz(is.specs,((ze=h.deployment)==null?void 0:ze.envValues)??{});if(Te){Z(`${Te.spec.comment||Te.spec.key}:${Te.error}`),D("build");return}J(!0);try{const et=se?W.find(Me=>Me.id===se):ss;et&&pe(et.id);const gn=et?{...h,modelName:et.modelName||h.modelName,description:et.description,instruction:et.instruction}:h,rs=await c1(PV(gn));gn!==h&&p(gn),R(rs),D("publish")}catch(et){Z(et instanceof Error?et.message:String(et))}finally{J(!1)}},st=async se=>{if(!K||Y||!gs())return;const Te=W.find(mt=>mt.id===se);if(!Te||Te.phase==="starting"||Te.phase==="sending")return;const ze=Te.modelName.trim(),et=Te.description.trim(),gn=Te.instruction.trim(),rs=$d(Te),Me=W.findIndex(mt=>mt.id===se),Rs=W.findIndex(mt=>$d(mt)===rs);if(!ze||!et||!gn||Rs!==Me)return;const xs=Sx(_n,Te);q(mt=>mt.map(as=>as.id===se?{...as,configOpen:!1,phase:"starting",messages:[],error:null}:as)),Ne("");let Zt=null;try{await bs(se),await Et();const mt={...h,modelName:Te.modelName||h.modelName,description:Te.description,instruction:Te.instruction};Zt=await g8(BV(mt),a?{runtimeId:a.runtimeId,region:a.region}:void 0),yIe(Zt.runId);const as=await b8(Zt.runId,"test_user");ge.current.set(se,{run:Zt,sessionId:as}),Ee(ge.current.size),q(Bi=>Bi.map(uo=>uo.id===se?{...uo,phase:"ready",runtimeSnapshot:xs}:uo))}catch(mt){if(Zt)try{await ld(Zt.runId),Qh(Zt.runId)}catch(as){console.warn("清理调试运行失败",as)}q(as=>as.map(Bi=>Bi.id===se?{...Bi,phase:"error",runtimeSnapshot:"",error:mt instanceof Error?mt.message:String(mt)}:Bi))}},ot=async()=>{const se=ie.trim(),Te=W.filter(et=>et.phase==="ready"&&et.runtimeSnapshot===Sx(_n,et)&&ge.current.has(et.id));if(!se||Te.length===0)return;Ne("");const ze=new Set(Te.map(et=>et.id));q(et=>et.map(gn=>ze.has(gn.id)?{...gn,phase:"sending",messages:[...gn.messages,{role:"user",content:se},{role:"assistant",content:"",blocks:[]}]}:gn)),await Promise.all(Te.map(async et=>{const gn=ge.current.get(et.id);if(gn)try{let rs=wa();for await(const Me of x8({runId:gn.run.runId,userId:"test_user",sessionId:gn.sessionId,text:se})){const Rs=Me.error||Me.errorMessage||Me.error_message;if(Rs||(rs=yf(rs,Me)),q(xs=>xs.map(Zt=>{if(Zt.id!==et.id)return Zt;const mt=[...Zt.messages],as={...mt[mt.length-1]};return Rs?as.error=String(Rs):(as.content=rs.blocks.filter(Bi=>Bi.kind==="text").map(Bi=>Bi.text).join(""),as.blocks=rs.blocks),mt[mt.length-1]=as,{...Zt,messages:mt}})),Rs)break}}catch(rs){q(Me=>Me.map(Rs=>{if(Rs.id!==et.id)return Rs;const xs=[...Rs.messages],Zt={...xs[xs.length-1]};return Zt.error=rs instanceof Error?rs.message:String(rs),xs[xs.length-1]=Zt,{...Rs,messages:xs}}))}finally{q(rs=>rs.map(Me=>Me.id===et.id?{...Me,phase:"ready"}:Me))}}))},kt=()=>{q(se=>{if(se.length>=3)return se;const Te=we.current++,ze=`variant-${Te}`;return[...se,{id:ze,name:`对照组 ${Te}`,modelName:h.modelName??"",description:h.description,instruction:h.instruction,optimizations:[],configOpen:!0,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]})},Mn=async se=>{await bs(se),q(Te=>Te.filter(ze=>ze.id!==se)),ue===se&&pe("baseline")},Tn=(se,Te)=>q(ze=>ze.map(et=>et.id===se?{...et,...Te}:et)),qt=(se,Te,ze)=>{se==="baseline"&&Te==="modelName"&&(de.current=!0),Tn(se,{[Te]:ze}),!(ue!==se||se==="baseline")&&pe("baseline")},pi=se=>{const Te=W.find(xs=>xs.id===se);if(!Te)return;const ze=Te.modelName.trim(),et=Te.description.trim(),gn=Te.instruction.trim(),rs=$d(Te),Me=W.findIndex(xs=>xs.id===se),Rs=W.findIndex(xs=>$d(xs)===rs);if(!(!ze||!et||!gn||Rs!==Me)){if(se==="baseline"){Tn(se,{configOpen:!1});return}st(se)}},Pe=async(se,Te,ze)=>{var rs;const et=(rs=h.deployment)==null?void 0:rs.network,gn=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 ug(se.name,se.files,{region:(a==null?void 0:a.region)??U,projectName:"default",network:gn},{...ze,onStage:Te,runtimeId:a==null?void 0:a.runtimeId,appName:a==null?void 0:a.appName,description:h.description})},Vt=()=>{gs()&&(q(se=>se.map(Te=>Te.id==="baseline"&&!ge.current.has(Te.id)?{...Te,modelName:de.current?Te.modelName:DN(h),description:h.description,instruction:h.instruction}:Te)),D("validate"))},vt=async se=>{if(se==="publish"){if(!gs())return;H?D("publish"):Je();return}if(se==="validate"){Vt();return}await Re()&&D(se)},qn=Nt.current,ys=se=>EIe.find(Te=>Te.id===se),aa=o.jsx("section",{className:`cw-ai-compose${v?" is-generating":""}${x?" is-success":""}`,"aria-label":"AI 自动填写 Agent 配置",children:o.jsx(Po,{initial:!1,mode:"wait",children:x?o.jsxs(Jn.div,{className:"cw-ai-compose-success",role:"status",initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},transition:{duration:.22,ease:[.22,1,.36,1]},children:[o.jsx("span",{className:"cw-ai-success-check","aria-hidden":!0}),o.jsx("strong",{children:"生成成功"}),o.jsx("button",{type:"button",className:"cw-ai-regenerate",onClick:()=>E(!1),children:"重新生成"})]},"success"):o.jsxs(Jn.div,{className:"cw-ai-compose-entry",initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},transition:{duration:.2,ease:[.22,1,.36,1]},children:[o.jsxs("form",{className:"cw-ai-compose-form",onSubmit:se=>{se.preventDefault(),Kn()},children:[o.jsx("input",{type:"text",value:m,maxLength:8e3,disabled:v,placeholder:"描述目标,使用 doubao-seed-2-0-lite-260428 模型一键生成配置","aria-invalid":!!k,"aria-describedby":k?"ai-requirement-error":void 0,onChange:se=>b(se.target.value),onKeyDown:se=>{se.key==="Enter"&&(se.preventDefault(),Kn())}}),o.jsx("button",{type:"submit",disabled:v||!S||!!k,"aria-label":v?"正在智能生成":"智能生成",children:v?o.jsx("span",{className:"cw-ai-orb","aria-hidden":!0,children:o.jsx("span",{})}):"智能生成"})]}),k&&o.jsx("p",{className:"cw-ai-requirement-error",id:"ai-requirement-error",role:"alert",children:k})]},"compose")})});return o.jsxs("div",{className:`cw-root is-${z}`,children:[o.jsx(UIe,{mode:z}),qe&&o.jsx(vx,{className:"cw-workspace-alert",message:qe}),o.jsxs("main",{className:"cw-workspace-main",id:"cw-workspace-main",children:[z==="build"&&o.jsx("div",{className:"cw-build-workspace",children:o.jsxs("div",{className:"cw-editor",children:[o.jsx(Om,{draft:h,direction:"horizontal",selectedPath:Qt,onSelect:It,onAdd:xt,onInsert:$t,onDelete:cn}),o.jsx("div",{className:"cw-detail",children:o.jsx("div",{className:"cw-detail-scroll",ref:ft,children:o.jsx("div",{className:"cw-detail-inner",children:o.jsx("div",{className:"cw-lower",children:o.jsxs("div",{className:"cw-form-col",children:[o.jsxs(qn,{meta:ys("type"),children:[o.jsx(RN,{className:"cw-agent-type-options","aria-label":"Agent 类型",value:Ve.agentType??"llm",onChange:bt,children:KCe.map(se=>{const Te=(Ve.agentType??"llm")===se.id,ze=Tt&&se.id==="a2a",et=ze?"cw-remote-agent-disabled-hint":void 0;return o.jsxs("div",{"data-agent-type":se.id,className:`cw-agent-type-option ${Te?"is-on":""} ${ze?"is-disabled":""}`,tabIndex:ze?0:void 0,"aria-describedby":et,children:[o.jsx(RN.Item,{value:se.id,disabled:ze,block:!0,className:"cw-agent-type-control",children:o.jsx("span",{className:"cw-agent-type-copy",children:o.jsx("strong",{children:wIe[se.id]})})}),ze&&o.jsx("span",{id:et,className:"cw-agent-type-disabled-hint",role:"tooltip",children:"远程智能体只能作为子步骤使用"})]},se.id)})}),F&&zt&&Ve.subAgents.length===0&&o.jsx("span",{className:"cw-error-text",children:DIe({name:Ve.name.trim()||"未命名",typeLabel:vV(Ve.agentType).label})})]}),o.jsx(qn,{meta:ys("basic"),children:o.jsxs("div",{className:"cw-form",children:[!Fn&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:[Tt?"Agent 名称":"名称",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("input",{className:`cw-input ${Hs(Rn)}`,value:Ve.name,placeholder:"assistant",onChange:se=>Ze({name:se.target.value})}),F&&ps?o.jsx("span",{className:"cw-error-text",children:ps}):o.jsx("span",{className:"cw-help",children:"遵循 Google ADK 命名规则,且在执行流程中保持唯一。"})]}),o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:[Tt?"描述":"智能体描述",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("textarea",{className:`cw-textarea cw-textarea-sm ${Hs($s)}`,value:Ve.description,placeholder:"简要描述这个 Agent 的用途,便于团队识别…",onChange:se=>Ze({description:se.target.value})}),F&&$s?o.jsx("span",{className:"cw-error-text",children:"描述为必填项"}):o.jsx("span",{className:"cw-help",children:Tt?"完整描述会保留;部署时会自动整理为符合 Runtime 规范的单行描述。":"描述会显示在 Agent 列表与选择器中。"})]})]}),zt?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"cw-section-desc cw-dependency-hint",children:"这是一个协作容器,本身不生成回答。请在左侧画布中 添加任务步骤,并通过拖拽调整它们的位置。"}),Ve.agentType==="loop"&&o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"最大轮次"}),o.jsx("input",{className:"cw-input",type:"number",min:1,value:Ve.maxIterations??3,onChange:se=>Ze({maxIterations:Math.max(1,Number(se.target.value)||1)})}),o.jsx("span",{className:"cw-help",children:"循环编排反复执行子 Agent,直到满足条件或达到该轮次上限。"})]})]}):Fn?o.jsxs("div",{className:"cw-field cw-remote-center-fields",children:[o.jsxs("div",{className:"cw-remote-center-head",children:[o.jsxs("div",{className:"cw-label",children:["AgentKit 智能体中心",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx("p",{className:"cw-help cw-remote-center-description",children:"远程 Agent 的名称、描述和能力来自中心返回的 Agent Card。 系统会根据每轮任务动态发现并挂载匹配的 Agent。"})]}),o.jsx(TIe,{value:((Js=Ve.a2aRegistry)==null?void 0:Js.registrySpaceId)??"",region:((mi=Ve.a2aRegistry)==null?void 0:mi.registryRegion)||Na.region,invalid:F&&$n,onChange:se=>We(jV,se)}),o.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":xe,"aria-controls":ut,onClick:()=>Fe(se=>!se),children:[o.jsx("span",{children:"更多选项"}),o.jsx(nc,{className:`cw-more-options-chevron ${xe?"is-open":""}`,"aria-hidden":!0})]}),o.jsx(Po,{initial:!1,children:xe&&o.jsx(Jn.div,{id:ut,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:o.jsx(Zh,{env:SIe,values:RV(Ve.a2aRegistry,{includeDefaults:!1}),onChange:We})})}),F&&$n&&o.jsx("span",{className:"cw-error-text",children:"请选择 AgentKit 智能体中心"})]}):o.jsxs("div",{className:"cw-field",children:[o.jsxs("label",{className:"cw-label",children:["系统提示词",o.jsx("span",{className:"cw-req",children:"*"})]}),o.jsx(g.Suspense,{fallback:o.jsx("div",{className:"cw-markdown-loading",role:"status",children:"正在加载 Markdown 编辑器…"}),children:o.jsx(bIe,{value:Ve.instruction,invalid:ms,onChange:se=>Ze({instruction:se})})}),F&&ms?o.jsx("span",{className:"cw-error-text",children:"系统提示词为必填项"}):o.jsx("span",{className:"cw-help",children:"支持 Markdown 快捷输入,例如键入 ## 加空格创建二级标题。"})]})]})}),!zt&&!Fn&&o.jsxs(o.Fragment,{children:[o.jsx(qn,{meta:ys("model"),children:o.jsxs("div",{className:"cw-form",children:[o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"模型名称"}),o.jsx("input",{className:"cw-input",value:Ve.modelName??"",placeholder:"doubao-seed-2-1-pro-260628",onChange:se=>Ze({modelName:se.target.value})})]}),o.jsxs("button",{type:"button",className:"cw-more-options cw-model-more-options","aria-expanded":ae,"aria-controls":rt,onClick:()=>ne(se=>!se),children:[o.jsx("span",{children:"更多选项"}),o.jsx(nc,{className:`cw-more-options-chevron ${ae?"is-open":""}`,"aria-hidden":!0})]}),o.jsx(Po,{initial:!1,children:ae&&o.jsxs(Jn.div,{id:rt,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:[o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"服务商 Provider"}),o.jsx("input",{className:"cw-input",value:Ve.modelProvider??"",placeholder:"openai",onChange:se=>Ze({modelProvider:se.target.value})})]}),o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"API Base"}),o.jsx("input",{className:"cw-input",value:Ve.modelApiBase??"",placeholder:"https://ark.cn-beijing.volces.com/api/v3/",onChange:se=>Ze({modelApiBase:se.target.value})}),o.jsx("span",{className:"cw-help cw-dependency-hint",children:"留空则使用 VeADK 默认模型配置;Ark API Key 会由 Studio 服务端凭据自动获取。其他服务商的 Key 可在部署页添加。"})]})]})})]})}),o.jsx(qn,{meta:ys("tools"),children:o.jsxs("div",{className:"cw-form",children:[o.jsxs("div",{className:"cw-field",children:[o.jsx("label",{className:"cw-label",children:"内置工具"}),o.jsx("span",{className:"cw-help",children:"勾选 VeADK 提供的内置能力,生成时会自动补全 import 与所需环境变量。"}),o.jsx("div",{className:"cw-tools-list-shell",children:o.jsx(_Ie,{items:KU,selected:Pt,onToggle:pn,scrollRows:6})}),o.jsx(Po,{initial:!1,children:Pt.includes("run_code")&&o.jsxs(Jn.div,{className:"cw-tool-config",initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.16,ease:"easeOut"},children:[o.jsxs("div",{className:"cw-tool-config-head",children:[o.jsx("span",{className:"cw-label",children:"代码执行配置"}),o.jsx("span",{className:"cw-help",children:"指定 AgentKit 代码执行沙箱。"})]}),o.jsx(Zh,{env:((oa=Nu.find(se=>se.id==="run_code"))==null?void 0:oa.env)??[],values:((al=h.deployment)==null?void 0:al.envValues)??{},onChange:_t})]})})]}),o.jsxs("div",{className:"cw-field cw-mcp-field",children:[o.jsx("label",{className:"cw-label",children:"MCP 工具"}),o.jsx(AIe,{tools:jt,onChange:se=>Ze({mcpTools:se})})]})]})}),o.jsx(qn,{meta:ys("skills"),children:o.jsx("div",{className:"cw-form",children:o.jsx(IIe,{selected:Sn,onChange:se=>Ze({selectedSkills:se})})})}),o.jsx(qn,{meta:ys("knowledge"),children:o.jsxs("div",{className:"cw-form cw-toggle-stack",children:[o.jsx(cb,{checked:Ve.knowledgebase,onChange:se=>Ze({knowledgebase:se}),title:"知识库",desc:"启用外部知识检索(RAG),让 Agent 基于你的资料作答。",icon:Rb}),Ve.knowledgebase&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"知识库后端"}),o.jsx(Hw,{options:q_,value:Ve.knowledgebaseBackend,onChange:se=>Ze({knowledgebaseBackend:se,knowledgebaseIndex:se==="viking"?Ve.knowledgebaseIndex:""})}),(Ve.knowledgebaseBackend??hu)==="viking"&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"VikingDB 知识库"}),o.jsx(kIe,{value:Ve.knowledgebaseIndex??"",onChange:se=>Ze({knowledgebaseIndex:se})})]}),o.jsx(Zh,{env:((Wi=q_.find(se=>se.id===(Ve.knowledgebaseBackend??hu)))==null?void 0:Wi.env)??[],values:((Mu=h.deployment)==null?void 0:Mu.envValues)??{},onChange:_t})]})]})}),Tt&&o.jsx(qn,{meta:ys("memory"),children:o.jsxs("div",{className:"cw-form cw-toggle-stack",children:[o.jsx(cb,{checked:Ve.memory.shortTerm,onChange:se=>Ze({memory:{...Ve.memory,shortTerm:se}}),title:"短期记忆",desc:"在单次会话内保留上下文,跨轮次记住对话内容。",icon:EB}),Ve.memory.shortTerm&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"短期记忆后端"}),o.jsx(Hw,{options:G_,value:Ve.shortTermBackend,onChange:se=>Ze({shortTermBackend:se})}),o.jsx(Zh,{env:((pc=G_.find(se=>se.id===(Ve.shortTermBackend??"local")))==null?void 0:pc.env)??[],values:((re=h.deployment)==null?void 0:re.envValues)??{},onChange:_t})]}),o.jsx(cb,{checked:Ve.memory.longTerm,onChange:se=>Ze({memory:{...Ve.memory,longTerm:se}}),title:"长期记忆",desc:"跨会话持久化关键信息,让 Agent 记住历史偏好。",icon:Rb}),Ve.memory.longTerm&&o.jsxs("div",{className:"cw-field cw-subfield",children:[o.jsx("label",{className:"cw-label",children:"长期记忆后端"}),o.jsx(Hw,{options:K_,value:Ve.longTermBackend,onChange:se=>Ze({longTermBackend:se})}),o.jsx(Zh,{env:((wt=K_.find(se=>se.id===(Ve.longTermBackend??"local")))==null?void 0:wt.env)??[],values:((mn=h.deployment)==null?void 0:mn.envValues)??{},onChange:_t}),o.jsx(cb,{checked:!!Ve.autoSaveSession,onChange:se=>Ze({autoSaveSession:se}),title:"自动保存会话到长期记忆",desc:"会话结束时自动把内容写入长期记忆,无需手动调用。",icon:Rb})]})]})})]})]})})})})})]})}),z==="validate"&&o.jsx("div",{className:"cw-validation-workspace",children:o.jsx("div",{className:"cw-validation-content",children:o.jsx(BIe,{enabled:K,disabledReason:V,variants:W,draftSnapshot:_n,input:ie,onInput:Ne,onSend:ot,onStartVariant:st,onDeployVariant:se=>void Je(se),onAddVariant:kt,onRemoveVariant:Mn,onToggleConfig:se=>{const Te=W.find(ze=>ze.id===se);Te&&Tn(se,{configOpen:!Te.configOpen})},onCompleteConfig:pi,onConfigChange:qt,onOpenTrace:On})})}),z==="publish"&&o.jsx("div",{className:"cw-preview-body",children:H?o.jsx(eE,{embedded:!0,project:H,agentDraft:h,agentName:h.name||"未命名 Agent",agentCount:LV(h),releaseConfiguration:ss?{modelName:ss.modelName||h.modelName||"默认模型",description:ss.description,instruction:ss.instruction,optimizations:ss.optimizations.flatMap(se=>{const Te=UV.find(ze=>ze.id===se);return Te?[Te.label]:[]})}:void 0,onChange:R,onDeploy:Pe,onAgentAdded:n,onDeploymentTaskChange:r,deploymentActionLabel:a?"更新并发布":"部署",deploymentActionTargetId:"cw-publish-primary-action",deploymentRuntimeId:a==null?void 0:a.runtimeId,onDeploymentStarted:u,onDeploymentComplete:c,feishuEnabled:!!((Ns=h.deployment)!=null&&Ns.feishuEnabled),onFeishuEnabledChange:se=>{const Te={...h,deployment:{...h.deployment??{feishuEnabled:!1},feishuEnabled:se}};p(Te)},deploymentEnv:is.specs,deploymentEnvValues:{...(nn=h.deployment)==null?void 0:nn.envValues,...is.fixedValues},onDeploymentEnvChange:_t,network:(Ts=h.deployment)==null?void 0:Ts.network,onNetworkChange:se=>p(Te=>({...Te,deployment:{...Te.deployment??{feishuEnabled:!1},network:se}})),deployRegion:U,onDeployRegionChange:te,deploymentTelemetrySource:"custom_create",onExportYaml:()=>xIe(`${h.name||"agent"}.yaml`,nAe(h),"text/yaml")}):o.jsxs("div",{className:"cw-publish-loading",role:"status",children:[o.jsx(dn,{className:"cw-i cw-spin"}),o.jsx("strong",{children:"正在生成发布配置"}),o.jsx("span",{children:"校验 Agent 结构并准备部署快照…"})]})})]}),o.jsx(FIe,{mode:z,busy:Y,onChange:vt,assistant:z==="build"?aa:void 0}),ve&&o.jsx(kV,{testRunId:ve.runId,sessionId:ve.sessionId,title:`调用链路 · ${ve.variantName}`,onClose:()=>Qe(null)}),De&&o.jsx(qA,{variant:"warning",title:"离开调试?",description:"离开调试页面后,当前环境将被清理。您可以通过重新启动环境进行新的测试。",confirmLabel:Se?"清理中...":"确定离开",closeLabel:"关闭离开调试确认",busy:Se,onCancel:ce,onConfirm:()=>void Ae()}),w&&o.jsx("div",{className:"confirm-scrim",onClick:()=>_(null),children:o.jsxs("div",{className:"confirm-box cw-ai-error-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"ai-generate-error-title","aria-describedby":"ai-generate-error-message",onClick:se=>se.stopPropagation(),children:[o.jsx("div",{className:"confirm-title",id:"ai-generate-error-title",children:"智能生成失败"}),o.jsx("div",{className:"cw-ai-error-message",id:"ai-generate-error-message",children:w}),o.jsx("div",{className:"confirm-actions",children:o.jsx("button",{type:"button",className:"confirm-btn cw-ai-error-close",onClick:()=>_(null),children:"关闭"})})]})})]})}function ko(e){return{...wi(),...e}}const HIe=[{id:"support",icon:hee,draft:ko({name:"客服助手",description:"7×24 在线答疑,结合知识库与历史对话,稳定、礼貌地解决用户问题。",instruction:"你是一名专业、耐心的客服助手。请始终保持礼貌、友好的语气,优先依据知识库中的资料回答用户问题;当资料不足以确定答案时,如实告知用户并主动引导其提供更多信息,切勿编造。回答尽量简洁、分点清晰,必要时给出操作步骤。",model:"doubao-1.5-pro-32k",knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"analyst",icon:QJ,draft:ko({name:"数据分析师",description:"运行代码完成统计与可视化,开启链路追踪,分析过程可观测、可复现。",instruction:"你是一名严谨的数据分析师。面对数据问题时,先厘清分析目标与口径,再通过编写并运行代码完成清洗、统计与可视化。每一步都要说明你的假设与方法,给出结论时附上关键数据支撑,并指出潜在的偏差与局限。",model:"doubao-1.5-pro-32k",tools:["code_runner"],tracing:!0})},{id:"translator",icon:pee,draft:ko({name:"翻译助手",description:"中英互译,忠实、通顺、地道,保留原文语气与专业术语。",instruction:"你是一名专业的翻译助手,精通中英互译。请在忠实于原文含义的前提下,使译文自然、地道、符合目标语言表达习惯;保留专有名词与专业术语的准确性,并尽量贴合原文的语气与风格。仅输出译文,除非用户额外要求解释。",model:"doubao-1.5-pro-32k"})},{id:"coder",icon:Ak,draft:ko({name:"代码助手",description:"编写、调试与重构代码,可运行代码验证结果,给出清晰可维护的实现。",instruction:"你是一名资深软件工程师。请根据需求编写正确、清晰、可维护的代码,遵循目标语言的惯用风格与最佳实践。在不确定时通过运行代码验证你的实现,给出关键的边界条件与测试思路,并对复杂逻辑附上简要注释。",model:"doubao-1.5-pro-32k",tools:["code_runner","file_reader"],tracing:!0})},{id:"researcher",icon:Eee,draft:ko({name:"研究员",description:"联网检索一手资料,结合知识库与长期记忆,输出有据可查的研究结论。",instruction:"你是一名严谨的研究员。面对研究问题时,先拆解关键子问题,再通过联网检索收集多个一手、可信的来源,交叉验证后再下结论。结论需注明出处与不确定性,区分事实与推断,避免以偏概全。",model:"doubao-1.5-pro-32k",tools:["web_search"],knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"research-team",icon:Dee,draft:ko({name:"多智能体研究团队",description:"由检索员、分析员、撰写员协作的研究编排,分工完成端到端调研报告。",instruction:"你是一支研究团队的总协调者。负责拆解用户的研究任务,将检索、分析、撰写分别委派给对应的子 Agent,汇总各子 Agent 的产出,把控整体质量,最终输出结构清晰、有据可查的研究报告。",model:"doubao-1.5-pro-32k",tracing:!0,memory:{shortTerm:!0,longTerm:!0},subAgents:[ko({name:"检索员",description:"联网搜集与课题相关的一手资料与数据。",instruction:"你是研究团队中的检索员。根据课题联网检索多个可信来源,整理出关键事实、数据与原文出处,交付给分析员,不做主观结论。",tools:["web_search"]}),ko({name:"分析员",description:"对检索到的材料做交叉验证与归纳分析。",instruction:"你是研究团队中的分析员。对检索员提供的材料做交叉验证、归纳与对比,提炼洞见、识别矛盾与不确定性,形成结构化的分析要点。",tools:["code_runner"]}),ko({name:"撰写员",description:"将分析结论组织为结构清晰、引用规范的报告。",instruction:"你是研究团队中的撰写员。把分析员的要点组织成结构清晰、语言通顺、引用规范的研究报告,确保每个结论都能追溯到来源。"})]})}];function zIe(e){const t=[];return e.tools.length&&t.push({icon:SB,label:"工具"}),(e.memory.shortTerm||e.memory.longTerm)&&t.push({icon:XJ,label:"记忆"}),e.knowledgebase&&t.push({icon:YJ,label:"知识库"}),e.tracing&&t.push({icon:qJ,label:"观测"}),e.subAgents.length&&t.push({icon:See,label:`子Agent ${e.subAgents.length}`}),t}function VIe({onBack:e,onCreate:t}){const[n,s]=g.useState(null);return o.jsx("div",{className:"tpl-root",children:n?o.jsx(KIe,{template:n,onBack:()=>s(null),onCreate:t}):o.jsx(GIe,{onPick:s})})}function GIe({onPick:e}){return o.jsxs("div",{className:"tpl-scroll",children:[o.jsxs("div",{className:"tpl-head",children:[o.jsx("h1",{className:"tpl-title",children:"从模板新建"}),o.jsx("p",{className:"tpl-sub",children:"选择一个预制 agent 模板,按需微调后即可创建。"})]}),o.jsx("div",{className:"tpl-grid",children:HIe.map((t,n)=>o.jsxs(Jn.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:[o.jsx("span",{className:"tpl-card-icon",children:o.jsx(t.icon,{className:"icon"})}),o.jsx("span",{className:"tpl-card-name",children:t.draft.name}),o.jsx("span",{className:"tpl-card-desc",children:rc(t.draft.description)})]},t.id))})]})}function KIe({template:e,onBack:t,onCreate:n}){const[s,i]=g.useState(e.draft.name),r=e.icon,a=zIe(e.draft);function l(){const c=s.trim()||e.draft.name;n({...e.draft,name:c})}return o.jsxs("div",{className:"tpl-scroll tpl-scroll--detail",children:[o.jsxs("button",{className:"tpl-back",onClick:t,children:[o.jsx(Tk,{className:"icon"})," 返回模板列表"]}),o.jsxs(Jn.div,{className:"tpl-detail",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.28,ease:[.22,1,.36,1]},children:[o.jsxs("div",{className:"tpl-detail-head",children:[o.jsx("span",{className:"tpl-detail-icon",children:o.jsx(r,{className:"icon"})}),o.jsxs("div",{className:"tpl-detail-headtext",children:[o.jsx("div",{className:"tpl-detail-name",children:e.draft.name}),o.jsx("div",{className:"tpl-detail-desc",children:rc(e.draft.description)})]})]}),a.length>0&&o.jsx("div",{className:"tpl-tags tpl-tags--detail",children:a.map(c=>o.jsxs("span",{className:"tpl-tag",children:[o.jsx(c.icon,{className:"tpl-tag-icon"})," ",c.label]},c.label))}),o.jsxs("label",{className:"tpl-field",children:[o.jsx("span",{className:"tpl-field-label",children:"名称"}),o.jsx("input",{className:"tpl-input",value:s,onChange:c=>i(c.target.value),placeholder:e.draft.name})]}),o.jsxs("div",{className:"tpl-field",children:[o.jsx("span",{className:"tpl-field-label",children:"系统提示词"}),o.jsx("p",{className:"tpl-instruction",children:e.draft.instruction})]}),o.jsxs("div",{className:"tpl-meta-grid",children:[e.draft.model&&o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"模型"}),o.jsx("span",{className:"tpl-meta-val tpl-mono",children:e.draft.model})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"工具"}),o.jsx("span",{className:"tpl-meta-val",children:e.draft.tools.length?e.draft.tools.join("、"):"无"})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"记忆"}),o.jsx("span",{className:"tpl-meta-val",children:qIe(e.draft)})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"知识库"}),o.jsx("span",{className:"tpl-meta-val",children:e.draft.knowledgebase?"已开启":"关闭"})]}),o.jsxs("div",{className:"tpl-meta",children:[o.jsx("span",{className:"tpl-meta-key",children:"观测追踪"}),o.jsx("span",{className:"tpl-meta-val",children:e.draft.tracing?"已开启":"关闭"})]})]}),e.draft.subAgents.length>0&&o.jsxs("div",{className:"tpl-field",children:[o.jsxs("span",{className:"tpl-field-label",children:["子 Agent(",e.draft.subAgents.length,")"]}),o.jsx("div",{className:"tpl-subagents",children:e.draft.subAgents.map((c,u)=>o.jsxs("div",{className:"tpl-subagent",children:[o.jsxs("div",{className:"tpl-subagent-top",children:[o.jsx("span",{className:"tpl-subagent-name",children:c.name}),c.tools.length>0&&o.jsx("span",{className:"tpl-subagent-tools",children:c.tools.join("、")})]}),o.jsx("div",{className:"tpl-subagent-desc",children:rc(c.description)})]},u))})]}),o.jsxs("button",{className:"tpl-create",onClick:l,children:["使用此模板创建 ",o.jsx(nc,{className:"icon"})]})]})]})}function qIe(e){const t=[];return e.memory.shortTerm&&t.push("短期"),e.memory.longTerm&&t.push("长期"),t.length?t.join(" + "):"关闭"}const YIe=[{type:"sequential",label:"顺序",desc:"节点依次执行",Icon:vB},{type:"parallel",label:"并行",desc:"节点同时执行",Icon:pB},{type:"loop",label:"循环",desc:"节点循环执行",Icon:Rk}];let PN=0;function qw(){return PN+=1,`node_${PN}`}function Yw(e,t,n){const s=wi();return{id:e,type:"agentNode",position:t,data:{agent:{...s,name:(n==null?void 0:n.name)??`agent_${e.replace("node_","")}`,...n}}}}function WIe({data:e,selected:t}){const n=e.agent;return o.jsxs("div",{className:`wfb-node ${t?"wfb-node--selected":""}`,children:[o.jsx(Oi,{type:"target",position:Xe.Left,className:"wfb-handle"}),o.jsx("div",{className:"wfb-node-icon",children:o.jsx(au,{className:"icon"})}),o.jsxs("div",{className:"wfb-node-body",children:[o.jsx("div",{className:"wfb-node-name",children:n.name||"未命名节点"}),o.jsx("div",{className:"wfb-node-desc",children:n.instruction?n.instruction.slice(0,48):"点击编辑指令…"})]}),o.jsx(Oi,{type:"source",position:Xe.Right,className:"wfb-handle"})]})}const XIe={agentNode:WIe},oD={type:"smoothstep",markerEnd:{type:wf.ArrowClosed,width:16,height:16}};function QIe({onBack:e,onCreate:t}){const n=g.useRef(null),[s,i]=g.useState(""),[r,a]=g.useState(""),[l,c]=g.useState("sequential"),u=g.useMemo(()=>{PN=0;const A=qw();return Yw(A,{x:80,y:120},{name:"agent_1"})},[]),[d,f,h]=dU([u]),[p,m,b]=fU([]),[v,y]=g.useState(u.id),x=d.find(A=>A.id===v)??null,E=s.trim()||"workflow_agent",w=g.useMemo(()=>iH({name:E,subAgents:d.map(A=>A.data.agent)}),[E,d]),_=Yl(E)??(w.has(E)?"名称须与 Agent 节点名称保持唯一":null),S=x?Yl(x.data.agent.name)??(w.has(x.data.agent.name)?"Agent 名称在当前工作流中必须唯一":null):null,k=d.length>0&&_===null&&d.every(A=>Yl(A.data.agent.name)===null&&!w.has(A.data.agent.name)),T=g.useCallback(A=>m(M=>U9({...A,...oD},M)),[m]),C=g.useCallback(()=>{const A=qw(),M=d.length*28,P=Yw(A,{x:80+M,y:120+M});f(H=>H.concat(P)),y(A)},[d.length,f]),I=A=>{A.dataTransfer.setData("application/wfb-node","agentNode"),A.dataTransfer.effectAllowed="move"},j=g.useCallback(A=>{A.preventDefault(),A.dataTransfer.dropEffect="move"},[]),L=g.useCallback(A=>{if(A.preventDefault(),A.dataTransfer.getData("application/wfb-node")!=="agentNode"||!n.current)return;const P=n.current.screenToFlowPosition({x:A.clientX,y:A.clientY}),H=qw(),R=Yw(H,P);f(Y=>Y.concat(R)),y(H)},[f]),z=g.useCallback(A=>{v&&f(M=>M.map(P=>P.id===v?{...P,data:{...P.data,agent:{...P.data.agent,...A}}}:P))},[v,f]),D=g.useCallback(()=>{v&&(f(A=>A.filter(M=>M.id!==v)),m(A=>A.filter(M=>M.source!==v&&M.target!==v)),y(null))},[v,f,m]),F=g.useCallback(()=>{if(!k)return;const A=d.map(P=>P.data.agent),M={...wi(),name:E,description:r.trim(),instruction:r.trim(),subAgents:A,workflow:{type:l,nodes:d.map(P=>({id:P.id,agent:P.data.agent})),edges:p.map(P=>({from:P.source,to:P.target}))}};t(M)},[k,d,p,E,r,l,t]);return o.jsx("div",{className:"wfb",children:o.jsxs("div",{className:"wfb-grid",children:[o.jsxs("aside",{className:"wfb-palette",children:[o.jsx("div",{className:"wfb-section-label",children:"工作流信息"}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"名称"}),o.jsx("input",{className:`wfb-input ${_?"wfb-input--error":""}`,value:s,onChange:A=>i(A.target.value),placeholder:"my_workflow"}),_&&o.jsx("span",{className:"wfb-field-error",children:_})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"描述"}),o.jsx("textarea",{className:"wfb-input wfb-textarea",value:r,onChange:A=>a(A.target.value),placeholder:"这个工作流做什么…",rows:2})]}),o.jsx("div",{className:"wfb-section-label",children:"执行方式"}),o.jsx("div",{className:"wfb-types",children:YIe.map(({type:A,label:M,desc:P,Icon:H})=>o.jsxs("button",{type:"button",className:`wfb-type ${l===A?"wfb-type--active":""}`,onClick:()=>c(A),children:[o.jsx(H,{className:"icon"}),o.jsxs("span",{className:"wfb-type-text",children:[o.jsx("span",{className:"wfb-type-name",children:M}),o.jsx("span",{className:"wfb-type-desc",children:P})]})]},A))}),o.jsx("div",{className:"wfb-section-label",children:"节点"}),o.jsxs("div",{className:"wfb-palette-item",draggable:!0,onDragStart:I,title:"拖拽到画布,或点击下方按钮添加",children:[o.jsx(fee,{className:"icon wfb-grip"}),o.jsx("span",{className:"wfb-node-icon wfb-node-icon--sm",children:o.jsx(au,{className:"icon"})}),o.jsx("span",{className:"wfb-palette-item-text",children:"Agent 节点"})]}),o.jsxs("button",{className:"wfb-add",type:"button",onClick:C,children:[o.jsx(_i,{className:"icon"}),"添加节点"]}),o.jsx("div",{className:"wfb-hint",children:"拖拽节点的圆点连线以表达执行顺序。"})]}),o.jsxs("div",{className:"wfb-canvas",children:[o.jsxs("button",{className:"wfb-create",onClick:F,disabled:!k,type:"button",children:[o.jsx(ou,{className:"icon"}),"创建工作流"]}),o.jsxs(uU,{nodes:d,edges:p,onNodesChange:h,onEdgesChange:b,onConnect:T,onInit:A=>n.current=A,nodeTypes:XIe,defaultEdgeOptions:oD,onDrop:L,onDragOver:j,onNodeClick:(A,M)=>y(M.id),onPaneClick:()=>y(null),fitView:!0,fitViewOptions:{padding:.3,maxZoom:1},proOptions:{hideAttribution:!0},children:[o.jsx(pU,{gap:16,size:1,color:"hsl(240 5.9% 88%)"}),o.jsx(gU,{showInteractive:!1}),o.jsx(pce,{pannable:!0,zoomable:!0,className:"wfb-minimap"})]})]}),o.jsx("aside",{className:"wfb-inspector",children:x?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"wfb-inspector-head",children:[o.jsx("div",{className:"wfb-section-label",children:"节点配置"}),o.jsx("button",{className:"wfb-icon-btn",type:"button",onClick:D,title:"删除节点",children:o.jsx(sc,{className:"icon"})})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"名称"}),o.jsx("input",{className:`wfb-input ${S?"wfb-input--error":""}`,value:x.data.agent.name,onChange:A=>z({name:A.target.value}),placeholder:"agent_name"}),S?o.jsx("span",{className:"wfb-field-error",children:S}):o.jsx("span",{className:"wfb-field-help",children:"仅使用英文字母、数字和下划线,且名称保持唯一。"})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"描述"}),o.jsx("input",{className:"wfb-input",value:x.data.agent.description,onChange:A=>z({description:A.target.value}),placeholder:"这个 agent 做什么…"})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"指令 (instruction)"}),o.jsx("textarea",{className:"wfb-input wfb-textarea",value:x.data.agent.instruction,onChange:A=>z({instruction:A.target.value}),placeholder:"你是一个…",rows:6})]}),o.jsxs("label",{className:"wfb-field",children:[o.jsx("span",{className:"wfb-field-label",children:"工具 (逗号分隔)"}),o.jsx("input",{className:"wfb-input",value:x.data.agent.tools.join(", "),onChange:A=>z({tools:A.target.value.split(",").map(M=>M.trim()).filter(Boolean)}),placeholder:"web_search, calculator"})]}),o.jsxs("div",{className:"wfb-inspector-meta",children:[o.jsx("span",{className:"wfb-meta-key",children:"节点 ID"}),o.jsx("code",{className:"wfb-meta-val",children:x.id})]})]}):o.jsxs("div",{className:"wfb-inspector-empty",children:[o.jsx(au,{className:"wfb-empty-icon"}),o.jsx("p",{children:"选择一个节点以编辑其配置"}),o.jsxs("p",{className:"wfb-empty-sub",children:["共 ",d.length," 个节点 · ",p.length," 条连线"]})]})})]})})}function ZIe(e){return o.jsx(hA,{children:o.jsx(QIe,{...e})})}const lD=50*1024*1024,BN=800,JIe={name:"code_package",files:[]};function eje(e){let n=e.replace(/\.zip$/i,"").trim().replace(/[^A-Za-z0-9_]+/g,"_").replace(/^_+|_+$/g,"");return n||(n="uploaded_agent"),/^[A-Za-z_]/.test(n)||(n=`agent_${n}`),n==="user"&&(n="uploaded_agent"),n.slice(0,64)}function tje(e){const t=e.replace(/\\/g,"/").replace(/^\.\//,"");if(!t||t.endsWith("/"))return null;if(t.startsWith("/")||t.includes("\0"))throw new Error(`压缩包包含非法路径:${e}`);const n=t.split("/");if(n.some(s=>!s||s==="."||s===".."))throw new Error(`压缩包包含非法路径:${e}`);return n[0]==="__MACOSX"||n[n.length-1]===".DS_Store"?null:n.join("/")}function nje(e){const t=e.flatMap(a=>{const l=tje(a.name);return l?[{path:l,content:a.text}]:[]});if(t.length===0)throw new Error("压缩包中没有可部署的文件。");if(t.length>BN)throw new Error(`代码包文件数不能超过 ${BN} 个。`);const i=new Set(t.map(a=>a.path.split("/")[0])).size===1&&t.every(a=>a.path.includes("/"))?t.map(a=>({...a,path:a.path.split("/").slice(1).join("/")})):t,r=new Set;for(const a of i){if(r.has(a.path))throw new Error(`代码包包含重复文件:${a.path}`);r.add(a.path)}if(!r.has("app.py"))throw new Error("代码包根目录必须包含 app.py,作为 AgentKit 启动入口。");return i}function sje({onBack:e,onAgentAdded:t,onDeploymentTaskChange:n,onDeploymentStarted:s,onDeploymentComplete:i,initialDeployRegion:r="cn-beijing"}){const a=g.useRef(null),l=g.useRef(0),[c,u]=g.useState(null),[d,f]=g.useState(""),[h,p]=g.useState(!1),[m,b]=g.useState(!1),[v,y]=g.useState(!1),[x,E]=g.useState(""),[w,_]=g.useState(r),[S,k]=g.useState();g.useEffect(()=>()=>{l.current+=1},[]);async function T(L){const z=++l.current;if(E(""),!L.name.toLowerCase().endsWith(".zip")){E("请选择 .zip 格式的代码包。");return}if(L.size>lD){E("代码包不能超过 50 MB。");return}b(!0);try{const D=await SV(new Uint8Array(await L.arrayBuffer()),{maxEntries:BN,maxUncompressedBytes:lD}),F=nje(D);if(z!==l.current)return;f(L.name),u({name:eje(L.name),files:F})}catch(D){if(z!==l.current)return;f(""),u(null),E(D instanceof Error?D.message:String(D))}finally{z===l.current&&b(!1)}}function C(L){var D;const z=(D=L.currentTarget.files)==null?void 0:D[0];L.currentTarget.value="",z&&T(z)}function I(L){var D;L.preventDefault(),y(!1);const z=(D=L.dataTransfer.files)==null?void 0:D[0];z&&T(z)}async function j(L,z,D){const F=S&&S.mode!=="public"?{mode:S.mode,vpc_id:S.vpcId,subnet_ids:S.subnetIds,enable_shared_internet_access:S.enableSharedInternetAccess}:void 0;return ug(L.name,L.files,{region:w,projectName:"default",network:F},{...D,onStage:z})}return o.jsxs("div",{className:"package-create package-create-preview",children:[o.jsx(eE,{project:c??JIe,agentName:(c==null?void 0:c.name)||"代码包",onChange:c?u:void 0,onDeploy:j,onAgentAdded:t,onDeploymentTaskChange:n,onDeploymentStarted:s,onDeploymentComplete:i,network:S,onNetworkChange:k,deployRegion:w,onDeployRegionChange:_,deploymentTelemetrySource:"code_package",onBack:e,backLabel:"返回创建方式",deployDisabled:!c||m,deployDisabledReason:m?"正在读取代码包":c?void 0:"请先上传代码包",deploymentPrimaryPane:o.jsxs("section",{className:"package-source-pane","aria-label":"代码包上传",children:[o.jsx("div",{className:"package-source-label",children:"代码包"}),o.jsxs("div",{className:`package-dropzone${v?" is-dragging":""}${c?" is-ready":""}`,onDragEnter:L=>{L.preventDefault(),y(!0)},onDragOver:L=>L.preventDefault(),onDragLeave:L=>{L.currentTarget.contains(L.relatedTarget)||y(!1)},onDrop:I,onClick:()=>{var L;m||(L=a.current)==null||L.click()},onKeyDown:L=>{var z;!m&&(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),(z=a.current)==null||z.click())},role:"button",tabIndex:m?-1:0,"aria-label":c?"重新上传代码包":"上传代码包","aria-disabled":m,children:[o.jsx("strong",{children:m?"正在读取代码包…":c?d:"请上传代码包"}),o.jsx("span",{children:c?`已识别 ${c.files.length} 个文件,点击区域可重新上传`:"点击或拖拽上传,支持 .zip 格式,最大 50 MB,根目录需包含 app.py"}),o.jsx("div",{className:"package-upload-actions",children:c&&o.jsx("button",{type:"button",className:"package-upload-secondary",onClick:L=>{L.stopPropagation(),p(!0)},onKeyDown:L=>L.stopPropagation(),children:"查看文件"})}),o.jsx("input",{ref:a,type:"file",accept:".zip,application/zip","aria-label":"选择代码包",onChange:C})]}),x&&o.jsx("div",{className:"package-create-error",role:"alert",children:x})]})}),c&&o.jsx(Sz,{project:c,open:h,onClose:()=>p(!1),onChange:u})]})}const FV=1;function _x(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ije(e){return _x(e)&&typeof e.id=="string"&&typeof e.updatedAt=="number"&&_x(e.draft)}function oE(e){return`veadk.agentDrafts.${encodeURIComponent(e)}`}function rje(e){var s;const t=Z1(e),n={...((s=t.draft.deployment)==null?void 0:s.envValues)??{},...t.envValues};return!t.draft.deployment&&Object.keys(n).length===0?t.draft:{...t.draft,deployment:{...t.draft.deployment??{feishuEnabled:!1},envValues:n}}}function $V(e){return{...e,draft:rje(e.draft)}}function aje(e){const t=Array.isArray(e)?e:_x(e)&&e.version===FV?e.drafts:void 0;if(!Array.isArray(t)||!t.every(ije))throw _x(e)&&typeof e.version=="number"?new Error("本机草稿版本暂不受支持,请升级 Studio 后重试。"):new Error("本机草稿数据格式无效。");return t.map($V)}function oje(e,t){if(!t)return[];const n=e.getItem(oE(t));if(!n)return[];try{return aje(JSON.parse(n))}catch(s){throw s instanceof Error&&s.message.startsWith("本机草稿")?s:new Error("无法读取本机草稿,浏览器中的草稿数据可能已损坏。")}}function cD(e,t,n){if(!t)return;const s={version:FV,drafts:n.map($V)};try{e.setItem(oE(t),JSON.stringify(s))}catch(i){throw i instanceof DOMException&&(i.name==="QuotaExceededError"||i.name==="NS_ERROR_DOM_QUOTA_REACHED")?new Error("浏览器存储空间不足,草稿未保存。请删除不需要的草稿或清理此站点的浏览器存储后重试。"):new Error("浏览器拒绝保存草稿,请检查站点存储权限后重试。")}}const lje="/web/skill-creator";class P2 extends Error{constructor(n,s){super(n);NC(this,"status");this.name="SkillCreatorApiError",this.status=s}}function Ou(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} 格式错误`);return e}function us(e,...t){for(const n of t){const s=e[n];if(typeof s=="string"&&s)return s}}function HV(e,...t){for(const n of t){const s=e[n];if(typeof s=="number"&&Number.isFinite(s))return s}}async function Dg(e,t){return fetch(Cn(`${lje}${e}`),{...t,headers:s1({Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers})})}async function B2(e,t){if((e.headers.get("content-type")??"").includes("application/json")){const i=Ou(await e.json(),"错误响应");return us(i,"detail","message","error")??t}return(await e.text()).trim()||t}async function U2(e,t){if(!e.ok)throw new P2(await B2(e,t),e.status);if(!(e.headers.get("content-type")??"").includes("application/json"))throw new Error(`${t}:服务端返回了非 JSON 响应`);return e.json()}function cje(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 uje(e){if(e==="provisioning"||e==="generating"||e==="validating"||e==="packaging"||e==="completed"||e==="failed")return e;throw new Error(`未知的 Skill 生成阶段:${String(e)}`)}function dje(e){return Array.isArray(e)?e.map((t,n)=>{const s=Ou(t,`文件 ${n+1}`),i=us(s,"path");if(!i)throw new Error(`文件 ${n+1} 缺少 path`);const r=HV(s,"size");if(r===void 0)throw new Error(`文件 ${n+1} 缺少 size`);return{path:i,size:r}}):[]}function fje(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=Array.isArray(t.errors)?t.errors.map(String):[],s=Array.isArray(t.warnings)?t.warnings.map(String):[];return{valid:typeof t.valid=="boolean"?t.valid:n.length===0,errors:n,warnings:s}}function hje(e){if(e===void 0)return[];if(!Array.isArray(e))throw new Error("Skill 生成活动记录格式错误");return e.map((t,n)=>{const s=Ou(t,`活动 ${n+1}`),i=us(s,"id"),r=us(s,"kind"),a=us(s,"status");if(!i||!r||!["status","thinking","tool","message"].includes(r))throw new Error(`活动 ${n+1} 格式错误`);if(a!=="running"&&a!=="done")throw new Error(`活动 ${n+1} 状态错误`);if(r==="tool"){const c=us(s,"name");if(!c)throw new Error(`活动 ${n+1} 缺少工具名称`);return{id:i,kind:r,name:c,args:s.input,response:s.output,status:a}}const l=us(s,"text");if(!l)throw new Error(`活动 ${n+1} 缺少文本`);return{id:i,kind:r,text:l,status:a}})}function pje(e,t){const n=Ou(e,`候选方案 ${t+1}`),s=us(n,"id","candidate_id","candidateId"),i=us(n,"model","model_id","modelId");if(!s||!i)throw new Error(`候选方案 ${t+1} 缺少 id 或 model`);return{id:s,model:i,modelLabel:us(n,"modelLabel","model_label")??i,status:cje(n.status),stage:uje(n.stage),name:us(n,"name","skill_name","skillName"),description:us(n,"description"),skillMd:us(n,"skillMd","skill_md"),files:dje(n.files),activities:hje(n.activities),validation:fje(n.validation),durationMs:HV(n,"elapsedMs","elapsed_ms"),error:us(n,"error","error_message","errorMessage"),published:n.published===!0,skillId:us(n,"skill_id","skillId"),version:us(n,"version")}}function UN(e,t=""){const n=Ou(e,"Skill 创建任务"),s=us(n,"id","job_id","jobId");if(!s)throw new Error("Skill 创建任务缺少 id");const i=Array.isArray(n.candidates)?n.candidates.map(pje):[],r=us(n,"status")??"running";if(r!=="provisioning"&&r!=="running"&&r!=="completed")throw new Error(`未知的 Skill 任务状态:${r}`);return{id:s,prompt:us(n,"prompt")??t,status:r,candidates:i}}async function mje(e,t){const n=await Dg("/jobs",{method:"POST",body:JSON.stringify({prompt:e})});if(!n.ok)throw new P2(await B2(n,"创建 Skill 任务失败"),n.status);const s=n.headers.get("content-type")??"";if(s.includes("application/json")){const u=UN(await n.json(),e);return t==null||t(u),u}if(!s.includes("application/x-ndjson")||!n.body)throw new Error("创建 Skill 任务失败:服务端返回了非流式响应");const i=n.body.getReader(),r=new TextDecoder;let a="",l;const c=u=>{if(!u.trim())return;const d=Ou(JSON.parse(u),"Skill 创建进度");if(d.type==="error")throw new Error(us(d,"error")??"创建 Skill 任务失败");if(d.type!=="progress"&&d.type!=="complete")throw new Error("未知的 Skill 创建进度事件");l=UN(d.job,e),t==null||t(l)};for(;;){const{done:u,value:d}=await i.read();a+=r.decode(d,{stream:!u});const f=a.split(` +`);if(a=f.pop()??"",f.forEach(c),u)break}if(c(a),!l)throw new Error("创建 Skill 任务失败:服务端未返回任务");return l}async function gje(e){const t=await Dg(`/jobs/${encodeURIComponent(e)}`);return UN(await U2(t,"读取 Skill 任务失败"))}async function bje(e){const t=await Dg(`/jobs/${encodeURIComponent(e)}`,{method:"DELETE"});await U2(t,"清理 Skill 任务失败")}async function yje(e,t){var l;const n=await Dg(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/download`);if(!n.ok)throw new Error(await B2(n,"下载 Skill 失败"));const i=((l=(n.headers.get("content-disposition")??"").match(/filename="([^"]+)"/))==null?void 0:l[1])??"skill.zip",r=URL.createObjectURL(await n.blob()),a=document.createElement("a");a.href=r,a.download=i,a.click(),URL.revokeObjectURL(r)}async function xje(e,t,n){const s=await Dg(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/publish`,{method:"POST",body:JSON.stringify(n)}),i=Ou(await U2(s,"添加到 AgentKit 失败"),"发布结果"),r=us(i,"skill_id","skillId","id");if(!r)throw new Error("发布结果缺少 skill_id");return{skillId:r,name:us(i,"name"),version:us(i,"version"),skillSpaceIds:Array.isArray(i.skillSpaceIds)?i.skillSpaceIds.map(String):Array.isArray(i.skill_space_ids)?i.skill_space_ids.map(String):[],message:us(i,"message")}}const Eje=()=>{};function vje(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 wje({activities:e}){const t=g.useMemo(()=>e.filter(n=>n.kind!=="status").map(vje),[e]);return t.length===0?null:o.jsx("div",{className:"skill-conversation","aria-label":"Skill 生成对话","aria-live":"polite",children:o.jsx(r2,{blocks:t,onAction:Eje})})}const uD={provisioning:"正在准备 Sandbox",generating:"正在生成 Skill",validating:"正在校验结构",packaging:"正在打包",completed:"生成完成",failed:"生成失败"},dD=12e4;function Sje({status:e}){return e==="succeeded"?o.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("circle",{cx:"10",cy:"10",r:"7"}),o.jsx("path",{d:"m6.7 10.1 2.1 2.2 4.6-4.8"})]}):e==="failed"?o.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("circle",{cx:"10",cy:"10",r:"7"}),o.jsx("path",{d:"M10 6.2v4.5M10 13.6h.01"})]}):o.jsxs("svg",{className:"skill-candidate__spinner",viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("circle",{cx:"10",cy:"10",r:"7"}),o.jsx("path",{d:"M10 3a7 7 0 0 1 7 7"})]})}function _je(){return o.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("path",{d:"M4.2 3.5h7.1l4.5 4.6v8.4H4.2z"}),o.jsx("path",{d:"M11.3 3.5v4.6h4.5M7 11h6M7 13.8h4.2"})]})}function Nje(){return o.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:o.jsx("path",{d:"m9 5-5 5 5 5M4.5 10H16"})})}function Tje({candidate:e}){var c,u;const[t,n]=g.useState("SKILL.md"),s=e.files.find(d=>d.path.endsWith("SKILL.md")),i=e.skillMd&&!s?[{path:"SKILL.md",size:new Blob([e.skillMd]).size},...e.files]:e.files,r=i.find(d=>d.path===t)??i[0],a=(c=e.skillMd)==null?void 0:c.slice(0,dD),l=(((u=e.skillMd)==null?void 0:u.length)??0)>dD;return i.length===0?null:o.jsxs("div",{className:"skill-files",children:[o.jsx("div",{className:"skill-files__tabs",role:"tablist","aria-label":`${e.name??"Skill"} 文件`,children:i.map(d=>o.jsx("button",{type:"button",role:"tab","aria-selected":(r==null?void 0:r.path)===d.path,className:(r==null?void 0:r.path)===d.path?"is-active":"",onClick:()=>n(d.path),children:d.path},d.path))}),e.skillMd&&(r!=null&&r.path.endsWith("SKILL.md"))?o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:"skill-files__content",children:o.jsx("code",{children:a})}),l?o.jsx("p",{className:"skill-files__truncated",children:"预览内容较长,完整文件请下载 ZIP 查看。"}):null]}):o.jsx("div",{className:"skill-files__unavailable",children:r?`${r.path} · ${r.size.toLocaleString()} bytes`:"文件内容将在下载包中提供"})]})}function kje({label:e,jobId:t,candidate:n,selected:s,publishing:i,publishDisabled:r,publishError:a,onSelect:l,onPublish:c}){const[u,d]=g.useState("conversation"),[f,h]=g.useState(!1),[p,m]=g.useState(!1),[b,v]=g.useState(""),[y,x]=g.useState(""),[E,w]=g.useState(""),[_,S]=g.useState(""),k=g.useRef(null),T=g.useRef(null),C=n.status==="queued"||n.status==="running",I=n.status==="succeeded",j=n.validation;return o.jsxs("article",{className:`skill-candidate skill-candidate--${n.status}${s?" is-selected":""}`,"aria-label":`${e} ${n.model}`,children:[o.jsxs("header",{className:"skill-candidate__header",children:[o.jsx("h2",{children:n.model}),s?o.jsx("span",{className:"skill-candidate__selected",children:"已选方案"}):null]}),u==="conversation"?o.jsxs("div",{className:"skill-candidate__view skill-candidate__view--conversation",children:[o.jsxs("div",{className:"skill-candidate__status","aria-live":"polite",children:[o.jsx("span",{className:"skill-candidate__status-icon",children:o.jsx(Sje,{status:n.status})}),C?o.jsx(Ta,{duration:2.2,spread:16,children:uD[n.stage]}):o.jsx("span",{children:uD[n.stage]}),n.durationMs!==void 0&&I?o.jsxs("span",{className:"skill-candidate__duration",children:[(n.durationMs/1e3).toFixed(1)," 秒"]}):null]}),o.jsx(wje,{activities:n.activities}),n.error?o.jsx("div",{className:"skill-candidate__error",children:n.error}):null,I?o.jsx("div",{className:"skill-candidate__view-actions",children:o.jsxs("button",{ref:k,type:"button",className:"skill-action skill-action--preview",onClick:()=>{d("preview"),requestAnimationFrame(()=>{var L;return(L=T.current)==null?void 0:L.focus()})},children:[o.jsx(_je,{}),"查看 Skill"]})}):null]}):o.jsxs("div",{className:"skill-candidate__view skill-candidate__view--preview",children:[o.jsx("div",{className:"skill-candidate__preview-nav",children:o.jsxs("button",{ref:T,type:"button",className:"skill-candidate__back",onClick:()=>{d("conversation"),requestAnimationFrame(()=>{var L;return(L=k.current)==null?void 0:L.focus()})},children:[o.jsx(Nje,{}),"返回对话"]})}),o.jsxs("div",{className:"skill-candidate__result",children:[o.jsxs("div",{className:"skill-candidate__summary",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Skill"}),o.jsx("strong",{children:n.name??"未命名 Skill"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"文件"}),o.jsx("strong",{children:n.files.length})]}),o.jsxs("div",{children:[o.jsx("span",{children:"校验"}),o.jsx("strong",{className:(j==null?void 0:j.valid)===!1?"is-invalid":"is-valid",children:(j==null?void 0:j.valid)===!1?"未通过":"已通过"})]})]}),n.description?o.jsx("p",{className:"skill-candidate__description",children:n.description}):null,j&&(j.errors.length>0||j.warnings.length>0)?o.jsxs("details",{className:"skill-validation",children:[o.jsx("summary",{children:"查看校验详情"}),[...j.errors,...j.warnings].map((L,z)=>o.jsx("div",{children:L},`${L}-${z}`))]}):null,o.jsx(Tje,{candidate:n}),o.jsxs("div",{className:"skill-candidate__actions",children:[o.jsx("button",{type:"button",className:"skill-action skill-action--select","aria-pressed":s,onClick:l,children:s?"已采用此方案":"采用此方案"}),o.jsx("button",{type:"button",className:"skill-action",disabled:p,onClick:()=>{m(!0),v(""),yje(t,n.id).catch(L=>{v(L instanceof Error?L.message:String(L))}).finally(()=>m(!1))},children:p?"正在下载…":"下载 ZIP"}),o.jsx("button",{type:"button",className:"skill-action",disabled:!s||i||r||n.published,title:s?void 0:"请先采用此方案",onClick:()=>h(L=>!L),children:n.published?"已添加到 AgentKit":i?"正在添加…":"添加到 AgentKit"})]}),b?o.jsx("div",{className:"skill-candidate__error",children:b}):null,f&&s&&!n.published?o.jsxs("form",{className:"skill-publish-form",onSubmit:L=>{L.preventDefault();const z=y.split(",").map(D=>D.trim()).filter(Boolean);c({skillSpaceIds:z,...E.trim()?{projectName:E.trim()}:{},..._.trim()?{skillId:_.trim()}:{}})},children:[o.jsxs("label",{children:[o.jsx("span",{children:"SkillSpace ID(可选)"}),o.jsx("input",{value:y,onChange:L=>x(L.target.value),placeholder:"多个 ID 用英文逗号分隔"})]}),o.jsxs("div",{className:"skill-publish-form__optional",children:[o.jsxs("label",{children:[o.jsx("span",{children:"项目名称(可选)"}),o.jsx("input",{value:E,onChange:L=>w(L.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"已有 Skill ID(可选)"}),o.jsx("input",{value:_,onChange:L=>S(L.target.value)})]})]}),o.jsx("button",{type:"submit",className:"skill-action skill-action--select",disabled:i,children:i?"正在添加…":"确认添加"})]}):null,a?o.jsx("div",{className:"skill-candidate__error",children:a}):null]})]})]})}const fD=new Set(["completed"]),fb=1100,Aje=3e4;function Cje(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 Ije({initialJob:e}){const[t,n]=g.useState(e),[s,i]=g.useState(""),[r,a]=g.useState(!1),[l,c]=g.useState(),[u,d]=g.useState(),[f,h]=g.useState(()=>new Set),[p,m]=g.useState({});g.useEffect(()=>{n(e),i(""),a(!1)},[e]),g.useEffect(()=>{if(fD.has(e.status)||e.id.startsWith("pending-"))return;let y=!1,x;const E=Date.now()+Aje,w=async()=>{try{const _=await gje(e.id);y||(n({..._,prompt:_.prompt||e.prompt}),i(""),fD.has(_.status)||(x=window.setTimeout(w,fb)))}catch(_){if(!y){const S=_ instanceof P2?_:void 0;if((S==null?void 0:S.status)===404&&Date.now(){y=!0,x!==void 0&&window.clearTimeout(x)}},[e.id,e.status]);const b=o2.map((y,x)=>t.candidates.find(E=>E.model===y)??t.candidates[x]??Cje(y,x));async function v(y,x){d(y.id),m(E=>({...E,[y.id]:""}));try{await xje(t.id,y.id,x),h(E=>new Set(E).add(y.id))}catch(E){m(w=>({...w,[y.id]:E instanceof Error?E.message:String(E)}))}finally{d(void 0)}}return o.jsxs("section",{className:"skill-workspace",children:[o.jsx("header",{className:"skill-workspace__intro",children:o.jsx("h1",{children:"正在把需求变成可运行的 Skill"})}),s?o.jsxs("div",{className:"skill-workspace__poll-error",role:"alert",children:["状态刷新失败:",s,"。",r?"":"页面会继续重试。"]}):null,o.jsx("div",{className:"skill-workspace__grid",children:b.map((y,x)=>{const w=f.has(y.id)||y.published?{...y,published:!0}:y;return o.jsx(kje,{label:`方案 ${x===0?"A":"B"}`,jobId:t.id,candidate:w,selected:l===y.id,publishing:u===y.id,publishDisabled:u!==void 0&&u!==y.id,publishError:p[y.id],onSelect:()=>c(y.id),onPublish:_=>void v(y,_)},`${y.model}-${y.id}`)})})]})}function jje(e){return Object.prototype.toString.call(e)==="[object Object]"}function hD(e){return jje(e)||Array.isArray(e)}function Rje(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function F2(e,t){const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;const i=JSON.stringify(Object.keys(e.breakpoints||{})),r=JSON.stringify(Object.keys(t.breakpoints||{}));return i!==r?!1:n.every(a=>{const l=e[a],c=t[a];return typeof l=="function"?`${l}`==`${c}`:!hD(l)||!hD(c)?l===c:F2(l,c)})}function pD(e){return e.concat().sort((t,n)=>t.name>n.name?1:-1).map(t=>t.options)}function Oje(e,t){if(e.length!==t.length)return!1;const n=pD(e),s=pD(t);return n.every((i,r)=>{const a=s[r];return F2(i,a)})}function $2(e){return typeof e=="number"}function FN(e){return typeof e=="string"}function lE(e){return typeof e=="boolean"}function mD(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ss(e){return Math.abs(e)}function H2(e){return Math.sign(e)}function Jp(e,t){return Ss(e-t)}function Mje(e,t){if(e===0||t===0||Ss(e)<=Ss(t))return 0;const n=Jp(Ss(e),Ss(t));return Ss(n/e)}function Lje(e){return Math.round(e*100)/100}function Vm(e){return Gm(e).map(Number)}function Aa(e){return e[Pg(e)]}function Pg(e){return Math.max(0,e.length-1)}function z2(e,t){return t===Pg(e)}function gD(e,t=0){return Array.from(Array(e),(n,s)=>t+s)}function Gm(e){return Object.keys(e)}function zV(e,t){return[e,t].reduce((n,s)=>(Gm(s).forEach(i=>{const r=n[i],a=s[i],l=mD(r)&&mD(a);n[i]=l?zV(r,a):a}),n),{})}function $N(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function Dje(e,t){const n={start:s,center:i,end:r};function s(){return 0}function i(c){return r(c)/2}function r(c){return t-c}function a(c,u){return FN(e)?n[e](c):e(t,c,u)}return{measure:a}}function Km(){let e=[];function t(i,r,a,l={passive:!0}){let c;if("addEventListener"in i)i.addEventListener(r,a,l),c=()=>i.removeEventListener(r,a,l);else{const u=i;u.addListener(a),c=()=>u.removeListener(a)}return e.push(c),s}function n(){e=e.filter(i=>i())}const s={add:t,clear:n};return s}function Pje(e,t,n,s){const i=Km(),r=1e3/60;let a=null,l=0,c=0;function u(){i.add(e,"visibilitychange",()=>{e.hidden&&m()})}function d(){p(),i.clear()}function f(v){if(!c)return;a||(a=v,n(),n());const y=v-a;for(a=v,l+=y;l>=r;)n(),l-=r;const x=l/r;s(x),c&&(c=t.requestAnimationFrame(f))}function h(){c||(c=t.requestAnimationFrame(f))}function p(){t.cancelAnimationFrame(c),a=null,l=0,c=0}function m(){a=null,l=0}return{init:u,destroy:d,start:h,stop:p,update:n,render:s}}function Bje(e,t){const n=t==="rtl",s=e==="y",i=s?"y":"x",r=s?"x":"y",a=!s&&n?-1:1,l=d(),c=f();function u(m){const{height:b,width:v}=m;return s?b:v}function d(){return s?"top":n?"right":"left"}function f(){return s?"bottom":n?"left":"right"}function h(m){return m*a}return{scroll:i,cross:r,startEdge:l,endEdge:c,measureSize:u,direction:h}}function bu(e=0,t=0){const n=Ss(e-t);function s(u){return ut}function r(u){return s(u)||i(u)}function a(u){return r(u)?s(u)?e:t:u}function l(u){return n?u-n*Math.ceil((u-t)/n):u}return{length:n,max:t,min:e,constrain:a,reachedAny:r,reachedMax:i,reachedMin:s,removeOffset:l}}function VV(e,t,n){const{constrain:s}=bu(0,e),i=e+1;let r=a(t);function a(h){return n?Ss((i+h)%i):s(h)}function l(){return r}function c(h){return r=a(h),f}function u(h){return d().set(l()+h)}function d(){return VV(e,l(),n)}const f={get:l,set:c,add:u,clone:d};return f}function Uje(e,t,n,s,i,r,a,l,c,u,d,f,h,p,m,b,v,y,x){const{cross:E,direction:w}=e,_=["INPUT","SELECT","TEXTAREA"],S={passive:!1},k=Km(),T=Km(),C=bu(50,225).constrain(p.measure(20)),I={mouse:300,touch:400},j={mouse:500,touch:600},L=m?43:25;let z=!1,D=0,F=0,A=!1,M=!1,P=!1,H=!1;function R(de){if(!x)return;function ge(Ee){(lE(x)||x(de,Ee))&&V(Ee)}const Le=t;k.add(Le,"dragstart",Ee=>Ee.preventDefault(),S).add(Le,"touchmove",()=>{},S).add(Le,"touchend",()=>{}).add(Le,"touchstart",ge).add(Le,"mousedown",ge).add(Le,"touchcancel",q).add(Le,"contextmenu",q).add(Le,"click",ue,!0)}function Y(){k.clear(),T.clear()}function J(){const de=H?n:t;T.add(de,"touchmove",W,S).add(de,"touchend",q).add(de,"mousemove",W,S).add(de,"mouseup",q)}function U(de){const ge=de.nodeName||"";return _.includes(ge)}function te(){return(m?j:I)[H?"mouse":"touch"]}function K(de,ge){const Le=f.add(H2(de)*-1),Ee=d.byDistance(de,!m).distance;return m||Ss(de)=2,!(ge&&de.button!==0)&&(U(de.target)||(A=!0,r.pointerDown(de),u.useFriction(0).useDuration(0),i.set(a),J(),D=r.readPoint(de),F=r.readPoint(de,E),h.emit("pointerDown")))}function W(de){if(!$N(de,s)&&de.touches.length>=2)return q(de);const Le=r.readPoint(de),Ee=r.readPoint(de,E),ie=Jp(Le,D),Ne=Jp(Ee,F);if(!M&&!H&&(!de.cancelable||(M=ie>Ne,!M)))return q(de);const ve=r.pointerMove(de);ie>b&&(P=!0),u.useFriction(.3).useDuration(.75),l.start(),i.add(w(ve)),de.preventDefault()}function q(de){const Le=d.byDistance(0,!1).index!==f.get(),Ee=r.pointerUp(de)*te(),ie=K(w(Ee),Le),Ne=Mje(Ee,ie),ve=L-10*Ne,Qe=y+Ne/50;M=!1,A=!1,T.clear(),u.useDuration(ve).useFriction(Qe),c.distance(ie,!m),H=!1,h.emit("pointerUp")}function ue(de){P&&(de.stopPropagation(),de.preventDefault(),P=!1)}function pe(){return A}return{init:R,destroy:Y,pointerDown:pe}}function Fje(e,t){let s,i;function r(f){return f.timeStamp}function a(f,h){const m=`client${(h||e.scroll)==="x"?"X":"Y"}`;return($N(f,t)?f:f.touches[0])[m]}function l(f){return s=f,i=f,a(f)}function c(f){const h=a(f)-a(i),p=r(f)-r(s)>170;return i=f,p&&(s=f),h}function u(f){if(!s||!i)return 0;const h=a(i)-a(s),p=r(f)-r(s),m=r(f)-r(i)>170,b=h/p;return p&&!m&&Ss(b)>.1?b:0}return{pointerDown:l,pointerMove:c,pointerUp:u,readPoint:a}}function $je(){function e(n){const{offsetTop:s,offsetLeft:i,offsetWidth:r,offsetHeight:a}=n;return{top:s,right:i+r,bottom:s+a,left:i,width:r,height:a}}return{measure:e}}function Hje(e){function t(s){return e*(s/100)}return{measure:t}}function zje(e,t,n,s,i,r,a){const l=[e].concat(s);let c,u,d=[],f=!1;function h(v){return i.measureSize(a.measure(v))}function p(v){if(!r)return;u=h(e),d=s.map(h);function y(x){for(const E of x){if(f)return;const w=E.target===e,_=s.indexOf(E.target),S=w?u:d[_],k=h(w?e:s[_]);if(Ss(k-S)>=.5){v.reInit(),t.emit("resize");break}}}c=new ResizeObserver(x=>{(lE(r)||r(v,x))&&y(x)}),n.requestAnimationFrame(()=>{l.forEach(x=>c.observe(x))})}function m(){f=!0,c&&c.disconnect()}return{init:p,destroy:m}}function Vje(e,t,n,s,i,r){let a=0,l=0,c=i,u=r,d=e.get(),f=0;function h(){const S=s.get()-e.get(),k=!c;let T=0;return k?(a=0,n.set(s),e.set(s),T=S):(n.set(e),a+=S/c,a*=u,d+=a,e.add(a),T=d-f),l=H2(T),f=d,_}function p(){const S=s.get()-t.get();return Ss(S)<.001}function m(){return c}function b(){return l}function v(){return a}function y(){return E(i)}function x(){return w(r)}function E(S){return c=S,_}function w(S){return u=S,_}const _={direction:b,duration:m,velocity:v,seek:h,settled:p,useBaseFriction:x,useBaseDuration:y,useFriction:w,useDuration:E};return _}function Gje(e,t,n,s,i){const r=i.measure(10),a=i.measure(50),l=bu(.1,.99);let c=!1;function u(){return!(c||!e.reachedAny(n.get())||!e.reachedAny(t.get()))}function d(p){if(!u())return;const m=e.reachedMin(t.get())?"min":"max",b=Ss(e[m]-t.get()),v=n.get()-t.get(),y=l.constrain(b/a);n.subtract(v*y),!p&&Ss(v){const{min:v,max:y}=r,x=r.constrain(m),E=!b,w=z2(n,b);return E?y:w||u(v,x)?v:u(y,x)?y:x}).map(m=>parseFloat(m.toFixed(3)))}function h(){if(t<=e+i)return[r.max];if(s==="keepSnaps")return a;const{min:m,max:b}=l;return a.slice(m,b)}return{snapsContained:c,scrollContainLimit:l}}function qje(e,t,n){const s=t[0],i=n?s-e:Aa(t);return{limit:bu(i,s)}}function Yje(e,t,n,s){const r=t.min+.1,a=t.max+.1,{reachedMin:l,reachedMax:c}=bu(r,a);function u(h){return h===1?c(n.get()):h===-1?l(n.get()):!1}function d(h){if(!u(h))return;const p=e*(h*-1);s.forEach(m=>m.add(p))}return{loop:d}}function Wje(e){const{max:t,length:n}=e;function s(r){const a=r-t;return n?a/-n:0}return{get:s}}function Xje(e,t,n,s,i){const{startEdge:r,endEdge:a}=e,{groupSlides:l}=i,c=f().map(t.measure),u=h(),d=p();function f(){return l(s).map(b=>Aa(b)[a]-b[0][r]).map(Ss)}function h(){return s.map(b=>n[r]-b[r]).map(b=>-Ss(b))}function p(){return l(u).map(b=>b[0]).map((b,v)=>b+c[v])}return{snaps:u,snapsAligned:d}}function Qje(e,t,n,s,i,r){const{groupSlides:a}=i,{min:l,max:c}=s,u=d();function d(){const h=a(r),p=!e||t==="keepSnaps";return n.length===1?[r]:p?h:h.slice(l,c).map((m,b,v)=>{const y=!b,x=z2(v,b);if(y){const E=Aa(v[0])+1;return gD(E)}if(x){const E=Pg(r)-Aa(v)[0]+1;return gD(E,Aa(v)[0])}return m})}return{slideRegistry:u}}function Zje(e,t,n,s,i){const{reachedAny:r,removeOffset:a,constrain:l}=s;function c(m){return m.concat().sort((b,v)=>Ss(b)-Ss(v))[0]}function u(m){const b=e?a(m):l(m),v=t.map((x,E)=>({diff:d(x-b,0),index:E})).sort((x,E)=>Ss(x.diff)-Ss(E.diff)),{index:y}=v[0];return{index:y,distance:b}}function d(m,b){const v=[m,m+n,m-n];if(!e)return m;if(!b)return c(v);const y=v.filter(x=>H2(x)===b);return y.length?c(y):Aa(v)-n}function f(m,b){const v=t[m]-i.get(),y=d(v,b);return{index:m,distance:y}}function h(m,b){const v=i.get()+m,{index:y,distance:x}=u(v),E=!e&&r(v);if(!b||E)return{index:y,distance:m};const w=t[y]-x,_=m+d(w,0);return{index:y,distance:_}}return{byDistance:h,byIndex:f,shortcut:d}}function Jje(e,t,n,s,i,r,a){function l(f){const h=f.distance,p=f.index!==t.get();r.add(h),h&&(s.duration()?e.start():(e.update(),e.render(1),e.update())),p&&(n.set(t.get()),t.set(f.index),a.emit("select"))}function c(f,h){const p=i.byDistance(f,h);l(p)}function u(f,h){const p=t.clone().set(f),m=i.byIndex(p.get(),h);l(m)}return{distance:c,index:u}}function eRe(e,t,n,s,i,r,a,l){const c={passive:!0,capture:!0};let u=0;function d(p){if(!l)return;function m(b){if(new Date().getTime()-u>10)return;a.emit("slideFocusStart"),e.scrollLeft=0;const x=n.findIndex(E=>E.includes(b));$2(x)&&(i.useDuration(0),s.index(x,0),a.emit("slideFocus"))}r.add(document,"keydown",f,!1),t.forEach((b,v)=>{r.add(b,"focus",y=>{(lE(l)||l(p,y))&&m(v)},c)})}function f(p){p.code==="Tab"&&(u=new Date().getTime())}return{init:d}}function bp(e){let t=e;function n(){return t}function s(c){t=a(c)}function i(c){t+=a(c)}function r(c){t-=a(c)}function a(c){return $2(c)?c:c.get()}return{get:n,set:s,add:i,subtract:r}}function GV(e,t){const n=e.scroll==="x"?a:l,s=t.style;let i=null,r=!1;function a(h){return`translate3d(${h}px,0px,0px)`}function l(h){return`translate3d(0px,${h}px,0px)`}function c(h){if(r)return;const p=Lje(e.direction(h));p!==i&&(s.transform=n(p),i=p)}function u(h){r=!h}function d(){r||(s.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:d,to:c,toggleActive:u}}function tRe(e,t,n,s,i,r,a,l,c){const d=Vm(i),f=Vm(i).reverse(),h=y().concat(x());function p(k,T){return k.reduce((C,I)=>C-i[I],T)}function m(k,T){return k.reduce((C,I)=>p(C,T)>0?C.concat([I]):C,[])}function b(k){return r.map((T,C)=>({start:T-s[C]+.5+k,end:T+t-.5+k}))}function v(k,T,C){const I=b(T);return k.map(j=>{const L=C?0:-n,z=C?n:0,D=C?"end":"start",F=I[j][D];return{index:j,loopPoint:F,slideLocation:bp(-1),translate:GV(e,c[j]),target:()=>l.get()>F?L:z}})}function y(){const k=a[0],T=m(f,k);return v(T,n,!1)}function x(){const k=t-a[0]-1,T=m(d,k);return v(T,-n,!0)}function E(){return h.every(({index:k})=>{const T=d.filter(C=>C!==k);return p(T,t)<=.1})}function w(){h.forEach(k=>{const{target:T,translate:C,slideLocation:I}=k,j=T();j!==I.get()&&(C.to(j),I.set(j))})}function _(){h.forEach(k=>k.translate.clear())}return{canLoop:E,clear:_,loop:w,loopPoints:h}}function nRe(e,t,n){let s,i=!1;function r(c){if(!n)return;function u(d){for(const f of d)if(f.type==="childList"){c.reInit(),t.emit("slidesChanged");break}}s=new MutationObserver(d=>{i||(lE(n)||n(c,d))&&u(d)}),s.observe(e,{childList:!0})}function a(){s&&s.disconnect(),i=!0}return{init:r,destroy:a}}function sRe(e,t,n,s){const i={};let r=null,a=null,l,c=!1;function u(){l=new IntersectionObserver(m=>{c||(m.forEach(b=>{const v=t.indexOf(b.target);i[v]=b}),r=null,a=null,n.emit("slidesInView"))},{root:e.parentElement,threshold:s}),t.forEach(m=>l.observe(m))}function d(){l&&l.disconnect(),c=!0}function f(m){return Gm(i).reduce((b,v)=>{const y=parseInt(v),{isIntersecting:x}=i[y];return(m&&x||!m&&!x)&&b.push(y),b},[])}function h(m=!0){if(m&&r)return r;if(!m&&a)return a;const b=f(m);return m&&(r=b),m||(a=b),b}return{init:u,destroy:d,get:h}}function iRe(e,t,n,s,i,r){const{measureSize:a,startEdge:l,endEdge:c}=e,u=n[0]&&i,d=m(),f=b(),h=n.map(a),p=v();function m(){if(!u)return 0;const x=n[0];return Ss(t[l]-x[l])}function b(){if(!u)return 0;const x=r.getComputedStyle(Aa(s));return parseFloat(x.getPropertyValue(`margin-${c}`))}function v(){return n.map((x,E,w)=>{const _=!E,S=z2(w,E);return _?h[E]+d:S?h[E]+f:w[E+1][l]-x[l]}).map(Ss)}return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:f}}function rRe(e,t,n,s,i,r,a,l,c){const{startEdge:u,endEdge:d,direction:f}=e,h=$2(n);function p(y,x){return Vm(y).filter(E=>E%x===0).map(E=>y.slice(E,E+x))}function m(y){return y.length?Vm(y).reduce((x,E,w)=>{const _=Aa(x)||0,S=_===0,k=E===Pg(y),T=i[u]-r[_][u],C=i[u]-r[E][d],I=!s&&S?f(a):0,j=!s&&k?f(l):0,L=Ss(C-j-(T+I));return w&&L>t+c&&x.push(E),k&&x.push(y.length),x},[]).map((x,E,w)=>{const _=Math.max(w[E-1]||0);return y.slice(_,x)}):[]}function b(y){return h?p(y,n):m(y)}return{groupSlides:b}}function aRe(e,t,n,s,i,r,a){const{align:l,axis:c,direction:u,startIndex:d,loop:f,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:b,slidesToScroll:v,skipSnaps:y,containScroll:x,watchResize:E,watchSlides:w,watchDrag:_,watchFocus:S}=r,k=2,T=$je(),C=T.measure(t),I=n.map(T.measure),j=Bje(c,u),L=j.measureSize(C),z=Hje(L),D=Dje(l,L),F=!f&&!!x,A=f||!!x,{slideSizes:M,slideSizesWithGaps:P,startGap:H,endGap:R}=iRe(j,C,I,n,A,i),Y=rRe(j,L,v,f,C,I,H,R,k),{snaps:J,snapsAligned:U}=Xje(j,D,C,I,Y),te=-Aa(J)+Aa(P),{snapsContained:K,scrollContainLimit:V}=Kje(L,te,U,x,k),W=F?K:U,{limit:q}=qje(te,W,f),ue=VV(Pg(W),d,f),pe=ue.clone(),we=Vm(n),de=({dragHandler:Fe,scrollBody:at,scrollBounds:It,options:{loop:ft}})=>{ft||It.constrain(Fe.pointerDown()),at.seek()},ge=({scrollBody:Fe,translate:at,location:It,offsetLocation:ft,previousLocation:fn,scrollLooper:Et,slideLooper:Nt,dragHandler:Qt,animation:Ve,eventHandler:Tt,scrollBounds:rt,options:{loop:ut}},Ze)=>{const _t=Fe.settled(),me=!rt.shouldConstrain(),We=ut?_t:_t&&me,bt=We&&!Qt.pointerDown();bt&&Ve.stop();const an=It.get()*Ze+fn.get()*(1-Ze);ft.set(an),ut&&(Et.loop(Fe.direction()),Nt.loop()),at.to(ft.get()),bt&&Tt.emit("settle"),We||Tt.emit("scroll")},Le=Pje(s,i,()=>de(xe),Fe=>ge(xe,Fe)),Ee=.68,ie=W[ue.get()],Ne=bp(ie),ve=bp(ie),Qe=bp(ie),De=bp(ie),Ke=Vje(Ne,Qe,ve,De,h,Ee),Se=Zje(f,W,te,q,De),He=Jje(Le,ue,pe,Ke,Se,De,a),Be=Wje(q),qe=Km(),Z=sRe(t,n,a,b),{slideRegistry:ae}=Qje(F,x,W,V,Y,we),ne=eRe(e,n,ae,He,Ke,qe,a,S),xe={ownerDocument:s,ownerWindow:i,eventHandler:a,containerRect:C,slideRects:I,animation:Le,axis:j,dragHandler:Uje(j,e,s,i,De,Fje(j,i),Ne,Le,He,Ke,Se,ue,a,z,p,m,y,Ee,_),eventStore:qe,percentOfView:z,index:ue,indexPrevious:pe,limit:q,location:Ne,offsetLocation:Qe,previousLocation:ve,options:r,resizeHandler:zje(t,a,i,n,j,E,T),scrollBody:Ke,scrollBounds:Gje(q,Qe,De,Ke,z),scrollLooper:Yje(te,q,Qe,[Ne,Qe,ve,De]),scrollProgress:Be,scrollSnapList:W.map(Be.get),scrollSnaps:W,scrollTarget:Se,scrollTo:He,slideLooper:tRe(j,L,te,M,P,J,W,Qe,n),slideFocus:ne,slidesHandler:nRe(t,a,w),slidesInView:Z,slideIndexes:we,slideRegistry:ae,slidesToScroll:Y,target:De,translate:GV(j,t)};return xe}function oRe(){let e={},t;function n(u){t=u}function s(u){return e[u]||[]}function i(u){return s(u).forEach(d=>d(t,u)),c}function r(u,d){return e[u]=s(u).concat([d]),c}function a(u,d){return e[u]=s(u).filter(f=>f!==d),c}function l(){e={}}const c={init:n,emit:i,off:a,on:r,clear:l};return c}const lRe={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function cRe(e){function t(r,a){return zV(r,a||{})}function n(r){const a=r.breakpoints||{},l=Gm(a).filter(c=>e.matchMedia(c).matches).map(c=>a[c]).reduce((c,u)=>t(c,u),{});return t(r,l)}function s(r){return r.map(a=>Gm(a.breakpoints||{})).reduce((a,l)=>a.concat(l),[]).map(e.matchMedia)}return{mergeOptions:t,optionsAtMedia:n,optionsMediaQueries:s}}function uRe(e){let t=[];function n(r,a){return t=a.filter(({options:l})=>e.optionsAtMedia(l).active!==!1),t.forEach(l=>l.init(r,e)),a.reduce((l,c)=>Object.assign(l,{[c.name]:c}),{})}function s(){t=t.filter(r=>r.destroy())}return{init:n,destroy:s}}function Nx(e,t,n){const s=e.ownerDocument,i=s.defaultView,r=cRe(i),a=uRe(r),l=Km(),c=oRe(),{mergeOptions:u,optionsAtMedia:d,optionsMediaQueries:f}=r,{on:h,off:p,emit:m}=c,b=j;let v=!1,y,x=u(lRe,Nx.globalOptions),E=u(x),w=[],_,S,k;function T(){const{container:we,slides:de}=E;S=(FN(we)?e.querySelector(we):we)||e.children[0];const Le=FN(de)?S.querySelectorAll(de):de;k=[].slice.call(Le||S.children)}function C(we){const de=aRe(e,S,k,s,i,we,c);if(we.loop&&!de.slideLooper.canLoop()){const ge=Object.assign({},we,{loop:!1});return C(ge)}return de}function I(we,de){v||(x=u(x,we),E=d(x),w=de||w,T(),y=C(E),f([x,...w.map(({options:ge})=>ge)]).forEach(ge=>l.add(ge,"change",j)),E.active&&(y.translate.to(y.location.get()),y.animation.init(),y.slidesInView.init(),y.slideFocus.init(pe),y.eventHandler.init(pe),y.resizeHandler.init(pe),y.slidesHandler.init(pe),y.options.loop&&y.slideLooper.loop(),S.offsetParent&&k.length&&y.dragHandler.init(pe),_=a.init(pe,w)))}function j(we,de){const ge=Y();L(),I(u({startIndex:ge},we),de),c.emit("reInit")}function L(){y.dragHandler.destroy(),y.eventStore.clear(),y.translate.clear(),y.slideLooper.clear(),y.resizeHandler.destroy(),y.slidesHandler.destroy(),y.slidesInView.destroy(),y.animation.destroy(),a.destroy(),l.clear()}function z(){v||(v=!0,l.clear(),L(),c.emit("destroy"),c.clear())}function D(we,de,ge){!E.active||v||(y.scrollBody.useBaseFriction().useDuration(de===!0?0:E.duration),y.scrollTo.index(we,ge||0))}function F(we){const de=y.index.add(1).get();D(de,we,-1)}function A(we){const de=y.index.add(-1).get();D(de,we,1)}function M(){return y.index.add(1).get()!==Y()}function P(){return y.index.add(-1).get()!==Y()}function H(){return y.scrollSnapList}function R(){return y.scrollProgress.get(y.offsetLocation.get())}function Y(){return y.index.get()}function J(){return y.indexPrevious.get()}function U(){return y.slidesInView.get()}function te(){return y.slidesInView.get(!1)}function K(){return _}function V(){return y}function W(){return e}function q(){return S}function ue(){return k}const pe={canScrollNext:M,canScrollPrev:P,containerNode:q,internalEngine:V,destroy:z,off:p,on:h,emit:m,plugins:K,previousScrollSnap:J,reInit:b,rootNode:W,scrollNext:F,scrollPrev:A,scrollProgress:R,scrollSnapList:H,scrollTo:D,selectedScrollSnap:Y,slideNodes:ue,slidesInView:U,slidesNotInView:te};return I(t,n),setTimeout(()=>c.emit("init"),0),pe}Nx.globalOptions=void 0;function V2(e={},t=[]){const n=g.useRef(e),s=g.useRef(t),[i,r]=g.useState(),[a,l]=g.useState(),c=g.useCallback(()=>{i&&i.reInit(n.current,s.current)},[i]);return g.useEffect(()=>{F2(n.current,e)||(n.current=e,c())},[e,c]),g.useEffect(()=>{Oje(s.current,t)||(s.current=t,c())},[t,c]),g.useEffect(()=>{if(Rje()&&a){Nx.globalOptions=V2.globalOptions;const u=Nx(a,n.current,s.current);return r(u),()=>u.destroy()}else r(void 0)},[a,r]),[l,i]}V2.globalOptions=void 0;const KV=g.createContext(null);function Bg(...e){return e.filter(Boolean).join(" ")}function cE(){const e=g.useContext(KV);if(!e)throw new Error("useCarousel must be used within a ");return e}function dRe({orientation:e="horizontal",opts:t,setApi:n,plugins:s,className:i,children:r,...a}){const[l,c]=V2({...t,axis:e==="horizontal"?"x":"y"},s),[u,d]=g.useState(!1),[f,h]=g.useState(!1),p=g.useCallback(y=>{y&&(d(y.canScrollPrev()),h(y.canScrollNext()))},[]),m=g.useCallback(()=>c==null?void 0:c.scrollPrev(),[c]),b=g.useCallback(()=>c==null?void 0:c.scrollNext(),[c]),v=g.useCallback(y=>{y.key==="ArrowLeft"?(y.preventDefault(),m()):y.key==="ArrowRight"&&(y.preventDefault(),b())},[b,m]);return g.useEffect(()=>{c&&n&&n(c)},[c,n]),g.useEffect(()=>{if(c)return p(c),c.on("reInit",p),c.on("select",p),()=>{c.off("reInit",p),c.off("select",p)}},[c,p]),o.jsx(KV.Provider,{value:{carouselRef:l,api:c,opts:t,orientation:e,plugins:s,setApi:n,scrollPrev:m,scrollNext:b,canScrollPrev:u,canScrollNext:f},children:o.jsx("div",{onKeyDownCapture:v,className:Bg("ui-carousel",i),role:"region","aria-roledescription":"carousel","aria-orientation":e,"data-slot":"carousel",...a,children:r})})}function fRe({className:e,...t}){const{carouselRef:n,orientation:s}=cE();return o.jsx("div",{ref:n,className:"ui-carousel__viewport","data-slot":"carousel-content",children:o.jsx("div",{className:Bg("ui-carousel__track",s==="vertical"?"is-vertical":void 0,e),...t})})}function hRe({className:e,...t}){const{orientation:n}=cE();return o.jsx("div",{role:"group","aria-roledescription":"slide","data-slot":"carousel-item",className:Bg("ui-carousel__item",n==="vertical"?"is-vertical":void 0,e),...t})}function qV({direction:e}){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:e==="left"?"m10 3.75-4.25 4.25L10 12.25":"m6 3.75 4.25 4.25L6 12.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function pRe({className:e,...t}){const{orientation:n,scrollPrev:s,canScrollPrev:i}=cE();return o.jsx("button",{type:"button","data-slot":"carousel-previous",className:Bg("ui-carousel__control ui-carousel__control--previous",n==="vertical"?"is-vertical":void 0,e),disabled:!i,onClick:s,"aria-label":"上一张",...t,children:o.jsx(qV,{direction:"left"})})}function mRe({className:e,...t}){const{orientation:n,scrollNext:s,canScrollNext:i}=cE();return o.jsx("button",{type:"button","data-slot":"carousel-next",className:Bg("ui-carousel__control ui-carousel__control--next",n==="vertical"?"is-vertical":void 0,e),disabled:!i,onClick:s,"aria-label":"下一张",...t,children:o.jsx(qV,{direction:"right"})})}const bD=[{title:"随心应变",description:"支持多类 Agent",illustration:"agents"},{title:"一键成型",description:"自动构建 Agent",illustration:"build"},{title:"一搜即达",description:"全局搜索",illustration:"search"},{title:"开箱即用",description:"丰富内置工具",illustration:"tools"}];function gRe(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4.25 4.25 7.5 7.5m0-7.5-7.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function bRe({kind:e}){return e==="agents"?o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsx("g",{className:"new-chat-feature-card__illustration-connectors",children:o.jsx("path",{d:"M43 27.5V33.5H22V38.5M43 33.5H64V38.5"})}),o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"33",y:"6.5",width:"20",height:"21",rx:"6"}),o.jsx("rect",{x:"9",y:"38.5",width:"26",height:"19",rx:"6"}),o.jsx("rect",{x:"51",y:"38.5",width:"26",height:"19",rx:"6"})]}),o.jsxs("g",{className:"new-chat-feature-card__illustration-details",children:[o.jsx("circle",{className:"new-chat-feature-card__illustration-dot",cx:"40",cy:"14.5",r:"1.25"}),o.jsx("circle",{className:"new-chat-feature-card__illustration-dot",cx:"46",cy:"14.5",r:"1.25"}),o.jsx("path",{d:"M39.5 21h7M17 46.5h10M17 51.5h7M59 46.5h10M59 51.5h7"})]})]}):e==="build"?o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsx("g",{className:"new-chat-feature-card__illustration-connectors",children:o.jsx("path",{d:"M26.5 39H36M50 39h9.5"})}),o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"5.5",y:"7.5",width:"75",height:"49",rx:"7.5"}),o.jsx("rect",{x:"12.5",y:"31.5",width:"14",height:"15",rx:"4"}),o.jsx("rect",{x:"36",y:"31.5",width:"14",height:"15",rx:"4"}),o.jsx("rect",{x:"59.5",y:"31.5",width:"14",height:"15",rx:"4"})]}),o.jsx("g",{className:"new-chat-feature-card__illustration-details",children:o.jsx("path",{d:"M6 20.5h74M13.5 14h.01m6 0h.01m6 0h.01M17 39h5m18.5 0h5m18-1 2.5 2.5 4-5"})})]}):e==="search"?o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"7.5",y:"9.5",width:"41",height:"16",rx:"5"}),o.jsx("rect",{x:"7.5",y:"35.5",width:"34",height:"18",rx:"5"}),o.jsx("circle",{cx:"61",cy:"33",r:"10.5"})]}),o.jsx("g",{className:"new-chat-feature-card__illustration-details",children:o.jsx("path",{d:"M14.5 16h21M14.5 21h14M14.5 42.5h17M14.5 47.5h11M68.5 40.5 77 49"})})]}):o.jsxs("svg",{className:"new-chat-feature-card__illustration",viewBox:"0 0 86 64","aria-hidden":"true",children:[o.jsxs("g",{className:"new-chat-feature-card__illustration-surfaces",children:[o.jsx("rect",{x:"8.5",y:"7.5",width:"29",height:"21",rx:"6"}),o.jsx("rect",{x:"48.5",y:"7.5",width:"29",height:"21",rx:"6"}),o.jsx("rect",{x:"8.5",y:"35.5",width:"29",height:"21",rx:"6"}),o.jsx("rect",{x:"48.5",y:"35.5",width:"29",height:"21",rx:"6"})]}),o.jsx("g",{className:"new-chat-feature-card__illustration-details",children:o.jsx("path",{d:"M23 13.5v9m-4.5-4.5h9M56.5 14.5h13M56.5 21.5h13M16.5 42.5h13M16.5 49.5h9M56.5 42.5h13M56.5 49.5h13"})})]})}function yRe(){const[e,t]=g.useState(),[n,s]=g.useState(!1),[i,r]=g.useState(!1),[a,l]=g.useState(!1),[c,u]=g.useState(!0);return g.useEffect(()=>{if(!c)return;const d=window.matchMedia("(prefers-reduced-motion: reduce)"),f=()=>l(d.matches);return f(),d.addEventListener("change",f),()=>d.removeEventListener("change",f)},[c]),g.useEffect(()=>{if(!c||!e||n||i||a)return;const d=window.setInterval(()=>e.scrollNext(),6e3);return()=>window.clearInterval(d)},[e,i,n,a,c]),c?o.jsxs(dRe,{className:"new-chat-feature-carousel",opts:{align:"start",loop:!0},setApi:t,"aria-label":"新特性预览",onPointerEnter:()=>s(!0),onPointerLeave:()=>s(!1),onFocusCapture:()=>r(!0),onBlurCapture:d=>{d.currentTarget.contains(d.relatedTarget)||r(!1)},children:[o.jsx(pRe,{"aria-label":"上一张新特性"}),o.jsx(fRe,{children:bD.map((d,f)=>o.jsx(hRe,{"aria-label":`${f+1} / ${bD.length}`,children:o.jsxs("article",{className:"new-chat-feature-card",children:[o.jsxs("div",{className:"new-chat-feature-card__copy",children:[o.jsx("strong",{children:d.title}),o.jsx("span",{children:d.description})]}),o.jsx(bRe,{kind:d.illustration})]})},d.title))}),o.jsx("button",{type:"button",className:"new-chat-feature-carousel__close","aria-label":"关闭新特性轮播",onClick:()=>u(!1),children:o.jsx(gRe,{})}),o.jsx(mRe,{"aria-label":"下一张新特性"})]}):null}const xRe=3*60*1e3,ERe=3e3,vRe=10*60*1e3,Tx="veadk.studio.pending-update",yD=[{id:"resolving",label:"读取目标版本信息"},{id:"downloading",label:"下载并校验完整更新包"},{id:"preparing",label:"准备 VeFaaS Function 代码"},{id:"submitting",label:"提交 Function 更新"},{id:"publishing",label:"发布新 Revision 并重启服务"}],wRe={resolving:"读取版本信息",downloading:"下载更新包",preparing:"准备 Function 代码",submitting:"提交 Function 更新",publishing:"发布 Revision",checking:"检查更新",unknown:"未知阶段"};function SRe(e){return e<60?`${e} 秒`:`${Math.floor(e/60)} 分 ${e%60} 秒`}function _Re(e,t){return e===t?!0:/^\d{14}$/.test(e)&&/^\d{14}$/.test(t)&&e>t}function NRe(){if(typeof window>"u")return null;const e=window.localStorage.getItem(Tx);if(!e)return null;try{const t=JSON.parse(e);if(typeof t.targetVersion=="string"&&typeof t.startedAt=="number")return{targetVersion:t.targetVersion,startedAt:t.startedAt}}catch{}return window.localStorage.removeItem(Tx),null}function Ww(e,t){window.localStorage.setItem(Tx,JSON.stringify({targetVersion:e,startedAt:t}))}function hb(){window.localStorage.removeItem(Tx)}function xD({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M19.2 8.3A8 8 0 1 0 20 13"}),o.jsx("path",{d:"M19.2 4.8v3.5h-3.5"}),o.jsx("path",{d:"M12 7.8v7.7"}),o.jsx("path",{d:"m9.2 12.7 2.8 2.8 2.8-2.8"})]})}function TRe(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:"m4 6 4 4 4-4"})})}function kRe(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})})}function ED({lines:e,phase:t,copyState:n,onCopy:s}){const i=g.useRef(null),r=g.useRef(!0);return g.useEffect(()=>{const a=i.current;a&&r.current&&(a.scrollTop=a.scrollHeight)},[e]),o.jsxs("section",{className:"studio-update-live-log","aria-label":"VeFaaS 更新日志",children:[o.jsxs("div",{className:"studio-update-log-header",children:[o.jsxs("span",{children:[o.jsx("i",{className:`is-${t}`,"aria-hidden":!0}),"VeFaaS 更新日志",o.jsx("small",{children:t==="active"?"实时":t==="complete"?"已完成":"已停止"})]}),o.jsx("button",{type:"button",onClick:s,disabled:!e.length,children:n==="copied"?"已复制":n==="error"?"复制失败":"复制日志"})]}),o.jsx("div",{ref:i,className:"studio-update-log-lines",role:"log","aria-live":"off",tabIndex:0,onScroll:a=>{const l=a.currentTarget;r.current=l.scrollHeight-l.scrollTop-l.clientHeight<24},children:e.length?e.map((a,l)=>o.jsx("div",{children:a},`${l}-${a}`)):o.jsx("p",{children:t==="active"?"等待 VeFaaS 返回更新日志…":"本次更新未返回发布日志"})})]})}function ARe({variant:e="default"}){var D,F;const[t]=g.useState(NRe),[n,s]=g.useState(null),[i,r]=g.useState(t?"submitting":"idle"),[a,l]=g.useState(!1),[c,u]=g.useState(""),[d,f]=g.useState((t==null?void 0:t.targetVersion)??""),[h,p]=g.useState(!1),[m,b]=g.useState("idle"),[v,y]=g.useState(0),x=g.useRef(null),E=g.useRef((t==null?void 0:t.targetVersion)??""),w=g.useRef((t==null?void 0:t.startedAt)??0);g.useEffect(()=>{if(!h)return;const A=P=>{var H;P.target instanceof Node&&!((H=x.current)!=null&&H.contains(P.target))&&p(!1)},M=P=>{P.key==="Escape"&&p(!1)};return window.addEventListener("pointerdown",A),window.addEventListener("keydown",M),()=>{window.removeEventListener("pointerdown",A),window.removeEventListener("keydown",M)}},[h]);const _=g.useCallback(async()=>{const A=await o8(E.current||void 0,w.current||void 0);return s(A),A},[]);if(g.useEffect(()=>{let A=!0;const M=()=>{_().catch(()=>{A&&s(H=>H)})};M();const P=window.setInterval(M,xRe);return()=>{A=!1,window.clearInterval(P)}},[_]),g.useEffect(()=>{if(i!=="submitting")return;const A=window.setInterval(()=>{_().then(M=>{const P=E.current;if(P&&_Re(M.currentVersion,P)||!P&&!M.available&&M.latestVersion){window.clearInterval(A),hb(),r("published"),u("Studio 已更新,刷新页面即可使用新版本");return}if(M.state==="error"){window.clearInterval(A),hb(),r("error"),u(M.message||"Studio 更新失败");return}Date.now()-w.current>vRe&&(window.clearInterval(A),hb(),r("error"),u("等待 VeFaaS 发布超时,请稍后重新检查版本"))}).catch(()=>{})},ERe);return()=>window.clearInterval(A)},[i,_]),g.useEffect(()=>{i!=="idle"||(n==null?void 0:n.state)!=="updating"||(E.current=n.targetVersion,w.current=n.startedAt||Date.now(),Ww(n.targetVersion,w.current),f(n.targetVersion),r("submitting"))},[i,n]),g.useEffect(()=>{if(i!=="submitting"){y(0);return}const A=()=>{const P=w.current||Date.now();y(Math.max(0,Math.floor((Date.now()-P)/1e3)))};A();const M=window.setInterval(A,1e3);return()=>window.clearInterval(M)},[i]),!(n!=null&&n.enabled)||!(n.available||n.state==="updating"||i!=="idle"))return null;const k=n.releases??[],T=d||((D=k[0])==null?void 0:D.version)||n.latestVersion,C=k.find(A=>A.version===T),I=async()=>{E.current=T,w.current=Date.now(),Ww(T,w.current),r("submitting"),u(""),b("idle");try{const A=await l8(T);E.current=A.version,Ww(A.version,w.current),u("更新已提交,正在等待 VeFaaS 发布新版本")}catch(A){if(A instanceof TypeError){u("连接已切换,正在确认新版本状态");return}hb(),r("error");const M=A instanceof Error?A.message:"Studio 更新失败";try{const P=await _();u(P.message||M)}catch{u(M)}}},j=(F=n.updateLogs)!=null&&F.length?n.updateLogs:(n.errorLog||n.progressMessage||c).split(` `).filter(Boolean),L=async()=>{try{await navigator.clipboard.writeText(j.join(` -`)),b("copied")}catch{b("error")}},z=()=>{var A;p(!1),b("idle"),u(""),f(E.current||((A=k[0])==null?void 0:A.version)||""),r("confirm")};return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:e==="feature-link"?"welcome-feature-link studio-update-trigger--feature":`studio-update-trigger is-${i}`,title:i==="submitting"?"正在更新 Studio":i==="published"?"Studio 已更新":`更新 Studio 至 ${n.latestVersion}`,onClick:()=>{var A;i==="published"?window.location.reload():(i==="submitting"||i==="error"||(f(((A=k[0])==null?void 0:A.version)||n.latestVersion),r("confirm")),l(!0))},children:[e!=="feature-link"&&o.jsx(mD,{className:"studio-update-icon"}),i==="submitting"?o.jsx(ka,{as:"span",children:"正在更新"}):i==="published"?o.jsx("span",{children:"刷新使用新版"}):i==="error"?o.jsx("span",{children:"更新失败"}):e==="feature-link"?o.jsx("span",{children:"立即更新"}):o.jsx("span",{children:"有新版更新"})]}),a&&i!=="idle"&&o.jsx("div",{className:"confirm-scrim",role:"presentation",children:o.jsxs("section",{className:"confirm-box studio-update-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"studio-update-title",children:[o.jsx("div",{className:"studio-update-dialog-mark",children:o.jsx(mD,{})}),o.jsx("div",{id:"studio-update-title",className:"confirm-title",children:i==="error"?"Studio 更新失败":i==="submitting"?"正在更新 Studio":i==="published"?"Studio 更新完成":"发现新版本"}),i==="error"?o.jsxs("div",{className:"studio-update-error-panel",children:[o.jsx("p",{className:"confirm-text studio-update-error",children:c}),o.jsxs("dl",{className:"studio-update-error-meta",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"失败阶段"}),o.jsx("dd",{children:yRe[n.errorStage]||n.errorStage||"未知阶段"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"错误 ID"}),o.jsx("dd",{children:n.errorId||"未生成"})]})]}),o.jsx(gD,{lines:j,phase:"error",copyState:m,onCopy:()=>void L()}),n.consoleUrl&&o.jsxs("a",{className:"studio-update-console-link",href:n.consoleUrl,target:"_blank",rel:"noreferrer",children:["前往 VeFaaS 控制台查看 Function 日志",o.jsx("span",{"aria-hidden":!0,children:"↗"})]})]}):i==="submitting"||i==="published"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"studio-update-progress-summary",children:[o.jsxs("div",{children:[o.jsx("span",{children:"目标版本"}),o.jsx("strong",{children:E.current||T})]}),o.jsxs("div",{children:[o.jsx("span",{children:i==="published"?"更新状态":"已用时"}),o.jsx("strong",{children:i==="published"?"已完成":xRe(v)})]})]}),o.jsx("ol",{className:"studio-update-progress","aria-label":"Studio 更新进度",children:pD.map((A,O)=>{const P=pD.findIndex(Y=>Y.id===n.progressStage),$=i==="published"||Ovoid L()}),o.jsx("p",{className:"studio-update-progress-note",children:"发布阶段会短暂中断连接;关闭此窗口不会停止更新,可随时点击右上角按钮重新查看。"})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"confirm-text",children:"更新会重启 Studio 服务,预计约 3–5 分钟完成更新与发布。期间正在进行的对话、 流式响应或部署任务可能中断,登录态不会受到影响。"}),o.jsxs("div",{className:"studio-update-field",ref:x,children:[o.jsx("span",{children:"选择版本"}),o.jsxs("button",{type:"button",className:"studio-update-version-trigger","aria-label":"选择版本","aria-haspopup":"listbox","aria-expanded":h,onClick:()=>p(A=>!A),onKeyDown:A=>{(A.key==="ArrowDown"||A.key==="ArrowUp")&&(A.preventDefault(),p(!0))},children:[o.jsx("span",{children:T}),o.jsx(wRe,{})]}),h&&o.jsx("div",{className:"studio-update-version-menu",role:"listbox","aria-label":"选择版本",children:k.map(A=>{const O=A.version===T;return o.jsxs("button",{type:"button",role:"option","aria-selected":O,className:`studio-update-version-option${O?" is-selected":""}`,onClick:()=>{f(A.version),p(!1)},children:[o.jsx("span",{children:A.version}),O&&o.jsx(SRe,{})]},A.version)})})]}),o.jsxs("dl",{className:"studio-update-versions",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:n.currentVersion})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"目标版本"}),o.jsx("dd",{children:T})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"Commit"}),o.jsx("dd",{children:((C==null?void 0:C.gitSha)||n.latestGitSha).slice(0,8)})]})]}),o.jsxs("section",{className:"studio-update-changelog","aria-labelledby":"studio-update-changelog-title",children:[o.jsx("div",{id:"studio-update-changelog-title",children:"更新内容"}),C!=null&&C.changelog.length?o.jsx("ul",{children:C.changelog.map(A=>o.jsx("li",{children:A},A))}):o.jsx("p",{children:"暂无更新说明"})]})]}),o.jsxs("div",{className:"confirm-actions",children:[o.jsx("button",{type:"button",className:"confirm-btn",onClick:()=>{l(!1),p(!1),i==="confirm"&&(r("idle"),u(""))},children:i==="submitting"?"后台运行":i==="confirm"?"取消":"关闭"}),i==="confirm"&&o.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:()=>void I(),children:"立即更新"}),i==="error"&&o.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:z,children:"重新尝试"})]})]})})]})}const NRe=[{title:"多地域智能体",description:"并行加载北京与上海 Runtime,列表下滑即可继续加载。"},{title:"会话内切换",description:"在输入框旁选择智能体,并直接开启一段新会话。"},{title:"可视化执行画布",description:"通过横向画布查看多智能体结构,并支持全屏浏览。"}];function TRe({canUpdate:e=!1}){return o.jsxs("div",{className:"welcome-feature-pill",children:[o.jsx("span",{children:"焕然一新"}),o.jsx("span",{className:"welcome-feature-divider","aria-hidden":"true"}),o.jsx("button",{type:"button",className:"welcome-feature-link","aria-describedby":"welcome-feature-popover",children:"查看新特性"}),o.jsxs("section",{id:"welcome-feature-popover",className:"welcome-feature-popover",role:"tooltip",children:[o.jsx("strong",{children:"本次更新"}),o.jsx("ul",{children:NRe.map(t=>o.jsxs("li",{children:[o.jsx("span",{children:t.title}),o.jsx("p",{children:t.description})]},t.title))})]}),e&&o.jsx(_Re,{variant:"feature-link"})]})}const kRe=1e4;async function VV(e){const t=await fetch(Cn(e),{headers:t1({Accept:"application/json"}),signal:Un(void 0,kRe)});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 ARe(){return VV("/web/sandbox/capabilities")}async function CRe(){return VV("/web/skill-creator/capabilities")}const IRe="我的智能体";function jRe({open:e,state:t,agentKind:n="codex",error:s,onCancel:i,onConfirm:r}){const a=n==="codex"?"Codex":n==="openclaw"?"OpenClaw":"Hermes",l=n==="codex"?IRe:`我的 ${a}`,c=g.useRef(null),u=g.useRef(null),d=g.useRef(null),f=g.useRef(!1),h=g.useRef(i),[p,m]=g.useState(l);if(h.current=i,g.useEffect(()=>{if(!e)return;m(l);const x=document.body.style.overflow;document.body.style.overflow="hidden";const E=window.requestAnimationFrame(()=>{var _,S;(_=u.current)==null||_.focus(),(S=u.current)==null||S.select()}),w=_=>{var C;if(_.key==="Escape"){_.preventDefault(),h.current();return}if(_.key!=="Tab")return;const S=(C=c.current)==null?void 0:C.querySelectorAll("input:not(:disabled), button:not(:disabled)");if(!(S!=null&&S.length))return;const k=S[0],T=S[S.length-1];_.shiftKey&&document.activeElement===k?(_.preventDefault(),T.focus()):!_.shiftKey&&document.activeElement===T&&(_.preventDefault(),k.focus())};return window.addEventListener("keydown",w),()=>{window.cancelAnimationFrame(E),document.body.style.overflow=x,window.removeEventListener("keydown",w)}},[l,e]),!e)return null;const b=t==="loading",v=p.trim(),y=b?`正在创建 ${a} 智能体`:t==="error"?"启动失败":`创建 ${a} 智能体`;return hi.createPortal(o.jsx("div",{className:"sandbox-dialog-backdrop",onMouseDown:x=>{x.target===x.currentTarget&&!b&&i()},children:o.jsxs("form",{ref:c,className:"sandbox-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"sandbox-dialog-title","aria-describedby":t==="confirm"?void 0:"sandbox-dialog-description",onSubmit:x=>{x.preventDefault(),!b&&!f.current&&v&&r(v)},children:[o.jsxs("div",{className:"sandbox-dialog-visual","aria-hidden":"true",children:[o.jsx("span",{className:"sandbox-dialog-orbit"}),o.jsx("span",{className:"sandbox-dialog-icon",children:b?o.jsx("span",{className:"sandbox-spinner"}):o.jsx($m,{kind:n})})]}),o.jsxs("div",{className:"sandbox-dialog-copy",children:[o.jsx("h2",{id:"sandbox-dialog-title",children:y}),t==="error"?o.jsx("p",{id:"sandbox-dialog-description",className:"sandbox-dialog-error",role:"alert",children:s||"AgentKit 沙箱初始化失败,请稍后重新尝试。"}):b?o.jsxs("p",{id:"sandbox-dialog-description","aria-live":"polite",children:["正在创建并等待 ",a," 智能体就绪,这通常需要半分钟"]}):null,o.jsxs("label",{className:"sandbox-dialog-field",children:[o.jsxs("span",{className:"sandbox-dialog-field-label",children:[o.jsx("span",{children:"智能体名称"}),o.jsxs("span",{"aria-hidden":"true",children:[p.length,"/",t3]})]}),o.jsx("input",{ref:u,type:"text",required:!0,value:p,maxLength:t3,disabled:b,placeholder:l,autoComplete:"off",onChange:x=>m(x.target.value),onCompositionStart:()=>{f.current=!0},onCompositionEnd:()=>{f.current=!1},onKeyDown:x=>{const{nativeEvent:E}=x;x.key==="Enter"&&(f.current||E.isComposing||E.keyCode===229)&&x.preventDefault()}})]})]}),o.jsxs("footer",{className:"sandbox-dialog-actions",children:[o.jsx("button",{ref:d,type:"button",onClick:i,children:b?"取消创建":"取消"}),!b&&o.jsx("button",{type:"submit",className:"is-primary",disabled:!v,children:t==="error"?"重新尝试":"确认创建"})]})]})}),document.body)}function RRe({agentName:e,onExit:t}){return o.jsxs("div",{className:"sandbox-session-warning",role:"status",children:[o.jsx("span",{className:"sandbox-session-warning-dot","aria-hidden":"true"}),o.jsxs("span",{className:"sandbox-session-warning-copy",children:["当前您在使用 ",e," 智能体"]}),o.jsx("button",{type:"button",onClick:t,children:"退出内置智能体"})]})}function ORe({activity:e,time:t}){var n;return o.jsxs("aside",{className:"sandbox-activity-record",role:"status","aria-label":"Sandbox 操作记录",children:[o.jsxs("div",{className:"sandbox-activity-summary",children:[o.jsx("span",{className:"sandbox-activity-dot","aria-hidden":"true"}),o.jsx("span",{className:"sandbox-activity-label",children:"操作记录"}),o.jsx("strong",{children:e.title}),t?o.jsx("time",{children:t}):null]}),(n=e.details)!=null&&n.length?o.jsx("dl",{className:"sandbox-activity-details",children:e.details.map(s=>o.jsxs("div",{children:[o.jsx("dt",{children:s.label}),o.jsx("dd",{title:s.value,children:s.code?o.jsx("code",{children:s.value}):s.value})]},`${s.label}:${s.value}`))}):null]})}function MRe(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(e)}function LRe({usage:e}){const t=[["Total",e.totalTokens],["Input",e.inputTokens],...e.cachedInputTokens>0?[["Cached input",e.cachedInputTokens]]:[],["Output",e.outputTokens],...e.reasoningOutputTokens>0?[["Reasoning output",e.reasoningOutputTokens]]:[]];return o.jsx("div",{className:"sandbox-token-usage","aria-label":"Codex Token 用量",children:t.map(([n,s])=>o.jsxs("span",{title:`${n}: ${s.toLocaleString()} tokens`,children:[o.jsx("small",{children:n}),o.jsx("strong",{children:MRe(s)})]},n))})}function GV(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("path",{d:"m7.5 9 2.7 2.5L7.5 14M12.7 14h3.8"}),o.jsx("path",{d:"M3.8 7.5h16.4",opacity:".55"})]})}function KV(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("path",{d:"M3.8 8h16.4"}),o.jsx("circle",{cx:"6.5",cy:"6.3",r:".65",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"8.8",cy:"6.3",r:".65",fill:"currentColor",stroke:"none"}),o.jsx("path",{d:"m9 15 2.2-4 1.6 2.4 1.1-1.2L16 15H9Z"})]})}function $2(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M12 3.4 19 6v5.3c0 4.3-2.7 7.6-7 9.3-4.3-1.7-7-5-7-9.3V6l7-2.6Z"}),o.jsx("path",{d:"m8.8 12 2 2 4.4-4.4"})]})}function Jb(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M3.5 7.7h6.1l1.7 2h9.2v7.5a2.3 2.3 0 0 1-2.3 2.3H5.8a2.3 2.3 0 0 1-2.3-2.3V7.7Z"}),o.jsx("path",{d:"M3.8 7.7V6.8a2.3 2.3 0 0 1 2.3-2.3h3l1.8 2h6.9a2.3 2.3 0 0 1 2.3 2.3v.9"}),o.jsx("path",{d:"M12 13v3M10.5 14.5h3"})]})}function DRe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 5v14M5 12h14"})})}function PRe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6.5 11.5 5.5-5.5 5.5 5.5M12 6v12"})})}function BRe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("circle",{cx:"8.5",cy:"9",r:"1.4"}),o.jsx("path",{d:"m5.5 17 4.2-4.2 2.6 2.4 2.1-2.1 4.1 3.9"})]})}function URe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3.5h7l5 5v12H6z"}),o.jsx("path",{d:"M13 3.5v5h5M9 13h6M9 16h5"})]})}function FRe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"13.5",height:"14",rx:"2.5"}),o.jsx("path",{d:"m17 10 3.5-2v8L17 14zM7 8.5h4.5"})]})}function $Re(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m12 3 1.5 4.5L18 9l-4.5 1.5L12 15l-1.5-4.5L6 9l4.5-1.5zM18.5 15.5l.7 2.1 2.1.7-2.1.7-.7 2.1-.7-2.1-2.1-.7 2.1-.7z"})})}function HRe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6.5 6.5 11 11M17.5 6.5l-11 11"})})}function BN(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9 6 6 6-6 6"})})}function zRe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.8 8.2A8 8 0 1 1 4 12M4.8 8.2V4.5M4.8 8.2h3.7"}),o.jsx("path",{d:"M12 8v4.5l3 1.8"})]})}function Ho(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M20 12a8 8 0 1 1-2.35-5.65"})})}function Fg({open:e,title:t,subtitle:n,icon:s,className:i="",onClose:r,children:a}){const l=g.useId(),c=g.useRef(null),u=g.useRef(null),d=g.useRef(r);return d.current=r,g.useEffect(()=>{var p;if(!e)return;u.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const f=document.body.style.overflow;document.body.style.overflow="hidden",(p=c.current)==null||p.focus();const h=m=>{var E;if(m.key==="Escape"){m.preventDefault(),d.current();return}if(m.key!=="Tab")return;const b=(E=c.current)==null?void 0:E.closest("[role=dialog]"),v=Array.from((b==null?void 0:b.querySelectorAll('button:not(:disabled), input:not(:disabled), iframe, [tabindex]:not([tabindex="-1"])'))??[]);if(v.length===0)return;const y=v[0],x=v[v.length-1];m.shiftKey&&document.activeElement===y?(m.preventDefault(),x.focus()):!m.shiftKey&&document.activeElement===x&&(m.preventDefault(),y.focus())};return window.addEventListener("keydown",h),()=>{var m;document.body.style.overflow=f,window.removeEventListener("keydown",h),(m=u.current)==null||m.focus()}},[e]),e?hi.createPortal(o.jsx("div",{className:"sandbox-control-backdrop",onMouseDown:f=>{f.target===f.currentTarget&&r()},children:o.jsxs("section",{className:`sandbox-control-dialog ${i}`.trim(),role:"dialog","aria-modal":"true","aria-labelledby":l,children:[o.jsxs("header",{className:"sandbox-control-head",children:[o.jsx("span",{className:"sandbox-control-head-icon","aria-hidden":"true",children:s}),o.jsxs("div",{children:[o.jsx("h2",{id:l,children:t}),o.jsx("p",{children:n})]}),o.jsx("button",{ref:c,type:"button",className:"sandbox-control-close","aria-label":`关闭${t}`,onClick:r,children:o.jsx(HRe,{})})]}),a]})}),document.body):null}function VRe({open:e,kind:t,launch:n,loading:s,error:i,onReload:r,onClose:a}){const l=t==="terminal",c=l?"Terminal":"Sandbox Browser";return o.jsxs(Fg,{open:e,title:c,subtitle:l?"连接当前 AgentKit Session 的交互式终端":"在当前 AgentKit Session 中查看与操作浏览器",icon:l?o.jsx(GV,{}):o.jsx(KV,{}),className:`sandbox-tool-dialog sandbox-tool-dialog--${t}`,onClose:a,children:[o.jsx("div",{className:"sandbox-tool-toolbar",children:o.jsxs("span",{children:[o.jsx("i",{className:s?"is-loading":n?"is-ready":""}),s?"正在连接…":n?"已连接":"尚未连接"]})}),o.jsx("div",{className:"sandbox-tool-surface",children:s?o.jsxs("div",{className:"sandbox-control-state",children:[o.jsx(Ho,{className:"spin"}),o.jsxs("strong",{children:["正在打开 ",c]}),o.jsx("span",{children:"工具正在连接当前 AgentKit Session。"})]}):i?o.jsxs("div",{className:"sandbox-control-state is-error",children:[o.jsxs("strong",{children:[c," 打开失败"]}),o.jsx("span",{children:i}),o.jsx("button",{type:"button",onClick:r,children:"重试"})]}):n?o.jsx("iframe",{src:n.url,title:c,allow:"clipboard-read; clipboard-write",sandbox:"allow-downloads allow-forms allow-modals allow-popups allow-pointer-lock allow-same-origin allow-scripts"}):null})]})}function GRe({open:e,threads:t,currentThreadId:n,loading:s,error:i,onSelect:r,onClose:a}){return o.jsx(Fg,{open:e,title:"恢复 Codex 对话",subtitle:"选择当前 Sandbox Session 中最近更新的 Thread",icon:o.jsx(zRe,{}),className:"sandbox-threads-dialog",onClose:a,children:o.jsx("div",{className:"sandbox-thread-list",children:s?o.jsxs("div",{className:"sandbox-control-state",children:[o.jsx(Ho,{className:"spin"}),o.jsx("strong",{children:"正在读取历史对话"})]}):i?o.jsxs("div",{className:"sandbox-control-state is-error",children:[o.jsx("strong",{children:"历史对话读取失败"}),o.jsx("span",{children:i})]}):t.length===0?o.jsx("div",{className:"sandbox-control-state",children:o.jsx("strong",{children:"暂无可恢复的对话"})}):t.map(l=>{const c=l.id===n,u=l.name||l.preview||`Thread ${l.id.slice(0,8)}`;return o.jsxs("button",{type:"button",className:c?"is-active":"",disabled:c,onClick:()=>r(l.id),children:[o.jsxs("span",{children:[o.jsx("strong",{children:u}),o.jsx("small",{children:l.preview||l.cwd||l.id})]}),o.jsx("time",{children:l.updatedAt?new Date(l.updatedAt*1e3).toLocaleString():""}),o.jsx(BN,{})]},l.id)})})})}const KRe=[{value:"read-only",label:"只读",detail:"允许读取文件,不允许写入工作空间。"},{value:"workspace-write",label:"工作区写入",detail:"允许在当前工作空间内读取与修改文件。"},{value:"danger-full-access",label:"完全访问",detail:"不启用沙箱隔离,适合明确可信的任务。",danger:!0}],qRe=[{value:"untrusted",label:"仅不可信命令",detail:"只对 Codex 判断为不可信的操作发起审批。"},{value:"on-request",label:"按需审批",detail:"Codex 可在必要时请求你确认命令或文件修改。"},{value:"never",label:"不审批",detail:"Codex 不会暂停并请求人工批准。",danger:!0}],YRe=[{value:"user",label:"由我审批",detail:"审批请求会显示在 Studio 中,由你决定。"},{value:"auto_review",label:"自动审查",detail:"使用 Codex 自动审查流程处理审批请求。"}];function WRe({open:e,value:t,busy:n,error:s,onSave:i,onClose:r}){const[a,l]=g.useState(t);return g.useEffect(()=>{e&&l(t)},[e,t]),o.jsxs(Fg,{open:e,title:"Codex 权限",subtitle:"设置会保存到当前 Sandbox Session,并同步到其中的所有 Thread",icon:o.jsx($2,{}),className:"sandbox-settings-dialog",onClose:r,children:[o.jsxs("div",{className:"sandbox-control-body",children:[o.jsx(qw,{label:"沙箱模式",choices:KRe,value:a.sandboxMode,disabled:n,onChange:c=>l(u=>({...u,sandboxMode:c,networkAccess:c==="danger-full-access"?!0:u.networkAccess}))}),o.jsx(qw,{label:"审批策略",choices:qRe,value:a.approvalPolicy,disabled:n,onChange:c=>l(u=>({...u,approvalPolicy:c}))}),o.jsx(qw,{label:"审批方式",choices:YRe,value:a.approvalsReviewer,disabled:n,onChange:c=>l(u=>({...u,approvalsReviewer:c}))}),o.jsxs("label",{className:`sandbox-network-toggle${a.sandboxMode==="danger-full-access"?" is-disabled":""}`,children:[o.jsxs("span",{children:[o.jsx("strong",{children:"允许网络访问"}),o.jsx("small",{children:"控制 workspace-write 与只读模式中的外部网络访问。"})]}),o.jsx("input",{type:"checkbox",checked:a.networkAccess,disabled:n||a.sandboxMode==="danger-full-access",onChange:c=>l(u=>({...u,networkAccess:c.target.checked}))})]}),a.sandboxMode==="danger-full-access"?o.jsx("div",{className:"sandbox-control-note is-danger",children:"完全访问会关闭文件系统与网络隔离,请只在可信任务中使用。"}):null,s?o.jsx("div",{className:"sandbox-control-error",children:s}):null]}),o.jsxs("footer",{className:"sandbox-control-actions",children:[o.jsx("button",{type:"button",onClick:r,disabled:n,children:"取消"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:n,onClick:()=>i(a),children:[n?o.jsx(Ho,{className:"spin"}):null,"保存权限"]})]})]})}function qw({label:e,choices:t,value:n,disabled:s,onChange:i}){return o.jsxs("fieldset",{className:"sandbox-choice-group",disabled:s,role:"radiogroup","aria-label":e,children:[o.jsx("legend",{children:e}),o.jsx("div",{className:"sandbox-choice-list",children:t.map(r=>o.jsxs("button",{type:"button",role:"radio",className:`${n===r.value?"is-active":""}${r.danger?" is-danger":""}`.trim(),"aria-checked":n===r.value,onClick:()=>i(r.value),onKeyDown:a=>{var d,f;const l=t.findIndex(h=>h.value===r.value);let c=l;if(a.key==="ArrowRight"||a.key==="ArrowDown")c=(l+1)%t.length;else if(a.key==="ArrowLeft"||a.key==="ArrowUp")c=(l-1+t.length)%t.length;else if(a.key==="Home")c=0;else if(a.key==="End")c=t.length-1;else return;a.preventDefault(),i(t[c].value);const u=(d=a.currentTarget.parentElement)==null?void 0:d.querySelectorAll('[role="radio"]');(f=u==null?void 0:u[c])==null||f.focus()},children:[o.jsx("i",{}),o.jsxs("span",{children:[o.jsx("strong",{children:r.label}),o.jsx("small",{children:r.detail})]})]},r.value))})]})}function XRe({open:e,cwd:t,locked:n,busy:s,error:i,browse:r,onSave:a,onClose:l}){const[c,u]=g.useState(t||"/"),[d,f]=g.useState(null),[h,p]=g.useState(!1),[m,b]=g.useState("");g.useEffect(()=>{if(!e)return;const y=t||"/";u(y),v(y)},[t,e]);async function v(y){p(!0),b("");try{const x=await r(y);f(x),u(x.path)}catch(x){b(x instanceof Error?x.message:String(x))}finally{p(!1)}}return o.jsxs(Fg,{open:e,title:"工作空间",subtitle:"选择当前 Codex Thread 执行命令与修改文件的目录",icon:o.jsx(Jb,{}),className:"sandbox-workspace-dialog",onClose:l,children:[o.jsxs("div",{className:"sandbox-control-body",children:[o.jsxs("label",{className:"sandbox-workspace-input",children:[o.jsx("span",{children:"绝对路径"}),o.jsxs("div",{children:[o.jsx("input",{value:c,disabled:s||n,spellCheck:!1,onChange:y=>u(y.target.value),onKeyDown:y=>{y.key==="Enter"&&c.startsWith("/")&&(y.preventDefault(),v(c))}}),o.jsx("button",{type:"button",disabled:s||h||!c.startsWith("/"),onClick:()=>void v(c),children:"浏览"})]})]}),o.jsxs("div",{className:"sandbox-directory-browser",children:[o.jsxs("div",{className:"sandbox-directory-head",children:[o.jsx("span",{title:d==null?void 0:d.path,children:(d==null?void 0:d.path)??c}),h?o.jsx(Ho,{className:"spin"}):null]}),o.jsxs("div",{className:"sandbox-directory-list",children:[d!=null&&d.parent?o.jsxs("button",{type:"button",disabled:h,onClick:()=>void v(d.parent??"/"),children:[o.jsx(Jb,{}),o.jsx("span",{children:"上一级"}),o.jsx("small",{children:d.parent}),o.jsx(BN,{})]}):null,d==null?void 0:d.directories.map(y=>o.jsxs("button",{type:"button",disabled:h,onClick:()=>void v(y.path),children:[o.jsx(Jb,{}),o.jsx("span",{children:y.name}),o.jsx(BN,{})]},y.path)),!h&&(d==null?void 0:d.directories.length)===0?o.jsx("div",{className:"sandbox-directory-empty",children:"当前目录没有子目录"}):null]})]}),n?o.jsx("div",{className:"sandbox-control-note",children:"当前对话已经开始,工作空间已锁定。新建 Sandbox 会话后可重新选择。"}):null,m||i?o.jsx("div",{className:"sandbox-control-error",children:m||i}):null]}),o.jsxs("footer",{className:"sandbox-control-actions",children:[o.jsx("button",{type:"button",onClick:l,disabled:s,children:"取消"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:s||n||!c.startsWith("/"),onClick:()=>a(c),children:[s?o.jsx(Ho,{className:"spin"}):null,"使用此目录"]})]})]})}function QRe({approval:e,busy:t,error:n,onDecision:s}){var a;const i=(a=e==null?void 0:e.command)==null?void 0:a.trim(),r=(e==null?void 0:e.changes)===void 0?"":JSON.stringify(e.changes,null,2);return o.jsxs(Fg,{open:e!==null,title:(e==null?void 0:e.kind)==="file"?"允许修改文件?":"允许执行命令?",subtitle:"Codex 正在等待你的决定",icon:o.jsx($2,{}),className:"sandbox-approval-dialog",onClose:()=>{t||s("cancel")},children:[o.jsxs("div",{className:"sandbox-control-body",children:[e!=null&&e.reason?o.jsx("div",{className:"sandbox-approval-reason",children:e.reason}):null,i?o.jsx("pre",{children:i}):null,r?o.jsx("pre",{children:r}):null,e!=null&&e.cwd?o.jsxs("div",{className:"sandbox-approval-meta",children:["执行目录 ",o.jsx("code",{children:e.cwd})]}):null,n?o.jsx("div",{className:"sandbox-control-error",children:n}):null]}),o.jsxs("footer",{className:"sandbox-control-actions sandbox-approval-actions",children:[o.jsx("button",{type:"button",disabled:t,onClick:()=>s("decline"),children:"拒绝"}),o.jsx("button",{type:"button",disabled:t,onClick:()=>s("accept"),children:"仅本次允许"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:t,onClick:()=>s("acceptForSession"),children:[t?o.jsx(Ho,{className:"spin"}):null,"本会话允许"]})]})]})}const ZRe={codex:"Codex",openclaw:"OpenClaw",hermes:"Hermes"};function bD(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(t)}function JRe({session:e,onBack:t,onOpen:n,onDelete:s}){const[i,r]=g.useState(!1),[a,l]=g.useState(!1),[c,u]=g.useState(!1),[d,f]=g.useState(""),h=ZRe[e.toolName],p=async()=>{if(!(a||c)){l(!0),f("");try{await n()}catch(b){f(b instanceof Error?b.message:String(b))}finally{l(!1)}}},m=async()=>{if(!(c||a)){u(!0),f("");try{await s()}catch(b){f(b instanceof Error?b.message:String(b)),r(!1)}finally{u(!1)}}};return o.jsxs("section",{className:"sandbox-agent-details",children:[o.jsxs("header",{className:"sandbox-agent-details-header",children:[o.jsxs("button",{type:"button",className:"sandbox-agent-back",onClick:t,children:[o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m14.5 6-6 6 6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})}),"返回智能体"]}),o.jsxs("div",{children:[o.jsx("h1",{children:e.displayName||`${h} 智能体`}),o.jsxs("p",{children:[h," AgentKit Session 详情"]})]})]}),d?o.jsx("div",{className:"sandbox-agent-detail-error",role:"alert",children:d}):null,o.jsxs("div",{className:"sandbox-agent-detail-panel",children:[o.jsxs("dl",{children:[o.jsxs("div",{children:[o.jsx("dt",{children:"智能体类型"}),o.jsx("dd",{children:h})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:B1(e.status)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"创建人"}),o.jsx("dd",{children:e.createdBy||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"工具类型"}),o.jsx("dd",{children:e.toolType||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"创建时间"}),o.jsx("dd",{children:bD(e.createdAt)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"过期时间"}),o.jsx("dd",{children:bD(e.expireAt)})]}),o.jsxs("div",{className:"is-wide",children:[o.jsx("dt",{children:"Session ID"}),o.jsx("dd",{children:e.id})]})]}),o.jsxs("footer",{children:[o.jsx("button",{type:"button",className:"sandbox-agent-delete",disabled:a||c,onClick:()=>r(!0),children:"删除智能体"}),o.jsx("button",{type:"button",className:"sandbox-agent-open",disabled:a||c,"aria-busy":a||void 0,onClick:()=>void p(),children:a?"打开中…":"打开智能体"})]})]}),i?o.jsx("div",{className:"confirm-scrim",onClick:()=>!c&&r(!1),children:o.jsxs("div",{className:"confirm-box",role:"alertdialog","aria-modal":"true","aria-labelledby":"sandbox-agent-delete-title",onClick:b=>b.stopPropagation(),children:[o.jsx("div",{className:"confirm-title",id:"sandbox-agent-delete-title",children:"删除智能体?"}),o.jsxs("div",{className:"confirm-text",children:["将删除“",e.displayName||`${h} 智能体`,"”及其 AgentKit Session,此操作无法撤销。"]}),o.jsxs("div",{className:"confirm-actions",children:[o.jsx("button",{type:"button",className:"confirm-btn",disabled:c,onClick:()=>r(!1),children:"取消"}),o.jsx("button",{type:"button",className:"confirm-btn confirm-btn--danger",disabled:c,onClick:()=>void m(),children:c?"删除中…":"确认删除"})]})]})}):null]})}const eOe="_SegmentedControl_1sl7d_1",tOe="_SegmentedControlOption_1sl7d_140",nOe="_SegmentedControlThumb_1sl7d_219",UN={SegmentedControl:eOe,SegmentedControlOption:tOe,SegmentedControlThumb:nOe},ey=({value:e,onChange:t,children:n,block:s,pill:i=!0,size:r="md",gutterSize:a,className:l,onClick:c,...u})=>{const d=g.useRef(null),f=g.useRef(null),h=g.useCallback(m=>{const b=d.current,v=f.current;if(!b||!v)return;const y=b==null?void 0:b.querySelector('[data-state="on"]');if(!y)return;const x=b.clientWidth;let E=Math.floor(y.clientWidth);const w=y.offsetLeft;if(x-(E+w)<2&&(E=E-1),v.style.width=`${Math.floor(E)}px`,v.style.transform=`translateX(${w}px)`,b.scrollWidth>x){const _=x*.15,S=b.scrollLeft,k=y.offsetLeft,T=k+E;(kS+x-_)&&m&&y.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}},[]);zSe({ref:d,onResize:()=>{const m=f.current;if(!m)return;const b=m.style.transition;m.style.transition="",h(!1),m.style.transition=b}}),g.useLayoutEffect(()=>{const m=d.current,b=f.current;!m||!b||(h(!!b.style.transition),b.style.transition||fN(()=>{b.style.transition="width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter)"}))},[h,e,r,a,i]);const p=m=>{m&&t&&t(m)};return o.jsxs(_Ce,{ref:d,className:la(UN.SegmentedControl,l),type:"single",value:e,loop:!1,onValueChange:p,onClick:c,"data-block":s?"":void 0,"data-pill":i?"":void 0,"data-size":r,"data-gutter-size":a,...u,children:[o.jsx("div",{className:UN.SegmentedControlThumb,ref:f}),n]})},sOe=({children:e,...t})=>o.jsx(CCe,{className:UN.SegmentedControlOption,...t,onPointerEnter:z$,children:o.jsx("span",{className:"relative",children:e})});ey.Option=sOe;function iOe({workspace:e,onBack:t}){const[n,s]=g.useState("main"),[i,r]=g.useState(""),[a,l]=g.useState(!1),[c,u]=g.useState(""),d=e.kind==="openclaw"?"OpenClaw":"Hermes";g.useEffect(()=>{s("main"),r(""),u(""),l(!1)},[e.session.id]);const f=async()=>{if(s("terminal"),!(i||a)){l(!0),u("");try{const h=await sn.launchAgentTerminal(e.kind,e.session.id);r(h.url)}catch(h){u(h instanceof Error?h.message:String(h))}finally{l(!1)}}};return o.jsxs("section",{className:"sandbox-agent-workspace",children:[o.jsxs("header",{children:[o.jsxs("div",{className:"sandbox-agent-workspace-title",children:[o.jsx("button",{type:"button",onClick:t,"aria-label":"返回智能体列表",children:o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m14.5 6-6 6 6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}),o.jsxs("div",{children:[o.jsx("h1",{children:e.session.displayName||`${d} 智能体`}),o.jsxs("p",{children:[o.jsxs("span",{children:["创建人 ",e.session.createdBy||"未知"]}),o.jsx("span",{className:"sandbox-agent-workspace-status","data-ready":e.session.status.toLowerCase()==="ready"||void 0,children:B1(e.session.status)})]})]})]}),o.jsxs(ey,{className:"sandbox-agent-workspace-tabs",value:n,size:"lg",gutterSize:"lg",block:!0,pill:!1,"aria-label":"智能体工作区",onChange:h=>{h==="terminal"?f():s("main")},children:[o.jsx(ey.Option,{value:"main",children:"主界面"}),o.jsx(ey.Option,{value:"terminal",children:"终端"})]})]}),o.jsx("div",{className:"sandbox-agent-workspace-surface",children:n==="main"?o.jsx("iframe",{src:e.webuiUrl,title:`${d} 主界面`,allow:"clipboard-read; clipboard-write"}):a?o.jsx("div",{className:"sandbox-agent-workspace-state",role:"status",children:"正在打开终端…"}):c?o.jsxs("div",{className:"sandbox-agent-workspace-state is-error",role:"alert",children:[o.jsx("p",{children:c}),o.jsx("button",{type:"button",onClick:()=>void f(),children:"重新尝试"})]}):i?o.jsx("iframe",{src:i,title:`${d} 终端`}):null})]})}const lE=[{name:"model",usage:"/model [model]",description:"显示或切换当前对话模型",keywords:["模型","switch"]},{name:"models",usage:"/models",description:"列出 app-server 可用模型",keywords:["模型列表","list"]},{name:"skill",usage:"/skill",description:"浏览并调用当前工作区可用的 Skill",keywords:["技能","workflow"]},{name:"skills",usage:"/skills",description:"浏览并调用当前工作区可用的 Skills",keywords:["技能列表","workflow","list"]},{name:"new",usage:"/new",description:"开始一个新对话",keywords:["新建","对话"]},{name:"resume",usage:"/resume [thread]",description:"打开历史会话或恢复指定 thread",keywords:["历史","恢复","session"]},{name:"fork",usage:"/fork",description:"从当前上下文分叉一个新对话",keywords:["分叉","branch"]},{name:"compact",usage:"/compact",description:"压缩当前对话上下文",keywords:["压缩","上下文"]},{name:"archive",usage:"/archive",description:"归档当前对话并新建对话",keywords:["归档","关闭"]},{name:"status",usage:"/status",description:"显示当前连接、thread、模型与 token 状态",keywords:["状态","连接","token"]},{name:"clear",usage:"/clear",description:"清空当前视图并开始新对话",keywords:["清空","重置"]},{name:"help",usage:"/help",description:"显示 Sandbox 支持的快捷命令",keywords:["帮助","命令"]}];function rOe(e){var n;const t=e.trim().match(/^\/([^\s]+)(?:\s+([\s\S]*))?$/);if(t)return{name:t[1].toLocaleLowerCase(),argument:((n=t[2])==null?void 0:n.trim())??""}}function aOe(e){const t=e.toLocaleLowerCase();return lE.filter(n=>!t||[n.name,n.description,...n.keywords].some(s=>s.toLocaleLowerCase().includes(t))).sort((n,s)=>yD(n,t)-yD(s,t)).slice(0,12)}function yD(e,t){return t?e.name===t?0:e.name.startsWith(t)?1:e.name.includes(t)?2:3:lE.indexOf(e)}function oOe(e,t){const n=t.toLocaleLowerCase();return e.filter(s=>!n||`${s.id} ${s.displayName} ${s.description}`.toLocaleLowerCase().includes(n)).sort((s,i)=>{if(!n)return Number(i.isDefault)-Number(s.isDefault);const r=s.id.toLocaleLowerCase(),a=i.id.toLocaleLowerCase(),l=(c,u)=>c===n?0:c.startsWith(n)?1:u.toLocaleLowerCase().startsWith(n)?2:3;return l(r,s.displayName)-l(a,i.displayName)}).slice(0,12)}function lOe(){return lE.map(e=>({label:e.usage,value:e.description}))}function cOe(e,t){return e.map(n=>{const s=n.displayName.trim(),i=s&&s!==n.id?`${s} · ${n.id}`:n.id;return{label:n.id===t?"当前模型":"可用模型",value:n.description?`${i} — ${n.description}`:i,code:!1}})}function uOe(e){const t=[{label:"Thread",value:e.threadId,code:!0},{label:"工作空间",value:e.cwd||"未设置",code:!!e.cwd}];return e.model&&t.push({label:"模型",value:e.model,code:!0}),t.push({label:"状态",value:e.busy?"运行中":"空闲"}),e.threadTotal&&t.push({label:"累计 Token",value:e.threadTotal.totalTokens.toLocaleString()}),e.modelContextWindow!==void 0&&t.push({label:"上下文窗口",value:e.modelContextWindow.toLocaleString()}),t}function dOe(e){return e.messages.map(t=>{var s;const n=[];return t.role==="user"&&((s=t.skillNames)!=null&&s.length)&&n.push({kind:"invocation",value:{skills:t.skillNames.map(i=>({name:i,description:""}))}}),t.content&&n.push({kind:"text",text:t.content}),{role:t.role,blocks:n,meta:{localId:t.id,ts:t.timestamp/1e3}}})}function fOe({appName:e,value:t,onChange:n,onSubmit:s,disabled:i,busy:r,attachments:a,onAddFiles:l,onRemoveAttachment:c,actions:u,models:d,modelsLoading:f,modelsLoaded:h,currentModel:p,onRequestModels:m,skills:b,skillsLoading:v,skillsLoaded:y,selectedSkills:x,onRequestSkills:E,onSelectedSkillsChange:w}){const _=g.useRef(null),S=g.useRef(null),k=g.useRef(null),T=g.useRef(null),[C,I]=g.useState(!1),[j,L]=g.useState(0),[z,D]=g.useState(!1);g.useLayoutEffect(()=>{const V=_.current;V&&(V.style.height="auto",V.style.height=`${Math.min(V.scrollHeight,200)}px`)},[t]);const F=g.useMemo(()=>{if(!t.startsWith("/")||t.includes(` -`))return;const V=t.slice(1),W=V.search(/\s/),q=(W<0?V:V.slice(0,W)).toLocaleLowerCase(),ue=W<0?"":V.slice(W).trim();if(!(W>=0&&q!=="model"))return{command:q,argument:ue,modelMode:W>=0}},[t]),A=g.useMemo(()=>{const V=/(^|\s)\$([^\s$]*)$/.exec(t);if(V)return{query:V[2],start:t.length-V[2].length-1,end:t.length}},[t]),O=g.useMemo(()=>{if(A){const V=A.query.toLocaleLowerCase();return b.filter(W=>!x.some(q=>q.id===W.id||q.name===W.name)).filter(W=>`${W.name} ${W.description}`.toLocaleLowerCase().includes(V)).slice(0,12).map(W=>({kind:"skill",skill:W}))}return F!=null&&F.modelMode?oOe(d,F.argument).map(V=>({kind:"model",model:V})):F?aOe(F.command).map(V=>({kind:"command",command:V})):[]},[A,d,x,b,F]),P=!z&&!!(A||F);g.useEffect(()=>{L(0)},[t]),g.useEffect(()=>{F!=null&&F.modelMode&&!h&&!f&&m()},[h,f,m,F==null?void 0:F.modelMode]),g.useEffect(()=>{A&&!y&&!v&&E()},[A,E,y,v]);const $=a.some(V=>V.status!=="ready"),R=!i&&!r&&!$&&(t.trim().length>0||a.length>0);function Y(V){D(!1),I(!1),n(V)}function J(V){if(V.kind==="skill"){if(!A)return;const W=t.slice(0,A.start)+t.slice(A.end);w([...x,V.skill]),Y(W),D(!0),requestAnimationFrame(()=>{var q,ue;(q=_.current)==null||q.focus(),(ue=_.current)==null||ue.setSelectionRange(A.start,A.start)});return}if(V.kind==="model"){Y(`/model ${V.model.id}`),D(!0),requestAnimationFrame(()=>{var W;return(W=_.current)==null?void 0:W.focus()});return}if(V.command.name==="model"){Y("/model "),m(),requestAnimationFrame(()=>{var W;return(W=_.current)==null?void 0:W.focus()});return}if(V.command.name==="skill"||V.command.name==="skills"){Y(`/${V.command.name}`),D(!0),requestAnimationFrame(()=>{var W;return(W=_.current)==null?void 0:W.focus()});return}Y(`/${V.command.name}`),D(!0),requestAnimationFrame(()=>{var W;return(W=_.current)==null?void 0:W.focus()})}function U(V){var W;I(!1),(W=V.current)==null||W.click()}function te(V){const W=V.target.files?Array.from(V.target.files):[];W.length&&l(W),V.target.value=""}const K=A?"可用 Skills":F!=null&&F.modelMode?"选择模型":"Codex 快捷命令";return o.jsxs("div",{className:"composer sandbox-codex-composer",children:[a.length>0?o.jsx($1,{appName:e,compact:!0,items:a,onRemove:c}):null,o.jsxs("div",{className:"composer-box",children:[P?o.jsxs("div",{className:"composer-command-menu",role:"listbox","aria-label":K,children:[o.jsxs("div",{className:"composer-command-head",children:[o.jsx($Re,{}),o.jsx("span",{children:K}),F!=null&&F.modelMode&&p?o.jsxs("small",{children:["当前:",p]}):null,o.jsx("kbd",{children:A?"$":"/"})]}),A&&v?o.jsxs("div",{className:"composer-command-empty",children:[o.jsx(Ho,{className:"spin"})," 正在发现当前工作区的 Skills…"]}):F!=null&&F.modelMode&&f?o.jsxs("div",{className:"composer-command-empty",children:[o.jsx(Ho,{className:"spin"})," 正在读取模型…"]}):O.length===0?o.jsx("div",{className:"composer-command-empty",children:A?"当前工作区没有匹配的 Skill":F!=null&&F.modelMode?"没有匹配模型,也可以直接输入模型 ID":"没有匹配的快捷命令"}):o.jsx("div",{className:"composer-command-list",children:O.map((V,W)=>{const q=V.kind==="command"?`command:${V.command.name}`:V.kind==="model"?`model:${V.model.id}`:`skill:${V.skill.id}`,ue=V.kind==="command"?V.command.usage:V.kind==="model"?V.model.displayName:`$${V.skill.name}`,me=V.kind==="command"?V.command.description:V.kind==="model"?V.model.description||V.model.id:V.skill.description||"加载并执行该 Skill";return o.jsxs("button",{type:"button",role:"option","aria-selected":W===j,className:`composer-command-item${W===j?" is-active":""}`,onMouseDown:Se=>{Se.preventDefault(),J(V)},onMouseEnter:()=>L(W),children:[o.jsx("span",{className:`composer-command-icon composer-command-icon--${V.kind}`,"aria-hidden":"true",children:V.kind==="command"?"/":V.kind==="model"?"◇":"$"}),o.jsxs("span",{className:"composer-command-copy",children:[o.jsx("strong",{children:ue}),o.jsx("span",{children:me})]}),W===j?o.jsx("kbd",{children:"↵"}):null]},q)})})]}):null,o.jsxs("div",{className:"composer-left-controls",children:[o.jsxs("div",{className:"composer-menu-wrap",children:[o.jsx("button",{type:"button",className:"comp-icon",title:"添加","aria-label":"添加",disabled:i,onClick:()=>I(V=>!V),children:o.jsx(DRe,{className:"icon"})}),C?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>I(!1)}),o.jsxs("div",{className:"composer-menu",role:"menu",children:[o.jsxs("button",{type:"button",className:"menu-item",disabled:u.uploadBusy,onClick:()=>U(S),children:[o.jsx(BRe,{className:"icon"}),"上传图片"]}),o.jsxs("button",{type:"button",className:"menu-item",disabled:u.uploadBusy,onClick:()=>U(k),children:[o.jsx(URe,{className:"icon"}),"上传文档或 PDF"]}),o.jsxs("button",{type:"button",className:"menu-item",disabled:u.uploadBusy,onClick:()=>U(T),children:[o.jsx(FRe,{className:"icon"}),"上传视频"]}),o.jsx("div",{className:"composer-menu-separator",role:"separator"}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>{I(!1),u.onOpenTerminal()},children:[o.jsx(GV,{className:"icon"}),"进入终端"]}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>{I(!1),u.onOpenBrowser()},children:[o.jsx(KV,{className:"icon"}),"查看浏览器"]})]})]}):null]}),o.jsx("button",{type:"button",className:"comp-icon sandbox-composer-control",title:"Codex 权限","aria-label":"Codex 权限",disabled:u.settingsBusy||r,onClick:u.onOpenPermissions,children:o.jsx($2,{})}),o.jsx("button",{type:"button",className:`comp-icon sandbox-composer-control${u.workspaceLocked?" is-locked":""}`,title:u.workspaceLocked?"对话已开始,工作空间已锁定":"选择工作空间","aria-label":"Codex 工作空间",disabled:u.settingsBusy||r,onClick:u.onOpenWorkspace,children:o.jsx(Jb,{})})]}),o.jsxs("div",{className:"composer-input-stack sandbox-composer-input",children:[x.length>0?o.jsx(F1,{skillPrefix:"$",value:{skills:x.map(({name:V,description:W})=>({name:V,description:W}))},onRemoveSkill:V=>w(x.filter(W=>W.name!==V))}):null,o.jsx("textarea",{ref:_,className:"comp-input scroll",rows:1,value:t,disabled:i,placeholder:"向 AgentKit 沙箱发送消息,输入 / 查看命令,输入 $ 调用 Skill…","aria-expanded":P,onChange:V=>Y(V.target.value),onBlur:()=>window.setTimeout(()=>D(!0),0),onKeyDown:V=>{if(!n2(V.nativeEvent)){if(P){if((V.key==="ArrowDown"||V.key==="Tab"&&!V.shiftKey)&&O.length>0){V.preventDefault(),L(W=>(W+1)%O.length);return}if((V.key==="ArrowUp"||V.key==="Tab"&&V.shiftKey)&&O.length>0){V.preventDefault(),L(W=>(W-1+O.length)%O.length);return}if(V.key==="Enter"&&!V.shiftKey&&O[j]){V.preventDefault(),J(O[j]);return}if(V.key==="Escape"){V.preventDefault(),D(!0);return}}if(V.key==="Backspace"&&!t&&V.currentTarget.selectionStart===0&&x.length>0){V.preventDefault(),w(x.slice(0,-1));return}V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),R&&s(t))}}})]}),o.jsx("button",{type:"button",className:"comp-send",disabled:!R,onClick:()=>s(t),"aria-label":"发送",children:r?o.jsx(Ho,{className:"icon spin"}):o.jsx(PRe,{className:"icon"})})]}),o.jsx("input",{ref:S,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:te}),o.jsx("input",{ref:k,type:"file",accept:".txt,.md,.markdown,.pdf,text/plain,text/markdown,application/pdf",multiple:!0,hidden:!0,onChange:te}),o.jsx("input",{ref:T,type:"file",accept:"video/mp4,video/webm,video/quicktime",multiple:!0,hidden:!0,onChange:te})]})}function hOe({session:e,conversationBusy:t,onInputChange:n,onSessionPatch:s,onSnapshot:i,onActivity:r,onError:a}){const l=g.useRef((e==null?void 0:e.id)??"");l.current=(e==null?void 0:e.id)??"";const[c,u]=g.useState(!1),[d,f]=g.useState([]),[h,p]=g.useState(!1),[m,b]=g.useState(!1),[v,y]=g.useState([]),[x,E]=g.useState(!1),[w,_]=g.useState(!1),[S,k]=g.useState([]),[T,C]=g.useState(!1),[I,j]=g.useState([]),[L,z]=g.useState(!1),[D,F]=g.useState("");g.useEffect(()=>{u(!1),f([]),p(!1),b(!1),y([]),E(!1),_(!1),k([]),C(!1),j([]),z(!1),F("")},[e==null?void 0:e.id]);const A=g.useCallback(async()=>{const U=l.current;if(!U)return[];p(!0);try{const te=await sn.listModels(U);return l.current===U&&(f(te),b(!0)),te}catch(te){return l.current===U&&(b(!0),a(te instanceof Error?te.message:String(te))),[]}finally{l.current===U&&p(!1)}},[a]),O=g.useCallback(async()=>{const U=l.current;if(!U)return[];E(!0);try{const te=await sn.listSkills(U);return l.current===U&&(y(te),_(!0)),te}catch(te){return l.current===U&&(_(!0),a(te instanceof Error?te.message:String(te))),[]}finally{l.current===U&&E(!1)}},[a]),P=g.useCallback(async()=>{const U=l.current;if(U){C(!0),z(!0),F("");try{const te=await sn.listThreads(U);l.current===U&&j(te.threads)}catch(te){l.current===U&&F(te instanceof Error?te.message:String(te))}finally{l.current===U&&z(!1)}}},[]);function $(U){i(U),k([]),y([]),_(!1),C(!1)}async function R(U){const te=l.current;if(!(!te||c||t)){if(U===(e==null?void 0:e.threadId)){C(!1);return}u(!0),a("");try{const K=await sn.resumeThread(te,U);if(l.current!==te)return;$(K),r("已恢复 Codex 对话",[{label:"Thread",value:K.threadId,code:!0}])}catch(K){l.current===te&&a(K instanceof Error?K.message:String(K))}finally{l.current===te&&u(!1)}}}async function Y(U){const te=e,K=U.trim();if(!K.startsWith("/"))return!1;if(!te||t||c)return!0;const V=rOe(K),W=V&&lE.find(q=>q.name===V.name);if(!V||!W)return a(`未知快捷命令:${K.split(/\s/,1)[0]}。输入 /help 查看可用命令。`),!0;if(a(""),k([]),W.name==="model"&&!V.argument)return n("/model "),m||await A(),!0;if(W.name==="skill"||W.name==="skills")return n("$"),w||(await O()).length===0&&n(""),!0;if(W.name==="resume"&&!V.argument)return n(""),await P(),!0;n(""),u(!0);try{if(W.name==="model"){const q=await sn.setModel(te.id,V.argument);if(l.current!==te.id)return!0;s({model:q}),r("已切换 Codex 模型",[{label:"模型",value:q,code:!0}])}else if(W.name==="models"){const q=m?d:await A();if(l.current!==te.id)return!0;r(q.length>0?"Codex 可用模型":"当前没有可用模型",cOe(q,te.model))}else if(W.name==="new"||W.name==="clear"){const q=await sn.newThread(te.id);if(l.current!==te.id)return!0;$(q),r("已新建 Codex 对话",[{label:"Thread",value:q.threadId,code:!0}])}else if(W.name==="resume"){const q=await sn.resumeThread(te.id,V.argument);if(l.current!==te.id)return!0;$(q),r("已恢复 Codex 对话",[{label:"Thread",value:q.threadId,code:!0}])}else if(W.name==="fork"){const q=await sn.forkThread(te.id);if(l.current!==te.id)return!0;$(q),r("已分叉 Codex 对话",[{label:"Thread",value:q.threadId,code:!0}])}else if(W.name==="compact"){if(await sn.compactThread(te.id),l.current!==te.id)return!0;r("已开始压缩当前 Codex 对话",[{label:"Thread",value:te.threadId,code:!0}])}else if(W.name==="archive"){const q=te.threadId,ue=await sn.archiveThread(te.id,q);if(l.current!==te.id)return!0;ue.snapshot&&$(ue.snapshot),r("已归档 Codex 对话",[{label:"Thread",value:q,code:!0}])}else if(W.name==="status"){const q=await sn.getStatus(te.id);if(l.current!==te.id)return!0;s(q),r("Codex 当前状态",uOe(q))}else W.name==="help"&&r("Sandbox 支持的 Codex 快捷命令",lOe())}catch(q){l.current===te.id&&(n(K),a(q instanceof Error?q.message:String(q)))}finally{l.current===te.id&&u(!1)}return!0}function J(){y([]),_(!1),k([])}return{commandBusy:c,models:d,modelsLoading:h,modelsLoaded:m,loadModels:A,skills:v,skillsLoading:x,skillsLoaded:w,loadSkills:O,selectedSkills:S,setSelectedSkills:k,invalidateSkills:J,threadsOpen:T,threads:I,threadsLoading:L,threadsError:D,openThreads:P,closeThreads:()=>{c||(C(!1),F(""))},resumeThread:R,executeSlash:Y}}function pOe(e){return e.toLowerCase()==="github"?o.jsx(oee,{className:"icon"}):o.jsx(fee,{className:"icon"})}function mOe({branding:e,onUsername:t}){const[n,s]=g.useState(null),[i,r]=g.useState(""),[a,l]=g.useState(0),[c,u]=g.useState(""),d=g.useRef(null);g.useEffect(()=>{let m=!0;return s(null),r(""),vB().then(b=>{m&&s(b)}).catch(b=>{m&&r(b instanceof Error?b.message:String(b))}),()=>{m=!1}},[a]);const f=n!==null&&n.length===0;g.useEffect(()=>{var m;f&&((m=d.current)==null||m.focus())},[f]);const h=Dee.test(c),p=()=>{h&&t(c)};return o.jsxs("div",{className:"login",children:[o.jsx("header",{className:"login-top",children:o.jsxs("span",{className:"login-brand",children:[o.jsx("img",{className:"login-brand-logo",src:e.logoUrl||zk,width:20,height:20,alt:"","aria-hidden":!0}),e.title]})}),o.jsx("main",{className:"login-main",children:o.jsxs("div",{className:"login-card",children:[o.jsx(ka,{as:"h1",className:"login-title",duration:4.8,spread:22,children:e.title}),i?o.jsxs("div",{className:"login-provider-error",role:"alert",children:[o.jsx("p",{children:i}),o.jsx("button",{type:"button",onClick:()=>l(m=>m+1),children:"重试"})]}):n===null?null:n.length>0?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"login-sub",children:"登录以继续使用"}),o.jsx("div",{className:"login-providers",children:n.map(m=>o.jsxs("button",{className:"login-btn",onClick:()=>Bee(m.loginUrl),children:[pOe(m.id),o.jsxs("span",{children:["使用 ",m.label," 登录"]})]},m.id))})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"login-sub",children:"输入一个用户名即可开始"}),o.jsxs("form",{className:"login-name",onSubmit:m=>{m.preventDefault(),p()},children:[o.jsx("input",{ref:d,className:"login-name-input",value:c,onChange:m=>u(m.target.value),placeholder:"用户名(字母 + 数字,最多 16 位)",maxLength:16}),o.jsx("button",{type:"submit",className:"login-name-go",disabled:!h,"aria-label":"进入",children:o.jsx(Pp,{className:"icon"})})]}),o.jsx("p",{className:"login-hint","aria-live":"polite",children:c&&!h?"只能包含大小写字母和数字,最多 16 位。":""})]}),o.jsx("p",{className:"login-powered",children:"火山引擎 AgentKit 提供企业级 Agent 解决方案"}),o.jsxs("p",{className:"login-legal",children:["继续即表示你已阅读并同意 AgentKit"," ",o.jsx("a",{href:"https://docs.volcengine.com/docs/86681/1925174?lang=zh",target:"_blank",rel:"noreferrer",children:"产品和服务条款"})]})]})}),o.jsx("footer",{className:"login-footer",children:"© 2026 VeADK. All rights reserved."})]})}function gOe({open:e,checking:t,error:n,onLogin:s}){const i=g.useRef(null);return g.useEffect(()=>{var a;if(!e)return;const r=document.body.style.overflow;return document.body.style.overflow="hidden",(a=i.current)==null||a.focus(),()=>{document.body.style.overflow=r}},[e]),e?hi.createPortal(o.jsx("div",{className:"auth-expired-backdrop",children:o.jsxs("section",{className:"auth-expired-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"auth-expired-title","aria-describedby":"auth-expired-description",children:[o.jsx("div",{className:"auth-expired-mark","aria-hidden":"true",children:o.jsx(Sk,{})}),o.jsxs("div",{className:"auth-expired-copy",children:[o.jsx("h2",{id:"auth-expired-title",children:"登录状态已过期"}),o.jsx("p",{id:"auth-expired-description",children:"当前编辑内容会保留。重新登录后,刚才的操作将自动继续。"}),n&&o.jsx("p",{className:"auth-expired-error",role:"alert",children:n})]}),o.jsx("footer",{className:"auth-expired-actions",children:o.jsx("button",{ref:i,type:"button",onClick:s,disabled:t,children:t?"等待登录完成…":"重新登录"})})]})}),document.body):null}const bOe=[{value:"slow",label:"执行速度慢"},{value:"crash",label:"运行崩溃"},{value:"incorrect",label:"结果不准确"},{value:"tool_error",label:"工具调用失败"},{value:"other",label:"其他问题"}];function yOe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"m7 7 10 10"}),o.jsx("path",{d:"m17 7-10 10"})]})}function xOe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5 12.5 4.2 4.2L19 7"})})}function EOe({onClose:e,onSubmit:t}){const n=g.useId(),s=g.useId(),i=g.useRef(null),r=g.useRef(null),a=g.useRef(!1),l=g.useRef(e),[c,u]=g.useState(()=>new Set),[d,f]=g.useState(""),[h,p]=g.useState(!1),[m,b]=g.useState(""),[v,y]=g.useState(!1);a.current=h,l.current=e,g.useEffect(()=>{var T;const _=document.body.style.overflow,S=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(T=r.current)==null||T.focus();const k=C=>{var z;if(C.key==="Escape"&&!a.current){C.preventDefault(),l.current();return}if(C.key!=="Tab")return;const I=Array.from(((z=i.current)==null?void 0:z.querySelectorAll("button:not(:disabled), textarea:not(:disabled)"))??[]);if(I.length===0)return;const j=I[0],L=I[I.length-1];C.shiftKey&&document.activeElement===j?(C.preventDefault(),L.focus()):!C.shiftKey&&document.activeElement===L&&(C.preventDefault(),j.focus())};return window.addEventListener("keydown",k),()=>{document.body.style.overflow=_,window.removeEventListener("keydown",k),S!=null&&S.isConnected&&S.focus()}},[]);const x=_=>{u(S=>{const k=new Set(S);return k.has(_)?k.delete(_):k.add(_),k})},E=async()=>{if(!(h||v)){p(!0),b("");try{await t({issues:[...c],description:d.trim()}),y(!0)}catch(_){b(_ instanceof Error?_.message:String(_))}finally{p(!1)}}},w=c.size>0||d.trim().length>0;return hi.createPortal(o.jsx("div",{className:"issue-feedback-backdrop",onMouseDown:_=>{_.target===_.currentTarget&&!h&&e()},children:o.jsxs("section",{ref:i,className:"issue-feedback-dialog",role:"dialog","aria-modal":"true","aria-labelledby":n,"aria-describedby":v?`${s}-success`:s,"aria-busy":h||void 0,children:[o.jsxs("header",{className:"issue-feedback-head",children:[o.jsx("h2",{id:n,children:"问题反馈"}),o.jsx("button",{type:"button",className:"issue-feedback-close",onClick:e,disabled:h,"aria-label":"关闭问题反馈",children:o.jsx(yOe,{})})]}),v?o.jsxs("div",{className:"issue-feedback-success",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"issue-feedback-success-mark","aria-hidden":"true",children:o.jsx(xOe,{})}),o.jsxs("div",{children:[o.jsx("h3",{children:"上报成功,感谢您的反馈"}),o.jsx("p",{id:`${s}-success`,children:"AgentKit 团队会尽快查看您提交的问题。"})]})]}):o.jsxs("div",{className:"issue-feedback-body",children:[o.jsx("p",{id:s,className:"issue-feedback-intro",children:"请选择遇到的问题,也可以补充具体表现。"}),o.jsx("p",{className:"issue-feedback-privacy",role:"alert",children:"您的对话数据将会上报到 AgentKit 团队,请注意隐私保护。"}),o.jsx("div",{className:"issue-feedback-chips","aria-label":"常见问题",children:bOe.map(_=>o.jsx("button",{type:"button",className:"issue-feedback-chip","aria-pressed":c.has(_.value),onClick:()=>x(_.value),disabled:h,children:_.label},_.value))}),o.jsxs("label",{className:"issue-feedback-field",children:[o.jsx("span",{children:"问题描述"}),o.jsx("textarea",{ref:r,value:d,onChange:_=>f(_.target.value),placeholder:"请描述问题发生时的表现(选填)",maxLength:4e3,rows:5,disabled:h})]}),m&&o.jsx("p",{className:"issue-feedback-error",role:"alert",children:m})]}),o.jsx("footer",{className:"issue-feedback-actions",children:v?o.jsx("button",{type:"button",className:"is-primary",onClick:e,children:"完成"}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",onClick:e,disabled:h,children:"取消"}),o.jsx("button",{type:"button",className:"is-primary",onClick:()=>void E(),disabled:!w||h,children:h?"正在上报…":"提交反馈"})]})})]})}),document.body)}const vOe=[{value:"conversation",label:"对话"},{value:"agents",label:"智能体"},{value:"applications",label:"自动化"},{value:"search",label:"搜索"},{value:"other",label:"其他"}],wOe=[{value:"page_slow",label:"页面加载慢"},{value:"feature_unavailable",label:"功能无法使用"},{value:"display_error",label:"页面显示异常"},{value:"no_response",label:"操作无响应"},{value:"other",label:"其他问题"}],SOe=["点击后没有反应","页面一直处于加载状态","部分内容显示不完整","操作后出现错误提示"];function _Oe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5 12.5 4.2 4.2L19 7"})})}function NOe({initialModule:e,onSubmit:t}){const n=g.useRef(null),[s,i]=g.useState(()=>new Set),[r,a]=g.useState(e),[l,c]=g.useState(""),[u,d]=g.useState(!1),[f,h]=g.useState(""),[p,m]=g.useState(!1),b=E=>{i(w=>{const _=new Set(w);return _.has(E)?_.delete(E):_.add(E),_})},v=E=>{var w;c(_=>_.trim()?_.includes(E)?_:`${_.trimEnd()} -${E}`:E),(w=n.current)==null||w.focus()},y=async E=>{if(E.preventDefault(),!(u||p)){d(!0),h("");try{await t({module:r,issues:[...s],description:l.trim()}),m(!0)}catch(w){h(w instanceof Error?w.message:String(w))}finally{d(!1)}}},x=s.size>0||l.trim().length>0;return o.jsxs("div",{className:"platform-feedback-page",children:[o.jsxs("header",{className:"platform-feedback-header",children:[o.jsx("h1",{children:"问题反馈"}),o.jsx("p",{children:"告诉我们您在使用 AgentKit Studio 时遇到的问题。"})]}),o.jsx("div",{className:"platform-feedback-scroll",children:p?o.jsxs("section",{className:"platform-feedback-success","aria-labelledby":"feedback-success-title","aria-live":"polite",role:"status",children:[o.jsx("span",{className:"platform-feedback-success-icon","aria-hidden":"true",children:o.jsx(_Oe,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:"feedback-success-title",children:"上报成功,感谢您的反馈"}),o.jsx("p",{children:"AgentKit 团队会尽快查看您提交的问题。"})]})]}):o.jsxs("form",{className:"platform-feedback-form",onSubmit:E=>void y(E),children:[o.jsxs("section",{className:"platform-feedback-section",children:[o.jsx("div",{className:"platform-feedback-section-heading",children:o.jsx("h2",{children:"所属模块"})}),o.jsx("div",{className:"platform-feedback-pills","aria-label":"所属模块",children:vOe.map(E=>o.jsx("button",{type:"button","aria-pressed":r===E.value,onClick:()=>a(E.value),disabled:u,children:E.label},E.value))})]}),o.jsx("section",{className:"platform-feedback-section",children:o.jsxs("div",{className:"platform-feedback-suggestions",children:[o.jsx("span",{children:"常见问题(可多选)"}),o.jsx("div",{className:"platform-feedback-pills","aria-label":"问题类型",children:wOe.map(E=>o.jsx("button",{type:"button","aria-pressed":s.has(E.value),onClick:()=>b(E.value),disabled:u,children:E.label},E.value))})]})}),o.jsxs("section",{className:"platform-feedback-section",children:[o.jsxs("label",{className:"platform-feedback-field",children:[o.jsx("span",{children:"问题描述"}),o.jsx("textarea",{ref:n,value:l,onChange:E=>c(E.target.value),placeholder:"请描述问题发生时的页面、操作和表现",maxLength:4e3,rows:6,disabled:u})]}),o.jsxs("div",{className:"platform-feedback-suggestions",children:[o.jsx("span",{children:"快捷补充"}),o.jsx("div",{className:"platform-feedback-pills","aria-label":"问题描述推荐",children:SOe.map(E=>o.jsx("button",{type:"button",onClick:()=>v(E),disabled:u,children:E},E))})]})]}),o.jsx("p",{className:"platform-feedback-privacy",role:"alert",children:"您的数据将会上报到 AgentKit 团队,请注意隐私保护。"}),f&&o.jsx("p",{className:"platform-feedback-error",role:"alert",children:f}),o.jsx("div",{className:"platform-feedback-actions",children:o.jsx("button",{type:"submit",disabled:!x||u,children:u?"正在上报…":"提交反馈"})})]})})]})}function TOe({node:e,ctx:t}){const n=e.variant??"default";return o.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)})}Cu("Button",TOe);function kOe({node:e,ctx:t}){return o.jsx("div",{className:"a2ui-card","data-a2ui-id":e.id,"data-a2ui-component":e.component,children:t.render(e.child)})}Cu("Card",kOe);const AOe={start:"flex-start",center:"center",end:"flex-end",spaceBetween:"space-between",spaceAround:"space-around",spaceEvenly:"space-evenly",stretch:"stretch"},COe={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"};function qV(e){return AOe[e]??"flex-start"}function YV(e){return COe[e]??"stretch"}function IOe({node:e,ctx:t}){const n=e.children??[];return o.jsx("div",{className:"a2ui-column","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"column",justifyContent:qV(e.justify),alignItems:YV(e.align)},children:n.map(s=>t.render(s))})}Cu("Column",IOe);function jOe({node:e}){const t=e.axis==="vertical";return o.jsx("div",{className:`a2ui-divider ${t?"a2ui-divider--v":"a2ui-divider--h"}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component})}Cu("Divider",jOe);const ROe={send:"✈️",check:"✅",close:"✖️",star:"⭐",favorite:"❤️",info:"ℹ️",help:"❓",error:"⛔",calendarToday:"📅",event:"📅",schedule:"🕒",locationOn:"📍",accountCircle:"👤",mail:"✉️",call:"📞",home:"🏠",settings:"⚙️",search:"🔍"};function OOe({node:e}){const t=e.name??"";return o.jsx("span",{className:"a2ui-icon",title:t,"aria-label":t,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:ROe[t]??"•"})}Cu("Icon",OOe);function MOe({node:e,ctx:t}){const n=e.children??[];return o.jsx("div",{className:"a2ui-row","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"row",justifyContent:qV(e.justify),alignItems:YV(e.align??"center")},children:n.map(s=>t.render(s))})}Cu("Row",MOe);const LOe=new Set(["h1","h2","h3","h4","h5"]);function DOe({node:e,ctx:t}){const n=e.variant??"body",s=t.resolveString(e.text),i=LOe.has(n)?n:"p";return o.jsx(i,{className:`a2ui-text a2ui-text--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:s})}Cu("Text",DOe);function POe(e){return e==="agents"?"agents":e==="applications"?"applications":e==="search"?"search":["conversation","new-chat","sandbox"].includes(e)?"conversation":"other"}async function Yw(e){const[t,n,s]=await Promise.allSettled([ARe(),CRe(),Uk(e)]);return{agentId:e,ready:!0,harnessEnabled:s.status==="fulfilled",builtinTools:s.status==="fulfilled"?s.value:[],temporaryEnabled:t.status==="fulfilled"&&t.value.enabled,skillCreateEnabled:n.status==="fulfilled"&&n.value.enabled}}const ma={app:"veadk.appName",view:"veadk.view",session:"veadk.sessionId"},BOe=600,UOe=1e3,FOe=5e3,$Oe=500,HOe=new Set,zOe=[];function Va(){return{skills:[]}}function Ww(e){return`${rE(e)}.active`}function FN(e){return`veadk.agentOrder.${encodeURIComponent(e)}`}function VOe(e){if(!e)return[];try{const t=JSON.parse(localStorage.getItem(FN(e))||"[]");return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function $N(e,t){if(e.name===t||e.id===t)return e;for(const n of e.children){const s=$N(n,t);if(s)return s}}function WV(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(...WV(n)));return t}function xD(){const e=typeof localStorage<"u"?localStorage.getItem(ma.view):null;return e==="menu"||e==="intelligent"||e==="custom"||e==="template"||e==="workflow"?e:null}function GOe({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"3.75",y:"3.75",width:"16.5",height:"16.5",rx:"3.25"}),o.jsx("path",{d:"M12 8.5v7M8.5 12h7"}),o.jsx("path",{d:"M6.75 6.75h1M16.25 17.25h1",opacity:"0.6"})]})}function KOe({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"3.5",y:"5",width:"17",height:"14.75",rx:"2.25"}),o.jsx("path",{d:"M3.5 9h17M9.25 12.25 7.1 14.4l2.15 2.15M14.75 12.25l2.15 2.15-2.15 2.15M12.8 11.85l-1.6 5.1"})]})}function qOe({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"2.75",y:"5",width:"6.5",height:"14",rx:"1.6"}),o.jsx("path",{d:"M5.25 8.5h1.5M5.25 11.5h1.5"}),o.jsx("rect",{x:"14.75",y:"5",width:"6.5",height:"14",rx:"1.6"}),o.jsx("path",{d:"M17.25 15.5h1.5M17.25 12.5h1.5M8.75 12h6.5m-2.5-2.5 2.5 2.5-2.5 2.5"})]})}function YOe(){return o.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":!0,children:[o.jsx("rect",{x:"3",y:"4",width:"14",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none"}),o.jsx("rect",{x:"6",y:"10.4",width:"13",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.7"}),o.jsx("rect",{x:"9",y:"16.8",width:"9",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.45"})]})}function HN(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 WOe(e){if(!e)return"";const t=[];return e.ts&&t.push(HN(e.ts)),e.tokens!=null&&t.push(`${e.tokens.toLocaleString()} tokens`),t.join(" · ")}function Rc(e){return e.blocks.map(t=>t.kind==="text"?t.text:"").join("").trim()}function ED(e,t){for(let n=t-1;n>=0;n-=1)if(e[n].role==="user")return Rc(e[n]);return""}const XOe="send_a2ui_json_to_client";function QOe(e){return e.blocks.some(t=>t.kind==="text"?t.text.trim().length>0:t.kind==="attachment"||t.kind==="artifact"?t.files.length>0:t.kind==="tool"?!(t.name===XOe&&t.done):t.kind==="agent-transfer"?!1:t.kind==="a2ui"?sH(t.messages).some(n=>n.components[n.rootId]):t.kind==="auth")}function ZOe(e){return e.blocks.some(t=>t.kind==="auth"&&!t.done)}function JOe(e){return new Promise((t,n)=>{let s="";try{s=new URL(e,window.location.href).protocol}catch{}if(s!=="http:"&&s!=="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 r=!1;const a=()=>{clearInterval(u),window.removeEventListener("message",c)},l=d=>{if(!r){r=!0,a();try{i.close()}catch{}t(d)}},c=d=>{if(d.origin!==window.location.origin)return;const f=d.data;f&&f.veadkOAuth&&typeof f.url=="string"&&l(f.url)};window.addEventListener("message",c);const u=setInterval(()=>{if(!r){if(i.closed){a();const d=window.prompt("授权完成后,请粘贴回调页面(浏览器地址栏)的完整 URL:");d&&d.trim()?(r=!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)&&l(d)}catch{}}},500)})}function eMe(e,t){const n=JSON.parse(JSON.stringify(e??{})),s=n.exchangedAuthCredential??n.exchanged_auth_credential??{},i=s.oauth2??{};return i.authResponseUri=t,i.auth_response_uri=t,s.oauth2=i,n.exchangedAuthCredential=s,n}function vD({text:e}){const[t,n]=g.useState(!1);return o.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?o.jsx(Ra,{className:"icon"}):o.jsx(Zx,{className:"icon"})})}const wD=["今天想做点什么?","有什么可以帮你的?","需要我帮你查点什么吗?","有问题尽管问我","嗨,我们开始吧","开始一段新对话吧","今天想先解决哪件事?","把你的想法告诉我吧","我们从哪里开始?","有什么任务交给我?","准备好一起推进了吗?","说说你现在最关心的问题","今天也一起把事情做好","我在,随时可以开始"],SD=()=>wD[Math.floor(Math.random()*wD.length)];function wo(e){var t;for(const n of e)(t=n.previewUrl)!=null&&t.startsWith("blob:")&&URL.revokeObjectURL(n.previewUrl)}function _D(){return`draft-${Date.now()}-${Math.random().toString(36).slice(2)}`}function ND(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"}const tMe={"read-only":"只读","workspace-write":"工作区写入","danger-full-access":"完全访问"},nMe={untrusted:"仅不可信命令","on-request":"按需审批",never:"不审批"},sMe={user:"由我审批",auto_review:"自动审查"};function iMe(e,t){const n=e.kind==="file"?"文件修改":"命令执行";return t==="accept"?`已允许本次${n}`:t==="acceptForSession"?`已在本会话中允许${n}`:t==="decline"?`已拒绝${n}`:`已取消${n}审批`}function rMe(e){var n,s,i;const t=[];return(n=e.command)!=null&&n.trim()&&t.push({label:"命令",value:e.command.trim(),code:!0}),(s=e.grantRoot)!=null&&s.trim()&&t.push({label:"授权路径",value:e.grantRoot.trim(),code:!0}),(i=e.cwd)!=null&&i.trim()&&t.push({label:"执行目录",value:e.cwd.trim(),code:!0}),t}function TD(e){return e.flatMap(t=>t.apps.map(n=>so(t.id,n)))}function aMe(e,t){var n;return((n=e.find(s=>s.runtimeId&&s.apps.some(i=>so(s.id,i)===t)))==null?void 0:n.runtimeId)??""}function oMe(e,t){for(const n of e){const s=n.apps.find(i=>so(n.id,i)===t);if(s&&n.runtimeId)return{runtimeId:n.runtimeId,region:n.region??"cn-beijing",appName:s}}return null}function lMe(){const[e,t]=g.useState([]),[n,s]=g.useState(""),[i,r]=g.useState([]),[a,l]=g.useState(""),c=g.useRef(null),[u,d]=g.useState(!1),[f,h]=g.useState([]),[p,m]=g.useState(null),[b,v]=g.useState([]),[y,x]=g.useState(!1),[E,w]=g.useState(!1),[_,S]=g.useState(""),[k,T]=g.useState(!1),[C,I]=g.useState(!1),[j,L]=g.useState(null),[z,D]=g.useState(null),[F,A]=g.useState(!1),[O,P]=g.useState(""),[$,R]=g.useState(null),[Y,J]=g.useState(!1),[U,te]=g.useState(""),[K,V]=g.useState(!1),[W,q]=g.useState(!1),[ue,me]=g.useState("confirm"),[Se,de]=g.useState(""),[ge,Me]=g.useState("codex"),[ve,re]=g.useState(!1),[ke,we]=g.useState(0),[Je,Le]=g.useState(null),[Ve,_e]=g.useState(null),He=g.useRef(null),Pe=g.useRef(null),qe=g.useRef((p==null?void 0:p.id)??""),Z=g.useRef(""),ae=g.useRef(0);qe.current=(p==null?void 0:p.id)??"";const[ne,be]=g.useState({}),Fe=a?ne[a]??[]:f,Ke=p?b:Fe,bt=(M,B)=>be(Q=>({...Q,[M]:typeof B=="function"?B(Q[M]??[]):B}));function dt(M,B,Q=[],le=""){if(qe.current!==M)return;const xe=crypto.randomUUID(),Ne={role:"system",blocks:[],activity:{id:xe,title:B,...Q.length>0?{details:Q}:{}},meta:{localId:xe,ts:Date.now()/1e3}};v(Ye=>{if(!le)return[...Ye,Ne];const $e=Ye.findIndex(tt=>{var rt;return((rt=tt.meta)==null?void 0:rt.localId)===le});return $e<0?[...Ye,Ne]:[...Ye.slice(0,$e),Ne,...Ye.slice($e)]})}const[cn,Ut]=g.useState(""),[wt,$t]=g.useState("agent"),[Ge,Yt]=g.useState(null),[it,ct]=g.useState({}),Qe=g.useRef(new Map),vt=!n||it.ready===!0&&it.agentId===n,[ye,Ze]=g.useState(null),[xt,rn]=g.useState(!1),Hn=g.useRef(0),[ut,pt]=g.useState([]),[gn,en]=g.useState(Va),[St,an]=g.useState(null),[ls,Rs]=g.useState(0),[Rn,Wn]=g.useState(!1),[bn,yn]=g.useState(null),[Xn,zs]=g.useState(!1),[pi,bs]=g.useState([]),[Js,On]=g.useState(!1),cs=g.useRef(new Set),[Qn,us]=g.useState(()=>new Set),[Os,Ms]=g.useState(()=>new Set),[Ss,_s]=g.useState(()=>new Set),un=g.useRef(new Map),on=g.useRef(new Map),dn=g.useRef(void 0),ce=g.useRef(()=>{}),Ie=(M,B)=>us(Q=>{const le=new Set(Q);return B?le.add(M):le.delete(M),le}),Ue=M=>{const B=on.current.get(M);B!==void 0&&window.clearTimeout(B),on.current.delete(M),Ms(Q=>new Set(Q).add(M))},nt=M=>{const B=on.current.get(M);B!==void 0&&window.clearTimeout(B);const Q=window.setTimeout(()=>{on.current.delete(M),Ms(le=>{const xe=new Set(le);return xe.delete(M),xe})},2400);on.current.set(M,Q)},at=(M,B)=>{_s(Q=>{if(Q.has(M)===B)return Q;const le=new Set(Q);return le.delete(M),le})},We=g.useRef(""),[_t,De]=g.useState(""),[xn,Zn]=g.useState(""),[ki,zn]=g.useState(()=>new Set),[Ht,Nt]=g.useState(null),[En,Vn]=g.useState(null),[Pa,Ba]=g.useState(!1),[Ui,Mr]=g.useState(),[ca,cc]=g.useState(SD),[Mn,uo]=g.useState(null),[uc,ie]=g.useState(!1),[Zt,Ln]=g.useState(!1),[Ns,Wt]=g.useState(""),Jn=g.useRef(!1),[se,Te]=g.useState(null),[pe,et]=g.useState(""),[pn,Gn]=g.useState(),[Tt,ys]=g.useState(null),Ts=(Tt==null?void 0:Tt.capabilities.runtimeScope)??"mine",[tn,ln]=g.useState({newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0}),[ks,Xi]=g.useState("cloud"),[Lr,Ou]=g.useState(Sm),[Mu,$g]=g.useState(""),[dc,mi]=g.useState(!1),[hr,fc]=g.useState(!1),[cE,mh]=g.useState(!1),[gh,Vs]=g.useState({}),[uE,Hg]=g.useState({}),[zg,Dr]=g.useState({}),dE=Qn.has(a),Vg=Os.has(a),hc=dE||u,Gg=!!a&&Xn,fo=p?y:hc,tl=fo||!p&&Vg,Tn=hOe({session:p,conversationBusy:y,onInputChange:Ut,onSessionPatch:M=>{const B=qe.current;m(Q=>(Q==null?void 0:Q.id)===B?{...Q,...M}:Q)},onSnapshot:M=>{const B=qe.current;v(dOe(M)),m(Q=>(Q==null?void 0:Q.id)===B?{...Q,threadId:M.threadId,cwd:M.cwd??Q.cwd,model:M.model??Q.model,workspaceLocked:M.workspaceLocked,permissions:M.permissions,busy:!1}:Q)},onActivity:(M,B=[])=>{const Q=qe.current;Q&&dt(Q,M,B)},onError:De}),nl=gh[a]??"",bh=uE[a]??HOe,Kg=zg[a]??zOe,Fi=St==null?void 0:St.graph,qg=[St==null?void 0:St.name,Fi==null?void 0:Fi.name,Fi==null?void 0:Fi.id].filter(M=>!!M),yh=gn.targetAgent&&Fi?$N(Fi,gn.targetAgent.name):Fi,fE=(yh==null?void 0:yh.skills)??(gn.targetAgent?[]:(St==null?void 0:St.skills)??[]),hE=Fi?WV(Fi):[];function xh(M){wo(M);for(const B of M)B.status==="uploading"?cs.current.add(B.id):B.uri&&Mb(n,B.uri).catch(Q=>De(String(Q)))}function Lu(){Hn.current+=1;const M=ye;Ze(null),rn(!1),M&&!M.id.startsWith("pending-")&&hje(M.id).catch(B=>{De(B instanceof Error?B.message:String(B))})}async function Du(M){try{await m_(n,pe,M),await p_(n,pe,M),r(B=>B.filter(Q=>Q.id!==M)),be(B=>{const{[M]:Q,...le}=B;return le})}catch(B){De(String(B))}}function Yg(M){const B=ut.find(xe=>xe.id===M);if(!B)return;const Q=ut.filter(xe=>xe.id!==M);wo([B]),B.status==="uploading"&&cs.current.add(M),pt(Q),Q.length===0&&!cn.trim()&&!!a&&Ke.length===0?(We.current="",l(""),Du(a)):B.uri&&Mb(n,B.uri).catch(xe=>De(String(xe)))}const Wg=(M,B)=>{var Ne,Ye,$e,tt,rt;const Q=B.author&&B.author!=="user"?B.author:void 0;Q&&(Vs(je=>({...je,[M]:Q})),Hg(je=>({...je,[M]:new Set(je[M]??[]).add(Q)})),Dr(je=>{var lt;return(lt=je[M])!=null&<.length?je:{...je,[M]:[Q]}}));const le=((Ne=B.actions)==null?void 0:Ne.transferToAgent)??((Ye=B.actions)==null?void 0:Ye.transfer_to_agent);le&&Dr(je=>{const lt=je[M]??[];return lt[lt.length-1]===le?je:{...je,[M]:[...lt,le]}}),((($e=B.actions)==null?void 0:$e.endOfAgent)??((tt=B.actions)==null?void 0:tt.end_of_agent)??((rt=B.actions)==null?void 0:rt.escalate))&&Dr(je=>{const lt=je[M]??[];return lt.length<=1?je:{...je,[M]:lt.slice(0,-1)}})},[Ua,Ft]=g.useState(xD),[Xg,Qg]=g.useState([]),[pE,Eh]=g.useState({}),vh=g.useCallback(M=>{Qg(B=>{const Q=B.findIndex(xe=>xe.id===M.id);if(Q===-1)return[M,...B];const le=[...B];return le[Q]={...le[Q],...M},le})},[]),[mE,gE]=g.useState(!0),[wh,ai]=g.useState(!1),[Zg,As]=g.useState(!1),[Sh,Dn]=g.useState(!1),[Jg,ei]=g.useState(null),[Pu,H]=g.useState([]),oe=g.useRef([]),he=g.useRef(null),Ce=g.useRef(null),[st,yt]=g.useState([]),[Mt,gi]=g.useState(""),Lt=g.useRef(null),[Pr,bi]=g.useState(!1),[Bu,vn]=g.useState(!1),[H2,bE]=g.useState(""),[XV,QV]=g.useState("good"),[ZV,e0]=g.useState("basic"),[JV,eG]=g.useState("good"),[_h,t0]=g.useState(""),[tG,nG]=g.useState(null),[sl,xs]=g.useState(!1),[pc,Br]=g.useState(null),yE=g.useRef(null),[Fa,Nh]=g.useState(()=>{const M=Ea();return ah(M),M}),[sG,z2]=g.useState(!1),[iG,V2]=g.useState(""),[G2,n0]=g.useState(null),[rG,K2]=g.useState({}),[aG,q2]=g.useState(()=>new Set),[Uu,ua]=g.useState(null),[s0,xE]=g.useState("cn-beijing"),[Y2,$i]=g.useState(""),[W2,Ai]=g.useState(""),[wn,Qi]=g.useState(null),[oG,EE]=g.useState(!1),i0=g.useRef(!1),Fu=g.useRef(!1),$a=g.useCallback(M=>{if(!pe)return!1;try{rD(localStorage,pe,M)}catch(B){return Zn(B instanceof Error?B.message:"浏览器拒绝保存草稿,请稍后重试。"),!1}return oe.current=M,H(M),Zn(""),!0},[pe]),Ha=g.useCallback(M=>{var B;M&&((B=he.current)==null?void 0:B.id)!==M||(he.current=null,Ce.current!==null&&(window.clearTimeout(Ce.current),Ce.current=null))},[]),$u=g.useCallback(()=>{const M=he.current;M&&(Ha(),$a([M,...oe.current.filter(B=>B.id!==M.id)]))},[Ha,$a]),lG=g.useCallback((M,B,Q)=>{!M||!pe||(he.current&&he.current.id!==M&&$u(),he.current={id:M,draft:B,updatedAt:Date.now(),deploymentTarget:Q},Ce.current!==null&&window.clearTimeout(Ce.current),Ce.current=window.setTimeout($u,BOe))},[$u,pe]),vE=g.useCallback(M=>{!M||!pe||(Ha(M),$a(oe.current.filter(B=>B.id!==M)))},[Ha,$a,pe]),X2=g.useCallback(M=>{if(!pe||M.length===0)return;const B=new Set(M.map(Q=>Q.id));he.current&&B.has(he.current.id)&&Ha(),$a(oe.current.filter(Q=>!B.has(Q.id))),Eh(Q=>Object.fromEntries(Object.entries(Q).filter(([le])=>!B.has(le)))),B.has(Mt)&&(gi(""),ei(null),ua(null),Lt.current=null,localStorage.removeItem(Ww(pe)))},[Ha,$a,Mt,pe]),Q2=g.useCallback(M=>{if(!M||!pe)return;Ha(M);const B=Lt.current,Q=oe.current.filter(le=>le.id!==M);$a((B==null?void 0:B.id)===M?[B,...Q]:Q)},[Ha,$a,pe]);g.useEffect(()=>(window.addEventListener("pagehide",$u),()=>{window.removeEventListener("pagehide",$u)}),[$u]),g.useEffect(()=>{if(!pe){Ha(),oe.current=[],H([]),yt([]),gi(""),Zn(""),Lt.current=null;return}let M=[],B="";try{M=sje(localStorage,pe),localStorage.getItem(rE(pe))!==null&&rD(localStorage,pe,M),B=localStorage.getItem(Ww(pe))||"",Zn("")}catch(le){Zn(le instanceof Error?le.message:"无法读取本机草稿,请稍后重试。")}oe.current=M,H(M),yt(VOe(pe));const Q=M.find(le=>le.id===B);Lt.current=Q??null,Ua==="custom"&&Q&&(gi(Q.id),ei(Q.draft),ua(Q.deploymentTarget??null))},[Ha,pe]),g.useEffect(()=>{if(!pe)return;const M=Ww(pe);try{Ua==="custom"&&Mt?localStorage.setItem(M,Mt):localStorage.removeItem(M)}catch{Zn("浏览器拒绝保存当前草稿位置,请检查站点存储权限后重试。")}},[Ua,Mt,pe]);const cG=g.useCallback(M=>{if(!pe)return;const B=[...new Set(M.filter(Boolean))];yt(B),localStorage.setItem(FN(pe),JSON.stringify(B))},[pe]),uG=g.useCallback(async M=>{const B=M.filter(tt=>!!tt.runtimeId&&tt.canDelete===!0);if(B.length===0)return;const Q=aMe(Fa,n),le=new Set(B.map(tt=>tt.runtimeId));q2(tt=>{const rt=new Set(tt);for(const je of le)rt.add(je);return rt}),J0(le);const xe=new Set,Ne=new Set,Ye=new Set,$e=[];for(const tt of B)try{if(!tt.region)throw new Error("Runtime 缺少地域信息,无法删除");await o8(tt.runtimeId,tt.region),px(tt.runtimeId),xe.add(tt.runtimeId),Ne.add(tt.id)}catch(rt){const je=rt instanceof Error?rt.message:String(rt);Ye.add(tt.runtimeId),$e.push(`${tt.label}: ${je}`)}if(xe.size>0&&(J0(xe),Nh(Ea()),n0(rt=>{if(!rt)return rt;const je=new Set(rt);for(const lt of xe)je.delete(lt);return je}),K2(rt=>Object.fromEntries(Object.entries(rt).filter(([je])=>!xe.has(je)))),yt(rt=>{const je=rt.filter(lt=>!Ne.has(lt));return pe&&localStorage.setItem(FN(pe),JSON.stringify(je)),je}),$a(oe.current.filter(rt=>{var je;return!((je=rt.deploymentTarget)!=null&&je.runtimeId)||!xe.has(rt.deploymentTarget.runtimeId)})),(Q?xe.has(Q):B.some(rt=>rt.id===n))&&(IG(),Ft(null),ai(!1),As(!1),Dn(!1),bi(!1),vn(!1),Qi(null),$i(""),Ai(""),xs(!0),De("")),wn!=null&&wn.runtime&&xe.has(wn.runtime.runtimeId)&&(Ft(null),ai(!1),As(!1),Dn(!1),bi(!1),vn(!1),Qi(null),$i(""),Ai(""),xs(!0),De(""))),Ye.size>0&&q2(tt=>{const rt=new Set(tt);for(const je of Ye)rt.delete(je);return rt}),$e.length>0){const tt=$e.slice(0,3).join(";"),rt=$e.length>3?`;另有 ${$e.length-3} 个失败`:"";throw new Error(`${$e.length} 个 Agent 删除失败:${tt}${rt}`)}},[wn,n,$a,Fa,pe]),wE=g.useCallback(async()=>{z2(!0),V2("");try{const M=[];let B="";do{const Q=await a1({scope:Ts,region:"all",pageSize:100,nextToken:B});M.push(...Q.runtimes),B=Q.nextToken}while(B&&M.length<2e3);n0(new Set(M.map(Q=>Q.runtimeId))),K2(Object.fromEntries(M.map(Q=>[Q.runtimeId,{canDelete:Q.canDelete}])))}catch(M){V2(M instanceof Error?M.message:String(M))}finally{z2(!1)}},[Ts]);function r0(M){console.log("create agent draft:",M),Ft(null),rl()}function SE(M,B){console.log("Agent added, navigating to:",M,B),Nh(Ea()),n0(null),J0(),vE(Mt),gi(""),Lt.current=null,ua(null),$i(""),Ai(M),e0("basic"),Ft(null),vn(!0),s(M)}const _E=g.useCallback(M=>{Ft(null),Dn(!1),xs(!1),Qi(null),vn(!0),Ai(""),e0("basic"),$i(M.id),De("")},[]),Z2=g.useCallback(M=>{Mt&&Eh(B=>({...B,[Mt]:M.id})),_E(M)},[Mt,_E]),J2=g.useCallback(async M=>{if(!M.runtimeId)throw new Error("部署完成,但未返回 Runtime ID。");const B=(Uu==null?void 0:Uu.region)??s0,Q=await Yb(M.runtimeId,M.agentName,M.region??B,M.version);Nh(Ea()),Rs(xe=>xe+1);const le=await Yw(Q);Qe.current.set(Q,le),ct(le),n0(xe=>{const Ne=new Set(xe??[]);return Ne.add(M.runtimeId),Ne}),J0(),ua(null),vE(Mt),Eh(xe=>{if(!Mt||!xe[Mt])return xe;const Ne={...xe};return delete Ne[Mt],Ne}),gi(""),Lt.current=null,Ai(Q),e0("basic"),Ft(null),vn(!0),s(Q)},[Mt,s0,vE,Uu]),Th=g.useRef(null),NE=g.useRef(new Map),mc=g.useRef(!0),il=g.useRef(!1),gc=g.useRef(null),eC=g.useRef({key:"",turnCount:0}),TE=(p==null?void 0:p.id)??a;g.useLayoutEffect(()=>{const M=Th.current,B=eC.current,Q=B.key!==TE,le=!Q&&Ke.length>B.turnCount;if(eC.current={key:TE,turnCount:Ke.length},!M||Ke.length===0||!Q&&!le)return;mc.current=!0,il.current=!1,gc.current!==null&&(window.clearTimeout(gc.current),gc.current=null);const xe=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(Q||xe){M.scrollTop=M.scrollHeight;return}il.current=!0,M.scrollTo({top:M.scrollHeight,behavior:"smooth"}),gc.current=window.setTimeout(()=>{il.current=!1,gc.current=null},450)},[TE,Ke.length]),g.useLayoutEffect(()=>{const M=Th.current;!M||!mc.current||il.current||(M.scrollTop=M.scrollHeight)},[fo,Ke]),g.useEffect(()=>{if(!_h||Bu||Ke.length===0)return;const M=NE.current.get(_h);if(!M)return;mc.current=!1,M.scrollIntoView({behavior:"smooth",block:"center"});const B=window.setTimeout(()=>{t0("")},2600);return()=>window.clearTimeout(B)},[_h,Bu,Ke]),g.useEffect(()=>()=>{gc.current!==null&&window.clearTimeout(gc.current)},[]);const dG=g.useCallback(()=>{const M=Th.current;!M||il.current||(mc.current=M.scrollHeight-M.scrollTop-M.clientHeight<32)},[]),fG=g.useCallback(M=>{M.deltaY<0&&(il.current=!1,mc.current=!1)},[]),hG=g.useCallback(()=>{il.current=!1,mc.current=!1},[]),pG=g.useCallback(()=>{const M=Th.current;!M||!mc.current||il.current||(M.scrollTop=M.scrollHeight)},[]),kE=g.useCallback(()=>{Te(null),d_().then(M=>{et(M.userId),Gn(M.info),fc(!!M.local),uo(M.status),M.status==="authenticated"&&(i0.current=!0,Fu.current=!0,localStorage.removeItem(ma.app),s(""),Ft(null),ai(!1),As(!1),Dn(!1),bi(!1),vn(!1),xs(!1))}).catch(M=>{Te(M instanceof Error?M.message:String(M))})},[]);g.useEffect(()=>{kE()},[kE]),g.useEffect(()=>{const M=()=>{Wt(""),ie(!0)};return window.addEventListener(f_,M),Kee()&&M(),()=>window.removeEventListener(f_,M)},[]);const mG=g.useCallback(async()=>{if(Jn.current)return;Jn.current=!0;const M=Uee();if(!M){Jn.current=!1,Wt("登录窗口被浏览器拦截,请允许弹出窗口后重试。");return}Ln(!0),Wt("");try{for(;;){await new Promise(B=>window.setTimeout(B,1e3));try{const B=await d_();if(B.status==="authenticated"){et(B.userId),Gn(B.info),fc(!!B.local),uo(B.status),ie(!1),qee(),M.close();return}}catch{}if(M.closed){Wt("登录窗口已关闭,请重新登录以继续当前操作。");return}}}finally{Jn.current=!1,Ln(!1)}},[]);g.useEffect(()=>{hr&&pe&&vR(pe)},[hr,pe]),g.useEffect(()=>{if(Mn!=="authenticated"||!pe||!n){ct({});return}const M=Qe.current.get(n);if(M){ct(M);return}let B=!1;return ct({}),Yw(n).then(Q=>{B||(Qe.current.set(n,Q),ct(Q))}),()=>{B=!0}},[n,Mn,pe]),g.useEffect(()=>{if(Mn!=="authenticated"||!pe){ys(null);return}let M=!1;return ys(null),n8().then(B=>{M||ys(B)}).catch(B=>{console.warn("[app] /web/access failed; using ordinary-user access:",B),M||ys(t8)}),()=>{M=!0}},[Mn,pe]),g.useEffect(()=>{e8().then(M=>{hAe(M.telemetry),mAe({agentsSource:M.agentsSource}),ln(M.features),Xi(M.agentsSource),Ou(M.branding),$g(M.version),mi(!0)})},[]),g.useEffect(()=>{Mn!=="authenticated"||!pn||!Tt||pAe({userId:Tt.telemetry.userId,role:Tt.role,local:hr})},[Tt,Mn,hr,pn]),g.useEffect(()=>{Tt&&(Tt.capabilities.createAgents||(Ft(null),ei(null),As(!1),Dn(!1),Qg([])),Tt.capabilities.manageAgents||vn(!1))},[Tt]),g.useEffect(()=>{Mn!=="authenticated"||ks!=="cloud"||!dc||!Bu||wn||wE()},[wn,ks,Mn,Bu,wE,dc]),g.useEffect(()=>{document.title=Lr.title;let M=document.querySelector('link[rel~="icon"]');M||(M=document.createElement("link"),M.rel="icon",document.head.appendChild(M)),M.removeAttribute("type"),M.href=Lr.logoUrl||zk},[Lr]),g.useEffect(()=>{fetch("/web/runtime-config",{signal:AbortSignal.timeout(1e4)}).then(M=>M.ok?M.json():null).then(M=>{M&&gE(!!M.credentials)}).catch(M=>{console.warn("[app] /web/runtime-config probe failed; workbench stays hidden:",M)})},[]);function gG(M){vR(M),i0.current=!0,Fu.current=!0,localStorage.removeItem(ma.app),ys(null),Ft(null),ei(null),ai(!1),As(!1),Dn(!1),bi(!1),vn(!1),rl(),s(""),xs(!1),et(M),Gn({name:M}),fc(!0),uo("authenticated")}function bG(){ys(null),hr?(Pee(),et(""),Gn(void 0),uo("unauthenticated")):$ee()}g.useEffect(()=>{if(Mn==="authenticated"){if(ks==="cloud"){const M=TD(Fa);s(B=>B&&M.includes(B)?B:(B&&(Fu.current=!0,localStorage.removeItem(ma.app)),""));return}TB().then(M=>{t(M);const B=TD(Fa);s(Q=>Q&&(M.includes(Q)||B.includes(Q))?Q:(Q&&(Fu.current=!0,localStorage.removeItem(ma.app)),""))}).catch(M=>De(String(M)))}},[Mn,ks,Fa]),g.useEffect(()=>{n?(Fu.current=!1,localStorage.setItem(ma.app,n)):localStorage.removeItem(ma.app)},[n]),g.useEffect(()=>{let M=!1;if(yn(null),bs([]),sl||wn||!n||!pe||!a){zs(!1);return}return zs(!0),b_(n,pe,a).then(B=>{M||(yn(B),Uk(n).then(Q=>{M||bs(Q)}).catch(()=>{M||bs([])}))}).catch(()=>{M||yn(null)}).finally(()=>{M||zs(!1)}),()=>{M=!0}},[wn,n,sl,pe,a]),g.useEffect(()=>{let M=!1;if(an(null),en(Va()),Mn!=="authenticated"||sl||wn||!n){Wn(!1);return}return Wn(!0),Fk(n).then(B=>{M||an(B)}).catch(()=>{M||an(null)}).finally(()=>{M||Wn(!1)}),()=>{M=!0}},[wn,n,ls,Mn,sl]),g.useEffect(()=>{Tt&&localStorage.setItem(ma.view,Tt.capabilities.createAgents?Ua??"chat":"chat")},[Tt,Ua]),g.useEffect(()=>{localStorage.setItem(ma.session,a),We.current=a},[a]),g.useEffect(()=>{const M=oMe(Fa,n);if(!M||!pe){ce.current=()=>{},_s(je=>je.size===0?je:new Set);return}const{runtimeId:B,region:Q,appName:le}=M;let xe=!1,Ne=0;function Ye(){dn.current!==void 0&&(window.clearTimeout(dn.current),dn.current=void 0)}function $e(je){Ye(),dn.current=window.setTimeout(()=>void tt(),je)}async function tt(){const je=++Ne;try{const lt=await OB({runtimeId:B,region:Q,appName:le,userId:pe});if(xe||je!==Ne)return;const kt=new Set(lt.items.filter(Bn=>Bn.state==="running").map(Bn=>Bn.sessionId));if(_s(Bn=>Bn.size===kt.size&&[...kt].every(ft=>Bn.has(ft))?Bn:kt),kt.size>0){$e(UOe);return}const Pn=lt.items.filter(Bn=>Bn.state==="pending").map(Bn=>Date.parse(Bn.dueAt)).filter(Number.isFinite);Pn.length>0&&$e(Math.max($Oe,Math.min(...Pn)-Date.now()))}catch{!xe&&je===Ne&&$e(FOe)}}const rt=()=>{Ye(),tt()};return ce.current=rt,rt(),()=>{xe=!0,Ne+=1,Ye(),ce.current===rt&&(ce.current=()=>{})}},[n,Fa,pe]),g.useEffect(()=>()=>un.current.forEach(M=>M.abort()),[]),g.useEffect(()=>()=>on.current.forEach(M=>{window.clearTimeout(M)}),[]),g.useEffect(()=>()=>{var M,B;(M=He.current)==null||M.abort(),(B=Pe.current)==null||B.abort()},[]),g.useEffect(()=>{if(sl||wn||p||!n||!pe)return;let M=!1;return(async()=>{const B=await a0(n);if(!M){if(!i0.current){i0.current=!0;const Q=localStorage.getItem(ma.session)||"";if(xD()===null&&Q&&B.some(le=>le.id===Q)){kh(Q);return}}rl()}})(),()=>{M=!0}},[wn,n,sl,p,pe]),g.useEffect(()=>{const M=yE.current;M&&M.app===n&&(yE.current=null,kh(M.sid))},[n]);function yG(M,B){bi(!1),M===n?kh(B):(yE.current={app:M,sid:B},s(M))}async function a0(M){try{const B=await Dk(M,pe),Q=await Promise.allSettled(B.map(Ne=>{var Ye;return(Ye=Ne.events)!=null&&Ye.length?Promise.resolve(Ne):Hy(M,pe,Ne.id)})),le=Q.find(Ne=>Ne.status==="rejected"&&!/get session failed:\s*404\b/i.test(String(Ne.reason)));if((le==null?void 0:le.status)==="rejected")throw le.reason;const xe=Q.flatMap(Ne=>Ne.status==="fulfilled"?[Ne.value]:[]);return r(xe),xe}catch(B){return De(String(B)),[]}}function tC(M="codex",B=!1){p||(De(""),de(""),me("confirm"),Me(M),re(B),q(!0))}function xG(){var M;(M=He.current)==null||M.abort(),He.current=null,q(!1),me("confirm"),de(""),!p&&wt==="temporary"&&!ve&&$t("agent")}async function EG(M){var Q;(Q=He.current)==null||Q.abort();const B=new AbortController;He.current=B,me("loading"),de("");try{const le=ge==="codex"?await sn.startSession({displayName:M,signal:B.signal}):await sn.startAgentSession(ge,{displayName:M,signal:B.signal});if(He.current!==B)return;if(yAe({kind:ge,source:ve?"my_agents":"new_chat",sessionId:le.id}),ve){we(Ne=>Ne+1),q(!1),me("confirm"),xs(!0);return}if(ge!=="codex")return;const xe=await sn.connectSession(le.id,{signal:B.signal});if(He.current!==B)return;We.current="",l(""),h([]),Ut(""),en(Va()),$t("temporary"),Lu(),rn(!1),xh(ut),pt([]),v([]),m(xe),Ft(null),ai(!1),As(!1),Dn(!1),bi(!1),vn(!1),Qi(null),xs(!1),Le(null),_e(null),q(!1),me("confirm")}catch(le){if((le==null?void 0:le.name)==="AbortError"||He.current!==B)return;xAe({kind:ge,source:ve?"my_agents":"new_chat",error:le}),de(le instanceof Error?le.message:String(le)),me("error")}finally{He.current===B&&(He.current=null)}}async function AE(M){if(De(""),M.toolName==="codex"){const Q=await sn.connectSession(M.id);We.current="",l(""),h([]),Ut(""),en(Va()),v([]),m(Q),Le(null),_e(null),xs(!1),vn(!1);return}const B=await sn.openAgentSession(M.toolName,M.id);_e(B),Le(null),xs(!1),vn(!1)}function vG(M){Le(M),_e(null),xs(!1),vn(!1),De("")}async function wG(M){(p==null?void 0:p.id)===M.id&&ho(),M.toolName==="codex"?await sn.deleteSession(M.id):await sn.deleteAgentSession(M.toolName,M.id),Le(null),_e(null),we(B=>B+1),xs(!0)}function ho(){var B;(B=Pe.current)==null||B.abort(),Pe.current=null,qe.current="",Z.current="",x(!1),v([]),wo(ut),pt([]),Ut(""),De(""),$t("agent"),w(!1),S(""),T(!1),I(!1),L(null),D(null),A(!1),P(""),R(null),J(!1),te(""),V(!1),ae.current+=1;const M=p;m(null),M&&sn.closeSession(M.id).catch(Q=>De(String(Q)))}async function CE(M){const B=p;if(B){L(M),D(null),P(""),A(!0);try{const Q=M==="terminal"?await sn.launchTerminal(B.id):await sn.launchBrowser(B.id);D(Q)}catch(Q){P(Q instanceof Error?Q.message:String(Q))}finally{A(!1)}}}async function SG(M){const B=p;if(!(!B||E)){w(!0),S("");try{const Q=await sn.updatePermissions(B.id,M);m(le=>(le==null?void 0:le.id)===B.id?{...le,permissions:Q}:le),dt(B.id,"已更新当前 Sandbox Session 的 Codex 权限",[{label:"沙箱模式",value:tMe[Q.sandboxMode]},{label:"审批策略",value:nMe[Q.approvalPolicy]},{label:"审批方式",value:sMe[Q.approvalsReviewer]},{label:"网络访问",value:Q.networkAccess?"允许":"关闭"}]),qe.current===B.id&&T(!1)}catch(Q){S(Q instanceof Error?Q.message:String(Q))}finally{w(!1)}}}const _G=g.useCallback(async M=>{const B=p==null?void 0:p.id;if(!B)throw new Error("当前没有已连接的 Sandbox。");return sn.listDirectories(B,M)},[p==null?void 0:p.id]);async function NG(M){const B=p;if(!(!B||B.workspaceLocked||E)){w(!0),S("");try{const Q=await sn.updateWorkspace(B.id,M);m(le=>(le==null?void 0:le.id)===B.id?{...le,cwd:Q}:le),Tn.invalidateSkills(),dt(B.id,"已更新工作空间",[{label:"工作目录",value:Q,code:!0}]),qe.current===B.id&&I(!1)}catch(Q){S(Q instanceof Error?Q.message:String(Q))}finally{w(!1)}}}async function TG(M){const B=p,Q=$;if(!(!B||!Q||Y)){J(!0),te("");try{await sn.resolveApproval(B.id,Q.id,M),dt(B.id,iMe(Q,M),rMe(Q),Z.current),R(le=>(le==null?void 0:le.id)===Q.id?null:le)}catch(le){te(le instanceof Error?le.message:String(le))}finally{J(!1)}}}async function kG(M){const B=p;if(!B||K)return;const Q=++ae.current;De(""),V(!0);const le=Array.from(M).map(xe=>{const Ne={id:_D(),mimeType:ND(xe),name:xe.name,sizeBytes:xe.size,status:"uploading",previewUrl:URL.createObjectURL(xe)};return{file:xe,attachment:Ne}});pt(xe=>[...xe,...le.map(({attachment:Ne})=>Ne)]);try{const Ne=(await Promise.all(le.map(async({file:Ye,attachment:$e})=>{try{const tt=await sn.uploadFile(B.id,Ye);return ae.current!==Q?null:(pt(rt=>rt.map(je=>je.id===$e.id?{...je,id:tt.id,uri:tt.path,name:tt.name,mimeType:tt.mimeType,sizeBytes:tt.sizeBytes,status:"ready"}:je)),tt)}catch(tt){if(ae.current!==Q)return null;const rt=tt instanceof Error?tt.message:String(tt);return pt(je=>je.map(lt=>lt.id===$e.id?{...lt,status:"error",error:rt}:lt)),De(rt),null}}))).filter(Ye=>Ye!==null);ae.current===Q&&Ne.length>0&&dt(B.id,Ne.length===1?"已上传文件到 Sandbox":`已上传 ${Ne.length} 个文件到 Sandbox`,Ne.map((Ye,$e)=>({label:Ne.length===1?"文件":`文件 ${$e+1}`,value:Ye.path,code:!0})))}finally{ae.current===Q?V(!1):wo(le.map(({attachment:xe})=>xe))}}function AG(M){const B=ut.find(Q=>Q.id===M);B&&(wo([B]),pt(Q=>Q.filter(le=>le.id!==M)))}async function nC(M,B=[],Q=[]){var Bn;const le=p,xe=B.filter(ft=>ft.status==="ready"&&ft.uri);if(!le||y||!M.trim()&&xe.length===0)return;De(""),R(null),te("");const Ne=new AbortController;(Bn=Pe.current)==null||Bn.abort(),Pe.current=Ne;const Ye=[];Q.length>0&&Ye.push({kind:"invocation",value:{skills:Q.map(({name:ft,description:Dt})=>({name:ft,description:Dt}))}}),xe.length>0&&Ye.push({kind:"attachment",files:xe.map(ft=>({id:ft.id,mimeType:ft.mimeType,name:ft.name,sizeBytes:ft.sizeBytes}))}),M.trim()&&Ye.push({kind:"text",text:M});const $e=xe.map(ft=>ft.uri).filter(ft=>!!ft),rt=[Q.map(ft=>`$${ft.name}`).join(" "),M.trim()].filter(Boolean).join(" "),je=$e.length>0?[rt,"以下文件已上传到当前 Sandbox 工作空间,请在任务中使用:",...$e.map(ft=>`- ${ft}`)].filter(Boolean).join(` +`)),b("copied")}catch{b("error")}},z=()=>{var A;p(!1),b("idle"),u(""),f(E.current||((A=k[0])==null?void 0:A.version)||""),r("confirm")};return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:e==="feature-link"?"welcome-feature-link studio-update-trigger--feature":`studio-update-trigger is-${i}`,title:i==="submitting"?"正在更新 Studio":i==="published"?"Studio 已更新":`更新 Studio 至 ${n.latestVersion}`,onClick:()=>{var A;i==="published"?window.location.reload():(i==="submitting"||i==="error"||(f(((A=k[0])==null?void 0:A.version)||n.latestVersion),r("confirm")),l(!0))},children:[e!=="feature-link"&&o.jsx(xD,{className:"studio-update-icon"}),i==="submitting"?o.jsx(Ta,{as:"span",children:"正在更新"}):i==="published"?o.jsx("span",{children:"刷新使用新版"}):i==="error"?o.jsx("span",{children:"更新失败"}):e==="feature-link"?o.jsx("span",{children:"立即更新"}):o.jsx("span",{children:"有新版更新"})]}),a&&i!=="idle"&&o.jsx("div",{className:"confirm-scrim",role:"presentation",children:o.jsxs("section",{className:"confirm-box studio-update-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"studio-update-title",children:[o.jsx("div",{className:"studio-update-dialog-mark",children:o.jsx(xD,{})}),o.jsx("div",{id:"studio-update-title",className:"confirm-title",children:i==="error"?"Studio 更新失败":i==="submitting"?"正在更新 Studio":i==="published"?"Studio 更新完成":"发现新版本"}),i==="error"?o.jsxs("div",{className:"studio-update-error-panel",children:[o.jsx("p",{className:"confirm-text studio-update-error",children:c}),o.jsxs("dl",{className:"studio-update-error-meta",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"失败阶段"}),o.jsx("dd",{children:wRe[n.errorStage]||n.errorStage||"未知阶段"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"错误 ID"}),o.jsx("dd",{children:n.errorId||"未生成"})]})]}),o.jsx(ED,{lines:j,phase:"error",copyState:m,onCopy:()=>void L()}),n.consoleUrl&&o.jsxs("a",{className:"studio-update-console-link",href:n.consoleUrl,target:"_blank",rel:"noreferrer",children:["前往 VeFaaS 控制台查看 Function 日志",o.jsx("span",{"aria-hidden":!0,children:"↗"})]})]}):i==="submitting"||i==="published"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"studio-update-progress-summary",children:[o.jsxs("div",{children:[o.jsx("span",{children:"目标版本"}),o.jsx("strong",{children:E.current||T})]}),o.jsxs("div",{children:[o.jsx("span",{children:i==="published"?"更新状态":"已用时"}),o.jsx("strong",{children:i==="published"?"已完成":SRe(v)})]})]}),o.jsx("ol",{className:"studio-update-progress","aria-label":"Studio 更新进度",children:yD.map((A,M)=>{const P=yD.findIndex(Y=>Y.id===n.progressStage),H=i==="published"||Mvoid L()}),o.jsx("p",{className:"studio-update-progress-note",children:"发布阶段会短暂中断连接;关闭此窗口不会停止更新,可随时点击右上角按钮重新查看。"})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"confirm-text",children:"更新会重启 Studio 服务,预计约 3–5 分钟完成更新与发布。期间正在进行的对话、 流式响应或部署任务可能中断,登录态不会受到影响。"}),o.jsxs("div",{className:"studio-update-field",ref:x,children:[o.jsx("span",{children:"选择版本"}),o.jsxs("button",{type:"button",className:"studio-update-version-trigger","aria-label":"选择版本","aria-haspopup":"listbox","aria-expanded":h,onClick:()=>p(A=>!A),onKeyDown:A=>{(A.key==="ArrowDown"||A.key==="ArrowUp")&&(A.preventDefault(),p(!0))},children:[o.jsx("span",{children:T}),o.jsx(TRe,{})]}),h&&o.jsx("div",{className:"studio-update-version-menu",role:"listbox","aria-label":"选择版本",children:k.map(A=>{const M=A.version===T;return o.jsxs("button",{type:"button",role:"option","aria-selected":M,className:`studio-update-version-option${M?" is-selected":""}`,onClick:()=>{f(A.version),p(!1)},children:[o.jsx("span",{children:A.version}),M&&o.jsx(kRe,{})]},A.version)})})]}),o.jsxs("dl",{className:"studio-update-versions",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:n.currentVersion})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"目标版本"}),o.jsx("dd",{children:T})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"Commit"}),o.jsx("dd",{children:((C==null?void 0:C.gitSha)||n.latestGitSha).slice(0,8)})]})]}),o.jsxs("section",{className:"studio-update-changelog","aria-labelledby":"studio-update-changelog-title",children:[o.jsx("div",{id:"studio-update-changelog-title",children:"更新内容"}),C!=null&&C.changelog.length?o.jsx("ul",{children:C.changelog.map(A=>o.jsx("li",{children:A},A))}):o.jsx("p",{children:"暂无更新说明"})]})]}),o.jsxs("div",{className:"confirm-actions",children:[o.jsx("button",{type:"button",className:"confirm-btn",onClick:()=>{l(!1),p(!1),i==="confirm"&&(r("idle"),u(""))},children:i==="submitting"?"后台运行":i==="confirm"?"取消":"关闭"}),i==="confirm"&&o.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:()=>void I(),children:"立即更新"}),i==="error"&&o.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:z,children:"重新尝试"})]})]})})]})}const CRe=[{title:"多地域智能体",description:"并行加载北京与上海 Runtime,列表下滑即可继续加载。"},{title:"会话内切换",description:"在输入框旁选择智能体,并直接开启一段新会话。"},{title:"可视化执行画布",description:"通过横向画布查看多智能体结构,并支持全屏浏览。"}];function IRe({canUpdate:e=!1}){return o.jsxs("div",{className:"welcome-feature-pill",children:[o.jsx("span",{children:"焕然一新"}),o.jsx("span",{className:"welcome-feature-divider","aria-hidden":"true"}),o.jsx("button",{type:"button",className:"welcome-feature-link","aria-describedby":"welcome-feature-popover",children:"查看新特性"}),o.jsxs("section",{id:"welcome-feature-popover",className:"welcome-feature-popover",role:"tooltip",children:[o.jsx("strong",{children:"本次更新"}),o.jsx("ul",{children:CRe.map(t=>o.jsxs("li",{children:[o.jsx("span",{children:t.title}),o.jsx("p",{children:t.description})]},t.title))})]}),e&&o.jsx(ARe,{variant:"feature-link"})]})}const jRe=1e4;async function YV(e){const t=await fetch(Cn(e),{headers:s1({Accept:"application/json"}),signal:Pn(void 0,jRe)});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 RRe(){return YV("/web/sandbox/capabilities")}async function ORe(){return YV("/web/skill-creator/capabilities")}const MRe="我的智能体";function LRe({open:e,state:t,agentKind:n="codex",error:s,onCancel:i,onConfirm:r}){const a=n==="codex"?"Codex":n==="openclaw"?"OpenClaw":"Hermes",l=n==="codex"?MRe:`我的 ${a}`,c=g.useRef(null),u=g.useRef(null),d=g.useRef(null),f=g.useRef(!1),h=g.useRef(i),[p,m]=g.useState(l);if(h.current=i,g.useEffect(()=>{if(!e)return;m(l);const x=document.body.style.overflow;document.body.style.overflow="hidden";const E=window.requestAnimationFrame(()=>{var _,S;(_=u.current)==null||_.focus(),(S=u.current)==null||S.select()}),w=_=>{var C;if(_.key==="Escape"){_.preventDefault(),h.current();return}if(_.key!=="Tab")return;const S=(C=c.current)==null?void 0:C.querySelectorAll("input:not(:disabled), button:not(:disabled)");if(!(S!=null&&S.length))return;const k=S[0],T=S[S.length-1];_.shiftKey&&document.activeElement===k?(_.preventDefault(),T.focus()):!_.shiftKey&&document.activeElement===T&&(_.preventDefault(),k.focus())};return window.addEventListener("keydown",w),()=>{window.cancelAnimationFrame(E),document.body.style.overflow=x,window.removeEventListener("keydown",w)}},[l,e]),!e)return null;const b=t==="loading",v=p.trim(),y=b?`正在创建 ${a} 智能体`:t==="error"?"启动失败":`创建 ${a} 智能体`;return hi.createPortal(o.jsx("div",{className:"sandbox-dialog-backdrop",onMouseDown:x=>{x.target===x.currentTarget&&!b&&i()},children:o.jsxs("form",{ref:c,className:"sandbox-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"sandbox-dialog-title","aria-describedby":t==="confirm"?void 0:"sandbox-dialog-description",onSubmit:x=>{x.preventDefault(),!b&&!f.current&&v&&r(v)},children:[o.jsxs("div",{className:"sandbox-dialog-visual","aria-hidden":"true",children:[o.jsx("span",{className:"sandbox-dialog-orbit"}),o.jsx("span",{className:"sandbox-dialog-icon",children:b?o.jsx("span",{className:"sandbox-spinner"}):o.jsx(Fm,{kind:n})})]}),o.jsxs("div",{className:"sandbox-dialog-copy",children:[o.jsx("h2",{id:"sandbox-dialog-title",children:y}),t==="error"?o.jsx("p",{id:"sandbox-dialog-description",className:"sandbox-dialog-error",role:"alert",children:s||"AgentKit 沙箱初始化失败,请稍后重新尝试。"}):b?o.jsxs("p",{id:"sandbox-dialog-description","aria-live":"polite",children:["正在创建并等待 ",a," 智能体就绪,这通常需要半分钟"]}):null,o.jsxs("label",{className:"sandbox-dialog-field",children:[o.jsxs("span",{className:"sandbox-dialog-field-label",children:[o.jsx("span",{children:"智能体名称"}),o.jsxs("span",{"aria-hidden":"true",children:[p.length,"/",r3]})]}),o.jsx("input",{ref:u,type:"text",required:!0,value:p,maxLength:r3,disabled:b,placeholder:l,autoComplete:"off",onChange:x=>m(x.target.value),onCompositionStart:()=>{f.current=!0},onCompositionEnd:()=>{f.current=!1},onKeyDown:x=>{const{nativeEvent:E}=x;x.key==="Enter"&&(f.current||E.isComposing||E.keyCode===229)&&x.preventDefault()}})]})]}),o.jsxs("footer",{className:"sandbox-dialog-actions",children:[o.jsx("button",{ref:d,type:"button",onClick:i,children:b?"取消创建":"取消"}),!b&&o.jsx("button",{type:"submit",className:"is-primary",disabled:!v,children:t==="error"?"重新尝试":"确认创建"})]})]})}),document.body)}function DRe({agentName:e,onExit:t}){return o.jsxs("div",{className:"sandbox-session-warning",role:"status",children:[o.jsx("span",{className:"sandbox-session-warning-dot","aria-hidden":"true"}),o.jsxs("span",{className:"sandbox-session-warning-copy",children:["当前您在使用 ",e," 智能体"]}),o.jsx("button",{type:"button",onClick:t,children:"退出内置智能体"})]})}function PRe({activity:e,time:t}){var n;return o.jsxs("aside",{className:"sandbox-activity-record",role:"status","aria-label":"Sandbox 操作记录",children:[o.jsxs("div",{className:"sandbox-activity-summary",children:[o.jsx("span",{className:"sandbox-activity-dot","aria-hidden":"true"}),o.jsx("span",{className:"sandbox-activity-label",children:"操作记录"}),o.jsx("strong",{children:e.title}),t?o.jsx("time",{children:t}):null]}),(n=e.details)!=null&&n.length?o.jsx("dl",{className:"sandbox-activity-details",children:e.details.map(s=>o.jsxs("div",{children:[o.jsx("dt",{children:s.label}),o.jsx("dd",{title:s.value,children:s.code?o.jsx("code",{children:s.value}):s.value})]},`${s.label}:${s.value}`))}):null]})}function BRe(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(e)}function URe({usage:e}){const t=[["Total",e.totalTokens],["Input",e.inputTokens],...e.cachedInputTokens>0?[["Cached input",e.cachedInputTokens]]:[],["Output",e.outputTokens],...e.reasoningOutputTokens>0?[["Reasoning output",e.reasoningOutputTokens]]:[]];return o.jsx("div",{className:"sandbox-token-usage","aria-label":"Codex Token 用量",children:t.map(([n,s])=>o.jsxs("span",{title:`${n}: ${s.toLocaleString()} tokens`,children:[o.jsx("small",{children:n}),o.jsx("strong",{children:BRe(s)})]},n))})}function WV(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("path",{d:"m7.5 9 2.7 2.5L7.5 14M12.7 14h3.8"}),o.jsx("path",{d:"M3.8 7.5h16.4",opacity:".55"})]})}function XV(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("path",{d:"M3.8 8h16.4"}),o.jsx("circle",{cx:"6.5",cy:"6.3",r:".65",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"8.8",cy:"6.3",r:".65",fill:"currentColor",stroke:"none"}),o.jsx("path",{d:"m9 15 2.2-4 1.6 2.4 1.1-1.2L16 15H9Z"})]})}function G2(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M12 3.4 19 6v5.3c0 4.3-2.7 7.6-7 9.3-4.3-1.7-7-5-7-9.3V6l7-2.6Z"}),o.jsx("path",{d:"m8.8 12 2 2 4.4-4.4"})]})}function ty(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M3.5 7.7h6.1l1.7 2h9.2v7.5a2.3 2.3 0 0 1-2.3 2.3H5.8a2.3 2.3 0 0 1-2.3-2.3V7.7Z"}),o.jsx("path",{d:"M3.8 7.7V6.8a2.3 2.3 0 0 1 2.3-2.3h3l1.8 2h6.9a2.3 2.3 0 0 1 2.3 2.3v.9"}),o.jsx("path",{d:"M12 13v3M10.5 14.5h3"})]})}function FRe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 5v14M5 12h14"})})}function $Re(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6.5 11.5 5.5-5.5 5.5 5.5M12 6v12"})})}function HRe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.5"}),o.jsx("circle",{cx:"8.5",cy:"9",r:"1.4"}),o.jsx("path",{d:"m5.5 17 4.2-4.2 2.6 2.4 2.1-2.1 4.1 3.9"})]})}function zRe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3.5h7l5 5v12H6z"}),o.jsx("path",{d:"M13 3.5v5h5M9 13h6M9 16h5"})]})}function VRe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"13.5",height:"14",rx:"2.5"}),o.jsx("path",{d:"m17 10 3.5-2v8L17 14zM7 8.5h4.5"})]})}function GRe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m12 3 1.5 4.5L18 9l-4.5 1.5L12 15l-1.5-4.5L6 9l4.5-1.5zM18.5 15.5l.7 2.1 2.1.7-2.1.7-.7 2.1-.7-2.1-2.1-.7 2.1-.7z"})})}function KRe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6.5 6.5 11 11M17.5 6.5l-11 11"})})}function HN(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9 6 6 6-6 6"})})}function qRe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.8 8.2A8 8 0 1 1 4 12M4.8 8.2V4.5M4.8 8.2h3.7"}),o.jsx("path",{d:"M12 8v4.5l3 1.8"})]})}function qo(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M20 12a8 8 0 1 1-2.35-5.65"})})}function Ug({open:e,title:t,subtitle:n,icon:s,className:i="",onClose:r,children:a}){const l=g.useId(),c=g.useRef(null),u=g.useRef(null),d=g.useRef(r);return d.current=r,g.useEffect(()=>{var p;if(!e)return;u.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const f=document.body.style.overflow;document.body.style.overflow="hidden",(p=c.current)==null||p.focus();const h=m=>{var E;if(m.key==="Escape"){m.preventDefault(),d.current();return}if(m.key!=="Tab")return;const b=(E=c.current)==null?void 0:E.closest("[role=dialog]"),v=Array.from((b==null?void 0:b.querySelectorAll('button:not(:disabled), input:not(:disabled), iframe, [tabindex]:not([tabindex="-1"])'))??[]);if(v.length===0)return;const y=v[0],x=v[v.length-1];m.shiftKey&&document.activeElement===y?(m.preventDefault(),x.focus()):!m.shiftKey&&document.activeElement===x&&(m.preventDefault(),y.focus())};return window.addEventListener("keydown",h),()=>{var m;document.body.style.overflow=f,window.removeEventListener("keydown",h),(m=u.current)==null||m.focus()}},[e]),e?hi.createPortal(o.jsx("div",{className:"sandbox-control-backdrop",onMouseDown:f=>{f.target===f.currentTarget&&r()},children:o.jsxs("section",{className:`sandbox-control-dialog ${i}`.trim(),role:"dialog","aria-modal":"true","aria-labelledby":l,children:[o.jsxs("header",{className:"sandbox-control-head",children:[o.jsx("span",{className:"sandbox-control-head-icon","aria-hidden":"true",children:s}),o.jsxs("div",{children:[o.jsx("h2",{id:l,children:t}),o.jsx("p",{children:n})]}),o.jsx("button",{ref:c,type:"button",className:"sandbox-control-close","aria-label":`关闭${t}`,onClick:r,children:o.jsx(KRe,{})})]}),a]})}),document.body):null}function YRe({open:e,kind:t,launch:n,loading:s,error:i,onReload:r,onClose:a}){const l=t==="terminal",c=l?"Terminal":"Sandbox Browser";return o.jsxs(Ug,{open:e,title:c,subtitle:l?"连接当前 AgentKit Session 的交互式终端":"在当前 AgentKit Session 中查看与操作浏览器",icon:l?o.jsx(WV,{}):o.jsx(XV,{}),className:`sandbox-tool-dialog sandbox-tool-dialog--${t}`,onClose:a,children:[o.jsx("div",{className:"sandbox-tool-toolbar",children:o.jsxs("span",{children:[o.jsx("i",{className:s?"is-loading":n?"is-ready":""}),s?"正在连接…":n?"已连接":"尚未连接"]})}),o.jsx("div",{className:"sandbox-tool-surface",children:s?o.jsxs("div",{className:"sandbox-control-state",children:[o.jsx(qo,{className:"spin"}),o.jsxs("strong",{children:["正在打开 ",c]}),o.jsx("span",{children:"工具正在连接当前 AgentKit Session。"})]}):i?o.jsxs("div",{className:"sandbox-control-state is-error",children:[o.jsxs("strong",{children:[c," 打开失败"]}),o.jsx("span",{children:i}),o.jsx("button",{type:"button",onClick:r,children:"重试"})]}):n?o.jsx("iframe",{src:n.url,title:c,allow:"clipboard-read; clipboard-write",sandbox:"allow-downloads allow-forms allow-modals allow-popups allow-pointer-lock allow-same-origin allow-scripts"}):null})]})}function WRe({open:e,threads:t,currentThreadId:n,loading:s,error:i,onSelect:r,onClose:a}){return o.jsx(Ug,{open:e,title:"恢复 Codex 对话",subtitle:"选择当前 Sandbox Session 中最近更新的 Thread",icon:o.jsx(qRe,{}),className:"sandbox-threads-dialog",onClose:a,children:o.jsx("div",{className:"sandbox-thread-list",children:s?o.jsxs("div",{className:"sandbox-control-state",children:[o.jsx(qo,{className:"spin"}),o.jsx("strong",{children:"正在读取历史对话"})]}):i?o.jsxs("div",{className:"sandbox-control-state is-error",children:[o.jsx("strong",{children:"历史对话读取失败"}),o.jsx("span",{children:i})]}):t.length===0?o.jsx("div",{className:"sandbox-control-state",children:o.jsx("strong",{children:"暂无可恢复的对话"})}):t.map(l=>{const c=l.id===n,u=l.name||l.preview||`Thread ${l.id.slice(0,8)}`;return o.jsxs("button",{type:"button",className:c?"is-active":"",disabled:c,onClick:()=>r(l.id),children:[o.jsxs("span",{children:[o.jsx("strong",{children:u}),o.jsx("small",{children:l.preview||l.cwd||l.id})]}),o.jsx("time",{children:l.updatedAt?new Date(l.updatedAt*1e3).toLocaleString():""}),o.jsx(HN,{})]},l.id)})})})}const XRe=[{value:"read-only",label:"只读",detail:"允许读取文件,不允许写入工作空间。"},{value:"workspace-write",label:"工作区写入",detail:"允许在当前工作空间内读取与修改文件。"},{value:"danger-full-access",label:"完全访问",detail:"不启用沙箱隔离,适合明确可信的任务。",danger:!0}],QRe=[{value:"untrusted",label:"仅不可信命令",detail:"只对 Codex 判断为不可信的操作发起审批。"},{value:"on-request",label:"按需审批",detail:"Codex 可在必要时请求你确认命令或文件修改。"},{value:"never",label:"不审批",detail:"Codex 不会暂停并请求人工批准。",danger:!0}],ZRe=[{value:"user",label:"由我审批",detail:"审批请求会显示在 Studio 中,由你决定。"},{value:"auto_review",label:"自动审查",detail:"使用 Codex 自动审查流程处理审批请求。"}];function JRe({open:e,value:t,busy:n,error:s,onSave:i,onClose:r}){const[a,l]=g.useState(t);return g.useEffect(()=>{e&&l(t)},[e,t]),o.jsxs(Ug,{open:e,title:"Codex 权限",subtitle:"设置会保存到当前 Sandbox Session,并同步到其中的所有 Thread",icon:o.jsx(G2,{}),className:"sandbox-settings-dialog",onClose:r,children:[o.jsxs("div",{className:"sandbox-control-body",children:[o.jsx(Xw,{label:"沙箱模式",choices:XRe,value:a.sandboxMode,disabled:n,onChange:c=>l(u=>({...u,sandboxMode:c,networkAccess:c==="danger-full-access"?!0:u.networkAccess}))}),o.jsx(Xw,{label:"审批策略",choices:QRe,value:a.approvalPolicy,disabled:n,onChange:c=>l(u=>({...u,approvalPolicy:c}))}),o.jsx(Xw,{label:"审批方式",choices:ZRe,value:a.approvalsReviewer,disabled:n,onChange:c=>l(u=>({...u,approvalsReviewer:c}))}),o.jsxs("label",{className:`sandbox-network-toggle${a.sandboxMode==="danger-full-access"?" is-disabled":""}`,children:[o.jsxs("span",{children:[o.jsx("strong",{children:"允许网络访问"}),o.jsx("small",{children:"控制 workspace-write 与只读模式中的外部网络访问。"})]}),o.jsx("input",{type:"checkbox",checked:a.networkAccess,disabled:n||a.sandboxMode==="danger-full-access",onChange:c=>l(u=>({...u,networkAccess:c.target.checked}))})]}),a.sandboxMode==="danger-full-access"?o.jsx("div",{className:"sandbox-control-note is-danger",children:"完全访问会关闭文件系统与网络隔离,请只在可信任务中使用。"}):null,s?o.jsx("div",{className:"sandbox-control-error",children:s}):null]}),o.jsxs("footer",{className:"sandbox-control-actions",children:[o.jsx("button",{type:"button",onClick:r,disabled:n,children:"取消"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:n,onClick:()=>i(a),children:[n?o.jsx(qo,{className:"spin"}):null,"保存权限"]})]})]})}function Xw({label:e,choices:t,value:n,disabled:s,onChange:i}){return o.jsxs("fieldset",{className:"sandbox-choice-group",disabled:s,role:"radiogroup","aria-label":e,children:[o.jsx("legend",{children:e}),o.jsx("div",{className:"sandbox-choice-list",children:t.map(r=>o.jsxs("button",{type:"button",role:"radio",className:`${n===r.value?"is-active":""}${r.danger?" is-danger":""}`.trim(),"aria-checked":n===r.value,onClick:()=>i(r.value),onKeyDown:a=>{var d,f;const l=t.findIndex(h=>h.value===r.value);let c=l;if(a.key==="ArrowRight"||a.key==="ArrowDown")c=(l+1)%t.length;else if(a.key==="ArrowLeft"||a.key==="ArrowUp")c=(l-1+t.length)%t.length;else if(a.key==="Home")c=0;else if(a.key==="End")c=t.length-1;else return;a.preventDefault(),i(t[c].value);const u=(d=a.currentTarget.parentElement)==null?void 0:d.querySelectorAll('[role="radio"]');(f=u==null?void 0:u[c])==null||f.focus()},children:[o.jsx("i",{}),o.jsxs("span",{children:[o.jsx("strong",{children:r.label}),o.jsx("small",{children:r.detail})]})]},r.value))})]})}function eOe({open:e,cwd:t,locked:n,busy:s,error:i,browse:r,onSave:a,onClose:l}){const[c,u]=g.useState(t||"/"),[d,f]=g.useState(null),[h,p]=g.useState(!1),[m,b]=g.useState("");g.useEffect(()=>{if(!e)return;const y=t||"/";u(y),v(y)},[t,e]);async function v(y){p(!0),b("");try{const x=await r(y);f(x),u(x.path)}catch(x){b(x instanceof Error?x.message:String(x))}finally{p(!1)}}return o.jsxs(Ug,{open:e,title:"工作空间",subtitle:"选择当前 Codex Thread 执行命令与修改文件的目录",icon:o.jsx(ty,{}),className:"sandbox-workspace-dialog",onClose:l,children:[o.jsxs("div",{className:"sandbox-control-body",children:[o.jsxs("label",{className:"sandbox-workspace-input",children:[o.jsx("span",{children:"绝对路径"}),o.jsxs("div",{children:[o.jsx("input",{value:c,disabled:s||n,spellCheck:!1,onChange:y=>u(y.target.value),onKeyDown:y=>{y.key==="Enter"&&c.startsWith("/")&&(y.preventDefault(),v(c))}}),o.jsx("button",{type:"button",disabled:s||h||!c.startsWith("/"),onClick:()=>void v(c),children:"浏览"})]})]}),o.jsxs("div",{className:"sandbox-directory-browser",children:[o.jsxs("div",{className:"sandbox-directory-head",children:[o.jsx("span",{title:d==null?void 0:d.path,children:(d==null?void 0:d.path)??c}),h?o.jsx(qo,{className:"spin"}):null]}),o.jsxs("div",{className:"sandbox-directory-list",children:[d!=null&&d.parent?o.jsxs("button",{type:"button",disabled:h,onClick:()=>void v(d.parent??"/"),children:[o.jsx(ty,{}),o.jsx("span",{children:"上一级"}),o.jsx("small",{children:d.parent}),o.jsx(HN,{})]}):null,d==null?void 0:d.directories.map(y=>o.jsxs("button",{type:"button",disabled:h,onClick:()=>void v(y.path),children:[o.jsx(ty,{}),o.jsx("span",{children:y.name}),o.jsx(HN,{})]},y.path)),!h&&(d==null?void 0:d.directories.length)===0?o.jsx("div",{className:"sandbox-directory-empty",children:"当前目录没有子目录"}):null]})]}),n?o.jsx("div",{className:"sandbox-control-note",children:"当前对话已经开始,工作空间已锁定。新建 Sandbox 会话后可重新选择。"}):null,m||i?o.jsx("div",{className:"sandbox-control-error",children:m||i}):null]}),o.jsxs("footer",{className:"sandbox-control-actions",children:[o.jsx("button",{type:"button",onClick:l,disabled:s,children:"取消"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:s||n||!c.startsWith("/"),onClick:()=>a(c),children:[s?o.jsx(qo,{className:"spin"}):null,"使用此目录"]})]})]})}function tOe({approval:e,busy:t,error:n,onDecision:s}){var a;const i=(a=e==null?void 0:e.command)==null?void 0:a.trim(),r=(e==null?void 0:e.changes)===void 0?"":JSON.stringify(e.changes,null,2);return o.jsxs(Ug,{open:e!==null,title:(e==null?void 0:e.kind)==="file"?"允许修改文件?":"允许执行命令?",subtitle:"Codex 正在等待你的决定",icon:o.jsx(G2,{}),className:"sandbox-approval-dialog",onClose:()=>{t||s("cancel")},children:[o.jsxs("div",{className:"sandbox-control-body",children:[e!=null&&e.reason?o.jsx("div",{className:"sandbox-approval-reason",children:e.reason}):null,i?o.jsx("pre",{children:i}):null,r?o.jsx("pre",{children:r}):null,e!=null&&e.cwd?o.jsxs("div",{className:"sandbox-approval-meta",children:["执行目录 ",o.jsx("code",{children:e.cwd})]}):null,n?o.jsx("div",{className:"sandbox-control-error",children:n}):null]}),o.jsxs("footer",{className:"sandbox-control-actions sandbox-approval-actions",children:[o.jsx("button",{type:"button",disabled:t,onClick:()=>s("decline"),children:"拒绝"}),o.jsx("button",{type:"button",disabled:t,onClick:()=>s("accept"),children:"仅本次允许"}),o.jsxs("button",{type:"button",className:"is-primary",disabled:t,onClick:()=>s("acceptForSession"),children:[t?o.jsx(qo,{className:"spin"}):null,"本会话允许"]})]})]})}const nOe={codex:"Codex",openclaw:"OpenClaw",hermes:"Hermes"};function vD(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(t)}function sOe({session:e,onBack:t,onOpen:n,onDelete:s}){const[i,r]=g.useState(!1),[a,l]=g.useState(!1),[c,u]=g.useState(!1),[d,f]=g.useState(""),h=nOe[e.toolName],p=async()=>{if(!(a||c)){l(!0),f("");try{await n()}catch(b){f(b instanceof Error?b.message:String(b))}finally{l(!1)}}},m=async()=>{if(!(c||a)){u(!0),f("");try{await s()}catch(b){f(b instanceof Error?b.message:String(b)),r(!1)}finally{u(!1)}}};return o.jsxs("section",{className:"sandbox-agent-details",children:[o.jsxs("header",{className:"sandbox-agent-details-header",children:[o.jsxs("button",{type:"button",className:"sandbox-agent-back",onClick:t,children:[o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m14.5 6-6 6 6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})}),"返回智能体"]}),o.jsxs("div",{children:[o.jsx("h1",{children:e.displayName||`${h} 智能体`}),o.jsxs("p",{children:[h," AgentKit Session 详情"]})]})]}),d?o.jsx("div",{className:"sandbox-agent-detail-error",role:"alert",children:d}):null,o.jsxs("div",{className:"sandbox-agent-detail-panel",children:[o.jsxs("dl",{children:[o.jsxs("div",{children:[o.jsx("dt",{children:"智能体类型"}),o.jsx("dd",{children:h})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:F1(e.status)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"创建人"}),o.jsx("dd",{children:e.createdBy||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"工具类型"}),o.jsx("dd",{children:e.toolType||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"创建时间"}),o.jsx("dd",{children:vD(e.createdAt)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"过期时间"}),o.jsx("dd",{children:vD(e.expireAt)})]}),o.jsxs("div",{className:"is-wide",children:[o.jsx("dt",{children:"Session ID"}),o.jsx("dd",{children:e.id})]})]}),o.jsxs("footer",{children:[o.jsx("button",{type:"button",className:"sandbox-agent-delete",disabled:a||c,onClick:()=>r(!0),children:"删除智能体"}),o.jsx("button",{type:"button",className:"sandbox-agent-open",disabled:a||c,"aria-busy":a||void 0,onClick:()=>void p(),children:a?"打开中…":"打开智能体"})]})]}),i?o.jsx("div",{className:"confirm-scrim",onClick:()=>!c&&r(!1),children:o.jsxs("div",{className:"confirm-box",role:"alertdialog","aria-modal":"true","aria-labelledby":"sandbox-agent-delete-title",onClick:b=>b.stopPropagation(),children:[o.jsx("div",{className:"confirm-title",id:"sandbox-agent-delete-title",children:"删除智能体?"}),o.jsxs("div",{className:"confirm-text",children:["将删除“",e.displayName||`${h} 智能体`,"”及其 AgentKit Session,此操作无法撤销。"]}),o.jsxs("div",{className:"confirm-actions",children:[o.jsx("button",{type:"button",className:"confirm-btn",disabled:c,onClick:()=>r(!1),children:"取消"}),o.jsx("button",{type:"button",className:"confirm-btn confirm-btn--danger",disabled:c,onClick:()=>void m(),children:c?"删除中…":"确认删除"})]})]})}):null]})}const iOe="_SegmentedControl_1sl7d_1",rOe="_SegmentedControlOption_1sl7d_140",aOe="_SegmentedControlThumb_1sl7d_219",zN={SegmentedControl:iOe,SegmentedControlOption:rOe,SegmentedControlThumb:aOe},ny=({value:e,onChange:t,children:n,block:s,pill:i=!0,size:r="md",gutterSize:a,className:l,onClick:c,...u})=>{const d=g.useRef(null),f=g.useRef(null),h=g.useCallback(m=>{const b=d.current,v=f.current;if(!b||!v)return;const y=b==null?void 0:b.querySelector('[data-state="on"]');if(!y)return;const x=b.clientWidth;let E=Math.floor(y.clientWidth);const w=y.offsetLeft;if(x-(E+w)<2&&(E=E-1),v.style.width=`${Math.floor(E)}px`,v.style.transform=`translateX(${w}px)`,b.scrollWidth>x){const _=x*.15,S=b.scrollLeft,k=y.offsetLeft,T=k+E;(kS+x-_)&&m&&y.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}},[]);qSe({ref:d,onResize:()=>{const m=f.current;if(!m)return;const b=m.style.transition;m.style.transition="",h(!1),m.style.transition=b}}),g.useLayoutEffect(()=>{const m=d.current,b=f.current;!m||!b||(h(!!b.style.transition),b.style.transition||gN(()=>{b.style.transition="width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter)"}))},[h,e,r,a,i]);const p=m=>{m&&t&&t(m)};return o.jsxs(ACe,{ref:d,className:ra(zN.SegmentedControl,l),type:"single",value:e,loop:!1,onValueChange:p,onClick:c,"data-block":s?"":void 0,"data-pill":i?"":void 0,"data-size":r,"data-gutter-size":a,...u,children:[o.jsx("div",{className:zN.SegmentedControlThumb,ref:f}),n]})},oOe=({children:e,...t})=>o.jsx(OCe,{className:zN.SegmentedControlOption,...t,onPointerEnter:q$,children:o.jsx("span",{className:"relative",children:e})});ny.Option=oOe;function lOe({workspace:e,onBack:t}){const[n,s]=g.useState("main"),[i,r]=g.useState(""),[a,l]=g.useState(!1),[c,u]=g.useState(""),d=e.kind==="openclaw"?"OpenClaw":"Hermes";g.useEffect(()=>{s("main"),r(""),u(""),l(!1)},[e.session.id]);const f=async()=>{if(s("terminal"),!(i||a)){l(!0),u("");try{const h=await rn.launchAgentTerminal(e.kind,e.session.id);r(h.url)}catch(h){u(h instanceof Error?h.message:String(h))}finally{l(!1)}}};return o.jsxs("section",{className:"sandbox-agent-workspace",children:[o.jsxs("header",{children:[o.jsxs("div",{className:"sandbox-agent-workspace-title",children:[o.jsx("button",{type:"button",onClick:t,"aria-label":"返回智能体列表",children:o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m14.5 6-6 6 6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}),o.jsxs("div",{children:[o.jsx("h1",{children:e.session.displayName||`${d} 智能体`}),o.jsxs("p",{children:[o.jsxs("span",{children:["创建人 ",e.session.createdBy||"未知"]}),o.jsx("span",{className:"sandbox-agent-workspace-status","data-ready":e.session.status.toLowerCase()==="ready"||void 0,children:F1(e.session.status)})]})]})]}),o.jsxs(ny,{className:"sandbox-agent-workspace-tabs",value:n,size:"lg",gutterSize:"lg",block:!0,pill:!1,"aria-label":"智能体工作区",onChange:h=>{h==="terminal"?f():s("main")},children:[o.jsx(ny.Option,{value:"main",children:"主界面"}),o.jsx(ny.Option,{value:"terminal",children:"终端"})]})]}),o.jsx("div",{className:"sandbox-agent-workspace-surface",children:n==="main"?o.jsx("iframe",{src:e.webuiUrl,title:`${d} 主界面`,allow:"clipboard-read; clipboard-write"}):a?o.jsx("div",{className:"sandbox-agent-workspace-state",role:"status",children:"正在打开终端…"}):c?o.jsxs("div",{className:"sandbox-agent-workspace-state is-error",role:"alert",children:[o.jsx("p",{children:c}),o.jsx("button",{type:"button",onClick:()=>void f(),children:"重新尝试"})]}):i?o.jsx("iframe",{src:i,title:`${d} 终端`}):null})]})}const uE=[{name:"model",usage:"/model [model]",description:"显示或切换当前对话模型",keywords:["模型","switch"]},{name:"models",usage:"/models",description:"列出 app-server 可用模型",keywords:["模型列表","list"]},{name:"skill",usage:"/skill",description:"浏览并调用当前工作区可用的 Skill",keywords:["技能","workflow"]},{name:"skills",usage:"/skills",description:"浏览并调用当前工作区可用的 Skills",keywords:["技能列表","workflow","list"]},{name:"new",usage:"/new",description:"开始一个新对话",keywords:["新建","对话"]},{name:"resume",usage:"/resume [thread]",description:"打开历史会话或恢复指定 thread",keywords:["历史","恢复","session"]},{name:"fork",usage:"/fork",description:"从当前上下文分叉一个新对话",keywords:["分叉","branch"]},{name:"compact",usage:"/compact",description:"压缩当前对话上下文",keywords:["压缩","上下文"]},{name:"archive",usage:"/archive",description:"归档当前对话并新建对话",keywords:["归档","关闭"]},{name:"status",usage:"/status",description:"显示当前连接、thread、模型与 token 状态",keywords:["状态","连接","token"]},{name:"clear",usage:"/clear",description:"清空当前视图并开始新对话",keywords:["清空","重置"]},{name:"help",usage:"/help",description:"显示 Sandbox 支持的快捷命令",keywords:["帮助","命令"]}];function cOe(e){var n;const t=e.trim().match(/^\/([^\s]+)(?:\s+([\s\S]*))?$/);if(t)return{name:t[1].toLocaleLowerCase(),argument:((n=t[2])==null?void 0:n.trim())??""}}function uOe(e){const t=e.toLocaleLowerCase();return uE.filter(n=>!t||[n.name,n.description,...n.keywords].some(s=>s.toLocaleLowerCase().includes(t))).sort((n,s)=>wD(n,t)-wD(s,t)).slice(0,12)}function wD(e,t){return t?e.name===t?0:e.name.startsWith(t)?1:e.name.includes(t)?2:3:uE.indexOf(e)}function dOe(e,t){const n=t.toLocaleLowerCase();return e.filter(s=>!n||`${s.id} ${s.displayName} ${s.description}`.toLocaleLowerCase().includes(n)).sort((s,i)=>{if(!n)return Number(i.isDefault)-Number(s.isDefault);const r=s.id.toLocaleLowerCase(),a=i.id.toLocaleLowerCase(),l=(c,u)=>c===n?0:c.startsWith(n)?1:u.toLocaleLowerCase().startsWith(n)?2:3;return l(r,s.displayName)-l(a,i.displayName)}).slice(0,12)}function fOe(){return uE.map(e=>({label:e.usage,value:e.description}))}function hOe(e,t){return e.map(n=>{const s=n.displayName.trim(),i=s&&s!==n.id?`${s} · ${n.id}`:n.id;return{label:n.id===t?"当前模型":"可用模型",value:n.description?`${i} — ${n.description}`:i,code:!1}})}function pOe(e){const t=[{label:"Thread",value:e.threadId,code:!0},{label:"工作空间",value:e.cwd||"未设置",code:!!e.cwd}];return e.model&&t.push({label:"模型",value:e.model,code:!0}),t.push({label:"状态",value:e.busy?"运行中":"空闲"}),e.threadTotal&&t.push({label:"累计 Token",value:e.threadTotal.totalTokens.toLocaleString()}),e.modelContextWindow!==void 0&&t.push({label:"上下文窗口",value:e.modelContextWindow.toLocaleString()}),t}function mOe(e){return e.messages.map(t=>{var s;const n=[];return t.role==="user"&&((s=t.skillNames)!=null&&s.length)&&n.push({kind:"invocation",value:{skills:t.skillNames.map(i=>({name:i,description:""}))}}),t.content&&n.push({kind:"text",text:t.content}),{role:t.role,blocks:n,meta:{localId:t.id,ts:t.timestamp/1e3}}})}function gOe({appName:e,value:t,onChange:n,onSubmit:s,disabled:i,busy:r,attachments:a,onAddFiles:l,onRemoveAttachment:c,actions:u,models:d,modelsLoading:f,modelsLoaded:h,currentModel:p,onRequestModels:m,skills:b,skillsLoading:v,skillsLoaded:y,selectedSkills:x,onRequestSkills:E,onSelectedSkillsChange:w}){const _=g.useRef(null),S=g.useRef(null),k=g.useRef(null),T=g.useRef(null),[C,I]=g.useState(!1),[j,L]=g.useState(0),[z,D]=g.useState(!1);g.useLayoutEffect(()=>{const V=_.current;V&&(V.style.height="auto",V.style.height=`${Math.min(V.scrollHeight,200)}px`)},[t]);const F=g.useMemo(()=>{if(!t.startsWith("/")||t.includes(` +`))return;const V=t.slice(1),W=V.search(/\s/),q=(W<0?V:V.slice(0,W)).toLocaleLowerCase(),ue=W<0?"":V.slice(W).trim();if(!(W>=0&&q!=="model"))return{command:q,argument:ue,modelMode:W>=0}},[t]),A=g.useMemo(()=>{const V=/(^|\s)\$([^\s$]*)$/.exec(t);if(V)return{query:V[2],start:t.length-V[2].length-1,end:t.length}},[t]),M=g.useMemo(()=>{if(A){const V=A.query.toLocaleLowerCase();return b.filter(W=>!x.some(q=>q.id===W.id||q.name===W.name)).filter(W=>`${W.name} ${W.description}`.toLocaleLowerCase().includes(V)).slice(0,12).map(W=>({kind:"skill",skill:W}))}return F!=null&&F.modelMode?dOe(d,F.argument).map(V=>({kind:"model",model:V})):F?uOe(F.command).map(V=>({kind:"command",command:V})):[]},[A,d,x,b,F]),P=!z&&!!(A||F);g.useEffect(()=>{L(0)},[t]),g.useEffect(()=>{F!=null&&F.modelMode&&!h&&!f&&m()},[h,f,m,F==null?void 0:F.modelMode]),g.useEffect(()=>{A&&!y&&!v&&E()},[A,E,y,v]);const H=a.some(V=>V.status!=="ready"),R=!i&&!r&&!H&&(t.trim().length>0||a.length>0);function Y(V){D(!1),I(!1),n(V)}function J(V){if(V.kind==="skill"){if(!A)return;const W=t.slice(0,A.start)+t.slice(A.end);w([...x,V.skill]),Y(W),D(!0),requestAnimationFrame(()=>{var q,ue;(q=_.current)==null||q.focus(),(ue=_.current)==null||ue.setSelectionRange(A.start,A.start)});return}if(V.kind==="model"){Y(`/model ${V.model.id}`),D(!0),requestAnimationFrame(()=>{var W;return(W=_.current)==null?void 0:W.focus()});return}if(V.command.name==="model"){Y("/model "),m(),requestAnimationFrame(()=>{var W;return(W=_.current)==null?void 0:W.focus()});return}if(V.command.name==="skill"||V.command.name==="skills"){Y(`/${V.command.name}`),D(!0),requestAnimationFrame(()=>{var W;return(W=_.current)==null?void 0:W.focus()});return}Y(`/${V.command.name}`),D(!0),requestAnimationFrame(()=>{var W;return(W=_.current)==null?void 0:W.focus()})}function U(V){var W;I(!1),(W=V.current)==null||W.click()}function te(V){const W=V.target.files?Array.from(V.target.files):[];W.length&&l(W),V.target.value=""}const K=A?"可用 Skills":F!=null&&F.modelMode?"选择模型":"Codex 快捷命令";return o.jsxs("div",{className:"composer sandbox-codex-composer",children:[a.length>0?o.jsx(z1,{appName:e,compact:!0,items:a,onRemove:c}):null,o.jsxs("div",{className:"composer-box",children:[P?o.jsxs("div",{className:"composer-command-menu",role:"listbox","aria-label":K,children:[o.jsxs("div",{className:"composer-command-head",children:[o.jsx(GRe,{}),o.jsx("span",{children:K}),F!=null&&F.modelMode&&p?o.jsxs("small",{children:["当前:",p]}):null,o.jsx("kbd",{children:A?"$":"/"})]}),A&&v?o.jsxs("div",{className:"composer-command-empty",children:[o.jsx(qo,{className:"spin"})," 正在发现当前工作区的 Skills…"]}):F!=null&&F.modelMode&&f?o.jsxs("div",{className:"composer-command-empty",children:[o.jsx(qo,{className:"spin"})," 正在读取模型…"]}):M.length===0?o.jsx("div",{className:"composer-command-empty",children:A?"当前工作区没有匹配的 Skill":F!=null&&F.modelMode?"没有匹配模型,也可以直接输入模型 ID":"没有匹配的快捷命令"}):o.jsx("div",{className:"composer-command-list",children:M.map((V,W)=>{const q=V.kind==="command"?`command:${V.command.name}`:V.kind==="model"?`model:${V.model.id}`:`skill:${V.skill.id}`,ue=V.kind==="command"?V.command.usage:V.kind==="model"?V.model.displayName:`$${V.skill.name}`,pe=V.kind==="command"?V.command.description:V.kind==="model"?V.model.description||V.model.id:V.skill.description||"加载并执行该 Skill";return o.jsxs("button",{type:"button",role:"option","aria-selected":W===j,className:`composer-command-item${W===j?" is-active":""}`,onMouseDown:we=>{we.preventDefault(),J(V)},onMouseEnter:()=>L(W),children:[o.jsx("span",{className:`composer-command-icon composer-command-icon--${V.kind}`,"aria-hidden":"true",children:V.kind==="command"?"/":V.kind==="model"?"◇":"$"}),o.jsxs("span",{className:"composer-command-copy",children:[o.jsx("strong",{children:ue}),o.jsx("span",{children:pe})]}),W===j?o.jsx("kbd",{children:"↵"}):null]},q)})})]}):null,o.jsxs("div",{className:"composer-left-controls",children:[o.jsxs("div",{className:"composer-menu-wrap",children:[o.jsx("button",{type:"button",className:"comp-icon",title:"添加","aria-label":"添加",disabled:i,onClick:()=>I(V=>!V),children:o.jsx(FRe,{className:"icon"})}),C?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>I(!1)}),o.jsxs("div",{className:"composer-menu",role:"menu",children:[o.jsxs("button",{type:"button",className:"menu-item",disabled:u.uploadBusy,onClick:()=>U(S),children:[o.jsx(HRe,{className:"icon"}),"上传图片"]}),o.jsxs("button",{type:"button",className:"menu-item",disabled:u.uploadBusy,onClick:()=>U(k),children:[o.jsx(zRe,{className:"icon"}),"上传文档或 PDF"]}),o.jsxs("button",{type:"button",className:"menu-item",disabled:u.uploadBusy,onClick:()=>U(T),children:[o.jsx(VRe,{className:"icon"}),"上传视频"]}),o.jsx("div",{className:"composer-menu-separator",role:"separator"}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>{I(!1),u.onOpenTerminal()},children:[o.jsx(WV,{className:"icon"}),"进入终端"]}),o.jsxs("button",{type:"button",className:"menu-item",onClick:()=>{I(!1),u.onOpenBrowser()},children:[o.jsx(XV,{className:"icon"}),"查看浏览器"]})]})]}):null]}),o.jsx("button",{type:"button",className:"comp-icon sandbox-composer-control",title:"Codex 权限","aria-label":"Codex 权限",disabled:u.settingsBusy||r,onClick:u.onOpenPermissions,children:o.jsx(G2,{})}),o.jsx("button",{type:"button",className:`comp-icon sandbox-composer-control${u.workspaceLocked?" is-locked":""}`,title:u.workspaceLocked?"对话已开始,工作空间已锁定":"选择工作空间","aria-label":"Codex 工作空间",disabled:u.settingsBusy||r,onClick:u.onOpenWorkspace,children:o.jsx(ty,{})})]}),o.jsxs("div",{className:"composer-input-stack sandbox-composer-input",children:[x.length>0?o.jsx(H1,{skillPrefix:"$",value:{skills:x.map(({name:V,description:W})=>({name:V,description:W}))},onRemoveSkill:V=>w(x.filter(W=>W.name!==V))}):null,o.jsx("textarea",{ref:_,className:"comp-input scroll",rows:1,value:t,disabled:i,placeholder:"向 AgentKit 沙箱发送消息,输入 / 查看命令,输入 $ 调用 Skill…","aria-expanded":P,onChange:V=>Y(V.target.value),onBlur:()=>window.setTimeout(()=>D(!0),0),onKeyDown:V=>{if(!a2(V.nativeEvent)){if(P){if((V.key==="ArrowDown"||V.key==="Tab"&&!V.shiftKey)&&M.length>0){V.preventDefault(),L(W=>(W+1)%M.length);return}if((V.key==="ArrowUp"||V.key==="Tab"&&V.shiftKey)&&M.length>0){V.preventDefault(),L(W=>(W-1+M.length)%M.length);return}if(V.key==="Enter"&&!V.shiftKey&&M[j]){V.preventDefault(),J(M[j]);return}if(V.key==="Escape"){V.preventDefault(),D(!0);return}}if(V.key==="Backspace"&&!t&&V.currentTarget.selectionStart===0&&x.length>0){V.preventDefault(),w(x.slice(0,-1));return}V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),R&&s(t))}}})]}),o.jsx("button",{type:"button",className:"comp-send",disabled:!R,onClick:()=>s(t),"aria-label":"发送",children:r?o.jsx(qo,{className:"icon spin"}):o.jsx($Re,{className:"icon"})})]}),o.jsx("input",{ref:S,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:te}),o.jsx("input",{ref:k,type:"file",accept:".txt,.md,.markdown,.pdf,text/plain,text/markdown,application/pdf",multiple:!0,hidden:!0,onChange:te}),o.jsx("input",{ref:T,type:"file",accept:"video/mp4,video/webm,video/quicktime",multiple:!0,hidden:!0,onChange:te})]})}function bOe({session:e,conversationBusy:t,onInputChange:n,onSessionPatch:s,onSnapshot:i,onActivity:r,onError:a}){const l=g.useRef((e==null?void 0:e.id)??"");l.current=(e==null?void 0:e.id)??"";const[c,u]=g.useState(!1),[d,f]=g.useState([]),[h,p]=g.useState(!1),[m,b]=g.useState(!1),[v,y]=g.useState([]),[x,E]=g.useState(!1),[w,_]=g.useState(!1),[S,k]=g.useState([]),[T,C]=g.useState(!1),[I,j]=g.useState([]),[L,z]=g.useState(!1),[D,F]=g.useState("");g.useEffect(()=>{u(!1),f([]),p(!1),b(!1),y([]),E(!1),_(!1),k([]),C(!1),j([]),z(!1),F("")},[e==null?void 0:e.id]);const A=g.useCallback(async()=>{const U=l.current;if(!U)return[];p(!0);try{const te=await rn.listModels(U);return l.current===U&&(f(te),b(!0)),te}catch(te){return l.current===U&&(b(!0),a(te instanceof Error?te.message:String(te))),[]}finally{l.current===U&&p(!1)}},[a]),M=g.useCallback(async()=>{const U=l.current;if(!U)return[];E(!0);try{const te=await rn.listSkills(U);return l.current===U&&(y(te),_(!0)),te}catch(te){return l.current===U&&(_(!0),a(te instanceof Error?te.message:String(te))),[]}finally{l.current===U&&E(!1)}},[a]),P=g.useCallback(async()=>{const U=l.current;if(U){C(!0),z(!0),F("");try{const te=await rn.listThreads(U);l.current===U&&j(te.threads)}catch(te){l.current===U&&F(te instanceof Error?te.message:String(te))}finally{l.current===U&&z(!1)}}},[]);function H(U){i(U),k([]),y([]),_(!1),C(!1)}async function R(U){const te=l.current;if(!(!te||c||t)){if(U===(e==null?void 0:e.threadId)){C(!1);return}u(!0),a("");try{const K=await rn.resumeThread(te,U);if(l.current!==te)return;H(K),r("已恢复 Codex 对话",[{label:"Thread",value:K.threadId,code:!0}])}catch(K){l.current===te&&a(K instanceof Error?K.message:String(K))}finally{l.current===te&&u(!1)}}}async function Y(U){const te=e,K=U.trim();if(!K.startsWith("/"))return!1;if(!te||t||c)return!0;const V=cOe(K),W=V&&uE.find(q=>q.name===V.name);if(!V||!W)return a(`未知快捷命令:${K.split(/\s/,1)[0]}。输入 /help 查看可用命令。`),!0;if(a(""),k([]),W.name==="model"&&!V.argument)return n("/model "),m||await A(),!0;if(W.name==="skill"||W.name==="skills")return n("$"),w||(await M()).length===0&&n(""),!0;if(W.name==="resume"&&!V.argument)return n(""),await P(),!0;n(""),u(!0);try{if(W.name==="model"){const q=await rn.setModel(te.id,V.argument);if(l.current!==te.id)return!0;s({model:q}),r("已切换 Codex 模型",[{label:"模型",value:q,code:!0}])}else if(W.name==="models"){const q=m?d:await A();if(l.current!==te.id)return!0;r(q.length>0?"Codex 可用模型":"当前没有可用模型",hOe(q,te.model))}else if(W.name==="new"||W.name==="clear"){const q=await rn.newThread(te.id);if(l.current!==te.id)return!0;H(q),r("已新建 Codex 对话",[{label:"Thread",value:q.threadId,code:!0}])}else if(W.name==="resume"){const q=await rn.resumeThread(te.id,V.argument);if(l.current!==te.id)return!0;H(q),r("已恢复 Codex 对话",[{label:"Thread",value:q.threadId,code:!0}])}else if(W.name==="fork"){const q=await rn.forkThread(te.id);if(l.current!==te.id)return!0;H(q),r("已分叉 Codex 对话",[{label:"Thread",value:q.threadId,code:!0}])}else if(W.name==="compact"){if(await rn.compactThread(te.id),l.current!==te.id)return!0;r("已开始压缩当前 Codex 对话",[{label:"Thread",value:te.threadId,code:!0}])}else if(W.name==="archive"){const q=te.threadId,ue=await rn.archiveThread(te.id,q);if(l.current!==te.id)return!0;ue.snapshot&&H(ue.snapshot),r("已归档 Codex 对话",[{label:"Thread",value:q,code:!0}])}else if(W.name==="status"){const q=await rn.getStatus(te.id);if(l.current!==te.id)return!0;s(q),r("Codex 当前状态",pOe(q))}else W.name==="help"&&r("Sandbox 支持的 Codex 快捷命令",fOe())}catch(q){l.current===te.id&&(n(K),a(q instanceof Error?q.message:String(q)))}finally{l.current===te.id&&u(!1)}return!0}function J(){y([]),_(!1),k([])}return{commandBusy:c,models:d,modelsLoading:h,modelsLoaded:m,loadModels:A,skills:v,skillsLoading:x,skillsLoaded:w,loadSkills:M,selectedSkills:S,setSelectedSkills:k,invalidateSkills:J,threadsOpen:T,threads:I,threadsLoading:L,threadsError:D,openThreads:P,closeThreads:()=>{c||(C(!1),F(""))},resumeThread:R,executeSlash:Y}}function yOe(e){return e.toLowerCase()==="github"?o.jsx(dee,{className:"icon"}):o.jsx(gee,{className:"icon"})}function xOe({branding:e,onUsername:t}){const[n,s]=g.useState(null),[i,r]=g.useState(""),[a,l]=g.useState(0),[c,u]=g.useState(""),d=g.useRef(null);g.useEffect(()=>{let m=!0;return s(null),r(""),NB().then(b=>{m&&s(b)}).catch(b=>{m&&r(b instanceof Error?b.message:String(b))}),()=>{m=!1}},[a]);const f=n!==null&&n.length===0;g.useEffect(()=>{var m;f&&((m=d.current)==null||m.focus())},[f]);const h=Fee.test(c),p=()=>{h&&t(c)};return o.jsxs("div",{className:"login",children:[o.jsx("header",{className:"login-top",children:o.jsxs("span",{className:"login-brand",children:[o.jsx("img",{className:"login-brand-logo",src:e.logoUrl||qk,width:20,height:20,alt:"","aria-hidden":!0}),e.title]})}),o.jsx("main",{className:"login-main",children:o.jsxs("div",{className:"login-card",children:[o.jsx(Ta,{as:"h1",className:"login-title",duration:4.8,spread:22,children:e.title}),i?o.jsxs("div",{className:"login-provider-error",role:"alert",children:[o.jsx("p",{children:i}),o.jsx("button",{type:"button",onClick:()=>l(m=>m+1),children:"重试"})]}):n===null?null:n.length>0?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"login-sub",children:"登录以继续使用"}),o.jsx("div",{className:"login-providers",children:n.map(m=>o.jsxs("button",{className:"login-btn",onClick:()=>Hee(m.loginUrl),children:[yOe(m.id),o.jsxs("span",{children:["使用 ",m.label," 登录"]})]},m.id))})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"login-sub",children:"输入一个用户名即可开始"}),o.jsxs("form",{className:"login-name",onSubmit:m=>{m.preventDefault(),p()},children:[o.jsx("input",{ref:d,className:"login-name-input",value:c,onChange:m=>u(m.target.value),placeholder:"用户名(字母 + 数字,最多 16 位)",maxLength:16}),o.jsx("button",{type:"submit",className:"login-name-go",disabled:!h,"aria-label":"进入",children:o.jsx(Dp,{className:"icon"})})]}),o.jsx("p",{className:"login-hint","aria-live":"polite",children:c&&!h?"只能包含大小写字母和数字,最多 16 位。":""})]}),o.jsx("p",{className:"login-powered",children:"火山引擎 AgentKit 提供企业级 Agent 解决方案"}),o.jsxs("p",{className:"login-legal",children:["继续即表示你已阅读并同意 AgentKit"," ",o.jsx("a",{href:"https://docs.volcengine.com/docs/86681/1925174?lang=zh",target:"_blank",rel:"noreferrer",children:"产品和服务条款"})]})]})}),o.jsx("footer",{className:"login-footer",children:"© 2026 VeADK. All rights reserved."})]})}function EOe({open:e,checking:t,error:n,onLogin:s}){const i=g.useRef(null);return g.useEffect(()=>{var a;if(!e)return;const r=document.body.style.overflow;return document.body.style.overflow="hidden",(a=i.current)==null||a.focus(),()=>{document.body.style.overflow=r}},[e]),e?hi.createPortal(o.jsx("div",{className:"auth-expired-backdrop",children:o.jsxs("section",{className:"auth-expired-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"auth-expired-title","aria-describedby":"auth-expired-description",children:[o.jsx("div",{className:"auth-expired-mark","aria-hidden":"true",children:o.jsx(kk,{})}),o.jsxs("div",{className:"auth-expired-copy",children:[o.jsx("h2",{id:"auth-expired-title",children:"登录状态已过期"}),o.jsx("p",{id:"auth-expired-description",children:"当前编辑内容会保留。重新登录后,刚才的操作将自动继续。"}),n&&o.jsx("p",{className:"auth-expired-error",role:"alert",children:n})]}),o.jsx("footer",{className:"auth-expired-actions",children:o.jsx("button",{ref:i,type:"button",onClick:s,disabled:t,children:t?"等待登录完成…":"重新登录"})})]})}),document.body):null}const vOe=[{value:"slow",label:"执行速度慢"},{value:"crash",label:"运行崩溃"},{value:"incorrect",label:"结果不准确"},{value:"tool_error",label:"工具调用失败"},{value:"other",label:"其他问题"}];function wOe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"m7 7 10 10"}),o.jsx("path",{d:"m17 7-10 10"})]})}function SOe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5 12.5 4.2 4.2L19 7"})})}function _Oe({onClose:e,onSubmit:t}){const n=g.useId(),s=g.useId(),i=g.useRef(null),r=g.useRef(null),a=g.useRef(!1),l=g.useRef(e),[c,u]=g.useState(()=>new Set),[d,f]=g.useState(""),[h,p]=g.useState(!1),[m,b]=g.useState(""),[v,y]=g.useState(!1);a.current=h,l.current=e,g.useEffect(()=>{var T;const _=document.body.style.overflow,S=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(T=r.current)==null||T.focus();const k=C=>{var z;if(C.key==="Escape"&&!a.current){C.preventDefault(),l.current();return}if(C.key!=="Tab")return;const I=Array.from(((z=i.current)==null?void 0:z.querySelectorAll("button:not(:disabled), textarea:not(:disabled)"))??[]);if(I.length===0)return;const j=I[0],L=I[I.length-1];C.shiftKey&&document.activeElement===j?(C.preventDefault(),L.focus()):!C.shiftKey&&document.activeElement===L&&(C.preventDefault(),j.focus())};return window.addEventListener("keydown",k),()=>{document.body.style.overflow=_,window.removeEventListener("keydown",k),S!=null&&S.isConnected&&S.focus()}},[]);const x=_=>{u(S=>{const k=new Set(S);return k.has(_)?k.delete(_):k.add(_),k})},E=async()=>{if(!(h||v)){p(!0),b("");try{await t({issues:[...c],description:d.trim()}),y(!0)}catch(_){b(_ instanceof Error?_.message:String(_))}finally{p(!1)}}},w=c.size>0||d.trim().length>0;return hi.createPortal(o.jsx("div",{className:"issue-feedback-backdrop",onMouseDown:_=>{_.target===_.currentTarget&&!h&&e()},children:o.jsxs("section",{ref:i,className:"issue-feedback-dialog",role:"dialog","aria-modal":"true","aria-labelledby":n,"aria-describedby":v?`${s}-success`:s,"aria-busy":h||void 0,children:[o.jsxs("header",{className:"issue-feedback-head",children:[o.jsx("h2",{id:n,children:"问题反馈"}),o.jsx("button",{type:"button",className:"issue-feedback-close",onClick:e,disabled:h,"aria-label":"关闭问题反馈",children:o.jsx(wOe,{})})]}),v?o.jsxs("div",{className:"issue-feedback-success",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"issue-feedback-success-mark","aria-hidden":"true",children:o.jsx(SOe,{})}),o.jsxs("div",{children:[o.jsx("h3",{children:"上报成功,感谢您的反馈"}),o.jsx("p",{id:`${s}-success`,children:"AgentKit 团队会尽快查看您提交的问题。"})]})]}):o.jsxs("div",{className:"issue-feedback-body",children:[o.jsx("p",{id:s,className:"issue-feedback-intro",children:"请选择遇到的问题,也可以补充具体表现。"}),o.jsx("p",{className:"issue-feedback-privacy",role:"alert",children:"您的对话数据将会上报到 AgentKit 团队,请注意隐私保护。"}),o.jsx("div",{className:"issue-feedback-chips","aria-label":"常见问题",children:vOe.map(_=>o.jsx("button",{type:"button",className:"issue-feedback-chip","aria-pressed":c.has(_.value),onClick:()=>x(_.value),disabled:h,children:_.label},_.value))}),o.jsxs("label",{className:"issue-feedback-field",children:[o.jsx("span",{children:"问题描述"}),o.jsx("textarea",{ref:r,value:d,onChange:_=>f(_.target.value),placeholder:"请描述问题发生时的表现(选填)",maxLength:4e3,rows:5,disabled:h})]}),m&&o.jsx("p",{className:"issue-feedback-error",role:"alert",children:m})]}),o.jsx("footer",{className:"issue-feedback-actions",children:v?o.jsx("button",{type:"button",className:"is-primary",onClick:e,children:"完成"}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",onClick:e,disabled:h,children:"取消"}),o.jsx("button",{type:"button",className:"is-primary",onClick:()=>void E(),disabled:!w||h,children:h?"正在上报…":"提交反馈"})]})})]})}),document.body)}const NOe=[{value:"conversation",label:"对话"},{value:"agents",label:"智能体"},{value:"applications",label:"自动化"},{value:"search",label:"搜索"},{value:"other",label:"其他"}],TOe=[{value:"page_slow",label:"页面加载慢"},{value:"feature_unavailable",label:"功能无法使用"},{value:"display_error",label:"页面显示异常"},{value:"no_response",label:"操作无响应"},{value:"other",label:"其他问题"}],kOe=["点击后没有反应","页面一直处于加载状态","部分内容显示不完整","操作后出现错误提示"];function AOe(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5 12.5 4.2 4.2L19 7"})})}function COe({initialModule:e,onSubmit:t}){const n=g.useRef(null),[s,i]=g.useState(()=>new Set),[r,a]=g.useState(e),[l,c]=g.useState(""),[u,d]=g.useState(!1),[f,h]=g.useState(""),[p,m]=g.useState(!1),b=E=>{i(w=>{const _=new Set(w);return _.has(E)?_.delete(E):_.add(E),_})},v=E=>{var w;c(_=>_.trim()?_.includes(E)?_:`${_.trimEnd()} +${E}`:E),(w=n.current)==null||w.focus()},y=async E=>{if(E.preventDefault(),!(u||p)){d(!0),h("");try{await t({module:r,issues:[...s],description:l.trim()}),m(!0)}catch(w){h(w instanceof Error?w.message:String(w))}finally{d(!1)}}},x=s.size>0||l.trim().length>0;return o.jsxs("div",{className:"platform-feedback-page",children:[o.jsxs("header",{className:"platform-feedback-header",children:[o.jsx("h1",{children:"问题反馈"}),o.jsx("p",{children:"告诉我们您在使用 AgentKit Studio 时遇到的问题。"})]}),o.jsx("div",{className:"platform-feedback-scroll",children:p?o.jsxs("section",{className:"platform-feedback-success","aria-labelledby":"feedback-success-title","aria-live":"polite",role:"status",children:[o.jsx("span",{className:"platform-feedback-success-icon","aria-hidden":"true",children:o.jsx(AOe,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:"feedback-success-title",children:"上报成功,感谢您的反馈"}),o.jsx("p",{children:"AgentKit 团队会尽快查看您提交的问题。"})]})]}):o.jsxs("form",{className:"platform-feedback-form",onSubmit:E=>void y(E),children:[o.jsxs("section",{className:"platform-feedback-section",children:[o.jsx("div",{className:"platform-feedback-section-heading",children:o.jsx("h2",{children:"所属模块"})}),o.jsx("div",{className:"platform-feedback-pills","aria-label":"所属模块",children:NOe.map(E=>o.jsx("button",{type:"button","aria-pressed":r===E.value,onClick:()=>a(E.value),disabled:u,children:E.label},E.value))})]}),o.jsx("section",{className:"platform-feedback-section",children:o.jsxs("div",{className:"platform-feedback-suggestions",children:[o.jsx("span",{children:"常见问题(可多选)"}),o.jsx("div",{className:"platform-feedback-pills","aria-label":"问题类型",children:TOe.map(E=>o.jsx("button",{type:"button","aria-pressed":s.has(E.value),onClick:()=>b(E.value),disabled:u,children:E.label},E.value))})]})}),o.jsxs("section",{className:"platform-feedback-section",children:[o.jsxs("label",{className:"platform-feedback-field",children:[o.jsx("span",{children:"问题描述"}),o.jsx("textarea",{ref:n,value:l,onChange:E=>c(E.target.value),placeholder:"请描述问题发生时的页面、操作和表现",maxLength:4e3,rows:6,disabled:u})]}),o.jsxs("div",{className:"platform-feedback-suggestions",children:[o.jsx("span",{children:"快捷补充"}),o.jsx("div",{className:"platform-feedback-pills","aria-label":"问题描述推荐",children:kOe.map(E=>o.jsx("button",{type:"button",onClick:()=>v(E),disabled:u,children:E},E))})]})]}),o.jsx("p",{className:"platform-feedback-privacy",role:"alert",children:"您的数据将会上报到 AgentKit 团队,请注意隐私保护。"}),f&&o.jsx("p",{className:"platform-feedback-error",role:"alert",children:f}),o.jsx("div",{className:"platform-feedback-actions",children:o.jsx("button",{type:"submit",disabled:!x||u,children:u?"正在上报…":"提交反馈"})})]})})]})}function IOe({node:e,ctx:t}){const n=e.variant??"default";return o.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)})}Iu("Button",IOe);function jOe({node:e,ctx:t}){return o.jsx("div",{className:"a2ui-card","data-a2ui-id":e.id,"data-a2ui-component":e.component,children:t.render(e.child)})}Iu("Card",jOe);const ROe={start:"flex-start",center:"center",end:"flex-end",spaceBetween:"space-between",spaceAround:"space-around",spaceEvenly:"space-evenly",stretch:"stretch"},OOe={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"};function QV(e){return ROe[e]??"flex-start"}function ZV(e){return OOe[e]??"stretch"}function MOe({node:e,ctx:t}){const n=e.children??[];return o.jsx("div",{className:"a2ui-column","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"column",justifyContent:QV(e.justify),alignItems:ZV(e.align)},children:n.map(s=>t.render(s))})}Iu("Column",MOe);function LOe({node:e}){const t=e.axis==="vertical";return o.jsx("div",{className:`a2ui-divider ${t?"a2ui-divider--v":"a2ui-divider--h"}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component})}Iu("Divider",LOe);const DOe={send:"✈️",check:"✅",close:"✖️",star:"⭐",favorite:"❤️",info:"ℹ️",help:"❓",error:"⛔",calendarToday:"📅",event:"📅",schedule:"🕒",locationOn:"📍",accountCircle:"👤",mail:"✉️",call:"📞",home:"🏠",settings:"⚙️",search:"🔍"};function POe({node:e}){const t=e.name??"";return o.jsx("span",{className:"a2ui-icon",title:t,"aria-label":t,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:DOe[t]??"•"})}Iu("Icon",POe);function BOe({node:e,ctx:t}){const n=e.children??[];return o.jsx("div",{className:"a2ui-row","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"row",justifyContent:QV(e.justify),alignItems:ZV(e.align??"center")},children:n.map(s=>t.render(s))})}Iu("Row",BOe);const UOe=new Set(["h1","h2","h3","h4","h5"]);function FOe({node:e,ctx:t}){const n=e.variant??"body",s=t.resolveString(e.text),i=UOe.has(n)?n:"p";return o.jsx(i,{className:`a2ui-text a2ui-text--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:s})}Iu("Text",FOe);function $Oe(e){return e==="agents"?"agents":e==="applications"?"applications":e==="search"?"search":["conversation","new-chat","sandbox"].includes(e)?"conversation":"other"}async function Qw(e){const[t,n,s]=await Promise.allSettled([RRe(),ORe(),zk(e)]);return{agentId:e,ready:!0,harnessEnabled:s.status==="fulfilled",builtinTools:s.status==="fulfilled"?s.value:[],temporaryEnabled:t.status==="fulfilled"&&t.value.enabled,skillCreateEnabled:n.status==="fulfilled"&&n.value.enabled}}const pa={app:"veadk.appName",view:"veadk.view",session:"veadk.sessionId"},HOe=600,zOe=1e3,VOe=5e3,GOe=500,KOe=new Set,qOe=[];function Va(){return{skills:[]}}function Zw(e){return`${oE(e)}.active`}function VN(e){return`veadk.agentOrder.${encodeURIComponent(e)}`}function YOe(e){if(!e)return[];try{const t=JSON.parse(localStorage.getItem(VN(e))||"[]");return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function GN(e,t){if(e.name===t||e.id===t)return e;for(const n of e.children){const s=GN(n,t);if(s)return s}}function JV(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(...JV(n)));return t}function SD(){const e=typeof localStorage<"u"?localStorage.getItem(pa.view):null;return e==="menu"||e==="intelligent"||e==="custom"||e==="template"||e==="workflow"?e:null}function WOe({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"3.75",y:"3.75",width:"16.5",height:"16.5",rx:"3.25"}),o.jsx("path",{d:"M12 8.5v7M8.5 12h7"}),o.jsx("path",{d:"M6.75 6.75h1M16.25 17.25h1",opacity:"0.6"})]})}function XOe({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"3.5",y:"5",width:"17",height:"14.75",rx:"2.25"}),o.jsx("path",{d:"M3.5 9h17M9.25 12.25 7.1 14.4l2.15 2.15M14.75 12.25l2.15 2.15-2.15 2.15M12.8 11.85l-1.6 5.1"})]})}function QOe({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"2.75",y:"5",width:"6.5",height:"14",rx:"1.6"}),o.jsx("path",{d:"M5.25 8.5h1.5M5.25 11.5h1.5"}),o.jsx("rect",{x:"14.75",y:"5",width:"6.5",height:"14",rx:"1.6"}),o.jsx("path",{d:"M17.25 15.5h1.5M17.25 12.5h1.5M8.75 12h6.5m-2.5-2.5 2.5 2.5-2.5 2.5"})]})}function ZOe(){return o.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":!0,children:[o.jsx("rect",{x:"3",y:"4",width:"14",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none"}),o.jsx("rect",{x:"6",y:"10.4",width:"13",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.7"}),o.jsx("rect",{x:"9",y:"16.8",width:"9",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.45"})]})}function KN(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 JOe(e){if(!e)return"";const t=[];return e.ts&&t.push(KN(e.ts)),e.tokens!=null&&t.push(`${e.tokens.toLocaleString()} tokens`),t.join(" · ")}function Oc(e){return e.blocks.map(t=>t.kind==="text"?t.text:"").join("").trim()}function _D(e,t){for(let n=t-1;n>=0;n-=1)if(e[n].role==="user")return Oc(e[n]);return""}const eMe="send_a2ui_json_to_client";function tMe(e){return e.blocks.some(t=>t.kind==="text"?t.text.trim().length>0:t.kind==="attachment"||t.kind==="artifact"?t.files.length>0:t.kind==="tool"?!(t.name===eMe&&t.done):t.kind==="agent-transfer"?!1:t.kind==="a2ui"?oH(t.messages).some(n=>n.components[n.rootId]):t.kind==="auth")}function nMe(e){return e.blocks.some(t=>t.kind==="auth"&&!t.done)}function sMe(e){return new Promise((t,n)=>{let s="";try{s=new URL(e,window.location.href).protocol}catch{}if(s!=="http:"&&s!=="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 r=!1;const a=()=>{clearInterval(u),window.removeEventListener("message",c)},l=d=>{if(!r){r=!0,a();try{i.close()}catch{}t(d)}},c=d=>{if(d.origin!==window.location.origin)return;const f=d.data;f&&f.veadkOAuth&&typeof f.url=="string"&&l(f.url)};window.addEventListener("message",c);const u=setInterval(()=>{if(!r){if(i.closed){a();const d=window.prompt("授权完成后,请粘贴回调页面(浏览器地址栏)的完整 URL:");d&&d.trim()?(r=!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)&&l(d)}catch{}}},500)})}function iMe(e,t){const n=JSON.parse(JSON.stringify(e??{})),s=n.exchangedAuthCredential??n.exchanged_auth_credential??{},i=s.oauth2??{};return i.authResponseUri=t,i.auth_response_uri=t,s.oauth2=i,n.exchangedAuthCredential=s,n}function ND({text:e}){const[t,n]=g.useState(!1);return o.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?o.jsx(ja,{className:"icon"}):o.jsx(e1,{className:"icon"})})}const TD=["今天想做点什么?","有什么可以帮你的?","需要我帮你查点什么吗?","有问题尽管问我","嗨,我们开始吧","开始一段新对话吧","今天想先解决哪件事?","把你的想法告诉我吧","我们从哪里开始?","有什么任务交给我?","准备好一起推进了吗?","说说你现在最关心的问题","今天也一起把事情做好","我在,随时可以开始"],kD=()=>TD[Math.floor(Math.random()*TD.length)];function Jw(e){var t;for(const n of e)(t=n.previewUrl)!=null&&t.startsWith("blob:")&&URL.revokeObjectURL(n.previewUrl)}function AD(){return`draft-${Date.now()}-${Math.random().toString(36).slice(2)}`}function CD(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"}const rMe={"read-only":"只读","workspace-write":"工作区写入","danger-full-access":"完全访问"},aMe={untrusted:"仅不可信命令","on-request":"按需审批",never:"不审批"},oMe={user:"由我审批",auto_review:"自动审查"};function lMe(e,t){const n=e.kind==="file"?"文件修改":"命令执行";return t==="accept"?`已允许本次${n}`:t==="acceptForSession"?`已在本会话中允许${n}`:t==="decline"?`已拒绝${n}`:`已取消${n}审批`}function cMe(e){var n,s,i;const t=[];return(n=e.command)!=null&&n.trim()&&t.push({label:"命令",value:e.command.trim(),code:!0}),(s=e.grantRoot)!=null&&s.trim()&&t.push({label:"授权路径",value:e.grantRoot.trim(),code:!0}),(i=e.cwd)!=null&&i.trim()&&t.push({label:"执行目录",value:e.cwd.trim(),code:!0}),t}function ID(e){return e.flatMap(t=>t.apps.map(n=>so(t.id,n)))}function uMe(e,t){var n;return((n=e.find(s=>s.runtimeId&&s.apps.some(i=>so(s.id,i)===t)))==null?void 0:n.runtimeId)??""}function dMe(e,t){for(const n of e){const s=n.apps.find(i=>so(n.id,i)===t);if(s&&n.runtimeId)return{runtimeId:n.runtimeId,region:n.region??"cn-beijing",appName:s}}return null}function fMe(){const[e,t]=g.useState([]),[n,s]=g.useState(""),[i,r]=g.useState([]),[a,l]=g.useState(""),c=g.useRef(null),[u,d]=g.useState(!1),[f,h]=g.useState([]),[p,m]=g.useState(null),[b,v]=g.useState([]),[y,x]=g.useState(!1),[E,w]=g.useState(!1),[_,S]=g.useState(""),[k,T]=g.useState(!1),[C,I]=g.useState(!1),[j,L]=g.useState(null),[z,D]=g.useState(null),[F,A]=g.useState(!1),[M,P]=g.useState(""),[H,R]=g.useState(null),[Y,J]=g.useState(!1),[U,te]=g.useState(""),[K,V]=g.useState(!1),[W,q]=g.useState(!1),[ue,pe]=g.useState("confirm"),[we,de]=g.useState(""),[ge,Le]=g.useState("codex"),[Ee,ie]=g.useState(!1),[Ne,ve]=g.useState(0),[Qe,De]=g.useState(null),[Ke,Se]=g.useState(null),He=g.useRef(null),Be=g.useRef(null),qe=g.useRef((p==null?void 0:p.id)??""),Z=g.useRef(""),ae=g.useRef(0),ne=g.useRef(new Set);qe.current=(p==null?void 0:p.id)??"",g.useEffect(()=>()=>{for(const O of ne.current)URL.revokeObjectURL(O);ne.current.clear()},[]);function xe(O){const B=URL.createObjectURL(O);return ne.current.add(B),B}function Fe(O){!O||!ne.current.delete(O)||URL.revokeObjectURL(O)}function at(){for(const O of ne.current)URL.revokeObjectURL(O);ne.current.clear()}const[It,ft]=g.useState({}),fn=a?It[a]??[]:f,Et=p?b:fn,Nt=(O,B)=>ft(Q=>({...Q,[O]:typeof B=="function"?B(Q[O]??[]):B}));function Qt(O,B,Q=[],le=""){if(qe.current!==O)return;const be=crypto.randomUUID(),_e={role:"system",blocks:[],activity:{id:be,title:B,...Q.length>0?{details:Q}:{}},meta:{localId:be,ts:Date.now()/1e3}};v(Ye=>{if(!le)return[...Ye,_e];const $e=Ye.findIndex(tt=>{var it;return((it=tt.meta)==null?void 0:it.localId)===le});return $e<0?[...Ye,_e]:[...Ye.slice(0,$e),_e,...Ye.slice($e)]})}const[Ve,Tt]=g.useState(""),[rt,ut]=g.useState("agent"),[Ze,_t]=g.useState(null),[me,We]=g.useState({}),bt=g.useRef(new Map),an=!n||me.ready===!0&&me.agentId===n,[Kn,xt]=g.useState(null),[$t,hn]=g.useState(!1),cn=g.useRef(0),[Pt,jt]=g.useState([]),[Sn,pn]=g.useState(Va),[zt,Fn]=g.useState(null),[hs,ps]=g.useState(0),[Rn,$s]=g.useState(!1),[ms,$n]=g.useState(null),[Hs,Hn]=g.useState(!1),[js,_n]=g.useState([]),[ss,is]=g.useState(!1),_s=g.useRef(new Set),[gs,zs]=g.useState(()=>new Set),[bs,On]=g.useState(()=>new Set),[Nn,ce]=g.useState(()=>new Set),Ae=g.useRef(new Map),Re=g.useRef(new Map),Je=g.useRef(void 0),st=g.useRef(()=>{}),ot=(O,B)=>zs(Q=>{const le=new Set(Q);return B?le.add(O):le.delete(O),le}),kt=O=>{const B=Re.current.get(O);B!==void 0&&window.clearTimeout(B),Re.current.delete(O),On(Q=>new Set(Q).add(O))},Mn=O=>{const B=Re.current.get(O);B!==void 0&&window.clearTimeout(B);const Q=window.setTimeout(()=>{Re.current.delete(O),On(le=>{const be=new Set(le);return be.delete(O),be})},2400);Re.current.set(O,Q)},Tn=(O,B)=>{ce(Q=>{if(Q.has(O)===B)return Q;const le=new Set(Q);return le.delete(O),le})},qt=g.useRef(""),[pi,Pe]=g.useState(""),[Vt,vt]=g.useState(""),[qn,ys]=g.useState(()=>new Set),[aa,Da]=g.useState(null),[Js,mi]=g.useState(null),[oa,al]=g.useState(!1),[Wi,Mu]=g.useState(),[pc,re]=g.useState(kD),[wt,mn]=g.useState(null),[Ns,nn]=g.useState(!1),[Ts,se]=g.useState(!1),[Te,ze]=g.useState(""),et=g.useRef(!1),[gn,rs]=g.useState(null),[Me,Rs]=g.useState(""),[xs,Zt]=g.useState(),[mt,as]=g.useState(null),Bi=(mt==null?void 0:mt.capabilities.runtimeScope)??"mine",[uo,Lu]=g.useState({newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0}),[fo,Fg]=g.useState("cloud"),[Pa,gi]=g.useState(wm),[ho,bh]=g.useState(""),[$g,Hg]=g.useState(!1),[po,ei]=g.useState(!1),[dE,zg]=g.useState(!1),[Vg,Ba]=g.useState({}),[fE,Gg]=g.useState({}),[Kg,mo]=g.useState({}),qg=gs.has(a),go=bs.has(a),bo=qg||u,ol=!!a&&Hs,Ua=p?y:bo,Yg=Ua||!p&&go,Yn=bOe({session:p,conversationBusy:y,onInputChange:Tt,onSessionPatch:O=>{const B=qe.current;m(Q=>(Q==null?void 0:Q.id)===B?{...Q,...O}:Q)},onSnapshot:O=>{const B=qe.current;at(),v(mOe(O)),m(Q=>(Q==null?void 0:Q.id)===B?{...Q,threadId:O.threadId,cwd:O.cwd??Q.cwd,model:O.model??Q.model,workspaceLocked:O.workspaceLocked,permissions:O.permissions,busy:!1}:Q)},onActivity:(O,B=[])=>{const Q=qe.current;Q&&Qt(Q,O,B)},onError:Pe}),hE=Vg[a]??"",pE=fE[a]??KOe,mE=Kg[a]??qOe,Ui=zt==null?void 0:zt.graph,Wg=[zt==null?void 0:zt.name,Ui==null?void 0:Ui.name,Ui==null?void 0:Ui.id].filter(O=>!!O),Du=Sn.targetAgent&&Ui?GN(Ui,Sn.targetAgent.name):Ui,Xg=(Du==null?void 0:Du.skills)??(Sn.targetAgent?[]:(zt==null?void 0:zt.skills)??[]),Qg=Ui?JV(Ui):[];function yh(O){Jw(O);for(const B of O)B.status==="uploading"?_s.current.add(B.id):B.uri&&Db(n,B.uri).catch(Q=>Pe(String(Q)))}function Pu(){cn.current+=1;const O=Kn;xt(null),hn(!1),O&&!O.id.startsWith("pending-")&&bje(O.id).catch(B=>{Pe(B instanceof Error?B.message:String(B))})}async function Bu(O){try{await x_(n,Me,O),await y_(n,Me,O),r(B=>B.filter(Q=>Q.id!==O)),ft(B=>{const{[O]:Q,...le}=B;return le})}catch(B){Pe(String(B))}}function gE(O){const B=Pt.find(be=>be.id===O);if(!B)return;const Q=Pt.filter(be=>be.id!==O);Jw([B]),B.status==="uploading"&&_s.current.add(O),jt(Q),Q.length===0&&!Ve.trim()&&!!a&&Et.length===0?(qt.current="",l(""),Bu(a)):B.uri&&Db(n,B.uri).catch(be=>Pe(String(be)))}const Zg=(O,B)=>{var _e,Ye,$e,tt,it;const Q=B.author&&B.author!=="user"?B.author:void 0;Q&&(Ba(Ie=>({...Ie,[O]:Q})),Gg(Ie=>({...Ie,[O]:new Set(Ie[O]??[]).add(Q)})),mo(Ie=>{var ct;return(ct=Ie[O])!=null&&ct.length?Ie:{...Ie,[O]:[Q]}}));const le=((_e=B.actions)==null?void 0:_e.transferToAgent)??((Ye=B.actions)==null?void 0:Ye.transfer_to_agent);le&&mo(Ie=>{const ct=Ie[O]??[];return ct[ct.length-1]===le?Ie:{...Ie,[O]:[...ct,le]}}),((($e=B.actions)==null?void 0:$e.endOfAgent)??((tt=B.actions)==null?void 0:tt.end_of_agent)??((it=B.actions)==null?void 0:it.escalate))&&mo(Ie=>{const ct=Ie[O]??[];return ct.length<=1?Ie:{...Ie,[O]:ct.slice(0,-1)}})},[yo,Ht]=g.useState(SD),[Jg,e0]=g.useState([]),[bE,xh]=g.useState({}),Eh=g.useCallback(O=>{e0(B=>{const Q=B.findIndex(be=>be.id===O.id);if(Q===-1)return[O,...B];const le=[...B];return le[Q]={...le[Q],...O},le})},[]),[yE,t0]=g.useState(!0),[Uu,ti]=g.useState(!1),[vh,ks]=g.useState(!1),[wh,$]=g.useState(!1),[oe,fe]=g.useState(null),[Ce,nt]=g.useState([]),ht=g.useRef([]),bn=g.useRef(null),la=g.useRef(null),[un,fr]=g.useState([]),[Vs,Mr]=g.useState(""),hr=g.useRef(null),[xE,bi]=g.useState(!1),[Fu,yn]=g.useState(!1),[K2,EE]=g.useState(""),[eG,tG]=g.useState("good"),[nG,n0]=g.useState("basic"),[sG,iG]=g.useState("good"),[Sh,s0]=g.useState(""),[rG,aG]=g.useState(null),[ll,Es]=g.useState(!1),[mc,Lr]=g.useState(null),vE=g.useRef(null),[Fa,_h]=g.useState(()=>{const O=xa();return lh(O),O}),[oG,q2]=g.useState(!1),[lG,Y2]=g.useState(""),[W2,i0]=g.useState(null),[cG,X2]=g.useState({}),[uG,Q2]=g.useState(()=>new Set),[$u,ca]=g.useState(null),[r0,wE]=g.useState("cn-beijing"),[Z2,Fi]=g.useState(""),[J2,ki]=g.useState(""),[xn,Xi]=g.useState(null),[dG,SE]=g.useState(!1),a0=g.useRef(!1),Hu=g.useRef(!1),$a=g.useCallback(O=>{if(!Me)return!1;try{cD(localStorage,Me,O)}catch(B){return vt(B instanceof Error?B.message:"浏览器拒绝保存草稿,请稍后重试。"),!1}return ht.current=O,nt(O),vt(""),!0},[Me]),Ha=g.useCallback(O=>{var B;O&&((B=bn.current)==null?void 0:B.id)!==O||(bn.current=null,la.current!==null&&(window.clearTimeout(la.current),la.current=null))},[]),zu=g.useCallback(()=>{const O=bn.current;O&&(Ha(),$a([O,...ht.current.filter(B=>B.id!==O.id)]))},[Ha,$a]),fG=g.useCallback((O,B,Q)=>{!O||!Me||(bn.current&&bn.current.id!==O&&zu(),bn.current={id:O,draft:B,updatedAt:Date.now(),deploymentTarget:Q},la.current!==null&&window.clearTimeout(la.current),la.current=window.setTimeout(zu,HOe))},[zu,Me]),_E=g.useCallback(O=>{!O||!Me||(Ha(O),$a(ht.current.filter(B=>B.id!==O)))},[Ha,$a,Me]),eC=g.useCallback(O=>{if(!Me||O.length===0)return;const B=new Set(O.map(Q=>Q.id));bn.current&&B.has(bn.current.id)&&Ha(),$a(ht.current.filter(Q=>!B.has(Q.id))),xh(Q=>Object.fromEntries(Object.entries(Q).filter(([le])=>!B.has(le)))),B.has(Vs)&&(Mr(""),fe(null),ca(null),hr.current=null,localStorage.removeItem(Zw(Me)))},[Ha,$a,Vs,Me]),tC=g.useCallback(O=>{if(!O||!Me)return;Ha(O);const B=hr.current,Q=ht.current.filter(le=>le.id!==O);$a((B==null?void 0:B.id)===O?[B,...Q]:Q)},[Ha,$a,Me]);g.useEffect(()=>(window.addEventListener("pagehide",zu),()=>{window.removeEventListener("pagehide",zu)}),[zu]),g.useEffect(()=>{if(!Me){Ha(),ht.current=[],nt([]),fr([]),Mr(""),vt(""),hr.current=null;return}let O=[],B="";try{O=oje(localStorage,Me),localStorage.getItem(oE(Me))!==null&&cD(localStorage,Me,O),B=localStorage.getItem(Zw(Me))||"",vt("")}catch(le){vt(le instanceof Error?le.message:"无法读取本机草稿,请稍后重试。")}ht.current=O,nt(O),fr(YOe(Me));const Q=O.find(le=>le.id===B);hr.current=Q??null,yo==="custom"&&Q&&(Mr(Q.id),fe(Q.draft),ca(Q.deploymentTarget??null))},[Ha,Me]),g.useEffect(()=>{if(!Me)return;const O=Zw(Me);try{yo==="custom"&&Vs?localStorage.setItem(O,Vs):localStorage.removeItem(O)}catch{vt("浏览器拒绝保存当前草稿位置,请检查站点存储权限后重试。")}},[yo,Vs,Me]);const hG=g.useCallback(O=>{if(!Me)return;const B=[...new Set(O.filter(Boolean))];fr(B),localStorage.setItem(VN(Me),JSON.stringify(B))},[Me]),pG=g.useCallback(async O=>{const B=O.filter(tt=>!!tt.runtimeId&&tt.canDelete===!0);if(B.length===0)return;const Q=uMe(Fa,n),le=new Set(B.map(tt=>tt.runtimeId));Q2(tt=>{const it=new Set(tt);for(const Ie of le)it.add(Ie);return it}),tb(le);const be=new Set,_e=new Set,Ye=new Set,$e=[];for(const tt of B)try{if(!tt.region)throw new Error("Runtime 缺少地域信息,无法删除");await d8(tt.runtimeId,tt.region),gx(tt.runtimeId),be.add(tt.runtimeId),_e.add(tt.id)}catch(it){const Ie=it instanceof Error?it.message:String(it);Ye.add(tt.runtimeId),$e.push(`${tt.label}: ${Ie}`)}if(be.size>0&&(tb(be),_h(xa()),i0(it=>{if(!it)return it;const Ie=new Set(it);for(const ct of be)Ie.delete(ct);return Ie}),X2(it=>Object.fromEntries(Object.entries(it).filter(([Ie])=>!be.has(Ie)))),fr(it=>{const Ie=it.filter(ct=>!_e.has(ct));return Me&&localStorage.setItem(VN(Me),JSON.stringify(Ie)),Ie}),$a(ht.current.filter(it=>{var Ie;return!((Ie=it.deploymentTarget)!=null&&Ie.runtimeId)||!be.has(it.deploymentTarget.runtimeId)})),(Q?be.has(Q):B.some(it=>it.id===n))&&(MG(),Ht(null),ti(!1),ks(!1),$(!1),bi(!1),yn(!1),Xi(null),Fi(""),ki(""),Es(!0),Pe("")),xn!=null&&xn.runtime&&be.has(xn.runtime.runtimeId)&&(Ht(null),ti(!1),ks(!1),$(!1),bi(!1),yn(!1),Xi(null),Fi(""),ki(""),Es(!0),Pe(""))),Ye.size>0&&Q2(tt=>{const it=new Set(tt);for(const Ie of Ye)it.delete(Ie);return it}),$e.length>0){const tt=$e.slice(0,3).join(";"),it=$e.length>3?`;另有 ${$e.length-3} 个失败`:"";throw new Error(`${$e.length} 个 Agent 删除失败:${tt}${it}`)}},[xn,n,$a,Fa,Me]),NE=g.useCallback(async()=>{q2(!0),Y2("");try{const O=[];let B="";do{const Q=await l1({scope:Bi,region:"all",pageSize:100,nextToken:B});O.push(...Q.runtimes),B=Q.nextToken}while(B&&O.length<2e3);i0(new Set(O.map(Q=>Q.runtimeId))),X2(Object.fromEntries(O.map(Q=>[Q.runtimeId,{canDelete:Q.canDelete}])))}catch(O){Y2(O instanceof Error?O.message:String(O))}finally{q2(!1)}},[Bi]);function o0(O){console.log("create agent draft:",O),Ht(null),ul()}function TE(O,B){console.log("Agent added, navigating to:",O,B),_h(xa()),i0(null),tb(),_E(Vs),Mr(""),hr.current=null,ca(null),Fi(""),ki(O),n0("basic"),Ht(null),yn(!0),s(O)}const kE=g.useCallback(O=>{Ht(null),$(!1),Es(!1),Xi(null),yn(!0),ki(""),n0("basic"),Fi(O.id),Pe("")},[]),nC=g.useCallback(O=>{Vs&&xh(B=>({...B,[Vs]:O.id})),kE(O)},[Vs,kE]),sC=g.useCallback(async O=>{if(!O.runtimeId)throw new Error("部署完成,但未返回 Runtime ID。");const B=($u==null?void 0:$u.region)??r0,Q=await Xb(O.runtimeId,O.agentName,O.region??B,O.version);_h(xa()),ps(be=>be+1);const le=await Qw(Q);bt.current.set(Q,le),We(le),i0(be=>{const _e=new Set(be??[]);return _e.add(O.runtimeId),_e}),tb(),ca(null),_E(Vs),xh(be=>{if(!Vs||!be[Vs])return be;const _e={...be};return delete _e[Vs],_e}),Mr(""),hr.current=null,ki(Q),n0("basic"),Ht(null),yn(!0),s(Q)},[Vs,r0,_E,$u]),Nh=g.useRef(null),AE=g.useRef(new Map),gc=g.useRef(!0),cl=g.useRef(!1),bc=g.useRef(null),iC=g.useRef({key:"",turnCount:0}),CE=(p==null?void 0:p.id)??a;g.useLayoutEffect(()=>{const O=Nh.current,B=iC.current,Q=B.key!==CE,le=!Q&&Et.length>B.turnCount;if(iC.current={key:CE,turnCount:Et.length},!O||Et.length===0||!Q&&!le)return;gc.current=!0,cl.current=!1,bc.current!==null&&(window.clearTimeout(bc.current),bc.current=null);const be=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(Q||be){O.scrollTop=O.scrollHeight;return}cl.current=!0,O.scrollTo({top:O.scrollHeight,behavior:"smooth"}),bc.current=window.setTimeout(()=>{cl.current=!1,bc.current=null},450)},[CE,Et.length]),g.useLayoutEffect(()=>{const O=Nh.current;!O||!gc.current||cl.current||(O.scrollTop=O.scrollHeight)},[Ua,Et]),g.useEffect(()=>{if(!Sh||Fu||Et.length===0)return;const O=AE.current.get(Sh);if(!O)return;gc.current=!1,O.scrollIntoView({behavior:"smooth",block:"center"});const B=window.setTimeout(()=>{s0("")},2600);return()=>window.clearTimeout(B)},[Sh,Fu,Et]),g.useEffect(()=>()=>{bc.current!==null&&window.clearTimeout(bc.current)},[]);const mG=g.useCallback(()=>{const O=Nh.current;!O||cl.current||(gc.current=O.scrollHeight-O.scrollTop-O.clientHeight<32)},[]),gG=g.useCallback(O=>{O.deltaY<0&&(cl.current=!1,gc.current=!1)},[]),bG=g.useCallback(()=>{cl.current=!1,gc.current=!1},[]),yG=g.useCallback(()=>{const O=Nh.current;!O||!gc.current||cl.current||(O.scrollTop=O.scrollHeight)},[]),IE=g.useCallback(()=>{rs(null),m_().then(O=>{Rs(O.userId),Zt(O.info),ei(!!O.local),mn(O.status),O.status==="authenticated"&&(a0.current=!0,Hu.current=!0,localStorage.removeItem(pa.app),s(""),Ht(null),ti(!1),ks(!1),$(!1),bi(!1),yn(!1),Es(!1))}).catch(O=>{rs(O instanceof Error?O.message:String(O))})},[]);g.useEffect(()=>{IE()},[IE]),g.useEffect(()=>{const O=()=>{ze(""),nn(!0)};return window.addEventListener(g_,O),Xee()&&O(),()=>window.removeEventListener(g_,O)},[]);const xG=g.useCallback(async()=>{if(et.current)return;et.current=!0;const O=zee();if(!O){et.current=!1,ze("登录窗口被浏览器拦截,请允许弹出窗口后重试。");return}se(!0),ze("");try{for(;;){await new Promise(B=>window.setTimeout(B,1e3));try{const B=await m_();if(B.status==="authenticated"){Rs(B.userId),Zt(B.info),ei(!!B.local),mn(B.status),nn(!1),Qee(),O.close();return}}catch{}if(O.closed){ze("登录窗口已关闭,请重新登录以继续当前操作。");return}}}finally{et.current=!1,se(!1)}},[]);g.useEffect(()=>{po&&Me&&NR(Me)},[po,Me]),g.useEffect(()=>{if(wt!=="authenticated"||!Me||!n){We({});return}const O=bt.current.get(n);if(O){We(O);return}let B=!1;return We({}),Qw(n).then(Q=>{B||(bt.current.set(n,Q),We(Q))}),()=>{B=!0}},[n,wt,Me]),g.useEffect(()=>{if(wt!=="authenticated"||!Me){as(null);return}let O=!1;return as(null),a8().then(B=>{O||as(B)}).catch(B=>{console.warn("[app] /web/access failed; using ordinary-user access:",B),O||as(r8)}),()=>{O=!0}},[wt,Me]),g.useEffect(()=>{i8().then(O=>{bAe(O.telemetry),xAe({agentsSource:O.agentsSource}),Lu(O.features),Fg(O.agentsSource),gi(O.branding),bh(O.version),Hg(!0)})},[]),g.useEffect(()=>{wt!=="authenticated"||!xs||!mt||yAe({userId:mt.telemetry.userId,role:mt.role,local:po})},[mt,wt,po,xs]),g.useEffect(()=>{mt&&(mt.capabilities.createAgents||(Ht(null),fe(null),ks(!1),$(!1),e0([])),mt.capabilities.manageAgents||yn(!1))},[mt]),g.useEffect(()=>{wt!=="authenticated"||fo!=="cloud"||!$g||!Fu||xn||NE()},[xn,fo,wt,Fu,NE,$g]),g.useEffect(()=>{document.title=Pa.title;let O=document.querySelector('link[rel~="icon"]');O||(O=document.createElement("link"),O.rel="icon",document.head.appendChild(O)),O.removeAttribute("type"),O.href=Pa.logoUrl||qk},[Pa]),g.useEffect(()=>{fetch("/web/runtime-config",{signal:AbortSignal.timeout(1e4)}).then(O=>O.ok?O.json():null).then(O=>{O&&t0(!!O.credentials)}).catch(O=>{console.warn("[app] /web/runtime-config probe failed; workbench stays hidden:",O)})},[]);function EG(O){NR(O),a0.current=!0,Hu.current=!0,localStorage.removeItem(pa.app),as(null),Ht(null),fe(null),ti(!1),ks(!1),$(!1),bi(!1),yn(!1),ul(),s(""),Es(!1),Rs(O),Zt({name:O}),ei(!0),mn("authenticated")}function vG(){as(null),po?($ee(),Rs(""),Zt(void 0),mn("unauthenticated")):Gee()}g.useEffect(()=>{if(wt==="authenticated"){if(fo==="cloud"){const O=ID(Fa);s(B=>B&&O.includes(B)?B:(B&&(Hu.current=!0,localStorage.removeItem(pa.app)),""));return}IB().then(O=>{t(O);const B=ID(Fa);s(Q=>Q&&(O.includes(Q)||B.includes(Q))?Q:(Q&&(Hu.current=!0,localStorage.removeItem(pa.app)),""))}).catch(O=>Pe(String(O)))}},[wt,fo,Fa]),g.useEffect(()=>{n?(Hu.current=!1,localStorage.setItem(pa.app,n)):localStorage.removeItem(pa.app)},[n]),g.useEffect(()=>{let O=!1;if($n(null),_n([]),ll||xn||!n||!Me||!a){Hn(!1);return}return Hn(!0),v_(n,Me,a).then(B=>{O||($n(B),zk(n).then(Q=>{O||_n(Q)}).catch(()=>{O||_n([])}))}).catch(()=>{O||$n(null)}).finally(()=>{O||Hn(!1)}),()=>{O=!0}},[xn,n,ll,Me,a]),g.useEffect(()=>{let O=!1;if(Fn(null),pn(Va()),wt!=="authenticated"||ll||xn||!n){$s(!1);return}return $s(!0),Vk(n).then(B=>{O||Fn(B)}).catch(()=>{O||Fn(null)}).finally(()=>{O||$s(!1)}),()=>{O=!0}},[xn,n,hs,wt,ll]),g.useEffect(()=>{mt&&localStorage.setItem(pa.view,mt.capabilities.createAgents?yo??"chat":"chat")},[mt,yo]),g.useEffect(()=>{localStorage.setItem(pa.session,a),qt.current=a},[a]),g.useEffect(()=>{const O=dMe(Fa,n);if(!O||!Me){st.current=()=>{},ce(Ie=>Ie.size===0?Ie:new Set);return}const{runtimeId:B,region:Q,appName:le}=O;let be=!1,_e=0;function Ye(){Je.current!==void 0&&(window.clearTimeout(Je.current),Je.current=void 0)}function $e(Ie){Ye(),Je.current=window.setTimeout(()=>void tt(),Ie)}async function tt(){const Ie=++_e;try{const ct=await PB({runtimeId:B,region:Q,appName:le,userId:Me});if(be||Ie!==_e)return;const At=new Set(ct.items.filter(Dn=>Dn.state==="running").map(Dn=>Dn.sessionId));if(ce(Dn=>Dn.size===At.size&&[...At].every(dt=>Dn.has(dt))?Dn:At),At.size>0){$e(zOe);return}const Ln=ct.items.filter(Dn=>Dn.state==="pending").map(Dn=>Date.parse(Dn.dueAt)).filter(Number.isFinite);Ln.length>0&&$e(Math.max(GOe,Math.min(...Ln)-Date.now()))}catch{!be&&Ie===_e&&$e(VOe)}}const it=()=>{Ye(),tt()};return st.current=it,it(),()=>{be=!0,_e+=1,Ye(),st.current===it&&(st.current=()=>{})}},[n,Fa,Me]),g.useEffect(()=>()=>Ae.current.forEach(O=>O.abort()),[]),g.useEffect(()=>()=>Re.current.forEach(O=>{window.clearTimeout(O)}),[]),g.useEffect(()=>()=>{var O,B;(O=He.current)==null||O.abort(),(B=Be.current)==null||B.abort()},[]),g.useEffect(()=>{if(ll||xn||p||!n||!Me)return;let O=!1;return(async()=>{const B=await l0(n);if(!O){if(!a0.current){a0.current=!0;const Q=localStorage.getItem(pa.session)||"";if(SD()===null&&Q&&B.some(le=>le.id===Q)){Th(Q);return}}ul()}})(),()=>{O=!0}},[xn,n,ll,p,Me]),g.useEffect(()=>{const O=vE.current;O&&O.app===n&&(vE.current=null,Th(O.sid))},[n]);function wG(O,B){bi(!1),O===n?Th(B):(vE.current={app:O,sid:B},s(O))}async function l0(O){try{const B=await Fk(O,Me),Q=await Promise.allSettled(B.map(_e=>{var Ye;return(Ye=_e.events)!=null&&Ye.length?Promise.resolve(_e):Vy(O,Me,_e.id)})),le=Q.find(_e=>_e.status==="rejected"&&!/get session failed:\s*404\b/i.test(String(_e.reason)));if((le==null?void 0:le.status)==="rejected")throw le.reason;const be=Q.flatMap(_e=>_e.status==="fulfilled"?[_e.value]:[]);return r(be),be}catch(B){return Pe(String(B)),[]}}function rC(O="codex",B=!1){p||(Pe(""),de(""),pe("confirm"),Le(O),ie(B),q(!0))}function SG(){var O;(O=He.current)==null||O.abort(),He.current=null,q(!1),pe("confirm"),de(""),!p&&rt==="temporary"&&!Ee&&ut("agent")}async function _G(O){var Q;(Q=He.current)==null||Q.abort();const B=new AbortController;He.current=B,pe("loading"),de("");try{const le=ge==="codex"?await rn.startSession({displayName:O,signal:B.signal}):await rn.startAgentSession(ge,{displayName:O,signal:B.signal});if(He.current!==B)return;if(wAe({kind:ge,source:Ee?"my_agents":"new_chat",sessionId:le.id}),Ee){ve(_e=>_e+1),q(!1),pe("confirm"),Es(!0);return}if(ge!=="codex")return;const be=await rn.connectSession(le.id,{signal:B.signal});if(He.current!==B)return;qt.current="",l(""),h([]),Tt(""),pn(Va()),ut("temporary"),Pu(),hn(!1),yh(Pt),jt([]),at(),v([]),m(be),Ht(null),ti(!1),ks(!1),$(!1),bi(!1),yn(!1),Xi(null),Es(!1),De(null),Se(null),q(!1),pe("confirm")}catch(le){if((le==null?void 0:le.name)==="AbortError"||He.current!==B)return;SAe({kind:ge,source:Ee?"my_agents":"new_chat",error:le}),de(le instanceof Error?le.message:String(le)),pe("error")}finally{He.current===B&&(He.current=null)}}async function jE(O){if(Pe(""),O.toolName==="codex"){const Q=await rn.connectSession(O.id);qt.current="",l(""),h([]),Tt(""),pn(Va()),at(),v([]),m(Q),De(null),Se(null),Es(!1),yn(!1);return}const B=await rn.openAgentSession(O.toolName,O.id);Se(B),De(null),Es(!1),yn(!1)}function NG(O){De(O),Se(null),Es(!1),yn(!1),Pe("")}async function TG(O){(p==null?void 0:p.id)===O.id&&xo(),O.toolName==="codex"?await rn.deleteSession(O.id):await rn.deleteAgentSession(O.toolName,O.id),De(null),Se(null),ve(B=>B+1),Es(!0)}function xo(){var B;(B=Be.current)==null||B.abort(),Be.current=null,qe.current="",Z.current="",x(!1),at(),v([]),jt([]),Tt(""),Pe(""),ut("agent"),w(!1),S(""),T(!1),I(!1),L(null),D(null),A(!1),P(""),R(null),J(!1),te(""),V(!1),ae.current+=1;const O=p;m(null),O&&rn.closeSession(O.id).catch(Q=>Pe(String(Q)))}async function RE(O){const B=p;if(B){L(O),D(null),P(""),A(!0);try{const Q=O==="terminal"?await rn.launchTerminal(B.id):await rn.launchBrowser(B.id);D(Q)}catch(Q){P(Q instanceof Error?Q.message:String(Q))}finally{A(!1)}}}async function kG(O){const B=p;if(!(!B||E)){w(!0),S("");try{const Q=await rn.updatePermissions(B.id,O);m(le=>(le==null?void 0:le.id)===B.id?{...le,permissions:Q}:le),Qt(B.id,"已更新当前 Sandbox Session 的 Codex 权限",[{label:"沙箱模式",value:rMe[Q.sandboxMode]},{label:"审批策略",value:aMe[Q.approvalPolicy]},{label:"审批方式",value:oMe[Q.approvalsReviewer]},{label:"网络访问",value:Q.networkAccess?"允许":"关闭"}]),qe.current===B.id&&T(!1)}catch(Q){S(Q instanceof Error?Q.message:String(Q))}finally{w(!1)}}}const AG=g.useCallback(async O=>{const B=p==null?void 0:p.id;if(!B)throw new Error("当前没有已连接的 Sandbox。");return rn.listDirectories(B,O)},[p==null?void 0:p.id]);async function CG(O){const B=p;if(!(!B||B.workspaceLocked||E)){w(!0),S("");try{const Q=await rn.updateWorkspace(B.id,O);m(le=>(le==null?void 0:le.id)===B.id?{...le,cwd:Q}:le),Yn.invalidateSkills(),Qt(B.id,"已更新工作空间",[{label:"工作目录",value:Q,code:!0}]),qe.current===B.id&&I(!1)}catch(Q){S(Q instanceof Error?Q.message:String(Q))}finally{w(!1)}}}async function IG(O){const B=p,Q=H;if(!(!B||!Q||Y)){J(!0),te("");try{await rn.resolveApproval(B.id,Q.id,O),Qt(B.id,lMe(Q,O),cMe(Q),Z.current),R(le=>(le==null?void 0:le.id)===Q.id?null:le)}catch(le){te(le instanceof Error?le.message:String(le))}finally{J(!1)}}}async function jG(O){const B=p;if(!B||K)return;const Q=++ae.current;Pe(""),V(!0);const le=Array.from(O).map(be=>{const _e={id:AD(),mimeType:CD(be),name:be.name,sizeBytes:be.size,status:"uploading",previewUrl:xe(be)};return{file:be,attachment:_e}});jt(be=>[...be,...le.map(({attachment:_e})=>_e)]);try{const _e=(await Promise.all(le.map(async({file:Ye,attachment:$e})=>{try{const tt=await rn.uploadFile(B.id,Ye);return ae.current!==Q?null:(jt(it=>it.map(Ie=>Ie.id===$e.id?{...Ie,id:tt.id,uri:tt.path,name:tt.name,mimeType:tt.mimeType,sizeBytes:tt.sizeBytes,status:"ready"}:Ie)),tt)}catch(tt){if(ae.current!==Q)return null;const it=tt instanceof Error?tt.message:String(tt);return jt(Ie=>Ie.map(ct=>ct.id===$e.id?{...ct,status:"error",error:it}:ct)),Pe(it),null}}))).filter(Ye=>Ye!==null);ae.current===Q&&_e.length>0&&Qt(B.id,_e.length===1?"已上传文件到 Sandbox":`已上传 ${_e.length} 个文件到 Sandbox`,_e.map((Ye,$e)=>({label:_e.length===1?"文件":`文件 ${$e+1}`,value:Ye.path,code:!0})))}finally{if(ae.current===Q)V(!1);else for(const{attachment:be}of le)Fe(be.previewUrl)}}function RG(O){const B=Pt.find(Q=>Q.id===O);B&&(Fe(B.previewUrl),jt(Q=>Q.filter(le=>le.id!==O)))}async function aC(O,B=[],Q=[]){var Dn;const le=p,be=B.filter(dt=>dt.status==="ready"&&dt.uri);if(!le||y||!O.trim()&&be.length===0)return;Pe(""),R(null),te("");const _e=new AbortController;(Dn=Be.current)==null||Dn.abort(),Be.current=_e;const Ye=[];Q.length>0&&Ye.push({kind:"invocation",value:{skills:Q.map(({name:dt,description:Bt})=>({name:dt,description:Bt}))}}),be.length>0&&Ye.push({kind:"attachment",files:be.map(dt=>({id:dt.id,mimeType:dt.mimeType,name:dt.name,sizeBytes:dt.sizeBytes,previewUrl:dt.previewUrl}))}),O.trim()&&Ye.push({kind:"text",text:O});const $e=be.map(dt=>dt.uri).filter(dt=>!!dt),it=[Q.map(dt=>`$${dt.name}`).join(" "),O.trim()].filter(Boolean).join(" "),Ie=$e.length>0?[it,"以下文件已上传到当前 Sandbox 工作空间,请在任务中使用:",...$e.map(dt=>`- ${dt}`)].filter(Boolean).join(` -`):rt,lt=crypto.randomUUID(),kt=crypto.randomUUID(),Pn=[{role:"user",blocks:Ye,meta:{localId:lt,ts:Date.now()/1e3}},{role:"assistant",blocks:[],meta:{localId:kt}}];Z.current=kt,v(ft=>[...ft,...Pn]),x(!0),m(ft=>(ft==null?void 0:ft.id)===le.id?{...ft,busy:!0,workspaceLocked:!0}:ft);try{const ft=await sn.sendMessage({sessionId:le.id,text:je,skillIds:Q.map(Dt=>Dt.id)},{signal:Ne.signal,onApproval:Dt=>{Pe.current===Ne&&(te(""),R(Dt))},onApprovalResolved:Dt=>{Pe.current===Ne&&R(ot=>(ot==null?void 0:ot.id)===Dt?null:ot)},onBlocks:Dt=>{Pe.current===Ne&&v(ot=>{const Ct=ot.slice(),At=Ct.findIndex(Ci=>{var Sn;return((Sn=Ci.meta)==null?void 0:Sn.localId)===kt}),ds=Ct[At];return(ds==null?void 0:ds.role)==="assistant"&&(Ct[At]={...ds,blocks:Dt}),Ct})},onUsage:Dt=>{Pe.current===Ne&&v(ot=>{const Ct=ot.slice(),At=Ct.findIndex(Ci=>{var Sn;return((Sn=Ci.meta)==null?void 0:Sn.localId)===kt}),ds=Ct[At];return(ds==null?void 0:ds.role)==="assistant"&&(Ct[At]={...ds,meta:{...ds.meta,sandboxUsage:Dt.usage}}),Ct})}});if(Pe.current!==Ne)return;v(Dt=>{const ot=Dt.slice(),Ct=ot.findIndex(ds=>{var Ci;return((Ci=ds.meta)==null?void 0:Ci.localId)===kt}),At=ot[Ct];return(At==null?void 0:At.role)==="assistant"&&(ot[Ct]={...At,blocks:ft.blocks,meta:{...At.meta,ts:Date.now()/1e3,...ft.usage?{sandboxUsage:ft.usage.usage}:{}}}),ot}),wo(B)}catch(ft){if((ft==null?void 0:ft.name)==="AbortError"){wo(B);return}if(Pe.current!==Ne){wo(B);return}v(Dt=>Dt.filter(ot=>{var Ct,At;return((Ct=ot.meta)==null?void 0:Ct.localId)!==lt&&((At=ot.meta)==null?void 0:At.localId)!==kt})),Ut(M),pt(B),Tn.setSelectedSkills(Q),De(`内置智能体发送失败:${ft instanceof Error?ft.message:String(ft)}`);try{const Dt=await sn.getSettings(le.id);m(ot=>(ot==null?void 0:ot.id)===le.id?{...ot,...Dt}:ot)}catch{}}finally{Pe.current===Ne&&(Pe.current=null,Z.current===kt&&(Z.current=""),x(!1),R(null),m(ft=>(ft==null?void 0:ft.id)===le.id?{...ft,busy:!1}:ft))}}async function CG(M){if(await Tn.executeSlash(M)||!p||y||Tn.commandBusy)return;const B=ut,Q=Tn.selectedSkills;Ut(""),pt([]),Tn.setSelectedSkills([]),await nC(M.trim(),B,Q)}function rl(){ho(),De(""),cc(SD()),$t("agent"),Yt(null),Lu(),rn(!1);const M=a&&Fe.length===0&&ut.length>0?a:"";We.current="",l(""),yn(null),bs([]),d(!1),h([]),en(Va()),xh(ut),pt([]),M&&Du(M)}function IG(){var M;Fu.current=!0,localStorage.removeItem(ma.app),a&&((M=un.current.get(a))==null||M.abort()),c.current=null,rl(),s(""),ct({}),an(null)}function jG(){Vn(null),Ft(null),ai(!1),As(!1),Dn(!1),bi(!1),vn(!1),Qi(null),Le(null),_e(null),xs(!1),Br(null),rl()}async function RG(M){var B;try{(B=un.current.get(M))==null||B.abort(),at(M,!1),await m_(n,pe,M),await p_(n,pe,M);const Q=on.current.get(M);Q!==void 0&&window.clearTimeout(Q),on.current.delete(M),Ms(le=>{if(!le.has(M))return le;const xe=new Set(le);return xe.delete(M),xe}),be(le=>{const{[M]:xe,...Ne}=le;return Ne}),M===a&&rl(),await a0(n)}catch(Q){De(String(Q))}}async function kh(M){if(p&&ho(),M!==a&&(We.current=M,De(""),d(!1),h([]),$t("agent"),Yt(null),Lu(),en(Va()),yn(null),bs([]),l(M),ne[M]===void 0)){mh(!0);try{const B=await Hy(n,pe,M);bt(M,Tte(B.events??[],B.state))}catch(B){De(String(B))}finally{mh(!1)}}}async function OG(M){if(!M.sessionId||!M.messageId){De("这条案例缺少会话定位信息,无法跳转。");return}bi(!1),Ft(null),As(!1),Dn(!1),ai(!1),vn(!1),bE(n),QV(M.kind),t0(M.messageId),await kh(M.sessionId)}function MG(){const M=H2||n;bi(!1),Ft(null),As(!1),Dn(!1),ai(!1),$i(""),Ai(M),e0("evaluations"),eG(XV),vn(!0),bE(""),t0("")}function LG(M){const B=new Map,Q=new Map;for(const le of M){if(!le.sessionId||!le.messageId)continue;const xe=B.get(le.sessionId)??new Set;if(xe.add(le.messageId),B.set(le.sessionId,xe),le.runtimeId&&le.userId){const Ne=[le.runtimeId,n,le.userId,le.sessionId].join(":"),Ye=Q.get(Ne)??{runtimeId:le.runtimeId,appName:n,userId:le.userId,sessionId:le.sessionId,eventIds:new Set};Ye.eventIds.add(le.messageId),Q.set(Ne,Ye)}}if(B.size!==0){be(le=>{const xe={...le};for(const[Ne,Ye]of B){const $e=xe[Ne];$e&&(xe[Ne]=$e.map(tt=>{var rt;return(rt=tt.meta)!=null&&rt.eventId&&Ye.has(tt.meta.eventId)?{...tt,meta:{...tt.meta,feedback:void 0}}:tt}))}return xe}),r(le=>le.map(xe=>{const Ne=B.get(xe.id);if(!Ne||!xe.state)return xe;const Ye={...xe.state};for(const $e of Ne)delete Ye[`veadk_feedback:${$e}`];return{...xe,state:Ye}})),zn(le=>{const xe=new Set(le);for(const Ne of B.values())for(const Ye of Ne)xe.delete(Ye);return xe});for(const le of Q.values())wB({runtimeId:le.runtimeId,appName:le.appName,userId:le.userId,sessionId:le.sessionId,eventIds:[...le.eventIds]});nG(le=>le&&(M.some(xe=>xe.id===le.id||xe.messageId===le.messageId)?null:le))}}async function sC(M=!0){if(a)return a;c.current||(c.current=$y(n,pe));const B=c.current;try{const Q=await B;M&&l(Q);const le=Date.now()/1e3,xe={id:Q,lastUpdateTime:le,events:[]};return r(Ne=>[xe,...Ne.filter(Ye=>Ye.id!==Q)]),Q}finally{c.current===B&&(c.current=null)}}async function DG(M){if(!n||!pe||!a||!bn)return!1;On(!0),De("");try{const B=await y_(n,pe,a,M,bn.revision);return yn(B),!0}catch(B){return De(String(B)),!1}finally{On(!1)}}async function PG(M){if(!(!n||!pe||!a||!bn)){On(!0),De("");try{const B=await KB(n,pe,a,M,bn.revision);yn(B)}catch(B){De(String(B))}finally{On(!1)}}}async function BG(M){De("");let B;try{B=await sC()}catch(le){De(String(le));return}const Q=Array.from(M).map(le=>({file:le,attachment:{id:_D(),mimeType:ND(le),name:le.name,sizeBytes:le.size,status:"uploading"}}));pt(le=>[...le,...Q.map(xe=>xe.attachment)]),await Promise.all(Q.map(async({file:le,attachment:xe})=>{try{const Ne=await HB(n,pe,B,le);if(cs.current.delete(xe.id)){Ne.uri&&await Mb(n,Ne.uri);return}pt(Ye=>Ye.map($e=>$e.id===xe.id?Ne:$e))}catch(Ne){if(cs.current.delete(xe.id))return;const Ye=Ne instanceof Error?Ne.message:String(Ne);pt($e=>$e.map(tt=>tt.id===xe.id?{...tt,status:"error",error:Ye}:tt)),De(Ye)}}))}async function iC(M,B=[],Q=Va()){if(!M.trim()&&B.length===0||hc||Gg||!n||!pe)return;De("");const le=[];(Q.skills.length>0||Q.targetAgent)&&le.push({kind:"invocation",value:Q}),B.length&&le.push({kind:"attachment",files:B.map(je=>({id:je.id,mimeType:je.mimeType,data:je.data,uri:je.uri,name:je.name,sizeBytes:je.sizeBytes}))}),M.trim()&&le.push({kind:"text",text:M});const xe=[{role:"user",blocks:le,meta:{ts:Date.now()/1e3}},{role:"assistant",blocks:[]}],Ne=!a;Ne&&(h(xe),d(!0));const Ye=Ge;let $e;try{$e=await sC(!Ne)}catch(je){Ne&&(h([]),d(!1),Ut(M),en(Q)),De(String(je));return}let tt=Rv(bn);if(Ye)try{let je=await b_(n,pe,$e);const lt=jTe[Ye].filter(kt=>{var Pn;return(Pn=it.builtinTools)==null?void 0:Pn.includes(kt)});for(const kt of[...hH[Ye],...lt])je.tools.some(Pn=>Pn.name===kt)||(je=await y_(n,pe,$e,{kind:"tool",name:kt},je.revision));yn(je),tt=Rv(je)}catch(je){Ne&&(h([]),d(!1),Ut(M),en(Q)),De(`任务能力挂载失败:${String(je)}`);return}bt($e,je=>Ne?xe:[...je,...xe]),Ne&&(We.current=$e,l($e),h([]),d(!1));const rt=new AbortController;un.current.set($e,rt),Ie($e,!0),Ue($e),We.current=$e,Vs(je=>({...je,[$e]:""})),Hg(je=>({...je,[$e]:new Set})),Dr(je=>({...je,[$e]:[]}));try{let je=Sa(),lt="",kt=0,Pn=Date.now()/1e3,Bn="",ft="",Dt=!1;for await(const ot of wm({appName:n,userId:pe,sessionId:$e,text:M,attachments:B,invocation:Q,signal:rt.signal,sessionCapabilities:tt})){if(rt.signal.aborted)break;const Ct=ot.error??ot.errorMessage??ot.error_message;if(typeof Ct=="string"&&Ct){Dt=!0,We.current===$e&&De(Ct);break}Wg($e,ot);const At=ot.author&&ot.author!=="user"?ot.author:"";At&&At!==lt&&(lt=At,je=Sa()),je=gf(je,ot);const ds=ot.usageMetadata??ot.usage_metadata;ds!=null&&ds.totalTokenCount&&(kt=ds.totalTokenCount),ot.timestamp&&(Pn=ot.timestamp),ot.id&&(Bn=ot.id);const Ci=ot.invocationId??ot.invocation_id;Ci&&(ft=Ci);const Sn=je.blocks,Fr={author:lt||void 0,tokens:kt||void 0,ts:Pn,eventId:Bn||void 0,invocationId:ft||void 0};bt($e,mo=>{var Ls;const Ii=mo.slice(),pr=Ii[Ii.length-1];return(pr==null?void 0:pr.role)==="assistant"&&(!((Ls=pr.meta)!=null&&Ls.author)||pr.meta.author===lt)?Ii[Ii.length-1]={...pr,blocks:Sn,meta:Fr}:Ii.push({role:"assistant",blocks:Sn,meta:Fr}),Ii})}a0(n),!rt.signal.aborted&&!Dt&&Bn&&ce.current()}catch(je){(je==null?void 0:je.name)!=="AbortError"&&!rt.signal.aborted&&We.current===$e&&De(String(je))}finally{un.current.get($e)===rt&&un.current.delete($e),Ie($e,!1),nt($e),Vs(je=>({...je,[$e]:""})),Dr(je=>({...je,[$e]:[]}))}}function UG(M,B){var xe,Ne;const Q=((xe=M==null?void 0:M.event)==null?void 0:xe.name)??B.id,le=((Ne=M==null?void 0:M.event)==null?void 0:Ne.context)??{};iC(`[ui-action] ${Q}: ${JSON.stringify(le)}`)}async function FG(M){var tt,rt,je;if(!M.authUri)throw new Error("事件中没有授权地址。");if(!n||!pe||!a)throw new Error("会话尚未就绪。");const B=a,Q=await JOe(M.authUri),le=eMe(M.authConfig,Q),xe=lt=>lt.map(kt=>kt.kind==="auth"&&!kt.done?{...kt,done:!0}:kt);bt(B,lt=>{const kt=lt.slice(),Pn=kt[kt.length-1];return(Pn==null?void 0:Pn.role)==="assistant"&&(kt[kt.length-1]={...Pn,blocks:xe(Pn.blocks)}),kt});const Ne=Ke[Ke.length-1],Ye=xe(Ne&&Ne.role==="assistant"?Ne.blocks:[]),$e=new AbortController;un.current.set(B,$e),Ie(B,!0),Ue(B);try{let lt=Sa(),kt=((tt=Ne==null?void 0:Ne.meta)==null?void 0:tt.author)??"",Pn=Ye,Bn=0,ft=Date.now()/1e3,Dt=((rt=Ne==null?void 0:Ne.meta)==null?void 0:rt.eventId)??"",ot=((je=Ne==null?void 0:Ne.meta)==null?void 0:je.invocationId)??"",Ct=!1;for await(const At of wm({appName:n,userId:pe,sessionId:a,text:"",functionResponses:[{id:M.callId,name:"adk_request_credential",response:le}],signal:$e.signal,sessionCapabilities:Rv(bn)})){if($e.signal.aborted)break;const ds=At.error??At.errorMessage??At.error_message;if(typeof ds=="string"&&ds){Ct=!0,We.current===B&&De(ds);break}Wg(B,At);const Ci=At.author&&At.author!=="user"?At.author:"";Ci&&Ci!==kt&&(kt=Ci,Pn=[],lt=Sa()),lt=gf(lt,At);const Sn=At.usageMetadata??At.usage_metadata;Sn!=null&&Sn.totalTokenCount&&(Bn=Sn.totalTokenCount),At.timestamp&&(ft=At.timestamp),At.id&&(Dt=At.id);const Fr=At.invocationId??At.invocation_id;Fr&&(ot=Fr);const mo=[...Pn,...lt.blocks];bt(B,Ii=>{var mC,gC,bC,yC,xC;const pr=Ii.slice(),Ls=pr[pr.length-1],pC={author:kt||((mC=Ls==null?void 0:Ls.meta)==null?void 0:mC.author),tokens:Bn||((gC=Ls==null?void 0:Ls.meta)==null?void 0:gC.tokens),ts:ft,eventId:Dt||((bC=Ls==null?void 0:Ls.meta)==null?void 0:bC.eventId),invocationId:ot||((yC=Ls==null?void 0:Ls.meta)==null?void 0:yC.invocationId)};return(Ls==null?void 0:Ls.role)==="assistant"&&(!((xC=Ls.meta)!=null&&xC.author)||Ls.meta.author===kt)?pr[pr.length-1]={...Ls,blocks:mo,meta:pC}:pr.push({role:"assistant",blocks:mo,meta:pC}),pr})}a0(n),!$e.signal.aborted&&!Ct&&Dt&&ce.current()}catch(lt){(lt==null?void 0:lt.name)!=="AbortError"&&!$e.signal.aborted&&We.current===B&&De(String(lt))}finally{un.current.get(B)===$e&&un.current.delete(B),Ie(B,!1),nt(B),Vs(lt=>({...lt,[B]:""})),Dr(lt=>({...lt,[B]:[]}))}}if(se)return o.jsxs("div",{className:"boot boot-error",children:[o.jsx("p",{children:se}),o.jsx("button",{type:"button",onClick:kE,children:"重试"})]});if(Mn===null)return o.jsx("div",{className:"boot"});if(Mn==="unauthenticated")return o.jsx(mOe,{branding:Lr,onUsername:gG});if(!Tt)return o.jsx("div",{className:"boot"});const Ur=Tt.capabilities.createAgents,rC=Tt.capabilities.manageAgents,al=Ur?Ua:null,aC=Ur&&Sh,oC=Ur&&Zg,lC=Bu&&!!(wn||Y2||W2),cC=O$(e,Fa),Ah=cC.filter(M=>M.runtimeId&&(G2===null||G2.has(M.runtimeId))).map(M=>{var B;return{...M,canDelete:M.runtimeId?((B=rG[M.runtimeId])==null?void 0:B.canDelete)===!0:!1}}),$G=(()=>{if(Ah.length===0)return Ah;const M=new Map(st.map((B,Q)=>[B,Q]));return[...Ah].sort((B,Q)=>{const le=M.get(B.id),xe=M.get(Q.id);return le!=null&&xe!=null?le-xe:le!=null?-1:xe!=null?1:Ah.indexOf(B)-Ah.indexOf(Q)})})(),uC=M=>{var B;return((B=cC.find(Q=>Q.id===M))==null?void 0:B.label)??M},kn=Fa.find(M=>M.runtimeId&&M.apps.some(B=>so(M.id,B)===n)),Zi=kn&&kn.runtimeId&&kn.region?{runtimeId:kn.runtimeId,name:kn.name,region:kn.region}:void 0,Ch=(Zi==null?void 0:Zi.runtimeId)??"",po=kn?kn.apps.find(M=>so(kn.id,M)===n)??(St==null?void 0:St.appName)??kn.apps[0]??kn.name:"",HG=async M=>{var Ne,Ye,$e;const B=Ht,Q=a;if(!B||!Q)throw new Error("当前会话不可用,请关闭后重试。");const le=((Ne=B.turn.meta)==null?void 0:Ne.invocationId)??"",xe=Ch?[]:await zy(n,Q).catch(()=>[]);await g_({source:"agent_exec",module:"conversation",issues:M.issues,problem:"",description:M.description,page:"conversation",appName:po||n,runtimeId:Ch,region:(Zi==null?void 0:Zi.region)??"cn-beijing",sessionId:Q,eventId:((Ye=B.turn.meta)==null?void 0:Ye.eventId)??(($e=B.turn.meta)==null?void 0:$e.localId)??"",invocationId:le,input:B.input,output:Rc(B.turn),toolCalls:NR(B.turn),trace:gte(xe,le)})},zG=async M=>{const B=p?"":a,Q=p||B?Ke:[],le=B&&n&&!Ch?await zy(n,B).catch(()=>[]):[];await g_({source:"platform",module:M.module,issues:M.issues,problem:"",description:M.description,page:En??"unknown",appName:po||n,runtimeId:Ch,region:(Zi==null?void 0:Zi.region)??"cn-beijing",sessionId:B,eventId:"",invocationId:"",input:Q.filter(xe=>xe.role==="user").map(Rc).filter(Boolean).join(` +`):it,ct=crypto.randomUUID(),At=crypto.randomUUID(),Ln=[{role:"user",blocks:Ye,meta:{localId:ct,ts:Date.now()/1e3}},{role:"assistant",blocks:[],meta:{localId:At}}];Z.current=At,v(dt=>[...dt,...Ln]),x(!0),m(dt=>(dt==null?void 0:dt.id)===le.id?{...dt,busy:!0,workspaceLocked:!0}:dt);try{const dt=await rn.sendMessage({sessionId:le.id,text:Ie,skillIds:Q.map(Bt=>Bt.id)},{signal:_e.signal,onApproval:Bt=>{Be.current===_e&&(te(""),R(Bt))},onApprovalResolved:Bt=>{Be.current===_e&&R(lt=>(lt==null?void 0:lt.id)===Bt?null:lt)},onBlocks:Bt=>{Be.current===_e&&v(lt=>{const Rt=lt.slice(),Ct=Rt.findIndex(Ai=>{var En;return((En=Ai.meta)==null?void 0:En.localId)===At}),os=Rt[Ct];return(os==null?void 0:os.role)==="assistant"&&(Rt[Ct]={...os,blocks:Bt}),Rt})},onUsage:Bt=>{Be.current===_e&&v(lt=>{const Rt=lt.slice(),Ct=Rt.findIndex(Ai=>{var En;return((En=Ai.meta)==null?void 0:En.localId)===At}),os=Rt[Ct];return(os==null?void 0:os.role)==="assistant"&&(Rt[Ct]={...os,meta:{...os.meta,sandboxUsage:Bt.usage}}),Rt})}});if(Be.current!==_e)return;v(Bt=>{const lt=Bt.slice(),Rt=lt.findIndex(os=>{var Ai;return((Ai=os.meta)==null?void 0:Ai.localId)===At}),Ct=lt[Rt];return(Ct==null?void 0:Ct.role)==="assistant"&&(lt[Rt]={...Ct,blocks:dt.blocks,meta:{...Ct.meta,ts:Date.now()/1e3,...dt.usage?{sandboxUsage:dt.usage.usage}:{}}}),lt})}catch(dt){if((dt==null?void 0:dt.name)==="AbortError"||Be.current!==_e)return;v(Bt=>Bt.filter(lt=>{var Rt,Ct;return((Rt=lt.meta)==null?void 0:Rt.localId)!==ct&&((Ct=lt.meta)==null?void 0:Ct.localId)!==At})),Tt(O),jt(B),Yn.setSelectedSkills(Q),Pe(`内置智能体发送失败:${dt instanceof Error?dt.message:String(dt)}`);try{const Bt=await rn.getSettings(le.id);m(lt=>(lt==null?void 0:lt.id)===le.id?{...lt,...Bt}:lt)}catch{}}finally{Be.current===_e&&(Be.current=null,Z.current===At&&(Z.current=""),x(!1),R(null),m(dt=>(dt==null?void 0:dt.id)===le.id?{...dt,busy:!1}:dt))}}async function OG(O){if(await Yn.executeSlash(O)||!p||y||Yn.commandBusy)return;const B=Pt,Q=Yn.selectedSkills;Tt(""),jt([]),Yn.setSelectedSkills([]),await aC(O.trim(),B,Q)}function ul(){xo(),Pe(""),re(kD()),ut("agent"),_t(null),Pu(),hn(!1);const O=a&&fn.length===0&&Pt.length>0?a:"";qt.current="",l(""),$n(null),_n([]),d(!1),h([]),pn(Va()),yh(Pt),jt([]),O&&Bu(O)}function MG(){var O;Hu.current=!0,localStorage.removeItem(pa.app),a&&((O=Ae.current.get(a))==null||O.abort()),c.current=null,ul(),s(""),We({}),Fn(null)}function LG(){mi(null),Ht(null),ti(!1),ks(!1),$(!1),bi(!1),yn(!1),Xi(null),De(null),Se(null),Es(!1),Lr(null),ul()}async function DG(O){var B;try{(B=Ae.current.get(O))==null||B.abort(),Tn(O,!1),await x_(n,Me,O),await y_(n,Me,O);const Q=Re.current.get(O);Q!==void 0&&window.clearTimeout(Q),Re.current.delete(O),On(le=>{if(!le.has(O))return le;const be=new Set(le);return be.delete(O),be}),ft(le=>{const{[O]:be,..._e}=le;return _e}),O===a&&ul(),await l0(n)}catch(Q){Pe(String(Q))}}async function Th(O){if(p&&xo(),O!==a&&(qt.current=O,Pe(""),d(!1),h([]),ut("agent"),_t(null),Pu(),pn(Va()),$n(null),_n([]),l(O),It[O]===void 0)){zg(!0);try{const B=await Vy(n,Me,O);Nt(O,Ite(B.events??[],B.state))}catch(B){Pe(String(B))}finally{zg(!1)}}}async function PG(O){if(!O.sessionId||!O.messageId){Pe("这条案例缺少会话定位信息,无法跳转。");return}bi(!1),Ht(null),ks(!1),$(!1),ti(!1),yn(!1),EE(n),tG(O.kind),s0(O.messageId),await Th(O.sessionId)}function BG(){const O=K2||n;bi(!1),Ht(null),ks(!1),$(!1),ti(!1),Fi(""),ki(O),n0("evaluations"),iG(eG),yn(!0),EE(""),s0("")}function UG(O){const B=new Map,Q=new Map;for(const le of O){if(!le.sessionId||!le.messageId)continue;const be=B.get(le.sessionId)??new Set;if(be.add(le.messageId),B.set(le.sessionId,be),le.runtimeId&&le.userId){const _e=[le.runtimeId,n,le.userId,le.sessionId].join(":"),Ye=Q.get(_e)??{runtimeId:le.runtimeId,appName:n,userId:le.userId,sessionId:le.sessionId,eventIds:new Set};Ye.eventIds.add(le.messageId),Q.set(_e,Ye)}}if(B.size!==0){ft(le=>{const be={...le};for(const[_e,Ye]of B){const $e=be[_e];$e&&(be[_e]=$e.map(tt=>{var it;return(it=tt.meta)!=null&&it.eventId&&Ye.has(tt.meta.eventId)?{...tt,meta:{...tt.meta,feedback:void 0}}:tt}))}return be}),r(le=>le.map(be=>{const _e=B.get(be.id);if(!_e||!be.state)return be;const Ye={...be.state};for(const $e of _e)delete Ye[`veadk_feedback:${$e}`];return{...be,state:Ye}})),ys(le=>{const be=new Set(le);for(const _e of B.values())for(const Ye of _e)be.delete(Ye);return be});for(const le of Q.values())TB({runtimeId:le.runtimeId,appName:le.appName,userId:le.userId,sessionId:le.sessionId,eventIds:[...le.eventIds]});aG(le=>le&&(O.some(be=>be.id===le.id||be.messageId===le.messageId)?null:le))}}async function oC(O=!0){if(a)return a;c.current||(c.current=zy(n,Me));const B=c.current;try{const Q=await B;O&&l(Q);const le=Date.now()/1e3,be={id:Q,lastUpdateTime:le,events:[]};return r(_e=>[be,..._e.filter(Ye=>Ye.id!==Q)]),Q}finally{c.current===B&&(c.current=null)}}async function FG(O){if(!n||!Me||!a||!ms)return!1;is(!0),Pe("");try{const B=await w_(n,Me,a,O,ms.revision);return $n(B),!0}catch(B){return Pe(String(B)),!1}finally{is(!1)}}async function $G(O){if(!(!n||!Me||!a||!ms)){is(!0),Pe("");try{const B=await XB(n,Me,a,O,ms.revision);$n(B)}catch(B){Pe(String(B))}finally{is(!1)}}}async function HG(O){Pe("");let B;try{B=await oC()}catch(le){Pe(String(le));return}const Q=Array.from(O).map(le=>({file:le,attachment:{id:AD(),mimeType:CD(le),name:le.name,sizeBytes:le.size,status:"uploading"}}));jt(le=>[...le,...Q.map(be=>be.attachment)]),await Promise.all(Q.map(async({file:le,attachment:be})=>{try{const _e=await KB(n,Me,B,le);if(_s.current.delete(be.id)){_e.uri&&await Db(n,_e.uri);return}jt(Ye=>Ye.map($e=>$e.id===be.id?_e:$e))}catch(_e){if(_s.current.delete(be.id))return;const Ye=_e instanceof Error?_e.message:String(_e);jt($e=>$e.map(tt=>tt.id===be.id?{...tt,status:"error",error:Ye}:tt)),Pe(Ye)}}))}async function lC(O,B=[],Q=Va()){if(!O.trim()&&B.length===0||bo||ol||!n||!Me)return;Pe("");const le=[];(Q.skills.length>0||Q.targetAgent)&&le.push({kind:"invocation",value:Q}),B.length&&le.push({kind:"attachment",files:B.map(Ie=>({id:Ie.id,mimeType:Ie.mimeType,data:Ie.data,uri:Ie.uri,name:Ie.name,sizeBytes:Ie.sizeBytes}))}),O.trim()&&le.push({kind:"text",text:O});const be=[{role:"user",blocks:le,meta:{ts:Date.now()/1e3}},{role:"assistant",blocks:[]}],_e=!a;_e&&(h(be),d(!0));const Ye=Ze;let $e;try{$e=await oC(!_e)}catch(Ie){_e&&(h([]),d(!1),Tt(O),pn(Q)),Pe(String(Ie));return}let tt=Lv(ms);if(Ye)try{let Ie=await v_(n,Me,$e);const ct=LTe[Ye].filter(At=>{var Ln;return(Ln=me.builtinTools)==null?void 0:Ln.includes(At)});for(const At of[...bH[Ye],...ct])Ie.tools.some(Ln=>Ln.name===At)||(Ie=await w_(n,Me,$e,{kind:"tool",name:At},Ie.revision));$n(Ie),tt=Lv(Ie)}catch(Ie){_e&&(h([]),d(!1),Tt(O),pn(Q)),Pe(`任务能力挂载失败:${String(Ie)}`);return}Nt($e,Ie=>_e?be:[...Ie,...be]),_e&&(qt.current=$e,l($e),h([]),d(!1));const it=new AbortController;Ae.current.set($e,it),ot($e,!0),kt($e),qt.current=$e,Ba(Ie=>({...Ie,[$e]:""})),Gg(Ie=>({...Ie,[$e]:new Set})),mo(Ie=>({...Ie,[$e]:[]}));try{let Ie=wa(),ct="",At=0,Ln=Date.now()/1e3,Dn="",dt="",Bt=!1;for await(const lt of vm({appName:n,userId:Me,sessionId:$e,text:O,attachments:B,invocation:Q,signal:it.signal,sessionCapabilities:tt})){if(it.signal.aborted)break;const Rt=lt.error??lt.errorMessage??lt.error_message;if(typeof Rt=="string"&&Rt){Bt=!0,qt.current===$e&&Pe(Rt);break}Zg($e,lt);const Ct=lt.author&<.author!=="user"?lt.author:"";Ct&&Ct!==ct&&(ct=Ct,Ie=wa()),Ie=yf(Ie,lt);const os=lt.usageMetadata??lt.usage_metadata;os!=null&&os.totalTokenCount&&(At=os.totalTokenCount),lt.timestamp&&(Ln=lt.timestamp),lt.id&&(Dn=lt.id);const Ai=lt.invocationId??lt.invocation_id;Ai&&(dt=Ai);const En=Ie.blocks,Pr={author:ct||void 0,tokens:At||void 0,ts:Ln,eventId:Dn||void 0,invocationId:dt||void 0};Nt($e,vo=>{var Os;const Ci=vo.slice(),pr=Ci[Ci.length-1];return(pr==null?void 0:pr.role)==="assistant"&&(!((Os=pr.meta)!=null&&Os.author)||pr.meta.author===ct)?Ci[Ci.length-1]={...pr,blocks:En,meta:Pr}:Ci.push({role:"assistant",blocks:En,meta:Pr}),Ci})}l0(n),!it.signal.aborted&&!Bt&&Dn&&st.current()}catch(Ie){(Ie==null?void 0:Ie.name)!=="AbortError"&&!it.signal.aborted&&qt.current===$e&&Pe(String(Ie))}finally{Ae.current.get($e)===it&&Ae.current.delete($e),ot($e,!1),Mn($e),Ba(Ie=>({...Ie,[$e]:""})),mo(Ie=>({...Ie,[$e]:[]}))}}function zG(O,B){var be,_e;const Q=((be=O==null?void 0:O.event)==null?void 0:be.name)??B.id,le=((_e=O==null?void 0:O.event)==null?void 0:_e.context)??{};lC(`[ui-action] ${Q}: ${JSON.stringify(le)}`)}async function VG(O){var tt,it,Ie;if(!O.authUri)throw new Error("事件中没有授权地址。");if(!n||!Me||!a)throw new Error("会话尚未就绪。");const B=a,Q=await sMe(O.authUri),le=iMe(O.authConfig,Q),be=ct=>ct.map(At=>At.kind==="auth"&&!At.done?{...At,done:!0}:At);Nt(B,ct=>{const At=ct.slice(),Ln=At[At.length-1];return(Ln==null?void 0:Ln.role)==="assistant"&&(At[At.length-1]={...Ln,blocks:be(Ln.blocks)}),At});const _e=Et[Et.length-1],Ye=be(_e&&_e.role==="assistant"?_e.blocks:[]),$e=new AbortController;Ae.current.set(B,$e),ot(B,!0),kt(B);try{let ct=wa(),At=((tt=_e==null?void 0:_e.meta)==null?void 0:tt.author)??"",Ln=Ye,Dn=0,dt=Date.now()/1e3,Bt=((it=_e==null?void 0:_e.meta)==null?void 0:it.eventId)??"",lt=((Ie=_e==null?void 0:_e.meta)==null?void 0:Ie.invocationId)??"",Rt=!1;for await(const Ct of vm({appName:n,userId:Me,sessionId:a,text:"",functionResponses:[{id:O.callId,name:"adk_request_credential",response:le}],signal:$e.signal,sessionCapabilities:Lv(ms)})){if($e.signal.aborted)break;const os=Ct.error??Ct.errorMessage??Ct.error_message;if(typeof os=="string"&&os){Rt=!0,qt.current===B&&Pe(os);break}Zg(B,Ct);const Ai=Ct.author&&Ct.author!=="user"?Ct.author:"";Ai&&Ai!==At&&(At=Ai,Ln=[],ct=wa()),ct=yf(ct,Ct);const En=Ct.usageMetadata??Ct.usage_metadata;En!=null&&En.totalTokenCount&&(Dn=En.totalTokenCount),Ct.timestamp&&(dt=Ct.timestamp),Ct.id&&(Bt=Ct.id);const Pr=Ct.invocationId??Ct.invocation_id;Pr&&(lt=Pr);const vo=[...Ln,...ct.blocks];Nt(B,Ci=>{var xC,EC,vC,wC,SC;const pr=Ci.slice(),Os=pr[pr.length-1],yC={author:At||((xC=Os==null?void 0:Os.meta)==null?void 0:xC.author),tokens:Dn||((EC=Os==null?void 0:Os.meta)==null?void 0:EC.tokens),ts:dt,eventId:Bt||((vC=Os==null?void 0:Os.meta)==null?void 0:vC.eventId),invocationId:lt||((wC=Os==null?void 0:Os.meta)==null?void 0:wC.invocationId)};return(Os==null?void 0:Os.role)==="assistant"&&(!((SC=Os.meta)!=null&&SC.author)||Os.meta.author===At)?pr[pr.length-1]={...Os,blocks:vo,meta:yC}:pr.push({role:"assistant",blocks:vo,meta:yC}),pr})}l0(n),!$e.signal.aborted&&!Rt&&Bt&&st.current()}catch(ct){(ct==null?void 0:ct.name)!=="AbortError"&&!$e.signal.aborted&&qt.current===B&&Pe(String(ct))}finally{Ae.current.get(B)===$e&&Ae.current.delete(B),ot(B,!1),Mn(B),Ba(ct=>({...ct,[B]:""})),mo(ct=>({...ct,[B]:[]}))}}if(gn)return o.jsxs("div",{className:"boot boot-error",children:[o.jsx("p",{children:gn}),o.jsx("button",{type:"button",onClick:IE,children:"重试"})]});if(wt===null)return o.jsx("div",{className:"boot"});if(wt==="unauthenticated")return o.jsx(xOe,{branding:Pa,onUsername:EG});if(!mt)return o.jsx("div",{className:"boot"});const Dr=mt.capabilities.createAgents,cC=mt.capabilities.manageAgents,dl=Dr?yo:null,uC=Dr&&wh,dC=Dr&&vh,fC=Fu&&!!(xn||Z2||J2),hC=P$(e,Fa),kh=hC.filter(O=>O.runtimeId&&(W2===null||W2.has(O.runtimeId))).map(O=>{var B;return{...O,canDelete:O.runtimeId?((B=cG[O.runtimeId])==null?void 0:B.canDelete)===!0:!1}}),GG=(()=>{if(kh.length===0)return kh;const O=new Map(un.map((B,Q)=>[B,Q]));return[...kh].sort((B,Q)=>{const le=O.get(B.id),be=O.get(Q.id);return le!=null&&be!=null?le-be:le!=null?-1:be!=null?1:kh.indexOf(B)-kh.indexOf(Q)})})(),pC=O=>{var B;return((B=hC.find(Q=>Q.id===O))==null?void 0:B.label)??O},kn=Fa.find(O=>O.runtimeId&&O.apps.some(B=>so(O.id,B)===n)),Qi=kn&&kn.runtimeId&&kn.region?{runtimeId:kn.runtimeId,name:kn.name,region:kn.region}:void 0,Ah=(Qi==null?void 0:Qi.runtimeId)??"",Eo=kn?kn.apps.find(O=>so(kn.id,O)===n)??(zt==null?void 0:zt.appName)??kn.apps[0]??kn.name:"",KG=async O=>{var _e,Ye,$e;const B=aa,Q=a;if(!B||!Q)throw new Error("当前会话不可用,请关闭后重试。");const le=((_e=B.turn.meta)==null?void 0:_e.invocationId)??"",be=Ah?[]:await Gy(n,Q).catch(()=>[]);await E_({source:"agent_exec",module:"conversation",issues:O.issues,problem:"",description:O.description,page:"conversation",appName:Eo||n,runtimeId:Ah,region:(Qi==null?void 0:Qi.region)??"cn-beijing",sessionId:Q,eventId:((Ye=B.turn.meta)==null?void 0:Ye.eventId)??(($e=B.turn.meta)==null?void 0:$e.localId)??"",invocationId:le,input:B.input,output:Oc(B.turn),toolCalls:CR(B.turn),trace:Ete(be,le)})},qG=async O=>{const B=p?"":a,Q=p||B?Et:[],le=B&&n&&!Ah?await Gy(n,B).catch(()=>[]):[];await E_({source:"platform",module:O.module,issues:O.issues,problem:"",description:O.description,page:Js??"unknown",appName:Eo||n,runtimeId:Ah,region:(Qi==null?void 0:Qi.region)??"cn-beijing",sessionId:B,eventId:"",invocationId:"",input:Q.filter(be=>be.role==="user").map(Oc).filter(Boolean).join(` -`),output:Q.filter(xe=>xe.role==="assistant").map(Rc).filter(Boolean).join(` +`),output:Q.filter(be=>be.role==="assistant").map(Oc).filter(Boolean).join(` -`),toolCalls:Q.flatMap(NR),trace:le})},dC=async(M,B,Q="")=>{var tt,rt,je,lt,kt,Pn,Bn,ft;const le=(tt=M.meta)==null?void 0:tt.eventId,xe=a;if(!le||!xe||!Zi)return;const Ne=Rc(M),Ye=(rt=M.meta)==null?void 0:rt.feedback,$e={...Ye,rating:B,syncStatus:"syncing",updatedAt:Date.now()/1e3};bt(xe,Dt=>Dt.map(ot=>{var Ct;return((Ct=ot.meta)==null?void 0:Ct.eventId)===le?{...ot,meta:{...ot.meta,feedback:$e}}:ot})),zn(Dt=>new Set(Dt).add(le)),kn!=null&&kn.runtimeId&&po&&Ob({runtimeId:kn.runtimeId,region:kn.region??"cn-beijing",appName:po,userId:pe,sessionId:xe,messageId:le,invocationId:(je=M.meta)==null?void 0:je.invocationId,rating:B,input:Q,output:Ne,createdAt:(lt=M.meta)!=null&<.ts?new Date(M.meta.ts*1e3).toISOString():void 0});try{const Dt=await RB({appName:n,userId:pe,sessionId:xe,eventId:le,rating:B});bt(xe,ot=>ot.map(Ct=>{var At;return((At=Ct.meta)==null?void 0:At.eventId)===le?{...Ct,meta:{...Ct.meta,feedback:Dt}}:Ct})),r(ot=>ot.map(Ct=>Ct.id===xe?{...Ct,state:{...Ct.state??{},[`veadk_feedback:${le}`]:Dt}}:Ct)),kn!=null&&kn.runtimeId&&po&&(Ob({runtimeId:kn.runtimeId,region:kn.region??"cn-beijing",appName:po,userId:pe,sessionId:xe,messageId:le,invocationId:(kt=M.meta)==null?void 0:kt.invocationId,rating:Dt.rating,input:Q,output:Ne,createdAt:(Pn=M.meta)!=null&&Pn.ts?new Date(M.meta.ts*1e3).toISOString():void 0}),DB({runtimeId:kn.runtimeId,region:kn.region??"cn-beijing",appName:po,pageSize:100}))}catch(Dt){bt(xe,ot=>ot.map(Ct=>{var At;return((At=Ct.meta)==null?void 0:At.eventId)===le?{...Ct,meta:{...Ct.meta,feedback:Ye}}:Ct})),kn!=null&&kn.runtimeId&&po&&Ob({runtimeId:kn.runtimeId,region:kn.region??"cn-beijing",appName:po,userId:pe,sessionId:xe,messageId:le,invocationId:(Bn=M.meta)==null?void 0:Bn.invocationId,rating:(Ye==null?void 0:Ye.rating)??null,input:Q,output:Ne,createdAt:(ft=M.meta)!=null&&ft.ts?new Date(M.meta.ts*1e3).toISOString():void 0}),We.current===xe&&De(Dt instanceof Error?Dt.message:String(Dt))}finally{zn(Dt=>{const ot=new Set(Dt);return ot.delete(le),ot})}},o0=async M=>{Nh(Ea());let B=Qe.current.get(M);B||(B=await Yw(M),Qe.current.set(M,B)),ct(B),Rs(Q=>Q+1),s(M),Qi(null),$i(""),Ai(""),xs(!1),vn(!1),Ft(null),ai(!1),As(!1),Dn(!1),bi(!1),rl()},VG=async M=>{await o0(M)},GG=M=>{if(!Ur){De("当前账号没有添加 Agent 的权限。");return}xs(!1),vn(!1),xE(M),ei(null),Ft(null),Dn(!0),De("")},fC=async(M,B=!1)=>{if(M.runtime)try{const Q=await Yb(M.runtime.runtimeId,M.name,M.runtime.region,M.runtime.currentVersion);await o0(Q)}catch(Q){const le=Q instanceof Error?Q.message:String(Q);if(De(le),B)throw new Error(le)}},KG=M=>{M.runtime&&(Qi(M),$i(""),Ai(""),xs(!1),vn(!0),De(""))},qG=M=>{if(!Ur){De("当前账号没有创建智能体的权限。");return}tC(M,!0)},IE=()=>{Vn(null),p&&ho(),We.current="",l(""),Ft(null),ai(!1),As(!1),Dn(!1),bi(!1),vn(!1),Qi(null),Le(null),_e(null),$i(""),Ai(""),xs(!0),Br(null),De("")},YG=()=>{Vn(null),p&&ho(),We.current="",l(""),Ft(null),ai(!1),As(!1),Dn(!1),bi(!1),vn(!1),Qi(null),Le(null),_e(null),xs(!1),Br("catalog"),De("")},WG=async M=>{if(bE(""),t0(""),M.runtimeId&&M.id.startsWith("detail:")){try{const B=await Yb(M.runtimeId,M.label,M.region??"cn-beijing",M.currentVersion);await o0(B)}catch(B){De(B instanceof Error?B.message:String(B))}return}await o0(M.id)},jE=wn!=null&&wn.runtime?Fa.find(M=>{var B;return M.runtimeId===((B=wn.runtime)==null?void 0:B.runtimeId)}):void 0,ol=wn!=null&&wn.runtime?{id:`detail:${wn.runtime.runtimeId}`,label:wn.name,app:wn.appName??wn.name,remote:!0,runtimeApp:jE==null?void 0:jE.apps[0],runtimeId:wn.runtime.runtimeId,region:wn.runtime.region,currentVersion:wn.runtime.currentVersion,canDelete:wn.runtime.canDelete}:null,hC=En!==null?"feedback":pc?"applications":Pr?"search":sl||Bu||Je||Ve?"agents":a||Ua||wh||Zg||Sh?null:"new-chat";return o.jsxs("div",{className:"layout",children:[o.jsx(Yte,{branding:Lr,access:Tt,features:tn,sessions:i,currentSessionId:a,activePage:hC,streamingSids:Qn,evaluatingSids:Ss,onNewChat:jG,onSearch:()=>{Vn(null),p&&ho(),Ft(null),ai(!1),As(!1),Dn(!1),vn(!1),Qi(null),Le(null),_e(null),xs(!1),Br(null),bi(!0),De("")},onQuickCreate:()=>{if(!Ur){De("当前账号没有添加 Agent 的权限。");return}p&&ho(),We.current="",l(""),ai(!1),As(!1),bi(!1),vn(!1),Qi(null),Le(null),_e(null),xs(!1),Br(null),Ft(null),ei(null),xE("cn-beijing"),Dn(!0),De("")},onSkillCenter:()=>{p&&ho(),Ft(null),As(!1),Dn(!1),bi(!1),vn(!1),Qi(null),Le(null),_e(null),xs(!1),Br(null),ai(!0),De("")},onAddAgent:()=>{if(!Ur){De("当前账号没有添加 Agent 的权限。");return}p&&ho(),We.current="",Ft(null),ai(!1),bi(!1),vn(!1),Qi(null),Le(null),_e(null),xs(!1),Br(null),l(""),Dn(!1),As(!0),De("")},onMyAgents:IE,onApplications:YG,onIssueFeedback:()=>{En===null&&(Vn(hC??(p?"sandbox":a?"conversation":"workspace")),De(""))},onPickSession:M=>{Vn(null),Ft(null),ai(!1),As(!1),Dn(!1),bi(!1),vn(!1),Qi(null),Le(null),_e(null),xs(!1),Br(null),De(""),kh(M)},onDeleteSession:RG,userInfo:pn,version:Mu,onLogout:bG}),(()=>{const M=o.jsxs("div",{className:`composer-slot${p?" sandbox-composer-wrap":""}`,children:[p&&o.jsx(RRe,{agentName:p.toolName==="codex"?"Codex":p.toolName==="openclaw"?"OpenClaw":"Hermes",onExit:rl}),p?o.jsx(fOe,{appName:n,value:cn,onChange:Ut,onSubmit:B=>void CG(B),disabled:!1,busy:y||Tn.commandBusy,attachments:ut,onAddFiles:kG,onRemoveAttachment:AG,actions:{onOpenTerminal:()=>void CE("terminal"),onOpenBrowser:()=>void CE("browser"),onOpenPermissions:()=>{S(""),T(!0)},onOpenWorkspace:()=>{S(""),I(!0)},workspaceLocked:p.workspaceLocked,settingsBusy:E,uploadBusy:K||y},models:Tn.models,modelsLoading:Tn.modelsLoading,modelsLoaded:Tn.modelsLoaded,currentModel:p.model,onRequestModels:()=>void Tn.loadModels(),skills:Tn.skills,skillsLoading:Tn.skillsLoading,skillsLoaded:Tn.skillsLoaded,selectedSkills:Tn.selectedSkills,onRequestSkills:()=>void Tn.loadSkills(),onSelectedSkillsChange:Tn.setSelectedSkills}):o.jsx(RTe,{sessionId:a,sessionInitializing:u,appName:n,agentName:n?uC(n):"Agent",value:cn,onChange:Ut,onSubmit:()=>{if(!p&&wt==="skill-create"){const xe=cn.trim();if(!xe||xt)return;const Ne={id:`pending-${Date.now()}`,prompt:xe,status:"provisioning",candidates:s2.map(($e,tt)=>({id:`pending-${tt}`,model:$e,modelLabel:$e,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}))};rn(!0);const Ye=++Hn.current;De(""),Ze(Ne),Ut(""),dje(xe,$e=>{Hn.current===Ye&&Ze($e)}).then($e=>{Hn.current===Ye&&Ze($e)}).catch($e=>{Hn.current===Ye&&(Ze(null),Ut(xe),De($e instanceof Error?$e.message:String($e)))}).finally(()=>{Hn.current===Ye&&rn(!1)});return}const B=cn;if(Ut(""),p){nC(B);return}const Q=ut,le=gn;pt([]),en(Va()),iC(B,Q,le),wo(Q)},disabled:p?!1:!pe||wt==="temporary"||wt==="agent"&&!n,busy:p?y:wt==="skill-create"?xt:hc,showMeta:Ke.length>0&&!p,attachments:p?[]:ut,skills:p?[]:fE,agents:p?[]:hE,invocation:p?Va():gn,capabilitiesLoading:!p&&Rn,allowAttachments:!p,onInvocationChange:en,onAddFiles:BG,onRemoveAttachment:Yg,newChatMode:p?"agent":wt,newChatTask:p?null:Ge,newChatLayout:!p&&Ke.length===0&&ye===null,showAgentPicker:!p&&Ke.length===0&&ye===null&&wt==="agent",agentPickerDisabled:!pe||hc,selectedRuntimeId:Zi==null?void 0:Zi.runtimeId,runtimeScope:Tt.capabilities.runtimeScope,onSelectRuntime:async B=>{var Q;await fC({id:B.runtimeId,name:B.name,description:((Q=B.description)==null?void 0:Q.trim())||"暂无描述",createdAt:B.createdAt??"",specificationLabel:"地域",specification:B.region==="cn-shanghai"?"上海":"北京",isMine:B.isMine,runtime:{runtimeId:B.runtimeId,region:B.region,currentVersion:B.currentVersion,canDelete:B.canDelete}},!0)},onSelectSandboxSession:AE,showModeSelector:!1,temporaryEnabled:vt&&it.temporaryEnabled,skillCreateEnabled:vt&&it.skillCreateEnabled,harnessEnabled:vt&&it.harnessEnabled,builtinTools:vt?it.builtinTools:[],onModeChange:B=>{if(!(B==="temporary"&&!it.temporaryEnabled||B==="skill-create"&&!it.skillCreateEnabled)){if(B==="temporary"){Yt(null),$t(B),tC();return}if($t(B),B!=="agent"&&Yt(null),De(""),B==="skill-create"){en(Va());const Q=a&&Fe.length===0&&ut.length>0?a:"";xh(ut),pt([]),Q&&(We.current="",l(""),Du(Q))}}},onTaskChange:Yt})]});return o.jsx("section",{className:"main-shell",children:o.jsxs("main",{className:`main${p?" is-sandbox-session":""}`,children:[_t&&o.jsx("div",{className:"error",role:"alert",children:_t}),xn&&o.jsx("div",{className:"error",role:"alert",children:xn}),cE&&o.jsxs("div",{className:"session-loading",children:[o.jsx(mn,{className:"icon spin"})," 加载会话…"]}),H2&&!lC&&!aC&&!oC&&!Pr&&!wh&&al===null&&o.jsx("div",{className:"case-return-bar",children:o.jsxs("button",{type:"button",onClick:MG,children:[o.jsx(wk,{"aria-hidden":!0}),o.jsx("span",{children:"返回评测案例"})]})}),En!==null?o.jsx(NOe,{initialModule:POe(En),onSubmit:zG}):pc==="coding-agents"?o.jsx(HNe,{onBack:()=>Br("catalog")}):pc==="feishu"?o.jsx(_Ne,{onBack:()=>Br("catalog")}):pc&&pc!=="catalog"?o.jsx(gNe,{automation:pc,onBack:()=>Br("catalog")}):pc==="catalog"?o.jsx(dNe,{onOpen:Br}):Ve?o.jsx(iOe,{workspace:Ve,onBack:IE}):Je?o.jsx(JRe,{session:Je,onBack:IE,onOpen:()=>AE(Je),onDelete:()=>wG(Je)}):sl?o.jsx(U_e,{canCreate:Ur,runtimeScope:Tt.capabilities.runtimeScope,onCreateAgent:GG,onUseAgent:fC,onViewAgentDetails:KG,onCreateSandboxAgent:qG,onUseSandboxAgent:AE,onViewSandboxAgentDetails:vG,sandboxRefreshKey:ke,connectedRuntimeId:Ch,hiddenRuntimeIds:aG,drafts:Pu,deploymentTasks:Xg,draftDeploymentTaskIds:pE,onViewDeploymentTask:_E,onEditDraft:B=>{xs(!1),ei(B.draft),gi(B.id),Lt.current=B,ua(B.deploymentTarget??null),$i(""),Ai(""),Ft("custom"),De("")},onDeleteDraft:B=>X2([B])}):lC?o.jsx(kSe,{agents:ol?[ol]:$G,drafts:Pu,agentOrder:st,selectedAgentId:n,agentInfo:St,agentInfoAgentId:n,loadingAgentInfo:Rn,canCreate:Ur,canUpdate:Ur||rC,loadingAgents:sG,agentsError:iG,deploymentTasks:Xg,focusedDeploymentTaskId:Y2,focusedAgentId:(ol==null?void 0:ol.id)??W2,focusedAgentSection:ZV,focusedCaseKind:JV,feedbackCasePreview:tG,detailOnly:!0,onRetryAgents:()=>void wE(),onAgentOrderChange:cG,onDeleteAgents:uG,onDeleteDrafts:X2,onSelectAgent:VG,onTalkAgent:WG,onOpenFeedbackCase:B=>void OG(B),onFeedbackCasesDeleted:LG,onCreateAgent:()=>{if(!Ur){De("当前账号没有添加 Agent 的权限。");return}vn(!1),Dn(!0),Ft(null),ei(null),ua(null),xE("cn-beijing"),gi(""),Lt.current=null,$i(""),Ai(""),De("")},onUpdateAgent:(B,Q)=>{var Ye,$e;if(!rC&&!Ur){De("当前账号没有管理 Agent 的权限。");return}if(!Q.canUpdate){De(Q.reason||"当前 Runtime 不支持原地更新。");return}if(!Q.runtime.runtimeId){De("仅支持更新已部署的云端智能体。");return}if(!Q.runtime.region){De("Runtime 缺少地域信息,无法更新。");return}if(!((Ye=Q.agent)!=null&&Ye.appName)){De("Runtime 缺少智能体名称,无法更新。");return}const le=Object.fromEntries(Q.runtime.envs.map(({key:tt,value:rt})=>[tt,rt])),xe={...B,deployment:{...B.deployment??{feishuEnabled:!1},network:Q.runtime.network,envValues:{...le,...(($e=B.deployment)==null?void 0:$e.envValues)??{}}}};vn(!1),ei(xe);const Ne=`runtime-${Q.runtime.runtimeId}`;gi(Ne),Lt.current=Pu.find(tt=>tt.id===Ne)??null,$i(""),Ai(""),ua({runtimeId:Q.runtime.runtimeId,name:Q.runtime.name||Q.agent.name||B.name,region:Q.runtime.region,appName:Q.agent.appName,currentVersion:Q.runtime.currentVersion}),Ft("custom"),De("")},onEditDraft:B=>{vn(!1),ei(B.draft),gi(B.id),Lt.current=B,ua(B.deploymentTarget??null),$i(""),Ai(""),Ft("custom"),De("")}},(ol==null?void 0:ol.id)??"workspace"):aC?o.jsx(pH,{title:"您想以哪种方式添加 Agent 来运行?",sub:"选择最适合你的方式,下一步即可开始",cards:[{key:"scratch",icon:GOe,title:"从 0 快速创建",desc:"用智能 / 自定义 / 模板 / 工作流的方式从零创建一个 Agent。",onClick:()=>{Dn(!1),ei(null),Ft("menu")}},{key:"package",icon:KOe,title:"从代码包添加和部署",desc:"上传 Agent 项目压缩包,查看代码并直接部署到 AgentKit Runtime。",onClick:()=>{Dn(!1),ei(null),Ft("package")}},{key:"migration",icon:qOe,title:"从存量迁移",desc:"从您的 LangChain / Dify 等存量项目迁移至 AgentKit Runtime",status:"敬请期待",disabled:!0,onClick:()=>{}}]}):Pr?o.jsx(Ute,{userId:pe,appId:n,agentInfo:St,capabilitiesLoading:Rn,agentLabel:uC,onOpenSession:yG}):oC?o.jsx(iSe,{onAdded:B=>{Nh(Ea()),As(!1),s(B)},onCancel:()=>As(!1)}):wh?o.jsx(eSe,{}):al!==null&&!mE?o.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:[o.jsx("div",{style:{fontSize:18,fontWeight:600},children:"需要配置火山引擎 AK/SK"}),o.jsxs("div",{style:{maxWidth:420,lineHeight:1.6},children:["智能体工作台需要 Volcengine 凭据才能使用。请在运行环境中设置"," ",o.jsx("code",{children:"VOLCENGINE_ACCESS_KEY"})," 与"," ",o.jsx("code",{children:"VOLCENGINE_SECRET_KEY"})," 后重试。"]})]}):al==="menu"?o.jsx(tAe,{onSelect:B=>{ei(null),ua(null),$i(""),Ai(""),gi(B==="custom"?`draft-${Date.now().toString(36)}`:""),Lt.current=null,Ft(B)},onImport:B=>{ei(B),ua(null),$i(""),Ai(""),gi(`draft-${Date.now().toString(36)}`),Lt.current=null,Ft("custom")}}):al==="intelligent"?o.jsx(WAe,{userId:pe,onBack:()=>Ft("menu"),onCreate:r0,onAgentAdded:SE,onDeploymentTaskChange:vh}):al==="custom"?o.jsx(PIe,{initialDraft:Jg??void 0,onBack:()=>Ft("menu"),onCreate:r0,onAgentAdded:SE,features:tn,onDeploymentTaskChange:vh,deploymentTarget:Uu??void 0,initialDeployRegion:s0,onDraftChange:(B,Q)=>{Mt&&(Q?lG(Mt,B,Uu??void 0):Q2(Mt))},onDiscard:Mt?()=>{Q2(Mt),gi(""),Lt.current=null,ei(null),ua(null),$i(""),Ai(n),Ft(null),Dn(!1),vn(!0),De("")}:void 0,onDeploymentStarted:Z2,onDeploymentComplete:J2},Mt||"custom"):al==="template"?o.jsx(FIe,{onBack:()=>Ft("menu"),onCreate:r0}):al==="workflow"?o.jsx(YIe,{onBack:()=>Ft("menu"),onCreate:r0}):al==="package"?o.jsx(JIe,{onBack:()=>{Ft(null),Dn(!0)},onAgentAdded:SE,onDeploymentTaskChange:vh,onDeploymentStarted:Z2,onDeploymentComplete:J2,initialDeployRegion:s0}):Ke.length===0&&ye?o.jsx(Tje,{initialJob:ye}):Ke.length===0&&!vt?o.jsxs("div",{className:"session-loading",children:[o.jsx(mn,{className:"icon spin"})," 正在检查 Agent 能力…"]}):Ke.length===0?o.jsxs("div",{className:"welcome",children:[o.jsxs("div",{className:"welcome-primary",children:[o.jsxs("div",{className:"welcome-heading",children:[o.jsx(TRe,{canUpdate:Tt.role==="admin"}),o.jsx("h1",{className:"welcome-title",children:p?"让灵感自由生长":wt==="skill-create"?"想创建一个什么 Skill?":ca})]}),M]}),o.jsx(pRe,{})]},`welcome-${it.agentId??n}`):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`transcript${tl?" is-streaming":""}`,ref:Th,onScroll:dG,onWheel:fG,onTouchMove:hG,children:Ke.map((B,Q)=>{var ft,Dt,ot,Ct,At,ds,Ci;const le=Q===Ke.length-1;if(B.role==="system")return B.activity?o.jsx("div",{className:"turn turn--system",children:o.jsx(ORe,{activity:B.activity,time:HN((ft=B.meta)==null?void 0:ft.ts)})},B.activity.id):null;if(B.role==="user"){const Sn=B.blocks.map(Ii=>Ii.kind==="text"?Ii.text:"").join(""),Fr=B.blocks.flatMap(Ii=>Ii.kind==="attachment"?Ii.files:[]),mo=B.blocks.find(Ii=>Ii.kind==="invocation");return o.jsxs(is.div,{className:"turn turn--user",initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[(mo==null?void 0:mo.kind)==="invocation"&&o.jsx(F1,{value:mo.value}),Fr.length>0&&o.jsx($1,{appName:n,items:Fr}),Sn&&o.jsx("div",{className:"bubble",children:o.jsx(rh,{text:Sn})}),o.jsxs("div",{className:"turn-actions turn-actions--right",children:[((Dt=B.meta)==null?void 0:Dt.ts)&&o.jsx("span",{className:"meta-text",children:HN(B.meta.ts)}),o.jsx(vD,{text:Sn})]})]},Q)}const xe=((ot=B.meta)==null?void 0:ot.author)??"",Ne=xe&&Fi?$N(Fi,xe):void 0,Ye=!!(xe&&qg.length>0&&!qg.includes(xe)),$e=(Ne==null?void 0:Ne.name)||xe,tt=(Ne==null?void 0:Ne.description)||(Ye?"正在执行主 Agent 移交的任务。":"");if(B.blocks.length>0&&B.blocks.every(Sn=>Sn.kind==="agent-transfer"))return null;const rt=B.blocks.length===0,je=((At=(Ct=B.meta)==null?void 0:Ct.feedback)==null?void 0:At.rating)??null,lt=((ds=B.meta)==null?void 0:ds.eventId)??"",kt=ki.has(lt),Pn=!!(Zi&<&&Rc(B)),Bn=Pn?ED(Ke,Q):"";return o.jsxs(is.div,{ref:Sn=>{lt&&(Sn?NE.current.set(lt,Sn):NE.current.delete(lt))},className:["turn turn--assistant",Ye?"turn--subagent":"",_h&&_h===lt?"is-feedback-target":""].filter(Boolean).join(" "),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[Ye&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"subagent-run-label",children:[o.jsxs("span",{className:"subagent-run-handoff",children:[o.jsx(XJ,{}),o.jsx("span",{children:"智能体移交"})]}),o.jsx("span",{className:"subagent-run-title",children:$e})]}),o.jsx("p",{className:"subagent-run-description",title:tt,children:tt})]}),rt?le&&fo?o.jsx(fH,{}):null:o.jsxs(o.Fragment,{children:[o.jsx(t2,{appName:n,blocks:B.blocks,streaming:le&&(fo||Vg),onStreamFrame:le?pG:void 0,onAction:UG,onAuth:FG,onArtifactDownload:(Sn,Fr)=>UB(n,pe,a,Sn,Fr),onArtifactPreview:(Sn,Fr)=>$B(n,pe,a,Sn,Fr)}),!(le&&fo)&&!QOe(B)&&o.jsx("div",{className:"turn-empty",children:"本次没有返回可显示的内容。"}),!(le&&fo)&&!ZOe(B)&&o.jsxs("div",{className:"turn-meta",children:[p&&((Ci=B.meta)!=null&&Ci.sandboxUsage)?o.jsx(LRe,{usage:B.meta.sandboxUsage}):null,o.jsxs("div",{className:"turn-actions",children:[Pn&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:`icon-btn feedback-btn${je==="good"?" feedback-btn--good":""}`,"aria-label":"赞","aria-pressed":je==="good","aria-busy":kt,title:je==="good"?"取消点赞":"赞",disabled:kt,onClick:()=>void dC(B,je==="good"?null:"good",Bn),children:o.jsx($te,{className:"icon",filled:je==="good"})}),o.jsx("button",{type:"button",className:`icon-btn feedback-btn${je==="bad"?" feedback-btn--bad":""}`,"aria-label":"踩","aria-pressed":je==="bad","aria-busy":kt,title:je==="bad"?"取消点踩":"踩",disabled:kt,onClick:()=>void dC(B,je==="bad"?null:"bad",Bn),children:o.jsx(Hte,{className:"icon",filled:je==="bad"})})]}),!p&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"icon-btn","aria-label":"问题反馈",title:"问题反馈",onClick:()=>Nt({turn:B,input:ED(Ke,Q)}),children:o.jsx(y8,{className:"icon"})}),o.jsx("button",{type:"button",className:"icon-btn",title:"Tracing 火焰图",onClick:()=>{var Sn;Mr((Sn=B.meta)!=null&&Sn.ts?B.meta.ts*1e3:Date.now()),Ba(!0)},children:o.jsx(YOe,{})})]}),o.jsx(vD,{text:Rc(B)})]}),B.meta&&o.jsx("span",{className:"meta-text",children:WOe(B.meta)})]})]})]},Q)})}),!p&&o.jsx(xfe,{appName:n,info:St,loading:Rn,activeAgent:nl,seenAgents:bh,execPath:Kg,capabilities:bn,capabilityLoading:Xn,capabilityMutating:Js,builtinTools:pi,onAddCapability:DG,onRemoveCapability:B=>void PG(B)}),o.jsx("div",{className:"conversation-composer-slot",children:M})]})]})})})(),Ht&&a&&o.jsx(EOe,{onClose:()=>Nt(null),onSubmit:HG}),Pa&&a&&o.jsx(SV,{appName:n,sessionId:a,endTimeMs:Ui,onClose:()=>Ba(!1)}),o.jsx(jRe,{open:W,state:ue,agentKind:ge,error:Se,onCancel:xG,onConfirm:M=>void EG(M)}),p?o.jsxs(o.Fragment,{children:[o.jsx(VRe,{open:j!==null,kind:j??"terminal",launch:z,loading:F,error:O,onReload:()=>{j&&CE(j)},onClose:()=>{L(null),D(null),A(!1),P("")}}),o.jsx(WRe,{open:k,value:p.permissions,busy:E||y,error:_,onSave:M=>void SG(M),onClose:()=>{E||(T(!1),S(""))}}),o.jsx(XRe,{open:C,cwd:p.cwd,locked:p.workspaceLocked,busy:E,error:_,browse:_G,onSave:M=>void NG(M),onClose:()=>{E||(I(!1),S(""))}}),o.jsx(GRe,{open:Tn.threadsOpen,threads:Tn.threads,currentThreadId:p.threadId,loading:Tn.threadsLoading,error:Tn.threadsError,onSelect:M=>void Tn.resumeThread(M),onClose:Tn.closeThreads}),o.jsx(QRe,{approval:$,busy:Y,error:U,onDecision:M=>void TG(M)})]}):null,o.jsx(gOe,{open:uc,checking:Zt,error:Ns,onLogin:()=>void mG()}),oG&&o.jsx("div",{className:"confirm-scrim",onClick:()=>EE(!1),children:o.jsxs("div",{className:"confirm-box",onClick:M=>M.stopPropagation(),children:[o.jsx("div",{className:"confirm-title",children:"返回创建首页?"}),o.jsx("div",{className:"confirm-text",children:"返回后当前填写的内容将会丢失,确定要返回吗?"}),o.jsxs("div",{className:"confirm-actions",children:[o.jsx("button",{className:"confirm-btn",onClick:()=>EE(!1),children:"取消"}),o.jsx("button",{className:"confirm-btn confirm-btn--danger",onClick:()=>{ei(null),Ft("menu"),EE(!1)},children:"确定返回"})]})]})})]})}const kD="veadk.preloadRecoveryAt";window.addEventListener("vite:preloadError",e=>{const t=Date.now();let n=0;try{n=Number(sessionStorage.getItem(kD)||"0")}catch{}if(!(t-n<1e4)){e.preventDefault();try{sessionStorage.setItem(kD,String(t))}catch{}window.location.reload()}});(()=>{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})()||WY.createRoot(document.getElementById("root")).render(o.jsx(Bt.StrictMode,{children:o.jsx(aW,{reducedMotion:"user",children:o.jsx(UJ,{maskOpacity:.9,children:o.jsx(lMe,{})})})}));export{_2 as $,_be as A,Nbe as B,W7 as C,o as D,mt as E,$n as F,qt as G,fMe as H,sV as I,$0e as J,hi as K,g as L,C1 as M,Cr as N,hMe as O,Fz as P,zp as Q,Bt as R,hu as S,_Ce as T,Gz as U,Pi as V,cr as W,Iu as X,J1 as Y,Vz as Z,mu as _,aa as a,B7 as a0,nV as b,CCe as c,WM as d,Af as e,Yi as f,pMe as g,Az as h,lc as i,tE as j,Lf as k,ZAe as l,vMe as m,vA as n,Tme as o,a2e as p,Pm as q,nn as r,z0e as s,X0e as t,Ame as u,Df as v,Xbe as w,j0e as x,R0e as y,iye as z}; +`),toolCalls:Q.flatMap(CR),trace:le})},mC=async(O,B,Q="")=>{var tt,it,Ie,ct,At,Ln,Dn,dt;const le=(tt=O.meta)==null?void 0:tt.eventId,be=a;if(!le||!be||!Qi)return;const _e=Oc(O),Ye=(it=O.meta)==null?void 0:it.feedback,$e={...Ye,rating:B,syncStatus:"syncing",updatedAt:Date.now()/1e3};Nt(be,Bt=>Bt.map(lt=>{var Rt;return((Rt=lt.meta)==null?void 0:Rt.eventId)===le?{...lt,meta:{...lt.meta,feedback:$e}}:lt})),ys(Bt=>new Set(Bt).add(le)),kn!=null&&kn.runtimeId&&Eo&&Lb({runtimeId:kn.runtimeId,region:kn.region??"cn-beijing",appName:Eo,userId:Me,sessionId:be,messageId:le,invocationId:(Ie=O.meta)==null?void 0:Ie.invocationId,rating:B,input:Q,output:_e,createdAt:(ct=O.meta)!=null&&ct.ts?new Date(O.meta.ts*1e3).toISOString():void 0});try{const Bt=await DB({appName:n,userId:Me,sessionId:be,eventId:le,rating:B});Nt(be,lt=>lt.map(Rt=>{var Ct;return((Ct=Rt.meta)==null?void 0:Ct.eventId)===le?{...Rt,meta:{...Rt.meta,feedback:Bt}}:Rt})),r(lt=>lt.map(Rt=>Rt.id===be?{...Rt,state:{...Rt.state??{},[`veadk_feedback:${le}`]:Bt}}:Rt)),kn!=null&&kn.runtimeId&&Eo&&(Lb({runtimeId:kn.runtimeId,region:kn.region??"cn-beijing",appName:Eo,userId:Me,sessionId:be,messageId:le,invocationId:(At=O.meta)==null?void 0:At.invocationId,rating:Bt.rating,input:Q,output:_e,createdAt:(Ln=O.meta)!=null&&Ln.ts?new Date(O.meta.ts*1e3).toISOString():void 0}),FB({runtimeId:kn.runtimeId,region:kn.region??"cn-beijing",appName:Eo,pageSize:100}))}catch(Bt){Nt(be,lt=>lt.map(Rt=>{var Ct;return((Ct=Rt.meta)==null?void 0:Ct.eventId)===le?{...Rt,meta:{...Rt.meta,feedback:Ye}}:Rt})),kn!=null&&kn.runtimeId&&Eo&&Lb({runtimeId:kn.runtimeId,region:kn.region??"cn-beijing",appName:Eo,userId:Me,sessionId:be,messageId:le,invocationId:(Dn=O.meta)==null?void 0:Dn.invocationId,rating:(Ye==null?void 0:Ye.rating)??null,input:Q,output:_e,createdAt:(dt=O.meta)!=null&&dt.ts?new Date(O.meta.ts*1e3).toISOString():void 0}),qt.current===be&&Pe(Bt instanceof Error?Bt.message:String(Bt))}finally{ys(Bt=>{const lt=new Set(Bt);return lt.delete(le),lt})}},c0=async O=>{_h(xa());let B=bt.current.get(O);B||(B=await Qw(O),bt.current.set(O,B)),We(B),ps(Q=>Q+1),s(O),Xi(null),Fi(""),ki(""),Es(!1),yn(!1),Ht(null),ti(!1),ks(!1),$(!1),bi(!1),ul()},YG=async O=>{await c0(O)},WG=O=>{if(!Dr){Pe("当前账号没有添加 Agent 的权限。");return}Es(!1),yn(!1),wE(O),fe(null),Ht(null),$(!0),Pe("")},gC=async(O,B=!1)=>{if(O.runtime)try{const Q=await Xb(O.runtime.runtimeId,O.name,O.runtime.region,O.runtime.currentVersion);await c0(Q)}catch(Q){const le=Q instanceof Error?Q.message:String(Q);if(Pe(le),B)throw new Error(le)}},XG=O=>{O.runtime&&(Xi(O),Fi(""),ki(""),Es(!1),yn(!0),Pe(""))},QG=O=>{if(!Dr){Pe("当前账号没有创建智能体的权限。");return}rC(O,!0)},OE=()=>{mi(null),p&&xo(),qt.current="",l(""),Ht(null),ti(!1),ks(!1),$(!1),bi(!1),yn(!1),Xi(null),De(null),Se(null),Fi(""),ki(""),Es(!0),Lr(null),Pe("")},ZG=()=>{mi(null),p&&xo(),qt.current="",l(""),Ht(null),ti(!1),ks(!1),$(!1),bi(!1),yn(!1),Xi(null),De(null),Se(null),Es(!1),Lr("catalog"),Pe("")},JG=async O=>{if(EE(""),s0(""),O.runtimeId&&O.id.startsWith("detail:")){try{const B=await Xb(O.runtimeId,O.label,O.region??"cn-beijing",O.currentVersion);await c0(B)}catch(B){Pe(B instanceof Error?B.message:String(B))}return}await c0(O.id)},ME=xn!=null&&xn.runtime?Fa.find(O=>{var B;return O.runtimeId===((B=xn.runtime)==null?void 0:B.runtimeId)}):void 0,fl=xn!=null&&xn.runtime?{id:`detail:${xn.runtime.runtimeId}`,label:xn.name,app:xn.appName??xn.name,remote:!0,runtimeApp:ME==null?void 0:ME.apps[0],runtimeId:xn.runtime.runtimeId,region:xn.runtime.region,currentVersion:xn.runtime.currentVersion,canDelete:xn.runtime.canDelete}:null,bC=Js!==null?"feedback":mc?"applications":xE?"search":ll||Fu||Qe||Ke?"agents":a||yo||Uu||vh||wh?null:"new-chat";return o.jsxs("div",{className:"layout",children:[o.jsx(Zte,{branding:Pa,access:mt,features:uo,sessions:i,currentSessionId:a,activePage:bC,streamingSids:gs,evaluatingSids:Nn,onNewChat:LG,onSearch:()=>{mi(null),p&&xo(),Ht(null),ti(!1),ks(!1),$(!1),yn(!1),Xi(null),De(null),Se(null),Es(!1),Lr(null),bi(!0),Pe("")},onQuickCreate:()=>{if(!Dr){Pe("当前账号没有添加 Agent 的权限。");return}p&&xo(),qt.current="",l(""),ti(!1),ks(!1),bi(!1),yn(!1),Xi(null),De(null),Se(null),Es(!1),Lr(null),Ht(null),fe(null),wE("cn-beijing"),$(!0),Pe("")},onSkillCenter:()=>{p&&xo(),Ht(null),ks(!1),$(!1),bi(!1),yn(!1),Xi(null),De(null),Se(null),Es(!1),Lr(null),ti(!0),Pe("")},onAddAgent:()=>{if(!Dr){Pe("当前账号没有添加 Agent 的权限。");return}p&&xo(),qt.current="",Ht(null),ti(!1),bi(!1),yn(!1),Xi(null),De(null),Se(null),Es(!1),Lr(null),l(""),$(!1),ks(!0),Pe("")},onMyAgents:OE,onApplications:ZG,onIssueFeedback:()=>{Js===null&&(mi(bC??(p?"sandbox":a?"conversation":"workspace")),Pe(""))},onPickSession:O=>{mi(null),Ht(null),ti(!1),ks(!1),$(!1),bi(!1),yn(!1),Xi(null),De(null),Se(null),Es(!1),Lr(null),Pe(""),Th(O)},onDeleteSession:DG,userInfo:xs,version:ho,onLogout:vG}),(()=>{const O=o.jsxs("div",{className:`composer-slot${p?" sandbox-composer-wrap":""}`,children:[p&&o.jsx(DRe,{agentName:p.toolName==="codex"?"Codex":p.toolName==="openclaw"?"OpenClaw":"Hermes",onExit:ul}),p?o.jsx(gOe,{appName:n,value:Ve,onChange:Tt,onSubmit:B=>void OG(B),disabled:!1,busy:y||Yn.commandBusy,attachments:Pt,onAddFiles:jG,onRemoveAttachment:RG,actions:{onOpenTerminal:()=>void RE("terminal"),onOpenBrowser:()=>void RE("browser"),onOpenPermissions:()=>{S(""),T(!0)},onOpenWorkspace:()=>{S(""),I(!0)},workspaceLocked:p.workspaceLocked,settingsBusy:E,uploadBusy:K||y},models:Yn.models,modelsLoading:Yn.modelsLoading,modelsLoaded:Yn.modelsLoaded,currentModel:p.model,onRequestModels:()=>void Yn.loadModels(),skills:Yn.skills,skillsLoading:Yn.skillsLoading,skillsLoaded:Yn.skillsLoaded,selectedSkills:Yn.selectedSkills,onRequestSkills:()=>void Yn.loadSkills(),onSelectedSkillsChange:Yn.setSelectedSkills}):o.jsx(DTe,{sessionId:a,sessionInitializing:u,appName:n,agentName:n?pC(n):"Agent",value:Ve,onChange:Tt,onSubmit:()=>{if(!p&&rt==="skill-create"){const be=Ve.trim();if(!be||$t)return;const _e={id:`pending-${Date.now()}`,prompt:be,status:"provisioning",candidates:o2.map(($e,tt)=>({id:`pending-${tt}`,model:$e,modelLabel:$e,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}))};hn(!0);const Ye=++cn.current;Pe(""),xt(_e),Tt(""),mje(be,$e=>{cn.current===Ye&&xt($e)}).then($e=>{cn.current===Ye&&xt($e)}).catch($e=>{cn.current===Ye&&(xt(null),Tt(be),Pe($e instanceof Error?$e.message:String($e)))}).finally(()=>{cn.current===Ye&&hn(!1)});return}const B=Ve;if(Tt(""),p){aC(B);return}const Q=Pt,le=Sn;jt([]),pn(Va()),lC(B,Q,le),Jw(Q)},disabled:p?!1:!Me||rt==="temporary"||rt==="agent"&&!n,busy:p?y:rt==="skill-create"?$t:bo,showMeta:Et.length>0&&!p,attachments:p?[]:Pt,skills:p?[]:Xg,agents:p?[]:Qg,invocation:p?Va():Sn,capabilitiesLoading:!p&&Rn,allowAttachments:!p,onInvocationChange:pn,onAddFiles:HG,onRemoveAttachment:gE,newChatMode:p?"agent":rt,newChatTask:p?null:Ze,newChatLayout:!p&&Et.length===0&&Kn===null,showAgentPicker:!p&&Et.length===0&&Kn===null&&rt==="agent",agentPickerDisabled:!Me||bo,selectedRuntimeId:Qi==null?void 0:Qi.runtimeId,runtimeScope:mt.capabilities.runtimeScope,onSelectRuntime:async B=>{var Q;await gC({id:B.runtimeId,name:B.name,description:((Q=B.description)==null?void 0:Q.trim())||"暂无描述",createdAt:B.createdAt??"",specificationLabel:"地域",specification:B.region==="cn-shanghai"?"上海":"北京",isMine:B.isMine,runtime:{runtimeId:B.runtimeId,region:B.region,currentVersion:B.currentVersion,canDelete:B.canDelete}},!0)},onSelectSandboxSession:jE,showModeSelector:!1,temporaryEnabled:an&&me.temporaryEnabled,skillCreateEnabled:an&&me.skillCreateEnabled,harnessEnabled:an&&me.harnessEnabled,builtinTools:an?me.builtinTools:[],onModeChange:B=>{if(!(B==="temporary"&&!me.temporaryEnabled||B==="skill-create"&&!me.skillCreateEnabled)){if(B==="temporary"){_t(null),ut(B),rC();return}if(ut(B),B!=="agent"&&_t(null),Pe(""),B==="skill-create"){pn(Va());const Q=a&&fn.length===0&&Pt.length>0?a:"";yh(Pt),jt([]),Q&&(qt.current="",l(""),Bu(Q))}}},onTaskChange:_t})]});return o.jsx("section",{className:"main-shell",children:o.jsxs("main",{className:`main${p?" is-sandbox-session":""}`,children:[pi&&o.jsx("div",{className:"error",role:"alert",children:pi}),Vt&&o.jsx("div",{className:"error",role:"alert",children:Vt}),dE&&o.jsxs("div",{className:"session-loading",children:[o.jsx(dn,{className:"icon spin"})," 加载会话…"]}),K2&&!fC&&!uC&&!dC&&!xE&&!Uu&&dl===null&&o.jsx("div",{className:"case-return-bar",children:o.jsxs("button",{type:"button",onClick:BG,children:[o.jsx(Tk,{"aria-hidden":!0}),o.jsx("span",{children:"返回评测案例"})]})}),Js!==null?o.jsx(COe,{initialModule:$Oe(Js),onSubmit:qG}):mc==="coding-agents"?o.jsx(KNe,{onBack:()=>Lr("catalog")}):mc==="feishu"?o.jsx(ANe,{onBack:()=>Lr("catalog")}):mc&&mc!=="catalog"?o.jsx(ENe,{automation:mc,onBack:()=>Lr("catalog")}):mc==="catalog"?o.jsx(mNe,{onOpen:Lr}):Ke?o.jsx(lOe,{workspace:Ke,onBack:OE}):Qe?o.jsx(sOe,{session:Qe,onBack:OE,onOpen:()=>jE(Qe),onDelete:()=>TG(Qe)}):ll?o.jsx(z_e,{canCreate:Dr,runtimeScope:mt.capabilities.runtimeScope,onCreateAgent:WG,onUseAgent:gC,onViewAgentDetails:XG,onCreateSandboxAgent:QG,onUseSandboxAgent:jE,onViewSandboxAgentDetails:NG,sandboxRefreshKey:Ne,connectedRuntimeId:Ah,hiddenRuntimeIds:uG,drafts:Ce,deploymentTasks:Jg,draftDeploymentTaskIds:bE,onViewDeploymentTask:kE,onEditDraft:B=>{Es(!1),fe(B.draft),Mr(B.id),hr.current=B,ca(B.deploymentTarget??null),Fi(""),ki(""),Ht("custom"),Pe("")},onDeleteDraft:B=>eC([B])}):fC?o.jsx(jSe,{agents:fl?[fl]:GG,drafts:Ce,agentOrder:un,selectedAgentId:n,agentInfo:zt,agentInfoAgentId:n,loadingAgentInfo:Rn,canCreate:Dr,canUpdate:Dr||cC,loadingAgents:oG,agentsError:lG,deploymentTasks:Jg,focusedDeploymentTaskId:Z2,focusedAgentId:(fl==null?void 0:fl.id)??J2,focusedAgentSection:nG,focusedCaseKind:sG,feedbackCasePreview:rG,detailOnly:!0,onRetryAgents:()=>void NE(),onAgentOrderChange:hG,onDeleteAgents:pG,onDeleteDrafts:eC,onSelectAgent:YG,onTalkAgent:JG,onOpenFeedbackCase:B=>void PG(B),onFeedbackCasesDeleted:UG,onCreateAgent:()=>{if(!Dr){Pe("当前账号没有添加 Agent 的权限。");return}yn(!1),$(!0),Ht(null),fe(null),ca(null),wE("cn-beijing"),Mr(""),hr.current=null,Fi(""),ki(""),Pe("")},onUpdateAgent:(B,Q)=>{var Ye,$e;if(!cC&&!Dr){Pe("当前账号没有管理 Agent 的权限。");return}if(!Q.canUpdate){Pe(Q.reason||"当前 Runtime 不支持原地更新。");return}if(!Q.runtime.runtimeId){Pe("仅支持更新已部署的云端智能体。");return}if(!Q.runtime.region){Pe("Runtime 缺少地域信息,无法更新。");return}if(!((Ye=Q.agent)!=null&&Ye.appName)){Pe("Runtime 缺少智能体名称,无法更新。");return}const le=Object.fromEntries(Q.runtime.envs.map(({key:tt,value:it})=>[tt,it])),be={...B,deployment:{...B.deployment??{feishuEnabled:!1},network:Q.runtime.network,envValues:{...le,...(($e=B.deployment)==null?void 0:$e.envValues)??{}}}};yn(!1),fe(be);const _e=`runtime-${Q.runtime.runtimeId}`;Mr(_e),hr.current=Ce.find(tt=>tt.id===_e)??null,Fi(""),ki(""),ca({runtimeId:Q.runtime.runtimeId,name:Q.runtime.name||Q.agent.name||B.name,region:Q.runtime.region,appName:Q.agent.appName,currentVersion:Q.runtime.currentVersion}),Ht("custom"),Pe("")},onEditDraft:B=>{yn(!1),fe(B.draft),Mr(B.id),hr.current=B,ca(B.deploymentTarget??null),Fi(""),ki(""),Ht("custom"),Pe("")}},(fl==null?void 0:fl.id)??"workspace"):uC?o.jsx(yH,{title:"您想以哪种方式添加 Agent 来运行?",sub:"选择最适合你的方式,下一步即可开始",cards:[{key:"scratch",icon:WOe,title:"从 0 快速创建",desc:"用智能 / 自定义 / 模板 / 工作流的方式从零创建一个 Agent。",onClick:()=>{$(!1),fe(null),Ht("menu")}},{key:"package",icon:XOe,title:"从代码包添加和部署",desc:"上传 Agent 项目压缩包,查看代码并直接部署到 AgentKit Runtime。",onClick:()=>{$(!1),fe(null),Ht("package")}},{key:"migration",icon:QOe,title:"从存量迁移",desc:"从您的 LangChain / Dify 等存量项目迁移至 AgentKit Runtime",status:"敬请期待",disabled:!0,onClick:()=>{}}]}):xE?o.jsx(zte,{userId:Me,appId:n,agentInfo:zt,capabilitiesLoading:Rn,agentLabel:pC,onOpenSession:wG}):dC?o.jsx(lSe,{onAdded:B=>{_h(xa()),ks(!1),s(B)},onCancel:()=>ks(!1)}):Uu?o.jsx(iSe,{}):dl!==null&&!yE?o.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:[o.jsx("div",{style:{fontSize:18,fontWeight:600},children:"需要配置火山引擎 AK/SK"}),o.jsxs("div",{style:{maxWidth:420,lineHeight:1.6},children:["智能体工作台需要 Volcengine 凭据才能使用。请在运行环境中设置"," ",o.jsx("code",{children:"VOLCENGINE_ACCESS_KEY"})," 与"," ",o.jsx("code",{children:"VOLCENGINE_SECRET_KEY"})," 后重试。"]})]}):dl==="menu"?o.jsx(rAe,{onSelect:B=>{fe(null),ca(null),Fi(""),ki(""),Mr(B==="custom"?`draft-${Date.now().toString(36)}`:""),hr.current=null,Ht(B)},onImport:B=>{fe(B),ca(null),Fi(""),ki(""),Mr(`draft-${Date.now().toString(36)}`),hr.current=null,Ht("custom")}}):dl==="intelligent"?o.jsx(JAe,{userId:Me,onBack:()=>Ht("menu"),onCreate:o0,onAgentAdded:TE,onDeploymentTaskChange:Eh}):dl==="custom"?o.jsx($Ie,{initialDraft:oe??void 0,onBack:()=>Ht("menu"),onCreate:o0,onAgentAdded:TE,features:uo,onDeploymentTaskChange:Eh,deploymentTarget:$u??void 0,initialDeployRegion:r0,onDraftChange:(B,Q)=>{Vs&&(Q?fG(Vs,B,$u??void 0):tC(Vs))},onDiscard:Vs?()=>{tC(Vs),Mr(""),hr.current=null,fe(null),ca(null),Fi(""),ki(n),Ht(null),$(!1),yn(!0),Pe("")}:void 0,onDeploymentStarted:nC,onDeploymentComplete:sC},Vs||"custom"):dl==="template"?o.jsx(VIe,{onBack:()=>Ht("menu"),onCreate:o0}):dl==="workflow"?o.jsx(ZIe,{onBack:()=>Ht("menu"),onCreate:o0}):dl==="package"?o.jsx(sje,{onBack:()=>{Ht(null),$(!0)},onAgentAdded:TE,onDeploymentTaskChange:Eh,onDeploymentStarted:nC,onDeploymentComplete:sC,initialDeployRegion:r0}):Et.length===0&&Kn?o.jsx(Ije,{initialJob:Kn}):Et.length===0&&!an?o.jsxs("div",{className:"session-loading",children:[o.jsx(dn,{className:"icon spin"})," 正在检查 Agent 能力…"]}):Et.length===0?o.jsxs("div",{className:"welcome",children:[o.jsxs("div",{className:"welcome-primary",children:[o.jsxs("div",{className:"welcome-heading",children:[o.jsx(IRe,{canUpdate:mt.role==="admin"}),o.jsx("h1",{className:"welcome-title",children:p?"让灵感自由生长":rt==="skill-create"?"想创建一个什么 Skill?":pc})]}),O]}),o.jsx(yRe,{})]},`welcome-${me.agentId??n}`):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`transcript${Yg?" is-streaming":""}`,ref:Nh,onScroll:mG,onWheel:gG,onTouchMove:bG,children:Et.map((B,Q)=>{var dt,Bt,lt,Rt,Ct,os,Ai;const le=Q===Et.length-1;if(B.role==="system")return B.activity?o.jsx("div",{className:"turn turn--system",children:o.jsx(PRe,{activity:B.activity,time:KN((dt=B.meta)==null?void 0:dt.ts)})},B.activity.id):null;if(B.role==="user"){const En=B.blocks.map(Ci=>Ci.kind==="text"?Ci.text:"").join(""),Pr=B.blocks.flatMap(Ci=>Ci.kind==="attachment"?Ci.files:[]),vo=B.blocks.find(Ci=>Ci.kind==="invocation");return o.jsxs(Jn.div,{className:"turn turn--user",initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[(vo==null?void 0:vo.kind)==="invocation"&&o.jsx(H1,{value:vo.value}),Pr.length>0&&o.jsx(z1,{appName:n,items:Pr}),En&&o.jsx("div",{className:"bubble",children:o.jsx(oh,{text:En})}),o.jsxs("div",{className:"turn-actions turn-actions--right",children:[((Bt=B.meta)==null?void 0:Bt.ts)&&o.jsx("span",{className:"meta-text",children:KN(B.meta.ts)}),o.jsx(ND,{text:En})]})]},Q)}const be=((lt=B.meta)==null?void 0:lt.author)??"",_e=be&&Ui?GN(Ui,be):void 0,Ye=!!(be&&Wg.length>0&&!Wg.includes(be)),$e=(_e==null?void 0:_e.name)||be,tt=(_e==null?void 0:_e.description)||(Ye?"正在执行主 Agent 移交的任务。":"");if(B.blocks.length>0&&B.blocks.every(En=>En.kind==="agent-transfer"))return null;const it=B.blocks.length===0,Ie=((Ct=(Rt=B.meta)==null?void 0:Rt.feedback)==null?void 0:Ct.rating)??null,ct=((os=B.meta)==null?void 0:os.eventId)??"",At=qn.has(ct),Ln=!!(Qi&&ct&&Oc(B)),Dn=Ln?_D(Et,Q):"";return o.jsxs(Jn.div,{ref:En=>{ct&&(En?AE.current.set(ct,En):AE.current.delete(ct))},className:["turn turn--assistant",Ye?"turn--subagent":"",Sh&&Sh===ct?"is-feedback-target":""].filter(Boolean).join(" "),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[Ye&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"subagent-run-label",children:[o.jsxs("span",{className:"subagent-run-handoff",children:[o.jsx(eee,{}),o.jsx("span",{children:"智能体移交"})]}),o.jsx("span",{className:"subagent-run-title",children:$e})]}),o.jsx("p",{className:"subagent-run-description",title:tt,children:tt})]}),it?le&&Ua?o.jsx(gH,{}):null:o.jsxs(o.Fragment,{children:[o.jsx(r2,{appName:n,blocks:B.blocks,streaming:le&&(Ua||go),onStreamFrame:le?yG:void 0,onAction:zG,onAuth:VG,onArtifactDownload:(En,Pr)=>zB(n,Me,a,En,Pr),onArtifactPreview:(En,Pr)=>GB(n,Me,a,En,Pr)}),!(le&&Ua)&&!tMe(B)&&o.jsx("div",{className:"turn-empty",children:"本次没有返回可显示的内容。"}),!(le&&Ua)&&!nMe(B)&&o.jsxs("div",{className:"turn-meta",children:[p&&((Ai=B.meta)!=null&&Ai.sandboxUsage)?o.jsx(URe,{usage:B.meta.sandboxUsage}):null,o.jsxs("div",{className:"turn-actions",children:[Ln&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:`icon-btn feedback-btn${Ie==="good"?" feedback-btn--good":""}`,"aria-label":"赞","aria-pressed":Ie==="good","aria-busy":At,title:Ie==="good"?"取消点赞":"赞",disabled:At,onClick:()=>void mC(B,Ie==="good"?null:"good",Dn),children:o.jsx(Gte,{className:"icon",filled:Ie==="good"})}),o.jsx("button",{type:"button",className:`icon-btn feedback-btn${Ie==="bad"?" feedback-btn--bad":""}`,"aria-label":"踩","aria-pressed":Ie==="bad","aria-busy":At,title:Ie==="bad"?"取消点踩":"踩",disabled:At,onClick:()=>void mC(B,Ie==="bad"?null:"bad",Dn),children:o.jsx(Kte,{className:"icon",filled:Ie==="bad"})})]}),!p&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"icon-btn","aria-label":"问题反馈",title:"问题反馈",onClick:()=>Da({turn:B,input:_D(Et,Q)}),children:o.jsx(w8,{className:"icon"})}),o.jsx("button",{type:"button",className:"icon-btn",title:"Tracing 火焰图",onClick:()=>{var En;Mu((En=B.meta)!=null&&En.ts?B.meta.ts*1e3:Date.now()),al(!0)},children:o.jsx(ZOe,{})})]}),o.jsx(ND,{text:Oc(B)})]}),B.meta&&o.jsx("span",{className:"meta-text",children:JOe(B.meta)})]})]})]},Q)})}),!p&&o.jsx(Sfe,{appName:n,info:zt,loading:Rn,activeAgent:hE,seenAgents:pE,execPath:mE,capabilities:ms,capabilityLoading:Hs,capabilityMutating:ss,builtinTools:js,onAddCapability:FG,onRemoveCapability:B=>void $G(B)}),o.jsx("div",{className:"conversation-composer-slot",children:O})]})]})})})(),aa&&a&&o.jsx(_Oe,{onClose:()=>Da(null),onSubmit:KG}),oa&&a&&o.jsx(kV,{appName:n,sessionId:a,endTimeMs:Wi,onClose:()=>al(!1)}),o.jsx(LRe,{open:W,state:ue,agentKind:ge,error:we,onCancel:SG,onConfirm:O=>void _G(O)}),p?o.jsxs(o.Fragment,{children:[o.jsx(YRe,{open:j!==null,kind:j??"terminal",launch:z,loading:F,error:M,onReload:()=>{j&&RE(j)},onClose:()=>{L(null),D(null),A(!1),P("")}}),o.jsx(JRe,{open:k,value:p.permissions,busy:E||y,error:_,onSave:O=>void kG(O),onClose:()=>{E||(T(!1),S(""))}}),o.jsx(eOe,{open:C,cwd:p.cwd,locked:p.workspaceLocked,busy:E,error:_,browse:AG,onSave:O=>void CG(O),onClose:()=>{E||(I(!1),S(""))}}),o.jsx(WRe,{open:Yn.threadsOpen,threads:Yn.threads,currentThreadId:p.threadId,loading:Yn.threadsLoading,error:Yn.threadsError,onSelect:O=>void Yn.resumeThread(O),onClose:Yn.closeThreads}),o.jsx(tOe,{approval:H,busy:Y,error:U,onDecision:O=>void IG(O)})]}):null,o.jsx(EOe,{open:Ns,checking:Ts,error:Te,onLogin:()=>void xG()}),dG&&o.jsx("div",{className:"confirm-scrim",onClick:()=>SE(!1),children:o.jsxs("div",{className:"confirm-box",onClick:O=>O.stopPropagation(),children:[o.jsx("div",{className:"confirm-title",children:"返回创建首页?"}),o.jsx("div",{className:"confirm-text",children:"返回后当前填写的内容将会丢失,确定要返回吗?"}),o.jsxs("div",{className:"confirm-actions",children:[o.jsx("button",{className:"confirm-btn",onClick:()=>SE(!1),children:"取消"}),o.jsx("button",{className:"confirm-btn confirm-btn--danger",onClick:()=>{fe(null),Ht("menu"),SE(!1)},children:"确定返回"})]})]})})]})}const jD="veadk.preloadRecoveryAt";window.addEventListener("vite:preloadError",e=>{const t=Date.now();let n=0;try{n=Number(sessionStorage.getItem(jD)||"0")}catch{}if(!(t-n<1e4)){e.preventDefault();try{sessionStorage.setItem(jD,String(t))}catch{}window.location.reload()}});(()=>{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})()||JY.createRoot(document.getElementById("root")).render(o.jsx(Ft.StrictMode,{children:o.jsx(uW,{reducedMotion:"user",children:o.jsx(zJ,{maskOpacity:.9,children:o.jsx(fMe,{})})})}));export{A2 as $,Abe as A,Cbe as B,J7 as C,o as D,gt as E,Un as F,Xt as G,gMe as H,oV as I,G0e as J,hi as K,g as L,j1 as M,Cr as N,bMe as O,Vz as P,Hp as Q,Ft as R,pu as S,ACe as T,Wz as U,Di as V,lr as W,ju as X,tE as Y,Yz as Z,gu as _,sa as a,H7 as a0,aV as b,OCe as c,JM as d,If as e,qi as f,yMe as g,Rz as h,hc as i,sE as j,Pf as k,n2e as l,NMe as m,NA as n,Ime as o,u2e as p,Dm as q,sn as r,q0e as s,ebe as t,Rme as u,Bf as v,eye as w,L0e as x,D0e as y,lye as z}; diff --git a/veadk/webui/index.html b/veadk/webui/index.html index dc26a959..deaba462 100644 --- a/veadk/webui/index.html +++ b/veadk/webui/index.html @@ -5,7 +5,7 @@ AgentKit Studio - +