@fieldwangai/agentflow 0.1.55 → 0.1.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -125,7 +125,7 @@ script: node -e "console.log('TODO: scripts/x.mjs')"
125
125
 
126
126
  `).trimEnd()}function bx(e){return String(e||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function gK(e){const t=String(e||"");let n="",r=0;Ym.lastIndex=0;let s;for(;s=Ym.exec(t);)n+=bx(t.slice(r,s.index)),n+=`<span class="af-flow-node__image-token">${bx(s[0])}</span>`,r=s.index+s[0].length;return n+=bx(t.slice(r)),n||" "}function yK(e,t){const n=window.getComputedStyle(e),r=Number.parseFloat(n.lineHeight)||18,s=Number.parseFloat(n.paddingTop)||0,i=Number.parseFloat(n.paddingBottom)||0,a=Number.parseFloat(n.borderTopWidth)||0,l=Number.parseFloat(n.borderBottomWidth)||0,c=String(t||"").split(/\r\n|\r|\n/).length,d=Math.min(Math.max(c,2),8);return Math.ceil(d*r+s+i+a+l)}function ST({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:s,onProvideValueChange:i,onNodeBodyChange:a,onNodeImagesChange:l,modelLists:c,onModelChange:d}){var Vn,or;const{t:f}=Pn(),u=(e==null?void 0:e.inputs)??[],p=(e==null?void 0:e.outputs)??[],m=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),g=dK(e),b=fK(g),v=(e==null?void 0:e.isRunMode)??!1,y=!!(e!=null&&e.readOnly),k=(e==null?void 0:e.isExecuting)??!1,w=(e==null?void 0:e.isDim)??!1,j=(e==null?void 0:e.nodeStatus)??null,A=(e==null?void 0:e.nodeElapsed)??null,C=(e==null?void 0:e.definitionId)||"",$=C.startsWith("provide_"),B=C==="provide_bool",F=C==="provide_str",z=C==="provide_file",L=C==="agent_subAgent",O=L&&!v,W=B?pK(p[0]):!1,M=$?String(((Vn=p[0])==null?void 0:Vn.value)??((or=p[0])==null?void 0:or.default)??(e==null?void 0:e.body)??""):"",T=String((e==null?void 0:e.body)||""),E=(e==null?void 0:e.displayLabel)||(e==null?void 0:e.label)||f("flow:node.fallbackLabel"),D=!$&&!O&&(e!=null&&e.showBodyPreview)?String((e==null?void 0:e.body)||"").trim():"",_=ks(e==null?void 0:e.images),R=h.useRef(!1),P=h.useRef(!1),X=h.useRef(null),Z=h.useRef(null),V=h.useRef(null),[ne,ue]=h.useState(M),[pe,ge]=h.useState(T);h.useEffect(()=>{R.current||ue(M)},[n,M]),h.useEffect(()=>{P.current||ge(T)},[n,T]),h.useEffect(()=>{const ye=Z.current;if(!ye)return;const Ie=yK(ye,pe);ye.style.minHeight=`${Ie}px`,ye.style.height="",V.current&&(V.current.style.minHeight=`${Ie}px`,V.current.style.height="")},[pe]),h.useEffect(()=>{const ye=X.current,Ie=e==null?void 0:e.onNodeContentResize;if(!O||!ye||!Ie||typeof ResizeObserver>"u")return;let nt=0;const Ct=()=>{window.cancelAnimationFrame(nt),nt=window.requestAnimationFrame(()=>Ie(n))},ie=new ResizeObserver(Ct);return ie.observe(ye),Ct(),()=>{window.cancelAnimationFrame(nt),ie.disconnect()}},[e==null?void 0:e.onNodeContentResize,O,n]);const ae=Array.isArray(c==null?void 0:c.cursor)?c.cursor:[],be=Array.isArray(c==null?void 0:c.opencode)?c.opencode:[],Ae=Array.isArray(c==null?void 0:c.claudeCode)?c.claudeCode:[],we=((e==null?void 0:e.model)??"").trim(),Pe=m==="agent"&&!C.startsWith("tool_nodejs"),Te=new Set(ae.map(Bo)),it=new Set(be.map(Bo)),ct=new Set(Ae.map(Bo)),tt=we?we.startsWith("cursor:")||we.startsWith("opencode:")||we.startsWith("claude-code:")?we:ct.has(we)?`claude-code:${we}`:it.has(we)?`opencode:${we}`:Te.has(we)?`cursor:${we}`:we:"",jt=we&&!tt.startsWith("cursor:")&&!tt.startsWith("opencode:")&&!tt.startsWith("claude-code:")&&!Te.has(we)&&!it.has(we)&&!ct.has(we),Ye=we.startsWith("cursor:")?we.slice(7):we.startsWith("opencode:")?we.slice(9):we.startsWith("claude-code:")?we.slice(12):we,kt=ye=>{if(y)return;const Ie=ye.target.value;d&&d(n,Ie)},nn=ye=>{ye.stopPropagation(),!y&&r&&r(n)},vn=ye=>{ye.stopPropagation(),s&&s()},Mn=ye=>{ye.stopPropagation(),!y&&(i==null||i(n,ye.target.value==="true"?"true":"false"))},Ht=ye=>{if(ye.stopPropagation(),y)return;const Ie=ye.target.value;ue(Ie),R.current||i==null||i(n,Ie)},$n=ye=>{ye.stopPropagation(),R.current=!0},Wn=ye=>{if(ye.stopPropagation(),y)return;R.current=!1;const Ie=ye.currentTarget.value;ue(Ie),i==null||i(n,Ie)},le=()=>{y||i==null||i(n,ne)},de=ye=>{if(ye.stopPropagation(),y)return;const Ie=window.prompt("文件路径",ne);Ie!=null&&(ue(Ie),i==null||i(n,Ie))},He=ye=>{if(ge(ye),a==null||a(n,ye),l){const Ie=GU(_,ye);(Ie.length!==_.length||Ie.some((nt,Ct)=>{var ie;return nt.id!==((ie=_[Ct])==null?void 0:ie.id)}))&&l(n,Ie)}},Ze=ye=>{if(ye.stopPropagation(),y)return;const Ie=ye.target.value;P.current?ge(Ie):He(Ie)},ot=ye=>{ye.stopPropagation(),!y&&(P.current=!0)},Xt=ye=>{if(ye.stopPropagation(),y)return;P.current=!1;const Ie=ye.currentTarget.value;He(Ie)},rn=()=>{y||He(pe)},sn=async ye=>{if(y)return;const Ie=await xT({files:ye,body:pe,images:_});Ie&&(ge(Ie.body),a==null||a(n,Ie.body),l==null||l(n,Ie.images))},An=(ye,Ie)=>{if(ye.stopPropagation(),y)return;const nt=_.filter(ie=>ie.id!==Ie.id),Ct=mK(pe,Ie.label);ge(Ct),a==null||a(n,Ct),l==null||l(n,nt)},Sr=ye=>{if(y)return;const Ie=yT(ye);Ie.length!==0&&(ye.preventDefault(),ye.stopPropagation(),sn(Ie).catch(()=>{}))},Jt=ye=>{if(y)return;const Ie=Gm(ye);Ie.length!==0&&(ye.preventDefault(),ye.stopPropagation(),sn(Ie).catch(()=>{}))},mn=()=>{const ye=Z.current,Ie=V.current;!ye||!Ie||(Ie.scrollTop=ye.scrollTop,Ie.scrollLeft=ye.scrollLeft)};return o.jsxs("div",{className:"af-flow-node"+(t?" af-flow-node--selected":"")+(k?" af-flow-node--executing":"")+(j==="success"?" af-flow-node--done":"")+(j==="failed"?" af-flow-node--failed":"")+(j==="running"&&!k?" af-flow-node--running-disk":"")+(w?" af-flow-node--dim":"")+(O?" af-flow-node--inline-body-editor":"")+" af-flow-node--"+m.replace(/[^a-z0-9_-]/g,""),"data-schema":m,children:[o.jsxs("div",{className:"af-flow-node__chrome",children:[o.jsx("span",{className:"af-flow-node__type",title:g,children:b}),!v&&Pe&&o.jsxs("div",{className:"af-flow-node__model-wrap nodrag",onPointerDown:Or,onMouseDown:Or,onClick:Or,children:[o.jsxs("select",{className:"af-flow-node__model nodrag",value:tt,onChange:kt,onPointerDown:Or,onMouseDown:Or,onClick:Or,"aria-label":f("flow:node.model"),title:Ye||f("flow:node.defaultModel"),disabled:y,children:[o.jsx("option",{value:"",children:f("flow:node.defaultModel")}),jt&&o.jsx("option",{value:we,children:we}),ae.length>0&&o.jsx("optgroup",{label:"Cursor",children:ae.map(ye=>o.jsx("option",{value:`cursor:${Bo(ye)}`,children:Bo(ye)},`c-${ye}`))}),be.length>0&&o.jsx("optgroup",{label:"OpenCode",children:be.map(ye=>o.jsx("option",{value:`opencode:${Bo(ye)}`,children:Bo(ye)},`o-${ye}`))}),Ae.length>0&&o.jsx("optgroup",{label:"Claude Code",children:Ae.map(ye=>o.jsx("option",{value:`claude-code:${Bo(ye)}`,children:Bo(ye)},`cc-${ye}`))})]}),o.jsx("span",{className:"af-flow-node__model-arrow material-symbols-outlined",children:"expand_more"})]}),k&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--executing",children:"EXECUTING"}),j==="running"&&!k&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--running-disk",title:f("flow:node.diskRunning"),children:"RUNNING"}),j==="success"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--done",children:A!=null&&String(A).trim()!==""?A:"--"}),j==="failed"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--failed",children:"FAILED"}),!v&&$&&!B&&!F&&!z&&o.jsx("button",{type:"button",className:"af-flow-node__expand",onClick:vn,"aria-label":f("flow:node.expandProvide"),title:f("flow:node.expandProvide"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),!v&&o.jsx("button",{type:"button",className:"af-flow-node__delete",disabled:y,onClick:nn,"aria-label":f("flow:node.deleteNode"),title:f("flow:node.deleteNode"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-flow-node__body",children:[o.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--in",children:u.map((ye,Ie)=>{if(ye.showOnNode===!1)return null;const nt=f("flow:node.inputTooltip",{name:ye.name||`#${Ie}`,type:ye.type})+(ye.default!=null&&ye.default!==""?f("flow:node.defaultSuffix",{value:ye.default}):""),Ct=ye.name||`#${Ie+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:nt,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--in",children:[Ct,ye.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(Ps,{type:"target",position:Je.Left,id:`input-${Ie}`,className:"af-flow-node__handle",style:{background:nr(ye.type)},title:nt})]},`in-${Ie}`)})}),o.jsxs("div",{className:"af-flow-node__title-wrap",children:[o.jsx("span",{className:"af-flow-node__title",children:E}),n?o.jsx("span",{className:"af-flow-node__subtitle",title:n,children:n}):null,B?o.jsxs("select",{className:"af-flow-node__bool-select nodrag"+(W?" af-flow-node__bool-select--true":""),value:W?"true":"false",onChange:Mn,onPointerDown:Or,onMouseDown:Or,onClick:Or,"aria-label":"Boolean value",title:W?"true":"false",disabled:y,children:[o.jsx("option",{value:"false",children:"false"}),o.jsx("option",{value:"true",children:"true"})]}):F?o.jsx("textarea",{className:"af-flow-node__inline-text nodrag",value:ne,onChange:Ht,onCompositionStart:$n,onCompositionEnd:Wn,onBlur:le,onPointerDown:Or,onMouseDown:Or,onClick:Or,placeholder:"输入文本",rows:2,readOnly:y}):z?o.jsxs("div",{className:"af-flow-node__file-value nodrag",onPointerDown:Or,onMouseDown:Or,onClick:Or,children:[o.jsx("input",{className:"af-flow-node__file-input nodrag",value:ne,onChange:Ht,onCompositionStart:$n,onCompositionEnd:Wn,onBlur:le,placeholder:"选择或输入文件路径",title:ne||"选择或输入文件路径",readOnly:y}),o.jsx("button",{type:"button",className:"af-flow-node__file-picker nodrag",disabled:y,onClick:de,"aria-label":"选择文件",title:"选择文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"folder_open"})})]}):L&&!v?o.jsxs("div",{ref:X,className:"af-flow-node__prompt-stack nodrag",children:[o.jsx("pre",{ref:V,className:"af-flow-node__prompt-backdrop","aria-hidden":"true",dangerouslySetInnerHTML:{__html:gK(pe)+`
127
127
  `}}),o.jsx("textarea",{ref:Z,className:"af-flow-node__prompt-editor nodrag",value:pe,onChange:Ze,onCompositionStart:ot,onCompositionEnd:Xt,onBlur:rn,onPaste:Sr,onDrop:Jt,onScroll:mn,onDragOver:ye=>{Gm(ye).length>0&&ye.preventDefault()},placeholder:"输入 prompt",rows:2,readOnly:y})]}):null,L&&_.length>0?o.jsx("div",{className:"af-flow-node__image-chips",children:_.map((ye,Ie)=>o.jsxs("span",{className:"af-flow-node__image-chip",title:ye.name,children:[o.jsx("img",{src:ye.dataUrl,alt:""}),o.jsxs("span",{children:["[",ye.label||`image ${Ie+1}`,"]"]}),o.jsx("button",{type:"button",className:"af-flow-node__image-remove nodrag",disabled:y,onClick:nt=>An(nt,ye),onPointerDown:Or,onMouseDown:Or,"aria-label":`删除 ${ye.label||`image ${Ie+1}`}`,title:"删除图片",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},ye.id||Ie))}):null,D?o.jsx("span",{className:"af-flow-node__prompt-preview",title:D,children:D}):null]}),o.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--out",children:p.map((ye,Ie)=>{if(ye.showOnNode===!1)return null;const nt=f("flow:node.outputTooltip",{name:ye.name||`#${Ie}`,type:ye.type})+(ye.default!=null&&ye.default!==""?f("flow:node.defaultSuffix",{value:ye.default}):""),Ct=ye.name||`#${Ie+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:nt,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--out",children:[Ct,ye.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(Ps,{type:"source",position:Je.Right,id:`output-${Ie}`,className:"af-flow-node__handle",style:{background:nr(ye.type)},title:nt})]},`out-${Ie}`)})})]})]})}const pp="flowNode";function NT(e){if(!e||!(e instanceof Element))return!1;if(e.closest('[contenteditable="true"]'))return!0;const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}function Qm(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function xK(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function wK({open:e,onClose:t,flowId:n,flowSource:r,onArchived:s}){const{t:i}=Pn(),a=h.useId(),l=h.useRef(null),[c,d]=h.useState(""),[f,u]=h.useState(!1),[p,m]=h.useState("");if(h.useEffect(()=>{if(!e)return;d(""),m(""),u(!1);const y=requestAnimationFrame(()=>{var k;return(k=l.current)==null?void 0:k.focus()});return()=>cancelAnimationFrame(y)},[e,n]),!e)return null;const g=c.trim(),b=g===n;async function v(y){if(y.preventDefault(),!(!b||f)){u(!0),m("");try{const k=await fetch("/api/flow/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:g})}),w=await k.json().catch(()=>({}));if(!k.ok){m(typeof w.error=="string"?w.error:i("project:archiveModal.archiveFailed"));return}s()}catch(k){m(String((k==null?void 0:k.message)||k))}finally{u(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&t()},children:o.jsxs("div",{ref:l,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":a,tabIndex:-1,onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:a,className:"af-shortcuts-panel__title",children:i("project:archiveModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":i("project:archiveModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:v,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:i("project:archiveModal.lead",{flowId:n})}),o.jsxs("label",{className:"af-new-pipeline-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:i("project:archiveModal.confirmLabel")}),o.jsx("input",{type:"text",className:"af-new-pipeline-input",value:c,onChange:y=>d(y.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":g.length>0&&!b})]}),p?o.jsx("p",{className:"af-err af-new-pipeline-err",children:p}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:f,children:i("project:archiveModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!b||f,children:i(f?"project:archiveModal.archiving":"project:archiveModal.confirmArchive")})]})]})]})})}function Ij({open:e,title:t,message:n,confirmLabel:r,cancelLabel:s,destructive:i=!1,secondaryLabel:a,secondaryDestructive:l=!1,onSecondary:c,onConfirm:d,onCancel:f}){const{t:u}=Pn(),p=h.useId(),m=h.useRef(null);if(h.useEffect(()=>{if(!e)return;const y=requestAnimationFrame(()=>{var w;return(w=m.current)==null?void 0:w.focus()});function k(w){w.key==="Escape"&&f(),w.key==="Enter"&&d()}return window.addEventListener("keydown",k),()=>{cancelAnimationFrame(y),window.removeEventListener("keydown",k)}},[e,f,d]),!e)return null;const g=r??u("common:common.confirm","确定"),b=s??u("common:common.cancel","取消"),v=t??u("common:common.confirmTitle","请确认");return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&f()},children:o.jsxs("div",{ref:m,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":p,tabIndex:-1,onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:p,className:"af-shortcuts-panel__title",children:v}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:f,"aria-label":b,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-shortcuts-panel__body af-new-pipeline-form",children:[o.jsx("p",{className:"af-new-pipeline-lead",children:n}),o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:f,children:b}),a&&c?o.jsx("button",{type:"button",className:l?"af-btn-secondary af-btn-destructive":"af-btn-secondary",onClick:c,children:a}):null,o.jsx("button",{type:"button",className:i?"af-btn-primary af-btn-destructive":"af-btn-primary",onClick:d,autoFocus:!0,children:g})]})]})]})})}function bK({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,onDeleted:i}){const{t:a}=Pn(),l=h.useId(),c=h.useRef(null),[d,f]=h.useState(""),[u,p]=h.useState(!1),[m,g]=h.useState("");if(h.useEffect(()=>{if(!e)return;f(""),g(""),p(!1);const k=requestAnimationFrame(()=>{var w;return(w=c.current)==null?void 0:w.focus()});return()=>cancelAnimationFrame(k)},[e,n]),!e)return null;const b=d.trim(),v=b===n;async function y(k){if(k.preventDefault(),!v||u)return;p(!0),g("");let w=null;try{const j=new AbortController;w=setTimeout(()=>j.abort(),15e3);const A=await fetch("/api/flow/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:b,flowArchived:s}),signal:j.signal}),C=await A.json().catch(()=>({}));if(!A.ok){g(typeof C.error=="string"?C.error:a("project:deleteModal.deleteFailed"));return}try{for(let $=localStorage.length-1;$>=0;$--){const B=localStorage.key($);B&&(B.startsWith(`af:composer-sessions:${n}:${r}`)||B.startsWith(`af:composer-active-session:${n}:${r}`)||B.startsWith(`af:workspace-composer:${n}:${r}`))&&localStorage.removeItem(B)}}catch{}await i()}catch(j){if((j==null?void 0:j.name)==="AbortError"){g(a("project:deleteModal.deleteTimeout"));return}g(String((j==null?void 0:j.message)||j))}finally{w&&clearTimeout(w),p(!1)}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:k=>{k.target===k.currentTarget&&t()},children:o.jsxs("div",{ref:c,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":l,tabIndex:-1,onMouseDown:k=>k.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:l,className:"af-shortcuts-panel__title",children:a("project:deleteModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":a("project:deleteModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:y,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:a("project:deleteModal.lead",{flowId:n})}),o.jsxs("label",{className:"af-new-pipeline-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:a("project:deleteModal.confirmLabel")}),o.jsx("input",{type:"text",className:"af-new-pipeline-input",value:d,onChange:k=>f(k.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":b.length>0&&!v})]}),m?o.jsx("p",{className:"af-err af-new-pipeline-err",children:m}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:u,children:a("project:deleteModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary af-btn-destructive",disabled:!v||u,children:a(u?"project:deleteModal.deleting":"project:deleteModal.confirmDelete")})]})]})]})})}function vK({children:e}){return o.jsx("kbd",{className:"af-kbd",children:e})}function Ii({keys:e}){return o.jsx("span",{className:"af-shortcuts-keys",children:e.map((t,n)=>o.jsxs("span",{children:[n>0?o.jsx("span",{className:"af-shortcuts-keys__plus",children:"+"}):null,o.jsx(vK,{children:t})]},n))})}function jT({open:e,onClose:t}){const{t:n}=Pn(),r=h.useRef(null);if(h.useEffect(()=>{if(!e)return;const a=requestAnimationFrame(()=>{var l;return(l=r.current)==null?void 0:l.focus()});return()=>cancelAnimationFrame(a)},[e]),!e)return null;const i=xK()?"⌘":"Ctrl";return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:a=>{a.target===a.currentTarget&&t()},children:o.jsxs("div",{ref:r,className:"af-shortcuts-panel",role:"dialog","aria-modal":"true","aria-labelledby":"af-shortcuts-title",tabIndex:-1,onMouseDown:a=>a.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:"af-shortcuts-title",className:"af-shortcuts-panel__title",children:n("flow:shortcuts.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":n("common:common.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-shortcuts-panel__body",children:[o.jsxs("section",{className:"af-shortcuts-section",children:[o.jsx("h3",{className:"af-shortcuts-cat",children:n("flow:shortcuts.general")}),o.jsxs("ul",{className:"af-shortcuts-list",children:[o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.saveDesc")}),o.jsx(Ii,{keys:[i,"S"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.shortcutsLabel")}),o.jsx(Ii,{keys:["?"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),o.jsx(Ii,{keys:[i,"K"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.openNodePalette")}),o.jsx(Ii,{keys:["A"]})]})]})]}),o.jsxs("section",{className:"af-shortcuts-section",children:[o.jsx("h3",{className:"af-shortcuts-cat",children:n("flow:shortcuts.canvas")}),o.jsxs("ul",{className:"af-shortcuts-list",children:[o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectTool")}),o.jsx(Ii,{keys:["V"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.panTool")}),o.jsx(Ii,{keys:["H"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.holdSpacePan")}),o.jsx(Ii,{keys:["Space"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.saveViewport")}),o.jsx(Ii,{keys:["F"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectAll")}),o.jsx(Ii,{keys:[i,"A"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.undo")}),o.jsx(Ii,{keys:[i,"Z"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.redo")}),o.jsx(Ii,{keys:[i,"Shift","Z"]})]})]})]})]})]})})}function kK(e,t){if(!t)return 1;const n=t.toLowerCase(),r=(e.id||"").toLowerCase(),s=(e.label||"").toLowerCase(),i=(e.definitionId||"").toLowerCase();return r===n?100:r.startsWith(n)?80:r.includes(n)?60:s.startsWith(n)?40:s.includes(n)?30:i.includes(n)?15:0}function CT({open:e,onClose:t,onJump:n,nodes:r}){const{t:s}=Pn(),[i,a]=h.useState(""),[l,c]=h.useState(0),d=h.useRef(null),f=h.useRef(null);h.useEffect(()=>{if(!e)return;a(""),c(0);const g=requestAnimationFrame(()=>{var b;return(b=d.current)==null?void 0:b.focus()});return()=>cancelAnimationFrame(g)},[e]);const u=h.useMemo(()=>{const g=(r||[]).map(y=>{var k,w,j;return{id:y.id,label:((k=y.data)==null?void 0:k.label)||"",definitionId:((w=y.data)==null?void 0:w.definitionId)||"",schemaType:((j=y.data)==null?void 0:j.schemaType)||""}}),b=i.trim(),v=g.map(y=>({e:y,s:kK(y,b)})).filter(y=>y.s>0);return v.sort((y,k)=>k.s-y.s||y.e.id.localeCompare(k.e.id)),v.slice(0,50).map(y=>y.e)},[r,i]);if(h.useEffect(()=>{l>=u.length&&c(0)},[u.length,l]),h.useEffect(()=>{var b;const g=(b=f.current)==null?void 0:b.querySelector(`[data-idx="${l}"]`);g&&g.scrollIntoView({block:"nearest"})},[l]),!e)return null;const p=g=>{const b=u[g];b&&(n(b.id),t())},m=g=>{if(g.key==="Escape"){g.preventDefault(),t();return}if(g.key==="ArrowDown"){g.preventDefault(),c(b=>Math.min(u.length-1,b+1));return}if(g.key==="ArrowUp"){g.preventDefault(),c(b=>Math.max(0,b-1));return}g.key==="Enter"&&(g.preventDefault(),p(l))};return o.jsx("div",{className:"af-jump-overlay",role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&t()},children:o.jsxs("div",{className:"af-jump-panel",role:"dialog","aria-modal":"true","aria-label":s("flow:jumpPalette.title"),onMouseDown:g=>g.stopPropagation(),children:[o.jsxs("div",{className:"af-jump-panel__input-wrap",children:[o.jsx("span",{className:"af-jump-panel__icon material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{ref:d,type:"text",className:"af-jump-panel__input",placeholder:s("flow:jumpPalette.placeholder"),value:i,onChange:g=>{a(g.target.value),c(0)},onKeyDown:m,spellCheck:!1,autoComplete:"off"}),o.jsx("span",{className:"af-jump-panel__count",children:u.length})]}),u.length===0?o.jsx("div",{className:"af-jump-panel__empty",children:s("flow:jumpPalette.empty")}):o.jsx("ul",{ref:f,className:"af-jump-panel__list",role:"listbox",children:u.map((g,b)=>o.jsxs("li",{"data-idx":b,role:"option","aria-selected":b===l,className:"af-jump-panel__item"+(b===l?" af-jump-panel__item--active":""),onMouseEnter:()=>c(b),onMouseDown:v=>{v.preventDefault(),p(b)},children:[o.jsx("span",{className:"af-jump-panel__id",children:g.id}),g.label&&g.label!==g.id&&o.jsx("span",{className:"af-jump-panel__label",children:g.label}),g.definitionId&&o.jsx("span",{className:"af-jump-panel__tag",children:g.definitionId})]},g.id))}),o.jsxs("div",{className:"af-jump-panel__hint",children:[o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"↑"}),o.jsx("kbd",{className:"af-kbd",children:"↓"})," ",s("flow:jumpPalette.hintNavigate")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"Enter"})," ",s("flow:jumpPalette.hintJump")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"Esc"})," ",s("flow:jumpPalette.hintClose")]})]})]})})}function SK({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,filePath:i,fileName:a,onSaved:l,onAiEdit:c}){const{t:d}=Pn(),f=h.useId(),u=h.useRef(null),p=h.useRef(null),[m,g]=h.useState(""),[b,v]=h.useState(""),[y,k]=h.useState(!1),[w,j]=h.useState(!1),[A,C]=h.useState(!1),[$,B]=h.useState(""),[F,z]=h.useState("");if(h.useEffect(()=>{if(!e||!i)return;g(""),v(""),B(""),z(""),k(!0),j(!1),C(!1);const E=new URLSearchParams({flowId:n,flowSource:r,archived:s?"1":"0",path:i});(async()=>{try{const _=await fetch(`/api/pipeline-file-content?${E}`),R=await _.json();if(!_.ok)throw new Error(R.error||"HTTP "+_.status);g(R.content||""),v(R.content||"")}catch(_){B(_.message||String(_))}finally{k(!1)}})();const D=requestAnimationFrame(()=>{var _;return(_=u.current)==null?void 0:_.focus()});return()=>cancelAnimationFrame(D)},[e,i,n,r,s]),!e)return null;const L=m!==b;async function O(E){if(E.preventDefault(),!w){j(!0),B(""),z("");try{const D=new URLSearchParams({flowId:n,flowSource:r,archived:s?"1":"0",path:i}),_=await fetch(`/api/pipeline-file-save?${D}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:m})}),R=await _.json();if(!_.ok)throw new Error(R.error||"HTTP "+_.status);v(m),z(d("flow:fileEdit.saved")),l&&l()}catch(D){B(D.message||String(D))}finally{j(!1)}}}async function W(){if(!(!c||A||!m)){C(!0),B("");try{const E=await c(m);typeof E=="string"&&E&&g(E)}catch(E){B(E.message||String(E))}finally{C(!1)}}}function M(){g(b),B(""),z("")}const T=m.length>1e5;return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:E=>{E.target===E.currentTarget&&t()},children:o.jsxs("div",{ref:u,className:"af-shortcuts-panel af-file-edit-panel",role:"dialog","aria-modal":"true","aria-labelledby":f,tabIndex:-1,onMouseDown:E=>E.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:f,className:"af-shortcuts-panel__title",children:a||i}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":d("flow:fileEdit.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("div",{className:"af-file-edit-body",children:y?o.jsx("div",{className:"af-file-edit-loading",children:d("flow:fileEdit.loading")}):$&&!m?o.jsx("div",{className:"af-file-edit-error",children:$}):o.jsxs(o.Fragment,{children:[T&&o.jsx("div",{className:"af-file-edit-warning",children:d("flow:fileEdit.largeFileWarning")}),o.jsx("textarea",{ref:p,className:"af-file-edit-textarea",value:m,onChange:E=>g(E.target.value),spellCheck:!1,placeholder:d("flow:fileEdit.placeholder")})]})}),($||F)&&!y&&o.jsx("div",{className:`af-file-edit-status${F?" af-file-edit-status--success":""}`,children:F||$}),o.jsxs("div",{className:"af-file-edit-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:M,disabled:!L||w||A,children:d("flow:fileEdit.reset")}),c&&o.jsx("button",{type:"button",className:"af-btn-secondary af-btn-ai",onClick:W,disabled:A||w||!m,children:d(A?"flow:fileEdit.aiRunning":"flow:fileEdit.aiEdit")}),o.jsx("button",{type:"button",className:"af-btn-primary",onClick:O,disabled:!L||w||A,children:d(w?"flow:fileEdit.saving":"flow:fileEdit.save")})]})]})})}const ET=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),NK=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function jK(e,t){const n=e.slice(0,t),r=n.lastIndexOf("${");if(r<0)return null;const s=n.slice(r+2);return s.includes("}")?null:{atIndex:r,query:s}}function CK(e){const t=/\$\{([^}]*)\}/g,n=[];let r;for(;(r=t.exec(e))!==null;)n.push({start:r.index,end:r.index+r[0].length,key:r[1]});return n}function Tj(e){const t=new Set;if(!Array.isArray(e))return t;for(const n of e){const r=(n==null?void 0:n.name)!=null?String(n.name).trim():"";r&&t.add(r)}return t}function _T(e,{inputNames:t,outputNames:n}){const r=e.trim();if(!r)return!1;if(r.startsWith("input.")){const s=r.slice(6).trim();return s!==""&&t.has(s)}if(r.startsWith("output.")){const s=r.slice(7).trim();return s!==""&&n.has(s)}if(ET.has(r)||t.has(r)||n.has(r))return!0;if(!r.includes(".")){const s=`${r}.md`;if(t.has(s)||n.has(s))return!0}return!1}function PT(e){return{inputNames:Tj(e==null?void 0:e.inputs),outputNames:Tj(e==null?void 0:e.outputs)}}function EK(e,t,n){const r=PT(t),s=CK(e),i=[];for(const a of s)if(!_T(a.key,r)){const l=a.key.trim()===""?n("flow:placeholder.empty"):a.key.trim();i.push({start:a.start,end:a.end,message:n("flow:placeholder.invalidPlaceholder",{hint:l})})}return i}function _K(e,t){const n=PT(t),r=/\$\{([^}]*)\}/g,s=[];let i=0,a;for(;(a=r.exec(e))!==null;){a.index>i&&s.push({kind:"plain",text:e.slice(i,a.index)});const l=a[0],c=_T(a[1],n);s.push({kind:c?"ph-valid":"ph-invalid",text:l}),i=a.index+l.length}return i<e.length&&s.push({kind:"plain",text:e.slice(i)}),s}function PK(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function AK(e){return e.map(t=>{const n=PK(t.text);return t.kind==="ph-invalid"?`<span class="af-body-ph-invalid">${n}</span>`:t.kind==="ph-valid"?`<span class="af-body-ph-valid">${n}</span>`:n}).join("")}function IK(e,t){const n=[];for(const r of(e==null?void 0:e.inputs)??[]){const s=(r==null?void 0:r.name)!=null?String(r.name).trim():"";if(!s)continue;const i=(r==null?void 0:r.type)!=null?String(r.type):"";n.push({section:"input",insert:`input.${s}`,label:s,subtitle:i?t("flow:placeholder.inputSubtitle",{type:i}):t("flow:placeholder.inputSubtitleNoType")})}for(const r of(e==null?void 0:e.outputs)??[]){const s=(r==null?void 0:r.name)!=null?String(r.name).trim():"";if(!s)continue;const i=(r==null?void 0:r.type)!=null?String(r.type):"";n.push({section:"output",insert:`output.${s}`,label:s,subtitle:i?t("flow:placeholder.outputSubtitle",{type:i}):t("flow:placeholder.outputSubtitleNoType")})}for(const r of NK)ET.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function TK(e,t){const n=t.toLowerCase();return n?e.filter(r=>[r.insert,r.label,r.subtitle??""].map(i=>String(i).toLowerCase()).some(i=>i.includes(n))):e}function RK(e,t){if(!e||t<0)return null;const n=Math.min(t,e.value.length),r=getComputedStyle(e),s=document.createElement("div");s.setAttribute("aria-hidden","true"),s.style.visibility="hidden",s.style.position="fixed",s.style.top="0",s.style.left="-99999px",s.style.whiteSpace="pre-wrap",s.style.wordWrap="break-word",s.style.overflow="hidden";const i=e.clientWidth;if(i<=0)return null;s.style.width=`${i}px`,s.style.font=r.font,s.style.lineHeight=r.lineHeight,s.style.padding=r.padding,s.style.border=r.border,s.style.boxSizing=r.boxSizing,s.style.letterSpacing=r.letterSpacing,s.style.textIndent=r.textIndent,s.style.tabSize=r.tabSize||"8",s.textContent=e.value.slice(0,n);const a=document.createElement("span");a.textContent="​",s.appendChild(a),document.body.appendChild(s);const l=a.getBoundingClientRect(),c=parseFloat(r.lineHeight),d=Number.isFinite(c)&&c>0?c:l.height||16;return document.body.removeChild(s),{top:l.top,left:l.left,bottom:l.bottom,height:d}}function wh({value:e,onChange:t,disabled:n,placeholder:r,rows:s=8,textareaClassName:i,ioSlots:a,variant:l="drawer",images:c,onImagesChange:d}){const{t:f}=Pn(),u=h.useId(),p=h.useRef(null),m=h.useRef(null),[g,b]=h.useState(0),[v,y]=h.useState(0),[k,w]=h.useState(null),j=h.useMemo(()=>ks(c),[c]),A=h.useMemo(()=>EK(e,a,f),[e,a,f]),C=A.length>0,$=h.useMemo(()=>_K(e,a),[e,a]),B=h.useMemo(()=>AK($),[$]),F=h.useMemo(()=>n?null:jK(e,g),[e,g,n]),z=h.useMemo(()=>{if(!F)return[];const E=IK(a,f);return TK(E,F.query)},[F,a,f]);h.useEffect(()=>{y(E=>{const D=Math.max(0,z.length-1);return Math.min(Math.max(0,E),D)})},[z.length]);const L=h.useCallback(()=>{const E=p.current;if(!E||!F||z.length===0){w(null);return}const D=RK(E,g);if(!D){w(null);return}const _=4,R=44,P=13.5*16,X=Math.min(z.length*R+8,P);let Z=D.bottom+_;Z+X>window.innerHeight-8&&(Z=Math.max(8,D.top-X-_));const V=288;let ne=D.left;ne=Math.max(8,Math.min(ne,window.innerWidth-V-8)),w({top:Z,left:ne})},[F,z.length,g]);h.useLayoutEffect(()=>{if(!F||z.length===0){w(null);return}const E=requestAnimationFrame(()=>L());return()=>cancelAnimationFrame(E)},[F,z.length,g,e,L]),h.useEffect(()=>{if(!F||z.length===0)return;const E=()=>L();return window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[F,z.length,L]);const O=h.useCallback(E=>{if(!F)return;const{atIndex:D}=F,_=e.slice(0,D)+"${"+E+"}"+e.slice(g);t(_);const R=D+E.length+3;queueMicrotask(()=>{const P=p.current;P&&(P.focus(),P.setSelectionRange(R,R)),b(R)})},[F,e,g,t]),W=h.useCallback(()=>{const E=p.current,D=m.current;!E||!D||(D.scrollTop=E.scrollTop,D.scrollLeft=E.scrollLeft,F&&z.length>0&&queueMicrotask(()=>L()))},[F,z.length,L]),M=h.useCallback(E=>{if(!n&&F&&z.length>0&&(E.key==="ArrowDown"||E.key==="ArrowUp"||E.key==="Enter")){if(E.key==="ArrowDown")E.preventDefault(),y(D=>(D+1)%z.length);else if(E.key==="ArrowUp")E.preventDefault(),y(D=>(D-1+z.length)%z.length);else if(E.key==="Enter"&&!E.shiftKey){E.preventDefault();const D=z[v];D&&O(D.insert)}}},[n,F,z,v,O]),T=h.useCallback(async E=>{if(n||typeof d!="function")return!1;const D=await xT({files:E,body:e,images:j});return D?(t(D.body),d(D.images),queueMicrotask(()=>{const _=p.current;if(!_)return;_.focus();const R=D.body.length;_.setSelectionRange(R,R),b(R)}),!0):!1},[n,j,t,d,e]);return o.jsxs("div",{className:"af-body-prompt-editor"+(l==="expand"?" af-body-prompt-editor--expand":""),children:[j.length>0?o.jsx("div",{className:"af-body-image-list","aria-label":"image attachments",children:j.map((E,D)=>o.jsxs("span",{className:"af-body-image-chip",title:E.name,children:[o.jsx("img",{src:E.dataUrl,alt:""}),o.jsxs("span",{children:["[",E.label||`image ${D+1}`,"]"]})]},E.id||D))}):null,o.jsxs("div",{className:"af-body-prompt-stack",children:[o.jsx("pre",{ref:m,className:"af-body-prompt-backdrop "+i,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:B+`
128
- `}}),o.jsx("textarea",{ref:p,className:"af-body-prompt-textarea "+i,rows:s,value:e,disabled:n,placeholder:r,spellCheck:!1,"aria-invalid":C,"aria-describedby":C?u:void 0,onChange:E=>{t(E.target.value),b(E.target.selectionStart??E.target.value.length)},onSelect:E=>{const D=E.target;D instanceof HTMLTextAreaElement&&b(D.selectionStart??0)},onClick:E=>{const D=E.target;D instanceof HTMLTextAreaElement&&b(D.selectionStart??0)},onKeyUp:E=>{const D=E.target;D instanceof HTMLTextAreaElement&&b(D.selectionStart??D.value.length)},onKeyDown:M,onPaste:E=>{const D=yT(E);D.length!==0&&(E.preventDefault(),T(D).catch(()=>{}))},onDragOver:E=>{Gm(E).length>0&&E.preventDefault()},onDrop:E=>{const D=Gm(E);D.length!==0&&(E.preventDefault(),T(D).catch(()=>{}))},onScroll:W})]}),F&&z.length>0&&k?$r.createPortal(o.jsx("ul",{className:"af-body-ph-menu af-body-ph-menu--pop af-composer-mention-menu",role:"listbox","aria-label":f("flow:nodeProps.placeholderSlots"),style:{position:"fixed",top:k.top,left:k.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:z.map((E,D)=>o.jsx("li",{role:"option","aria-selected":D===v,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(D===v?" af-composer-mention-item--active":""),onMouseDown:_=>_.preventDefault(),onMouseEnter:()=>y(D),onClick:()=>O(E.insert),children:[o.jsx("span",{className:"af-composer-mention-id",children:`\${${E.insert}}`}),E.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:E.subtitle}):null]})},`${E.section}-${E.insert}`))}),document.body):null,C?o.jsx("p",{id:u,className:"af-body-ph-issues",role:"status",children:A.map(E=>E.message).join(" · ")}):null]})}const AT=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function bh(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function Rj({kind:e,label:t,slots:n,onSlotsChange:r,disabled:s,requiredReadonly:i=!0}){const{t:a}=Pn(),l=()=>r([...n,{type:"text",name:"",default:"",required:!1,showOnNode:!1}]),c=u=>r(n.filter((p,m)=>m!==u)),d=(u,p,m)=>{const g=n.map((b,v)=>{if(v!==u)return b;const y={...b,[p]:m};return p==="required"&&m===!0&&(y.showOnNode=!0),y});r(g)},f=e==="input"?"input":"output";return o.jsxs("div",{className:"af-node-props-field af-node-props-field--io",children:[o.jsxs("div",{className:"af-node-props-io-head",children:[o.jsx("span",{className:"af-node-props-label",children:t}),o.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-io-add",onClick:l,disabled:s,"aria-label":a("flow:nodeProps.addPinAriaLabel",{label:t}),children:a("flow:nodeProps.addPin")})]}),o.jsx("p",{className:"af-node-props-io-hint",children:a("flow:nodeProps.handleHint",{prefix:f})}),n.length===0?o.jsx("p",{className:"af-node-props-io-empty",children:a(e==="input"?"flow:nodeProps.noInputPins":"flow:nodeProps.noOutputPins")}):null,n.length>0?o.jsxs("div",{className:"af-node-props-io-table",role:"group","aria-label":t,children:[o.jsxs("div",{className:"af-node-props-io-table-head","aria-hidden":!0,children:[o.jsx("span",{children:a("flow:nodeProps.handle")}),o.jsx("span",{children:a("flow:nodeProps.type")}),o.jsx("span",{children:a("flow:nodeProps.name")}),o.jsx("span",{children:a("flow:nodeProps.defaultValue")}),o.jsx("span",{children:a("flow:nodeProps.required")}),o.jsx("span",{children:a("flow:nodeProps.showOnNode")}),o.jsx("span",{})]}),n.map((u,p)=>o.jsxs("div",{className:"af-node-props-io-row",children:[o.jsxs("span",{className:"af-node-props-io-handle",title:`${f}-${p}`,children:[f,"-",p]}),o.jsx("select",{className:"af-node-props-input af-node-props-io-cell",value:u.type,onChange:m=>d(p,"type",m.target.value),disabled:s,"aria-label":a("flow:nodeProps.pinTypeAriaLabel",{label:t,index:p}),children:["node","text","file","bool"].map(m=>o.jsx("option",{value:m,children:m},m))}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:u.name,onChange:m=>d(p,"name",m.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinNameAriaLabel",{label:t,index:p})}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:u.default,onChange:m=>d(p,"default",m.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinDefaultAriaLabel",{label:t,index:p})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.requiredHint"),children:o.jsx("input",{type:"checkbox",checked:!!u.required,onChange:m=>{i||d(p,"required",m.target.checked)},disabled:s||i,"aria-label":a("flow:nodeProps.pinRequiredAriaLabel",{label:t,index:p})})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.showOnNodeHint"),children:o.jsx("input",{type:"checkbox",checked:u.showOnNode!==!1,onChange:m=>d(p,"showOnNode",m.target.checked),disabled:s,"aria-label":a("flow:nodeProps.pinShowOnNodeAriaLabel",{label:t,index:p})})}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-io-remove",onClick:()=>c(p),disabled:s,"aria-label":a("flow:nodeProps.deletePinAriaLabel",{label:t,index:p}),title:a("flow:nodeProps.deletePin"),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},`${f}-${p}`))]}):null]})}function IT({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:s,disabled:i,onIdBlur:a,onClose:l,onPublishToMarketplace:c,allowEditRequiredPins:d=!1,error:f,ioSlots:u}){const{t:p}=Pn(),[m,g]=h.useState(!1),[b,v]=h.useState(!1),[y,k]=h.useState({status:"idle",message:""}),w=h.useCallback(O=>{t(W=>W&&{...W,...O})},[t]),{cursorList:j,opencodeList:A,claudeCodeList:C,currentNotInLists:$}=h.useMemo(()=>{const O=Array.isArray(s==null?void 0:s.cursor)?s.cursor:[],W=Array.isArray(s==null?void 0:s.opencode)?s.opencode:[],M=Array.isArray(s==null?void 0:s.claudeCode)?s.claudeCode:[],T=new Set([...O,...W,...M].map(bh)),E=((e==null?void 0:e.model)??"").trim(),D=E.startsWith("cursor:")?E.slice(7):E.startsWith("opencode:")?E.slice(9):E.startsWith("claude-code:")?E.slice(12):E,_=E&&!T.has(D)?E:"";return{cursorList:O,opencodeList:W,claudeCodeList:M,currentNotInLists:_}},[s,e==null?void 0:e.model]);if(!e)return null;const B=String(e.script??""),F=n==="tool_nodejs"||B.trim()!=="",z=typeof c=="function"&&!i&&(e==null?void 0:e.newId),L=async()=>{if(z){k({status:"running",message:p("flow:nodeProps.publishRunning")});try{const O=await c(e,n);k({status:"success",message:O!=null&&O.definitionId?p("flow:nodeProps.publishSuccessWithId",{id:O.definitionId}):p("flow:nodeProps.publishSuccess")})}catch(O){k({status:"error",message:String((O==null?void 0:O.message)||O)})}}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-pipeline-drawer-head af-node-props-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:p("flow:nodeProps.title")}),o.jsxs("div",{className:"af-node-props-head-actions",children:[o.jsxs("button",{type:"button",className:"af-btn-ghost af-node-props-market-btn",onClick:L,disabled:!z||y.status==="running",title:p("flow:nodeProps.publishToMarketplaceHint"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"inventory_2"}),y.status==="running"?p("flow:nodeProps.publishing"):p("flow:nodeProps.publishToMarketplace")]}),o.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-close-secondary",onClick:l,children:p("common:common.close")})]})]}),o.jsxs("div",{className:"af-pipeline-drawer-body af-node-props-body",children:[f?o.jsx("p",{className:"af-err af-node-props-err",children:f}):null,y.message?o.jsx("p",{className:`af-node-props-market-status af-node-props-market-status--${y.status}`,children:y.message}):null,o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:p("flow:node.nodeType")}),o.jsx("div",{className:"af-pipeline-drawer-readonly af-node-props-readonly-mono",children:n})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:nodeProps.instanceId"),o.jsx("span",{className:"af-node-props-hint",children:p("flow:node.displayNameHint")})]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.newId,onChange:O=>w({newId:O.target.value}),onBlur:a,disabled:i,spellCheck:!1,autoComplete:"off","aria-label":p("flow:nodeProps.instanceId")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.displayName"),"(LABEL)"]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.label,onChange:O=>w({label:O.target.value}),disabled:i,spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.role"),"(ROLE)"]}),o.jsx("select",{className:"af-node-props-select",value:nl.includes(e.role)?e.role:p("flow:roles.normal"),onChange:O=>w({role:O.target.value}),disabled:i,children:nl.map(O=>o.jsx("option",{value:O,children:O},O))})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.model"),"(MODEL)"]}),o.jsx("span",{className:"af-node-props-sublabel",children:p("flow:node.modelHint")}),o.jsxs("select",{className:"af-node-props-select",value:(()=>{const O=(e.model||"").trim();return O?$||O:""})(),onChange:O=>w({model:O.target.value}),disabled:i,"aria-label":p("flow:nodeProps.modelAriaLabel"),children:[o.jsx("option",{value:"",children:p("flow:node.defaultModel")}),$?o.jsxs("option",{value:$,children:[$,p("flow:nodeProps.yamlValueNotInList")]}):null,j.length>0?o.jsx("optgroup",{label:"Cursor",children:j.map(O=>o.jsx("option",{value:bh(O),children:O},`c-${O}`))}):null,A.length>0?o.jsx("optgroup",{label:"OpenCode",children:A.map(O=>o.jsx("option",{value:bh(O),children:O},`o-${O}`))}):null,C.length>0?o.jsx("optgroup",{label:"Claude Code",children:C.map(O=>o.jsx("option",{value:`claude-code:${bh(O)}`,children:O},`cc-${O}`))}):null]})]}),o.jsx(Rj,{kind:"input",label:p("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:O=>w({inputs:O}),disabled:i,requiredReadonly:!d}),o.jsx(Rj,{kind:"output",label:p("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:O=>w({outputs:O}),disabled:i,requiredReadonly:!d}),F?o.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[o.jsxs("div",{className:"af-node-props-prompt-head",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.directCommand"),"(script)",o.jsx("span",{className:"af-node-props-hint",children:p("flow:node.scriptHint")})]}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>v(!0),"aria-label":p("flow:nodeProps.expandEditScript"),title:p("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(wh,{value:B,onChange:O=>w({script:O}),disabled:i,placeholder:p("flow:nodeProps.scriptPlaceholder"),rows:6,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea af-node-props-script-textarea",ioSlots:u,variant:"drawer"})]}):null,o.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[o.jsxs("div",{className:"af-node-props-prompt-head",children:[o.jsx("span",{className:"af-node-props-label",children:p("flow:node.userPrompt")}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>g(!0),"aria-label":p("flow:nodeProps.expandEdit"),title:p("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(wh,{value:e.body,onChange:O=>w({body:O}),images:e.images,onImagesChange:O=>w({images:O}),disabled:i,placeholder:p("flow:nodeProps.bodyPlaceholder"),rows:8,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea",ioSlots:u,variant:"drawer"})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:p("flow:node.systemDescription")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-node-props-system-readonly",rows:4,readOnly:!0,value:r||p("flow:nodeProps.noDescription"),spellCheck:!1})]})]}),b?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editScript"),onMouseDown:O=>{O.target===O.currentTarget&&v(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:p("flow:node.directCommand")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>v(!1),"aria-label":p("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx(wh,{value:B,onChange:O=>w({script:O}),disabled:i,placeholder:p("flow:nodeProps.scriptPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:u,variant:"expand"})]})}):null,m?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editUserPrompt"),onMouseDown:O=>{O.target===O.currentTarget&&g(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:p("flow:node.body")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>g(!1),"aria-label":p("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx(wh,{value:e.body,onChange:O=>w({body:O}),images:e.images,onImagesChange:O=>w({images:O}),disabled:i,placeholder:p("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:u,variant:"expand"})]})}):null]})}function y0(e){var n;if(e.displayKind==="image"||e.encoding==="base64"&&((n=e.mimeType)!=null&&n.startsWith("image/")))return"image";if(e.displayKind==="json"||e.mimeType==="application/json")return"json";if(e.displayKind==="markdown"||e.mimeType==="text/markdown")return"markdown";if(e.displayKind==="text")return"text";const t=(e.content||"").trim();if(t&&(t.startsWith("{")||t.startsWith("[")))try{return JSON.parse(t),"json"}catch{}return"text"}function LK(e){const t=y0(e);if(t==="image"){const n=(e.mimeType||"image/png").split("/")[1];return n?n.toUpperCase():"IMAGE"}return t==="json"?"JSON":t==="markdown"?"MD":null}function TT(e){try{return JSON.stringify(JSON.parse(e.trim()),null,2)}catch{return e}}function Lj({text:e}){const{t}=Pn(),n=e||"";return n.trim()?o.jsx("div",{className:"af-run-ctx-md",children:o.jsx(dp,{children:n})}):o.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}function Oj({o:e}){var r;const{t}=Pn(),n=y0(e);if(n==="image"||e.encoding==="base64"&&((r=e.mimeType)!=null&&r.startsWith("image/"))){const i=`data:${e.mimeType||"image/png"};base64,${e.content||""}`;return o.jsxs("div",{className:"af-run-ctx-media",children:[o.jsx("img",{className:"af-run-ctx-img",src:i,alt:e.slot||"output",loading:"lazy"}),e.truncated?o.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.imageTruncated")}):null]})}if(n==="json")return o.jsx("pre",{className:"af-run-ctx-pre",children:TT(e.content||"")});if(n==="markdown"){const s=e.content||"";return s.trim()?o.jsx("div",{className:"af-run-ctx-md",children:o.jsx(dp,{children:s})}):o.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}return o.jsx("pre",{className:"af-run-ctx-pre",children:e.content!=null&&e.content!==""?e.content:t("flow:runContext.empty")})}function Mj(e){return LK(e)}function $j(e){var r;if(!e)return null;const t=y0(e);if(t==="image"||e.encoding==="base64"&&((r=e.mimeType)!=null&&r.startsWith("image/")))return null;const n=e.content;return n==null||n===""?null:t==="json"?TT(String(n)):String(n)}function Dj({text:e,title:t,copiedLabel:n}){const[r,s]=h.useState(!1);if(!e)return null;const i=async()=>{try{await navigator.clipboard.writeText(e),s(!0),window.setTimeout(()=>s(!1),1400)}catch{}};return o.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-copy-btn",onClick:i,title:r?n:t,"aria-label":r?n:t,children:o.jsx("span",{className:"material-symbols-outlined",children:r?"check":"content_copy"})})}const Fj=2e4,RT="af:run-node-ctx-width";function Jh(){return typeof window>"u"?416:Math.min(26*16,window.innerWidth-32)}function Da(e){const n=Math.max(280,Math.min(Math.floor(window.innerWidth*.92),1200));return Number.isFinite(e)?Math.min(Math.max(Math.round(e),200),n):Da(Jh())}function OK(){try{const e=localStorage.getItem(RT);if(e==null)return Da(Jh());const t=parseInt(e,10);return Number.isFinite(t)?Da(t):Da(Jh())}catch{return Da(Jh())}}async function zj(e,t,n,r){const s=new URLSearchParams({flowId:e,instanceId:t});n&&String(n).trim()&&s.set("runId",String(n).trim());const i=await fetch(`/api/node-exec-context?${s.toString()}`,{signal:r}),a=await i.text();let l;try{l=JSON.parse(a)}catch{throw new Error(a.startsWith("<!")||a.startsWith("<html")?"apiConnectError":"invalidJson")}if(!i.ok)throw new Error(l.error||"HTTP "+i.status);return l}function MK(e,t){const n=`flow:runContext.${t}`,r=e(n);return r!==n?r:t}function $K({instanceId:e,flowId:t,runId:n,nodeStatus:r,onClose:s}){const{t:i}=Pn(),[a,l]=h.useState(()=>typeof window<"u"&&window.matchMedia("(max-width: 960px)").matches),[c,d]=h.useState(OK),f=h.useRef({active:!1,pointerId:-1,startX:0,startW:416}),[u,p]=h.useState(!0),[m,g]=h.useState(""),[b,v]=h.useState([]),[y,k]=h.useState(null),[w,j]=h.useState(null),A=h.useRef(null),C=h.useRef(null),$=h.useRef(0),B=h.useRef(0);h.useLayoutEffect(()=>{const _=window.matchMedia("(max-width: 960px)"),R=()=>l(_.matches);return _.addEventListener("change",R),()=>_.removeEventListener("change",R)},[]),h.useEffect(()=>{function _(){d(R=>Da(R))}return window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[]);const F=h.useCallback(()=>{d(_=>{const R=Da(_);try{localStorage.setItem(RT,String(R))}catch{}return R})},[]),z=h.useCallback(_=>{if(a||_.button!==0)return;_.preventDefault();const R=_.currentTarget;f.current={active:!0,pointerId:_.pointerId,startX:_.clientX,startW:c},R.setPointerCapture(_.pointerId)},[a,c]),L=h.useCallback(_=>{const R=f.current;if(!R.active||_.pointerId!==R.pointerId)return;const P=R.startX-_.clientX;d(Da(R.startW+P))},[]),O=h.useCallback(_=>{const R=f.current;if(!(!R.active||_.pointerId!==R.pointerId)){R.active=!1;try{_.currentTarget.releasePointerCapture(_.pointerId)}catch{}F()}},[F]),W=h.useCallback(()=>{const _=f.current;_.active&&(_.active=!1,F())},[F]),M=h.useCallback(_=>{const R=Array.isArray(_)?_:[];v(R),k(P=>P&&R.some(X=>X.execId===P)?P:R.length>0?R[R.length-1].execId:null)},[]),T=h.useCallback(()=>{if(!e||!t)return;const _=++$.current,R=new AbortController,P=window.setTimeout(()=>R.abort(),Fj);(async()=>{try{const X=await zj(t,e,n,R.signal);if(_!==$.current)return;M(Array.isArray(X.rounds)?X.rounds:[])}catch{}finally{window.clearTimeout(P)}})()},[e,t,n,M]);h.useEffect(()=>{if(!e||!t){p(!1),g(""),v([]);return}const _=++B.current;p(!0),g(""),v([]),k(null);const R=new AbortController,P=window.setTimeout(()=>R.abort(),Fj);return(async()=>{try{const X=await zj(t,e,n,R.signal);if(_!==B.current)return;M(Array.isArray(X.rounds)?X.rounds:[])}catch(X){if(_!==B.current)return;const Z=(X==null?void 0:X.name)==="AbortError"?"requestTimeout":X.message||String(X);g(Z)}finally{window.clearTimeout(P),_===B.current&&p(!1)}})(),()=>{R.abort(),B.current++,$.current++}},[e,t,n,M]),h.useEffect(()=>{r&&T()},[r,T]),h.useEffect(()=>{clearInterval(C.current);const _=b.length>0?b[b.length-1]:null;return(r==="running"&&b.length===0||!!(_&&_.status==="running"))&&e&&t&&(C.current=setInterval(()=>T(),2e3)),()=>clearInterval(C.current)},[b,e,t,n,r,T]),h.useEffect(()=>{A.current&&(A.current.scrollTop=0)},[y]);const E=b.find(_=>_.execId===y),D=a?void 0:{width:`${c}px`};return o.jsxs("aside",{className:"af-run-ctx-panel",style:D,"aria-label":i("flow:runContext.title"),children:[a?null:o.jsx("div",{className:"af-run-ctx-resize",role:"separator","aria-orientation":"vertical","aria-label":i("flow:runContext.resizeHandle"),onPointerDown:z,onPointerMove:L,onPointerUp:O,onPointerCancel:O,onLostPointerCapture:W}),o.jsxs("div",{className:"af-run-ctx-panel__main",children:[o.jsxs("div",{className:"af-run-ctx-head",children:[o.jsx("h2",{className:"af-run-ctx-title",title:e,children:e}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:s,"aria-label":i("common:common.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),u&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i("common:common.loading")}),m&&o.jsx("div",{className:"af-run-ctx-error",children:MK(i,m)}),!u&&!m&&b.length===0&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i(r==="running"?"flow:runContext.executingNoArtifacts":"flow:runContext.noData")}),b.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-run-ctx-rounds af-run-ctx-rounds--select af-run-ctx-round--"+FK((E==null?void 0:E.status)||""),children:[o.jsx("span",{className:"af-run-ctx-round-dot","aria-hidden":!0}),o.jsx("select",{className:"af-run-ctx-round-select",value:String(y??""),onChange:_=>{const R=_.target.value;k(R==="latest"?"latest":Number(R))},children:[...b].reverse().map(_=>{const R=_.execId==="latest"?i("flow:runContext.latest"):`#${_.execId}`,P=zK(i,_.status),X=_.finishedAt?` · ${DK(_.finishedAt)}`:"";return o.jsx("option",{value:String(_.execId),children:`${R} · ${P}${X}`},_.execId)})})]}),E&&o.jsxs("div",{className:"af-run-ctx-body",ref:A,children:[E.inputs&&E.inputs.length>0&&o.jsxs("section",{className:"af-run-ctx-section",children:[o.jsxs("h3",{className:"af-run-ctx-section-title",children:[o.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"input"}),"Inputs"]}),E.inputs.map((_,R)=>o.jsxs("div",{className:"af-run-ctx-output-slot",children:[o.jsx("div",{className:"af-run-ctx-slot-head",children:o.jsx("div",{className:"af-run-ctx-slot-name",children:_.slot})}),o.jsx("pre",{className:"af-run-ctx-slot-text",children:_.value})]},`${_.slot}-${R}`))]}),E.prompt!=null&&o.jsxs("section",{className:"af-run-ctx-section",children:[o.jsxs("h3",{className:"af-run-ctx-section-title",children:[o.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"description"}),"Prompt",o.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>j("prompt"),title:i("flow:nodeProps.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(Lj,{text:E.prompt})]}),E.outputs&&E.outputs.length>0&&o.jsxs("section",{className:"af-run-ctx-section",children:[o.jsxs("h3",{className:"af-run-ctx-section-title",children:[o.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"output"}),"Outputs",o.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>j("output"),title:i("flow:nodeProps.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),E.outputs.map((_,R)=>{const P=Mj(_),X=$j(_);return o.jsxs("div",{className:"af-run-ctx-output-slot",children:[o.jsxs("div",{className:"af-run-ctx-slot-head",children:[o.jsx("div",{className:"af-run-ctx-slot-name",children:_.slot}),P?o.jsx("span",{className:"af-run-ctx-format-badge",title:i("flow:runContext.detectedContentType"),children:P}):null,o.jsx(Dj,{text:X,title:i("common:common.copy"),copiedLabel:i("common:common.copied")})]}),o.jsx(Oj,{o:_})]},`${_.slot}-${R}`)})]}),!E.prompt&&(!E.outputs||E.outputs.length===0)&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i("flow:runContext.roundNoContent")})]})]})]}),w&&E&&o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true",onClick:_=>{_.target===_.currentTarget&&j(null)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:w==="prompt"?"Prompt":"Outputs"}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>j(null),"aria-label":i("common:common.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-node-props-expand-body af-run-ctx-expand-body",children:[w==="prompt"&&E.prompt!=null&&o.jsx(Lj,{text:E.prompt}),w==="output"&&E.outputs&&E.outputs.map((_,R)=>{const P=Mj(_),X=$j(_);return o.jsxs("div",{className:"af-run-ctx-output-slot",style:{marginBottom:"1rem"},children:[o.jsxs("div",{className:"af-run-ctx-slot-head",children:[o.jsx("div",{className:"af-run-ctx-slot-name",children:_.slot}),P?o.jsx("span",{className:"af-run-ctx-format-badge",children:P}):null,o.jsx(Dj,{text:X,title:i("common:common.copy"),copiedLabel:i("common:common.copied")})]}),o.jsx(Oj,{o:_})]},`${_.slot}-${R}`)})]})]})})]})}function DK(e){try{const t=new Date(e);if(isNaN(t.getTime()))return e;const n=r=>String(r).padStart(2,"0");return`${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}catch{return e}}function FK(e){const t=String(e||"").toLowerCase();return t==="success"||t==="completed"||t==="done"?"success":t==="failed"||t==="error"?"failed":t==="running"||t==="executing"?"running":t==="cache_not_met"?"cache":t?"unknown":"pending"}function zK(e,t){const n=String(t||"").toLowerCase();return n?n==="success"||n==="completed"||n==="done"?e("flow:runContext.statusSuccess",{defaultValue:"成功"}):n==="failed"||n==="error"?e("flow:runContext.statusFailed",{defaultValue:"失败"}):n==="running"||n==="executing"?e("flow:runContext.statusRunning",{defaultValue:"运行中"}):n==="cache_not_met"?e("flow:runContext.statusCacheMiss",{defaultValue:"缓存失效"}):t:e("flow:runContext.statusPending",{defaultValue:"等待"})}function BK({flowId:e,flowSource:t,flowArchived:n,provideNodes:r,edges:s,nodes:i,onCliInputsChange:a,onBackToEdit:l}){const{t:c}=Pn(),[d,f]=h.useState({}),[u,p]=h.useState(null),[m,g]=h.useState({}),[b,v]=h.useState(!0),[y,k]=h.useState(!1),[w,j]=h.useState(""),[A,C]=h.useState(!1),[$,B]=h.useState(null),F=h.useRef(null),z=h.useRef(!0),L=h.useRef({});h.useMemo(()=>{var P,X,Z;const R={};for(const V of r){const ne=(Z=(X=(P=V.data)==null?void 0:P.outputs)==null?void 0:X[0])==null?void 0:Z.default;ne!=null&&ne!==""&&(R[V.id]=String(ne))}return L.current=R,R},[r]);const O=h.useMemo(()=>{var P;const R={};for(const X of i){if(!((P=X.data)!=null&&P.inputs))continue;const Z=X.data.inputs;for(let V=0;V<Z.length;V++){const ne=Z[V];if(!(ne!=null&&ne.name))continue;const ue=s.find(ge=>ge.target===X.id&&ge.targetHandle===`input-${V}`);if(!(ue!=null&&ue.source))continue;r.find(ge=>ge.id===ue.source)&&(R[ue.source]=ne.name)}}return R},[i,s,r]);h.useEffect(()=>(z.current=!0,()=>{z.current=!1}),[]),h.useEffect(()=>{if(!e){v(!1);return}v(!0);const R=new URLSearchParams({flowId:e,flowSource:t||"user"});n&&R.set("archived","1"),fetch(`/api/flow/run-config?${R.toString()}`).then(P=>{if(!P.ok)throw new Error(`HTTP ${P.status}`);return P.json()}).then(P=>{var Z;if(!z.current)return;f(P.presets||{}),p(P.activePreset||null);const X=P.activePreset&&((Z=P.presets)!=null&&Z[P.activePreset])?P.presets[P.activePreset]:{};g({...L.current,...X}),v(!1)}).catch(()=>{z.current&&(g(L.current),v(!1))})},[e,t,n]),h.useEffect(()=>{var P;if(!a)return;const R={};for(const[X,Z]of Object.entries(m)){const V=O[X];if(!V)continue;const ne=r.find(pe=>pe.id===X);if(!ne)continue;(((P=ne.data)==null?void 0:P.definitionId)||"").startsWith("provide_file")?R[V]={type:"file",path:Z}:R[V]={type:"str",value:Z}}a(R)},[m,O,r,a]);const W=h.useCallback((R,P)=>{g(X=>({...X,[R]:P}))},[]),M=h.useCallback(R=>{R!==u&&(p(R),R&&d[R]?g({...L.current,...d[R]}):g(L.current))},[u,d]),T=h.useCallback(async()=>{if(w.trim()){k(!0);try{const R={...d,[w.trim()]:m},P={flowId:e,flowSource:t,archived:n,presets:R,activePreset:w.trim()};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})).ok&&(f(R),p(w.trim()),j(""),C(!1))}finally{k(!1)}}},[e,t,n,d,m,w]),E=h.useCallback(async()=>{if(u){k(!0);try{const R={...d};delete R[u];const P=Object.keys(R)[0]||null;(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:e,flowSource:t,archived:n,presets:R,activePreset:P})})).ok&&(f(R),p(P),P&&R[P]?g({...L.current,...R[P]}):g(L.current))}finally{k(!1)}}},[e,t,n,d,u]),D=h.useCallback(async()=>{if(u){k(!0);try{const R={...d,[u]:m};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:e,flowSource:t,archived:n,presets:R,activePreset:u})})).ok&&f(R)}finally{k(!1)}}},[e,t,n,d,u,m]),_=Object.keys(d);return _.length>0,b?o.jsx("aside",{className:"af-run-config-panel",children:o.jsx("div",{className:"af-run-config-loading",children:c("common.loading")})}):o.jsxs("aside",{className:"af-run-config-panel",children:[o.jsxs("div",{className:"af-run-config-preset",children:[o.jsx("label",{className:"af-run-config-preset-label",children:c("flow:runConfig.preset")}),o.jsxs("div",{className:"af-run-config-preset-row",children:[o.jsxs("select",{className:"af-run-config-preset-select",value:u||"",onChange:R=>M(R.target.value||null),disabled:y,children:[o.jsx("option",{value:"",children:c("flow:runConfig.default")}),_.map(R=>o.jsx("option",{value:R,children:R},R))]}),o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--new",onClick:()=>C(!0),disabled:y,title:c("flow:runConfig.newPreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),u&&o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--save",onClick:D,disabled:y,title:c("flow:runConfig.savePreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"})}),u&&o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--delete",onClick:E,disabled:y,title:c("flow:runConfig.deletePreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"})})]})]}),A&&o.jsxs("div",{className:"af-run-config-save-dialog",children:[o.jsx("input",{type:"text",className:"af-run-config-save-input",placeholder:c("flow:runConfig.presetNamePlaceholder"),value:w,onChange:R=>j(R.target.value),disabled:y}),o.jsxs("div",{className:"af-run-config-save-actions",children:[o.jsx("button",{type:"button",className:"af-btn-primary",onClick:T,disabled:y||!w.trim(),children:c(y?"common.saving":"common.save")}),o.jsx("button",{type:"button",className:"af-btn-outline",onClick:()=>{C(!1),j("")},disabled:y,children:c("common.cancel")})]})]}),o.jsxs("div",{className:"af-run-config-inputs",children:[o.jsx("div",{className:"af-run-config-inputs-header",children:c("flow:runConfig.inputParams")}),r.length===0?o.jsx("div",{className:"af-run-config-empty",children:c("flow:runConfig.noProvideNodes")}):o.jsx("div",{className:"af-run-config-input-list",children:r.map(R=>{var ge,ae;const P=((ge=R.data)==null?void 0:ge.definitionId)||"",X=P.startsWith("provide_file"),Z=P==="provide_bool",V=((ae=R.data)==null?void 0:ae.label)||R.id,ne=R.id,ue=m[ne]||"",pe=["true","1","yes","on"].includes(String(ue).trim().toLowerCase());return o.jsxs("div",{className:"af-run-config-input-item",children:[o.jsxs("div",{className:"af-run-config-input-head",children:[o.jsx("span",{className:"af-run-config-input-icon material-symbols-outlined"+(X?" af-run-config-input-icon--file":""),"aria-hidden":!0,children:X?"description":Z?"toggle_on":"text_fields"}),o.jsx("span",{className:"af-run-config-input-label",children:V}),Z?null:o.jsx("button",{type:"button",className:"af-run-config-input-expand",onClick:()=>B({instanceId:ne,label:V,content:ue}),"aria-label":c("flow:runConfig.expandInput"),title:c("flow:runConfig.expandInput"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx("div",{className:"af-run-config-input-id",children:ne}),Z?o.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(pe?" af-run-config-bool-toggle--true":""),onClick:()=>W(ne,pe?"false":"true"),"aria-pressed":pe,children:pe?"true":"false"}):o.jsx("input",{type:"text",className:"af-run-config-input-field",value:ue,onChange:be=>W(ne,be.target.value),placeholder:c(X?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},ne)})})]}),$&&$r.createPortal(o.jsx("div",{className:"af-provide-edit-overlay",children:o.jsxs("div",{className:"af-provide-edit-modal",role:"dialog","aria-modal":"true",children:[o.jsxs("div",{className:"af-provide-edit-modal__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit_document"}),o.jsx("span",{className:"af-provide-edit-modal__title",children:$.label}),o.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>B(null),"aria-label":c("common:close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("div",{className:"af-provide-edit-modal__body",children:o.jsx("textarea",{ref:F,className:"af-provide-edit-modal__textarea",defaultValue:$.content,autoFocus:!0})}),o.jsxs("div",{className:"af-provide-edit-modal__foot",children:[o.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn af-provide-edit-modal__btn--save",onClick:()=>{!$||!F.current||(W($.instanceId,F.current.value),B(null))},children:[o.jsx("span",{className:"material-symbols-outlined",children:"save"}),c("flow:provideEdit.save")]}),o.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn",onClick:()=>B(null),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),c("flow:provideEdit.cancel")]})]})]})}),document.body)]})}const LT={ai:["planner-system","planner-user","planner-response","agent-step-prompt","repair-prompt","ai-thinking","ai-assistant","ai-result","ai-tool"],flow:["composer-start","classify","plan","phase-plan","phase-complete","phase-auto-continue","composer-done"],step:["step-start","step-progress","step-done","validation"],output:["natural","status"],error:["error"]},HK={"planner-system":"#9ecaff","planner-user":"#9ecaff","planner-response":"#7c4dff","agent-step-prompt":"#7c4dff","repair-prompt":"#ff6b6b","ai-thinking":"#a8b9d4","ai-assistant":"#e8deff","ai-result":"#00e475","ai-tool":"#9ecaff","composer-start":"#00e475","composer-done":"#00e475","step-start":"#e8deff","step-done":"#e8deff","step-progress":"#e8deff",natural:"#a8a8a8",status:"#a8a8a8",error:"#ff6b6b","phase-plan":"#00e475","phase-complete":"#00e475"};function WK(e){return!e||e<1024?`${e||0} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function VK(e){if(!e)return"";const t=new Date(e);return isNaN(t.getTime())?e:`${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}:${t.getSeconds().toString().padStart(2,"0")}.${t.getMilliseconds().toString().padStart(3,"0")}`}function UK(e){if(!e)return"";const t=new Date(e);return isNaN(t.getTime())?e:`${t.getMonth()+1}/${t.getDate()} ${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}`}function Bj(e,t){if(e==="natural"&&t&&typeof t=="object"){const n=t.kind;if(n==="thinking"||n==="assistant"||n==="result"||n==="tool")return"ai";if(n==="error")return"error"}for(const[n,r]of Object.entries(LT))if(r.includes(e))return n;return"other"}function KK({event:e,defaultExpanded:t}){const[n,r]=h.useState(!!t),s=HK[e.tag]||"#a8a8a8",i=e.payload,a=i&&typeof i=="object",l=a?typeof i.text=="string"?i.text:"":String(i||""),c=a?i.meta:null,d=h.useMemo(()=>l?l.slice(0,140).replace(/\s+/g," "):a?Object.keys(i).filter(m=>m!=="text"&&m!=="meta").slice(0,3).map(m=>{const g=i[m];return g==null?`${m}:null`:typeof g=="object"?`${m}:{…}`:`${m}:${String(g).slice(0,30)}`}).join(" "):"",[i,l,a]),f=h.useCallback(u=>{u.stopPropagation();const p=a?JSON.stringify(i,null,2):String(i);try{navigator.clipboard.writeText(p)}catch{}},[i,a]);return o.jsxs("div",{style:{borderLeft:`3px solid ${s}`,background:n?"#1c1b1b":"#131313",marginBottom:4,borderRadius:4,cursor:"pointer",transition:"background 120ms"},onClick:()=>r(u=>!u),children:[o.jsxs("div",{style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:10,fontSize:12},children:[o.jsx("span",{style:{color:"#9a9a9a",fontFamily:"monospace",flexShrink:0},children:VK(e.ts)}),o.jsx("span",{style:{color:s,fontWeight:600,fontFamily:"monospace",flexShrink:0,padding:"1px 6px",background:"rgba(255,255,255,0.04)",borderRadius:3},children:e.tag}),o.jsx("span",{style:{color:"#c5c2c1",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"monospace"},children:d}),n&&o.jsx("button",{type:"button",onClick:f,style:{background:"rgba(124,77,255,0.15)",color:"#e8deff",border:"none",borderRadius:3,padding:"2px 8px",fontSize:11,cursor:"pointer"},children:"Copy"})]}),n&&o.jsxs("div",{style:{padding:"0 10px 10px 10px",borderTop:"1px solid rgba(255,255,255,0.04)"},children:[c&&Object.keys(c).length>0&&o.jsx("div",{style:{marginTop:8,padding:8,background:"#0e0e0e",borderRadius:4,fontSize:11,fontFamily:"monospace",color:"#9ecaff",whiteSpace:"pre-wrap",wordBreak:"break-all"},children:JSON.stringify(c,null,2)}),l?o.jsx("pre",{style:{marginTop:8,padding:10,background:"#0e0e0e",borderRadius:4,fontSize:12,color:"#e5e2e1",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:600,overflowY:"auto",margin:"8px 0 0 0",fontFamily:"ui-monospace, SF Mono, Menlo, monospace"},children:l}):a?o.jsx("pre",{style:{marginTop:8,padding:10,background:"#0e0e0e",borderRadius:4,fontSize:12,color:"#e5e2e1",whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:400,overflowY:"auto",margin:"8px 0 0 0",fontFamily:"ui-monospace, SF Mono, Menlo, monospace"},children:JSON.stringify(i,null,2)}):null]})]})}function qK({open:e,onClose:t,flowId:n}){var B;const[r,s]=h.useState([]),[i,a]=h.useState(!1),[l,c]=h.useState(null),[d,f]=h.useState(null),[u,p]=h.useState(!1),[m,g]=h.useState(!0),[b,v]=h.useState({ai:!0,flow:!0,step:!0,output:!0,error:!0}),[y,k]=h.useState(""),w=h.useRef(null),j=h.useCallback(async()=>{a(!0);try{const F=m&&n?`?flowId=${encodeURIComponent(n)}`:"",L=await(await fetch(`/api/composer-logs${F}`)).json();s(Array.isArray(L.sessions)?L.sessions:[])}catch{s([])}finally{a(!1)}},[n,m]),A=h.useCallback(async F=>{if(!F){f(null);return}p(!0);try{const L=await(await fetch(`/api/composer-logs/${encodeURIComponent(F)}`)).json();f(L)}catch{f(null)}finally{p(!1)}},[]);h.useEffect(()=>{e&&j()},[e,j]),h.useEffect(()=>{if(!(!e||!l))return A(l),w.current=setInterval(()=>A(l),2e3),()=>{w.current&&clearInterval(w.current),w.current=null}},[e,l,A]);const C=h.useMemo(()=>{const F=(d==null?void 0:d.events)||[],z=y.trim().toLowerCase();return F.filter(L=>{const O=Bj(L.tag,L.payload);return!b[O]&&O!=="other"?!1:z?[L.tag,JSON.stringify(L.payload||"")].join(" ").toLowerCase().includes(z):!0})},[d,b,y]),$=h.useMemo(()=>{const F=(d==null?void 0:d.events)||[],z={};for(const L of F){const O=Bj(L.tag,L.payload);z[O]=(z[O]||0)+1}return z},[d]);return e?o.jsxs("div",{style:{position:"fixed",top:0,right:0,bottom:0,width:"min(1100px, 80vw)",background:"#131313",borderLeft:"1px solid rgba(255,255,255,0.08)",display:"flex",flexDirection:"column",zIndex:9999,boxShadow:"-8px 0 32px rgba(0,0,0,0.5)",color:"#e5e2e1",fontFamily:"Inter, system-ui, sans-serif"},children:[o.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid rgba(255,255,255,0.06)",display:"flex",alignItems:"center",gap:12,flexShrink:0,background:"#1c1b1b"},children:[o.jsx("span",{style:{fontWeight:600,fontSize:14},children:"Composer Logs"}),o.jsx("span",{style:{fontSize:11,color:"#9a9a9a"},children:n?`flowId: ${n}`:"no flow selected"}),o.jsxs("label",{style:{fontSize:11,color:"#9a9a9a",display:"flex",alignItems:"center",gap:4,cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",checked:m,onChange:F=>g(F.target.checked),disabled:!n}),"仅显示当前 flow"]}),o.jsx("button",{type:"button",onClick:j,style:{background:"rgba(124,77,255,0.15)",color:"#e8deff",border:"none",borderRadius:4,padding:"4px 10px",fontSize:12,cursor:"pointer"},children:"Refresh"}),o.jsx("span",{style:{flex:1}}),o.jsx("button",{type:"button",onClick:t,style:{background:"transparent",color:"#e5e2e1",border:"1px solid rgba(255,255,255,0.12)",borderRadius:4,padding:"4px 12px",fontSize:12,cursor:"pointer"},children:"Close"})]}),o.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden",minHeight:0},children:[o.jsxs("div",{style:{width:280,borderRight:"1px solid rgba(255,255,255,0.06)",overflowY:"auto",background:"#0e0e0e",flexShrink:0},children:[i&&o.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:"Loading…"}),!i&&r.length===0&&o.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:m&&n?"no sessions for this flow":"no sessions"}),r.map(F=>{const z=l===F.sessionId;return o.jsxs("div",{onClick:()=>c(F.sessionId),style:{padding:"10px 12px",borderBottom:"1px solid rgba(255,255,255,0.04)",cursor:"pointer",background:z?"rgba(124,77,255,0.18)":"transparent",borderLeft:z?"3px solid #7c4dff":"3px solid transparent"},children:[o.jsx("div",{style:{fontSize:12,fontWeight:600,color:"#e5e2e1"},children:UK(F.mtime)}),o.jsx("div",{style:{fontSize:11,color:"#9ecaff",marginTop:2,fontFamily:"monospace"},children:F.flowId||"(no flow)"}),F.promptPreview&&o.jsx("div",{style:{fontSize:11,color:"#9a9a9a",marginTop:4,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:F.promptPreview}),o.jsxs("div",{style:{fontSize:10,color:"#6a6a6a",marginTop:4},children:[WK(F.size)," · ",F.model||"default"]})]},F.sessionId)})]}),o.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minHeight:0},children:[o.jsxs("div",{style:{padding:"10px 16px",borderBottom:"1px solid rgba(255,255,255,0.06)",display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",flexShrink:0,background:"#1c1b1b"},children:[Object.keys(LT).map(F=>o.jsxs("button",{type:"button",onClick:()=>v(z=>({...z,[F]:!z[F]})),style:{background:b[F]?"rgba(124,77,255,0.25)":"transparent",color:b[F]?"#e8deff":"#6a6a6a",border:`1px solid ${b[F]?"rgba(124,77,255,0.4)":"rgba(255,255,255,0.08)"}`,borderRadius:999,padding:"3px 12px",fontSize:11,cursor:"pointer",fontFamily:"monospace",textTransform:"uppercase"},children:[F," ",$[F]!=null?`(${$[F]})`:""]},F)),o.jsx("input",{type:"text",placeholder:"search…",value:y,onChange:F=>k(F.target.value),style:{marginLeft:8,flex:1,minWidth:120,background:"#0e0e0e",border:"1px solid rgba(255,255,255,0.08)",borderRadius:4,color:"#e5e2e1",padding:"4px 8px",fontSize:12}})]}),o.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12,minHeight:0},children:[!l&&o.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20,textAlign:"center"},children:"Select a session on the left to view events"}),u&&!d&&o.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:"Loading…"}),d&&C.length===0&&o.jsxs("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:["No events match current filter (",((B=d.events)==null?void 0:B.length)||0," total)"]}),C.map((F,z)=>o.jsx(KK,{event:F,defaultExpanded:F.tag==="error"},`${F.ts}_${z}`))]})]})]})]}):null}const YK="0.1.55";function Hj(e){const t=Math.max(0,Number(e)||0),n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4),s=Math.floor(t%6e4/1e3);return`${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}:${String(s).padStart(2,"0")}`}function vx(e,t){return t==="running"?Hj(e):e==null||!Number.isFinite(e)||e<=0?"--":Hj(e)}const OT=h.createContext({modelLists:{cursor:[],opencode:[]},onModelChange:()=>{}});function GK(e){var k,w,j,A,C,$,B,F,z,L,O;const{setNodes:t}=ac(),n=Yv(),{modelLists:r,onModelChange:s}=h.useContext(OT),i=h.useRef(null),a=!!((k=e.data)!=null&&k.readOnly),l=(w=e.data)!=null&&w.displaySize&&Number(e.data.displaySize.width)>0&&Number(e.data.displaySize.height)>0?{width:Number(e.data.displaySize.width),height:Number(e.data.displaySize.height)}:null,c=((j=e.data)==null?void 0:j.definitionId)==="agent_subAgent"&&!((A=e.data)!=null&&A.isRunMode)&&!a,d=h.useCallback(W=>{const M=()=>n(W);window.requestAnimationFrame(M),window.setTimeout(M,80)},[n]),f=h.useCallback((W,M)=>{const T=Xj(M);T&&(t(E=>E.map(D=>{var P,X,Z,V,ne,ue;if(D.id!==W)return D;const _=Number(((X=(P=D.data)==null?void 0:P.displaySize)==null?void 0:X.width)||D.width||((Z=D.measured)==null?void 0:Z.width)||0),R=Number(((ne=(V=D.data)==null?void 0:V.displaySize)==null?void 0:ne.height)||D.height||((ue=D.measured)==null?void 0:ue.height)||0);return Math.abs(_-T.width)<2&&Math.abs(R-T.height)<2?D:{...D,width:T.width,height:T.height,data:{...D.data,displaySize:T}}})),d(W))},[d,t]),u=h.useCallback(W=>{if(a)return;const M=i.current;if(!M)return;const T=M.getBoundingClientRect();f(W,{width:Math.max(T.width,M.scrollWidth),height:Math.max(T.height,M.scrollHeight)})},[f,a]),p=h.useCallback(W=>{var ne,ue,pe,ge,ae,be;if(!c)return;W.preventDefault(),W.stopPropagation();const M=i.current,T=M==null?void 0:M.getBoundingClientRect(),E=Number(((ue=(ne=e.data)==null?void 0:ne.displaySize)==null?void 0:ue.width)||e.width||((pe=e.measured)==null?void 0:pe.width)||(T==null?void 0:T.width)||FT),D=Number(((ae=(ge=e.data)==null?void 0:ge.displaySize)==null?void 0:ae.height)||e.height||((be=e.measured)==null?void 0:be.height)||(T==null?void 0:T.height)||vb),_=W.clientX,R=W.clientY,P=e.id;let X=0;const Z=Ae=>{const we=Xj({width:E+Ae.clientX-_,height:D+Ae.clientY-R});we&&(window.cancelAnimationFrame(X),X=window.requestAnimationFrame(()=>f(P,we)))},V=()=>{window.cancelAnimationFrame(X),window.removeEventListener("pointermove",Z),window.removeEventListener("pointerup",V),window.removeEventListener("pointercancel",V),d(P)};window.addEventListener("pointermove",Z),window.addEventListener("pointerup",V,{once:!0}),window.addEventListener("pointercancel",V,{once:!0})},[f,($=(C=e.data)==null?void 0:C.displaySize)==null?void 0:$.height,(F=(B=e.data)==null?void 0:B.displaySize)==null?void 0:F.width,e.height,e.id,(z=e.measured)==null?void 0:z.height,(L=e.measured)==null?void 0:L.width,e.width,d,c]),m=h.useCallback(W=>{t(M=>M.filter(T=>T.id!==W))},[t]),g=h.useCallback(()=>{var E,D,_,R,P,X,Z,V;const W=((E=e.data)==null?void 0:E.definitionId)||"",M=((D=e.data)==null?void 0:D.label)||e.id,T=((P=(R=(_=e.data)==null?void 0:_.outputs)==null?void 0:R[0])==null?void 0:P.value)||((V=(Z=(X=e.data)==null?void 0:X.outputs)==null?void 0:Z[0])==null?void 0:V.default)||"";window.__provideEditContent={instanceId:e.id,label:M,definitionId:W,content:T},window.dispatchEvent(new CustomEvent("provide-expand"))},[e.id,e.data]),b=h.useCallback((W,M)=>{t(T=>T.map(E=>{var _;if(E.id!==W)return E;const D=Array.isArray((_=E.data)==null?void 0:_.outputs)&&E.data.outputs.length?E.data.outputs.map((R,P)=>P===0?{...R,default:M,value:M}:R):[{type:"bool",name:"value",default:M,value:M}];return{...E,data:{...E.data,body:"",outputs:D}}}))},[t]),v=h.useCallback((W,M)=>{t(T=>T.map(E=>E.id===W?{...E,data:{...E.data,body:M}}:E))},[t]),y=h.useCallback((W,M)=>{t(T=>T.map(E=>E.id===W?{...E,data:{...E.data,images:ks(M)}}:E))},[t]);return o.jsxs("div",{ref:i,className:"af-flow-node-shell"+(c?" af-flow-node-shell--resizable":""),style:l?{width:l.width,height:l.height}:void 0,children:[o.jsx(ST,{...e,data:{...e.data,onNodeContentResize:u},deleteNode:m,onProvideExpand:g,onProvideValueChange:b,onNodeBodyChange:v,onNodeImagesChange:y,modelLists:r,onModelChange:s}),c?o.jsx("span",{className:"af-flow-node-shell__resize-grip nodrag","aria-label":((O=e.data)==null?void 0:O.resizeLabel)||"Resize node",role:"separator",onPointerDown:p}):null]})}const XK={[pp]:GK},Hd=["CONTROL","TOOL","PROVIDE","AGENT"],JK=1200,Wj="af-flow-node--sync-flash",Vj="af-flow-edge--sync-flash";function Uj(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).includes(t)?n:`${n} ${t}`:t}function Kj(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).filter(r=>r&&r!==t).join(" "):""}function x0(e){const t=((e==null?void 0:e.id)??"").trim();return/^control/i.test(t)?"CONTROL":/^tool/i.test(t)?"TOOL":/^provide/i.test(t)?"PROVIDE":"AGENT"}function QK(e){const t=x0(e);return t==="CONTROL"?"control":t==="PROVIDE"?"provide":t==="TOOL"?"tool":"agent"}function vh(e){return(Array.isArray(e)?e:[]).map(n=>{const r=String((n==null?void 0:n.name)||(n==null?void 0:n.id)||"").trim(),s=String((n==null?void 0:n.type)||"").trim();return!r&&!s?"":s?`${r||"-"}: ${s}`:r}).filter(Boolean)}function MT(e){return String((e==null?void 0:e.label)||"").trim()||String((e==null?void 0:e.id)||"").trim()}function $T(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function kx(e,t){const n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim(),r=String((e==null?void 0:e.type)||"").trim();return n||r||`#${t+1}`}function qj(e,t,n){const r=String((t==null?void 0:t.name)||(t==null?void 0:t.id)||`#${n+1}`).trim(),s=String((t==null?void 0:t.type)||"").trim(),i=String((t==null?void 0:t.default)??(t==null?void 0:t.value)??"").trim();return[e,r,s?`type: ${s}`:"",i?`default: ${i}`:""].filter(Boolean).join(" · ")}function Yj(e,t){const n=Array.isArray(e)?e:[],r=n.slice(0,4),s=Math.max(0,n.length-r.length);return{list:n,shown:r,hidden:s,kind:t}}function ZK(e){return e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function e7(e,t){return t?[e==null?void 0:e.id,e==null?void 0:e.label,e==null?void 0:e.description].filter(Boolean).some(r=>String(r).toLowerCase().includes(t)):!0}function DT(e,t,n,r,s){const i=QK(e),a={id:t,type:pp,position:n,data:{label:e.label??e.id,definitionId:e.id,schemaType:i,inputs:Array.isArray(e.inputs)?e.inputs.map(l=>({...l})):[],outputs:Array.isArray(e.outputs)?e.outputs.map(l=>({...l})):[]}};return Uf(a,r,s)}const FT=320,t7=220,n7=1600,vb=104,r7=900;function Gj(e,t,n){const r=Number(e);return!Number.isFinite(r)||r<=0?0:Math.min(n,Math.max(t,Math.round(r)))}function Xj(e){if(!e||typeof e!="object")return null;const t=Number(e.width),n=Number(e.height);return!Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0?null:{width:Gj(t,t7,n7)||FT,height:Gj(n,vb,r7)||vb}}function s7(e){const t=(e==null?void 0:e.data)||{},n=r=>(Array.isArray(r)?r:[]).map((s,i)=>(s==null?void 0:s.showOnNode)===!1?"":[i,String((s==null?void 0:s.type)||""),String((s==null?void 0:s.name)||""),s!=null&&s.required?"1":"0"].join(":")).filter(Boolean).join("|");return`${n(t.inputs)}=>${n(t.outputs)}`}function Jj(e,t){const n=String((e==null?void 0:e.source)||""),r=String((e==null?void 0:e.target)||"");if(!n||!r)return!1;const s=new Map(t.map(d=>[d.id,d])),i=s.get(n),a=s.get(r),l=Ou(i,e.sourceHandle||"output-0","source"),c=Ou(a,e.targetHandle||"input-0","target");return!l||!c?!1:Lu(l,c)}function i7(e,t){const n=String((e==null?void 0:e.nodeId)||""),r=String((e==null?void 0:e.handleId)||""),s=(e==null?void 0:e.handleType)==="target"?"target":(e==null?void 0:e.handleType)==="source"?"source":"";if(!n||!r||!s)return null;const i=t.find(l=>l.id===n),a=Ou(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:kT(a)}:null}function o7(e,t,n){var a;const r=DT(e,`__candidate_${e.id}`,{x:0,y:0},{},t),s=n.handleType==="source"?"inputs":"outputs",i=Array.isArray((a=r.data)==null?void 0:a[s])?r.data[s]:[];for(let l=0;l<i.length;l+=1){const c=i[l];if(n.handleType==="source"?Lu(n.slot,c):Lu(c,n.slot))return{slot:c,slotIndex:l,hydrated:r}}return null}function a7(e,t){return t?e.map((n,r)=>{const s=o7(n,e,t);if(!s)return null;const i=x0(n);return{def:n,order:r,category:i,categoryRank:Hd.indexOf(i),slot:s.slot,slotIndex:s.slotIndex,displayLabel:MT(s.hydrated.data||n),description:$T(n)}}).filter(Boolean).sort((n,r)=>{var a,l;const s=(a=n.slot)!=null&&a.required?0:1,i=(l=r.slot)!=null&&l.required?0:1;return s-i||n.slotIndex-r.slotIndex||n.categoryRank-r.categoryRank||n.order-r.order}):[]}const l7=/@([a-zA-Z_][a-zA-Z0-9_]*)/g;function c7(e){const t=new Set,n=[];let r;const s=new RegExp(l7.source,"g");for(;(r=s.exec(e))!==null;){const i=r[1];t.has(i)||(t.add(i),n.push(i))}return n}function Qj(e,t){const n=e.slice(0,t),r=n.lastIndexOf("@");if(r<0)return null;const s=n.slice(r+1);return/[\s\n]/.test(s)?null:{atIndex:r,query:s}}function Vo(e){const t=String(e||"").indexOf(" - ");return t>=0?e.slice(0,t).trim():String(e||"").trim()}function kh(e,t,n,r){const s=(e||"").trim();if(!s)return"";if(s.startsWith("opencode:")||s.startsWith("claude-code:"))return s;const i=Array.isArray(t)?t:[],a=Array.isArray(n)?n:[],l=Array.isArray(r)?r:[],c=i.map(Vo),d=a.map(Vo);return l.map(Vo).includes(s)&&!c.includes(s)&&!d.includes(s)?`claude-code:${s}`:d.includes(s)&&!c.includes(s)?`opencode:${s}`:s}function u7(e){if(e==null)return"";const t=String(e).trim();return t?t.length<=26?t:`${t.slice(0,12)}…${t.slice(-10)}`:""}function Sx(e){if(!Array.isArray(e)||e.length===0)return 0;let t=0;for(const n of e){const r=/^(?:对话|Conversation|Chat)\s*(\d+)\s*$/.exec(String((n==null?void 0:n.label)??"").trim());r&&(t=Math.max(t,parseInt(r[1],10)))}return t}function d7({steps:e}){const{t}=Pn();return!e||e.length===0?null:o.jsx("div",{className:"af-composer-steps-track",role:"list","aria-label":t("flow:composer.stepsAriaLabel"),children:e.map(n=>{const r=String(n.description||n.type||"").trim(),s=n.model||n.executorModel,i=[`${n.index+1}. ${r||"—"}`,n.nodeRole?t("flow:composer.stepRoleLabel",{role:n.nodeRole}):"",n.instanceId?t("flow:composer.stepInstanceLabel",{instanceId:n.instanceId}):"",s?`${t("flow:palette.model")}:${s}`:""].filter(Boolean).join(`
128
+ `}}),o.jsx("textarea",{ref:p,className:"af-body-prompt-textarea "+i,rows:s,value:e,disabled:n,placeholder:r,spellCheck:!1,"aria-invalid":C,"aria-describedby":C?u:void 0,onChange:E=>{t(E.target.value),b(E.target.selectionStart??E.target.value.length)},onSelect:E=>{const D=E.target;D instanceof HTMLTextAreaElement&&b(D.selectionStart??0)},onClick:E=>{const D=E.target;D instanceof HTMLTextAreaElement&&b(D.selectionStart??0)},onKeyUp:E=>{const D=E.target;D instanceof HTMLTextAreaElement&&b(D.selectionStart??D.value.length)},onKeyDown:M,onPaste:E=>{const D=yT(E);D.length!==0&&(E.preventDefault(),T(D).catch(()=>{}))},onDragOver:E=>{Gm(E).length>0&&E.preventDefault()},onDrop:E=>{const D=Gm(E);D.length!==0&&(E.preventDefault(),T(D).catch(()=>{}))},onScroll:W})]}),F&&z.length>0&&k?$r.createPortal(o.jsx("ul",{className:"af-body-ph-menu af-body-ph-menu--pop af-composer-mention-menu",role:"listbox","aria-label":f("flow:nodeProps.placeholderSlots"),style:{position:"fixed",top:k.top,left:k.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:z.map((E,D)=>o.jsx("li",{role:"option","aria-selected":D===v,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(D===v?" af-composer-mention-item--active":""),onMouseDown:_=>_.preventDefault(),onMouseEnter:()=>y(D),onClick:()=>O(E.insert),children:[o.jsx("span",{className:"af-composer-mention-id",children:`\${${E.insert}}`}),E.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:E.subtitle}):null]})},`${E.section}-${E.insert}`))}),document.body):null,C?o.jsx("p",{id:u,className:"af-body-ph-issues",role:"status",children:A.map(E=>E.message).join(" · ")}):null]})}const AT=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function bh(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function Rj({kind:e,label:t,slots:n,onSlotsChange:r,disabled:s,requiredReadonly:i=!0}){const{t:a}=Pn(),l=()=>r([...n,{type:"text",name:"",default:"",required:!1,showOnNode:!1}]),c=u=>r(n.filter((p,m)=>m!==u)),d=(u,p,m)=>{const g=n.map((b,v)=>{if(v!==u)return b;const y={...b,[p]:m};return p==="required"&&m===!0&&(y.showOnNode=!0),y});r(g)},f=e==="input"?"input":"output";return o.jsxs("div",{className:"af-node-props-field af-node-props-field--io",children:[o.jsxs("div",{className:"af-node-props-io-head",children:[o.jsx("span",{className:"af-node-props-label",children:t}),o.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-io-add",onClick:l,disabled:s,"aria-label":a("flow:nodeProps.addPinAriaLabel",{label:t}),children:a("flow:nodeProps.addPin")})]}),o.jsx("p",{className:"af-node-props-io-hint",children:a("flow:nodeProps.handleHint",{prefix:f})}),n.length===0?o.jsx("p",{className:"af-node-props-io-empty",children:a(e==="input"?"flow:nodeProps.noInputPins":"flow:nodeProps.noOutputPins")}):null,n.length>0?o.jsxs("div",{className:"af-node-props-io-table",role:"group","aria-label":t,children:[o.jsxs("div",{className:"af-node-props-io-table-head","aria-hidden":!0,children:[o.jsx("span",{children:a("flow:nodeProps.handle")}),o.jsx("span",{children:a("flow:nodeProps.type")}),o.jsx("span",{children:a("flow:nodeProps.name")}),o.jsx("span",{children:a("flow:nodeProps.defaultValue")}),o.jsx("span",{children:a("flow:nodeProps.required")}),o.jsx("span",{children:a("flow:nodeProps.showOnNode")}),o.jsx("span",{})]}),n.map((u,p)=>o.jsxs("div",{className:"af-node-props-io-row",children:[o.jsxs("span",{className:"af-node-props-io-handle",title:`${f}-${p}`,children:[f,"-",p]}),o.jsx("select",{className:"af-node-props-input af-node-props-io-cell",value:u.type,onChange:m=>d(p,"type",m.target.value),disabled:s,"aria-label":a("flow:nodeProps.pinTypeAriaLabel",{label:t,index:p}),children:["node","text","file","bool"].map(m=>o.jsx("option",{value:m,children:m},m))}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:u.name,onChange:m=>d(p,"name",m.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinNameAriaLabel",{label:t,index:p})}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:u.default,onChange:m=>d(p,"default",m.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinDefaultAriaLabel",{label:t,index:p})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.requiredHint"),children:o.jsx("input",{type:"checkbox",checked:!!u.required,onChange:m=>{i||d(p,"required",m.target.checked)},disabled:s||i,"aria-label":a("flow:nodeProps.pinRequiredAriaLabel",{label:t,index:p})})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.showOnNodeHint"),children:o.jsx("input",{type:"checkbox",checked:u.showOnNode!==!1,onChange:m=>d(p,"showOnNode",m.target.checked),disabled:s,"aria-label":a("flow:nodeProps.pinShowOnNodeAriaLabel",{label:t,index:p})})}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-io-remove",onClick:()=>c(p),disabled:s,"aria-label":a("flow:nodeProps.deletePinAriaLabel",{label:t,index:p}),title:a("flow:nodeProps.deletePin"),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},`${f}-${p}`))]}):null]})}function IT({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:s,disabled:i,onIdBlur:a,onClose:l,onPublishToMarketplace:c,allowEditRequiredPins:d=!1,error:f,ioSlots:u}){const{t:p}=Pn(),[m,g]=h.useState(!1),[b,v]=h.useState(!1),[y,k]=h.useState({status:"idle",message:""}),w=h.useCallback(O=>{t(W=>W&&{...W,...O})},[t]),{cursorList:j,opencodeList:A,claudeCodeList:C,currentNotInLists:$}=h.useMemo(()=>{const O=Array.isArray(s==null?void 0:s.cursor)?s.cursor:[],W=Array.isArray(s==null?void 0:s.opencode)?s.opencode:[],M=Array.isArray(s==null?void 0:s.claudeCode)?s.claudeCode:[],T=new Set([...O,...W,...M].map(bh)),E=((e==null?void 0:e.model)??"").trim(),D=E.startsWith("cursor:")?E.slice(7):E.startsWith("opencode:")?E.slice(9):E.startsWith("claude-code:")?E.slice(12):E,_=E&&!T.has(D)?E:"";return{cursorList:O,opencodeList:W,claudeCodeList:M,currentNotInLists:_}},[s,e==null?void 0:e.model]);if(!e)return null;const B=String(e.script??""),F=n==="tool_nodejs"||B.trim()!=="",z=typeof c=="function"&&!i&&(e==null?void 0:e.newId),L=async()=>{if(z){k({status:"running",message:p("flow:nodeProps.publishRunning")});try{const O=await c(e,n);k({status:"success",message:O!=null&&O.definitionId?p("flow:nodeProps.publishSuccessWithId",{id:O.definitionId}):p("flow:nodeProps.publishSuccess")})}catch(O){k({status:"error",message:String((O==null?void 0:O.message)||O)})}}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-pipeline-drawer-head af-node-props-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:p("flow:nodeProps.title")}),o.jsxs("div",{className:"af-node-props-head-actions",children:[o.jsxs("button",{type:"button",className:"af-btn-ghost af-node-props-market-btn",onClick:L,disabled:!z||y.status==="running",title:p("flow:nodeProps.publishToMarketplaceHint"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"inventory_2"}),y.status==="running"?p("flow:nodeProps.publishing"):p("flow:nodeProps.publishToMarketplace")]}),o.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-close-secondary",onClick:l,children:p("common:common.close")})]})]}),o.jsxs("div",{className:"af-pipeline-drawer-body af-node-props-body",children:[f?o.jsx("p",{className:"af-err af-node-props-err",children:f}):null,y.message?o.jsx("p",{className:`af-node-props-market-status af-node-props-market-status--${y.status}`,children:y.message}):null,o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:p("flow:node.nodeType")}),o.jsx("div",{className:"af-pipeline-drawer-readonly af-node-props-readonly-mono",children:n})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:nodeProps.instanceId"),o.jsx("span",{className:"af-node-props-hint",children:p("flow:node.displayNameHint")})]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.newId,onChange:O=>w({newId:O.target.value}),onBlur:a,disabled:i,spellCheck:!1,autoComplete:"off","aria-label":p("flow:nodeProps.instanceId")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.displayName"),"(LABEL)"]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.label,onChange:O=>w({label:O.target.value}),disabled:i,spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.role"),"(ROLE)"]}),o.jsx("select",{className:"af-node-props-select",value:nl.includes(e.role)?e.role:p("flow:roles.normal"),onChange:O=>w({role:O.target.value}),disabled:i,children:nl.map(O=>o.jsx("option",{value:O,children:O},O))})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.model"),"(MODEL)"]}),o.jsx("span",{className:"af-node-props-sublabel",children:p("flow:node.modelHint")}),o.jsxs("select",{className:"af-node-props-select",value:(()=>{const O=(e.model||"").trim();return O?$||O:""})(),onChange:O=>w({model:O.target.value}),disabled:i,"aria-label":p("flow:nodeProps.modelAriaLabel"),children:[o.jsx("option",{value:"",children:p("flow:node.defaultModel")}),$?o.jsxs("option",{value:$,children:[$,p("flow:nodeProps.yamlValueNotInList")]}):null,j.length>0?o.jsx("optgroup",{label:"Cursor",children:j.map(O=>o.jsx("option",{value:bh(O),children:O},`c-${O}`))}):null,A.length>0?o.jsx("optgroup",{label:"OpenCode",children:A.map(O=>o.jsx("option",{value:bh(O),children:O},`o-${O}`))}):null,C.length>0?o.jsx("optgroup",{label:"Claude Code",children:C.map(O=>o.jsx("option",{value:`claude-code:${bh(O)}`,children:O},`cc-${O}`))}):null]})]}),o.jsx(Rj,{kind:"input",label:p("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:O=>w({inputs:O}),disabled:i,requiredReadonly:!d}),o.jsx(Rj,{kind:"output",label:p("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:O=>w({outputs:O}),disabled:i,requiredReadonly:!d}),F?o.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[o.jsxs("div",{className:"af-node-props-prompt-head",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.directCommand"),"(script)",o.jsx("span",{className:"af-node-props-hint",children:p("flow:node.scriptHint")})]}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>v(!0),"aria-label":p("flow:nodeProps.expandEditScript"),title:p("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(wh,{value:B,onChange:O=>w({script:O}),disabled:i,placeholder:p("flow:nodeProps.scriptPlaceholder"),rows:6,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea af-node-props-script-textarea",ioSlots:u,variant:"drawer"})]}):null,o.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[o.jsxs("div",{className:"af-node-props-prompt-head",children:[o.jsx("span",{className:"af-node-props-label",children:p("flow:node.userPrompt")}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>g(!0),"aria-label":p("flow:nodeProps.expandEdit"),title:p("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(wh,{value:e.body,onChange:O=>w({body:O}),images:e.images,onImagesChange:O=>w({images:O}),disabled:i,placeholder:p("flow:nodeProps.bodyPlaceholder"),rows:8,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea",ioSlots:u,variant:"drawer"})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:p("flow:node.systemDescription")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-node-props-system-readonly",rows:4,readOnly:!0,value:r||p("flow:nodeProps.noDescription"),spellCheck:!1})]})]}),b?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editScript"),onMouseDown:O=>{O.target===O.currentTarget&&v(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:p("flow:node.directCommand")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>v(!1),"aria-label":p("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx(wh,{value:B,onChange:O=>w({script:O}),disabled:i,placeholder:p("flow:nodeProps.scriptPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:u,variant:"expand"})]})}):null,m?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editUserPrompt"),onMouseDown:O=>{O.target===O.currentTarget&&g(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:p("flow:node.body")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>g(!1),"aria-label":p("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx(wh,{value:e.body,onChange:O=>w({body:O}),images:e.images,onImagesChange:O=>w({images:O}),disabled:i,placeholder:p("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:u,variant:"expand"})]})}):null]})}function y0(e){var n;if(e.displayKind==="image"||e.encoding==="base64"&&((n=e.mimeType)!=null&&n.startsWith("image/")))return"image";if(e.displayKind==="json"||e.mimeType==="application/json")return"json";if(e.displayKind==="markdown"||e.mimeType==="text/markdown")return"markdown";if(e.displayKind==="text")return"text";const t=(e.content||"").trim();if(t&&(t.startsWith("{")||t.startsWith("[")))try{return JSON.parse(t),"json"}catch{}return"text"}function LK(e){const t=y0(e);if(t==="image"){const n=(e.mimeType||"image/png").split("/")[1];return n?n.toUpperCase():"IMAGE"}return t==="json"?"JSON":t==="markdown"?"MD":null}function TT(e){try{return JSON.stringify(JSON.parse(e.trim()),null,2)}catch{return e}}function Lj({text:e}){const{t}=Pn(),n=e||"";return n.trim()?o.jsx("div",{className:"af-run-ctx-md",children:o.jsx(dp,{children:n})}):o.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}function Oj({o:e}){var r;const{t}=Pn(),n=y0(e);if(n==="image"||e.encoding==="base64"&&((r=e.mimeType)!=null&&r.startsWith("image/"))){const i=`data:${e.mimeType||"image/png"};base64,${e.content||""}`;return o.jsxs("div",{className:"af-run-ctx-media",children:[o.jsx("img",{className:"af-run-ctx-img",src:i,alt:e.slot||"output",loading:"lazy"}),e.truncated?o.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.imageTruncated")}):null]})}if(n==="json")return o.jsx("pre",{className:"af-run-ctx-pre",children:TT(e.content||"")});if(n==="markdown"){const s=e.content||"";return s.trim()?o.jsx("div",{className:"af-run-ctx-md",children:o.jsx(dp,{children:s})}):o.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}return o.jsx("pre",{className:"af-run-ctx-pre",children:e.content!=null&&e.content!==""?e.content:t("flow:runContext.empty")})}function Mj(e){return LK(e)}function $j(e){var r;if(!e)return null;const t=y0(e);if(t==="image"||e.encoding==="base64"&&((r=e.mimeType)!=null&&r.startsWith("image/")))return null;const n=e.content;return n==null||n===""?null:t==="json"?TT(String(n)):String(n)}function Dj({text:e,title:t,copiedLabel:n}){const[r,s]=h.useState(!1);if(!e)return null;const i=async()=>{try{await navigator.clipboard.writeText(e),s(!0),window.setTimeout(()=>s(!1),1400)}catch{}};return o.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-copy-btn",onClick:i,title:r?n:t,"aria-label":r?n:t,children:o.jsx("span",{className:"material-symbols-outlined",children:r?"check":"content_copy"})})}const Fj=2e4,RT="af:run-node-ctx-width";function Jh(){return typeof window>"u"?416:Math.min(26*16,window.innerWidth-32)}function Da(e){const n=Math.max(280,Math.min(Math.floor(window.innerWidth*.92),1200));return Number.isFinite(e)?Math.min(Math.max(Math.round(e),200),n):Da(Jh())}function OK(){try{const e=localStorage.getItem(RT);if(e==null)return Da(Jh());const t=parseInt(e,10);return Number.isFinite(t)?Da(t):Da(Jh())}catch{return Da(Jh())}}async function zj(e,t,n,r){const s=new URLSearchParams({flowId:e,instanceId:t});n&&String(n).trim()&&s.set("runId",String(n).trim());const i=await fetch(`/api/node-exec-context?${s.toString()}`,{signal:r}),a=await i.text();let l;try{l=JSON.parse(a)}catch{throw new Error(a.startsWith("<!")||a.startsWith("<html")?"apiConnectError":"invalidJson")}if(!i.ok)throw new Error(l.error||"HTTP "+i.status);return l}function MK(e,t){const n=`flow:runContext.${t}`,r=e(n);return r!==n?r:t}function $K({instanceId:e,flowId:t,runId:n,nodeStatus:r,onClose:s}){const{t:i}=Pn(),[a,l]=h.useState(()=>typeof window<"u"&&window.matchMedia("(max-width: 960px)").matches),[c,d]=h.useState(OK),f=h.useRef({active:!1,pointerId:-1,startX:0,startW:416}),[u,p]=h.useState(!0),[m,g]=h.useState(""),[b,v]=h.useState([]),[y,k]=h.useState(null),[w,j]=h.useState(null),A=h.useRef(null),C=h.useRef(null),$=h.useRef(0),B=h.useRef(0);h.useLayoutEffect(()=>{const _=window.matchMedia("(max-width: 960px)"),R=()=>l(_.matches);return _.addEventListener("change",R),()=>_.removeEventListener("change",R)},[]),h.useEffect(()=>{function _(){d(R=>Da(R))}return window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[]);const F=h.useCallback(()=>{d(_=>{const R=Da(_);try{localStorage.setItem(RT,String(R))}catch{}return R})},[]),z=h.useCallback(_=>{if(a||_.button!==0)return;_.preventDefault();const R=_.currentTarget;f.current={active:!0,pointerId:_.pointerId,startX:_.clientX,startW:c},R.setPointerCapture(_.pointerId)},[a,c]),L=h.useCallback(_=>{const R=f.current;if(!R.active||_.pointerId!==R.pointerId)return;const P=R.startX-_.clientX;d(Da(R.startW+P))},[]),O=h.useCallback(_=>{const R=f.current;if(!(!R.active||_.pointerId!==R.pointerId)){R.active=!1;try{_.currentTarget.releasePointerCapture(_.pointerId)}catch{}F()}},[F]),W=h.useCallback(()=>{const _=f.current;_.active&&(_.active=!1,F())},[F]),M=h.useCallback(_=>{const R=Array.isArray(_)?_:[];v(R),k(P=>P&&R.some(X=>X.execId===P)?P:R.length>0?R[R.length-1].execId:null)},[]),T=h.useCallback(()=>{if(!e||!t)return;const _=++$.current,R=new AbortController,P=window.setTimeout(()=>R.abort(),Fj);(async()=>{try{const X=await zj(t,e,n,R.signal);if(_!==$.current)return;M(Array.isArray(X.rounds)?X.rounds:[])}catch{}finally{window.clearTimeout(P)}})()},[e,t,n,M]);h.useEffect(()=>{if(!e||!t){p(!1),g(""),v([]);return}const _=++B.current;p(!0),g(""),v([]),k(null);const R=new AbortController,P=window.setTimeout(()=>R.abort(),Fj);return(async()=>{try{const X=await zj(t,e,n,R.signal);if(_!==B.current)return;M(Array.isArray(X.rounds)?X.rounds:[])}catch(X){if(_!==B.current)return;const Z=(X==null?void 0:X.name)==="AbortError"?"requestTimeout":X.message||String(X);g(Z)}finally{window.clearTimeout(P),_===B.current&&p(!1)}})(),()=>{R.abort(),B.current++,$.current++}},[e,t,n,M]),h.useEffect(()=>{r&&T()},[r,T]),h.useEffect(()=>{clearInterval(C.current);const _=b.length>0?b[b.length-1]:null;return(r==="running"&&b.length===0||!!(_&&_.status==="running"))&&e&&t&&(C.current=setInterval(()=>T(),2e3)),()=>clearInterval(C.current)},[b,e,t,n,r,T]),h.useEffect(()=>{A.current&&(A.current.scrollTop=0)},[y]);const E=b.find(_=>_.execId===y),D=a?void 0:{width:`${c}px`};return o.jsxs("aside",{className:"af-run-ctx-panel",style:D,"aria-label":i("flow:runContext.title"),children:[a?null:o.jsx("div",{className:"af-run-ctx-resize",role:"separator","aria-orientation":"vertical","aria-label":i("flow:runContext.resizeHandle"),onPointerDown:z,onPointerMove:L,onPointerUp:O,onPointerCancel:O,onLostPointerCapture:W}),o.jsxs("div",{className:"af-run-ctx-panel__main",children:[o.jsxs("div",{className:"af-run-ctx-head",children:[o.jsx("h2",{className:"af-run-ctx-title",title:e,children:e}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:s,"aria-label":i("common:common.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),u&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i("common:common.loading")}),m&&o.jsx("div",{className:"af-run-ctx-error",children:MK(i,m)}),!u&&!m&&b.length===0&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i(r==="running"?"flow:runContext.executingNoArtifacts":"flow:runContext.noData")}),b.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-run-ctx-rounds af-run-ctx-rounds--select af-run-ctx-round--"+FK((E==null?void 0:E.status)||""),children:[o.jsx("span",{className:"af-run-ctx-round-dot","aria-hidden":!0}),o.jsx("select",{className:"af-run-ctx-round-select",value:String(y??""),onChange:_=>{const R=_.target.value;k(R==="latest"?"latest":Number(R))},children:[...b].reverse().map(_=>{const R=_.execId==="latest"?i("flow:runContext.latest"):`#${_.execId}`,P=zK(i,_.status),X=_.finishedAt?` · ${DK(_.finishedAt)}`:"";return o.jsx("option",{value:String(_.execId),children:`${R} · ${P}${X}`},_.execId)})})]}),E&&o.jsxs("div",{className:"af-run-ctx-body",ref:A,children:[E.inputs&&E.inputs.length>0&&o.jsxs("section",{className:"af-run-ctx-section",children:[o.jsxs("h3",{className:"af-run-ctx-section-title",children:[o.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"input"}),"Inputs"]}),E.inputs.map((_,R)=>o.jsxs("div",{className:"af-run-ctx-output-slot",children:[o.jsx("div",{className:"af-run-ctx-slot-head",children:o.jsx("div",{className:"af-run-ctx-slot-name",children:_.slot})}),o.jsx("pre",{className:"af-run-ctx-slot-text",children:_.value})]},`${_.slot}-${R}`))]}),E.prompt!=null&&o.jsxs("section",{className:"af-run-ctx-section",children:[o.jsxs("h3",{className:"af-run-ctx-section-title",children:[o.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"description"}),"Prompt",o.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>j("prompt"),title:i("flow:nodeProps.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(Lj,{text:E.prompt})]}),E.outputs&&E.outputs.length>0&&o.jsxs("section",{className:"af-run-ctx-section",children:[o.jsxs("h3",{className:"af-run-ctx-section-title",children:[o.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"output"}),"Outputs",o.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>j("output"),title:i("flow:nodeProps.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),E.outputs.map((_,R)=>{const P=Mj(_),X=$j(_);return o.jsxs("div",{className:"af-run-ctx-output-slot",children:[o.jsxs("div",{className:"af-run-ctx-slot-head",children:[o.jsx("div",{className:"af-run-ctx-slot-name",children:_.slot}),P?o.jsx("span",{className:"af-run-ctx-format-badge",title:i("flow:runContext.detectedContentType"),children:P}):null,o.jsx(Dj,{text:X,title:i("common:common.copy"),copiedLabel:i("common:common.copied")})]}),o.jsx(Oj,{o:_})]},`${_.slot}-${R}`)})]}),!E.prompt&&(!E.outputs||E.outputs.length===0)&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i("flow:runContext.roundNoContent")})]})]})]}),w&&E&&o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true",onClick:_=>{_.target===_.currentTarget&&j(null)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:w==="prompt"?"Prompt":"Outputs"}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>j(null),"aria-label":i("common:common.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-node-props-expand-body af-run-ctx-expand-body",children:[w==="prompt"&&E.prompt!=null&&o.jsx(Lj,{text:E.prompt}),w==="output"&&E.outputs&&E.outputs.map((_,R)=>{const P=Mj(_),X=$j(_);return o.jsxs("div",{className:"af-run-ctx-output-slot",style:{marginBottom:"1rem"},children:[o.jsxs("div",{className:"af-run-ctx-slot-head",children:[o.jsx("div",{className:"af-run-ctx-slot-name",children:_.slot}),P?o.jsx("span",{className:"af-run-ctx-format-badge",children:P}):null,o.jsx(Dj,{text:X,title:i("common:common.copy"),copiedLabel:i("common:common.copied")})]}),o.jsx(Oj,{o:_})]},`${_.slot}-${R}`)})]})]})})]})}function DK(e){try{const t=new Date(e);if(isNaN(t.getTime()))return e;const n=r=>String(r).padStart(2,"0");return`${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}catch{return e}}function FK(e){const t=String(e||"").toLowerCase();return t==="success"||t==="completed"||t==="done"?"success":t==="failed"||t==="error"?"failed":t==="running"||t==="executing"?"running":t==="cache_not_met"?"cache":t?"unknown":"pending"}function zK(e,t){const n=String(t||"").toLowerCase();return n?n==="success"||n==="completed"||n==="done"?e("flow:runContext.statusSuccess",{defaultValue:"成功"}):n==="failed"||n==="error"?e("flow:runContext.statusFailed",{defaultValue:"失败"}):n==="running"||n==="executing"?e("flow:runContext.statusRunning",{defaultValue:"运行中"}):n==="cache_not_met"?e("flow:runContext.statusCacheMiss",{defaultValue:"缓存失效"}):t:e("flow:runContext.statusPending",{defaultValue:"等待"})}function BK({flowId:e,flowSource:t,flowArchived:n,provideNodes:r,edges:s,nodes:i,onCliInputsChange:a,onBackToEdit:l}){const{t:c}=Pn(),[d,f]=h.useState({}),[u,p]=h.useState(null),[m,g]=h.useState({}),[b,v]=h.useState(!0),[y,k]=h.useState(!1),[w,j]=h.useState(""),[A,C]=h.useState(!1),[$,B]=h.useState(null),F=h.useRef(null),z=h.useRef(!0),L=h.useRef({});h.useMemo(()=>{var P,X,Z;const R={};for(const V of r){const ne=(Z=(X=(P=V.data)==null?void 0:P.outputs)==null?void 0:X[0])==null?void 0:Z.default;ne!=null&&ne!==""&&(R[V.id]=String(ne))}return L.current=R,R},[r]);const O=h.useMemo(()=>{var P;const R={};for(const X of i){if(!((P=X.data)!=null&&P.inputs))continue;const Z=X.data.inputs;for(let V=0;V<Z.length;V++){const ne=Z[V];if(!(ne!=null&&ne.name))continue;const ue=s.find(ge=>ge.target===X.id&&ge.targetHandle===`input-${V}`);if(!(ue!=null&&ue.source))continue;r.find(ge=>ge.id===ue.source)&&(R[ue.source]=ne.name)}}return R},[i,s,r]);h.useEffect(()=>(z.current=!0,()=>{z.current=!1}),[]),h.useEffect(()=>{if(!e){v(!1);return}v(!0);const R=new URLSearchParams({flowId:e,flowSource:t||"user"});n&&R.set("archived","1"),fetch(`/api/flow/run-config?${R.toString()}`).then(P=>{if(!P.ok)throw new Error(`HTTP ${P.status}`);return P.json()}).then(P=>{var Z;if(!z.current)return;f(P.presets||{}),p(P.activePreset||null);const X=P.activePreset&&((Z=P.presets)!=null&&Z[P.activePreset])?P.presets[P.activePreset]:{};g({...L.current,...X}),v(!1)}).catch(()=>{z.current&&(g(L.current),v(!1))})},[e,t,n]),h.useEffect(()=>{var P;if(!a)return;const R={};for(const[X,Z]of Object.entries(m)){const V=O[X];if(!V)continue;const ne=r.find(pe=>pe.id===X);if(!ne)continue;(((P=ne.data)==null?void 0:P.definitionId)||"").startsWith("provide_file")?R[V]={type:"file",path:Z}:R[V]={type:"str",value:Z}}a(R)},[m,O,r,a]);const W=h.useCallback((R,P)=>{g(X=>({...X,[R]:P}))},[]),M=h.useCallback(R=>{R!==u&&(p(R),R&&d[R]?g({...L.current,...d[R]}):g(L.current))},[u,d]),T=h.useCallback(async()=>{if(w.trim()){k(!0);try{const R={...d,[w.trim()]:m},P={flowId:e,flowSource:t,archived:n,presets:R,activePreset:w.trim()};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})).ok&&(f(R),p(w.trim()),j(""),C(!1))}finally{k(!1)}}},[e,t,n,d,m,w]),E=h.useCallback(async()=>{if(u){k(!0);try{const R={...d};delete R[u];const P=Object.keys(R)[0]||null;(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:e,flowSource:t,archived:n,presets:R,activePreset:P})})).ok&&(f(R),p(P),P&&R[P]?g({...L.current,...R[P]}):g(L.current))}finally{k(!1)}}},[e,t,n,d,u]),D=h.useCallback(async()=>{if(u){k(!0);try{const R={...d,[u]:m};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:e,flowSource:t,archived:n,presets:R,activePreset:u})})).ok&&f(R)}finally{k(!1)}}},[e,t,n,d,u,m]),_=Object.keys(d);return _.length>0,b?o.jsx("aside",{className:"af-run-config-panel",children:o.jsx("div",{className:"af-run-config-loading",children:c("common.loading")})}):o.jsxs("aside",{className:"af-run-config-panel",children:[o.jsxs("div",{className:"af-run-config-preset",children:[o.jsx("label",{className:"af-run-config-preset-label",children:c("flow:runConfig.preset")}),o.jsxs("div",{className:"af-run-config-preset-row",children:[o.jsxs("select",{className:"af-run-config-preset-select",value:u||"",onChange:R=>M(R.target.value||null),disabled:y,children:[o.jsx("option",{value:"",children:c("flow:runConfig.default")}),_.map(R=>o.jsx("option",{value:R,children:R},R))]}),o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--new",onClick:()=>C(!0),disabled:y,title:c("flow:runConfig.newPreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),u&&o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--save",onClick:D,disabled:y,title:c("flow:runConfig.savePreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"})}),u&&o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--delete",onClick:E,disabled:y,title:c("flow:runConfig.deletePreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"})})]})]}),A&&o.jsxs("div",{className:"af-run-config-save-dialog",children:[o.jsx("input",{type:"text",className:"af-run-config-save-input",placeholder:c("flow:runConfig.presetNamePlaceholder"),value:w,onChange:R=>j(R.target.value),disabled:y}),o.jsxs("div",{className:"af-run-config-save-actions",children:[o.jsx("button",{type:"button",className:"af-btn-primary",onClick:T,disabled:y||!w.trim(),children:c(y?"common.saving":"common.save")}),o.jsx("button",{type:"button",className:"af-btn-outline",onClick:()=>{C(!1),j("")},disabled:y,children:c("common.cancel")})]})]}),o.jsxs("div",{className:"af-run-config-inputs",children:[o.jsx("div",{className:"af-run-config-inputs-header",children:c("flow:runConfig.inputParams")}),r.length===0?o.jsx("div",{className:"af-run-config-empty",children:c("flow:runConfig.noProvideNodes")}):o.jsx("div",{className:"af-run-config-input-list",children:r.map(R=>{var ge,ae;const P=((ge=R.data)==null?void 0:ge.definitionId)||"",X=P.startsWith("provide_file"),Z=P==="provide_bool",V=((ae=R.data)==null?void 0:ae.label)||R.id,ne=R.id,ue=m[ne]||"",pe=["true","1","yes","on"].includes(String(ue).trim().toLowerCase());return o.jsxs("div",{className:"af-run-config-input-item",children:[o.jsxs("div",{className:"af-run-config-input-head",children:[o.jsx("span",{className:"af-run-config-input-icon material-symbols-outlined"+(X?" af-run-config-input-icon--file":""),"aria-hidden":!0,children:X?"description":Z?"toggle_on":"text_fields"}),o.jsx("span",{className:"af-run-config-input-label",children:V}),Z?null:o.jsx("button",{type:"button",className:"af-run-config-input-expand",onClick:()=>B({instanceId:ne,label:V,content:ue}),"aria-label":c("flow:runConfig.expandInput"),title:c("flow:runConfig.expandInput"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx("div",{className:"af-run-config-input-id",children:ne}),Z?o.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(pe?" af-run-config-bool-toggle--true":""),onClick:()=>W(ne,pe?"false":"true"),"aria-pressed":pe,children:pe?"true":"false"}):o.jsx("input",{type:"text",className:"af-run-config-input-field",value:ue,onChange:be=>W(ne,be.target.value),placeholder:c(X?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},ne)})})]}),$&&$r.createPortal(o.jsx("div",{className:"af-provide-edit-overlay",children:o.jsxs("div",{className:"af-provide-edit-modal",role:"dialog","aria-modal":"true",children:[o.jsxs("div",{className:"af-provide-edit-modal__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit_document"}),o.jsx("span",{className:"af-provide-edit-modal__title",children:$.label}),o.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>B(null),"aria-label":c("common:close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("div",{className:"af-provide-edit-modal__body",children:o.jsx("textarea",{ref:F,className:"af-provide-edit-modal__textarea",defaultValue:$.content,autoFocus:!0})}),o.jsxs("div",{className:"af-provide-edit-modal__foot",children:[o.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn af-provide-edit-modal__btn--save",onClick:()=>{!$||!F.current||(W($.instanceId,F.current.value),B(null))},children:[o.jsx("span",{className:"material-symbols-outlined",children:"save"}),c("flow:provideEdit.save")]}),o.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn",onClick:()=>B(null),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),c("flow:provideEdit.cancel")]})]})]})}),document.body)]})}const LT={ai:["planner-system","planner-user","planner-response","agent-step-prompt","repair-prompt","ai-thinking","ai-assistant","ai-result","ai-tool"],flow:["composer-start","classify","plan","phase-plan","phase-complete","phase-auto-continue","composer-done"],step:["step-start","step-progress","step-done","validation"],output:["natural","status"],error:["error"]},HK={"planner-system":"#9ecaff","planner-user":"#9ecaff","planner-response":"#7c4dff","agent-step-prompt":"#7c4dff","repair-prompt":"#ff6b6b","ai-thinking":"#a8b9d4","ai-assistant":"#e8deff","ai-result":"#00e475","ai-tool":"#9ecaff","composer-start":"#00e475","composer-done":"#00e475","step-start":"#e8deff","step-done":"#e8deff","step-progress":"#e8deff",natural:"#a8a8a8",status:"#a8a8a8",error:"#ff6b6b","phase-plan":"#00e475","phase-complete":"#00e475"};function WK(e){return!e||e<1024?`${e||0} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function VK(e){if(!e)return"";const t=new Date(e);return isNaN(t.getTime())?e:`${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}:${t.getSeconds().toString().padStart(2,"0")}.${t.getMilliseconds().toString().padStart(3,"0")}`}function UK(e){if(!e)return"";const t=new Date(e);return isNaN(t.getTime())?e:`${t.getMonth()+1}/${t.getDate()} ${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}`}function Bj(e,t){if(e==="natural"&&t&&typeof t=="object"){const n=t.kind;if(n==="thinking"||n==="assistant"||n==="result"||n==="tool")return"ai";if(n==="error")return"error"}for(const[n,r]of Object.entries(LT))if(r.includes(e))return n;return"other"}function KK({event:e,defaultExpanded:t}){const[n,r]=h.useState(!!t),s=HK[e.tag]||"#a8a8a8",i=e.payload,a=i&&typeof i=="object",l=a?typeof i.text=="string"?i.text:"":String(i||""),c=a?i.meta:null,d=h.useMemo(()=>l?l.slice(0,140).replace(/\s+/g," "):a?Object.keys(i).filter(m=>m!=="text"&&m!=="meta").slice(0,3).map(m=>{const g=i[m];return g==null?`${m}:null`:typeof g=="object"?`${m}:{…}`:`${m}:${String(g).slice(0,30)}`}).join(" "):"",[i,l,a]),f=h.useCallback(u=>{u.stopPropagation();const p=a?JSON.stringify(i,null,2):String(i);try{navigator.clipboard.writeText(p)}catch{}},[i,a]);return o.jsxs("div",{style:{borderLeft:`3px solid ${s}`,background:n?"#1c1b1b":"#131313",marginBottom:4,borderRadius:4,cursor:"pointer",transition:"background 120ms"},onClick:()=>r(u=>!u),children:[o.jsxs("div",{style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:10,fontSize:12},children:[o.jsx("span",{style:{color:"#9a9a9a",fontFamily:"monospace",flexShrink:0},children:VK(e.ts)}),o.jsx("span",{style:{color:s,fontWeight:600,fontFamily:"monospace",flexShrink:0,padding:"1px 6px",background:"rgba(255,255,255,0.04)",borderRadius:3},children:e.tag}),o.jsx("span",{style:{color:"#c5c2c1",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"monospace"},children:d}),n&&o.jsx("button",{type:"button",onClick:f,style:{background:"rgba(124,77,255,0.15)",color:"#e8deff",border:"none",borderRadius:3,padding:"2px 8px",fontSize:11,cursor:"pointer"},children:"Copy"})]}),n&&o.jsxs("div",{style:{padding:"0 10px 10px 10px",borderTop:"1px solid rgba(255,255,255,0.04)"},children:[c&&Object.keys(c).length>0&&o.jsx("div",{style:{marginTop:8,padding:8,background:"#0e0e0e",borderRadius:4,fontSize:11,fontFamily:"monospace",color:"#9ecaff",whiteSpace:"pre-wrap",wordBreak:"break-all"},children:JSON.stringify(c,null,2)}),l?o.jsx("pre",{style:{marginTop:8,padding:10,background:"#0e0e0e",borderRadius:4,fontSize:12,color:"#e5e2e1",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:600,overflowY:"auto",margin:"8px 0 0 0",fontFamily:"ui-monospace, SF Mono, Menlo, monospace"},children:l}):a?o.jsx("pre",{style:{marginTop:8,padding:10,background:"#0e0e0e",borderRadius:4,fontSize:12,color:"#e5e2e1",whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:400,overflowY:"auto",margin:"8px 0 0 0",fontFamily:"ui-monospace, SF Mono, Menlo, monospace"},children:JSON.stringify(i,null,2)}):null]})]})}function qK({open:e,onClose:t,flowId:n}){var B;const[r,s]=h.useState([]),[i,a]=h.useState(!1),[l,c]=h.useState(null),[d,f]=h.useState(null),[u,p]=h.useState(!1),[m,g]=h.useState(!0),[b,v]=h.useState({ai:!0,flow:!0,step:!0,output:!0,error:!0}),[y,k]=h.useState(""),w=h.useRef(null),j=h.useCallback(async()=>{a(!0);try{const F=m&&n?`?flowId=${encodeURIComponent(n)}`:"",L=await(await fetch(`/api/composer-logs${F}`)).json();s(Array.isArray(L.sessions)?L.sessions:[])}catch{s([])}finally{a(!1)}},[n,m]),A=h.useCallback(async F=>{if(!F){f(null);return}p(!0);try{const L=await(await fetch(`/api/composer-logs/${encodeURIComponent(F)}`)).json();f(L)}catch{f(null)}finally{p(!1)}},[]);h.useEffect(()=>{e&&j()},[e,j]),h.useEffect(()=>{if(!(!e||!l))return A(l),w.current=setInterval(()=>A(l),2e3),()=>{w.current&&clearInterval(w.current),w.current=null}},[e,l,A]);const C=h.useMemo(()=>{const F=(d==null?void 0:d.events)||[],z=y.trim().toLowerCase();return F.filter(L=>{const O=Bj(L.tag,L.payload);return!b[O]&&O!=="other"?!1:z?[L.tag,JSON.stringify(L.payload||"")].join(" ").toLowerCase().includes(z):!0})},[d,b,y]),$=h.useMemo(()=>{const F=(d==null?void 0:d.events)||[],z={};for(const L of F){const O=Bj(L.tag,L.payload);z[O]=(z[O]||0)+1}return z},[d]);return e?o.jsxs("div",{style:{position:"fixed",top:0,right:0,bottom:0,width:"min(1100px, 80vw)",background:"#131313",borderLeft:"1px solid rgba(255,255,255,0.08)",display:"flex",flexDirection:"column",zIndex:9999,boxShadow:"-8px 0 32px rgba(0,0,0,0.5)",color:"#e5e2e1",fontFamily:"Inter, system-ui, sans-serif"},children:[o.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid rgba(255,255,255,0.06)",display:"flex",alignItems:"center",gap:12,flexShrink:0,background:"#1c1b1b"},children:[o.jsx("span",{style:{fontWeight:600,fontSize:14},children:"Composer Logs"}),o.jsx("span",{style:{fontSize:11,color:"#9a9a9a"},children:n?`flowId: ${n}`:"no flow selected"}),o.jsxs("label",{style:{fontSize:11,color:"#9a9a9a",display:"flex",alignItems:"center",gap:4,cursor:"pointer"},children:[o.jsx("input",{type:"checkbox",checked:m,onChange:F=>g(F.target.checked),disabled:!n}),"仅显示当前 flow"]}),o.jsx("button",{type:"button",onClick:j,style:{background:"rgba(124,77,255,0.15)",color:"#e8deff",border:"none",borderRadius:4,padding:"4px 10px",fontSize:12,cursor:"pointer"},children:"Refresh"}),o.jsx("span",{style:{flex:1}}),o.jsx("button",{type:"button",onClick:t,style:{background:"transparent",color:"#e5e2e1",border:"1px solid rgba(255,255,255,0.12)",borderRadius:4,padding:"4px 12px",fontSize:12,cursor:"pointer"},children:"Close"})]}),o.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden",minHeight:0},children:[o.jsxs("div",{style:{width:280,borderRight:"1px solid rgba(255,255,255,0.06)",overflowY:"auto",background:"#0e0e0e",flexShrink:0},children:[i&&o.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:"Loading…"}),!i&&r.length===0&&o.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:m&&n?"no sessions for this flow":"no sessions"}),r.map(F=>{const z=l===F.sessionId;return o.jsxs("div",{onClick:()=>c(F.sessionId),style:{padding:"10px 12px",borderBottom:"1px solid rgba(255,255,255,0.04)",cursor:"pointer",background:z?"rgba(124,77,255,0.18)":"transparent",borderLeft:z?"3px solid #7c4dff":"3px solid transparent"},children:[o.jsx("div",{style:{fontSize:12,fontWeight:600,color:"#e5e2e1"},children:UK(F.mtime)}),o.jsx("div",{style:{fontSize:11,color:"#9ecaff",marginTop:2,fontFamily:"monospace"},children:F.flowId||"(no flow)"}),F.promptPreview&&o.jsx("div",{style:{fontSize:11,color:"#9a9a9a",marginTop:4,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:F.promptPreview}),o.jsxs("div",{style:{fontSize:10,color:"#6a6a6a",marginTop:4},children:[WK(F.size)," · ",F.model||"default"]})]},F.sessionId)})]}),o.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minHeight:0},children:[o.jsxs("div",{style:{padding:"10px 16px",borderBottom:"1px solid rgba(255,255,255,0.06)",display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",flexShrink:0,background:"#1c1b1b"},children:[Object.keys(LT).map(F=>o.jsxs("button",{type:"button",onClick:()=>v(z=>({...z,[F]:!z[F]})),style:{background:b[F]?"rgba(124,77,255,0.25)":"transparent",color:b[F]?"#e8deff":"#6a6a6a",border:`1px solid ${b[F]?"rgba(124,77,255,0.4)":"rgba(255,255,255,0.08)"}`,borderRadius:999,padding:"3px 12px",fontSize:11,cursor:"pointer",fontFamily:"monospace",textTransform:"uppercase"},children:[F," ",$[F]!=null?`(${$[F]})`:""]},F)),o.jsx("input",{type:"text",placeholder:"search…",value:y,onChange:F=>k(F.target.value),style:{marginLeft:8,flex:1,minWidth:120,background:"#0e0e0e",border:"1px solid rgba(255,255,255,0.08)",borderRadius:4,color:"#e5e2e1",padding:"4px 8px",fontSize:12}})]}),o.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12,minHeight:0},children:[!l&&o.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20,textAlign:"center"},children:"Select a session on the left to view events"}),u&&!d&&o.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:"Loading…"}),d&&C.length===0&&o.jsxs("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:["No events match current filter (",((B=d.events)==null?void 0:B.length)||0," total)"]}),C.map((F,z)=>o.jsx(KK,{event:F,defaultExpanded:F.tag==="error"},`${F.ts}_${z}`))]})]})]})]}):null}const YK="0.1.57";function Hj(e){const t=Math.max(0,Number(e)||0),n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4),s=Math.floor(t%6e4/1e3);return`${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}:${String(s).padStart(2,"0")}`}function vx(e,t){return t==="running"?Hj(e):e==null||!Number.isFinite(e)||e<=0?"--":Hj(e)}const OT=h.createContext({modelLists:{cursor:[],opencode:[]},onModelChange:()=>{}});function GK(e){var k,w,j,A,C,$,B,F,z,L,O;const{setNodes:t}=ac(),n=Yv(),{modelLists:r,onModelChange:s}=h.useContext(OT),i=h.useRef(null),a=!!((k=e.data)!=null&&k.readOnly),l=(w=e.data)!=null&&w.displaySize&&Number(e.data.displaySize.width)>0&&Number(e.data.displaySize.height)>0?{width:Number(e.data.displaySize.width),height:Number(e.data.displaySize.height)}:null,c=((j=e.data)==null?void 0:j.definitionId)==="agent_subAgent"&&!((A=e.data)!=null&&A.isRunMode)&&!a,d=h.useCallback(W=>{const M=()=>n(W);window.requestAnimationFrame(M),window.setTimeout(M,80)},[n]),f=h.useCallback((W,M)=>{const T=Xj(M);T&&(t(E=>E.map(D=>{var P,X,Z,V,ne,ue;if(D.id!==W)return D;const _=Number(((X=(P=D.data)==null?void 0:P.displaySize)==null?void 0:X.width)||D.width||((Z=D.measured)==null?void 0:Z.width)||0),R=Number(((ne=(V=D.data)==null?void 0:V.displaySize)==null?void 0:ne.height)||D.height||((ue=D.measured)==null?void 0:ue.height)||0);return Math.abs(_-T.width)<2&&Math.abs(R-T.height)<2?D:{...D,width:T.width,height:T.height,data:{...D.data,displaySize:T}}})),d(W))},[d,t]),u=h.useCallback(W=>{if(a)return;const M=i.current;if(!M)return;const T=M.getBoundingClientRect();f(W,{width:Math.max(T.width,M.scrollWidth),height:Math.max(T.height,M.scrollHeight)})},[f,a]),p=h.useCallback(W=>{var ne,ue,pe,ge,ae,be;if(!c)return;W.preventDefault(),W.stopPropagation();const M=i.current,T=M==null?void 0:M.getBoundingClientRect(),E=Number(((ue=(ne=e.data)==null?void 0:ne.displaySize)==null?void 0:ue.width)||e.width||((pe=e.measured)==null?void 0:pe.width)||(T==null?void 0:T.width)||FT),D=Number(((ae=(ge=e.data)==null?void 0:ge.displaySize)==null?void 0:ae.height)||e.height||((be=e.measured)==null?void 0:be.height)||(T==null?void 0:T.height)||vb),_=W.clientX,R=W.clientY,P=e.id;let X=0;const Z=Ae=>{const we=Xj({width:E+Ae.clientX-_,height:D+Ae.clientY-R});we&&(window.cancelAnimationFrame(X),X=window.requestAnimationFrame(()=>f(P,we)))},V=()=>{window.cancelAnimationFrame(X),window.removeEventListener("pointermove",Z),window.removeEventListener("pointerup",V),window.removeEventListener("pointercancel",V),d(P)};window.addEventListener("pointermove",Z),window.addEventListener("pointerup",V,{once:!0}),window.addEventListener("pointercancel",V,{once:!0})},[f,($=(C=e.data)==null?void 0:C.displaySize)==null?void 0:$.height,(F=(B=e.data)==null?void 0:B.displaySize)==null?void 0:F.width,e.height,e.id,(z=e.measured)==null?void 0:z.height,(L=e.measured)==null?void 0:L.width,e.width,d,c]),m=h.useCallback(W=>{t(M=>M.filter(T=>T.id!==W))},[t]),g=h.useCallback(()=>{var E,D,_,R,P,X,Z,V;const W=((E=e.data)==null?void 0:E.definitionId)||"",M=((D=e.data)==null?void 0:D.label)||e.id,T=((P=(R=(_=e.data)==null?void 0:_.outputs)==null?void 0:R[0])==null?void 0:P.value)||((V=(Z=(X=e.data)==null?void 0:X.outputs)==null?void 0:Z[0])==null?void 0:V.default)||"";window.__provideEditContent={instanceId:e.id,label:M,definitionId:W,content:T},window.dispatchEvent(new CustomEvent("provide-expand"))},[e.id,e.data]),b=h.useCallback((W,M)=>{t(T=>T.map(E=>{var _;if(E.id!==W)return E;const D=Array.isArray((_=E.data)==null?void 0:_.outputs)&&E.data.outputs.length?E.data.outputs.map((R,P)=>P===0?{...R,default:M,value:M}:R):[{type:"bool",name:"value",default:M,value:M}];return{...E,data:{...E.data,body:"",outputs:D}}}))},[t]),v=h.useCallback((W,M)=>{t(T=>T.map(E=>E.id===W?{...E,data:{...E.data,body:M}}:E))},[t]),y=h.useCallback((W,M)=>{t(T=>T.map(E=>E.id===W?{...E,data:{...E.data,images:ks(M)}}:E))},[t]);return o.jsxs("div",{ref:i,className:"af-flow-node-shell"+(c?" af-flow-node-shell--resizable":""),style:l?{width:l.width,height:l.height}:void 0,children:[o.jsx(ST,{...e,data:{...e.data,onNodeContentResize:u},deleteNode:m,onProvideExpand:g,onProvideValueChange:b,onNodeBodyChange:v,onNodeImagesChange:y,modelLists:r,onModelChange:s}),c?o.jsx("span",{className:"af-flow-node-shell__resize-grip nodrag","aria-label":((O=e.data)==null?void 0:O.resizeLabel)||"Resize node",role:"separator",onPointerDown:p}):null]})}const XK={[pp]:GK},Hd=["CONTROL","TOOL","PROVIDE","AGENT"],JK=1200,Wj="af-flow-node--sync-flash",Vj="af-flow-edge--sync-flash";function Uj(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).includes(t)?n:`${n} ${t}`:t}function Kj(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).filter(r=>r&&r!==t).join(" "):""}function x0(e){const t=((e==null?void 0:e.id)??"").trim();return/^control/i.test(t)?"CONTROL":/^tool/i.test(t)?"TOOL":/^provide/i.test(t)?"PROVIDE":"AGENT"}function QK(e){const t=x0(e);return t==="CONTROL"?"control":t==="PROVIDE"?"provide":t==="TOOL"?"tool":"agent"}function vh(e){return(Array.isArray(e)?e:[]).map(n=>{const r=String((n==null?void 0:n.name)||(n==null?void 0:n.id)||"").trim(),s=String((n==null?void 0:n.type)||"").trim();return!r&&!s?"":s?`${r||"-"}: ${s}`:r}).filter(Boolean)}function MT(e){return String((e==null?void 0:e.label)||"").trim()||String((e==null?void 0:e.id)||"").trim()}function $T(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function kx(e,t){const n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim(),r=String((e==null?void 0:e.type)||"").trim();return n||r||`#${t+1}`}function qj(e,t,n){const r=String((t==null?void 0:t.name)||(t==null?void 0:t.id)||`#${n+1}`).trim(),s=String((t==null?void 0:t.type)||"").trim(),i=String((t==null?void 0:t.default)??(t==null?void 0:t.value)??"").trim();return[e,r,s?`type: ${s}`:"",i?`default: ${i}`:""].filter(Boolean).join(" · ")}function Yj(e,t){const n=Array.isArray(e)?e:[],r=n.slice(0,4),s=Math.max(0,n.length-r.length);return{list:n,shown:r,hidden:s,kind:t}}function ZK(e){return e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function e7(e,t){return t?[e==null?void 0:e.id,e==null?void 0:e.label,e==null?void 0:e.description].filter(Boolean).some(r=>String(r).toLowerCase().includes(t)):!0}function DT(e,t,n,r,s){const i=QK(e),a={id:t,type:pp,position:n,data:{label:e.label??e.id,definitionId:e.id,schemaType:i,inputs:Array.isArray(e.inputs)?e.inputs.map(l=>({...l})):[],outputs:Array.isArray(e.outputs)?e.outputs.map(l=>({...l})):[]}};return Uf(a,r,s)}const FT=320,t7=220,n7=1600,vb=104,r7=900;function Gj(e,t,n){const r=Number(e);return!Number.isFinite(r)||r<=0?0:Math.min(n,Math.max(t,Math.round(r)))}function Xj(e){if(!e||typeof e!="object")return null;const t=Number(e.width),n=Number(e.height);return!Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0?null:{width:Gj(t,t7,n7)||FT,height:Gj(n,vb,r7)||vb}}function s7(e){const t=(e==null?void 0:e.data)||{},n=r=>(Array.isArray(r)?r:[]).map((s,i)=>(s==null?void 0:s.showOnNode)===!1?"":[i,String((s==null?void 0:s.type)||""),String((s==null?void 0:s.name)||""),s!=null&&s.required?"1":"0"].join(":")).filter(Boolean).join("|");return`${n(t.inputs)}=>${n(t.outputs)}`}function Jj(e,t){const n=String((e==null?void 0:e.source)||""),r=String((e==null?void 0:e.target)||"");if(!n||!r)return!1;const s=new Map(t.map(d=>[d.id,d])),i=s.get(n),a=s.get(r),l=Ou(i,e.sourceHandle||"output-0","source"),c=Ou(a,e.targetHandle||"input-0","target");return!l||!c?!1:Lu(l,c)}function i7(e,t){const n=String((e==null?void 0:e.nodeId)||""),r=String((e==null?void 0:e.handleId)||""),s=(e==null?void 0:e.handleType)==="target"?"target":(e==null?void 0:e.handleType)==="source"?"source":"";if(!n||!r||!s)return null;const i=t.find(l=>l.id===n),a=Ou(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:kT(a)}:null}function o7(e,t,n){var a;const r=DT(e,`__candidate_${e.id}`,{x:0,y:0},{},t),s=n.handleType==="source"?"inputs":"outputs",i=Array.isArray((a=r.data)==null?void 0:a[s])?r.data[s]:[];for(let l=0;l<i.length;l+=1){const c=i[l];if(n.handleType==="source"?Lu(n.slot,c):Lu(c,n.slot))return{slot:c,slotIndex:l,hydrated:r}}return null}function a7(e,t){return t?e.map((n,r)=>{const s=o7(n,e,t);if(!s)return null;const i=x0(n);return{def:n,order:r,category:i,categoryRank:Hd.indexOf(i),slot:s.slot,slotIndex:s.slotIndex,displayLabel:MT(s.hydrated.data||n),description:$T(n)}}).filter(Boolean).sort((n,r)=>{var a,l;const s=(a=n.slot)!=null&&a.required?0:1,i=(l=r.slot)!=null&&l.required?0:1;return s-i||n.slotIndex-r.slotIndex||n.categoryRank-r.categoryRank||n.order-r.order}):[]}const l7=/@([a-zA-Z_][a-zA-Z0-9_]*)/g;function c7(e){const t=new Set,n=[];let r;const s=new RegExp(l7.source,"g");for(;(r=s.exec(e))!==null;){const i=r[1];t.has(i)||(t.add(i),n.push(i))}return n}function Qj(e,t){const n=e.slice(0,t),r=n.lastIndexOf("@");if(r<0)return null;const s=n.slice(r+1);return/[\s\n]/.test(s)?null:{atIndex:r,query:s}}function Vo(e){const t=String(e||"").indexOf(" - ");return t>=0?e.slice(0,t).trim():String(e||"").trim()}function kh(e,t,n,r){const s=(e||"").trim();if(!s)return"";if(s.startsWith("opencode:")||s.startsWith("claude-code:"))return s;const i=Array.isArray(t)?t:[],a=Array.isArray(n)?n:[],l=Array.isArray(r)?r:[],c=i.map(Vo),d=a.map(Vo);return l.map(Vo).includes(s)&&!c.includes(s)&&!d.includes(s)?`claude-code:${s}`:d.includes(s)&&!c.includes(s)?`opencode:${s}`:s}function u7(e){if(e==null)return"";const t=String(e).trim();return t?t.length<=26?t:`${t.slice(0,12)}…${t.slice(-10)}`:""}function Sx(e){if(!Array.isArray(e)||e.length===0)return 0;let t=0;for(const n of e){const r=/^(?:对话|Conversation|Chat)\s*(\d+)\s*$/.exec(String((n==null?void 0:n.label)??"").trim());r&&(t=Math.max(t,parseInt(r[1],10)))}return t}function d7({steps:e}){const{t}=Pn();return!e||e.length===0?null:o.jsx("div",{className:"af-composer-steps-track",role:"list","aria-label":t("flow:composer.stepsAriaLabel"),children:e.map(n=>{const r=String(n.description||n.type||"").trim(),s=n.model||n.executorModel,i=[`${n.index+1}. ${r||"—"}`,n.nodeRole?t("flow:composer.stepRoleLabel",{role:n.nodeRole}):"",n.instanceId?t("flow:composer.stepInstanceLabel",{instanceId:n.instanceId}):"",s?`${t("flow:palette.model")}:${s}`:""].filter(Boolean).join(`
129
129
  `),a=n.status||"pending";return o.jsxs("div",{className:"af-composer-step-chip"+(a==="done"?" af-composer-step-chip--done":"")+(a==="running"?" af-composer-step-chip--running":"")+(a==="error"?" af-composer-step-chip--error":"")+(a==="pending"?" af-composer-step-chip--pending":""),role:"listitem",title:i,children:[o.jsx("span",{className:"af-composer-step-chip-idx",children:n.index+1}),o.jsx("span",{className:"af-composer-step-chip-main",children:n.nodeRole||s?o.jsxs("span",{className:"af-composer-step-chip-meta",children:[n.nodeRole?o.jsx("span",{className:"af-composer-step-chip-role",children:n.nodeRole}):null,s?o.jsx("span",{className:"af-composer-step-chip-model",children:u7(s)}):null]}):null})]},n.index)})})}function f7(e,t){const n=e.trim(),r=t.trim();return r?n?!!(n===r||n.endsWith(r)||r.length>=8&&n.includes(r)):!1:!0}function p7(e){const t=[];for(const n of e){if(!n||typeof n.text!="string"||!n.text.trim())continue;const s=typeof n.kind=="string"&&n.kind?n.kind:"assistant",i=t[t.length-1];i&&i.kind===s?i.text+=s==="error"||s==="result"?`
130
130
  ${n.text}`:n.text:t.push({kind:s,text:n.text})}return t}function h7(e,t){return e==="thinking"?t("flow:composer.thinking"):e==="result"?t("flow:composer.result"):e==="assistant"?t("flow:composer.reply"):e==="error"?t("flow:composer.error"):String(e)}function m7(e){return e==="thinking"?"af-composer-ai-block af-composer-ai-block--thinking":e==="result"?"af-composer-ai-block af-composer-ai-block--result":e==="assistant"?"af-composer-ai-block af-composer-ai-block--reply":e==="error"?"af-composer-ai-block af-composer-ai-block--error":"af-composer-ai-block af-composer-ai-block--reply"}function Zj({thread:e,liveSegments:t,running:n,className:r="",autoScroll:s=!0}){const{t:i}=Pn(),a=h.useRef(null),l=["af-composer-ai-stack","af-composer-ai-stack--in-panel","af-composer-thread-stack",r].filter(Boolean).join(" ");return h.useEffect(()=>{if(!s||!a.current)return;const c=a.current;requestAnimationFrame(()=>{c.scrollTop=c.scrollHeight})},[e,t,s]),o.jsxs("div",{ref:a,className:l,children:[e.map((c,d)=>c.type==="user"?o.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--user-msg",children:[o.jsx("div",{className:"af-composer-ai-block-label",children:i("flow:composer.yourQuestion")}),o.jsx("div",{className:"af-composer-ai-block-body",children:c.text})]},`composer-u-${d}-${c.text.slice(0,48)}`):o.jsx("div",{className:"af-composer-thread-assistant",children:o.jsx(e1,{segments:c.segments,running:!1})},`composer-a-${d}`)),o.jsx("div",{className:"af-composer-thread-assistant",children:o.jsx(e1,{segments:t,running:n})})]})}function e1({segments:e,running:t=!1}){const{t:n}=Pn(),r=e.filter(u=>u.kind==="assistant").map(u=>u.text).join(""),s=e.filter(u=>u.kind==="result").map(u=>u.text).join(""),i=f7(r,s),a=e.filter(u=>u.kind==="error").map(u=>u.text).join(`
131
131
  `),l=e.filter(u=>u.kind!=="error"),c=i?l.filter(u=>u.kind!=="result"):l,d=p7(c),f=!!(d.length>0||a);return o.jsxs(o.Fragment,{children:[d.map((u,p)=>o.jsxs("section",{className:m7(u.kind),children:[o.jsx("div",{className:"af-composer-ai-block-label",children:h7(u.kind,n)}),o.jsx("div",{className:"af-composer-ai-block-body",children:u.text})]},`${u.kind}-${p}`)),t&&!f?o.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--reply af-composer-ai-block--pending",children:[o.jsx("div",{className:"af-composer-ai-block-label",children:n("flow:composer.reply")}),o.jsx("div",{className:"af-composer-ai-block-body",children:n("flow:composer.waiting")})]}):null,a?o.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--error",children:[o.jsx("div",{className:"af-composer-ai-block-label",children:n("flow:composer.error")}),o.jsx("div",{className:"af-composer-ai-block-body",children:a})]}):null]})}function g7({fitViewEpoch:e}){const{fitView:t}=ac(),n=h.useRef(t);return n.current=t,h.useEffect(()=>{if(e>0){const r=requestAnimationFrame(()=>n.current({padding:.2,duration:200,maxZoom:1}));return()=>cancelAnimationFrame(r)}},[e]),null}function y7({onReady:e}){const t=Yv();return h.useEffect(()=>(e(t),()=>e(null)),[e,t]),null}function t1(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}function n1(e){if(!e||typeof e!="object")return null;const t=Number(e.x),n=Number(e.y),r=Number(e.zoom);return!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)?null:{x:t,y:n,zoom:Math.min(Math.max(r,.1),4)}}const Qh=1500,r1=500,x7=262144,w7=2e3;function Nx(e){return typeof e!="string"?"":e.length<=w7?e:`[log line truncated, ${e.length} chars]`}const b7=Qh;function v7(e){const t=e.match(/^\[([^\]]+)\]\s+\[([^\]]+)\]\s+([\s\S]*)$/);if(!t)return null;const[,n,r,s]=t;if(r==="cli")try{const i=JSON.parse(s);return i&&i.event==="node-start"?{ts:n,type:"node-start",text:`节点 ${i.instanceId||""}${i.label?` · ${i.label}`:""} 开始`}:i&&i.event==="node-done"?{ts:n,type:"node-done",text:`节点 ${i.instanceId||""} 完成${i.elapsed?` (${i.elapsed})`:""}`}:i&&i.event==="node-failed"?{ts:n,type:"node-failed",text:`节点 ${i.instanceId||""} 失败${i.error?`: ${i.error}`:""}`}:i&&i.event==="apply-start"?{ts:n,type:"info",text:`[apply-start] uuid=${i.uuid||""}`}:{ts:n,type:"info",text:Nx(s)}}catch{return{ts:n,type:"info",text:Nx(s)}}return{ts:n,type:"log",text:Nx(`[${r}] ${s}`)}}function s1(e){if(!e)return[];const t=[],n=e.split(`
@@ -140,7 +140,7 @@ ${n.text}`:n.text:t.push({kind:s,text:n.text})}return t}function h7(e,t){return
140
140
  `);for(let l=0;l<a.length;l+=1){const c=a[l],d=a[l+1];if(i){c==='"'&&d==='"'?(s+='"',l+=1):c==='"'?i=!1:s+=c;continue}c==='"'?i=!0:c===t?(r.push(s.trim()),s=""):c===`
141
141
  `?(r.push(s.trim()),n.push(r),r=[],s=""):s+=c}return(s||r.length)&&(r.push(s.trim()),n.push(r)),n.filter(l=>l.some(c=>String(c||"").trim()))}function lo(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function q7(e){if(Array.isArray(e)){if(e.every(s=>s&&typeof s=="object"&&!Array.isArray(s))){const s=Array.from(new Set(e.flatMap(i=>Object.keys(i))));return{columns:s.map(i=>({key:i,label:i,align:"left"})),rows:e.map(i=>s.map(a=>lo(i[a])))}}if(e.every(Array.isArray)&&e.length>0){const s=e[0].map((i,a)=>lo(i)||`Column ${a+1}`);return{columns:s.map((i,a)=>({key:String(a),label:i,align:"left"})),rows:e.slice(1).map(i=>s.map((a,l)=>lo(i[l])))}}}if(!e||typeof e!="object")return null;const t=Array.isArray(e.columns)?e.columns:Array.isArray(e.headers)?e.headers:[],n=Array.isArray(e.rows)?e.rows:Array.isArray(e.data)?e.data:[];let r=t.map((s,i)=>s&&typeof s=="object"?{key:String(s.key||s.name||s.field||i),label:String(s.label||s.title||s.name||s.key||`Column ${i+1}`),align:["left","center","right"].includes(s.align)?s.align:"left"}:{key:String(i),label:lo(s)||`Column ${i+1}`,align:"left"});return r.length===0&&n.every(s=>s&&typeof s=="object"&&!Array.isArray(s))&&(r=Array.from(new Set(n.flatMap(s=>Object.keys(s)))).map(s=>({key:s,label:s,align:"left"}))),r.length===0&&n.every(Array.isArray)&&n.length>0?(r=n[0].map((s,i)=>({key:String(i),label:lo(s)||`Column ${i+1}`,align:"left"})),{columns:r,rows:n.slice(1).map(s=>r.map((i,a)=>lo(s[a])))}):{columns:r,rows:n.map(s=>Array.isArray(s)?r.map((i,a)=>lo(s[a])):s&&typeof s=="object"?r.map(i=>lo(s[i.key])):r.map((i,a)=>a===0?lo(s):""))}}function Y7(e){const t=String(e||"").trim();if(!t)return{columns:[],rows:[],error:""};const n=t.match(/^```(?:json|table|csv|tsv|markdown|md)?\s*\n?([\s\S]*?)```\s*$/i),r=n?n[1].trim():t;try{const l=q7(JSON.parse(r));if(l&&l.columns.length)return{...l,error:""}}catch{}const s=r.replace(/\r\n/g,`
142
142
  `).split(`
143
- `).filter(l=>l.trim());if(s.length>=2&&Go(s[0]).length>1&&BT(s[1])){const l=Go(s[0]),c=HT(s[1]);return{columns:l.map((d,f)=>({key:String(f),label:d,align:c[f]||"left"})),rows:s.slice(2).map(d=>Go(d)),error:""}}const i=r.includes(" ")?" ":",",a=K7(r,i);return a.length>0&&a[0].length>1?{columns:a[0].map((c,d)=>c||`Column ${d+1}`).map((c,d)=>({key:String(d),label:c,align:"left"})),rows:a.slice(1),error:""}:{columns:[],rows:[],error:"No table data detected"}}function b0({content:e}){const t=h.useMemo(()=>Y7(e),[e]);return t.error||t.columns.length===0?o.jsxs("div",{className:"af-work-display-table-empty",children:[o.jsx("strong",{children:"Table data error"}),o.jsx("span",{children:t.error||"No columns found"})]}):o.jsx("div",{className:"af-work-display-table-wrap af-work-display-table-wrap--standalone",children:o.jsxs("table",{className:"af-work-display-table",children:[o.jsx("thead",{children:o.jsx("tr",{children:t.columns.map((n,r)=>o.jsx("th",{style:{textAlign:n.align||"left"},children:n.label},`${n.key}-${r}`))})}),o.jsx("tbody",{children:t.rows.map((n,r)=>o.jsx("tr",{children:t.columns.map((s,i)=>o.jsx("td",{style:{textAlign:s.align||"left"},children:lo(n[i])},`${s.key}-${i}`))},r))})]})})}function v0({content:e}){const t=h.useRef(null),n=h.useMemo(()=>V7(e),[e]),[r,s]=h.useState({loading:!1,error:""});return h.useEffect(()=>{if(!n.ok){s({loading:!1,error:n.error||"Invalid chart spec"});return}let i=!1,a=null,l=null,c=null;return s({loading:!0,error:""}),I7(()=>import("./index-DgQRkS4v.js"),[]).then(d=>{i||!t.current||(a=d.init(t.current,"dark",{renderer:"canvas"}),a.setOption(n.spec.option,!0),c=()=>a==null?void 0:a.resize(),typeof ResizeObserver<"u"&&(l=new ResizeObserver(c),l.observe(t.current)),window.addEventListener("resize",c),window.requestAnimationFrame(c),i||s({loading:!1,error:""}))}).catch(d=>{i||s({loading:!1,error:String((d==null?void 0:d.message)||d)})}),()=>{var d,f;i=!0,c&&window.removeEventListener("resize",c),(d=l==null?void 0:l.disconnect)==null||d.call(l),(f=a==null?void 0:a.dispose)==null||f.call(a)}},[n]),!n.ok||r.error?o.jsxs("div",{className:"af-work-display-chart-error",children:[o.jsx("strong",{children:"Chart configuration error"}),o.jsx("span",{children:r.error||n.error})]}):o.jsxs("div",{className:"af-work-display-chart",children:[o.jsx("div",{ref:t,className:"af-work-display-chart__canvas"}),r.loading?o.jsx("div",{className:"af-work-display-chart__loading",children:"Loading chart..."}):null]})}const G7="af:workspace-graph:v2",Fc=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],X7=new Set(["control_start","control_end","control_load_skills","control_load_mcp"]),J7={id:"workspace_run",displayName:"Run",label:"Run",description:"Run the downstream workspace subgraph connected from this node.",type:"control",inputs:[{type:"node",name:"prev",default:""}],outputs:[{type:"node",name:"next",default:""}]},Q7={id:"control_load_skills",displayName:"Load Skills",label:"Load Skills",description:"Load the currently selected Workspace skill collection for downstream agent nodes.",type:"control",inputs:[{type:"node",name:"prev",default:""},{type:"text",name:"skillKeys",default:"",showOnNode:!1}],outputs:[{type:"node",name:"next",default:""},{type:"text",name:"skillsContext",default:"",showOnNode:!0}]},Z7={id:"control_load_mcp",displayName:"Load MCP",label:"Load MCP",description:"Load selected Cursor MCP server tool manifests for downstream agent nodes.",type:"control",inputs:[{type:"node",name:"prev",default:""},{type:"text",name:"serverNames",default:"",showOnNode:!1}],outputs:[{type:"node",name:"next",default:""},{type:"text",name:"mcpContext",default:"",showOnNode:!0}]},eq=new Set(["png","jpg","jpeg","gif","webp","svg"]),tq=320,VT=180,UT=960,Sb=96,KT=900,Nb="display-ref:",nq="0.1.55";function rq(){const e=new URLSearchParams(window.location.search);return{flowId:e.get("flowId")||"",flowSource:e.get("flowSource")||"user",archived:e.get("archived")==="1"||e.get("flowArchived")==="1"}}function Ia(e){const t=new URLSearchParams;return e.flowId&&t.set("flowId",e.flowId),e.flowSource&&t.set("flowSource",e.flowSource),e.archived&&t.set("archived","1"),t}function Zm(e){if(!e)return!1;const t=String(e.type||"");if(t&&/^image\//i.test(t))return!0;const n=String(e.name||"").toLowerCase().split(".").pop();return eq.has(n)}function eg(e,t){const n=String(e||"").trim();if(!n)return"";if(/^(?:https?:|data:|blob:|file:)/i.test(n)||n.startsWith("/"))return n;const r=Ia(t||{});return r.set("path",n),`/api/workspace/file/raw?${r.toString()}`}function sq(e,t){const n=String(e||"").trim();if(!n)return"";const r=Ia(t||{});return r.set("path",n),r.set("download","1"),`/api/workspace/file/raw?${r.toString()}`}function iq(e){const t=String((e==null?void 0:e.flowId)||"").trim();if(!t)return"";const n=String((e==null?void 0:e.flowSource)||"user").trim()||"user";return`af:composer-skills:workspace:${t}:${n}${e!=null&&e.archived?":archived":""}`}function oq(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function aq(e){var t;if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)return Number(e.selectionStart??0)!==Number(e.selectionEnd??0);if(e instanceof Element&&e.closest('[contenteditable="true"]')){const n=(t=window.getSelection)==null?void 0:t.call(window);return!!(n&&!n.isCollapsed)}return!1}function lq(e){return!e||typeof e.closest!="function"?!1:!!e.closest(".af-flow-node__prompt-stack")&&!aq(e)}function cq(e){const t=String(e||"").trim();if(!t)return"";if(/^思考中/.test(t))return"模型正在思考";if(/^生成回复中/.test(t))return"模型正在生成回复";if(/^Timing\s+(.+?):\s+(\d+)ms/i.test(t)){const n=t.match(/^Timing\s+(.+?):\s+(\d+)ms/i);return`耗时:${(n==null?void 0:n[1])||"step"} ${(n==null?void 0:n[2])||"0"}ms`}if(/^工具\s+(.+?)(?:\s+\((started|completed)\))?$/i.test(t)){const n=t.match(/^工具\s+(.+?)(?:\s+\((started|completed)\))?$/i),r=String((n==null?void 0:n[1])||"tool").trim(),s=String((n==null?void 0:n[2])||"").toLowerCase();if(r==="thinking")return"模型正在思考";const i=r==="readToolCall"?"读取文件/上下文":r==="grepToolCall"?"搜索代码":r==="editToolCall"?"编辑文件":r;return s==="completed"?`完成:${i}`:`执行:${i}`}return/^\[stderr\]/.test(t)?t:""}function c1(e){if(String((e==null?void 0:e.type)||"")!=="raw"||String((e==null?void 0:e.eventType)||"")!=="thinking")return"";const t=String((e==null?void 0:e.text)||"").trim();if(!t)return"";try{const n=JSON.parse(t);if((n==null?void 0:n.type)!=="thinking")return"";const r=String((n==null?void 0:n.subtype)||"");return r&&r!=="delta"?"":String((n==null?void 0:n.text)||(n==null?void 0:n.delta)||(n==null?void 0:n.thinking)||"").trim()}catch{return""}}function qT(e,t){const n=String(e||(t==null?void 0:t.id)||"").toLowerCase();return n.startsWith("control_")?"control":n.startsWith("provide_")?"provide":n.startsWith("tool_")?"agent":(t==null?void 0:t.type)||"agent"}function YT(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function k0(e){if(!e)return"";const t=String(e.baseDefinitionId||"").trim();if(!t)return String(e.id||"").trim();const n=e.runtime&&typeof e.runtime=="object"?e.runtime:{};return!!(n.entry||n.command)&&t==="tool_nodejs"?String(e.id||"").trim():t}function Wd(e){const t=String(k0(e)||(e==null?void 0:e.id)||"");return t==="workspace_run"?"CONTROL":t.startsWith("display_")?"DISPLAY":/^control/i.test(t)?"CONTROL":/^tool/i.test(t)?"TOOL":/^provide/i.test(t)?"PROVIDE":"AGENT"}function u1(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function tg(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function Vd(e){return tg(e)}function jb(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function jx(e,t){const n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim(),r=String((e==null?void 0:e.type)||"").trim();return n||r||`#${t+1}`}function d1(e,t,n){const r=String((t==null?void 0:t.name)||(t==null?void 0:t.id)||`#${n+1}`).trim(),s=String((t==null?void 0:t.type)||"").trim(),i=String((t==null?void 0:t.default)??(t==null?void 0:t.value)??"").trim();return[e,r,s?`type: ${s}`:"",i?`default: ${i}`:""].filter(Boolean).join(" · ")}function f1(e,t){const n=Array.isArray(e)?e:[],r=n.slice(0,4),s=Math.max(0,n.length-r.length);return{list:n,shown:r,hidden:s,kind:t}}function p1(e,t){const n=String((e==null?void 0:e.source)||""),r=String((e==null?void 0:e.target)||"");if(!n||!r)return!1;const s=new Map(t.map(l=>[l.id,l])),i=Ou(s.get(n),e.sourceHandle||"output-0","source"),a=Ou(s.get(r),e.targetHandle||"input-0","target");return!!(i&&a&&Lu(i,a))}function uq(e,t){const n=String((e==null?void 0:e.nodeId)||""),r=String((e==null?void 0:e.handleId)||""),s=(e==null?void 0:e.handleType)==="target"?"target":(e==null?void 0:e.handleType)==="source"?"source":"";if(!n||!r||!s)return null;const i=t.find(l=>l.id===n),a=Ou(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:kT(a)}:null}function dq(e,t){return t?e.map((n,r)=>{const s=Array.isArray(t.handleType==="source"?n.inputs:n.outputs)?t.handleType==="source"?n.inputs:n.outputs:[];for(let i=0;i<s.length;i+=1){const a=s[i];if(!(t.handleType==="source"?Lu(t.slot,a):Lu(a,t.slot)))continue;const c=Wd(n);return{def:n,order:r,category:c,categoryRank:Fc.indexOf(c),slot:a,slotIndex:i,displayLabel:Vd(n),description:jb(n)}}return null}).filter(Boolean).sort((n,r)=>{var a,l;const s=(a=n.slot)!=null&&a.required?0:1,i=(l=r.slot)!=null&&l.required?0:1;return s-i||n.slotIndex-r.slotIndex||n.categoryRank-r.categoryRank||n.order-r.order}):[]}function Ud(e,t=!1){if(t)return"folder";const n=String(e||"").toLowerCase().split(".").pop();return n==="md"||n==="markdown"?"article":n==="html"?"web":["csv","tsv"].includes(n)?"table":["js","jsx","ts","tsx","mjs","cjs"].includes(n)?"code":["yaml","yml","json"].includes(n)?"data_object":"draft"}function fq(e,t){const n=String(e||"node").replace(/^(agent|control|provide|tool|display)_/i,"").replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"node",r=new Set(t.map(s=>s.id));for(let s=1;s<1e4;s++){const i=`${n}_${s}`;if(!r.has(i))return i}return`${n}_${Date.now().toString(36)}`}function pq(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function Nh(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:pq(t),required:!!(t!=null&&t.required),showOnNode:(t==null?void 0:t.showOnNode)!=null?t.showOnNode!==!1:!!(t!=null&&t.required)||String((t==null?void 0:t.type)||"node").trim().toLowerCase()==="node"}))}function GT(e){const t=(e==null?void 0:e.data)||{},n=r=>(Array.isArray(r)?r:[]).map((s,i)=>(s==null?void 0:s.showOnNode)===!1?"":[i,String((s==null?void 0:s.type)||""),String((s==null?void 0:s.name)||""),s!=null&&s.required?"1":"0"].join(":")).filter(Boolean).join("|");return`${n(t.inputs)}=>${n(t.outputs)}`}function hq(e){var s,i;const t=(e==null?void 0:e.data)||{},n=t!=null&&t.displaySize&&typeof t.displaySize=="object"?t.displaySize:{},r=t!=null&&t.nodeSize&&typeof t.nodeSize=="object"?t.nodeSize:{};return[GT(e),Number((e==null?void 0:e.width)||0)||"",Number((e==null?void 0:e.height)||0)||"",Number(((s=e==null?void 0:e.measured)==null?void 0:s.width)||0)||"",Number(((i=e==null?void 0:e.measured)==null?void 0:i.height)||0)||"",Number(r.width||0)||"",Number(r.height||0)||"",Number(n.width||0)||"",Number(n.height||0)||"",t!=null&&t.isExecuting?"executing":"",(t==null?void 0:t.nodeStatus)||"",(t==null?void 0:t.runningRunNodeId)||""].join("::")}function Cx(e,t){var u,p;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=JT(n),s=Array.isArray(e==null?void 0:e.edges)?e.edges:[],i=(u=e==null?void 0:e.ui)!=null&&u.nodePositions&&typeof e.ui.nodePositions=="object"?e.ui.nodePositions:{},a=(p=e==null?void 0:e.ui)!=null&&p.nodeSizes&&typeof e.ui.nodeSizes=="object"?e.ui.nodeSizes:{},l=new Set(Object.keys(r));for(const m of s)m!=null&&m.source&&l.add(String(m.source)),m!=null&&m.target&&l.add(String(m.target));const d=Array.from(l).map(m=>{const g=r[m]||{},b=g.definitionId||m,v=t.find(B=>B.id===b),y=k0(v)||b,k=t.find(B=>B.id===y)||v,w=g.marketplaceRef||YT(v),j=i[m]&&typeof i[m].x=="number"&&typeof i[m].y=="number"?i[m]:{x:320+l.size*20,y:180+l.size*12},A=!!Yn(y),C=a[m]&&typeof a[m].width=="number"&&typeof a[m].height=="number"?{width:a[m].width,height:a[m].height}:null,$=mu(C,{display:A});return{id:m,type:pp,position:j,...$?{width:$.width,height:$.height}:{},data:{label:g.label||tg(v)||tg(k)||m,definitionId:y,...w?{marketplaceRef:w}:{},...v!=null&&v.packageId?{marketplacePackageId:v.packageId}:{},...v!=null&&v.version?{marketplaceVersion:v.version}:{},schemaType:qT(y,k||v),role:g.role||"normal",model:g.model||void 0,body:g.body||"",script:g.script||"",...$?{nodeSize:$}:{},...A&&$?{displaySize:$}:{}}}}).map(m=>Uf(m,r,t)),f=s.filter(m=>(m==null?void 0:m.source)&&(m==null?void 0:m.target)).map((m,g)=>({id:m.id||`we-${m.source}-${m.target}-${g}`,source:String(m.source),target:String(m.target),sourceHandle:m.sourceHandle??void 0,targetHandle:m.targetHandle??void 0,markerEnd:{type:Es.ArrowClosed}}));return{nodes:d,edges:bT(f,d),instances:r}}function h1(e){return`${Nb}${e}`}function Ex(e){const t=String(e||"");return t.startsWith(Nb)?t.slice(Nb.length):t}function XT(e){if(!e||typeof e!="object")return null;const t=Number(e.x),n=Number(e.y),r=Number(e.zoom);return!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)?null:{x:t,y:n,zoom:Math.min(Math.max(r,.1),4)}}function Cb(e,t=[]){const n=new Map((Array.isArray(t)?t:[]).filter(u=>{var p;return Yn((p=u==null?void 0:u.data)==null?void 0:p.definitionId)}).map(u=>[u.id,u])),r=Array.isArray(e==null?void 0:e.nodeIds)?e.nodeIds:[],s=[],i=new Set;for(const u of r){const p=String(u||"").trim();!p||i.has(p)||!n.has(p)||(i.add(p),s.push(p))}const a={},l=e!=null&&e.nodePositions&&typeof e.nodePositions=="object"?e.nodePositions:{};s.forEach((u,p)=>{const m=l[u];a[u]=m&&typeof m.x=="number"&&typeof m.y=="number"?{x:m.x,y:m.y}:{x:180+p*36,y:120+p*28}});const c={},d=e!=null&&e.nodeSizes&&typeof e.nodeSizes=="object"?e.nodeSizes:{};s.forEach(u=>{const p=mu(d[u],{display:!0});p&&(c[u]=p)});const f=XT(e==null?void 0:e.viewport);return{nodeIds:s,nodePositions:a,nodeSizes:c,...f?{viewport:f}:{}}}function mq(e,t=[]){return Cb(e,t)}function gq(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}async function yq(e){var n;const t=String(e||"");if(!t)return!1;try{if((n=navigator.clipboard)!=null&&n.writeText)return await navigator.clipboard.writeText(t),!0}catch{}try{const r=document.createElement("textarea");r.value=t,r.setAttribute("readonly",""),r.style.position="fixed",r.style.left="-9999px",r.style.top="0",document.body.appendChild(r),r.focus(),r.select();const s=document.execCommand("copy");return document.body.removeChild(r),s}catch{return!1}}function m1(e,t,n){const r=Number(e);return!Number.isFinite(r)||r<=0?0:Math.min(n,Math.max(t,Math.round(r)))}function mu(e,{display:t=!1}={}){if(!e||typeof e!="object")return null;const n=Number(e.width),r=Number(e.height);return!Number.isFinite(n)||!Number.isFinite(r)||n<=0||r<=0?null:t?{width:Math.round(n),height:Math.round(r)}:{width:m1(n,VT,UT)||tq,height:m1(r,Sb,KT)||Sb}}function zc(e){var s,i,a,l,c,d,f,u,p,m,g;const t=!!Yn((s=e==null?void 0:e.data)==null?void 0:s.definitionId),n=Number(((a=(i=e==null?void 0:e.data)==null?void 0:i.displaySize)==null?void 0:a.width)||((c=(l=e==null?void 0:e.data)==null?void 0:l.nodeSize)==null?void 0:c.width)||(e==null?void 0:e.width)||(t?(d=e==null?void 0:e.measured)==null?void 0:d.width:0)||0),r=Number(((u=(f=e==null?void 0:e.data)==null?void 0:f.displaySize)==null?void 0:u.height)||((m=(p=e==null?void 0:e.data)==null?void 0:p.nodeSize)==null?void 0:m.height)||(e==null?void 0:e.height)||(t?(g=e==null?void 0:e.measured)==null?void 0:g.height:0)||0);return mu({width:n,height:r},{display:t})}function jh(e,t,n){var l,c;const r=JT(fp(e,n||{})),s=t.map(d=>({source:d.source,target:d.target,sourceHandle:d.sourceHandle??null,targetHandle:d.targetHandle??null})),i={},a={};for(const d of e){i[d.id]={x:((l=d.position)==null?void 0:l.x)||0,y:((c=d.position)==null?void 0:c.y)||0};const f=zc(d);f&&(a[d.id]=f)}return{version:1,instances:r,edges:s,ui:{nodePositions:i,nodeSizes:a}}}function JT(e){const t={};for(const[n,r]of Object.entries(e||{})){const s=String((r==null?void 0:r.definitionId)||n);if(!!Yn(s)||s.startsWith("provide_")||!Array.isArray(r==null?void 0:r.output)){t[n]=r;continue}t[n]={...r,output:r.output.map(a=>({...a,value:"",default:""}))}}return t}function Yn(e){const t=String(e||"");return t==="display_markdown"?"markdown":t==="display_mermaid"?"mermaid":t==="display_ascii"?"ascii":t==="display_html"?"html":t==="display_image"?"image":t==="display_chart"?"chart":t==="display_table"?"table":""}function Kl(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],r=Yn(e==null?void 0:e.definitionId)==="image"?"src":"content",s=l=>String((l==null?void 0:l.value)??(l==null?void 0:l.default)??""),i=l=>s(l).trim(),a=t.find(l=>(l==null?void 0:l.name)===r&&i(l))||t.find(l=>(l==null?void 0:l.name)==="filePath"&&i(l))||t.find(l=>(l==null?void 0:l.type)==="text"&&i(l));return String((e==null?void 0:e.body)||(a?s(a):""))}function Wu(e){let t=String(e||"").trim();if(!t)return"";const n=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*?)```/);if(n&&n[1])t=n[1].trim();else{const i=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*)$/);i&&i[1]&&(t=i[1].trim())}t=t.replace(/^html\s*\n/i,"").replace(/```\s*$/g,"").trim();const s=[/<!doctype\b/i,/<html\b/i,/<head\b/i,/<body\b/i,/<style\b/i,/<script\b/i,/<main\b/i,/<section\b/i,/<article\b/i,/<div\b/i,/<svg\b/i,/<canvas\b/i].reduce((i,a)=>{const l=a.exec(t);return l?i<0?l.index:Math.min(i,l.index):i},-1);return s>0&&(t=t.slice(s).trim()),t}function QT(e){const t=Wu(e);if(!t.trim())return"";if(/<base\s+[^>]*target\s*=/i.test(t))return t;const n='<base target="_blank">';return/<head\b[^>]*>/i.test(t)?t.replace(/<head\b([^>]*)>/i,`<head$1>${n}`):/<html\b[^>]*>/i.test(t)?t.replace(/<html\b([^>]*)>/i,`<html$1><head>${n}</head>`):`<!doctype html><html><head>${n}</head><body>${t}</body></html>`}function xq(e,t){const n=String(e).trim().replace(/[\\/:*?"<>|]+/g,"-").replace(/\s+/g,"-").replace(/^-+|-+$/g,"")||"html-render",r=String(t).replace(/^\.+/,"")||"png";return`${n}.${r}`}function wq(e,t){const n=document.createElement("a");n.href=e,n.download=t,document.body.appendChild(n),n.click(),n.remove()}function g1(e,t){const n=URL.createObjectURL(e);try{wq(n,t)}finally{window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function bq(e){const t=Wu(e),n=new DOMParser().parseFromString(t||"<body></body>","text/html"),r=new XMLSerializer,s=Array.from(n.querySelectorAll("style")).map(a=>r.serializeToString(a)).join(`
143
+ `).filter(l=>l.trim());if(s.length>=2&&Go(s[0]).length>1&&BT(s[1])){const l=Go(s[0]),c=HT(s[1]);return{columns:l.map((d,f)=>({key:String(f),label:d,align:c[f]||"left"})),rows:s.slice(2).map(d=>Go(d)),error:""}}const i=r.includes(" ")?" ":",",a=K7(r,i);return a.length>0&&a[0].length>1?{columns:a[0].map((c,d)=>c||`Column ${d+1}`).map((c,d)=>({key:String(d),label:c,align:"left"})),rows:a.slice(1),error:""}:{columns:[],rows:[],error:"No table data detected"}}function b0({content:e}){const t=h.useMemo(()=>Y7(e),[e]);return t.error||t.columns.length===0?o.jsxs("div",{className:"af-work-display-table-empty",children:[o.jsx("strong",{children:"Table data error"}),o.jsx("span",{children:t.error||"No columns found"})]}):o.jsx("div",{className:"af-work-display-table-wrap af-work-display-table-wrap--standalone",children:o.jsxs("table",{className:"af-work-display-table",children:[o.jsx("thead",{children:o.jsx("tr",{children:t.columns.map((n,r)=>o.jsx("th",{style:{textAlign:n.align||"left"},children:n.label},`${n.key}-${r}`))})}),o.jsx("tbody",{children:t.rows.map((n,r)=>o.jsx("tr",{children:t.columns.map((s,i)=>o.jsx("td",{style:{textAlign:s.align||"left"},children:lo(n[i])},`${s.key}-${i}`))},r))})]})})}function v0({content:e}){const t=h.useRef(null),n=h.useMemo(()=>V7(e),[e]),[r,s]=h.useState({loading:!1,error:""});return h.useEffect(()=>{if(!n.ok){s({loading:!1,error:n.error||"Invalid chart spec"});return}let i=!1,a=null,l=null,c=null;return s({loading:!0,error:""}),I7(()=>import("./index-DgQRkS4v.js"),[]).then(d=>{i||!t.current||(a=d.init(t.current,"dark",{renderer:"canvas"}),a.setOption(n.spec.option,!0),c=()=>a==null?void 0:a.resize(),typeof ResizeObserver<"u"&&(l=new ResizeObserver(c),l.observe(t.current)),window.addEventListener("resize",c),window.requestAnimationFrame(c),i||s({loading:!1,error:""}))}).catch(d=>{i||s({loading:!1,error:String((d==null?void 0:d.message)||d)})}),()=>{var d,f;i=!0,c&&window.removeEventListener("resize",c),(d=l==null?void 0:l.disconnect)==null||d.call(l),(f=a==null?void 0:a.dispose)==null||f.call(a)}},[n]),!n.ok||r.error?o.jsxs("div",{className:"af-work-display-chart-error",children:[o.jsx("strong",{children:"Chart configuration error"}),o.jsx("span",{children:r.error||n.error})]}):o.jsxs("div",{className:"af-work-display-chart",children:[o.jsx("div",{ref:t,className:"af-work-display-chart__canvas"}),r.loading?o.jsx("div",{className:"af-work-display-chart__loading",children:"Loading chart..."}):null]})}const G7="af:workspace-graph:v2",Fc=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],X7=new Set(["control_start","control_end","control_load_skills","control_load_mcp"]),J7={id:"workspace_run",displayName:"Run",label:"Run",description:"Run the downstream workspace subgraph connected from this node.",type:"control",inputs:[{type:"node",name:"prev",default:""}],outputs:[{type:"node",name:"next",default:""}]},Q7={id:"control_load_skills",displayName:"Load Skills",label:"Load Skills",description:"Load the currently selected Workspace skill collection for downstream agent nodes.",type:"control",inputs:[{type:"node",name:"prev",default:""},{type:"text",name:"skillKeys",default:"",showOnNode:!1}],outputs:[{type:"node",name:"next",default:""},{type:"text",name:"skillsContext",default:"",showOnNode:!0}]},Z7={id:"control_load_mcp",displayName:"Load MCP",label:"Load MCP",description:"Load selected Cursor MCP server tool manifests for downstream agent nodes.",type:"control",inputs:[{type:"node",name:"prev",default:""},{type:"text",name:"serverNames",default:"",showOnNode:!1}],outputs:[{type:"node",name:"next",default:""},{type:"text",name:"mcpContext",default:"",showOnNode:!0}]},eq=new Set(["png","jpg","jpeg","gif","webp","svg"]),tq=320,VT=180,UT=960,Sb=96,KT=900,Nb="display-ref:",nq="0.1.57";function rq(){const e=new URLSearchParams(window.location.search);return{flowId:e.get("flowId")||"",flowSource:e.get("flowSource")||"user",archived:e.get("archived")==="1"||e.get("flowArchived")==="1"}}function Ia(e){const t=new URLSearchParams;return e.flowId&&t.set("flowId",e.flowId),e.flowSource&&t.set("flowSource",e.flowSource),e.archived&&t.set("archived","1"),t}function Zm(e){if(!e)return!1;const t=String(e.type||"");if(t&&/^image\//i.test(t))return!0;const n=String(e.name||"").toLowerCase().split(".").pop();return eq.has(n)}function eg(e,t){const n=String(e||"").trim();if(!n)return"";if(/^(?:https?:|data:|blob:|file:)/i.test(n)||n.startsWith("/"))return n;const r=Ia(t||{});return r.set("path",n),`/api/workspace/file/raw?${r.toString()}`}function sq(e,t){const n=String(e||"").trim();if(!n)return"";const r=Ia(t||{});return r.set("path",n),r.set("download","1"),`/api/workspace/file/raw?${r.toString()}`}function iq(e){const t=String((e==null?void 0:e.flowId)||"").trim();if(!t)return"";const n=String((e==null?void 0:e.flowSource)||"user").trim()||"user";return`af:composer-skills:workspace:${t}:${n}${e!=null&&e.archived?":archived":""}`}function oq(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function aq(e){var t;if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)return Number(e.selectionStart??0)!==Number(e.selectionEnd??0);if(e instanceof Element&&e.closest('[contenteditable="true"]')){const n=(t=window.getSelection)==null?void 0:t.call(window);return!!(n&&!n.isCollapsed)}return!1}function lq(e){return!e||typeof e.closest!="function"?!1:!!e.closest(".af-flow-node__prompt-stack")&&!aq(e)}function cq(e){const t=String(e||"").trim();if(!t)return"";if(/^思考中/.test(t))return"模型正在思考";if(/^生成回复中/.test(t))return"模型正在生成回复";if(/^Timing\s+(.+?):\s+(\d+)ms/i.test(t)){const n=t.match(/^Timing\s+(.+?):\s+(\d+)ms/i);return`耗时:${(n==null?void 0:n[1])||"step"} ${(n==null?void 0:n[2])||"0"}ms`}if(/^工具\s+(.+?)(?:\s+\((started|completed)\))?$/i.test(t)){const n=t.match(/^工具\s+(.+?)(?:\s+\((started|completed)\))?$/i),r=String((n==null?void 0:n[1])||"tool").trim(),s=String((n==null?void 0:n[2])||"").toLowerCase();if(r==="thinking")return"模型正在思考";const i=r==="readToolCall"?"读取文件/上下文":r==="grepToolCall"?"搜索代码":r==="editToolCall"?"编辑文件":r;return s==="completed"?`完成:${i}`:`执行:${i}`}return/^\[stderr\]/.test(t)?t:""}function c1(e){if(String((e==null?void 0:e.type)||"")!=="raw"||String((e==null?void 0:e.eventType)||"")!=="thinking")return"";const t=String((e==null?void 0:e.text)||"").trim();if(!t)return"";try{const n=JSON.parse(t);if((n==null?void 0:n.type)!=="thinking")return"";const r=String((n==null?void 0:n.subtype)||"");return r&&r!=="delta"?"":String((n==null?void 0:n.text)||(n==null?void 0:n.delta)||(n==null?void 0:n.thinking)||"").trim()}catch{return""}}function qT(e,t){const n=String(e||(t==null?void 0:t.id)||"").toLowerCase();return n.startsWith("control_")?"control":n.startsWith("provide_")?"provide":n.startsWith("tool_")?"agent":(t==null?void 0:t.type)||"agent"}function YT(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function k0(e){if(!e)return"";const t=String(e.baseDefinitionId||"").trim();if(!t)return String(e.id||"").trim();const n=e.runtime&&typeof e.runtime=="object"?e.runtime:{};return!!(n.entry||n.command)&&t==="tool_nodejs"?String(e.id||"").trim():t}function Wd(e){const t=String(k0(e)||(e==null?void 0:e.id)||"");return t==="workspace_run"?"CONTROL":t.startsWith("display_")?"DISPLAY":/^control/i.test(t)?"CONTROL":/^tool/i.test(t)?"TOOL":/^provide/i.test(t)?"PROVIDE":"AGENT"}function u1(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function tg(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function Vd(e){return tg(e)}function jb(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function jx(e,t){const n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim(),r=String((e==null?void 0:e.type)||"").trim();return n||r||`#${t+1}`}function d1(e,t,n){const r=String((t==null?void 0:t.name)||(t==null?void 0:t.id)||`#${n+1}`).trim(),s=String((t==null?void 0:t.type)||"").trim(),i=String((t==null?void 0:t.default)??(t==null?void 0:t.value)??"").trim();return[e,r,s?`type: ${s}`:"",i?`default: ${i}`:""].filter(Boolean).join(" · ")}function f1(e,t){const n=Array.isArray(e)?e:[],r=n.slice(0,4),s=Math.max(0,n.length-r.length);return{list:n,shown:r,hidden:s,kind:t}}function p1(e,t){const n=String((e==null?void 0:e.source)||""),r=String((e==null?void 0:e.target)||"");if(!n||!r)return!1;const s=new Map(t.map(l=>[l.id,l])),i=Ou(s.get(n),e.sourceHandle||"output-0","source"),a=Ou(s.get(r),e.targetHandle||"input-0","target");return!!(i&&a&&Lu(i,a))}function uq(e,t){const n=String((e==null?void 0:e.nodeId)||""),r=String((e==null?void 0:e.handleId)||""),s=(e==null?void 0:e.handleType)==="target"?"target":(e==null?void 0:e.handleType)==="source"?"source":"";if(!n||!r||!s)return null;const i=t.find(l=>l.id===n),a=Ou(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:kT(a)}:null}function dq(e,t){return t?e.map((n,r)=>{const s=Array.isArray(t.handleType==="source"?n.inputs:n.outputs)?t.handleType==="source"?n.inputs:n.outputs:[];for(let i=0;i<s.length;i+=1){const a=s[i];if(!(t.handleType==="source"?Lu(t.slot,a):Lu(a,t.slot)))continue;const c=Wd(n);return{def:n,order:r,category:c,categoryRank:Fc.indexOf(c),slot:a,slotIndex:i,displayLabel:Vd(n),description:jb(n)}}return null}).filter(Boolean).sort((n,r)=>{var a,l;const s=(a=n.slot)!=null&&a.required?0:1,i=(l=r.slot)!=null&&l.required?0:1;return s-i||n.slotIndex-r.slotIndex||n.categoryRank-r.categoryRank||n.order-r.order}):[]}function Ud(e,t=!1){if(t)return"folder";const n=String(e||"").toLowerCase().split(".").pop();return n==="md"||n==="markdown"?"article":n==="html"?"web":["csv","tsv"].includes(n)?"table":["js","jsx","ts","tsx","mjs","cjs"].includes(n)?"code":["yaml","yml","json"].includes(n)?"data_object":"draft"}function fq(e,t){const n=String(e||"node").replace(/^(agent|control|provide|tool|display)_/i,"").replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"node",r=new Set(t.map(s=>s.id));for(let s=1;s<1e4;s++){const i=`${n}_${s}`;if(!r.has(i))return i}return`${n}_${Date.now().toString(36)}`}function pq(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function Nh(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:pq(t),required:!!(t!=null&&t.required),showOnNode:(t==null?void 0:t.showOnNode)!=null?t.showOnNode!==!1:!!(t!=null&&t.required)||String((t==null?void 0:t.type)||"node").trim().toLowerCase()==="node"}))}function GT(e){const t=(e==null?void 0:e.data)||{},n=r=>(Array.isArray(r)?r:[]).map((s,i)=>(s==null?void 0:s.showOnNode)===!1?"":[i,String((s==null?void 0:s.type)||""),String((s==null?void 0:s.name)||""),s!=null&&s.required?"1":"0"].join(":")).filter(Boolean).join("|");return`${n(t.inputs)}=>${n(t.outputs)}`}function hq(e){var s,i;const t=(e==null?void 0:e.data)||{},n=t!=null&&t.displaySize&&typeof t.displaySize=="object"?t.displaySize:{},r=t!=null&&t.nodeSize&&typeof t.nodeSize=="object"?t.nodeSize:{};return[GT(e),Number((e==null?void 0:e.width)||0)||"",Number((e==null?void 0:e.height)||0)||"",Number(((s=e==null?void 0:e.measured)==null?void 0:s.width)||0)||"",Number(((i=e==null?void 0:e.measured)==null?void 0:i.height)||0)||"",Number(r.width||0)||"",Number(r.height||0)||"",Number(n.width||0)||"",Number(n.height||0)||"",t!=null&&t.isExecuting?"executing":"",(t==null?void 0:t.nodeStatus)||"",(t==null?void 0:t.runningRunNodeId)||""].join("::")}function Cx(e,t){var u,p;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=JT(n),s=Array.isArray(e==null?void 0:e.edges)?e.edges:[],i=(u=e==null?void 0:e.ui)!=null&&u.nodePositions&&typeof e.ui.nodePositions=="object"?e.ui.nodePositions:{},a=(p=e==null?void 0:e.ui)!=null&&p.nodeSizes&&typeof e.ui.nodeSizes=="object"?e.ui.nodeSizes:{},l=new Set(Object.keys(r));for(const m of s)m!=null&&m.source&&l.add(String(m.source)),m!=null&&m.target&&l.add(String(m.target));const d=Array.from(l).map(m=>{const g=r[m]||{},b=g.definitionId||m,v=t.find(B=>B.id===b),y=k0(v)||b,k=t.find(B=>B.id===y)||v,w=g.marketplaceRef||YT(v),j=i[m]&&typeof i[m].x=="number"&&typeof i[m].y=="number"?i[m]:{x:320+l.size*20,y:180+l.size*12},A=!!Yn(y),C=a[m]&&typeof a[m].width=="number"&&typeof a[m].height=="number"?{width:a[m].width,height:a[m].height}:null,$=mu(C,{display:A});return{id:m,type:pp,position:j,...$?{width:$.width,height:$.height}:{},data:{label:g.label||tg(v)||tg(k)||m,definitionId:y,...w?{marketplaceRef:w}:{},...v!=null&&v.packageId?{marketplacePackageId:v.packageId}:{},...v!=null&&v.version?{marketplaceVersion:v.version}:{},schemaType:qT(y,k||v),role:g.role||"normal",model:g.model||void 0,body:g.body||"",script:g.script||"",...$?{nodeSize:$}:{},...A&&$?{displaySize:$}:{}}}}).map(m=>Uf(m,r,t)),f=s.filter(m=>(m==null?void 0:m.source)&&(m==null?void 0:m.target)).map((m,g)=>({id:m.id||`we-${m.source}-${m.target}-${g}`,source:String(m.source),target:String(m.target),sourceHandle:m.sourceHandle??void 0,targetHandle:m.targetHandle??void 0,markerEnd:{type:Es.ArrowClosed}}));return{nodes:d,edges:bT(f,d),instances:r}}function h1(e){return`${Nb}${e}`}function Ex(e){const t=String(e||"");return t.startsWith(Nb)?t.slice(Nb.length):t}function XT(e){if(!e||typeof e!="object")return null;const t=Number(e.x),n=Number(e.y),r=Number(e.zoom);return!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)?null:{x:t,y:n,zoom:Math.min(Math.max(r,.1),4)}}function Cb(e,t=[]){const n=new Map((Array.isArray(t)?t:[]).filter(u=>{var p;return Yn((p=u==null?void 0:u.data)==null?void 0:p.definitionId)}).map(u=>[u.id,u])),r=Array.isArray(e==null?void 0:e.nodeIds)?e.nodeIds:[],s=[],i=new Set;for(const u of r){const p=String(u||"").trim();!p||i.has(p)||!n.has(p)||(i.add(p),s.push(p))}const a={},l=e!=null&&e.nodePositions&&typeof e.nodePositions=="object"?e.nodePositions:{};s.forEach((u,p)=>{const m=l[u];a[u]=m&&typeof m.x=="number"&&typeof m.y=="number"?{x:m.x,y:m.y}:{x:180+p*36,y:120+p*28}});const c={},d=e!=null&&e.nodeSizes&&typeof e.nodeSizes=="object"?e.nodeSizes:{};s.forEach(u=>{const p=mu(d[u],{display:!0});p&&(c[u]=p)});const f=XT(e==null?void 0:e.viewport);return{nodeIds:s,nodePositions:a,nodeSizes:c,...f?{viewport:f}:{}}}function mq(e,t=[]){return Cb(e,t)}function gq(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}async function yq(e){var n;const t=String(e||"");if(!t)return!1;try{if((n=navigator.clipboard)!=null&&n.writeText)return await navigator.clipboard.writeText(t),!0}catch{}try{const r=document.createElement("textarea");r.value=t,r.setAttribute("readonly",""),r.style.position="fixed",r.style.left="-9999px",r.style.top="0",document.body.appendChild(r),r.focus(),r.select();const s=document.execCommand("copy");return document.body.removeChild(r),s}catch{return!1}}function m1(e,t,n){const r=Number(e);return!Number.isFinite(r)||r<=0?0:Math.min(n,Math.max(t,Math.round(r)))}function mu(e,{display:t=!1}={}){if(!e||typeof e!="object")return null;const n=Number(e.width),r=Number(e.height);return!Number.isFinite(n)||!Number.isFinite(r)||n<=0||r<=0?null:t?{width:Math.round(n),height:Math.round(r)}:{width:m1(n,VT,UT)||tq,height:m1(r,Sb,KT)||Sb}}function zc(e){var s,i,a,l,c,d,f,u,p,m,g;const t=!!Yn((s=e==null?void 0:e.data)==null?void 0:s.definitionId),n=Number(((a=(i=e==null?void 0:e.data)==null?void 0:i.displaySize)==null?void 0:a.width)||((c=(l=e==null?void 0:e.data)==null?void 0:l.nodeSize)==null?void 0:c.width)||(e==null?void 0:e.width)||(t?(d=e==null?void 0:e.measured)==null?void 0:d.width:0)||0),r=Number(((u=(f=e==null?void 0:e.data)==null?void 0:f.displaySize)==null?void 0:u.height)||((m=(p=e==null?void 0:e.data)==null?void 0:p.nodeSize)==null?void 0:m.height)||(e==null?void 0:e.height)||(t?(g=e==null?void 0:e.measured)==null?void 0:g.height:0)||0);return mu({width:n,height:r},{display:t})}function jh(e,t,n){var l,c;const r=JT(fp(e,n||{})),s=t.map(d=>({source:d.source,target:d.target,sourceHandle:d.sourceHandle??null,targetHandle:d.targetHandle??null})),i={},a={};for(const d of e){i[d.id]={x:((l=d.position)==null?void 0:l.x)||0,y:((c=d.position)==null?void 0:c.y)||0};const f=zc(d);f&&(a[d.id]=f)}return{version:1,instances:r,edges:s,ui:{nodePositions:i,nodeSizes:a}}}function JT(e){const t={};for(const[n,r]of Object.entries(e||{})){const s=String((r==null?void 0:r.definitionId)||n);if(!!Yn(s)||s.startsWith("provide_")||!Array.isArray(r==null?void 0:r.output)){t[n]=r;continue}t[n]={...r,output:r.output.map(a=>({...a,value:"",default:""}))}}return t}function Yn(e){const t=String(e||"");return t==="display_markdown"?"markdown":t==="display_mermaid"?"mermaid":t==="display_ascii"?"ascii":t==="display_html"?"html":t==="display_image"?"image":t==="display_chart"?"chart":t==="display_table"?"table":""}function Kl(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],r=Yn(e==null?void 0:e.definitionId)==="image"?"src":"content",s=l=>String((l==null?void 0:l.value)??(l==null?void 0:l.default)??""),i=l=>s(l).trim(),a=t.find(l=>(l==null?void 0:l.name)===r&&i(l))||t.find(l=>(l==null?void 0:l.name)==="filePath"&&i(l))||t.find(l=>(l==null?void 0:l.type)==="text"&&i(l));return String((e==null?void 0:e.body)||(a?s(a):""))}function Wu(e){let t=String(e||"").trim();if(!t)return"";const n=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*?)```/);if(n&&n[1])t=n[1].trim();else{const i=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*)$/);i&&i[1]&&(t=i[1].trim())}t=t.replace(/^html\s*\n/i,"").replace(/```\s*$/g,"").trim();const s=[/<!doctype\b/i,/<html\b/i,/<head\b/i,/<body\b/i,/<style\b/i,/<script\b/i,/<main\b/i,/<section\b/i,/<article\b/i,/<div\b/i,/<svg\b/i,/<canvas\b/i].reduce((i,a)=>{const l=a.exec(t);return l?i<0?l.index:Math.min(i,l.index):i},-1);return s>0&&(t=t.slice(s).trim()),t}function QT(e){const t=Wu(e);if(!t.trim())return"";if(/<base\s+[^>]*target\s*=/i.test(t))return t;const n='<base target="_blank">';return/<head\b[^>]*>/i.test(t)?t.replace(/<head\b([^>]*)>/i,`<head$1>${n}`):/<html\b[^>]*>/i.test(t)?t.replace(/<html\b([^>]*)>/i,`<html$1><head>${n}</head>`):`<!doctype html><html><head>${n}</head><body>${t}</body></html>`}function xq(e,t){const n=String(e).trim().replace(/[\\/:*?"<>|]+/g,"-").replace(/\s+/g,"-").replace(/^-+|-+$/g,"")||"html-render",r=String(t).replace(/^\.+/,"")||"png";return`${n}.${r}`}function wq(e,t){const n=document.createElement("a");n.href=e,n.download=t,document.body.appendChild(n),n.click(),n.remove()}function g1(e,t){const n=URL.createObjectURL(e);try{wq(n,t)}finally{window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function bq(e){const t=Wu(e),n=new DOMParser().parseFromString(t||"<body></body>","text/html"),r=new XMLSerializer,s=Array.from(n.querySelectorAll("style")).map(a=>r.serializeToString(a)).join(`
144
144
  `),i=n.body?Array.from(n.body.childNodes).map(a=>r.serializeToString(a)).join(""):t;return`
145
145
  <style>
146
146
  * { box-sizing: border-box; }
@@ -205,7 +205,7 @@ The left node panel allows you to freely drag, delete, and adjust connections.`}
205
205
  `)})]}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Ze(),disabled:p,children:t(p?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:t("settings:claudeCode.title")}),o.jsx("span",{className:"af-set-badge"+(rn?" af-set-badge--ok":" af-set-badge--err"),children:t(rn?"settings:claudeCode.status.ready":"settings:claudeCode.status.notFound")})]}),o.jsxs("div",{className:"af-set-cli-block",children:[o.jsx("div",{className:"af-set-cli-icon",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:rn?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(rn?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:rn?t("settings:cursor.modelList.count",{count:c.claudeCode.length})+" · "+nt(c.claudeCodeFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),o.jsx("p",{className:"af-set-p",children:t("settings:claudeCode.description")}),rn?o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:claudeCode.modelPreviewLabel"),children:c.claudeCode.join(`
206
206
  `)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Ze(),disabled:p,children:t(p?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low af-set-env",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"variables"})}),o.jsx("h2",{className:"af-set-h2",children:t("settings:env.title")})]}),o.jsx("span",{className:"af-set-env-note",children:C?t("settings:env.saving"):e!=null&&e.isAdmin?t("settings:env.noteAdmin"):t("settings:env.note")})]}),o.jsxs("div",{className:"af-set-env-rows"+(e!=null&&e.isAdmin?" af-set-env-rows--admin":""),children:[o.jsxs("div",{className:"af-set-env-row af-set-env-row--header","aria-hidden":!0,children:[o.jsx("span",{children:t("settings:env.key")}),e!=null&&e.isAdmin?o.jsx("span",{children:t("settings:env.scope")}):null,o.jsx("span",{children:t("settings:env.value")}),o.jsx("span",{})]}),k.map(ie=>o.jsxs("div",{className:"af-set-env-row"+(e!=null&&e.isAdmin?" af-set-env-row--scoped":""),children:[o.jsx("div",{className:"af-set-env-cell",children:o.jsx("input",{className:"af-set-env-inline af-set-env-inline--key",value:ie.key,onChange:_e=>mn(ie.id,{key:_e.target.value}),"aria-label":t("settings:env.key"),spellCheck:!1})}),e!=null&&e.isAdmin?o.jsx("div",{className:"af-set-env-cell af-set-env-cell--scope",children:o.jsxs("div",{className:"af-set-env-scope-switch",role:"group","aria-label":t("settings:env.scope"),children:[o.jsx("button",{type:"button",className:ie.scope!=="global"?"is-active":"",onClick:()=>mn(ie.id,{scope:"user"}),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:ie.scope==="global"?"is-active":"",onClick:()=>mn(ie.id,{scope:"global"}),children:t("settings:env.global")})]})}):null,o.jsxs("div",{className:"af-set-env-cell af-set-env-cell--grow af-set-env-cell--value",children:[o.jsx("input",{className:"af-set-env-inline af-set-env-inline--value",type:M.has(ie.id)?"text":"password",value:ie.value,onChange:_e=>mn(ie.id,{value:_e.target.value}),placeholder:fne(ie.value)||t("settings:env.newValue"),"aria-label":t("settings:env.value")}),o.jsx("button",{type:"button",className:"af-set-env-value-toggle",onClick:()=>Vn(ie.id),"aria-label":M.has(ie.id)?"Hide value":"Show value",children:o.jsx("span",{className:"material-symbols-outlined",children:M.has(ie.id)?"visibility_off":"visibility"})})]}),o.jsx("div",{className:"af-set-env-actions",children:o.jsx("button",{type:"button",className:"af-set-env-del","aria-label":t("settings:env.delete",{key:ie.key}),onClick:()=>Jt(ie.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})})]},ie.id)),o.jsxs("div",{className:"af-set-env-row af-set-env-row--draft"+(e!=null&&e.isAdmin?" af-set-env-row--scoped":""),children:[o.jsx("div",{className:"af-set-env-cell",children:o.jsx("input",{className:"af-set-env-inline af-set-env-inline--key",placeholder:"KEY_NAME",value:B,onChange:ie=>F(ie.target.value),"aria-label":t("settings:env.newKey")})}),e!=null&&e.isAdmin?o.jsx("div",{className:"af-set-env-cell af-set-env-cell--scope",children:o.jsxs("div",{className:"af-set-env-scope-switch",role:"group","aria-label":t("settings:env.scope"),children:[o.jsx("button",{type:"button",className:O?"":"is-active",onClick:()=>W(!1),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:O?"is-active":"",onClick:()=>W(!0),children:t("settings:env.global")})]})}):null,o.jsx("div",{className:"af-set-env-cell af-set-env-cell--grow af-set-env-cell--value",children:o.jsx("input",{className:"af-set-env-inline af-set-env-inline--value",type:"password",placeholder:t("settings:env.newValue"),value:z,onChange:ie=>L(ie.target.value),"aria-label":t("settings:env.newValue")})}),o.jsx("div",{className:"af-set-env-actions",children:o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:Sr,disabled:!B.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:env.add")]})})]})]})]}),e!=null&&e.isAdmin?o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--allowlist",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"manage_accounts"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:t("settings:allowlist.title")}),o.jsx("p",{className:"af-set-card-subtitle",children:t("settings:allowlist.description")})]})]}),o.jsx("span",{className:"af-set-badge"+(sn?" af-set-badge--ok":" af-set-badge--muted"),children:t(sn?"settings:allowlist.enabled":"settings:allowlist.open")}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void le(),disabled:Pe,children:t(Pe?"settings:allowlist.refreshing":"common:common.refresh")})]}),tt?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:tt}):null,ae?o.jsxs("p",{className:"af-set-hint af-set-hint--inline",children:[t("settings:allowlist.file"),":",o.jsx("code",{children:ae})]}):null,o.jsxs("div",{className:"af-allowlist-grid",children:[o.jsxs("div",{className:"af-allowlist-main",children:[o.jsxs("div",{className:"af-allowlist-head",children:[o.jsx("span",{children:t("settings:allowlist.fileList")}),o.jsx("span",{children:it?t("settings:allowlist.saving"):t("settings:allowlist.userCount",{count:ne.length})})]}),o.jsx("div",{className:"af-allowlist-list",children:ne.length>0?ne.map(ie=>o.jsxs("div",{className:"af-allowlist-row",children:[o.jsx("span",{className:"af-allowlist-name",children:ie}),o.jsx("button",{type:"button",className:"af-set-env-del",onClick:()=>ye(ie),"aria-label":t("settings:allowlist.remove",{username:ie}),disabled:it,children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})]},ie)):o.jsx("div",{className:"af-allowlist-empty",children:t("settings:allowlist.emptyFile")})}),o.jsxs("div",{className:"af-allowlist-add",children:[o.jsx("input",{className:"af-set-input af-set-input--sm af-set-input--mono",value:Ae,onChange:ie=>we(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"&&or()},placeholder:"username",autoComplete:"off"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:or,disabled:it||!Ae.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:allowlist.add")]})]})]}),o.jsxs("div",{className:"af-allowlist-side",children:[o.jsxs("div",{className:"af-allowlist-head",children:[o.jsx("span",{children:t("settings:allowlist.envList")}),o.jsx("span",{children:t("settings:allowlist.readonly")})]}),o.jsx("div",{className:"af-allowlist-env-list",children:pe.length>0?pe.map(ie=>o.jsx("code",{children:ie},ie)):o.jsx("span",{children:t("settings:allowlist.emptyEnv")})}),o.jsx("p",{className:"af-set-hint af-set-hint--inline",children:t("settings:allowlist.unionHint")})]})]})]}):null,e!=null&&e.isAdmin?o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--feedback",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"rate_review"})}),o.jsx("h2",{className:"af-set-h2",children:"意见反馈"})]}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void Wn(),disabled:P,children:P?"刷新中...":"刷新"})]}),Z?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:Z}):null,o.jsx("div",{className:"af-feedback-list",children:_.length>0?_.map(ie=>o.jsxs("article",{className:"af-feedback-item",children:[o.jsxs("header",{className:"af-feedback-item__head",children:[o.jsxs("div",{children:[o.jsx("h3",{children:ie.title||"未命名反馈"}),o.jsxs("p",{children:[o.jsx("span",{children:ie.username||ie.userId||"unknown"}),o.jsx("span",{children:Ct(ie.createdAt)})]})]}),ie.contact?o.jsx("span",{className:"af-feedback-item__contact",children:ie.contact}):null]}),o.jsx("p",{className:"af-feedback-item__content",children:ie.content}),ie.pageUrl?o.jsx("code",{className:"af-feedback-item__url",children:ie.pageUrl}):null]},ie.id)):o.jsx("div",{className:"af-feedback-empty",children:P?"正在加载反馈...":"暂无反馈"})})]}):null]}),o.jsxs("aside",{className:"af-settings-rail","aria-label":t("settings:title"),children:[o.jsxs("div",{className:"af-set-rail-card af-set-rail-card--accent",children:[o.jsxs("div",{className:"af-set-rail-inner",children:[o.jsx("h3",{className:"af-set-rail-h3",children:t("settings:system.title")}),o.jsxs("div",{className:"af-set-health-line",children:[o.jsx("span",{className:"af-set-pulse-dot","aria-hidden":!0}),o.jsx("span",{className:"af-set-health-label",children:t(!a&&!f?"settings:system.normal":"settings:system.abnormal")})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.cursorModels")}),o.jsx("span",{children:c.cursor.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.cursor.length>0?12+c.cursor.length*3:4)}%`}})})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.opencodeModels")}),o.jsx("span",{children:c.opencode.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.opencode.length>0?12+c.opencode.length*3:4)}%`}})})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.claudeCodeModels")}),o.jsx("span",{children:c.claudeCode.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.claudeCode.length>0?12+c.claudeCode.length*3:4)}%`}})})]})]}),o.jsx("div",{className:"af-set-rail-watermark","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:"vital_signs"})})]}),o.jsxs("div",{className:"af-set-rail-card",children:[o.jsx("h3",{className:"af-set-rail-h3 af-set-rail-h3--sm",children:t("settings:language.title")}),o.jsxs("div",{className:"af-set-language-selector",children:[o.jsx("select",{className:"af-set-input af-set-input--sm",value:r,onChange:Ie,"aria-label":t("settings:language.description"),children:cne.map(ie=>o.jsxs("option",{value:ie.code,children:[ie.flag," ",ie.name]},ie.code))}),o.jsx("p",{className:"af-set-hint",children:t("settings:language.description")})]})]})]})]})]})})]})}function hne(){const{navigate:e}=Co(),[t,n]=h.useState(""),[r,s]=h.useState(""),[i,a]=h.useState(!1),[l,c]=h.useState(""),[d,f]=h.useState(!1),u=async p=>{if(p.preventDefault(),!i){a(!0),c("");try{const m=await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t,content:r,pageUrl:window.location.href})}),g=await m.json().catch(()=>({}));if(!m.ok)throw new Error(g.error||"提交失败");f(!0),n(""),s("")}catch(m){c(String(m.message||m))}finally{a(!1)}}};return o.jsx("main",{className:"af-feedback-page",children:o.jsxs("section",{className:"af-feedback-panel",children:[o.jsxs("div",{className:"af-feedback-head",children:[o.jsxs("div",{children:[o.jsx("span",{className:"af-feedback-eyebrow",children:"Feedback"}),o.jsx("h1",{children:"意见反馈"}),o.jsx("p",{children:"提交使用中遇到的问题、改进建议或功能需求,管理员会在设置页统一查看。"})]}),o.jsxs("button",{type:"button",className:"af-feedback-back",onClick:()=>e("/projects"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),"返回"]})]}),d?o.jsxs("div",{className:"af-feedback-success",role:"status",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"check_circle"}),o.jsxs("div",{children:[o.jsx("strong",{children:"已提交"}),o.jsx("span",{children:"感谢反馈,管理员可以在设置页查看这条记录。"})]})]}):null,o.jsxs("form",{className:"af-feedback-form",onSubmit:u,children:[o.jsxs("label",{className:"af-feedback-field",children:[o.jsx("span",{children:"标题"}),o.jsx("input",{value:t,onChange:p=>n(p.target.value),placeholder:"一句话说明问题或建议",maxLength:120,required:!0})]}),o.jsxs("label",{className:"af-feedback-field",children:[o.jsx("span",{children:"反馈内容"}),o.jsx("textarea",{value:r,onChange:p=>s(p.target.value),placeholder:"描述具体场景、期望表现、实际表现或复现步骤",maxLength:5e3,rows:9,required:!0})]}),l?o.jsx("p",{className:"af-err af-feedback-error",children:l}):null,o.jsx("div",{className:"af-feedback-actions",children:o.jsxs("button",{type:"submit",className:"af-feedback-submit",disabled:i||!t.trim()||!r.trim(),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:i?"hourglass_empty":"send"}),i?"提交中...":"提交反馈"]})})]})]})})}function p2(){return`m_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function D1(e,t=[]){const n=new Set((Array.isArray(t)?t:[]).map(String));return Object.entries(e&&typeof e=="object"?e:{}).map(([r,s])=>({id:p2(),key:r,value:String(s??""),private:n.has(r)}))}function F1(e){const t={};for(const n of Array.isArray(e)?e:[]){const r=String((n==null?void 0:n.key)||"").trim();r&&(t[r]=String((n==null?void 0:n.value)??""))}return t}function em(e=null){const t=e!=null&&e.raw&&typeof e.raw=="object"?e.raw:{},n=Array.isArray(t.args)?t.args:Array.isArray(e==null?void 0:e.args)?e.args:[];return{originalName:String((e==null?void 0:e.name)||""),name:String((e==null?void 0:e.name)||""),type:e!=null&&e.url||t.url?"url":"command",url:String((e==null?void 0:e.url)||t.url||""),command:String((e==null?void 0:e.command)||t.command||""),argsText:n.map(String).join(`
207
207
  `),description:String((e==null?void 0:e.description)||t.description||""),envRows:D1(t.env||(e==null?void 0:e.env),e==null?void 0:e.privateEnvKeys),headerRows:D1(t.headers||(e==null?void 0:e.headers),e==null?void 0:e.privateHeaderKeys),extraJson:JSON.stringify(Object.fromEntries(Object.entries(t).filter(([r])=>!["url","command","args","env","headers","description","__agentflowPrivateKeys"].includes(r))),null,2)}}function Ix(){return em({name:"",raw:{command:""}})}function mne(e){const n={...e.extraJson.trim()?JSON.parse(e.extraJson):{}};if(e.type==="url")n.url=e.url.trim();else{n.command=e.command.trim();const i=e.argsText.split(/\r?\n/g).map(a=>a.trim()).filter(Boolean);i.length&&(n.args=i)}const r=F1(e.envRows),s=F1(e.headerRows);return Object.keys(r).length&&(n.env=r),Object.keys(s).length&&(n.headers=s),e.description.trim()&&(n.description=e.description.trim()),{name:e.originalName,nextName:e.name.trim(),server:n,privateEnvKeys:e.envRows.filter(i=>i.private).map(i=>String(i.key||"").trim()).filter(Boolean),privateHeaderKeys:e.headerRows.filter(i=>i.private).map(i=>String(i.key||"").trim()).filter(Boolean)}}function z1(e){return e?e.ok?`${e.toolCount||0} tools enabled`:`Error - ${e.error||"Show Output"}`:"未检测"}function B1(e){return e?e.ok?"ok":"error":"unknown"}function H1({title:e,rows:t,onChange:n,placeholderKey:r="KEY",placeholderValue:s="value"}){const i=(a,l,c)=>n(t.map(d=>d.id===a?{...d,[l]:c}:d));return o.jsxs("div",{className:"af-mcp-field",children:[o.jsxs("div",{className:"af-mcp-field-head",children:[o.jsx("span",{children:e}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>n([...t,{id:p2(),key:"",value:"",private:!0}]),children:"添加"})]}),o.jsxs("div",{className:"af-mcp-kv-list",children:[t.length===0?o.jsx("p",{className:"af-set-hint",children:"暂无"}):null,t.map(a=>o.jsxs("div",{className:"af-mcp-kv-row",children:[o.jsx("input",{className:"af-set-input af-set-input--mono",value:a.key,placeholder:r,onChange:l=>i(a.id,"key",l.target.value)}),o.jsx("input",{className:"af-set-input af-set-input--mono",value:a.value,placeholder:s,onChange:l=>i(a.id,"value",l.target.value)}),o.jsxs("label",{className:"af-mcp-private-toggle",title:"只保存到当前 AgentFlow 用户的个人配置",children:[o.jsx("input",{type:"checkbox",checked:!!a.private,onChange:l=>i(a.id,"private",l.target.checked)}),o.jsx("span",{children:"个人"})]}),o.jsx("button",{type:"button",className:"af-set-env-del",onClick:()=>n(t.filter(l=>l.id!==a.id)),"aria-label":"删除",children:o.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},a.id))]})]})}function gne(){var O;const[e,t]=h.useState(""),[n,r]=h.useState([]),[s,i]=h.useState(Ix),[a,l]=h.useState(""),[c,d]=h.useState(!1),[f,u]=h.useState(!1),[p,m]=h.useState(!1),[g,b]=h.useState({}),[v,y]=h.useState(""),[k,w]=h.useState(""),j=h.useMemo(()=>n.find(W=>W.name===a)||null,[a,n]),A=j&&g[j.name]||null,C=h.useCallback(async()=>{d(!0),y("");try{const W=await fetch("/api/mcps"),M=await W.json().catch(()=>({}));if(!W.ok)throw new Error(M.error||"MCP HTTP "+W.status);const T=Array.isArray(M.servers)?M.servers:[];t(String(M.path||"")),r(T),a&&T.some(E=>E.name===a)&&i(em(T.find(E=>E.name===a)))}catch(W){y(String(W.message||W))}finally{d(!1)}},[a]);h.useEffect(()=>{C()},[C]);const $=()=>{l(""),i(Ix()),w(""),y("")},B=W=>{l(W.name),i(em(W)),w(""),y("")},F=async(W="")=>{m(!0),y(""),w("");try{const M=await fetch("/api/mcps/check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(W?{name:W}:{})}),T=await M.json().catch(()=>({}));if(!M.ok)throw new Error(T.error||"检测 MCP 失败");const E=Array.isArray(T.results)?T.results:[];b(D=>{const _={...D};for(const R of E)R!=null&&R.name&&(_[R.name]=R);return _}),w(W?`已检测 ${W}。`:"已检测所有 MCP。")}catch(M){y(String(M.message||M))}finally{m(!1)}},z=async()=>{u(!0),y(""),w("");try{const W=mne(s);if(!W.nextName)throw new Error("请填写 MCP 名称");const M=await fetch("/api/mcps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(W)}),T=await M.json().catch(()=>({}));if(!M.ok)throw new Error(T.error||"保存 MCP 失败");const E=Array.isArray(T.servers)?T.servers:[];r(E),t(String(T.path||e)),l(W.nextName),i(em(E.find(D=>D.name===W.nextName)||null)),b(D=>{const _={...D};return s.originalName&&s.originalName!==W.nextName&&delete _[s.originalName],delete _[W.nextName],_}),w("已保存。Cursor CLI 下次启动时会读取新配置。")}catch(W){y(String(W.message||W))}finally{u(!1)}},L=async W=>{if(W!=null&&W.name&&window.confirm(`删除 MCP "${W.name}"?`)){u(!0),y(""),w("");try{const M=await fetch("/api/mcps/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:W.name})}),T=await M.json().catch(()=>({}));if(!M.ok)throw new Error(T.error||"删除 MCP 失败");r(Array.isArray(T.servers)?T.servers:[]),l(""),i(Ix()),b(E=>{const D={...E};return delete D[W.name],D}),w("已删除。")}catch(M){y(String(M.message||M))}finally{u(!1)}}};return o.jsxs("main",{className:"af-settings-page",children:[o.jsxs("header",{className:"af-settings-top",children:[o.jsxs("div",{className:"af-settings-crumb",children:[o.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),o.jsx("span",{className:"af-settings-crumb-sep",children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:"MCP"})]}),o.jsxs("div",{className:"af-settings-top-right",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:C,disabled:c||f,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>F(),disabled:p||c||f||n.length===0,children:p?"检测中...":"检测状态"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:$,disabled:f,children:"新增 MCP"})]})]}),o.jsx("div",{className:"af-settings-body",children:o.jsxs("div",{className:"af-settings-inner",children:[o.jsxs("section",{className:"af-settings-hero",children:[o.jsx("h1",{className:"af-settings-h1",children:"MCP 管理"}),o.jsxs("p",{className:"af-settings-lead",children:["新增、编辑和删除 Cursor MCP server。当前配置文件:",o.jsx("span",{className:"af-settings-code",children:e||"~/.cursor/mcp.json"})]})]}),o.jsxs("div",{className:"af-mcp-layout",children:[o.jsxs("section",{className:"af-set-card af-mcp-list-card",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2",children:"Servers"}),o.jsxs("div",{className:"af-mcp-list-head-actions",children:[o.jsx("span",{className:"af-set-badge af-set-badge--muted",children:n.length}),o.jsxs("button",{type:"button",className:"af-set-btn-mini",onClick:$,disabled:f,children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新增"]})]})]}),c?o.jsx("p",{className:"af-set-p",children:"加载中..."}):null,n.length===0&&!c?o.jsxs("div",{className:"af-mcp-empty",children:[o.jsx("p",{className:"af-set-p",children:"暂无 MCP server。"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:$,disabled:f,children:"新增 MCP Server"})]}):null,o.jsx("div",{className:"af-mcp-server-list",children:n.map(W=>o.jsxs("button",{type:"button",className:"af-mcp-server-item"+(a===W.name?" af-mcp-server-item--active":""),onClick:()=>B(W),children:[o.jsx("span",{className:"material-symbols-outlined",children:W.type==="url"?"cloud":"terminal"}),o.jsxs("span",{children:[o.jsxs("span",{className:"af-mcp-server-title",children:[o.jsx("strong",{children:W.name}),o.jsx("small",{className:`af-mcp-server-health af-mcp-server-health--${B1(g[W.name])}`,children:z1(g[W.name])})]}),o.jsx("em",{children:W.url||[W.command,...W.args||[]].filter(Boolean).join(" ")})]})]},W.name))})]}),o.jsxs("section",{className:"af-set-card af-mcp-editor-card",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:j?"编辑 MCP":"新增 MCP"}),o.jsx("p",{className:"af-set-p af-set-p--tight",children:"保存后会写入 Cursor MCP 配置。已运行的 agent 进程不会热更新,下一次启动会读取新配置。"})]}),j?o.jsxs("div",{className:"af-mcp-editor-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>F(j.name),disabled:p||f,children:p?"检测中...":"检测"}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>L(j),disabled:f,children:"删除"})]}):null]}),v?o.jsx("p",{className:"af-mcp-error",children:v}):null,k?o.jsx("p",{className:"af-mcp-status",children:k}):null,A?o.jsxs("div",{className:`af-mcp-check af-mcp-check--${B1(A)}`,children:[o.jsxs("div",{className:"af-mcp-check-head",children:[o.jsx("strong",{children:z1(A)}),o.jsxs("span",{children:[A.elapsedMs||0,"ms"]})]}),A.error?o.jsx("p",{children:A.error}):null,(O=A.tools)!=null&&O.length?o.jsx("div",{className:"af-mcp-tools-list",children:A.tools.map(W=>o.jsxs("div",{className:"af-mcp-tool-row",children:[o.jsx("strong",{children:W.name}),W.description?o.jsx("span",{children:W.description}):null]},W.name))}):null]}):null,o.jsxs("div",{className:"af-mcp-form",children:[o.jsxs("label",{className:"af-set-label",children:["MCP 名称",o.jsx("input",{className:"af-set-input af-set-input--mono",value:s.name,onChange:W=>i(M=>({...M,name:W.target.value})),placeholder:"github"})]}),o.jsxs("label",{className:"af-set-label",children:["类型",o.jsxs("select",{className:"af-set-input",value:s.type,onChange:W=>i(M=>({...M,type:W.target.value})),children:[o.jsx("option",{value:"url",children:"URL / HTTP"}),o.jsx("option",{value:"command",children:"Command / stdio"})]})]}),s.type==="url"?o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["URL",o.jsx("input",{className:"af-set-input af-set-input--mono",value:s.url,onChange:W=>i(M=>({...M,url:W.target.value})),placeholder:"http://127.0.0.1:3845/mcp"})]}):o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"af-set-label",children:["Command",o.jsx("input",{className:"af-set-input af-set-input--mono",value:s.command,onChange:W=>i(M=>({...M,command:W.target.value})),placeholder:"uvx"})]}),o.jsxs("label",{className:"af-set-label",children:["Args,每行一个",o.jsx("textarea",{className:"af-set-input af-mcp-textarea af-set-input--mono",rows:4,value:s.argsText,onChange:W=>i(M=>({...M,argsText:W.target.value})),placeholder:`mcp-server-example
208
- --flag`})]})]}),o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["描述",o.jsx("input",{className:"af-set-input",value:s.description,onChange:W=>i(M=>({...M,description:W.target.value})),placeholder:"这个 MCP 提供什么能力"})]}),o.jsx(H1,{title:"Headers",rows:s.headerRows,onChange:W=>i(M=>({...M,headerRows:W})),placeholderKey:"Authorization",placeholderValue:"Bearer ..."}),o.jsx(H1,{title:"Env",rows:s.envRows,onChange:W=>i(M=>({...M,envRows:W})),placeholderKey:"TOKEN",placeholderValue:"..."}),o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["额外 JSON 字段",o.jsx("textarea",{className:"af-set-input af-mcp-textarea af-set-input--mono",rows:5,value:s.extraJson,onChange:W=>i(M=>({...M,extraJson:W.target.value}))})]})]}),o.jsxs("div",{className:"af-mcp-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:$,disabled:f,children:"清空"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:z,disabled:f,children:f?"保存中...":"保存 MCP"})]})]})]})]})})]})}const yne=[{icon:"campaign",title:"首页 Feed 想加一个广告引导",question:"先判断入口、展示位、用户影响面,再决定弹框、浮层还是页面内引导。",context:["查客户端展示位逻辑","查历史需求与配置","查 m09 / Feed PV"],result:"原型 + PRD + TAPD 更新",tone:"pink"},{icon:"manage_search",title:"接到需求但不知道现有逻辑",question:"不用先找研发问一圈,直接从 Likee 代码、知识库、历史文档里拿上下文。",context:["客户端 / 后台 / 前端知识库","接口与配置链路","相关 Git 文档"],result:"背景结论 + 影响范围",tone:"cyan"},{icon:"query_stats",title:"运营要评估活动或入口价值",question:"先查人群规模、页面访问、历史转化,避免凭经验拍优先级。",context:["CK / Hive 查数","自动生成 SQL","指标口径解释"],result:"数据表 + 图表 + 结论",tone:"green"},{icon:"draw",title:"想快速把方案画给团队看",question:"把一句需求变成客户端或 H5 原型,让评审时先讨论体验,不只讨论文字。",context:["Likee 客户端样式","前端页面结构","交互状态与文案"],result:"HTML 原型 + Display 面板",tone:"amber"},{icon:"sync_alt",title:"需求写完后需要同步多个地方",question:"PRD、TAPD、Git 仓库和评审展示保持一致,减少重复复制和漏改。",context:["需求正文","变更记录","MR / 仓库路径"],result:"TAPD 更新 + Git 提交",tone:"violet"},{icon:"monitoring",title:"上线后要看效果和复盘",question:"沿用需求阶段的口径继续查数,把结果沉淀回下一轮需求线索。",context:["上线后 CK / Hive","分页面 / 分人群指标","实验和版本信息"],result:"复盘结论 + 后续建议",tone:"blue"}],xne=[{label:"Use Case 01",title:"Likee 客户端知识库查询(如广告占位)",images:["/likee-context/usecase-ad-query.png"],trigger:"产品或运营想确认客户端已有逻辑,例如 Likee Android 里有哪些广告占位,以及相关常量和代码位置。",steps:["在「我的流程」加载 Likee Android 流程片段","在子 Agent 节点输入客户端逻辑问题","点击 Run Line,只执行当前链路","在右侧 Markdown Display 查看知识库查询结果"],outputs:["SETTING_ID / PAGE_ID 表格","客户端代码路径与口径说明","可继续用于 PRD 的背景材料"]},{label:"Use Case 02",title:"客户端原型设计",images:["/likee-context/usecase-prototype.png"],trigger:"业务已经明确要在 Likee 首页加入广告引导,需要先把弹框体验画出来给产品、设计、研发评审。",steps:["在 Workspace 打开原型生成流程","加载客户端原型 Skill","在子 Agent 中说明生成一个首页 dialog 弹框","查看 HTML Display 中的手机预览稿"],outputs:["Likee 风格手机原型","弹框文案与按钮状态","可直接用于评审的 Display 面板"]},{label:"Use Case 03",title:"前端 H5 原型设计",images:["/likee-context/usecase-h5-prototype.png"],trigger:"运营活动需要快速产出 Likee 风格 H5 页面,例如幸运转盘、积分排行榜、活动首页或结果页。",steps:["在 Workspace 打开 H5 原型生成流程","加载前端 H5 原型相关 Skill","在子 Agent 中说明活动结构、页面模块和运营规则","查看 HTML Display 中的可交互 H5 原型"],outputs:["Likee 风格 H5 页面","抽奖转盘与排行榜布局","活动规则和状态页","可用于评审的 HTML Display"]},{label:"Use Case 04",title:"CK / Hive 查数与 SQL 生成",images:["/likee-context/usecase-data-query.png"],trigger:"运营或产品需要快速验证一个数据问题,例如找出典型 UID、对比不同日期的视频上传分辨率占比,并保留可复用 SQL。",steps:["在 Workspace 打开查数流程","加载查数相关 Skill","在子 Agent 中说明数据口径、日期和筛选条件","查看 Markdown Display 中的数据结果和查询 SQL"],outputs:["查询结果表格","SQL 语句","口径说明","可继续接入 PRD 或复盘面板的数据结论"]},{label:"Use Case 05",title:"需求文档生成、数据补齐与同步",images:["/likee-context/usecase-prd.png","/likee-context/usecase-sync.png"],trigger:"需求进入评审和落库阶段,需要把 TAPD 信息、Hive 数据、原型内容组织成 PRD,并同步到 TAPD 和 Git 仓库。",steps:["先运行 TAPD / 数据查询节点,拿到迭代、页面 PV 和业务背景","把查询结果和原型 Display 内容接入 PRD 生成子 Agent","在 Markdown Display 查看完整需求文档","把 PRD content 接入 TAPD 更新节点和 Git 仓库提交节点"],outputs:["完整 PRD 文档","项目背景与 Top 页面数据","TAPD 需求更新成功","Git MR 链接"]},{label:"Use Case 06",title:"Display 模式做需求评审面板",images:["/likee-context/usecase-display.png"],trigger:"流程跑完后,需要把 PRD、原型、数据图表、展示位表格放在一个页面里给产品、运营、研发一起看。",steps:["在 Workspace 中完成查数、原型、PRD、同步节点执行","确认 Markdown / HTML / 图表 / 表格展示节点都有结果","切换顶部 DISPLAY 模式","使用生成链接把评审面板发给相关同学"],outputs:["PRD 长文档","客户端原型预览","图表与表格","统一展示链接"]}],wne=[{name:"likee-client-ui",namespace:"智能助手 / 客户端原型",icon:"phone_iphone",mode:"客户端原型设计",usage:"生成 Likee 客户端风格页面、弹框、Feed 引导、个人页、活动入口等原型,适合产品评审前快速对齐体验。",examples:["首页 dialog 弹框","Feed 内引导","客户端红色主品牌视觉","移动端交互态"],tone:"pink"},{name:"tapd-likee",namespace:"智能助手 / TAPD",icon:"sync",mode:"需求系统交互",usage:"和 TAPD 交互,支持创建、同步、更新需求,把工作区生成的 PRD 或 Markdown 内容回写到需求系统。",examples:["创建 TAPD 需求","更新需求正文","同步处理人和链接","把结果回显到 Display"],tone:"green"},{name:"plain-language-response",namespace:"智能助手 / 回答风格",icon:"record_voice_over",mode:"业务化回答",usage:"用于把回答收敛成产品、运营更容易阅读的解释,避免直接把客户端代码库细节、函数调用链和实现细节暴露太多。",examples:["需求背景解释","代码结论转业务语言","评审材料摘要","减少实现细节噪音"],tone:"cyan"},{name:"create-likee-h5-style-html",namespace:"智能助手 / 前端 H5",icon:"language",mode:"H5 原型设计",usage:"创建 Likee H5 风格原型,适合运营活动、抽奖、排行榜、报告页、反馈表单、创作者认证页、订单列表等页面。",examples:["幸运转盘活动","积分排行榜","活动规则页","结果页和空状态"],tone:"amber"},{name:"analytics",namespace:"数据 / CK & Hive",icon:"query_stats",mode:"查数和 SQL 生成",usage:"面向 CK、Hive 的指标查询和 SQL 生成,适合 PV、UV、转化、分国家、分实验组、典型 UID 等数据问题。",examples:["自动生成 SQL","输出查询结果表","解释指标口径","沉淀复盘数据"],tone:"green"}],bne=[["知识库","查客户端、后台、前端逻辑","广告、Feed、会员、增长、配置、接口调用链"],["数据","查 CK / Hive 并输出 SQL","PV、UV、转化、分页面、分国家、分实验组"],["产物","生成原型、PRD、Display 面板","Markdown、HTML 原型、图表、表格、交互预览"],["协作","同步 TAPD 与 Git 仓库","需求正文、变更记录、MR 链接、评审材料"]];function _h({icon:e,title:t,label:n,tone:r="violet"}){return o.jsxs("div",{className:`likee-flow-node likee-flow-node-${r}`,children:[o.jsx("span",{className:"material-symbols-outlined",children:e}),o.jsxs("div",{children:[o.jsx("strong",{children:t}),o.jsx("small",{children:n})]})]})}function vne(){return o.jsxs("div",{className:"likee-workspace-scene","aria-hidden":"true",children:[o.jsx("div",{className:"likee-scene-grid"}),o.jsxs("svg",{className:"likee-scene-lines",viewBox:"0 0 980 560",fill:"none",children:[o.jsx("path",{d:"M96 154 C236 96 330 122 444 194 C552 262 654 260 814 160"}),o.jsx("path",{d:"M118 350 C248 288 344 304 458 372 C578 444 704 420 858 310"}),o.jsx("path",{d:"M472 196 C512 248 524 302 486 372"}),o.jsx("path",{d:"M622 126 C670 198 696 258 682 354"})]}),o.jsx("div",{className:"likee-node-pos likee-node-a",children:o.jsx(_h,{icon:"travel_explore",title:"全局上下文",label:"Likee 业务、代码、数据",tone:"pink"})}),o.jsx("div",{className:"likee-node-pos likee-node-b",children:o.jsx(_h,{icon:"database",title:"CK / Hive",label:"自动 SQL 与指标口径",tone:"cyan"})}),o.jsx("div",{className:"likee-node-pos likee-node-c",children:o.jsx(_h,{icon:"article",title:"需求文档",label:"PRD、变更说明、评审稿",tone:"amber"})}),o.jsx("div",{className:"likee-node-pos likee-node-d",children:o.jsx(_h,{icon:"sync_alt",title:"TAPD / Git",label:"同步需求与版本资产",tone:"green"})}),o.jsxs("div",{className:"likee-phone-preview",children:[o.jsxs("div",{className:"likee-phone-top",children:[o.jsx("span",{children:"关注"}),o.jsx("strong",{children:"推荐"}),o.jsx("span",{children:"直播"})]}),o.jsxs("div",{className:"likee-phone-card",children:[o.jsx("div",{className:"likee-gift",children:"AD"}),o.jsx("h4",{children:"广告个性化引导弹框"}),o.jsx("p",{children:"保持推荐体验,同时解释权益与关闭路径。"}),o.jsx("button",{children:"继续"}),o.jsx("button",{className:"secondary",children:"稍后"})]})]}),o.jsxs("div",{className:"likee-display-panel",children:[o.jsxs("div",{className:"likee-panel-header",children:[o.jsx("span",{children:"DISPLAY"}),o.jsx("strong",{children:"需求资产面板"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"需求"}),o.jsx("strong",{children:"首页广告个性化引导"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"数据"}),o.jsx("strong",{children:"m09 PV Top 1"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"同步"}),o.jsx("strong",{children:"TAPD + Git MR"})]})]})]})}function tm({kicker:e,title:t,children:n}){return o.jsxs("div",{className:"likee-section-copy",children:[o.jsx("p",{className:"likee-section-kicker",children:e}),o.jsx("h2",{children:t}),o.jsx("p",{children:n})]})}function kne(){return o.jsx("section",{id:"likee-skills",className:"likee-section likee-section-dark",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-two-column-skills",children:[o.jsx(tm,{kicker:"SKILLS",title:"用 Skills 把 Likee 上下文变成可复用能力",children:"Skills 是工作区里可加载的能力包。手动搭建工作区时,只需要按场景加载对应 Skill。"}),o.jsx("div",{className:"likee-skill-grid",children:wne.map(e=>o.jsxs("article",{className:`likee-skill-card likee-skill-${e.tone}`,children:[o.jsxs("div",{className:"likee-skill-head",children:[o.jsx("div",{className:"likee-skill-icon",children:o.jsx("span",{className:"material-symbols-outlined",children:e.icon})}),o.jsxs("div",{children:[o.jsx("h3",{children:e.name}),o.jsx("span",{children:e.namespace})]})]}),o.jsx("div",{className:"likee-skill-mode",children:e.mode}),o.jsx("p",{children:e.usage}),o.jsx("div",{className:"likee-skill-examples",children:e.examples.map(t=>o.jsx("strong",{children:t},t))})]},e.name))})]})})}function h2(){return o.jsxs("div",{className:"likee-page",children:[o.jsx("div",{className:"likee-top-actions",children:o.jsxs("a",{href:"/projects",className:"likee-home-link",children:[o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"}),"返回首页"]})}),o.jsxs("section",{className:"likee-hero",children:[o.jsx(vne,{}),o.jsxs("div",{className:"likee-hero-content",children:[o.jsx("p",{className:"likee-eyebrow",children:"LIKEE CONTEXT WORKSPACE"}),o.jsx("h1",{children:"Likee Agent 工作台"}),o.jsx("p",{className:"likee-hero-subtitle",children:"提供 Likee 全局上下文,赋能需求挖掘、书写和运营。"}),o.jsxs("div",{className:"likee-signal-row",children:[o.jsx("span",{children:"查业务逻辑"}),o.jsx("span",{children:"查 CK / Hive"}),o.jsx("span",{children:"生成原型"}),o.jsx("span",{children:"生成 PRD"}),o.jsx("span",{children:"同步 TAPD / Git"})]}),o.jsxs("div",{className:"likee-hero-actions",children:[o.jsxs("a",{href:"/projects",className:"likee-primary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"rocket_launch"}),"立即使用"]}),o.jsxs("a",{href:"#likee-scenarios",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"ads_click"}),"按场景查看"]}),o.jsxs("a",{href:"#likee-usecases",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"view_timeline"}),"查看 Use Cases"]}),o.jsxs("a",{href:"#likee-skills",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"extension"}),"查看 Skills"]})]})]})]}),o.jsx("section",{id:"likee-scenarios",className:"likee-section",children:o.jsxs("div",{className:"likee-section-inner",children:[o.jsx(tm,{kicker:"SCENARIO TRIGGERS",title:"打造 Likee 团队全景上下文",children:"不要求先会写 Prompt,也不要求知道该找哪个系统。选择一个业务场景,工作台会把需要的 Likee 上下文、数据查询和最终产物组织起来。"}),o.jsx("div",{className:"likee-scenario-grid",children:yne.map(e=>o.jsxs("article",{className:`likee-scenario-card likee-scenario-${e.tone}`,children:[o.jsx("div",{className:"likee-scenario-icon",children:o.jsx("span",{className:"material-symbols-outlined",children:e.icon})}),o.jsxs("div",{children:[o.jsx("h3",{children:e.title}),o.jsx("p",{children:e.question})]}),o.jsx("div",{className:"likee-scenario-context",children:e.context.map(t=>o.jsx("span",{children:t},t))}),o.jsxs("div",{className:"likee-scenario-result",children:[o.jsx("span",{children:"产出"}),o.jsx("strong",{children:e.result})]})]},e.title))})]})}),o.jsx("section",{id:"likee-usecases",className:"likee-section likee-section-muted",children:o.jsxs("div",{className:"likee-section-inner likee-two-column",children:[o.jsx(tm,{kicker:"USE CASES",title:"沉淀 Likee 业务流水线",children:"这里展示的是平台里实际可跑的工作流:加载流程片段,在子 Agent 或 Run 节点输入业务问题,执行当前 line,最终在 Display、TAPD 和 Git 中拿到结果。"}),o.jsx("div",{className:"likee-usecase-stack",children:xne.map(e=>o.jsxs("article",{className:"likee-usecase-card",children:[o.jsx("div",{className:`likee-usecase-media ${e.images.length>1?"likee-usecase-media-split":""}`,children:e.images.map((t,n)=>o.jsx("img",{src:t,alt:`${e.title} 工作区截图 ${n+1}`,loading:"lazy"},t))}),o.jsxs("div",{className:"likee-usecase-body",children:[o.jsx("div",{className:"likee-usecase-label",children:e.label}),o.jsx("h3",{children:e.title}),o.jsx("p",{children:e.trigger}),o.jsx("ol",{className:"likee-usecase-steps",children:e.steps.map(t=>o.jsx("li",{children:t},t))}),o.jsxs("div",{className:"likee-usecase-output",children:[o.jsx("span",{children:"实际产物"}),o.jsx("div",{children:e.outputs.map(t=>o.jsx("strong",{children:t},t))})]})]})]},e.label))})]})}),o.jsx(kne,{}),o.jsx("section",{className:"likee-section",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-capability-layout",children:[o.jsx(tm,{kicker:"CAPABILITY MAP",title:"每个场景背后,都连接同一套 Likee 上下文能力",children:"工作台把知识库、CK / Hive、原型、PRD、TAPD 和 Git 放到同一条链路里。用户看到的是业务场景,系统处理的是上下文、产物和同步。"}),o.jsx("div",{className:"likee-capability-table",children:bne.map(([e,t,n])=>o.jsxs("div",{className:"likee-capability-row",children:[o.jsx("span",{children:e}),o.jsx("strong",{children:t}),o.jsx("p",{children:n})]},e))})]})})]})}function m2(e){return t=>typeof t===e}var Sne=m2("function"),Nne=e=>e===null,W1=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",V1=e=>!jne(e)&&!Nne(e)&&(Sne(e)||typeof e=="object"),jne=m2("undefined");function Cne(e,t,n){return Rne(n,e,t)?!0:(Lne(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?Ene(e,t,n):e instanceof Map&&t instanceof Map?Ane(e,t,n):e instanceof Set&&t instanceof Set?Tne(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?_ne(e,t):W1(e)&&W1(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?Pne(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():Ine(e,t,n))}function hp(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!V1(e)||!t||!V1(t)?!1:Cne(e,t,n)}function Ene(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let s=r;s--!==0;)if(!hp(e[s],t[s],n))return!1;return!0}function _ne(e,t){if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer),r=new DataView(t.buffer);let s=e.byteLength;for(;s--;)if(n.getUint8(s)!==r.getUint8(s))return!1;return!0}function Pne(e,t,n){return e.message===t.message&&e.name===t.name&&hp(e.cause,t.cause,n)}function Ane(e,t,n){if(e.size!==t.size)return!1;for(const r of e.entries())if(!t.has(r[0]))return!1;for(const r of e.entries())if(!hp(r[1],t.get(r[0]),n))return!1;return!0}function Ine(e,t,n){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let s=r.length;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[s]))return!1;for(let s=r.length;s--!==0;){const i=r[s];if(!(i==="_owner"&&e.$$typeof)&&!hp(e[i],t[i],n))return!1}return!0}function Tne(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;return!0}function Rne(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function Lne(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function S0(e,t){return hp(e,t,new WeakMap)}function Tx(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function One(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function Mne(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function $ne(){const e=h.useRef(!0);return e.current?(e.current=!1,!0):e.current}function Dne(e,t){const n=$ne();h.useEffect(()=>{if(!n)return e()},t)}function g2(e){const t=h.useRef(void 0);return h.useEffect(()=>{t.current=e}),t.current}function Fne(e,t){const n=h.useRef(t);return S0(t,n.current)||(n.current=t),h.useMemo(e,n.current)}function zne(e){h.useEffect(()=>{e()},[])}function Bne(e=0){const[t,n]=h.useState({height:Tx()?window.innerHeight:0,width:Tx()?window.innerWidth:0}),r=h.useRef(0),s=h.useRef(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(()=>{n({width:window.innerWidth,height:window.innerHeight})},e)});return h.useEffect(()=>{if(!Tx())return()=>{};const i=s.current;return n({height:window.innerHeight,width:window.innerWidth}),Mne(window,"resize",i),()=>{One(window,"resize",i)}},[]),t}var Hne=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],Wne=["bigint","boolean","null","number","string","symbol","undefined"];function mp(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(Vne(t))return t}function Ki(e){return t=>mp(t)===e}function Vne(e){return Hne.includes(e)}function Vu(e){return t=>typeof t===e}function Une(e){return Wne.includes(e)}var Kne=["innerHTML","ownerDocument","style","attributes","nodeValue"],gp=e=>Array.isArray(e),qne=e=>mp(e)==="AsyncGeneratorFunction",Yne=Ki("AsyncFunction"),Gne=Vu("bigint"),Xne=e=>e===!0||e===!1,Jne=Ki("Date"),Qne=Ki("Error"),rl=Vu("function"),Zne=Ki("GeneratorFunction"),ere=e=>typeof e=="number"&&Number.isInteger(e),Pb=Ki("Map"),y2=e=>Number.isNaN(e),N0=e=>e===null,x2=Ki("Function"),tre=Ki("Promise"),nre=Ki("RegExp"),Ab=Ki("Set"),yp=Vu("string"),rre=Vu("symbol"),j0=Vu("undefined"),sre=Ki("WeakMap"),ire=Ki("WeakSet"),C0=e=>N0(e)||j0(e),w2=e=>!j0(e),ore=e=>Vu("number")(e)&&!y2(e),are=e=>yp(e)&&e.trim().length>0,lre=e=>{if(!yp(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},Gg=e=>!C0(e)&&(rl(e)||typeof e=="object"),b2=e=>{if(mp(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},cre=e=>N0(e)||Une(typeof e),ure=e=>mp(e)==="URL",v2=e=>!C0(e)&&rl(e[Symbol.iterator]),dre=e=>v2(e)&&rl(e.next)&&rl(e.throw),fre=e=>rl(e)&&/^class\s/.test(e.toString()),pre=(e,t)=>!gp(e)||!rl(t)?!1:e.every(n=>t(n)),hre=e=>Gg(e)&&!b2(e)&&e.nodeType===1&&yp(e.nodeName)&&Kne.every(t=>t in e),mre=e=>yp(e)&&e.length===0||gp(e)&&e.length===0||Gg(e)&&!Pb(e)&&!Ab(e)&&Object.keys(e).length===0||Ab(e)&&e.size===0||Pb(e)&&e.size===0,gre=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,yre=(e,t)=>gp(e)?e.indexOf(t)>-1:!1,xre=(e,t,n)=>{if(!Gg(e)||!t)return!1;const r=e[t];return rl(n)?n(r):w2(r)};function At(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(gp(e))return"Array";if(x2(e))return"Function";const t=mp(e);return t||"Object"}At.array=gp;At.arrayOf=pre;At.asyncGeneratorFunction=qne;At.asyncFunction=Yne;At.bigint=Gne;At.boolean=Xne;At.class=fre;At.date=Jne;At.defined=w2;At.domElement=hre;At.empty=mre;At.error=Qne;At.function=rl;At.generator=dre;At.generatorFunction=Zne;At.instanceOf=gre;At.integer=ere;At.iterable=v2;At.map=Pb;At.nan=y2;At.null=N0;At.nullOrUndefined=C0;At.nonEmptyString=are;At.number=ore;At.numericString=lre;At.object=Gg;At.oneOf=yre;At.plainFunction=x2;At.plainObject=b2;At.primitive=cre;At.promise=tre;At.propertyOf=xre;At.regexp=nre;At.set=Ab;At.string=yp;At.symbol=rre;At.undefined=j0;At.url=ure;At.weakMap=sre;At.weakSet=ire;var Xr=At;/* v8 ignore next -- @preserve */var wre=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},bre=function(e,t){return e+Yf(t)},Yf=function(e){return e===null||typeof e=="boolean"||typeof e>"u"?"":typeof e=="number"?e.toString():typeof e=="string"?e:Array.isArray(e)?e.reduce(bre,""):wre(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?Yf(e.props.children):""};Yf.default=Yf;var vre=Yf;const Rx=il(vre);var k2={exports:{}};(function(e){const t=Object.getPrototypeOf({});function n(){return function(i){return typeof i=="object"&&i!==null&&!(i instanceof RegExp)&&!(i instanceof Date)}}function r(s){function i(A){return A!=="constructor"&&A!=="prototype"&&A!=="__proto__"}function a(A){let C=0;const $=A.length,B=new Array($);for(C;C<$;++C)B[C]=y(A[C]);return B}function l(A){const C={};if(p&&Object.getPrototypeOf(A)!==t)return p(A);const $=u(A);let B,F,z;for(B=0,F=$.length;B<F;++B)i(z=$[B])&&(C[z]=y(A[z]));return C}function c(A,C){const $=A.length,B=C.length;let F=0;const z=new Array($+B);for(F;F<$;++F)z[F]=y(A[F]);for(F=0;F<B;++F)z[F+$]=y(C[F]);return z}const d=Object.prototype.propertyIsEnumerable;function f(A){const C=Object.keys(A),$=Object.getOwnPropertySymbols(A);for(let B=0,F=$.length;B<F;++B)d.call(A,$[B])&&C.push($[B]);return C}const u=s!=null&&s.symbols?f:Object.keys,p=typeof(s==null?void 0:s.cloneProtoObject)=="function"?s.cloneProtoObject:void 0,m=typeof(s==null?void 0:s.isMergeableObject)=="function"?s.isMergeableObject:n(),g=(s==null?void 0:s.onlyDefinedProperties)===!0;function b(A){return typeof A!="object"||A===null}const v=s&&typeof s.mergeArray=="function"?s.mergeArray({clone:y,deepmerge:w,getKeys:u,isMergeableObject:m}):c;function y(A){return m(A)?Array.isArray(A)?a(A):l(A):A}function k(A,C){const $={},B=u(A),F=u(C);let z,L,O;for(z=0,L=B.length;z<L;++z)i(O=B[z])&&F.indexOf(O)===-1&&($[O]=y(A[O]));for(z=0,L=F.length;z<L;++z)if(i(O=F[z]))if(O in A)B.indexOf(O)!==-1&&(p&&m(C[O])&&Object.getPrototypeOf(C[O])!==t?$[O]=p(C[O]):$[O]=w(A[O],C[O]));else{if(g&&typeof C[O]>"u")continue;$[O]=y(C[O])}return $}function w(A,C){if(g&&typeof C>"u")return y(A);const $=Array.isArray(C),B=Array.isArray(A);return b(C)?C:m(A)?$&&B?v(A,C):$!==B?y(C):k(A,C):y(C)}function j(){switch(arguments.length){case 0:return{};case 1:return y(arguments[0]);case 2:return w(arguments[0],arguments[1])}let A;for(let C=0,$=arguments.length;C<$;++C)A=w(A,arguments[C]);return A}return s!=null&&s.all?j:w}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(k2);var kre=k2.exports;const Sre=il(kre);var Nre=new Error("Element already at target scroll position"),jre=new Error("Scroll cancelled"),Cre=Math.min,U1=Date.now,Ere={left:K1("scrollLeft"),top:K1("scrollTop")};function K1(e){return function(n,r,s,i){s=s||{},typeof s=="function"&&(i=s,s={}),typeof i!="function"&&(i=Pre);var a=U1(),l=n[e],c=s.ease||_re,d=isNaN(s.duration)?350:+s.duration,f=!1;return l===r?i(Nre,n[e]):requestAnimationFrame(p),u;function u(){f=!0}function p(m){if(f)return i(jre,n[e]);var g=U1(),b=Cre(1,(g-a)/d),v=c(b);n[e]=v*(r-l)+l,b<1?requestAnimationFrame(p):requestAnimationFrame(function(){i(null,n[e])})}}}function _re(e){return .5*(1-Math.cos(Math.PI*e))}function Pre(){}const Are=il(Ere);var S2={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(df,function(){function t(r){var s=getComputedStyle(r,null).getPropertyValue("overflow");return s.indexOf("scroll")>-1||s.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var s=r.parentNode;s.parentNode;){if(t(s))return s;s=s.parentNode}return document.scrollingElement||document.documentElement}}return n})})(S2);var Ire=S2.exports;const N2=il(Ire),Tre=["top","right","bottom","left"],q1=["start","end"],Y1=Tre.reduce((e,t)=>e.concat(t,t+"-"+q1[0],t+"-"+q1[1]),[]),Mu=Math.min,ql=Math.max,ag=Math.round,Ph=Math.floor,ko=e=>({x:e,y:e}),Rre={left:"right",right:"left",bottom:"top",top:"bottom"};function Ib(e,t,n){return ql(e,Mu(t,n))}function Uu(e,t){return typeof e=="function"?e(t):e}function sa(e){return e.split("-")[0]}function So(e){return e.split("-")[1]}function j2(e){return e==="x"?"y":"x"}function E0(e){return e==="y"?"height":"width"}function Fa(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function _0(e){return j2(Fa(e))}function C2(e,t,n){n===void 0&&(n=!1);const r=So(e),s=_0(e),i=E0(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=cg(a)),[a,cg(a)]}function Lre(e){const t=cg(e);return[lg(e),t,lg(t)]}function lg(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const G1=["left","right"],X1=["right","left"],Ore=["top","bottom"],Mre=["bottom","top"];function $re(e,t,n){switch(e){case"top":case"bottom":return n?t?X1:G1:t?G1:X1;case"left":case"right":return t?Ore:Mre;default:return[]}}function Dre(e,t,n,r){const s=So(e);let i=$re(sa(e),n==="start",r);return s&&(i=i.map(a=>a+"-"+s),t&&(i=i.concat(i.map(lg)))),i}function cg(e){const t=sa(e);return Rre[t]+e.slice(t.length)}function Fre(e){return{top:0,right:0,bottom:0,left:0,...e}}function E2(e){return typeof e!="number"?Fre(e):{top:e,right:e,bottom:e,left:e}}function ug(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function J1(e,t,n){let{reference:r,floating:s}=e;const i=Fa(t),a=_0(t),l=E0(a),c=sa(t),d=i==="y",f=r.x+r.width/2-s.width/2,u=r.y+r.height/2-s.height/2,p=r[l]/2-s[l]/2;let m;switch(c){case"top":m={x:f,y:r.y-s.height};break;case"bottom":m={x:f,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:u};break;case"left":m={x:r.x-s.width,y:u};break;default:m={x:r.x,y:r.y}}switch(So(t)){case"start":m[a]-=p*(n&&d?-1:1);break;case"end":m[a]+=p*(n&&d?-1:1);break}return m}async function zre(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:a,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:p=!1,padding:m=0}=Uu(t,e),g=E2(m),v=l[p?u==="floating"?"reference":"floating":u],y=ug(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),k=u==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),j=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},A=ug(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:k,offsetParent:w,strategy:c}):k);return{top:(y.top-A.top+g.top)/j.y,bottom:(A.bottom-y.bottom+g.bottom)/j.y,left:(y.left-A.left+g.left)/j.x,right:(A.right-y.right+g.right)/j.x}}const Bre=50,Hre=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:zre},c=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:u}=J1(d,r,c),p=r,m=0;const g={};for(let b=0;b<i.length;b++){const v=i[b];if(!v)continue;const{name:y,fn:k}=v,{x:w,y:j,data:A,reset:C}=await k({x:f,y:u,initialPlacement:r,placement:p,strategy:s,middlewareData:g,rects:d,platform:l,elements:{reference:e,floating:t}});f=w??f,u=j??u,g[y]={...g[y],...A},C&&m<Bre&&(m++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(d=C.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):C.rects),{x:f,y:u}=J1(d,p,c)),b=-1)}return{x:f,y:u,placement:p,strategy:s,middlewareData:g}},Wre=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:a,elements:l,middlewareData:c}=t,{element:d,padding:f=0}=Uu(e,t)||{};if(d==null)return{};const u=E2(f),p={x:n,y:r},m=_0(s),g=E0(m),b=await a.getDimensions(d),v=m==="y",y=v?"top":"left",k=v?"bottom":"right",w=v?"clientHeight":"clientWidth",j=i.reference[g]+i.reference[m]-p[m]-i.floating[g],A=p[m]-i.reference[m],C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let $=C?C[w]:0;(!$||!await(a.isElement==null?void 0:a.isElement(C)))&&($=l.floating[w]||i.floating[g]);const B=j/2-A/2,F=$/2-b[g]/2-1,z=Mu(u[y],F),L=Mu(u[k],F),O=z,W=$-b[g]-L,M=$/2-b[g]/2+B,T=Ib(O,M,W),E=!c.arrow&&So(s)!=null&&M!==T&&i.reference[g]/2-(M<O?z:L)-b[g]/2<0,D=E?M<O?M-O:M-W:0;return{[m]:p[m]+D,data:{[m]:T,centerOffset:M-T-D,...E&&{alignmentOffset:D}},reset:E}}});function Vre(e,t,n){return(e?[...n.filter(s=>So(s)===e),...n.filter(s=>So(s)!==e)]:n.filter(s=>sa(s)===s)).filter(s=>e?So(s)===e||(t?lg(s)!==s:!1):!0)}const Ure=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,s;const{rects:i,middlewareData:a,placement:l,platform:c,elements:d}=t,{crossAxis:f=!1,alignment:u,allowedPlacements:p=Y1,autoAlignment:m=!0,...g}=Uu(e,t),b=u!==void 0||p===Y1?Vre(u||null,m,p):p,v=await c.detectOverflow(t,g),y=((n=a.autoPlacement)==null?void 0:n.index)||0,k=b[y];if(k==null)return{};const w=C2(k,i,await(c.isRTL==null?void 0:c.isRTL(d.floating)));if(l!==k)return{reset:{placement:b[0]}};const j=[v[sa(k)],v[w[0]],v[w[1]]],A=[...((r=a.autoPlacement)==null?void 0:r.overflows)||[],{placement:k,overflows:j}],C=b[y+1];if(C)return{data:{index:y+1,overflows:A},reset:{placement:C}};const $=A.map(z=>{const L=So(z.placement);return[z.placement,L&&f?z.overflows.slice(0,2).reduce((O,W)=>O+W,0):z.overflows[0],z.overflows]}).sort((z,L)=>z[1]-L[1]),F=((s=$.filter(z=>z[2].slice(0,So(z[0])?2:3).every(L=>L<=0))[0])==null?void 0:s[0])||$[0][0];return F!==l?{data:{index:y+1,overflows:A},reset:{placement:F}}:{}}}},Kre=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:a,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...v}=Uu(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=sa(s),k=Fa(l),w=sa(l)===l,j=await(c.isRTL==null?void 0:c.isRTL(d.floating)),A=p||(w||!b?[cg(l)]:Lre(l)),C=g!=="none";!p&&C&&A.push(...Dre(l,b,g,j));const $=[l,...A],B=await c.detectOverflow(t,v),F=[];let z=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&F.push(B[y]),u){const M=C2(s,a,j);F.push(B[M[0]],B[M[1]])}if(z=[...z,{placement:s,overflows:F}],!F.every(M=>M<=0)){var L,O;const M=(((L=i.flip)==null?void 0:L.index)||0)+1,T=$[M];if(T&&(!(u==="alignment"?k!==Fa(T):!1)||z.every(_=>Fa(_.placement)===k?_.overflows[0]>0:!0)))return{data:{index:M,overflows:z},reset:{placement:T}};let E=(O=z.filter(D=>D.overflows[0]<=0).sort((D,_)=>D.overflows[1]-_.overflows[1])[0])==null?void 0:O.placement;if(!E)switch(m){case"bestFit":{var W;const D=(W=z.filter(_=>{if(C){const R=Fa(_.placement);return R===k||R==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(R=>R>0).reduce((R,P)=>R+P,0)]).sort((_,R)=>_[1]-R[1])[0])==null?void 0:W[0];D&&(E=D);break}case"initialPlacement":E=l;break}if(s!==E)return{reset:{placement:E}}}return{}}}},qre=new Set(["left","top"]);async function Yre(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=sa(n),l=So(n),c=Fa(n)==="y",d=qre.has(a)?-1:1,f=i&&c?-1:1,u=Uu(t,e);let{mainAxis:p,crossAxis:m,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&typeof g=="number"&&(m=l==="end"?g*-1:g),c?{x:m*f,y:p*d}:{x:p*d,y:m*f}}const Gre=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:a,middlewareData:l}=t,c=await Yre(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:a}}}}},Xre=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:y=>{let{x:k,y:w}=y;return{x:k,y:w}}},...d}=Uu(e,t),f={x:n,y:r},u=await i.detectOverflow(t,d),p=Fa(sa(s)),m=j2(p);let g=f[m],b=f[p];if(a){const y=m==="y"?"top":"left",k=m==="y"?"bottom":"right",w=g+u[y],j=g-u[k];g=Ib(w,g,j)}if(l){const y=p==="y"?"top":"left",k=p==="y"?"bottom":"right",w=b+u[y],j=b-u[k];b=Ib(w,b,j)}const v=c.fn({...t,[m]:g,[p]:b});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[m]:a,[p]:l}}}}}};function Xg(){return typeof window<"u"}function Ku(e){return _2(e)?(e.nodeName||"").toLowerCase():"#document"}function Ks(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function _o(e){var t;return(t=(_2(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function _2(e){return Xg()?e instanceof Node||e instanceof Ks(e).Node:!1}function Wi(e){return Xg()?e instanceof Element||e instanceof Ks(e).Element:!1}function aa(e){return Xg()?e instanceof HTMLElement||e instanceof Ks(e).HTMLElement:!1}function Q1(e){return!Xg()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ks(e).ShadowRoot}function xp(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Vi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function Jre(e){return/^(table|td|th)$/.test(Ku(e))}function Jg(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Qre=/transform|translate|scale|rotate|perspective|filter/,Zre=/paint|layout|strict|content/,Il=e=>!!e&&e!=="none";let Lx;function P0(e){const t=Wi(e)?Vi(e):e;return Il(t.transform)||Il(t.translate)||Il(t.scale)||Il(t.rotate)||Il(t.perspective)||!A0()&&(Il(t.backdropFilter)||Il(t.filter))||Qre.test(t.willChange||"")||Zre.test(t.contain||"")}function ese(e){let t=sl(e);for(;aa(t)&&!$u(t);){if(P0(t))return t;if(Jg(t))return null;t=sl(t)}return null}function A0(){return Lx==null&&(Lx=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Lx}function $u(e){return/^(html|body|#document)$/.test(Ku(e))}function Vi(e){return Ks(e).getComputedStyle(e)}function Qg(e){return Wi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function sl(e){if(Ku(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Q1(e)&&e.host||_o(e);return Q1(t)?t.host:t}function P2(e){const t=sl(e);return $u(t)?e.ownerDocument?e.ownerDocument.body:e.body:aa(t)&&xp(t)?t:P2(t)}function Gf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=P2(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),a=Ks(s);if(i){const l=Tb(a);return t.concat(a,a.visualViewport||[],xp(s)?s:[],l&&n?Gf(l):[])}else return t.concat(s,Gf(s,[],n))}function Tb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function A2(e){const t=Vi(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=aa(e),i=s?e.offsetWidth:n,a=s?e.offsetHeight:r,l=ag(n)!==i||ag(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function I0(e){return Wi(e)?e:e.contextElement}function gu(e){const t=I0(e);if(!aa(t))return ko(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=A2(t);let a=(i?ag(n.width):n.width)/r,l=(i?ag(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const tse=ko(0);function I2(e){const t=Ks(e);return!A0()||!t.visualViewport?tse:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nse(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ks(e)?!1:t}function sc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=I0(e);let a=ko(1);t&&(r?Wi(r)&&(a=gu(r)):a=gu(e));const l=nse(i,n,r)?I2(i):ko(0);let c=(s.left+l.x)/a.x,d=(s.top+l.y)/a.y,f=s.width/a.x,u=s.height/a.y;if(i){const p=Ks(i),m=r&&Wi(r)?Ks(r):r;let g=p,b=Tb(g);for(;b&&r&&m!==g;){const v=gu(b),y=b.getBoundingClientRect(),k=Vi(b),w=y.left+(b.clientLeft+parseFloat(k.paddingLeft))*v.x,j=y.top+(b.clientTop+parseFloat(k.paddingTop))*v.y;c*=v.x,d*=v.y,f*=v.x,u*=v.y,c+=w,d+=j,g=Ks(b),b=Tb(g)}}return ug({width:f,height:u,x:c,y:d})}function Zg(e,t){const n=Qg(e).scrollLeft;return t?t.left+n:sc(_o(e)).left+n}function T2(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Zg(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function rse(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",a=_o(r),l=t?Jg(t.floating):!1;if(r===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},d=ko(1);const f=ko(0),u=aa(r);if((u||!u&&!i)&&((Ku(r)!=="body"||xp(a))&&(c=Qg(r)),u)){const m=sc(r);d=gu(r),f.x=m.x+r.clientLeft,f.y=m.y+r.clientTop}const p=a&&!u&&!i?T2(a,c):ko(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+p.x,y:n.y*d.y-c.scrollTop*d.y+f.y+p.y}}function sse(e){return Array.from(e.getClientRects())}function ise(e){const t=_o(e),n=Qg(e),r=e.ownerDocument.body,s=ql(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ql(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Zg(e);const l=-n.scrollTop;return Vi(r).direction==="rtl"&&(a+=ql(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:l}}const Z1=25;function ose(e,t){const n=Ks(e),r=_o(e),s=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,c=0;if(s){i=s.width,a=s.height;const f=A0();(!f||f&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const d=Zg(r);if(d<=0){const f=r.ownerDocument,u=f.body,p=getComputedStyle(u),m=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-u.clientWidth-m);g<=Z1&&(i-=g)}else d<=Z1&&(i+=d);return{width:i,height:a,x:l,y:c}}function ase(e,t){const n=sc(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=aa(e)?gu(e):ko(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,c=s*i.x,d=r*i.y;return{width:a,height:l,x:c,y:d}}function eC(e,t,n){let r;if(t==="viewport")r=ose(e,n);else if(t==="document")r=ise(_o(e));else if(Wi(t))r=ase(t,n);else{const s=I2(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return ug(r)}function R2(e,t){const n=sl(e);return n===t||!Wi(n)||$u(n)?!1:Vi(n).position==="fixed"||R2(n,t)}function lse(e,t){const n=t.get(e);if(n)return n;let r=Gf(e,[],!1).filter(l=>Wi(l)&&Ku(l)!=="body"),s=null;const i=Vi(e).position==="fixed";let a=i?sl(e):e;for(;Wi(a)&&!$u(a);){const l=Vi(a),c=P0(a);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||xp(a)&&!c&&R2(e,a))?r=r.filter(f=>f!==a):s=l,a=sl(a)}return t.set(e,r),r}function cse(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?Jg(t)?[]:lse(t,this._c):[].concat(n),r],l=eC(t,a[0],s);let c=l.top,d=l.right,f=l.bottom,u=l.left;for(let p=1;p<a.length;p++){const m=eC(t,a[p],s);c=ql(m.top,c),d=Mu(m.right,d),f=Mu(m.bottom,f),u=ql(m.left,u)}return{width:d-u,height:f-c,x:u,y:c}}function use(e){const{width:t,height:n}=A2(e);return{width:t,height:n}}function dse(e,t,n){const r=aa(t),s=_o(t),i=n==="fixed",a=sc(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=ko(0);function d(){c.x=Zg(s)}if(r||!r&&!i)if((Ku(t)!=="body"||xp(s))&&(l=Qg(t)),r){const m=sc(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else s&&d();i&&!r&&s&&d();const f=s&&!r&&!i?T2(s,l):ko(0),u=a.left+l.scrollLeft-c.x-f.x,p=a.top+l.scrollTop-c.y-f.y;return{x:u,y:p,width:a.width,height:a.height}}function Ox(e){return Vi(e).position==="static"}function tC(e,t){if(!aa(e)||Vi(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return _o(e)===n&&(n=n.ownerDocument.body),n}function L2(e,t){const n=Ks(e);if(Jg(e))return n;if(!aa(e)){let s=sl(e);for(;s&&!$u(s);){if(Wi(s)&&!Ox(s))return s;s=sl(s)}return n}let r=tC(e,t);for(;r&&Jre(r)&&Ox(r);)r=tC(r,t);return r&&$u(r)&&Ox(r)&&!P0(r)?n:r||ese(e)||n}const fse=async function(e){const t=this.getOffsetParent||L2,n=this.getDimensions,r=await n(e.floating);return{reference:dse(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function pse(e){return Vi(e).direction==="rtl"}const hse={convertOffsetParentRelativeRectToViewportRelativeRect:rse,getDocumentElement:_o,getClippingRect:cse,getOffsetParent:L2,getElementRects:fse,getClientRects:sse,getDimensions:use,getScale:gu,isElement:Wi,isRTL:pse};function O2(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function mse(e,t){let n=null,r;const s=_o(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const d=e.getBoundingClientRect(),{left:f,top:u,width:p,height:m}=d;if(l||t(),!p||!m)return;const g=Ph(u),b=Ph(s.clientWidth-(f+p)),v=Ph(s.clientHeight-(u+m)),y=Ph(f),w={rootMargin:-g+"px "+-b+"px "+-v+"px "+-y+"px",threshold:ql(0,Mu(1,c))||1};let j=!0;function A(C){const $=C[0].intersectionRatio;if($!==c){if(!j)return a();$?a(!1,$):r=setTimeout(()=>{a(!1,1e-7)},1e3)}$===1&&!O2(d,e.getBoundingClientRect())&&a(),j=!1}try{n=new IntersectionObserver(A,{...w,root:s.ownerDocument})}catch{n=new IntersectionObserver(A,w)}n.observe(e)}return a(!0),i}function nC(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=I0(e),f=s||i?[...d?Gf(d):[],...t?Gf(t):[]]:[];f.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const u=d&&l?mse(d,n):null;let p=-1,m=null;a&&(m=new ResizeObserver(y=>{let[k]=y;k&&k.target===d&&m&&t&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=m)==null||w.observe(t)})),n()}),d&&!c&&m.observe(d),t&&m.observe(t));let g,b=c?sc(e):null;c&&v();function v(){const y=sc(e);b&&!O2(b,y)&&n(),b=y,g=requestAnimationFrame(v)}return n(),()=>{var y;f.forEach(k=>{s&&k.removeEventListener("scroll",n),i&&k.removeEventListener("resize",n)}),u==null||u(),(y=m)==null||y.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const gse=Gre,yse=Ure,xse=Xre,wse=Kre,rC=Wre,bse=(e,t,n)=>{const r=new Map,s={platform:hse,...n},i={...s.platform,_c:r};return Hre(e,t,{...s,platform:i})};var vse=typeof document<"u",kse=function(){},nm=vse?h.useLayoutEffect:kse;function dg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!dg(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!dg(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function M2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function sC(e,t){const n=M2(e);return Math.round(t*n)/n}function Mx(e){const t=h.useRef(e);return nm(()=>{t.current=e}),t}function iC(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[f,u]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=h.useState(r);dg(p,r)||m(r);const[g,b]=h.useState(null),[v,y]=h.useState(null),k=h.useCallback(_=>{_!==C.current&&(C.current=_,b(_))},[]),w=h.useCallback(_=>{_!==$.current&&($.current=_,y(_))},[]),j=i||g,A=a||v,C=h.useRef(null),$=h.useRef(null),B=h.useRef(f),F=c!=null,z=Mx(c),L=Mx(s),O=Mx(d),W=h.useCallback(()=>{if(!C.current||!$.current)return;const _={placement:t,strategy:n,middleware:p};L.current&&(_.platform=L.current),bse(C.current,$.current,_).then(R=>{const P={...R,isPositioned:O.current!==!1};M.current&&!dg(B.current,P)&&(B.current=P,$r.flushSync(()=>{u(P)}))})},[p,t,n,L,O]);nm(()=>{d===!1&&B.current.isPositioned&&(B.current.isPositioned=!1,u(_=>({..._,isPositioned:!1})))},[d]);const M=h.useRef(!1);nm(()=>(M.current=!0,()=>{M.current=!1}),[]),nm(()=>{if(j&&(C.current=j),A&&($.current=A),j&&A){if(z.current)return z.current(j,A,W);W()}},[j,A,W,z,F]);const T=h.useMemo(()=>({reference:C,floating:$,setReference:k,setFloating:w}),[k,w]),E=h.useMemo(()=>({reference:j,floating:A}),[j,A]),D=h.useMemo(()=>{const _={position:n,left:0,top:0};if(!E.floating)return _;const R=sC(E.floating,f.x),P=sC(E.floating,f.y);return l?{..._,transform:"translate("+R+"px, "+P+"px)",...M2(E.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:R,top:P}},[n,l,E.floating,f.x,f.y]);return h.useMemo(()=>({...f,update:W,refs:T,elements:E,floatingStyles:D}),[f,W,T,E,D])}const Sse=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?rC({element:r.current,padding:s}).fn(n):{}:r?rC({element:r,padding:s}).fn(n):{}}}},oC=(e,t)=>{const n=gse(e);return{name:n.name,fn:n.fn,options:[e,t]}},Nse=(e,t)=>{const n=xse(e);return{name:n.name,fn:n.fn,options:[e,t]}},jse=(e,t)=>{const n=wse(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cse=(e,t)=>{const n=yse(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ese=(e,t)=>{const n=Sse(e);return{name:n.name,fn:n.fn,options:[e,t]}},_se={arrowBase:32,arrowColor:"#ffffff",arrowSize:16,arrowSpacing:12,backgroundColor:"#ffffff",beaconSize:36,beaconTrigger:"click",beforeTimeout:5e3,blockTargetInteraction:!1,buttons:["back","close","primary"],closeButtonAction:"close",disableFocusTrap:!1,dismissKeyAction:"close",hideOverlay:!1,loaderDelay:300,offset:10,overlayClickAction:"close",overlayColor:"#00000080",primaryColor:"#000000",scrollDuration:300,scrollOffset:20,showProgress:!1,skipBeacon:!1,skipScroll:!1,spotlightPadding:10,spotlightRadius:4,targetWaitTimeout:1e3,textColor:"#000000",width:380,zIndex:100},Pse={beaconOptions:{offset:-18}},$2={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},Ase={isFixed:!1,locale:$2,placement:"bottom"},Ise={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},Ft={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update",COMPLETE:"complete"},_r={TOUR_START:"tour:start",STEP_BEFORE_HOOK:"step:before_hook",STEP_BEFORE:"step:before",SCROLL_START:"scroll:start",SCROLL_END:"scroll:end",BEACON:"beacon",TOOLTIP:"tooltip",STEP_AFTER:"step:after",STEP_AFTER_HOOK:"step:after_hook",TOUR_END:"tour:end",TOUR_STATUS:"tour:status",TARGET_NOT_FOUND:"error:target_not_found",ERROR:"error"},We={INIT:"init",READY:"ready",BEACON_BEFORE:"beacon_before",BEACON:"beacon",TOOLTIP_BEFORE:"tooltip_before",TOOLTIP:"tooltip",COMPLETE:"complete"},po={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},Rt={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},Tse="react-joyride-portal";function Rse(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function su(...e){return Sre({all:!0,isMergeableObject:t=>!(!Xr.plainObject(t)||h.isValidElement(t))})(...e)}function D2(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function Uo(e,t={}){const{defaultValue:n,step:r,steps:s}=t;let i=Rx(e);if(i)(i.includes("{current}")||i.includes("{total}"))&&r&&s&&(i=i.replace("{current}",r.toString()).replace("{total}",s.toString()));else if(h.isValidElement(e)&&!Object.values(e.props).length&&D2(e.type)==="function")try{i=Uo(e.type({}),t)}catch{i=Rx(n)}else i=Rx(n);return i}function Ar(e,t,n,...r){if(!e)return;const s=new Date,i=`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}:${String(s.getSeconds()).padStart(2,"0")}.${String(s.getMilliseconds()).padStart(3,"0")}`;console.log(`${t} %c${n}%c ${i}`,"font-weight: bold","color: gray; font-weight: normal",...r)}function Lse(e,t){const n=Rse(t);return{...e,...n}}function Xf(){}function Ose(e){return Object.keys(e)}function fg(e,...t){if(!Xr.plainObject(e))throw new TypeError("Expected an object");const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&(t.includes(r)||(n[r]=e[r]));return n}function aC(e,...t){if(!Xr.plainObject(e))throw new TypeError("Expected an object");if(!t.length)return e;const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&t.includes(r)&&(n[r]=e[r]);return n}function Rb(e,t,n){const r=i=>i.replace("{current}",String(t)).replace("{total}",String(n));if(D2(e)==="string")return r(e);if(!h.isValidElement(e))return e;const{children:s}=e.props;if(Xr.string(s)&&s.includes("{current}"))return h.cloneElement(e,{children:r(s)});if(Array.isArray(s))return h.cloneElement(e,{children:s.map(i=>typeof i=="string"?r(i):Rb(i,t,n))});if(Xr.function(e.type)&&!Object.values(e.props).length)try{return Rb(e.type({}),t,n)}catch{return e}return e}function lC(e){return Ose(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function T0(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function cC(e){let t=0,n=0,r=e;for(;r;)t+=r.offsetTop,n+=r.offsetLeft,r=r.offsetParent;return{left:n,top:t}}function R0(e){return e?e.getBoundingClientRect():null}function Mse(e=!1){const{body:t,documentElement:n}=document;if(!t||!n)return 0;if(e){const r=[t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight].sort((i,a)=>i-a),s=Math.floor(r.length/2);return r.length%2===0?(r[s-1]+r[s])/2:r[s]}return Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function pi(e){if(!e)return null;if(typeof e=="function")try{return e()}catch{return null}if(typeof e=="object"&&"current"in e)return e.current;if(typeof e=="string")try{return document.querySelector(e)}catch{return null}return e}function $se(e,t,n){const r=R0(e),s=qu(e),i=s?!s.isSameNode(Ss()):!1,a=n??Yu(e);let l=0,c=(r==null?void 0:r.top)??0;return i&&a?c=(r==null?void 0:r.top)??0:s instanceof HTMLElement&&(l=s.scrollTop,!i&&!a&&(c+=l),s.isSameNode(Ss())||(c+=Ss().scrollTop)),Math.floor(c-t)}function qu(e,t){if(!e)return Ss();const n=N2(e);if(n){if(n.isSameNode(Ss()))return t?document:Ss();if(!(n.scrollHeight>n.offsetHeight))return Ss()}return n}function Dse(e){const t=e.getBoundingClientRect(),n=Ss(),r=t.top+t.height/2,s=window.innerHeight/2;return Math.max(0,n.scrollTop+r-s)}function Fse(e,t){if(!e)return 0;const n=N2(e)??Ss(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,s=R0(n),i=n.scrollTop??0,{offsetTop:a=0,scrollTop:l=0}=n;let c=e.getBoundingClientRect().top+l;if(a&&(F2(e)||zse(e))){const f=e.getBoundingClientRect(),u=f.top-((s==null?void 0:s.top)??0),p=u+f.height,m=n.clientHeight,g=m*.2;u>=g&&p<=m-g?c=i:c=u+i}const d=Math.floor(c-t-r);return d<0?0:d}function zse(e){return e.offsetParent!==document.body}function F2(e){if(!e)return!1;const t=qu(e);return t?!t.isSameNode(Ss()):!1}function Yu(e,t="fixed"){if(!e||!(e instanceof Element))return!1;const{nodeName:n}=e;return n==="BODY"||n==="HTML"?!1:getComputedStyle(e).position===t?!0:e.parentNode?Yu(e.parentNode,t):!1}function Ah(e){if(!e)return!1;let t=e;for(;t&&t!==document.body;){if(t instanceof HTMLElement){const{display:n,visibility:r}=getComputedStyle(t);if(n==="none"||r==="hidden")return!1}t=t.parentElement??null}return!0}function uC(e){const{isFirstStep:t,scrollToFirstStep:n,step:r,target:s,targetLifecycle:i}=e;if(r.skipScroll||t&&!n&&i!==We.TOOLTIP||r.placement==="center")return!1;const a=s!=null&&s.isConnected?qu(s):Ss(),l=a?!a.isSameNode(Ss()):!1;return(r.isFixed||Yu(s))&&!l?!1:a.scrollHeight>a.clientHeight}function Ss(){return document.scrollingElement??document.documentElement}function dC(e,t){const{duration:n,element:r}=t;let s=()=>{};const i=new Promise(a=>{const{scrollTop:l}=r,c=e>l?e-l:l-e;s=Are.top(r,e,{duration:c<100?50:n},()=>{a()})});return{cancel:s,promise:i}}function Bse(e){const t=e.replace(/^#?([\da-f])([\da-f])([\da-f])$/i,(r,s,i,a)=>s+s+i+i+a+a),n=/^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})/i.exec(t);return n?[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)]:[]}const z2={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},Ih={...z2,borderRadius:4,padding:8};function Hse(e,t){const{styles:n}=e,r=su(n??{},t.styles??{});let{width:s}=t;T0()&&(s=typeof s=="number"&&window.innerWidth<s?window.innerWidth-30:s);const i={bottom:0,left:0,overflow:"hidden",position:"absolute",right:0,top:0,zIndex:t.zIndex};return su({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...z2,display:"inline-flex",borderRadius:"50%",position:"relative"},beacon:{height:t.beaconSize,width:t.beaconSize},beaconInner:{animation:"joyride-beacon-inner 1.2s infinite ease-in-out",backgroundColor:t.primaryColor,borderRadius:"50%",display:"block",height:"50%",left:"50%",opacity:.7,position:"absolute",top:"50%",transform:"translate(-50%, -50%)",width:"50%"},beaconOuter:{animation:"joyride-beacon-outer 1.2s infinite ease-in-out",backgroundColor:`rgba(${Bse(t.primaryColor).join(",")}, 0.2)`,border:`2px solid ${t.primaryColor}`,borderRadius:"50%",boxSizing:"border-box",display:"block",height:"100%",left:0,opacity:.9,position:"absolute",top:0,transformOrigin:"center",width:"100%"},buttonBack:{...Ih,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...Ih,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...Ih,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...Ih,color:t.textColor,fontSize:14},floater:{display:"inline-block",filter:"drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))",maxWidth:"100%",transition:"opacity 0.3s"},loader:{alignItems:"center",display:"flex",height:48,inset:0,justifyContent:"center",pointerEvents:"none",position:"fixed",width:48,zIndex:t.zIndex+1},overlay:{...i,backgroundColor:t.overlayColor},spotlight:{},tooltip:{backgroundColor:t.backgroundColor,borderRadius:5,boxSizing:"border-box",color:t.textColor,fontSize:16,maxWidth:"100%",padding:12,position:"relative",width:s},tooltipContainer:{lineHeight:1.4,textAlign:"center"},tooltipTitle:{fontSize:18,margin:0},tooltipContent:{paddingBottom:12,paddingTop:12},tooltipFooter:{alignItems:"center",display:"flex",justifyContent:"flex-end"},tooltipFooterSpacer:{flex:1}},r)}const Wse=["after","arrowBase","arrowColor","arrowSize","arrowSpacing","backgroundColor","beaconSize","beaconTrigger","before","beforeTimeout","buttons","closeButtonAction","skipBeacon","dismissKeyAction","disableFocusTrap","hideOverlay","skipScroll","blockTargetInteraction","loaderDelay","offset","overlayClickAction","overlayColor","primaryColor","scrollDuration","scrollOffset","showProgress","spotlightPadding","spotlightRadius","targetWaitTimeout","textColor","width","zIndex"];function L0(e,t){if(!t)return null;const n=su(Ase,aC(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=su(_se,e.options??{},aC(t,...Wse)),s=Hse(e,{...n,...r}),i=su(Pse,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:su($2,e.locale??{},n.locale||{}),floatingOptions:i,spotlightPadding:Vse(r.spotlightPadding),styles:s}}function Vse(e){return typeof e=="number"?{top:e,right:e,bottom:e,left:e}:{top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0,left:(e==null?void 0:e.left)??0}}function Use(e,t,n){const{action:r}=t,s=n&&[Ft.PREV,Ft.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||s}function B2(e,t=!1){return Xr.plainObject(e)?e.target?!0:(Ar(t,"tour","target is missing from the step"),!1):(Ar(t,"tour","step must be an object"),!1)}function H2(e,t=!1){return Xr.array(e)?e.every(n=>B2(n,t)):(Ar(t,"tour","steps must be an array"),!1)}var Kse=class{constructor(e){er(this,"beaconPosition",null);er(this,"debug");er(this,"eventListeners",new Map);er(this,"listeners",new Set);er(this,"props");er(this,"snapshot");er(this,"state");er(this,"steps");er(this,"tooltipPosition",null);er(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});er(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);er(this,"getServerSnapshot",()=>this.snapshot);er(this,"getSnapshot",()=>this.snapshot);er(this,"getEventState",()=>fg(this.snapshot,"positioned"));er(this,"getState",()=>fg(this.snapshot,"positioned"));er(this,"setPositionData",(e,t)=>{var r,s,i;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&Ar(this.debug,`step:${this.state.index}`,"positioned",`${e} ${t.placement}`),e==="beacon"?this.beaconPosition=t:this.tooltipPosition=t,(this.state.lifecycle===We.BEACON_BEFORE||this.state.lifecycle===We.TOOLTIP_BEFORE)&&!this.state.positioned&&this.updateState({positioned:!0});const n=(i=(s=this.getStep())==null?void 0:s.floatingOptions)==null?void 0:i.onPosition;n&&n(t)});er(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});er(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});er(this,"on",(e,t)=>{let n=this.eventListeners.get(e);return n||(n=new Set,this.eventListeners.set(e,n)),n.add(t),()=>{n.delete(t)}});er(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));er(this,"updateState",(e,t=!1)=>{const{controlled:n,index:r}=this.state,s=this.snapshot,i=n&&!t&&e.index!==void 0?r:e.index??r,a={action:e.action??this.state.action,controlled:n,index:i,lifecycle:e.lifecycle??this.state.lifecycle,origin:e.origin??null,positioned:e.positioned??this.state.positioned,scrolling:e.scrolling??this.state.scrolling,size:e.size??this.state.size,status:e.status??this.state.status,waiting:e.waiting??this.state.waiting},l=this.applyTransitions(a);if(this.state=l,!S0(s,l)){this.snapshot=Object.freeze({...l});for(const c of this.listeners)c(this.snapshot)}});const{initialStepIndex:t,stepIndex:n,steps:r=[]}=e??{},s=Xr.number(n);let i=0;this.debug=(e==null?void 0:e.debug)??!1,s?(i=n,Xr.number(t)&&Ar(this.debug,"tour","initialStepIndex is ignored in controlled mode")):Xr.number(t)&&(t>=0&&t<r.length?i=t:r.length>0&&Ar(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:Ft.INIT,controlled:s,index:i,lifecycle:We.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?Rt.READY:Rt.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===Rt.WAITING&&e.size>0?{...e,status:Rt.RUNNING}:e}getStep(e){return L0(this.props,this.steps[e??this.state.index])}};function qse(e){return new Kse(e)}function fC(e,t){return Math.min(Math.max(e,0),t)}function Yse(e,t,n){const r=h.useRef(t),s=h.useRef(n);return r.current=t,s.current=n,h.useMemo(()=>{const i=()=>e.current.getSnapshot();return{close:(v=null)=>{const{index:y,status:k}=i();k===Rt.RUNNING&&e.current.updateState({action:Ft.CLOSE,index:y+1,origin:v,lifecycle:We.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:v=>{const{controlled:y,size:k,status:w}=i();if(y){Ar(r.current,"tour","go() is not supported in controlled mode");return}w===Rt.RUNNING&&e.current.updateState({action:Ft.GO,index:v,lifecycle:We.COMPLETE,positioned:!1,scrolling:!1,status:v<k?w:Rt.FINISHED,waiting:!1})},info:()=>fg(e.current.getSnapshot(),"positioned"),next:v=>{const{index:y,size:k,status:w}=i();w===Rt.RUNNING&&e.current.updateState({action:Ft.NEXT,index:fC(y+1,k),lifecycle:We.COMPLETE,origin:v,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:v}=i();v===Rt.RUNNING&&e.current.updateState({action:Ft.UPDATE,lifecycle:We.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:v=>{const{index:y,size:k,status:w}=i();w===Rt.RUNNING&&e.current.updateState({action:Ft.PREV,index:fC(y-1,k),lifecycle:We.COMPLETE,origin:v,positioned:!1,scrolling:!1,waiting:!1})},reset:(v=!1)=>{const{controlled:y}=i();if(y){Ar(r.current,"tour","reset() is not supported in controlled mode");return}s.current(),e.current.updateState({action:Ft.RESET,index:0,lifecycle:We.INIT,positioned:!1,scrolling:!1,status:v?Rt.RUNNING:Rt.READY,waiting:!1})},skip:v=>{const{status:y}=i();y===Rt.RUNNING&&e.current.updateState({action:Ft.SKIP,lifecycle:We.COMPLETE,origin:v,positioned:!1,scrolling:!1,status:Rt.SKIPPED,waiting:!1})},start:v=>{const{index:y,size:k}=i();s.current(),e.current.updateState({action:Ft.START,index:Xr.number(v)?v:y,lifecycle:We.INIT,positioned:!1,scrolling:!1,status:k?Rt.RUNNING:Rt.WAITING,waiting:!1},!0)},stop:(v=!1)=>{const{index:y,status:k}=i();[Rt.FINISHED,Rt.SKIPPED].includes(k)||e.current.updateState({action:Ft.STOP,index:y+(v?1:0),lifecycle:We.COMPLETE,positioned:!1,scrolling:!1,status:Rt.PAUSED,waiting:!1})}}},[e])}const Gse=new Set(["origin","positioned"]);function Xse(e,t){const n=h.useRef(null);h.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return Ar(!0,"tour","init",r),n.current=r,e.current.subscribe(s=>{const i=n.current;if(n.current=s,!i)return;const a={};let l=!1;for(const c of Object.keys(s))s[c]!==i[c]&&!Gse.has(c)&&(a[c]={from:i[c],to:s[c]},(c==="status"||c==="size")&&(l=!0));Object.keys(a).length&&(!l&&s.index>=s.size||Ar(!0,l?"tour":`step:${s.index}`,"state",a))})},[t,e])}function Jse(e,t,n){const r=h.useRef(e),s=h.useRef(t);return r.current=e,s.current=t,h.useCallback((i,a,l)=>{var d;const c={...n.current.getEventState(),error:null,scroll:null,step:a,type:i,...l};(d=r.current)==null||d.call(r,c,s.current),n.current.dispatch(c,s.current)},[n])}function Ta(e,t){return{hasChanged(n){return e[n]!==t[n]},hasChangedTo(n,r){const s=e[n],i=t[n];return Array.isArray(r)?r.includes(s)&&!r.includes(i):s===r&&i!==r},previous:t}}function Qse(e){const{addFailure:t,controls:n,emitEvent:r,previousState:s,props:i,state:a,step:l,store:c}=e,{action:d,index:f,lifecycle:u,positioned:p,scrolling:m,size:g,status:b}=a,v=g2(l)??null,y=h.useRef(null),k=h.useRef(i),w=h.useRef(a),j=h.useRef(s),A=h.useRef(l),C=h.useRef(v),$=h.useRef(n),B=h.useRef(null),F=h.useRef(null),z=h.useRef(null);k.current=i,w.current=a,j.current=s,A.current=l,C.current=v,$.current=n;const L=()=>{B.current&&(clearInterval(B.current),B.current=null),F.current=null,z.current&&(z.current.cancel(),z.current=null)};h.useEffect(()=>{if(!j.current)return;const{hasChangedTo:O}=Ta(w.current,j.current);(O("action",[Ft.NEXT,Ft.PREV,Ft.SKIP,Ft.CLOSE])||y.current===Ft.CLOSE&&d===Ft.START)&&(y.current=d)},[d]),h.useEffect(()=>{if(!j.current)return()=>{L()};const{hasChanged:O}=Ta(w.current,j.current),W=A.current;if(O("index")&&L(),b!==Rt.RUNNING||!W||u!==We.INIT)return()=>{L()};const{hasChangedTo:M}=Ta(w.current,j.current);M("status",Rt.RUNNING)&&[Rt.IDLE,Rt.READY,Rt.PAUSED].includes(j.current.status)&&r(_r.TOUR_START,W),c.current.cleanupPositionData();const{debug:T}=k.current;if(W.before&&!z.current){Ar(T,`step:${f}`,"before()",W),z.current={cancel:()=>{}},c.current.updateState({waiting:!0}),r(_r.STEP_BEFORE_HOOK,W,{action:y.current??w.current.action});const E=()=>{z.current=null,c.current.updateState({action:y.current??w.current.action,waiting:!1,lifecycle:We.READY})},D=new AbortController,_=W.beforeTimeout;z.current={cancel:()=>D.abort()};const R=_?setTimeout(()=>{D.signal.aborted||(Ar(T,`step:${f}`,"before()","timed out",`${_}ms`),D.abort(),t(W,"before_hook"),r(_r.ERROR,W,{error:new Error("Step before hook timed out")}),E())},_):null;W.before({...c.current.getState(),action:y.current??c.current.getState().action,step:W}).then(()=>{D.signal.aborted||(R&&clearTimeout(R),E())}).catch(P=>{D.signal.aborted||(R&&clearTimeout(R),t(W,"before_hook"),r(_r.ERROR,W,{error:P instanceof Error?P:new Error(String(P))}),E())})}else if(!z.current){B.current&&F.current!==W.target&&L();const E=pi(W.target);if(E&&Ah(E))L(),c.current.updateState({action:y.current??Ft.UPDATE,lifecycle:We.READY,waiting:!1});else if(W.targetWaitTimeout===0)c.current.updateState({action:y.current??Ft.UPDATE,lifecycle:We.READY,waiting:!1});else if(!B.current){const{targetWaitTimeout:D}=W,_=Date.now();F.current=W.target,Ar(T,`step:${f}`,"polling","started",`${D}ms`),c.current.updateState({waiting:!0}),B.current=setInterval(()=>{const R=pi(W.target),P=Date.now()-_,X=P>=D;(R&&Ah(R)||X)&&(Ar(T,`step:${f}`,"polling",R&&Ah(R)?"found":"timed out",`${P}ms`),L(),c.current.updateState({action:y.current??Ft.UPDATE,lifecycle:We.READY,waiting:!1}))},100)}}return()=>{L()}},[t,r,f,u,b,c]),h.useEffect(()=>{if(!j.current)return;const{hasChanged:O,hasChangedTo:W,previous:M}=Ta(w.current,j.current),T=A.current;if(!T)return;const E=pi(T.target),D=!!E;if(D&&Ah(E)){if(W("lifecycle",We.READY)&&M.lifecycle===We.INIT&&r(_r.STEP_BEFORE,T,{action:y.current??w.current.action}),W("lifecycle",We.READY)){const _=w.current,R=Use(T,_,k.current.continuous)?We.TOOLTIP:We.BEACON,P=pi(T.scrollTarget??T.spotlightTarget??T.target),X=uC({isFirstStep:_.index===0,scrollToFirstStep:k.current.scrollToFirstStep,step:T,target:P,targetLifecycle:R}),Z=R===We.TOOLTIP?We.TOOLTIP_BEFORE:We.BEACON_BEFORE;Ar(k.current.debug,`step:${f}`,"scroll",X?"needed":"skipped"),c.current.updateState({action:Ft.UPDATE,lifecycle:Z,scrolling:X})}}else if(w.current.status===Rt.RUNNING&&u!==We.INIT&&u!==We.COMPLETE&&O("lifecycle")){Ar(k.current.debug,`step:${f}`,D?"Target not visible":"Target not mounted",T),t(T,"target_not_found"),r(_r.TARGET_NOT_FOUND,T);const _=w.current;_.controlled||c.current.updateState({action:Ft.UPDATE,index:_.index+(_.action===Ft.PREV?-1:1),lifecycle:We.INIT})}},[t,r,f,u,c]),h.useEffect(()=>{if(!j.current)return;const{hasChangedTo:O,previous:W}=Ta(w.current,j.current),M=A.current,T=C.current;if(M&&O("lifecycle",We.TOOLTIP_BEFORE)&&W.lifecycle===We.BEACON){const _=pi(M.scrollTarget??M.spotlightTarget??M.target);if(uC({isFirstStep:w.current.index===0,scrollToFirstStep:k.current.scrollToFirstStep,step:M,target:_,targetLifecycle:We.TOOLTIP})){c.current.updateState({scrolling:!0,positioned:!1});return}}const E=u===We.BEACON_BEFORE||u===We.TOOLTIP_BEFORE;if(M&&E&&!m){const _=u===We.TOOLTIP_BEFORE?We.TOOLTIP:We.BEACON;c.current.updateState({action:Ft.UPDATE,lifecycle:_})}M&&O("lifecycle",We.BEACON)&&r(_r.BEACON,M),M&&O("lifecycle",We.TOOLTIP)&&r(_r.TOOLTIP,M);const D=w.current;if((D.status===Rt.RUNNING||D.controlled&&D.status===Rt.PAUSED&&M)&&T&&O("lifecycle",We.COMPLETE)&&W.lifecycle===We.TOOLTIP&&(r(_r.STEP_AFTER,T,{action:y.current??Ft.UPDATE,index:W.index??D.index,lifecycle:D.lifecycle}),T.after)){r(_r.STEP_AFTER_HOOK,T,{action:y.current??Ft.UPDATE,index:W.index??D.index,lifecycle:D.lifecycle});try{T.after({...c.current.getState(),action:y.current??Ft.UPDATE,index:W.index??D.index,lifecycle:D.lifecycle,step:T})}catch{}}},[r,u,p,m,c]),h.useEffect(()=>{if(!j.current)return;const{hasChangedTo:O,previous:W}=Ta(w.current,j.current),M=A.current,T=C.current;g&&!M&&u===We.INIT&&c.current.updateState({action:Ft.UPDATE,lifecycle:We.COMPLETE,status:Rt.FINISHED}),!w.current.controlled&&b===Rt.RUNNING&&O("lifecycle",We.COMPLETE)&&f<g&&c.current.updateState({action:Ft.UPDATE,lifecycle:We.INIT}),O("lifecycle",We.COMPLETE)&&f>=g&&c.current.updateState({action:Ft.UPDATE,lifecycle:We.COMPLETE,status:Rt.FINISHED});const E=M??T??L0(k.current,k.current.steps[f-1]);if(E&&O("status",[Rt.FINISHED,Rt.SKIPPED])){let D;M?D=f:T?D=W.index??f:D=f-1,r(_r.TOUR_END,E,{index:D}),w.current.controlled||$.current.reset(),y.current=null}M&&O("action",Ft.STOP)&&(y.current=null,r(_r.TOUR_STATUS,M)),M&&O("action",Ft.RESET)&&(r(_r.TOUR_STATUS,M),y.current=null)},[d,r,f,u,g,b,c])}function Zse({controls:e,emitEvent:t,props:n,state:r,store:s}){const{debug:i,initialStepIndex:a,run:l,stepIndex:c,steps:d}=n,f=h.useRef(void 0),u=h.useRef(r),p=h.useRef(e);u.current=r,p.current=e,h.useEffect(()=>{const m=f.current;if(f.current=n,!m||n===m)return;const{hasChanged:g}=Ta(n,m);if(S0(m.steps,d)||(H2(d,i)?s.current.setSteps(d):(Ar(i,"tour","Steps are not valid",d),t(_r.ERROR,d[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),g("run"))l?s.current.getState().size&&p.current.start(c??a):p.current.stop();else if(Xr.number(c)&&g("stepIndex")){const b=Xr.number(m.stepIndex)&&m.stepIndex<c?Ft.NEXT:Ft.PREV;[Rt.FINISHED,Rt.SKIPPED].includes(u.current.status)||s.current.updateState({action:b,index:c,lifecycle:We.INIT,positioned:!1},!0)}},[i,t,a,n,l,c,d,s])}function eie(e,t){var l,c,d,f;const{beaconPosition:n,lifecycle:r,scrollOffset:s,step:i}=t;if(i.scrollTarget||i.spotlightTarget)return Math.max(0,e);let a=e-i.spotlightPadding.top;if(r===We.BEACON_BEFORE&&(n!=null&&n.placement)){const u=tie(n);["bottom"].includes(n.placement)||(a+=Math.floor(u-s))}else if(r===We.TOOLTIP_BEFORE){const{placement:u}=i;if(u==="top"){const p=((l=document.querySelector(".react-joyride__floater"))==null?void 0:l.getBoundingClientRect().height)??0,m=(c=i.floatingOptions)!=null&&c.hideArrow?0:i.arrowSize,g=i.offset+i.spotlightPadding.top+m;a-=p+g}else if(u==="left"||u==="right"){const p=((d=document.querySelector(".react-joyride__floater"))==null?void 0:d.getBoundingClientRect().height)??0,m=((f=pi(i.target))==null?void 0:f.getBoundingClientRect().height)??0,g=s+i.spotlightPadding.top+m/2-p/2;g<s&&(a-=s-g)}}return Math.max(0,a)}function tie(e){var n;const t=(n=e.middlewareData)==null?void 0:n.offset;return t?["left","right"].some(r=>e.placement.startsWith(r))?t.x:t.y:0}function nie({emitEvent:e,previousState:t,props:n,state:r,step:s,store:i}){const{index:a,lifecycle:l,positioned:c,scrolling:d,status:f}=r,u=h.useRef(null),p=h.useRef(r),m=h.useRef(t),g=h.useRef(n),b=h.useRef(s);p.current=r,m.current=t,g.current=n,b.current=s,h.useEffect(()=>()=>{var v;(v=u.current)==null||v.call(u)},[]),h.useEffect(()=>{var A;if(!m.current||!b.current)return;const{hasChangedTo:v}=Ta(p.current,m.current),y=b.current,{debug:k}=g.current,{scrollDuration:w}=y,j=l===We.BEACON_BEFORE||l===We.TOOLTIP_BEFORE;if(f===Rt.RUNNING&&j&&d&&v("positioned",!0)){const C=pi(y.scrollTarget??y.spotlightTarget??y.target),$=i.current.getPositionData("beacon"),B=qu(C),F=B?!B.isSameNode(Ss()):!1;(A=u.current)==null||A.call(u),(async()=>{if(F&&!Yu(B)){const D=Ss(),_=Dse(B),R={initial:D.scrollTop,target:_,element:D,duration:w};e(_r.SCROLL_START,y,{scroll:R});const{cancel:P,promise:X}=dC(_,{element:D,duration:w});u.current=P,await X,e(_r.SCROLL_END,y,{scroll:R})}const L=Math.floor(Fse(C,y.scrollOffset))||0,O=F?L:eie(L,{beaconPosition:$,lifecycle:l,scrollOffset:y.scrollOffset,step:y});Ar(k,`step:${a}`,"scroll",F?"custom":"document",`${L} → ${O}`);const W=B,M={initial:W.scrollTop,target:O,element:W,duration:w};e(_r.SCROLL_START,y,{scroll:M});const{cancel:T,promise:E}=dC(O,{element:W,duration:w});u.current=T,await E,e(_r.SCROLL_END,y,{scroll:M}),i.current.updateState({scrolling:!1})})().catch(()=>{i.current.updateState({scrolling:!1})})}},[e,a,l,c,d,f,i])}function rie(e){const t=Fne(()=>Lse(Ise,e),[e]),{debug:n,initialStepIndex:r,onEvent:s,run:i,stepIndex:a,steps:l}=t,c=h.useRef(qse(t)),d=aA.useSyncExternalStore(c.current.subscribe,c.current.getSnapshot,c.current.getServerSnapshot),[f,u]=h.useState([]),p=h.useCallback((A,C)=>{u($=>[...$,{reason:C,step:A}])},[]),m=h.useCallback(()=>{u([])},[]);Xse(c,n);const g=Yse(c,n,m),b=Jse(s,g,c),{index:v,size:y,status:k}=d,w=g2(d),j=h.useMemo(()=>L0(t,l[v]),[v,t,l]);return zne(()=>{i&&y&&H2(l,n)&&g.start(a??r)}),Dne(()=>{i&&y&&k===Rt.IDLE&&c.current.updateState({status:Rt.READY})},[i,y,k]),Zse({controls:g,emitEvent:b,props:t,state:d,store:c}),Qse({addFailure:p,controls:g,emitEvent:b,previousState:w,props:t,state:d,step:j,store:c}),nie({emitEvent:b,previousState:w,props:t,state:d,step:j,store:c}),{controls:g,failures:f,mergedProps:t,state:d,step:j,store:c}}function sie(e){const[t,n]=h.useState(null);return h.useEffect(()=>{let r=null,s=!1;if(e)if(Xr.domElement(e))r=e,s=!0;else{const i=document.querySelector(e);i&&(r=i)}else{const i=document.createElement("div");i.id=Tse,document.body.appendChild(i),r=i}return n(r),()=>{!r||s||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const iie={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function oie({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(h.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return Xf;const c=document.createElement("style");return c.id="joyride-loader-animation",e&&c.setAttribute("nonce",e),c.appendChild(document.createTextNode(`
208
+ --flag`})]})]}),o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["描述",o.jsx("input",{className:"af-set-input",value:s.description,onChange:W=>i(M=>({...M,description:W.target.value})),placeholder:"这个 MCP 提供什么能力"})]}),o.jsx(H1,{title:"Headers",rows:s.headerRows,onChange:W=>i(M=>({...M,headerRows:W})),placeholderKey:"Authorization",placeholderValue:"Bearer ..."}),o.jsx(H1,{title:"Env",rows:s.envRows,onChange:W=>i(M=>({...M,envRows:W})),placeholderKey:"TOKEN",placeholderValue:"..."}),o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["额外 JSON 字段",o.jsx("textarea",{className:"af-set-input af-mcp-textarea af-set-input--mono",rows:5,value:s.extraJson,onChange:W=>i(M=>({...M,extraJson:W.target.value}))})]})]}),o.jsxs("div",{className:"af-mcp-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:$,disabled:f,children:"清空"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:z,disabled:f,children:f?"保存中...":"保存 MCP"})]})]})]})]})})]})}const yne=[{icon:"campaign",title:"首页 Feed 想加一个广告引导",question:"先判断入口、展示位、用户影响面,再决定弹框、浮层还是页面内引导。",context:["查客户端展示位逻辑","查历史需求与配置","查 m09 / Feed PV"],result:"原型 + PRD + TAPD 更新",tone:"pink"},{icon:"manage_search",title:"接到需求但不知道现有逻辑",question:"不用先找研发问一圈,直接从 Likee 代码、知识库、历史文档里拿上下文。",context:["客户端 / 后台 / 前端知识库","接口与配置链路","相关 Git 文档"],result:"背景结论 + 影响范围",tone:"cyan"},{icon:"query_stats",title:"运营要评估活动或入口价值",question:"先查人群规模、页面访问、历史转化,避免凭经验拍优先级。",context:["CK / Hive 查数","自动生成 SQL","指标口径解释"],result:"数据表 + 图表 + 结论",tone:"green"},{icon:"draw",title:"想快速把方案画给团队看",question:"把一句需求变成客户端或 H5 原型,让评审时先讨论体验,不只讨论文字。",context:["Likee 客户端样式","前端页面结构","交互状态与文案"],result:"HTML 原型 + Display 面板",tone:"amber"},{icon:"sync_alt",title:"需求写完后需要同步多个地方",question:"PRD、TAPD、Git 仓库和评审展示保持一致,减少重复复制和漏改。",context:["需求正文","变更记录","MR / 仓库路径"],result:"TAPD 更新 + Git 提交",tone:"violet"},{icon:"monitoring",title:"上线后要看效果和复盘",question:"沿用需求阶段的口径继续查数,把结果沉淀回下一轮需求线索。",context:["上线后 CK / Hive","分页面 / 分人群指标","实验和版本信息"],result:"复盘结论 + 后续建议",tone:"blue"}],xne=[{label:"Use Case 01",title:"Likee 客户端知识库查询(如广告占位)",images:["/likee-context/usecase-ad-query.png"],trigger:"产品或运营想确认客户端已有逻辑,例如 Likee Android 里有哪些广告占位,以及相关常量和代码位置。",steps:["在「我的流程」加载 Likee Android 流程片段","在子 Agent 节点输入客户端逻辑问题","点击 Run Line,只执行当前链路","在右侧 Markdown Display 查看知识库查询结果"],outputs:["SETTING_ID / PAGE_ID 表格","客户端代码路径与口径说明","可继续用于 PRD 的背景材料"]},{label:"Use Case 02",title:"客户端原型设计",images:["/likee-context/usecase-prototype.png"],trigger:"业务已经明确要在 Likee 首页加入广告引导,需要先把弹框体验画出来给产品、设计、研发评审。",steps:["在 Workspace 打开原型生成流程","加载客户端原型 Skill","在子 Agent 中说明生成一个首页 dialog 弹框","查看 HTML Display 中的手机预览稿"],outputs:["Likee 风格手机原型","弹框文案与按钮状态","可直接用于评审的 Display 面板"]},{label:"Use Case 03",title:"前端 H5 原型设计",images:["/likee-context/usecase-h5-prototype.png"],trigger:"运营活动需要快速产出 Likee 风格 H5 页面,例如幸运转盘、积分排行榜、活动首页或结果页。",steps:["在 Workspace 打开 H5 原型生成流程","加载前端 H5 原型相关 Skill","在子 Agent 中说明活动结构、页面模块和运营规则","查看 HTML Display 中的可交互 H5 原型"],outputs:["Likee 风格 H5 页面","抽奖转盘与排行榜布局","活动规则和状态页","可用于评审的 HTML Display"]},{label:"Use Case 04",title:"CK / Hive 查数与 SQL 生成",images:["/likee-context/usecase-data-query.png"],trigger:"运营或产品需要快速验证一个数据问题,例如找出典型 UID、对比不同日期的视频上传分辨率占比,并保留可复用 SQL。",steps:["在 Workspace 打开查数流程","加载查数相关 Skill","在子 Agent 中说明数据口径、日期和筛选条件","查看 Markdown Display 中的数据结果和查询 SQL"],outputs:["查询结果表格","SQL 语句","口径说明","可继续接入 PRD 或复盘面板的数据结论"]},{label:"Use Case 05",title:"需求文档生成、数据补齐与同步",images:["/likee-context/usecase-prd.png","/likee-context/usecase-sync.png"],trigger:"需求进入评审和落库阶段,需要把 TAPD 信息、Hive 数据、原型内容组织成 PRD,并同步到 TAPD 和 Git 仓库。",steps:["先运行 TAPD / 数据查询节点,拿到迭代、页面 PV 和业务背景","把查询结果和原型 Display 内容接入 PRD 生成子 Agent","在 Markdown Display 查看完整需求文档","把 PRD content 接入 TAPD 更新节点和 Git 仓库提交节点"],outputs:["完整 PRD 文档","项目背景与 Top 页面数据","TAPD 需求更新成功","Git MR 链接"]},{label:"Use Case 06",title:"Display 模式做需求评审面板",images:["/likee-context/usecase-display.png"],trigger:"流程跑完后,需要把 PRD、原型、数据图表、展示位表格放在一个页面里给产品、运营、研发一起看。",steps:["在 Workspace 中完成查数、原型、PRD、同步节点执行","确认 Markdown / HTML / 图表 / 表格展示节点都有结果","切换顶部 DISPLAY 模式","使用生成链接把评审面板发给相关同学"],outputs:["PRD 长文档","客户端原型预览","图表与表格","统一展示链接"]}],wne=[{name:"likee-client-ui",namespace:"智能助手 / 客户端原型",icon:"phone_iphone",mode:"客户端原型设计",usage:"生成 Likee 客户端风格页面、弹框、Feed 引导、个人页、活动入口等原型,适合产品评审前快速对齐体验。",examples:["首页 dialog 弹框","Feed 内引导","客户端红色主品牌视觉","移动端交互态"],tone:"pink"},{name:"tapd-likee",namespace:"智能助手 / TAPD",icon:"sync",mode:"需求系统交互",usage:"和 TAPD 交互,支持创建、同步、更新需求,把工作区生成的 PRD 或 Markdown 内容回写到需求系统。",examples:["创建 TAPD 需求","更新需求正文","同步处理人和链接","把结果回显到 Display"],tone:"green"},{name:"plain-language-response",namespace:"智能助手 / 回答风格",icon:"record_voice_over",mode:"业务化回答",usage:"用于把回答收敛成产品、运营更容易阅读的解释,避免直接把客户端代码库细节、函数调用链和实现细节暴露太多。",examples:["需求背景解释","代码结论转业务语言","评审材料摘要","减少实现细节噪音"],tone:"cyan"},{name:"create-likee-h5-style-html",namespace:"智能助手 / 前端 H5",icon:"language",mode:"H5 原型设计",usage:"创建 Likee H5 风格原型,适合运营活动、抽奖、排行榜、报告页、反馈表单、创作者认证页、订单列表等页面。",examples:["幸运转盘活动","积分排行榜","活动规则页","结果页和空状态"],tone:"amber"},{name:"analytics",namespace:"数据 / CK & Hive",icon:"query_stats",mode:"查数和 SQL 生成",usage:"面向 CK、Hive 的指标查询和 SQL 生成,适合 PV、UV、转化、分国家、分实验组、典型 UID 等数据问题。",examples:["自动生成 SQL","输出查询结果表","解释指标口径","沉淀复盘数据"],tone:"green"}],bne=[["知识库","查客户端、后台、前端逻辑","广告、Feed、会员、增长、配置、接口调用链"],["数据","查 CK / Hive 并输出 SQL","PV、UV、转化、分页面、分国家、分实验组"],["产物","生成原型、PRD、Display 面板","Markdown、HTML 原型、图表、表格、交互预览"],["协作","同步 TAPD 与 Git 仓库","需求正文、变更记录、MR 链接、评审材料"]];function _h({icon:e,title:t,label:n,tone:r="violet"}){return o.jsxs("div",{className:`likee-flow-node likee-flow-node-${r}`,children:[o.jsx("span",{className:"material-symbols-outlined",children:e}),o.jsxs("div",{children:[o.jsx("strong",{children:t}),o.jsx("small",{children:n})]})]})}function vne(){return o.jsxs("div",{className:"likee-workspace-scene","aria-hidden":"true",children:[o.jsx("div",{className:"likee-scene-grid"}),o.jsxs("svg",{className:"likee-scene-lines",viewBox:"0 0 980 560",fill:"none",children:[o.jsx("path",{d:"M96 154 C236 96 330 122 444 194 C552 262 654 260 814 160"}),o.jsx("path",{d:"M118 350 C248 288 344 304 458 372 C578 444 704 420 858 310"}),o.jsx("path",{d:"M472 196 C512 248 524 302 486 372"}),o.jsx("path",{d:"M622 126 C670 198 696 258 682 354"})]}),o.jsx("div",{className:"likee-node-pos likee-node-a",children:o.jsx(_h,{icon:"travel_explore",title:"全局上下文",label:"Likee 业务、代码、数据",tone:"pink"})}),o.jsx("div",{className:"likee-node-pos likee-node-b",children:o.jsx(_h,{icon:"database",title:"CK / Hive",label:"自动 SQL 与指标口径",tone:"cyan"})}),o.jsx("div",{className:"likee-node-pos likee-node-c",children:o.jsx(_h,{icon:"article",title:"需求文档",label:"PRD、变更说明、评审稿",tone:"amber"})}),o.jsx("div",{className:"likee-node-pos likee-node-d",children:o.jsx(_h,{icon:"sync_alt",title:"TAPD / Git",label:"同步需求与版本资产",tone:"green"})}),o.jsxs("div",{className:"likee-phone-preview",children:[o.jsxs("div",{className:"likee-phone-top",children:[o.jsx("span",{children:"关注"}),o.jsx("strong",{children:"推荐"}),o.jsx("span",{children:"直播"})]}),o.jsxs("div",{className:"likee-phone-card",children:[o.jsx("div",{className:"likee-gift",children:"AD"}),o.jsx("h4",{children:"广告个性化引导弹框"}),o.jsx("p",{children:"保持推荐体验,同时解释权益与关闭路径。"}),o.jsx("button",{children:"继续"}),o.jsx("button",{className:"secondary",children:"稍后"})]})]}),o.jsxs("div",{className:"likee-display-panel",children:[o.jsxs("div",{className:"likee-panel-header",children:[o.jsx("span",{children:"DISPLAY"}),o.jsx("strong",{children:"需求资产面板"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"需求"}),o.jsx("strong",{children:"首页广告个性化引导"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"数据"}),o.jsx("strong",{children:"m09 PV Top 1"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"同步"}),o.jsx("strong",{children:"TAPD + Git MR"})]})]})]})}function tm({kicker:e,title:t,children:n}){return o.jsxs("div",{className:"likee-section-copy",children:[o.jsx("p",{className:"likee-section-kicker",children:e}),o.jsx("h2",{children:t}),o.jsx("p",{children:n})]})}function kne(){return o.jsx("section",{id:"likee-skills",className:"likee-section likee-section-dark",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-two-column-skills",children:[o.jsx(tm,{kicker:"SKILLS",title:"用 Skills 把 Likee 上下文变成可复用能力",children:"Skills 是工作区里可加载的能力包。手动搭建工作区时,只需要按场景加载对应 Skill。"}),o.jsx("div",{className:"likee-skill-grid",children:wne.map(e=>o.jsxs("article",{className:`likee-skill-card likee-skill-${e.tone}`,children:[o.jsxs("div",{className:"likee-skill-head",children:[o.jsx("div",{className:"likee-skill-icon",children:o.jsx("span",{className:"material-symbols-outlined",children:e.icon})}),o.jsxs("div",{children:[o.jsx("h3",{children:e.name}),o.jsx("span",{children:e.namespace})]})]}),o.jsx("div",{className:"likee-skill-mode",children:e.mode}),o.jsx("p",{children:e.usage}),o.jsx("div",{className:"likee-skill-examples",children:e.examples.map(t=>o.jsx("strong",{children:t},t))})]},e.name))})]})})}function h2(){return o.jsxs("div",{className:"likee-page",children:[o.jsx("div",{className:"likee-top-actions",children:o.jsxs("a",{href:"/projects",className:"likee-home-link",children:[o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"}),"返回首页"]})}),o.jsxs("section",{className:"likee-hero",children:[o.jsx(vne,{}),o.jsxs("div",{className:"likee-hero-content",children:[o.jsx("p",{className:"likee-eyebrow",children:"LIKEE CONTEXT WORKSPACE"}),o.jsx("h1",{children:"Likee Agent 工作台"}),o.jsx("p",{className:"likee-hero-subtitle",children:"提供 Likee 全局上下文,赋能需求挖掘、书写和运营。"}),o.jsxs("div",{className:"likee-signal-row",children:[o.jsx("span",{children:"查业务逻辑"}),o.jsx("span",{children:"查 CK / Hive"}),o.jsx("span",{children:"生成原型"}),o.jsx("span",{children:"生成 PRD"}),o.jsx("span",{children:"同步 TAPD / Git"})]}),o.jsxs("div",{className:"likee-hero-actions",children:[o.jsxs("a",{href:"/projects",className:"likee-primary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"rocket_launch"}),"立即使用"]}),o.jsxs("a",{href:"#likee-scenarios",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"ads_click"}),"按场景查看"]}),o.jsxs("a",{href:"#likee-usecases",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"view_timeline"}),"查看 Use Cases"]}),o.jsxs("a",{href:"#likee-skills",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"extension"}),"查看 Skills"]})]})]})]}),o.jsx("section",{id:"likee-scenarios",className:"likee-section",children:o.jsxs("div",{className:"likee-section-inner",children:[o.jsx(tm,{kicker:"SCENARIO TRIGGERS",title:"打造 Likee 团队全景上下文",children:"不要求先会写 Prompt,也不要求知道该找哪个系统。选择一个业务场景,工作台会把需要的 Likee 上下文、数据查询和最终产物组织起来。"}),o.jsx("div",{className:"likee-scenario-grid",children:yne.map(e=>o.jsxs("article",{className:`likee-scenario-card likee-scenario-${e.tone}`,children:[o.jsx("div",{className:"likee-scenario-icon",children:o.jsx("span",{className:"material-symbols-outlined",children:e.icon})}),o.jsxs("div",{children:[o.jsx("h3",{children:e.title}),o.jsx("p",{children:e.question})]}),o.jsx("div",{className:"likee-scenario-context",children:e.context.map(t=>o.jsx("span",{children:t},t))}),o.jsxs("div",{className:"likee-scenario-result",children:[o.jsx("span",{children:"产出"}),o.jsx("strong",{children:e.result})]})]},e.title))})]})}),o.jsx("section",{id:"likee-usecases",className:"likee-section likee-section-muted",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-usecase-layout",children:[o.jsx(tm,{kicker:"USE CASES",title:"沉淀 Likee 业务流水线",children:"这里展示的是平台里实际可跑的工作流:加载流程片段,在子 Agent 或 Run 节点输入业务问题,执行当前 line,最终在 Display、TAPD 和 Git 中拿到结果。"}),o.jsx("div",{className:"likee-usecase-stack",children:xne.map(e=>o.jsxs("article",{className:"likee-usecase-card",children:[o.jsx("div",{className:`likee-usecase-media ${e.images.length>1?"likee-usecase-media-split":""}`,children:e.images.map((t,n)=>o.jsx("img",{src:t,alt:`${e.title} 工作区截图 ${n+1}`,loading:"lazy"},t))}),o.jsxs("div",{className:"likee-usecase-body",children:[o.jsx("div",{className:"likee-usecase-label",children:e.label}),o.jsx("h3",{children:e.title}),o.jsx("p",{children:e.trigger}),o.jsx("ol",{className:"likee-usecase-steps",children:e.steps.map(t=>o.jsx("li",{children:t},t))}),o.jsxs("div",{className:"likee-usecase-output",children:[o.jsx("span",{children:"实际产物"}),o.jsx("div",{children:e.outputs.map(t=>o.jsx("strong",{children:t},t))})]})]})]},e.label))})]})}),o.jsx(kne,{}),o.jsx("section",{className:"likee-section",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-capability-layout",children:[o.jsx(tm,{kicker:"CAPABILITY MAP",title:"每个场景背后,都连接同一套 Likee 上下文能力",children:"工作台把知识库、CK / Hive、原型、PRD、TAPD 和 Git 放到同一条链路里。用户看到的是业务场景,系统处理的是上下文、产物和同步。"}),o.jsx("div",{className:"likee-capability-table",children:bne.map(([e,t,n])=>o.jsxs("div",{className:"likee-capability-row",children:[o.jsx("span",{children:e}),o.jsx("strong",{children:t}),o.jsx("p",{children:n})]},e))})]})})]})}function m2(e){return t=>typeof t===e}var Sne=m2("function"),Nne=e=>e===null,W1=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",V1=e=>!jne(e)&&!Nne(e)&&(Sne(e)||typeof e=="object"),jne=m2("undefined");function Cne(e,t,n){return Rne(n,e,t)?!0:(Lne(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?Ene(e,t,n):e instanceof Map&&t instanceof Map?Ane(e,t,n):e instanceof Set&&t instanceof Set?Tne(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?_ne(e,t):W1(e)&&W1(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?Pne(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():Ine(e,t,n))}function hp(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!V1(e)||!t||!V1(t)?!1:Cne(e,t,n)}function Ene(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let s=r;s--!==0;)if(!hp(e[s],t[s],n))return!1;return!0}function _ne(e,t){if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer),r=new DataView(t.buffer);let s=e.byteLength;for(;s--;)if(n.getUint8(s)!==r.getUint8(s))return!1;return!0}function Pne(e,t,n){return e.message===t.message&&e.name===t.name&&hp(e.cause,t.cause,n)}function Ane(e,t,n){if(e.size!==t.size)return!1;for(const r of e.entries())if(!t.has(r[0]))return!1;for(const r of e.entries())if(!hp(r[1],t.get(r[0]),n))return!1;return!0}function Ine(e,t,n){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let s=r.length;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[s]))return!1;for(let s=r.length;s--!==0;){const i=r[s];if(!(i==="_owner"&&e.$$typeof)&&!hp(e[i],t[i],n))return!1}return!0}function Tne(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;return!0}function Rne(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function Lne(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function S0(e,t){return hp(e,t,new WeakMap)}function Tx(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function One(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function Mne(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function $ne(){const e=h.useRef(!0);return e.current?(e.current=!1,!0):e.current}function Dne(e,t){const n=$ne();h.useEffect(()=>{if(!n)return e()},t)}function g2(e){const t=h.useRef(void 0);return h.useEffect(()=>{t.current=e}),t.current}function Fne(e,t){const n=h.useRef(t);return S0(t,n.current)||(n.current=t),h.useMemo(e,n.current)}function zne(e){h.useEffect(()=>{e()},[])}function Bne(e=0){const[t,n]=h.useState({height:Tx()?window.innerHeight:0,width:Tx()?window.innerWidth:0}),r=h.useRef(0),s=h.useRef(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(()=>{n({width:window.innerWidth,height:window.innerHeight})},e)});return h.useEffect(()=>{if(!Tx())return()=>{};const i=s.current;return n({height:window.innerHeight,width:window.innerWidth}),Mne(window,"resize",i),()=>{One(window,"resize",i)}},[]),t}var Hne=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],Wne=["bigint","boolean","null","number","string","symbol","undefined"];function mp(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(Vne(t))return t}function Ki(e){return t=>mp(t)===e}function Vne(e){return Hne.includes(e)}function Vu(e){return t=>typeof t===e}function Une(e){return Wne.includes(e)}var Kne=["innerHTML","ownerDocument","style","attributes","nodeValue"],gp=e=>Array.isArray(e),qne=e=>mp(e)==="AsyncGeneratorFunction",Yne=Ki("AsyncFunction"),Gne=Vu("bigint"),Xne=e=>e===!0||e===!1,Jne=Ki("Date"),Qne=Ki("Error"),rl=Vu("function"),Zne=Ki("GeneratorFunction"),ere=e=>typeof e=="number"&&Number.isInteger(e),Pb=Ki("Map"),y2=e=>Number.isNaN(e),N0=e=>e===null,x2=Ki("Function"),tre=Ki("Promise"),nre=Ki("RegExp"),Ab=Ki("Set"),yp=Vu("string"),rre=Vu("symbol"),j0=Vu("undefined"),sre=Ki("WeakMap"),ire=Ki("WeakSet"),C0=e=>N0(e)||j0(e),w2=e=>!j0(e),ore=e=>Vu("number")(e)&&!y2(e),are=e=>yp(e)&&e.trim().length>0,lre=e=>{if(!yp(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},Gg=e=>!C0(e)&&(rl(e)||typeof e=="object"),b2=e=>{if(mp(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},cre=e=>N0(e)||Une(typeof e),ure=e=>mp(e)==="URL",v2=e=>!C0(e)&&rl(e[Symbol.iterator]),dre=e=>v2(e)&&rl(e.next)&&rl(e.throw),fre=e=>rl(e)&&/^class\s/.test(e.toString()),pre=(e,t)=>!gp(e)||!rl(t)?!1:e.every(n=>t(n)),hre=e=>Gg(e)&&!b2(e)&&e.nodeType===1&&yp(e.nodeName)&&Kne.every(t=>t in e),mre=e=>yp(e)&&e.length===0||gp(e)&&e.length===0||Gg(e)&&!Pb(e)&&!Ab(e)&&Object.keys(e).length===0||Ab(e)&&e.size===0||Pb(e)&&e.size===0,gre=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,yre=(e,t)=>gp(e)?e.indexOf(t)>-1:!1,xre=(e,t,n)=>{if(!Gg(e)||!t)return!1;const r=e[t];return rl(n)?n(r):w2(r)};function At(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(gp(e))return"Array";if(x2(e))return"Function";const t=mp(e);return t||"Object"}At.array=gp;At.arrayOf=pre;At.asyncGeneratorFunction=qne;At.asyncFunction=Yne;At.bigint=Gne;At.boolean=Xne;At.class=fre;At.date=Jne;At.defined=w2;At.domElement=hre;At.empty=mre;At.error=Qne;At.function=rl;At.generator=dre;At.generatorFunction=Zne;At.instanceOf=gre;At.integer=ere;At.iterable=v2;At.map=Pb;At.nan=y2;At.null=N0;At.nullOrUndefined=C0;At.nonEmptyString=are;At.number=ore;At.numericString=lre;At.object=Gg;At.oneOf=yre;At.plainFunction=x2;At.plainObject=b2;At.primitive=cre;At.promise=tre;At.propertyOf=xre;At.regexp=nre;At.set=Ab;At.string=yp;At.symbol=rre;At.undefined=j0;At.url=ure;At.weakMap=sre;At.weakSet=ire;var Xr=At;/* v8 ignore next -- @preserve */var wre=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},bre=function(e,t){return e+Yf(t)},Yf=function(e){return e===null||typeof e=="boolean"||typeof e>"u"?"":typeof e=="number"?e.toString():typeof e=="string"?e:Array.isArray(e)?e.reduce(bre,""):wre(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?Yf(e.props.children):""};Yf.default=Yf;var vre=Yf;const Rx=il(vre);var k2={exports:{}};(function(e){const t=Object.getPrototypeOf({});function n(){return function(i){return typeof i=="object"&&i!==null&&!(i instanceof RegExp)&&!(i instanceof Date)}}function r(s){function i(A){return A!=="constructor"&&A!=="prototype"&&A!=="__proto__"}function a(A){let C=0;const $=A.length,B=new Array($);for(C;C<$;++C)B[C]=y(A[C]);return B}function l(A){const C={};if(p&&Object.getPrototypeOf(A)!==t)return p(A);const $=u(A);let B,F,z;for(B=0,F=$.length;B<F;++B)i(z=$[B])&&(C[z]=y(A[z]));return C}function c(A,C){const $=A.length,B=C.length;let F=0;const z=new Array($+B);for(F;F<$;++F)z[F]=y(A[F]);for(F=0;F<B;++F)z[F+$]=y(C[F]);return z}const d=Object.prototype.propertyIsEnumerable;function f(A){const C=Object.keys(A),$=Object.getOwnPropertySymbols(A);for(let B=0,F=$.length;B<F;++B)d.call(A,$[B])&&C.push($[B]);return C}const u=s!=null&&s.symbols?f:Object.keys,p=typeof(s==null?void 0:s.cloneProtoObject)=="function"?s.cloneProtoObject:void 0,m=typeof(s==null?void 0:s.isMergeableObject)=="function"?s.isMergeableObject:n(),g=(s==null?void 0:s.onlyDefinedProperties)===!0;function b(A){return typeof A!="object"||A===null}const v=s&&typeof s.mergeArray=="function"?s.mergeArray({clone:y,deepmerge:w,getKeys:u,isMergeableObject:m}):c;function y(A){return m(A)?Array.isArray(A)?a(A):l(A):A}function k(A,C){const $={},B=u(A),F=u(C);let z,L,O;for(z=0,L=B.length;z<L;++z)i(O=B[z])&&F.indexOf(O)===-1&&($[O]=y(A[O]));for(z=0,L=F.length;z<L;++z)if(i(O=F[z]))if(O in A)B.indexOf(O)!==-1&&(p&&m(C[O])&&Object.getPrototypeOf(C[O])!==t?$[O]=p(C[O]):$[O]=w(A[O],C[O]));else{if(g&&typeof C[O]>"u")continue;$[O]=y(C[O])}return $}function w(A,C){if(g&&typeof C>"u")return y(A);const $=Array.isArray(C),B=Array.isArray(A);return b(C)?C:m(A)?$&&B?v(A,C):$!==B?y(C):k(A,C):y(C)}function j(){switch(arguments.length){case 0:return{};case 1:return y(arguments[0]);case 2:return w(arguments[0],arguments[1])}let A;for(let C=0,$=arguments.length;C<$;++C)A=w(A,arguments[C]);return A}return s!=null&&s.all?j:w}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(k2);var kre=k2.exports;const Sre=il(kre);var Nre=new Error("Element already at target scroll position"),jre=new Error("Scroll cancelled"),Cre=Math.min,U1=Date.now,Ere={left:K1("scrollLeft"),top:K1("scrollTop")};function K1(e){return function(n,r,s,i){s=s||{},typeof s=="function"&&(i=s,s={}),typeof i!="function"&&(i=Pre);var a=U1(),l=n[e],c=s.ease||_re,d=isNaN(s.duration)?350:+s.duration,f=!1;return l===r?i(Nre,n[e]):requestAnimationFrame(p),u;function u(){f=!0}function p(m){if(f)return i(jre,n[e]);var g=U1(),b=Cre(1,(g-a)/d),v=c(b);n[e]=v*(r-l)+l,b<1?requestAnimationFrame(p):requestAnimationFrame(function(){i(null,n[e])})}}}function _re(e){return .5*(1-Math.cos(Math.PI*e))}function Pre(){}const Are=il(Ere);var S2={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(df,function(){function t(r){var s=getComputedStyle(r,null).getPropertyValue("overflow");return s.indexOf("scroll")>-1||s.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var s=r.parentNode;s.parentNode;){if(t(s))return s;s=s.parentNode}return document.scrollingElement||document.documentElement}}return n})})(S2);var Ire=S2.exports;const N2=il(Ire),Tre=["top","right","bottom","left"],q1=["start","end"],Y1=Tre.reduce((e,t)=>e.concat(t,t+"-"+q1[0],t+"-"+q1[1]),[]),Mu=Math.min,ql=Math.max,ag=Math.round,Ph=Math.floor,ko=e=>({x:e,y:e}),Rre={left:"right",right:"left",bottom:"top",top:"bottom"};function Ib(e,t,n){return ql(e,Mu(t,n))}function Uu(e,t){return typeof e=="function"?e(t):e}function sa(e){return e.split("-")[0]}function So(e){return e.split("-")[1]}function j2(e){return e==="x"?"y":"x"}function E0(e){return e==="y"?"height":"width"}function Fa(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function _0(e){return j2(Fa(e))}function C2(e,t,n){n===void 0&&(n=!1);const r=So(e),s=_0(e),i=E0(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=cg(a)),[a,cg(a)]}function Lre(e){const t=cg(e);return[lg(e),t,lg(t)]}function lg(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const G1=["left","right"],X1=["right","left"],Ore=["top","bottom"],Mre=["bottom","top"];function $re(e,t,n){switch(e){case"top":case"bottom":return n?t?X1:G1:t?G1:X1;case"left":case"right":return t?Ore:Mre;default:return[]}}function Dre(e,t,n,r){const s=So(e);let i=$re(sa(e),n==="start",r);return s&&(i=i.map(a=>a+"-"+s),t&&(i=i.concat(i.map(lg)))),i}function cg(e){const t=sa(e);return Rre[t]+e.slice(t.length)}function Fre(e){return{top:0,right:0,bottom:0,left:0,...e}}function E2(e){return typeof e!="number"?Fre(e):{top:e,right:e,bottom:e,left:e}}function ug(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function J1(e,t,n){let{reference:r,floating:s}=e;const i=Fa(t),a=_0(t),l=E0(a),c=sa(t),d=i==="y",f=r.x+r.width/2-s.width/2,u=r.y+r.height/2-s.height/2,p=r[l]/2-s[l]/2;let m;switch(c){case"top":m={x:f,y:r.y-s.height};break;case"bottom":m={x:f,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:u};break;case"left":m={x:r.x-s.width,y:u};break;default:m={x:r.x,y:r.y}}switch(So(t)){case"start":m[a]-=p*(n&&d?-1:1);break;case"end":m[a]+=p*(n&&d?-1:1);break}return m}async function zre(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:a,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:p=!1,padding:m=0}=Uu(t,e),g=E2(m),v=l[p?u==="floating"?"reference":"floating":u],y=ug(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),k=u==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),j=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},A=ug(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:k,offsetParent:w,strategy:c}):k);return{top:(y.top-A.top+g.top)/j.y,bottom:(A.bottom-y.bottom+g.bottom)/j.y,left:(y.left-A.left+g.left)/j.x,right:(A.right-y.right+g.right)/j.x}}const Bre=50,Hre=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:zre},c=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:u}=J1(d,r,c),p=r,m=0;const g={};for(let b=0;b<i.length;b++){const v=i[b];if(!v)continue;const{name:y,fn:k}=v,{x:w,y:j,data:A,reset:C}=await k({x:f,y:u,initialPlacement:r,placement:p,strategy:s,middlewareData:g,rects:d,platform:l,elements:{reference:e,floating:t}});f=w??f,u=j??u,g[y]={...g[y],...A},C&&m<Bre&&(m++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(d=C.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):C.rects),{x:f,y:u}=J1(d,p,c)),b=-1)}return{x:f,y:u,placement:p,strategy:s,middlewareData:g}},Wre=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:a,elements:l,middlewareData:c}=t,{element:d,padding:f=0}=Uu(e,t)||{};if(d==null)return{};const u=E2(f),p={x:n,y:r},m=_0(s),g=E0(m),b=await a.getDimensions(d),v=m==="y",y=v?"top":"left",k=v?"bottom":"right",w=v?"clientHeight":"clientWidth",j=i.reference[g]+i.reference[m]-p[m]-i.floating[g],A=p[m]-i.reference[m],C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let $=C?C[w]:0;(!$||!await(a.isElement==null?void 0:a.isElement(C)))&&($=l.floating[w]||i.floating[g]);const B=j/2-A/2,F=$/2-b[g]/2-1,z=Mu(u[y],F),L=Mu(u[k],F),O=z,W=$-b[g]-L,M=$/2-b[g]/2+B,T=Ib(O,M,W),E=!c.arrow&&So(s)!=null&&M!==T&&i.reference[g]/2-(M<O?z:L)-b[g]/2<0,D=E?M<O?M-O:M-W:0;return{[m]:p[m]+D,data:{[m]:T,centerOffset:M-T-D,...E&&{alignmentOffset:D}},reset:E}}});function Vre(e,t,n){return(e?[...n.filter(s=>So(s)===e),...n.filter(s=>So(s)!==e)]:n.filter(s=>sa(s)===s)).filter(s=>e?So(s)===e||(t?lg(s)!==s:!1):!0)}const Ure=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,s;const{rects:i,middlewareData:a,placement:l,platform:c,elements:d}=t,{crossAxis:f=!1,alignment:u,allowedPlacements:p=Y1,autoAlignment:m=!0,...g}=Uu(e,t),b=u!==void 0||p===Y1?Vre(u||null,m,p):p,v=await c.detectOverflow(t,g),y=((n=a.autoPlacement)==null?void 0:n.index)||0,k=b[y];if(k==null)return{};const w=C2(k,i,await(c.isRTL==null?void 0:c.isRTL(d.floating)));if(l!==k)return{reset:{placement:b[0]}};const j=[v[sa(k)],v[w[0]],v[w[1]]],A=[...((r=a.autoPlacement)==null?void 0:r.overflows)||[],{placement:k,overflows:j}],C=b[y+1];if(C)return{data:{index:y+1,overflows:A},reset:{placement:C}};const $=A.map(z=>{const L=So(z.placement);return[z.placement,L&&f?z.overflows.slice(0,2).reduce((O,W)=>O+W,0):z.overflows[0],z.overflows]}).sort((z,L)=>z[1]-L[1]),F=((s=$.filter(z=>z[2].slice(0,So(z[0])?2:3).every(L=>L<=0))[0])==null?void 0:s[0])||$[0][0];return F!==l?{data:{index:y+1,overflows:A},reset:{placement:F}}:{}}}},Kre=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:a,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...v}=Uu(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=sa(s),k=Fa(l),w=sa(l)===l,j=await(c.isRTL==null?void 0:c.isRTL(d.floating)),A=p||(w||!b?[cg(l)]:Lre(l)),C=g!=="none";!p&&C&&A.push(...Dre(l,b,g,j));const $=[l,...A],B=await c.detectOverflow(t,v),F=[];let z=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&F.push(B[y]),u){const M=C2(s,a,j);F.push(B[M[0]],B[M[1]])}if(z=[...z,{placement:s,overflows:F}],!F.every(M=>M<=0)){var L,O;const M=(((L=i.flip)==null?void 0:L.index)||0)+1,T=$[M];if(T&&(!(u==="alignment"?k!==Fa(T):!1)||z.every(_=>Fa(_.placement)===k?_.overflows[0]>0:!0)))return{data:{index:M,overflows:z},reset:{placement:T}};let E=(O=z.filter(D=>D.overflows[0]<=0).sort((D,_)=>D.overflows[1]-_.overflows[1])[0])==null?void 0:O.placement;if(!E)switch(m){case"bestFit":{var W;const D=(W=z.filter(_=>{if(C){const R=Fa(_.placement);return R===k||R==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(R=>R>0).reduce((R,P)=>R+P,0)]).sort((_,R)=>_[1]-R[1])[0])==null?void 0:W[0];D&&(E=D);break}case"initialPlacement":E=l;break}if(s!==E)return{reset:{placement:E}}}return{}}}},qre=new Set(["left","top"]);async function Yre(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=sa(n),l=So(n),c=Fa(n)==="y",d=qre.has(a)?-1:1,f=i&&c?-1:1,u=Uu(t,e);let{mainAxis:p,crossAxis:m,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&typeof g=="number"&&(m=l==="end"?g*-1:g),c?{x:m*f,y:p*d}:{x:p*d,y:m*f}}const Gre=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:a,middlewareData:l}=t,c=await Yre(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:a}}}}},Xre=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:y=>{let{x:k,y:w}=y;return{x:k,y:w}}},...d}=Uu(e,t),f={x:n,y:r},u=await i.detectOverflow(t,d),p=Fa(sa(s)),m=j2(p);let g=f[m],b=f[p];if(a){const y=m==="y"?"top":"left",k=m==="y"?"bottom":"right",w=g+u[y],j=g-u[k];g=Ib(w,g,j)}if(l){const y=p==="y"?"top":"left",k=p==="y"?"bottom":"right",w=b+u[y],j=b-u[k];b=Ib(w,b,j)}const v=c.fn({...t,[m]:g,[p]:b});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[m]:a,[p]:l}}}}}};function Xg(){return typeof window<"u"}function Ku(e){return _2(e)?(e.nodeName||"").toLowerCase():"#document"}function Ks(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function _o(e){var t;return(t=(_2(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function _2(e){return Xg()?e instanceof Node||e instanceof Ks(e).Node:!1}function Wi(e){return Xg()?e instanceof Element||e instanceof Ks(e).Element:!1}function aa(e){return Xg()?e instanceof HTMLElement||e instanceof Ks(e).HTMLElement:!1}function Q1(e){return!Xg()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ks(e).ShadowRoot}function xp(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Vi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function Jre(e){return/^(table|td|th)$/.test(Ku(e))}function Jg(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Qre=/transform|translate|scale|rotate|perspective|filter/,Zre=/paint|layout|strict|content/,Il=e=>!!e&&e!=="none";let Lx;function P0(e){const t=Wi(e)?Vi(e):e;return Il(t.transform)||Il(t.translate)||Il(t.scale)||Il(t.rotate)||Il(t.perspective)||!A0()&&(Il(t.backdropFilter)||Il(t.filter))||Qre.test(t.willChange||"")||Zre.test(t.contain||"")}function ese(e){let t=sl(e);for(;aa(t)&&!$u(t);){if(P0(t))return t;if(Jg(t))return null;t=sl(t)}return null}function A0(){return Lx==null&&(Lx=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Lx}function $u(e){return/^(html|body|#document)$/.test(Ku(e))}function Vi(e){return Ks(e).getComputedStyle(e)}function Qg(e){return Wi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function sl(e){if(Ku(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Q1(e)&&e.host||_o(e);return Q1(t)?t.host:t}function P2(e){const t=sl(e);return $u(t)?e.ownerDocument?e.ownerDocument.body:e.body:aa(t)&&xp(t)?t:P2(t)}function Gf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=P2(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),a=Ks(s);if(i){const l=Tb(a);return t.concat(a,a.visualViewport||[],xp(s)?s:[],l&&n?Gf(l):[])}else return t.concat(s,Gf(s,[],n))}function Tb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function A2(e){const t=Vi(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=aa(e),i=s?e.offsetWidth:n,a=s?e.offsetHeight:r,l=ag(n)!==i||ag(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function I0(e){return Wi(e)?e:e.contextElement}function gu(e){const t=I0(e);if(!aa(t))return ko(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=A2(t);let a=(i?ag(n.width):n.width)/r,l=(i?ag(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const tse=ko(0);function I2(e){const t=Ks(e);return!A0()||!t.visualViewport?tse:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nse(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ks(e)?!1:t}function sc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=I0(e);let a=ko(1);t&&(r?Wi(r)&&(a=gu(r)):a=gu(e));const l=nse(i,n,r)?I2(i):ko(0);let c=(s.left+l.x)/a.x,d=(s.top+l.y)/a.y,f=s.width/a.x,u=s.height/a.y;if(i){const p=Ks(i),m=r&&Wi(r)?Ks(r):r;let g=p,b=Tb(g);for(;b&&r&&m!==g;){const v=gu(b),y=b.getBoundingClientRect(),k=Vi(b),w=y.left+(b.clientLeft+parseFloat(k.paddingLeft))*v.x,j=y.top+(b.clientTop+parseFloat(k.paddingTop))*v.y;c*=v.x,d*=v.y,f*=v.x,u*=v.y,c+=w,d+=j,g=Ks(b),b=Tb(g)}}return ug({width:f,height:u,x:c,y:d})}function Zg(e,t){const n=Qg(e).scrollLeft;return t?t.left+n:sc(_o(e)).left+n}function T2(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Zg(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function rse(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",a=_o(r),l=t?Jg(t.floating):!1;if(r===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},d=ko(1);const f=ko(0),u=aa(r);if((u||!u&&!i)&&((Ku(r)!=="body"||xp(a))&&(c=Qg(r)),u)){const m=sc(r);d=gu(r),f.x=m.x+r.clientLeft,f.y=m.y+r.clientTop}const p=a&&!u&&!i?T2(a,c):ko(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+p.x,y:n.y*d.y-c.scrollTop*d.y+f.y+p.y}}function sse(e){return Array.from(e.getClientRects())}function ise(e){const t=_o(e),n=Qg(e),r=e.ownerDocument.body,s=ql(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ql(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Zg(e);const l=-n.scrollTop;return Vi(r).direction==="rtl"&&(a+=ql(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:l}}const Z1=25;function ose(e,t){const n=Ks(e),r=_o(e),s=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,c=0;if(s){i=s.width,a=s.height;const f=A0();(!f||f&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const d=Zg(r);if(d<=0){const f=r.ownerDocument,u=f.body,p=getComputedStyle(u),m=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-u.clientWidth-m);g<=Z1&&(i-=g)}else d<=Z1&&(i+=d);return{width:i,height:a,x:l,y:c}}function ase(e,t){const n=sc(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=aa(e)?gu(e):ko(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,c=s*i.x,d=r*i.y;return{width:a,height:l,x:c,y:d}}function eC(e,t,n){let r;if(t==="viewport")r=ose(e,n);else if(t==="document")r=ise(_o(e));else if(Wi(t))r=ase(t,n);else{const s=I2(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return ug(r)}function R2(e,t){const n=sl(e);return n===t||!Wi(n)||$u(n)?!1:Vi(n).position==="fixed"||R2(n,t)}function lse(e,t){const n=t.get(e);if(n)return n;let r=Gf(e,[],!1).filter(l=>Wi(l)&&Ku(l)!=="body"),s=null;const i=Vi(e).position==="fixed";let a=i?sl(e):e;for(;Wi(a)&&!$u(a);){const l=Vi(a),c=P0(a);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||xp(a)&&!c&&R2(e,a))?r=r.filter(f=>f!==a):s=l,a=sl(a)}return t.set(e,r),r}function cse(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?Jg(t)?[]:lse(t,this._c):[].concat(n),r],l=eC(t,a[0],s);let c=l.top,d=l.right,f=l.bottom,u=l.left;for(let p=1;p<a.length;p++){const m=eC(t,a[p],s);c=ql(m.top,c),d=Mu(m.right,d),f=Mu(m.bottom,f),u=ql(m.left,u)}return{width:d-u,height:f-c,x:u,y:c}}function use(e){const{width:t,height:n}=A2(e);return{width:t,height:n}}function dse(e,t,n){const r=aa(t),s=_o(t),i=n==="fixed",a=sc(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=ko(0);function d(){c.x=Zg(s)}if(r||!r&&!i)if((Ku(t)!=="body"||xp(s))&&(l=Qg(t)),r){const m=sc(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else s&&d();i&&!r&&s&&d();const f=s&&!r&&!i?T2(s,l):ko(0),u=a.left+l.scrollLeft-c.x-f.x,p=a.top+l.scrollTop-c.y-f.y;return{x:u,y:p,width:a.width,height:a.height}}function Ox(e){return Vi(e).position==="static"}function tC(e,t){if(!aa(e)||Vi(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return _o(e)===n&&(n=n.ownerDocument.body),n}function L2(e,t){const n=Ks(e);if(Jg(e))return n;if(!aa(e)){let s=sl(e);for(;s&&!$u(s);){if(Wi(s)&&!Ox(s))return s;s=sl(s)}return n}let r=tC(e,t);for(;r&&Jre(r)&&Ox(r);)r=tC(r,t);return r&&$u(r)&&Ox(r)&&!P0(r)?n:r||ese(e)||n}const fse=async function(e){const t=this.getOffsetParent||L2,n=this.getDimensions,r=await n(e.floating);return{reference:dse(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function pse(e){return Vi(e).direction==="rtl"}const hse={convertOffsetParentRelativeRectToViewportRelativeRect:rse,getDocumentElement:_o,getClippingRect:cse,getOffsetParent:L2,getElementRects:fse,getClientRects:sse,getDimensions:use,getScale:gu,isElement:Wi,isRTL:pse};function O2(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function mse(e,t){let n=null,r;const s=_o(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const d=e.getBoundingClientRect(),{left:f,top:u,width:p,height:m}=d;if(l||t(),!p||!m)return;const g=Ph(u),b=Ph(s.clientWidth-(f+p)),v=Ph(s.clientHeight-(u+m)),y=Ph(f),w={rootMargin:-g+"px "+-b+"px "+-v+"px "+-y+"px",threshold:ql(0,Mu(1,c))||1};let j=!0;function A(C){const $=C[0].intersectionRatio;if($!==c){if(!j)return a();$?a(!1,$):r=setTimeout(()=>{a(!1,1e-7)},1e3)}$===1&&!O2(d,e.getBoundingClientRect())&&a(),j=!1}try{n=new IntersectionObserver(A,{...w,root:s.ownerDocument})}catch{n=new IntersectionObserver(A,w)}n.observe(e)}return a(!0),i}function nC(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=I0(e),f=s||i?[...d?Gf(d):[],...t?Gf(t):[]]:[];f.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const u=d&&l?mse(d,n):null;let p=-1,m=null;a&&(m=new ResizeObserver(y=>{let[k]=y;k&&k.target===d&&m&&t&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=m)==null||w.observe(t)})),n()}),d&&!c&&m.observe(d),t&&m.observe(t));let g,b=c?sc(e):null;c&&v();function v(){const y=sc(e);b&&!O2(b,y)&&n(),b=y,g=requestAnimationFrame(v)}return n(),()=>{var y;f.forEach(k=>{s&&k.removeEventListener("scroll",n),i&&k.removeEventListener("resize",n)}),u==null||u(),(y=m)==null||y.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const gse=Gre,yse=Ure,xse=Xre,wse=Kre,rC=Wre,bse=(e,t,n)=>{const r=new Map,s={platform:hse,...n},i={...s.platform,_c:r};return Hre(e,t,{...s,platform:i})};var vse=typeof document<"u",kse=function(){},nm=vse?h.useLayoutEffect:kse;function dg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!dg(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!dg(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function M2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function sC(e,t){const n=M2(e);return Math.round(t*n)/n}function Mx(e){const t=h.useRef(e);return nm(()=>{t.current=e}),t}function iC(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[f,u]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=h.useState(r);dg(p,r)||m(r);const[g,b]=h.useState(null),[v,y]=h.useState(null),k=h.useCallback(_=>{_!==C.current&&(C.current=_,b(_))},[]),w=h.useCallback(_=>{_!==$.current&&($.current=_,y(_))},[]),j=i||g,A=a||v,C=h.useRef(null),$=h.useRef(null),B=h.useRef(f),F=c!=null,z=Mx(c),L=Mx(s),O=Mx(d),W=h.useCallback(()=>{if(!C.current||!$.current)return;const _={placement:t,strategy:n,middleware:p};L.current&&(_.platform=L.current),bse(C.current,$.current,_).then(R=>{const P={...R,isPositioned:O.current!==!1};M.current&&!dg(B.current,P)&&(B.current=P,$r.flushSync(()=>{u(P)}))})},[p,t,n,L,O]);nm(()=>{d===!1&&B.current.isPositioned&&(B.current.isPositioned=!1,u(_=>({..._,isPositioned:!1})))},[d]);const M=h.useRef(!1);nm(()=>(M.current=!0,()=>{M.current=!1}),[]),nm(()=>{if(j&&(C.current=j),A&&($.current=A),j&&A){if(z.current)return z.current(j,A,W);W()}},[j,A,W,z,F]);const T=h.useMemo(()=>({reference:C,floating:$,setReference:k,setFloating:w}),[k,w]),E=h.useMemo(()=>({reference:j,floating:A}),[j,A]),D=h.useMemo(()=>{const _={position:n,left:0,top:0};if(!E.floating)return _;const R=sC(E.floating,f.x),P=sC(E.floating,f.y);return l?{..._,transform:"translate("+R+"px, "+P+"px)",...M2(E.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:R,top:P}},[n,l,E.floating,f.x,f.y]);return h.useMemo(()=>({...f,update:W,refs:T,elements:E,floatingStyles:D}),[f,W,T,E,D])}const Sse=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?rC({element:r.current,padding:s}).fn(n):{}:r?rC({element:r,padding:s}).fn(n):{}}}},oC=(e,t)=>{const n=gse(e);return{name:n.name,fn:n.fn,options:[e,t]}},Nse=(e,t)=>{const n=xse(e);return{name:n.name,fn:n.fn,options:[e,t]}},jse=(e,t)=>{const n=wse(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cse=(e,t)=>{const n=yse(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ese=(e,t)=>{const n=Sse(e);return{name:n.name,fn:n.fn,options:[e,t]}},_se={arrowBase:32,arrowColor:"#ffffff",arrowSize:16,arrowSpacing:12,backgroundColor:"#ffffff",beaconSize:36,beaconTrigger:"click",beforeTimeout:5e3,blockTargetInteraction:!1,buttons:["back","close","primary"],closeButtonAction:"close",disableFocusTrap:!1,dismissKeyAction:"close",hideOverlay:!1,loaderDelay:300,offset:10,overlayClickAction:"close",overlayColor:"#00000080",primaryColor:"#000000",scrollDuration:300,scrollOffset:20,showProgress:!1,skipBeacon:!1,skipScroll:!1,spotlightPadding:10,spotlightRadius:4,targetWaitTimeout:1e3,textColor:"#000000",width:380,zIndex:100},Pse={beaconOptions:{offset:-18}},$2={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},Ase={isFixed:!1,locale:$2,placement:"bottom"},Ise={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},Ft={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update",COMPLETE:"complete"},_r={TOUR_START:"tour:start",STEP_BEFORE_HOOK:"step:before_hook",STEP_BEFORE:"step:before",SCROLL_START:"scroll:start",SCROLL_END:"scroll:end",BEACON:"beacon",TOOLTIP:"tooltip",STEP_AFTER:"step:after",STEP_AFTER_HOOK:"step:after_hook",TOUR_END:"tour:end",TOUR_STATUS:"tour:status",TARGET_NOT_FOUND:"error:target_not_found",ERROR:"error"},We={INIT:"init",READY:"ready",BEACON_BEFORE:"beacon_before",BEACON:"beacon",TOOLTIP_BEFORE:"tooltip_before",TOOLTIP:"tooltip",COMPLETE:"complete"},po={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},Rt={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},Tse="react-joyride-portal";function Rse(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function su(...e){return Sre({all:!0,isMergeableObject:t=>!(!Xr.plainObject(t)||h.isValidElement(t))})(...e)}function D2(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function Uo(e,t={}){const{defaultValue:n,step:r,steps:s}=t;let i=Rx(e);if(i)(i.includes("{current}")||i.includes("{total}"))&&r&&s&&(i=i.replace("{current}",r.toString()).replace("{total}",s.toString()));else if(h.isValidElement(e)&&!Object.values(e.props).length&&D2(e.type)==="function")try{i=Uo(e.type({}),t)}catch{i=Rx(n)}else i=Rx(n);return i}function Ar(e,t,n,...r){if(!e)return;const s=new Date,i=`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}:${String(s.getSeconds()).padStart(2,"0")}.${String(s.getMilliseconds()).padStart(3,"0")}`;console.log(`${t} %c${n}%c ${i}`,"font-weight: bold","color: gray; font-weight: normal",...r)}function Lse(e,t){const n=Rse(t);return{...e,...n}}function Xf(){}function Ose(e){return Object.keys(e)}function fg(e,...t){if(!Xr.plainObject(e))throw new TypeError("Expected an object");const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&(t.includes(r)||(n[r]=e[r]));return n}function aC(e,...t){if(!Xr.plainObject(e))throw new TypeError("Expected an object");if(!t.length)return e;const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&t.includes(r)&&(n[r]=e[r]);return n}function Rb(e,t,n){const r=i=>i.replace("{current}",String(t)).replace("{total}",String(n));if(D2(e)==="string")return r(e);if(!h.isValidElement(e))return e;const{children:s}=e.props;if(Xr.string(s)&&s.includes("{current}"))return h.cloneElement(e,{children:r(s)});if(Array.isArray(s))return h.cloneElement(e,{children:s.map(i=>typeof i=="string"?r(i):Rb(i,t,n))});if(Xr.function(e.type)&&!Object.values(e.props).length)try{return Rb(e.type({}),t,n)}catch{return e}return e}function lC(e){return Ose(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function T0(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function cC(e){let t=0,n=0,r=e;for(;r;)t+=r.offsetTop,n+=r.offsetLeft,r=r.offsetParent;return{left:n,top:t}}function R0(e){return e?e.getBoundingClientRect():null}function Mse(e=!1){const{body:t,documentElement:n}=document;if(!t||!n)return 0;if(e){const r=[t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight].sort((i,a)=>i-a),s=Math.floor(r.length/2);return r.length%2===0?(r[s-1]+r[s])/2:r[s]}return Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function pi(e){if(!e)return null;if(typeof e=="function")try{return e()}catch{return null}if(typeof e=="object"&&"current"in e)return e.current;if(typeof e=="string")try{return document.querySelector(e)}catch{return null}return e}function $se(e,t,n){const r=R0(e),s=qu(e),i=s?!s.isSameNode(Ss()):!1,a=n??Yu(e);let l=0,c=(r==null?void 0:r.top)??0;return i&&a?c=(r==null?void 0:r.top)??0:s instanceof HTMLElement&&(l=s.scrollTop,!i&&!a&&(c+=l),s.isSameNode(Ss())||(c+=Ss().scrollTop)),Math.floor(c-t)}function qu(e,t){if(!e)return Ss();const n=N2(e);if(n){if(n.isSameNode(Ss()))return t?document:Ss();if(!(n.scrollHeight>n.offsetHeight))return Ss()}return n}function Dse(e){const t=e.getBoundingClientRect(),n=Ss(),r=t.top+t.height/2,s=window.innerHeight/2;return Math.max(0,n.scrollTop+r-s)}function Fse(e,t){if(!e)return 0;const n=N2(e)??Ss(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,s=R0(n),i=n.scrollTop??0,{offsetTop:a=0,scrollTop:l=0}=n;let c=e.getBoundingClientRect().top+l;if(a&&(F2(e)||zse(e))){const f=e.getBoundingClientRect(),u=f.top-((s==null?void 0:s.top)??0),p=u+f.height,m=n.clientHeight,g=m*.2;u>=g&&p<=m-g?c=i:c=u+i}const d=Math.floor(c-t-r);return d<0?0:d}function zse(e){return e.offsetParent!==document.body}function F2(e){if(!e)return!1;const t=qu(e);return t?!t.isSameNode(Ss()):!1}function Yu(e,t="fixed"){if(!e||!(e instanceof Element))return!1;const{nodeName:n}=e;return n==="BODY"||n==="HTML"?!1:getComputedStyle(e).position===t?!0:e.parentNode?Yu(e.parentNode,t):!1}function Ah(e){if(!e)return!1;let t=e;for(;t&&t!==document.body;){if(t instanceof HTMLElement){const{display:n,visibility:r}=getComputedStyle(t);if(n==="none"||r==="hidden")return!1}t=t.parentElement??null}return!0}function uC(e){const{isFirstStep:t,scrollToFirstStep:n,step:r,target:s,targetLifecycle:i}=e;if(r.skipScroll||t&&!n&&i!==We.TOOLTIP||r.placement==="center")return!1;const a=s!=null&&s.isConnected?qu(s):Ss(),l=a?!a.isSameNode(Ss()):!1;return(r.isFixed||Yu(s))&&!l?!1:a.scrollHeight>a.clientHeight}function Ss(){return document.scrollingElement??document.documentElement}function dC(e,t){const{duration:n,element:r}=t;let s=()=>{};const i=new Promise(a=>{const{scrollTop:l}=r,c=e>l?e-l:l-e;s=Are.top(r,e,{duration:c<100?50:n},()=>{a()})});return{cancel:s,promise:i}}function Bse(e){const t=e.replace(/^#?([\da-f])([\da-f])([\da-f])$/i,(r,s,i,a)=>s+s+i+i+a+a),n=/^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})/i.exec(t);return n?[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)]:[]}const z2={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},Ih={...z2,borderRadius:4,padding:8};function Hse(e,t){const{styles:n}=e,r=su(n??{},t.styles??{});let{width:s}=t;T0()&&(s=typeof s=="number"&&window.innerWidth<s?window.innerWidth-30:s);const i={bottom:0,left:0,overflow:"hidden",position:"absolute",right:0,top:0,zIndex:t.zIndex};return su({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...z2,display:"inline-flex",borderRadius:"50%",position:"relative"},beacon:{height:t.beaconSize,width:t.beaconSize},beaconInner:{animation:"joyride-beacon-inner 1.2s infinite ease-in-out",backgroundColor:t.primaryColor,borderRadius:"50%",display:"block",height:"50%",left:"50%",opacity:.7,position:"absolute",top:"50%",transform:"translate(-50%, -50%)",width:"50%"},beaconOuter:{animation:"joyride-beacon-outer 1.2s infinite ease-in-out",backgroundColor:`rgba(${Bse(t.primaryColor).join(",")}, 0.2)`,border:`2px solid ${t.primaryColor}`,borderRadius:"50%",boxSizing:"border-box",display:"block",height:"100%",left:0,opacity:.9,position:"absolute",top:0,transformOrigin:"center",width:"100%"},buttonBack:{...Ih,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...Ih,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...Ih,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...Ih,color:t.textColor,fontSize:14},floater:{display:"inline-block",filter:"drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))",maxWidth:"100%",transition:"opacity 0.3s"},loader:{alignItems:"center",display:"flex",height:48,inset:0,justifyContent:"center",pointerEvents:"none",position:"fixed",width:48,zIndex:t.zIndex+1},overlay:{...i,backgroundColor:t.overlayColor},spotlight:{},tooltip:{backgroundColor:t.backgroundColor,borderRadius:5,boxSizing:"border-box",color:t.textColor,fontSize:16,maxWidth:"100%",padding:12,position:"relative",width:s},tooltipContainer:{lineHeight:1.4,textAlign:"center"},tooltipTitle:{fontSize:18,margin:0},tooltipContent:{paddingBottom:12,paddingTop:12},tooltipFooter:{alignItems:"center",display:"flex",justifyContent:"flex-end"},tooltipFooterSpacer:{flex:1}},r)}const Wse=["after","arrowBase","arrowColor","arrowSize","arrowSpacing","backgroundColor","beaconSize","beaconTrigger","before","beforeTimeout","buttons","closeButtonAction","skipBeacon","dismissKeyAction","disableFocusTrap","hideOverlay","skipScroll","blockTargetInteraction","loaderDelay","offset","overlayClickAction","overlayColor","primaryColor","scrollDuration","scrollOffset","showProgress","spotlightPadding","spotlightRadius","targetWaitTimeout","textColor","width","zIndex"];function L0(e,t){if(!t)return null;const n=su(Ase,aC(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=su(_se,e.options??{},aC(t,...Wse)),s=Hse(e,{...n,...r}),i=su(Pse,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:su($2,e.locale??{},n.locale||{}),floatingOptions:i,spotlightPadding:Vse(r.spotlightPadding),styles:s}}function Vse(e){return typeof e=="number"?{top:e,right:e,bottom:e,left:e}:{top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0,left:(e==null?void 0:e.left)??0}}function Use(e,t,n){const{action:r}=t,s=n&&[Ft.PREV,Ft.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||s}function B2(e,t=!1){return Xr.plainObject(e)?e.target?!0:(Ar(t,"tour","target is missing from the step"),!1):(Ar(t,"tour","step must be an object"),!1)}function H2(e,t=!1){return Xr.array(e)?e.every(n=>B2(n,t)):(Ar(t,"tour","steps must be an array"),!1)}var Kse=class{constructor(e){er(this,"beaconPosition",null);er(this,"debug");er(this,"eventListeners",new Map);er(this,"listeners",new Set);er(this,"props");er(this,"snapshot");er(this,"state");er(this,"steps");er(this,"tooltipPosition",null);er(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});er(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);er(this,"getServerSnapshot",()=>this.snapshot);er(this,"getSnapshot",()=>this.snapshot);er(this,"getEventState",()=>fg(this.snapshot,"positioned"));er(this,"getState",()=>fg(this.snapshot,"positioned"));er(this,"setPositionData",(e,t)=>{var r,s,i;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&Ar(this.debug,`step:${this.state.index}`,"positioned",`${e} ${t.placement}`),e==="beacon"?this.beaconPosition=t:this.tooltipPosition=t,(this.state.lifecycle===We.BEACON_BEFORE||this.state.lifecycle===We.TOOLTIP_BEFORE)&&!this.state.positioned&&this.updateState({positioned:!0});const n=(i=(s=this.getStep())==null?void 0:s.floatingOptions)==null?void 0:i.onPosition;n&&n(t)});er(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});er(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});er(this,"on",(e,t)=>{let n=this.eventListeners.get(e);return n||(n=new Set,this.eventListeners.set(e,n)),n.add(t),()=>{n.delete(t)}});er(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));er(this,"updateState",(e,t=!1)=>{const{controlled:n,index:r}=this.state,s=this.snapshot,i=n&&!t&&e.index!==void 0?r:e.index??r,a={action:e.action??this.state.action,controlled:n,index:i,lifecycle:e.lifecycle??this.state.lifecycle,origin:e.origin??null,positioned:e.positioned??this.state.positioned,scrolling:e.scrolling??this.state.scrolling,size:e.size??this.state.size,status:e.status??this.state.status,waiting:e.waiting??this.state.waiting},l=this.applyTransitions(a);if(this.state=l,!S0(s,l)){this.snapshot=Object.freeze({...l});for(const c of this.listeners)c(this.snapshot)}});const{initialStepIndex:t,stepIndex:n,steps:r=[]}=e??{},s=Xr.number(n);let i=0;this.debug=(e==null?void 0:e.debug)??!1,s?(i=n,Xr.number(t)&&Ar(this.debug,"tour","initialStepIndex is ignored in controlled mode")):Xr.number(t)&&(t>=0&&t<r.length?i=t:r.length>0&&Ar(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:Ft.INIT,controlled:s,index:i,lifecycle:We.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?Rt.READY:Rt.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===Rt.WAITING&&e.size>0?{...e,status:Rt.RUNNING}:e}getStep(e){return L0(this.props,this.steps[e??this.state.index])}};function qse(e){return new Kse(e)}function fC(e,t){return Math.min(Math.max(e,0),t)}function Yse(e,t,n){const r=h.useRef(t),s=h.useRef(n);return r.current=t,s.current=n,h.useMemo(()=>{const i=()=>e.current.getSnapshot();return{close:(v=null)=>{const{index:y,status:k}=i();k===Rt.RUNNING&&e.current.updateState({action:Ft.CLOSE,index:y+1,origin:v,lifecycle:We.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:v=>{const{controlled:y,size:k,status:w}=i();if(y){Ar(r.current,"tour","go() is not supported in controlled mode");return}w===Rt.RUNNING&&e.current.updateState({action:Ft.GO,index:v,lifecycle:We.COMPLETE,positioned:!1,scrolling:!1,status:v<k?w:Rt.FINISHED,waiting:!1})},info:()=>fg(e.current.getSnapshot(),"positioned"),next:v=>{const{index:y,size:k,status:w}=i();w===Rt.RUNNING&&e.current.updateState({action:Ft.NEXT,index:fC(y+1,k),lifecycle:We.COMPLETE,origin:v,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:v}=i();v===Rt.RUNNING&&e.current.updateState({action:Ft.UPDATE,lifecycle:We.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:v=>{const{index:y,size:k,status:w}=i();w===Rt.RUNNING&&e.current.updateState({action:Ft.PREV,index:fC(y-1,k),lifecycle:We.COMPLETE,origin:v,positioned:!1,scrolling:!1,waiting:!1})},reset:(v=!1)=>{const{controlled:y}=i();if(y){Ar(r.current,"tour","reset() is not supported in controlled mode");return}s.current(),e.current.updateState({action:Ft.RESET,index:0,lifecycle:We.INIT,positioned:!1,scrolling:!1,status:v?Rt.RUNNING:Rt.READY,waiting:!1})},skip:v=>{const{status:y}=i();y===Rt.RUNNING&&e.current.updateState({action:Ft.SKIP,lifecycle:We.COMPLETE,origin:v,positioned:!1,scrolling:!1,status:Rt.SKIPPED,waiting:!1})},start:v=>{const{index:y,size:k}=i();s.current(),e.current.updateState({action:Ft.START,index:Xr.number(v)?v:y,lifecycle:We.INIT,positioned:!1,scrolling:!1,status:k?Rt.RUNNING:Rt.WAITING,waiting:!1},!0)},stop:(v=!1)=>{const{index:y,status:k}=i();[Rt.FINISHED,Rt.SKIPPED].includes(k)||e.current.updateState({action:Ft.STOP,index:y+(v?1:0),lifecycle:We.COMPLETE,positioned:!1,scrolling:!1,status:Rt.PAUSED,waiting:!1})}}},[e])}const Gse=new Set(["origin","positioned"]);function Xse(e,t){const n=h.useRef(null);h.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return Ar(!0,"tour","init",r),n.current=r,e.current.subscribe(s=>{const i=n.current;if(n.current=s,!i)return;const a={};let l=!1;for(const c of Object.keys(s))s[c]!==i[c]&&!Gse.has(c)&&(a[c]={from:i[c],to:s[c]},(c==="status"||c==="size")&&(l=!0));Object.keys(a).length&&(!l&&s.index>=s.size||Ar(!0,l?"tour":`step:${s.index}`,"state",a))})},[t,e])}function Jse(e,t,n){const r=h.useRef(e),s=h.useRef(t);return r.current=e,s.current=t,h.useCallback((i,a,l)=>{var d;const c={...n.current.getEventState(),error:null,scroll:null,step:a,type:i,...l};(d=r.current)==null||d.call(r,c,s.current),n.current.dispatch(c,s.current)},[n])}function Ta(e,t){return{hasChanged(n){return e[n]!==t[n]},hasChangedTo(n,r){const s=e[n],i=t[n];return Array.isArray(r)?r.includes(s)&&!r.includes(i):s===r&&i!==r},previous:t}}function Qse(e){const{addFailure:t,controls:n,emitEvent:r,previousState:s,props:i,state:a,step:l,store:c}=e,{action:d,index:f,lifecycle:u,positioned:p,scrolling:m,size:g,status:b}=a,v=g2(l)??null,y=h.useRef(null),k=h.useRef(i),w=h.useRef(a),j=h.useRef(s),A=h.useRef(l),C=h.useRef(v),$=h.useRef(n),B=h.useRef(null),F=h.useRef(null),z=h.useRef(null);k.current=i,w.current=a,j.current=s,A.current=l,C.current=v,$.current=n;const L=()=>{B.current&&(clearInterval(B.current),B.current=null),F.current=null,z.current&&(z.current.cancel(),z.current=null)};h.useEffect(()=>{if(!j.current)return;const{hasChangedTo:O}=Ta(w.current,j.current);(O("action",[Ft.NEXT,Ft.PREV,Ft.SKIP,Ft.CLOSE])||y.current===Ft.CLOSE&&d===Ft.START)&&(y.current=d)},[d]),h.useEffect(()=>{if(!j.current)return()=>{L()};const{hasChanged:O}=Ta(w.current,j.current),W=A.current;if(O("index")&&L(),b!==Rt.RUNNING||!W||u!==We.INIT)return()=>{L()};const{hasChangedTo:M}=Ta(w.current,j.current);M("status",Rt.RUNNING)&&[Rt.IDLE,Rt.READY,Rt.PAUSED].includes(j.current.status)&&r(_r.TOUR_START,W),c.current.cleanupPositionData();const{debug:T}=k.current;if(W.before&&!z.current){Ar(T,`step:${f}`,"before()",W),z.current={cancel:()=>{}},c.current.updateState({waiting:!0}),r(_r.STEP_BEFORE_HOOK,W,{action:y.current??w.current.action});const E=()=>{z.current=null,c.current.updateState({action:y.current??w.current.action,waiting:!1,lifecycle:We.READY})},D=new AbortController,_=W.beforeTimeout;z.current={cancel:()=>D.abort()};const R=_?setTimeout(()=>{D.signal.aborted||(Ar(T,`step:${f}`,"before()","timed out",`${_}ms`),D.abort(),t(W,"before_hook"),r(_r.ERROR,W,{error:new Error("Step before hook timed out")}),E())},_):null;W.before({...c.current.getState(),action:y.current??c.current.getState().action,step:W}).then(()=>{D.signal.aborted||(R&&clearTimeout(R),E())}).catch(P=>{D.signal.aborted||(R&&clearTimeout(R),t(W,"before_hook"),r(_r.ERROR,W,{error:P instanceof Error?P:new Error(String(P))}),E())})}else if(!z.current){B.current&&F.current!==W.target&&L();const E=pi(W.target);if(E&&Ah(E))L(),c.current.updateState({action:y.current??Ft.UPDATE,lifecycle:We.READY,waiting:!1});else if(W.targetWaitTimeout===0)c.current.updateState({action:y.current??Ft.UPDATE,lifecycle:We.READY,waiting:!1});else if(!B.current){const{targetWaitTimeout:D}=W,_=Date.now();F.current=W.target,Ar(T,`step:${f}`,"polling","started",`${D}ms`),c.current.updateState({waiting:!0}),B.current=setInterval(()=>{const R=pi(W.target),P=Date.now()-_,X=P>=D;(R&&Ah(R)||X)&&(Ar(T,`step:${f}`,"polling",R&&Ah(R)?"found":"timed out",`${P}ms`),L(),c.current.updateState({action:y.current??Ft.UPDATE,lifecycle:We.READY,waiting:!1}))},100)}}return()=>{L()}},[t,r,f,u,b,c]),h.useEffect(()=>{if(!j.current)return;const{hasChanged:O,hasChangedTo:W,previous:M}=Ta(w.current,j.current),T=A.current;if(!T)return;const E=pi(T.target),D=!!E;if(D&&Ah(E)){if(W("lifecycle",We.READY)&&M.lifecycle===We.INIT&&r(_r.STEP_BEFORE,T,{action:y.current??w.current.action}),W("lifecycle",We.READY)){const _=w.current,R=Use(T,_,k.current.continuous)?We.TOOLTIP:We.BEACON,P=pi(T.scrollTarget??T.spotlightTarget??T.target),X=uC({isFirstStep:_.index===0,scrollToFirstStep:k.current.scrollToFirstStep,step:T,target:P,targetLifecycle:R}),Z=R===We.TOOLTIP?We.TOOLTIP_BEFORE:We.BEACON_BEFORE;Ar(k.current.debug,`step:${f}`,"scroll",X?"needed":"skipped"),c.current.updateState({action:Ft.UPDATE,lifecycle:Z,scrolling:X})}}else if(w.current.status===Rt.RUNNING&&u!==We.INIT&&u!==We.COMPLETE&&O("lifecycle")){Ar(k.current.debug,`step:${f}`,D?"Target not visible":"Target not mounted",T),t(T,"target_not_found"),r(_r.TARGET_NOT_FOUND,T);const _=w.current;_.controlled||c.current.updateState({action:Ft.UPDATE,index:_.index+(_.action===Ft.PREV?-1:1),lifecycle:We.INIT})}},[t,r,f,u,c]),h.useEffect(()=>{if(!j.current)return;const{hasChangedTo:O,previous:W}=Ta(w.current,j.current),M=A.current,T=C.current;if(M&&O("lifecycle",We.TOOLTIP_BEFORE)&&W.lifecycle===We.BEACON){const _=pi(M.scrollTarget??M.spotlightTarget??M.target);if(uC({isFirstStep:w.current.index===0,scrollToFirstStep:k.current.scrollToFirstStep,step:M,target:_,targetLifecycle:We.TOOLTIP})){c.current.updateState({scrolling:!0,positioned:!1});return}}const E=u===We.BEACON_BEFORE||u===We.TOOLTIP_BEFORE;if(M&&E&&!m){const _=u===We.TOOLTIP_BEFORE?We.TOOLTIP:We.BEACON;c.current.updateState({action:Ft.UPDATE,lifecycle:_})}M&&O("lifecycle",We.BEACON)&&r(_r.BEACON,M),M&&O("lifecycle",We.TOOLTIP)&&r(_r.TOOLTIP,M);const D=w.current;if((D.status===Rt.RUNNING||D.controlled&&D.status===Rt.PAUSED&&M)&&T&&O("lifecycle",We.COMPLETE)&&W.lifecycle===We.TOOLTIP&&(r(_r.STEP_AFTER,T,{action:y.current??Ft.UPDATE,index:W.index??D.index,lifecycle:D.lifecycle}),T.after)){r(_r.STEP_AFTER_HOOK,T,{action:y.current??Ft.UPDATE,index:W.index??D.index,lifecycle:D.lifecycle});try{T.after({...c.current.getState(),action:y.current??Ft.UPDATE,index:W.index??D.index,lifecycle:D.lifecycle,step:T})}catch{}}},[r,u,p,m,c]),h.useEffect(()=>{if(!j.current)return;const{hasChangedTo:O,previous:W}=Ta(w.current,j.current),M=A.current,T=C.current;g&&!M&&u===We.INIT&&c.current.updateState({action:Ft.UPDATE,lifecycle:We.COMPLETE,status:Rt.FINISHED}),!w.current.controlled&&b===Rt.RUNNING&&O("lifecycle",We.COMPLETE)&&f<g&&c.current.updateState({action:Ft.UPDATE,lifecycle:We.INIT}),O("lifecycle",We.COMPLETE)&&f>=g&&c.current.updateState({action:Ft.UPDATE,lifecycle:We.COMPLETE,status:Rt.FINISHED});const E=M??T??L0(k.current,k.current.steps[f-1]);if(E&&O("status",[Rt.FINISHED,Rt.SKIPPED])){let D;M?D=f:T?D=W.index??f:D=f-1,r(_r.TOUR_END,E,{index:D}),w.current.controlled||$.current.reset(),y.current=null}M&&O("action",Ft.STOP)&&(y.current=null,r(_r.TOUR_STATUS,M)),M&&O("action",Ft.RESET)&&(r(_r.TOUR_STATUS,M),y.current=null)},[d,r,f,u,g,b,c])}function Zse({controls:e,emitEvent:t,props:n,state:r,store:s}){const{debug:i,initialStepIndex:a,run:l,stepIndex:c,steps:d}=n,f=h.useRef(void 0),u=h.useRef(r),p=h.useRef(e);u.current=r,p.current=e,h.useEffect(()=>{const m=f.current;if(f.current=n,!m||n===m)return;const{hasChanged:g}=Ta(n,m);if(S0(m.steps,d)||(H2(d,i)?s.current.setSteps(d):(Ar(i,"tour","Steps are not valid",d),t(_r.ERROR,d[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),g("run"))l?s.current.getState().size&&p.current.start(c??a):p.current.stop();else if(Xr.number(c)&&g("stepIndex")){const b=Xr.number(m.stepIndex)&&m.stepIndex<c?Ft.NEXT:Ft.PREV;[Rt.FINISHED,Rt.SKIPPED].includes(u.current.status)||s.current.updateState({action:b,index:c,lifecycle:We.INIT,positioned:!1},!0)}},[i,t,a,n,l,c,d,s])}function eie(e,t){var l,c,d,f;const{beaconPosition:n,lifecycle:r,scrollOffset:s,step:i}=t;if(i.scrollTarget||i.spotlightTarget)return Math.max(0,e);let a=e-i.spotlightPadding.top;if(r===We.BEACON_BEFORE&&(n!=null&&n.placement)){const u=tie(n);["bottom"].includes(n.placement)||(a+=Math.floor(u-s))}else if(r===We.TOOLTIP_BEFORE){const{placement:u}=i;if(u==="top"){const p=((l=document.querySelector(".react-joyride__floater"))==null?void 0:l.getBoundingClientRect().height)??0,m=(c=i.floatingOptions)!=null&&c.hideArrow?0:i.arrowSize,g=i.offset+i.spotlightPadding.top+m;a-=p+g}else if(u==="left"||u==="right"){const p=((d=document.querySelector(".react-joyride__floater"))==null?void 0:d.getBoundingClientRect().height)??0,m=((f=pi(i.target))==null?void 0:f.getBoundingClientRect().height)??0,g=s+i.spotlightPadding.top+m/2-p/2;g<s&&(a-=s-g)}}return Math.max(0,a)}function tie(e){var n;const t=(n=e.middlewareData)==null?void 0:n.offset;return t?["left","right"].some(r=>e.placement.startsWith(r))?t.x:t.y:0}function nie({emitEvent:e,previousState:t,props:n,state:r,step:s,store:i}){const{index:a,lifecycle:l,positioned:c,scrolling:d,status:f}=r,u=h.useRef(null),p=h.useRef(r),m=h.useRef(t),g=h.useRef(n),b=h.useRef(s);p.current=r,m.current=t,g.current=n,b.current=s,h.useEffect(()=>()=>{var v;(v=u.current)==null||v.call(u)},[]),h.useEffect(()=>{var A;if(!m.current||!b.current)return;const{hasChangedTo:v}=Ta(p.current,m.current),y=b.current,{debug:k}=g.current,{scrollDuration:w}=y,j=l===We.BEACON_BEFORE||l===We.TOOLTIP_BEFORE;if(f===Rt.RUNNING&&j&&d&&v("positioned",!0)){const C=pi(y.scrollTarget??y.spotlightTarget??y.target),$=i.current.getPositionData("beacon"),B=qu(C),F=B?!B.isSameNode(Ss()):!1;(A=u.current)==null||A.call(u),(async()=>{if(F&&!Yu(B)){const D=Ss(),_=Dse(B),R={initial:D.scrollTop,target:_,element:D,duration:w};e(_r.SCROLL_START,y,{scroll:R});const{cancel:P,promise:X}=dC(_,{element:D,duration:w});u.current=P,await X,e(_r.SCROLL_END,y,{scroll:R})}const L=Math.floor(Fse(C,y.scrollOffset))||0,O=F?L:eie(L,{beaconPosition:$,lifecycle:l,scrollOffset:y.scrollOffset,step:y});Ar(k,`step:${a}`,"scroll",F?"custom":"document",`${L} → ${O}`);const W=B,M={initial:W.scrollTop,target:O,element:W,duration:w};e(_r.SCROLL_START,y,{scroll:M});const{cancel:T,promise:E}=dC(O,{element:W,duration:w});u.current=T,await E,e(_r.SCROLL_END,y,{scroll:M}),i.current.updateState({scrolling:!1})})().catch(()=>{i.current.updateState({scrolling:!1})})}},[e,a,l,c,d,f,i])}function rie(e){const t=Fne(()=>Lse(Ise,e),[e]),{debug:n,initialStepIndex:r,onEvent:s,run:i,stepIndex:a,steps:l}=t,c=h.useRef(qse(t)),d=aA.useSyncExternalStore(c.current.subscribe,c.current.getSnapshot,c.current.getServerSnapshot),[f,u]=h.useState([]),p=h.useCallback((A,C)=>{u($=>[...$,{reason:C,step:A}])},[]),m=h.useCallback(()=>{u([])},[]);Xse(c,n);const g=Yse(c,n,m),b=Jse(s,g,c),{index:v,size:y,status:k}=d,w=g2(d),j=h.useMemo(()=>L0(t,l[v]),[v,t,l]);return zne(()=>{i&&y&&H2(l,n)&&g.start(a??r)}),Dne(()=>{i&&y&&k===Rt.IDLE&&c.current.updateState({status:Rt.READY})},[i,y,k]),Zse({controls:g,emitEvent:b,props:t,state:d,store:c}),Qse({addFailure:p,controls:g,emitEvent:b,previousState:w,props:t,state:d,step:j,store:c}),nie({emitEvent:b,previousState:w,props:t,state:d,step:j,store:c}),{controls:g,failures:f,mergedProps:t,state:d,step:j,store:c}}function sie(e){const[t,n]=h.useState(null);return h.useEffect(()=>{let r=null,s=!1;if(e)if(Xr.domElement(e))r=e,s=!0;else{const i=document.querySelector(e);i&&(r=i)}else{const i=document.createElement("div");i.id=Tse,document.body.appendChild(i),r=i}return n(r),()=>{!r||s||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const iie={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function oie({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(h.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return Xf;const c=document.createElement("style");return c.id="joyride-loader-animation",e&&c.setAttribute("nonce",e),c.appendChild(document.createTextNode(`
209
209
  @keyframes joyride-loader-spin {
210
210
  to { transform: rotate(360deg); }
211
211
  }