@tom2012/cc-web 2026.5.16-b → 2026.5.17-b

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.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/frontend/dist/assets/{ChatOverlay-BK7ylWXg.js → ChatOverlay-DAgN-E-T.js} +1 -1
  3. package/frontend/dist/assets/{GraphPreview-T95ywRPB.js → GraphPreview-sveADvuJ.js} +1 -1
  4. package/frontend/dist/assets/{MobilePage-BLVs9_5k.js → MobilePage-6gsKYCbk.js} +3 -3
  5. package/frontend/dist/assets/{OfficePreview-CKseq-SI.js → OfficePreview-BYj9NyEQ.js} +2 -2
  6. package/frontend/dist/assets/{PdfPreview-ceRqAiRR.js → PdfPreview-1e1iPu2y.js} +1 -1
  7. package/frontend/dist/assets/{ProjectPage-5zeDKF0E.js → ProjectPage-CsigpH00.js} +5 -5
  8. package/frontend/dist/assets/{SettingsPage-DOUbFJgH.js → SettingsPage-BT8wt9ku.js} +1 -1
  9. package/frontend/dist/assets/{SkillHubPage-C5PQe1qz.js → SkillHubPage-BH3x0_RI.js} +1 -1
  10. package/frontend/dist/assets/{TrackEditor-CXn9A5LH.js → TrackEditor-CRhJKFTT.js} +3 -3
  11. package/frontend/dist/assets/TrackVisualEditor-DzrpHA4M.js +2 -0
  12. package/frontend/dist/assets/{chevron-down-B5k9UZaS.js → chevron-down-B1_H23MM.js} +1 -1
  13. package/frontend/dist/assets/{cssMode-UDf13VxV.js → cssMode-DFhAGaQl.js} +1 -1
  14. package/frontend/dist/assets/{editor.main-DL1nkpnc.js → editor.main-Dv96_EKG.js} +7 -7
  15. package/frontend/dist/assets/{freemarker2-CBpHtauL.js → freemarker2-DiQ8RXeI.js} +1 -1
  16. package/frontend/dist/assets/{handlebars-DR18oibx.js → handlebars-lNmPQXYn.js} +1 -1
  17. package/frontend/dist/assets/{html-R-xYVcDJ.js → html-CceA8gLw.js} +1 -1
  18. package/frontend/dist/assets/{htmlMode-CIT_YpSc.js → htmlMode-BUQC-_yi.js} +1 -1
  19. package/frontend/dist/assets/{index-CoQOKlkh.js → index-7HzPvnim.js} +2 -2
  20. package/frontend/dist/assets/index-D7pFgty-.css +1 -0
  21. package/frontend/dist/assets/{index-B_HwDnfi.js → index-DyxMqBaM.js} +1 -1
  22. package/frontend/dist/assets/{index-BOt8Hwdx.js → index-beUqd-be.js} +1 -1
  23. package/frontend/dist/assets/{index-CfixATeo.js → index-dHRMoKUn.js} +1 -1
  24. package/frontend/dist/assets/{javascript-Cy29oO-Z.js → javascript-CQe7I4xs.js} +1 -1
  25. package/frontend/dist/assets/{jsonMode-BB1s4t8K.js → jsonMode-DIlGP-3O.js} +1 -1
  26. package/frontend/dist/assets/{jszip.min-C28kgKJw.js → jszip.min-BVqCtBEI.js} +1 -1
  27. package/frontend/dist/assets/{liquid-DK8aRC0y.js → liquid-BgWCYgG1.js} +1 -1
  28. package/frontend/dist/assets/{mdx-Dj-K4EeA.js → mdx-toHFH6K_.js} +1 -1
  29. package/frontend/dist/assets/{python-ukYfDUCJ.js → python-y3adCX0q.js} +1 -1
  30. package/frontend/dist/assets/{razor-BTYacRNO.js → razor-h2keUv65.js} +1 -1
  31. package/frontend/dist/assets/{select-Bs4K8_uQ.js → select-Dg8S23zP.js} +1 -1
  32. package/frontend/dist/assets/{tsMode-CShWyfNw.js → tsMode-CrPSBUsc.js} +1 -1
  33. package/frontend/dist/assets/{typescript-CDgMSZwF.js → typescript-BqiSQ_9M.js} +1 -1
  34. package/frontend/dist/assets/{user-DCEdR_h8.js → user-ClsgmXgA.js} +1 -1
  35. package/frontend/dist/assets/{xml-DF-swCPQ.js → xml-DRvmzWvM.js} +1 -1
  36. package/frontend/dist/assets/{yaml-S7G1WVd6.js → yaml-C-SLyX1r.js} +1 -1
  37. package/frontend/dist/index.html +2 -2
  38. package/package.json +1 -1
  39. package/frontend/dist/assets/TrackVisualEditor-D7Nj1dV-.js +0 -2
  40. package/frontend/dist/assets/index-BD_QmGXq.css +0 -1
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/editor.main-Dv96_EKG.js","assets/index-7HzPvnim.js","assets/index-D7pFgty-.css","assets/editor-B5EY1bb8.css","assets/index-dHRMoKUn.js"])))=>i.map(i=>d[i]);
2
+ import{r as e,W as t,be as n,j as r,_ as o}from"./index-7HzPvnim.js";import{n as a,a as i,M as s,N as l,b as c}from"./ProjectPage-CsigpH00.js";import"./purify.es-CgRAQgUo.js";import"./ChatOverlay-DAgN-E-T.js";import"./chevron-down-B1_H23MM.js";import"./index-beUqd-be.js";import"./select-Dg8S23zP.js";import"./user-ClsgmXgA.js";function d(e){return"ask_user"===e.type||"fai"===e.type?e.outputVar:"let"===e.type?e.varName:null}function u(e,t){const n=[];for(const r of function(e,t){const n=[];for(let r=0;r<t;r++){const t=e.body[r];t&&("ask_user"===t.type?n.push({name:t.outputVar,source:"ask_user",parts:t.fields.map(e=>e.key)}):"fai"===t.type?n.push({name:t.outputVar,source:"fai",parts:t.outputs.map(e=>e.name)}):"let"===t.type&&n.push({name:t.varName,source:"let",parts:[]}))}return n}(e,t)){n.push(r.name);for(const e of r.parts)n.push(`${r.name}.${e}`)}return n}function p(e,t,n){if(0===n.length)return!1;return u(e,t).includes(n.join("."))}const f=/^[a-zA-Z_][a-zA-Z0-9_]*$/;function h(e){return e.path.join(".")}function g(e){return e.raw}function m(e){return"var"===e.kind?h(e):g(e)}function v(e){return"var"===e.kind?h(e):"lit"===e.kind?g(e):`${m((t=e).left)} ${t.op} ${m(t.right)}`;var t}function b(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\$/g,"\\$").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function x(e){return` // @@nid: ${e}`}function y(e){const t=e.inputs.map(e=>`${e.argName}:${e.argType}`).join("|"),n=e.outputs.map(e=>{const t=e.constraints??{},n=[];void 0!==t.min&&void 0!==t.max&&n.push(`range=${t.min}-${t.max}`),void 0!==t.maxLen&&n.push(`maxLen=${t.maxLen}`);const r=n.length?`;${n.join(",")}`:"";return"array"===e.type?`${e.name}:array<${e.innerType??"string"}>${r}`:`${e.name}:${e.type}${r}`}).join("|"),r=JSON.stringify(e.promptTemplate);return{faiName:e.faiName,inputsKey:t,outputsKey:n,promptKey:r}}function w(e,t){return`fai ${e}(${[...t.inputs.map(e=>`${e.argName}: ${e.argType}`),"prompt: prompt"].join(", ")}) -> ${t.outputs.map(e=>{let t=e.type;"array"===e.type&&(t=`array<${e.innerType??"string"}>`);const n=e.constraints??{},r=[];"number"==typeof n.min&&"number"==typeof n.max&&r.push(`${n.min}-${n.max}`),"number"==typeof n.maxLen&&r.push(`maxLen=${n.maxLen}`);const o=r.length?` ${r.join(" ")}`:"";return`${e.name}: ${t}${o}`}).join(", ")} { }`}function N(e,t){const n=[...e.inputs.map(e=>"var"===e.source.kind?h(e.source):g(e.source)),function(e){let t="";for(const n of e)"text"===n.kind?t+=b(n.raw):t+="${"+n.path.join(".")+"}";return`"${t}"`}(e.promptTemplate)].join(", ");return[x(e.id),` let ${e.outputVar} = ${t}(${n})`].join("\n")}function j(e){return"ask_user"===e.type||"fai"===e.type?e.outputVar:"let"===e.type?e.varName:null}function C(e){const t=[];if("fai"===e.type){for(const n of e.inputs)"var"===n.source.kind&&t.push(n.source);for(const n of e.promptTemplate)"ref"===n.kind&&t.push({kind:"var",path:n.path})}else("let"===e.type||"return"===e.type)&&k(e.value,t);return t}function k(e,t){"var"!==e.kind?"triple"===e.kind&&("var"===e.left.kind&&t.push(e.left),"var"===e.right.kind&&t.push(e.right)):t.push(e)}function D(e){const t=[];if(function(e,t){const n=new Map;for(let r=0;r<e.body.length;r++){const o=e.body[r];for(const n of C(o))p(e,r,n.path)||t.push({nodeIndex:r,nodeId:o.id,message:`variable "${n.path.join(".")}" not visible at this position`});const a=j(o);if(a){f.test(a)||t.push({nodeIndex:r,nodeId:o.id,message:`"${a}" is not a valid identifier (use letters/digits/underscore, no leading digit)`});const e=n.get(a);e?t.push({nodeIndex:r,nodeId:o.id,message:`name "${a}" already declared at node #${e.index}`}):n.set(a,{index:r,id:o.id})}if("fai"===o.type){f.test(o.faiName)||t.push({nodeIndex:r,nodeId:o.id,message:`fai name "${o.faiName}" is not a valid identifier`});for(const e of o.inputs)f.test(e.argName)||t.push({nodeIndex:r,nodeId:o.id,message:`fai input argName "${e.argName}" is not a valid identifier`});for(const e of o.outputs)f.test(e.name)||t.push({nodeIndex:r,nodeId:o.id,message:`fai output name "${e.name}" is not a valid identifier`})}if("ask_user"===o.type)for(const e of o.fields)f.test(e.key)||t.push({nodeIndex:r,nodeId:o.id,message:`ask_user field key "${e.key}" is not a valid identifier`})}}(e,t),t.length>0)return{ok:!1,errors:t};const n=[];for(const i of e.body)"fai"===i.type&&n.push(i);const r=function(e){const t=[],n=new Map;for(const r of e){const e=y(r);let o=t.find(t=>{return n=t.shape,r=e,n.faiName===r.faiName&&n.inputsKey===r.inputsKey&&n.outputsKey===r.outputsKey&&n.promptKey===r.promptKey;var n,r});if(!o){let n=e.faiName,a=2;for(;t.some(e=>e.declName===n);)n=`${e.faiName}_${a++}`;o={declName:n,declSource:w(n,r),shape:e},t.push(o)}n.set(r.id,o.declName)}return{decls:t,nodeIdToDeclName:n}}(n),o=[];for(let i=0;i<e.body.length;i++){const n=e.body[i];o.push(E(n,i,t,r))}if(t.length>0)return{ok:!1,errors:t};const a=0===r.decls.length?"":r.decls.map(e=>e.declSource).join("\n\n")+"\n\n";return{ok:!0,source:[s,l,"",a,"func main() -> any {",o.join("\n"),"}","export main",""].join("\n")}}function E(e,t,n,r){if("ask_user"===e.type)return function(e){const t=e.fields.map(e=>{const t=[`key: "${e.key}"`,`label: "${e.label}"`,`type: "${e.type}"`];return"enum"===e.type&&e.variants&&t.push(`variants: [${e.variants.map(e=>`"${e}"`).join(", ")}]`),!1===e.required&&t.push("required: false"),` { ${t.join(", ")} }`});return[x(e.id),` let ${e.outputVar} = __ccweb_ask_user({`," fields: [",t.join(",\n")," ]"," })"].join("\n")}(e);if("let"===e.type)return function(e){return[x(e.id),` let ${e.varName} = ${v(e.value)}`].join("\n")}(e);if("return"===e.type)return function(e){return[x(e.id),` return ${v(e.value)}`].join("\n")}(e);if("fai"===e.type){const o=r.nodeIdToDeclName.get(e.id);return o?N(e,o):(n.push({nodeIndex:t,nodeId:e.id,message:"fai dedupe lost node"}),"")}return n.push({nodeIndex:t,nodeId:e.id,message:"unknown node type"}),` // <unknown ${e.id}>`}const R="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function S(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function M(e){return"nodeType"in e}function T(e){var t,n;return e?S(e)?e:M(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function $(e){const{Document:t}=T(e);return e instanceof t}function O(e){return!S(e)&&e instanceof T(e).HTMLElement}function A(e){return e instanceof T(e).SVGElement}function I(e){return e?S(e)?e.document:M(e)?$(e)?e:O(e)||A(e)?e.ownerDocument:document:document:document}const L=R?e.useLayoutEffect:e.useEffect;function P(t){const n=e.useRef(t);return L(()=>{n.current=t}),e.useCallback(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return null==n.current?void 0:n.current(...t)},[])}function _(t,n){void 0===n&&(n=[t]);const r=e.useRef(t);return L(()=>{r.current!==t&&(r.current=t)},n),r}function B(t,n){const r=e.useRef();return e.useMemo(()=>{const e=t(r.current);return r.current=e,e},[...n])}function z(t){const n=P(t),r=e.useRef(null),o=e.useCallback(e=>{e!==r.current&&(null==n||n(e,r.current)),r.current=e},[]);return[r,o]}function K(t){const n=e.useRef();return e.useEffect(()=>{n.current=t},[t]),n.current}let V={};function F(t,n){return e.useMemo(()=>{if(n)return n;const e=null==V[t]?0:V[t]+1;return V[t]=e,t+"-"+e},[t,n])}function X(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((t,n)=>{const r=Object.entries(n);for(const[o,a]of r){const n=t[o];null!=n&&(t[o]=n+e*a)}return t},{...t})}}const Y=X(1),W=X(-1);function U(e){if(!e)return!1;const{KeyboardEvent:t}=T(e.target);return t&&e instanceof t}function q(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=T(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const J=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[J.Translate.toString(e),J.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),H="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Z(e){return e.matches(H)?e:e.querySelector(H)}const G={display:"none"};function Q(e){let{id:n,value:r}=e;return t.createElement("div",{id:n,style:G},r)}function ee(e){let{id:n,announcement:r,ariaLiveType:o="assertive"}=e;return t.createElement("div",{id:n,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":o,"aria-atomic":!0},r)}const te=e.createContext(null);const ne={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},re={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function oe(r){let{announcements:o=re,container:a,hiddenTextDescribedById:i,screenReaderInstructions:s=ne}=r;const{announce:l,announcement:c}=function(){const[t,n]=e.useState("");return{announce:e.useCallback(e=>{null!=e&&n(e)},[]),announcement:t}}(),d=F("DndLiveRegion"),[u,p]=e.useState(!1);if(e.useEffect(()=>{p(!0)},[]),function(t){const n=e.useContext(te);e.useEffect(()=>{if(!n)throw new Error("useDndMonitor must be used within a children of <DndContext>");return n(t)},[t,n])}(e.useMemo(()=>({onDragStart(e){let{active:t}=e;l(o.onDragStart({active:t}))},onDragMove(e){let{active:t,over:n}=e;o.onDragMove&&l(o.onDragMove({active:t,over:n}))},onDragOver(e){let{active:t,over:n}=e;l(o.onDragOver({active:t,over:n}))},onDragEnd(e){let{active:t,over:n}=e;l(o.onDragEnd({active:t,over:n}))},onDragCancel(e){let{active:t,over:n}=e;l(o.onDragCancel({active:t,over:n}))}}),[l,o])),!u)return null;const f=t.createElement(t.Fragment,null,t.createElement(Q,{id:i,value:s.draggable}),t.createElement(ee,{id:d,announcement:c}));return a?n.createPortal(f,a):f}var ae,ie;function se(){}(ie=ae||(ae={})).DragStart="dragStart",ie.DragMove="dragMove",ie.DragEnd="dragEnd",ie.DragCancel="dragCancel",ie.DragOver="dragOver",ie.RegisterDroppable="registerDroppable",ie.SetDroppableDisabled="setDroppableDisabled",ie.UnregisterDroppable="unregisterDroppable";const le=Object.freeze({x:0,y:0});function ce(e,t){const n=q(e);if(!n)return"0 0";return(n.x-t.left)/t.width*100+"% "+(n.y-t.top)/t.height*100+"%"}function de(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ue(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=o-r,s=a-n;if(r<o&&n<a){const n=t.width*t.height,r=e.width*e.height,o=i*s;return Number((o/(n+r-o)).toFixed(4))}return 0}const pe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const a of r){const{id:e}=a,r=n.get(e);if(r){const n=ue(r,t);n>0&&o.push({id:e,data:{droppableContainer:a,value:n}})}}return o.sort(de)};function fe(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:le}function he(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}const ge=he(1);function me(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}const ve={ignoreTransform:!1};function be(e,t){void 0===t&&(t=ve);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=T(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=me(t);if(!r)return e;const{scaleX:o,scaleY:a,x:i,y:s}=r,l=e.left-i-(1-o)*parseFloat(n),c=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),d=o?e.width/o:e.width,u=a?e.height/a:e.height;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}(n,t,r))}const{top:r,left:o,width:a,height:i,bottom:s,right:l}=n;return{top:r,left:o,width:a,height:i,bottom:s,right:l}}function xe(e){return be(e,{ignoreTransform:!0})}function ye(e,t){const n=[];return e?function r(o){if(null!=t&&n.length>=t)return n;if(!o)return n;if($(o)&&null!=o.scrollingElement&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!O(o)||A(o))return n;if(n.includes(o))return n;const a=T(e).getComputedStyle(o);return o!==e&&function(e,t){void 0===t&&(t=T(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(o,a)&&n.push(o),function(e,t){return void 0===t&&(t=T(e).getComputedStyle(e)),"fixed"===t.position}(o,a)?n:r(o.parentNode)}(e):n}function we(e){const[t]=ye(e,1);return null!=t?t:null}function Ne(e){return R&&e?S(e)?e:M(e)?$(e)||e===I(e).scrollingElement?window:O(e)?e:null:null:null}function je(e){return S(e)?e.scrollX:e.scrollLeft}function Ce(e){return S(e)?e.scrollY:e.scrollTop}function ke(e){return{x:je(e),y:Ce(e)}}var De,Ee;function Re(e){return!(!R||!e)&&e===document.scrollingElement}function Se(e){const t={x:0,y:0},n=Re(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}(Ee=De||(De={}))[Ee.Forward=1]="Forward",Ee[Ee.Backward=-1]="Backward";const Me={x:.2,y:.2};function Te(e,t,n,r,o){let{top:a,left:i,right:s,bottom:l}=n;void 0===r&&(r=10),void 0===o&&(o=Me);const{isTop:c,isBottom:d,isLeft:u,isRight:p}=Se(e),f={x:0,y:0},h={x:0,y:0},g=t.height*o.y,m=t.width*o.x;return!c&&a<=t.top+g?(f.y=De.Backward,h.y=r*Math.abs((t.top+g-a)/g)):!d&&l>=t.bottom-g&&(f.y=De.Forward,h.y=r*Math.abs((t.bottom-g-l)/g)),!p&&s>=t.right-m?(f.x=De.Forward,h.x=r*Math.abs((t.right-m-s)/m)):!u&&i<=t.left+m&&(f.x=De.Backward,h.x=r*Math.abs((t.left+m-i)/m)),{direction:f,speed:h}}function $e(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Oe(e){return e.reduce((e,t)=>Y(e,ke(t)),le)}function Ae(e,t){if(void 0===t&&(t=be),!e)return;const{top:n,left:r,bottom:o,right:a}=t(e);we(e)&&(o<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Ie=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+je(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+Ce(t),0)}]];class Le{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=ye(t),r=Oe(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[o,a,i]of Ie)for(const e of a)Object.defineProperty(this,e,{get:()=>{const t=i(n),a=r[o]-t;return this.rect[e]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Pe{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function _e(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var Be,ze,Ke,Ve;function Fe(e){e.preventDefault()}function Xe(e){e.stopPropagation()}(ze=Be||(Be={})).Click="click",ze.DragStart="dragstart",ze.Keydown="keydown",ze.ContextMenu="contextmenu",ze.Resize="resize",ze.SelectionChange="selectionchange",ze.VisibilityChange="visibilitychange",(Ve=Ke||(Ke={})).Space="Space",Ve.Down="ArrowDown",Ve.Right="ArrowRight",Ve.Left="ArrowLeft",Ve.Up="ArrowUp",Ve.Esc="Escape",Ve.Enter="Enter",Ve.Tab="Tab";const Ye={start:[Ke.Space,Ke.Enter],cancel:[Ke.Esc],end:[Ke.Space,Ke.Enter,Ke.Tab]},We=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ke.Right:return{...n,x:n.x+25};case Ke.Left:return{...n,x:n.x-25};case Ke.Down:return{...n,y:n.y+25};case Ke.Up:return{...n,y:n.y-25}}};class Ue{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new Pe(I(t)),this.windowListeners=new Pe(T(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Be.Resize,this.handleCancel),this.windowListeners.add(Be.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Be.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Ae(n),t(le)}handleKeyDown(e){if(U(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:o=Ye,coordinateGetter:a=We,scrollBehavior:i="smooth"}=r,{code:s}=e;if(o.end.includes(s))return void this.handleEnd(e);if(o.cancel.includes(s))return void this.handleCancel(e);const{collisionRect:l}=n.current,c=l?{x:l.left,y:l.top}:le;this.referenceCoordinates||(this.referenceCoordinates=c);const d=a(e,{active:t,context:n.current,currentCoordinates:c});if(d){const t=W(d,c),r={x:0,y:0},{scrollableAncestors:o}=n.current;for(const n of o){const o=e.code,{isTop:a,isRight:s,isLeft:l,isBottom:c,maxScroll:u,minScroll:p}=Se(n),f=$e(n),h={x:Math.min(o===Ke.Right?f.right-f.width/2:f.right,Math.max(o===Ke.Right?f.left:f.left+f.width/2,d.x)),y:Math.min(o===Ke.Down?f.bottom-f.height/2:f.bottom,Math.max(o===Ke.Down?f.top:f.top+f.height/2,d.y))},g=o===Ke.Right&&!s||o===Ke.Left&&!l,m=o===Ke.Down&&!c||o===Ke.Up&&!a;if(g&&h.x!==d.x){const e=n.scrollLeft+t.x,a=o===Ke.Right&&e<=u.x||o===Ke.Left&&e>=p.x;if(a&&!t.y)return void n.scrollTo({left:e,behavior:i});r.x=a?n.scrollLeft-e:o===Ke.Right?n.scrollLeft-u.x:n.scrollLeft-p.x,r.x&&n.scrollBy({left:-r.x,behavior:i});break}if(m&&h.y!==d.y){const e=n.scrollTop+t.y,a=o===Ke.Down&&e<=u.y||o===Ke.Up&&e>=p.y;if(a&&!t.x)return void n.scrollTo({top:e,behavior:i});r.y=a?n.scrollTop-e:o===Ke.Down?n.scrollTop-u.y:n.scrollTop-p.y,r.y&&n.scrollBy({top:-r.y,behavior:i});break}}this.handleMove(e,Y(W(d,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function qe(e){return Boolean(e&&"distance"in e)}function Je(e){return Boolean(e&&"delay"in e)}Ue.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Ye,onActivation:o}=t,{active:a}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const t=a.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==o||o({event:e.nativeEvent}),!0)}return!1}}];class He{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=T(e);return e instanceof t?e:I(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:o}=e,{target:a}=o;this.props=e,this.events=t,this.document=I(a),this.documentListeners=new Pe(this.document),this.listeners=new Pe(n),this.windowListeners=new Pe(T(a)),this.initialCoordinates=null!=(r=q(o))?r:le,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Be.Resize,this.handleCancel),this.windowListeners.add(Be.DragStart,Fe),this.windowListeners.add(Be.VisibilityChange,this.handleCancel),this.windowListeners.add(Be.ContextMenu,Fe),this.documentListeners.add(Be.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Je(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(qe(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Be.Click,Xe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Be.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:o}=this,{onMove:a,options:{activationConstraint:i}}=o;if(!r)return;const s=null!=(t=q(e))?t:le,l=W(r,s);if(!n&&i){if(qe(i)){if(null!=i.tolerance&&_e(l,i.tolerance))return this.handleCancel();if(_e(l,i.distance))return this.handleStart()}return Je(i)&&_e(l,i.tolerance)?this.handleCancel():void this.handlePending(i,l)}e.cancelable&&e.preventDefault(),a(s)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Ke.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Ze={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Ge extends He{constructor(e){const{event:t}=e,n=I(t.target);super(e,Ze,n)}}Ge.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const Qe={move:{name:"mousemove"},end:{name:"mouseup"}};var et,tt;(tt=et||(et={}))[tt.RightClick=2]="RightClick";(class extends He{constructor(e){super(e,Qe,I(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==et.RightClick&&(null==r||r({event:n}),!0)}}];const nt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var rt,ot,at,it;function st(t){let{acceleration:n,activator:r=rt.Pointer,canScroll:o,draggingRect:a,enabled:i,interval:s=5,order:l=at.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:p,threshold:f}=t;const h=function(e){let{delta:t,disabled:n}=e;const r=K(t);return B(e=>{if(n||!r||!e)return lt;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[De.Backward]:e.x[De.Backward]||-1===o.x,[De.Forward]:e.x[De.Forward]||1===o.x},y:{[De.Backward]:e.y[De.Backward]||-1===o.y,[De.Forward]:e.y[De.Forward]||1===o.y}}},[n,t,r])}({delta:p,disabled:!i}),[g,m]=function(){const t=e.useRef(null);return[e.useCallback((e,n)=>{t.current=setInterval(e,n)},[]),e.useCallback(()=>{null!==t.current&&(clearInterval(t.current),t.current=null)},[])]}(),v=e.useRef({x:0,y:0}),b=e.useRef({x:0,y:0}),x=e.useMemo(()=>{switch(r){case rt.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case rt.DraggableRect:return a}},[r,a,c]),y=e.useRef(null),w=e.useCallback(()=>{const e=y.current;if(!e)return;const t=v.current.x*b.current.x,n=v.current.y*b.current.y;e.scrollBy(t,n)},[]),N=e.useMemo(()=>l===at.TreeOrder?[...d].reverse():d,[l,d]);e.useEffect(()=>{if(i&&d.length&&x){for(const e of N){if(!1===(null==o?void 0:o(e)))continue;const t=d.indexOf(e),r=u[t];if(!r)continue;const{direction:a,speed:i}=Te(e,r,x,n,f);for(const e of["x","y"])h[e][a[e]]||(i[e]=0,a[e]=0);if(i.x>0||i.y>0)return m(),y.current=e,g(w,s),v.current=i,void(b.current=a)}v.current={x:0,y:0},b.current={x:0,y:0},m()}else m()},[n,w,o,m,i,s,JSON.stringify(x),JSON.stringify(h),g,d,N,u,JSON.stringify(f)])}(class extends He{constructor(e){super(e,nt)}static setup(){return window.addEventListener(nt.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(nt.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return!(o.length>1)&&(null==r||r({event:n}),!0)}}],(ot=rt||(rt={}))[ot.Pointer=0]="Pointer",ot[ot.DraggableRect=1]="DraggableRect",(it=at||(at={}))[it.TreeOrder=0]="TreeOrder",it[it.ReversedTreeOrder=1]="ReversedTreeOrder";const lt={x:{[De.Backward]:!1,[De.Forward]:!1},y:{[De.Backward]:!1,[De.Forward]:!1}};var ct,dt,ut;(dt=ct||(ct={}))[dt.Always=0]="Always",dt[dt.BeforeDragging=1]="BeforeDragging",dt[dt.WhileDragging=2]="WhileDragging",(ut||(ut={})).Optimized="optimized";const pt=new Map;function ft(e,t){return B(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function ht(t){let{callback:n,disabled:r}=t;const o=P(n),a=e.useMemo(()=>{if(r||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(o)},[r]);return e.useEffect(()=>()=>null==a?void 0:a.disconnect(),[a]),a}function gt(e){return new Le(be(e),e)}function mt(t,n,r){void 0===n&&(n=gt);const[o,a]=e.useState(null);function i(){a(e=>{if(!t)return null;var o;if(!1===t.isConnected)return null!=(o=null!=e?e:r)?o:null;const a=n(t);return JSON.stringify(e)===JSON.stringify(a)?e:a})}const s=function(t){let{callback:n,disabled:r}=t;const o=P(n),a=e.useMemo(()=>{if(r||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(o)},[o,r]);return e.useEffect(()=>()=>null==a?void 0:a.disconnect(),[a]),a}({callback(e){if(t)for(const n of e){const{type:e,target:r}=n;if("childList"===e&&r instanceof HTMLElement&&r.contains(t)){i();break}}}}),l=ht({callback:i});return L(()=>{i(),t?(null==l||l.observe(t),null==s||s.observe(document.body,{childList:!0,subtree:!0})):(null==l||l.disconnect(),null==s||s.disconnect())},[t]),o}const vt=[];function bt(t,n){void 0===n&&(n=[]);const r=e.useRef(null);return e.useEffect(()=>{r.current=null},n),e.useEffect(()=>{const e=t!==le;e&&!r.current&&(r.current=t),!e&&r.current&&(r.current=null)},[t]),r.current?W(t,r.current):le}function xt(t){return e.useMemo(()=>t?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(t):null,[t])}const yt=[];function wt(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return O(t)?t:e}const Nt=[{sensor:Ge,options:{}},{sensor:Ue,options:{}}],jt={current:{}},Ct={draggable:{measure:xe},droppable:{measure:xe,strategy:ct.WhileDragging,frequency:ut.Optimized},dragOverlay:{measure:be}};class kt extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const Dt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new kt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:se},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ct,measureDroppableContainers:se,windowRect:null,measuringScheduled:!1},Et={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:se,draggableNodes:new Map,over:null,measureDroppableContainers:se},Rt=e.createContext(Et),St=e.createContext(Dt);function Mt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new kt}}}function Tt(e,t){switch(t.type){case ae.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ae.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case ae.DragEnd:case ae.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ae.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new kt(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case ae.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const i=new kt(e.droppable.containers);return i.set(n,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case ae.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new kt(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function $t(t){let{disabled:n}=t;const{active:r,activatorEvent:o,draggableNodes:a}=e.useContext(Rt),i=K(o),s=K(null==r?void 0:r.id);return e.useEffect(()=>{if(!n&&!o&&i&&null!=s){if(!U(i))return;if(document.activeElement===i.target)return;const e=a.get(s);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=Z(e);if(t){t.focus();break}}})}},[o,n,a,s,i]),null}function Ot(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}const At=e.createContext({...le,scaleX:1,scaleY:1});var It,Lt;(Lt=It||(It={}))[Lt.Uninitialized=0]="Uninitialized",Lt[Lt.Initializing=1]="Initializing",Lt[Lt.Initialized=2]="Initialized";const Pt=e.memo(function(r){var o,a,i,s;let{id:l,accessibility:c,autoScroll:d=!0,children:u,sensors:p=Nt,collisionDetection:f=pe,measuring:h,modifiers:g,...m}=r;const v=e.useReducer(Tt,void 0,Mt),[b,x]=v,[y,w]=function(){const[t]=e.useState(()=>new Set),n=e.useCallback(e=>(t.add(e),()=>t.delete(e)),[t]);return[e.useCallback(e=>{let{type:n,event:r}=e;t.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)})},[t]),n]}(),[N,j]=e.useState(It.Uninitialized),C=N===It.Initialized,{draggable:{active:k,nodes:D,translate:E},droppable:{containers:S}}=b,M=null!=k?D.get(k):null,$=e.useRef({initial:null,translated:null}),A=e.useMemo(()=>{var e;return null!=k?{id:k,data:null!=(e=null==M?void 0:M.data)?e:jt,rect:$}:null},[k,M]),I=e.useRef(null),[P,K]=e.useState(null),[V,X]=e.useState(null),W=_(m,Object.values(m)),U=F("DndDescribedBy",l),J=e.useMemo(()=>S.getEnabled(),[S]),H=(Z=h,e.useMemo(()=>({draggable:{...Ct.draggable,...null==Z?void 0:Z.draggable},droppable:{...Ct.droppable,...null==Z?void 0:Z.droppable},dragOverlay:{...Ct.dragOverlay,...null==Z?void 0:Z.dragOverlay}}),[null==Z?void 0:Z.draggable,null==Z?void 0:Z.droppable,null==Z?void 0:Z.dragOverlay]));var Z;const{droppableRects:G,measureDroppableContainers:Q,measuringScheduled:ee}=function(t,n){let{dragging:r,dependencies:o,config:a}=n;const[i,s]=e.useState(null),{frequency:l,measure:c,strategy:d}=a,u=e.useRef(t),p=function(){switch(d){case ct.Always:return!1;case ct.BeforeDragging:return r;default:return!r}}(),f=_(p),h=e.useCallback(function(e){void 0===e&&(e=[]),f.current||s(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),g=e.useRef(null),m=B(e=>{if(p&&!r)return pt;if(!e||e===pt||u.current!==t||null!=i){const e=new Map;for(let n of t){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){e.set(n.id,n.rect.current);continue}const t=n.node.current,r=t?new Le(c(t),t):null;n.rect.current=r,r&&e.set(n.id,r)}return e}return e},[t,i,r,p,c]);return e.useEffect(()=>{u.current=t},[t]),e.useEffect(()=>{p||h()},[r,p]),e.useEffect(()=>{i&&i.length>0&&s(null)},[JSON.stringify(i)]),e.useEffect(()=>{p||"number"!=typeof l||null!==g.current||(g.current=setTimeout(()=>{h(),g.current=null},l))},[l,p,h,...o]),{droppableRects:m,measureDroppableContainers:h,measuringScheduled:null!=i}}(J,{dragging:C,dependencies:[E.x,E.y],config:H.droppable}),ne=function(e,t){const n=null!=t?e.get(t):void 0,r=n?n.node.current:null;return B(e=>{var n;return null==t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(D,k),re=e.useMemo(()=>V?q(V):null,[V]),ie=function(){const e=!1===(null==P?void 0:P.autoScrollEnabled),t="object"==typeof d?!1===d.enabled:!1===d,n=C&&!e&&!t;if("object"==typeof d)return{...d,enabled:n};return{enabled:n}}(),se=function(e,t){return ft(e,t)}(ne,H.draggable.measure);!function(t){let{activeNode:n,measure:r,initialRect:o,config:a=!0}=t;const i=e.useRef(!1),{x:s,y:l}="boolean"==typeof a?{x:a,y:a}:a;L(()=>{if(!s&&!l||!n)return void(i.current=!1);if(i.current||!o)return;const e=null==n?void 0:n.node.current;if(!e||!1===e.isConnected)return;const t=fe(r(e),o);if(s||(t.x=0),l||(t.y=0),i.current=!0,Math.abs(t.x)>0||Math.abs(t.y)>0){const n=we(e);n&&n.scrollBy({top:t.y,left:t.x})}},[n,s,l,o,r])}({activeNode:null!=k?D.get(k):null,config:ie.layoutShiftCompensation,initialRect:se,measure:H.draggable.measure});const ce=mt(ne,H.draggable.measure,se),de=mt(ne?ne.parentElement:null),ue=e.useRef({activatorEvent:null,active:null,activeNode:ne,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:S,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=S.getNodeFor(null==(o=ue.current.over)?void 0:o.id),me=function(t){let{measure:n}=t;const[r,o]=e.useState(null),a=ht({callback:e.useCallback(e=>{for(const{target:t}of e)if(O(t)){o(e=>{const r=n(t);return e?{...e,width:r.width,height:r.height}:r});break}},[n])}),i=e.useCallback(e=>{const t=wt(e);null==a||a.disconnect(),t&&(null==a||a.observe(t)),o(t?n(t):null)},[n,a]),[s,l]=z(i);return e.useMemo(()=>({nodeRef:s,rect:r,setRef:l}),[r,s,l])}({measure:H.dragOverlay.measure}),ve=null!=(a=me.nodeRef.current)?a:ne,xe=C?null!=(i=me.rect)?i:ce:null,je=Boolean(me.nodeRef.current&&me.rect),Ce=fe(De=je?null:ce,ft(De));var De;const Ee=xt(ve?T(ve):null),Se=function(t){const n=e.useRef(t),r=B(e=>t?e&&e!==vt&&t&&n.current&&t.parentNode===n.current.parentNode?e:ye(t):vt,[t]);return e.useEffect(()=>{n.current=t},[t]),r}(C?null!=he?he:ne:null),Me=function(t,n){void 0===n&&(n=be);const[r]=t,o=xt(r?T(r):null),[a,i]=e.useState(yt);function s(){i(()=>t.length?t.map(e=>Re(e)?o:new Le(n(e),e)):yt)}const l=ht({callback:s});return L(()=>{null==l||l.disconnect(),s(),t.forEach(e=>null==l?void 0:l.observe(e))},[t]),a}(Se),Te=Ot(g,{transform:{x:E.x-Ce.x,y:E.y-Ce.y,scaleX:1,scaleY:1},activatorEvent:V,active:A,activeNodeRect:ce,containerNodeRect:de,draggingNodeRect:xe,over:ue.current.over,overlayNodeRect:me.rect,scrollableAncestors:Se,scrollableAncestorRects:Me,windowRect:Ee}),$e=re?Y(re,E):null,Ae=function(t){const[n,r]=e.useState(null),o=e.useRef(t),a=e.useCallback(e=>{const t=Ne(e.target);t&&r(e=>e?(e.set(t,ke(t)),new Map(e)):null)},[]);return e.useEffect(()=>{const e=o.current;if(t!==e){n(e);const i=t.map(e=>{const t=Ne(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,ke(t)]):null}).filter(e=>null!=e);r(i.length?new Map(i):null),o.current=t}return()=>{n(t),n(e)};function n(e){e.forEach(e=>{const t=Ne(e);null==t||t.removeEventListener("scroll",a)})}},[a,t]),e.useMemo(()=>t.length?n?Array.from(n.values()).reduce((e,t)=>Y(e,t),le):Oe(t):le,[t,n])}(Se),Ie=bt(Ae),Pe=bt(Ae,[ce]),_e=Y(Te,Ie),Be=xe?ge(xe,Te):null,ze=A&&Be?f({active:A,collisionRect:Be,droppableRects:G,droppableContainers:J,pointerCoordinates:$e}):null,Ke=function(e,t){if(!e||0===e.length)return null;const[n]=e;return n[t]}(ze,"id"),[Ve,Fe]=e.useState(null),Xe=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(je?Te:Y(Te,Pe),null!=(s=null==Ve?void 0:Ve.rect)?s:null,ce),Ye=e.useRef(null),We=e.useCallback((e,t)=>{let{sensor:r,options:o}=t;if(null==I.current)return;const a=D.get(I.current);if(!a)return;const i=e.nativeEvent,s=new r({active:I.current,activeNode:a,event:i,options:o,context:ue,onAbort(e){if(!D.get(e))return;const{onDragAbort:t}=W.current,n={id:e};null==t||t(n),y({type:"onDragAbort",event:n})},onPending(e,t,n,r){if(!D.get(e))return;const{onDragPending:o}=W.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};null==o||o(a),y({type:"onDragPending",event:a})},onStart(e){const t=I.current;if(null==t)return;const r=D.get(t);if(!r)return;const{onDragStart:o}=W.current,a={activatorEvent:i,active:{id:t,data:r.data,rect:$}};n.unstable_batchedUpdates(()=>{null==o||o(a),j(It.Initializing),x({type:ae.DragStart,initialCoordinates:e,active:t}),y({type:"onDragStart",event:a}),K(Ye.current),X(i)})},onMove(e){x({type:ae.DragMove,coordinates:e})},onEnd:l(ae.DragEnd),onCancel:l(ae.DragCancel)});function l(e){return async function(){const{active:t,collisions:r,over:o,scrollAdjustedTranslate:a}=ue.current;let s=null;if(t&&a){const{cancelDrop:n}=W.current;if(s={activatorEvent:i,active:t,collisions:r,delta:a,over:o},e===ae.DragEnd&&"function"==typeof n){await Promise.resolve(n(s))&&(e=ae.DragCancel)}}I.current=null,n.unstable_batchedUpdates(()=>{x({type:e}),j(It.Uninitialized),Fe(null),K(null),X(null),Ye.current=null;const t=e===ae.DragEnd?"onDragEnd":"onDragCancel";if(s){const e=W.current[t];null==e||e(s),y({type:t,event:s})}})}}Ye.current=s},[D]),Ue=function(t,n){return e.useMemo(()=>t.reduce((e,t)=>{const{sensor:r}=t;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:n(e.handler,t)}))]},[]),[t,n])}(p,e.useCallback((e,t)=>(n,r)=>{const o=n.nativeEvent,a=D.get(r);if(null!==I.current||!a||o.dndKit||o.defaultPrevented)return;const i={active:a};!0===e(n,t.options,i)&&(o.dndKit={capturedBy:t.sensor},I.current=r,We(n,t))},[D,We]));!function(t){e.useEffect(()=>{if(!R)return;const e=t.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(const t of e)null==t||t()}},t.map(e=>{let{sensor:t}=e;return t}))}(p),L(()=>{ce&&N===It.Initializing&&j(It.Initialized)},[ce,N]),e.useEffect(()=>{const{onDragMove:e}=W.current,{active:t,activatorEvent:r,collisions:o,over:a}=ue.current;if(!t||!r)return;const i={active:t,activatorEvent:r,collisions:o,delta:{x:_e.x,y:_e.y},over:a};n.unstable_batchedUpdates(()=>{null==e||e(i),y({type:"onDragMove",event:i})})},[_e.x,_e.y]),e.useEffect(()=>{const{active:e,activatorEvent:t,collisions:r,droppableContainers:o,scrollAdjustedTranslate:a}=ue.current;if(!e||null==I.current||!t||!a)return;const{onDragOver:i}=W.current,s=o.get(Ke),l=s&&s.rect.current?{id:s.id,rect:s.rect.current,data:s.data,disabled:s.disabled}:null,c={active:e,activatorEvent:t,collisions:r,delta:{x:a.x,y:a.y},over:l};n.unstable_batchedUpdates(()=>{Fe(l),null==i||i(c),y({type:"onDragOver",event:c})})},[Ke]),L(()=>{ue.current={activatorEvent:V,active:A,activeNode:ne,collisionRect:Be,collisions:ze,droppableRects:G,draggableNodes:D,draggingNode:ve,draggingNodeRect:xe,droppableContainers:S,over:Ve,scrollableAncestors:Se,scrollAdjustedTranslate:_e},$.current={initial:xe,translated:Be}},[A,ne,ze,Be,D,ve,xe,G,S,Ve,Se,_e]),st({...ie,delta:E,draggingRect:Be,pointerCoordinates:$e,scrollableAncestors:Se,scrollableAncestorRects:Me});const qe=e.useMemo(()=>({active:A,activeNode:ne,activeNodeRect:ce,activatorEvent:V,collisions:ze,containerNodeRect:de,dragOverlay:me,draggableNodes:D,droppableContainers:S,droppableRects:G,over:Ve,measureDroppableContainers:Q,scrollableAncestors:Se,scrollableAncestorRects:Me,measuringConfiguration:H,measuringScheduled:ee,windowRect:Ee}),[A,ne,ce,V,ze,de,me,D,S,G,Ve,Q,Se,Me,H,ee,Ee]),Je=e.useMemo(()=>({activatorEvent:V,activators:Ue,active:A,activeNodeRect:ce,ariaDescribedById:{draggable:U},dispatch:x,draggableNodes:D,over:Ve,measureDroppableContainers:Q}),[V,Ue,A,ce,x,U,D,Ve,Q]);return t.createElement(te.Provider,{value:w},t.createElement(Rt.Provider,{value:Je},t.createElement(St.Provider,{value:qe},t.createElement(At.Provider,{value:Xe},u)),t.createElement($t,{disabled:!1===(null==c?void 0:c.restoreFocus)})),t.createElement(oe,{...c,hiddenTextDescribedById:U}))}),_t=e.createContext(null),Bt="button";function zt(t){let{id:n,data:r,disabled:o=!1,attributes:a}=t;const i=F("Draggable"),{activators:s,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:p,over:f}=e.useContext(Rt),{role:h=Bt,roleDescription:g="draggable",tabIndex:m=0}=null!=a?a:{},v=(null==c?void 0:c.id)===n,b=e.useContext(v?At:_t),[x,y]=z(),[w,N]=z(),j=function(t,n){return e.useMemo(()=>t.reduce((e,t)=>{let{eventName:r,handler:o}=t;return e[r]=e=>{o(e,n)},e},{}),[t,n])}(s,n),C=_(r);L(()=>(p.set(n,{id:n,key:i,node:x,activatorNode:w,data:C}),()=>{const e=p.get(n);e&&e.key===i&&p.delete(n)}),[p,n]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:e.useMemo(()=>({role:h,tabIndex:m,"aria-disabled":o,"aria-pressed":!(!v||h!==Bt)||void 0,"aria-roledescription":g,"aria-describedby":u.draggable}),[o,h,m,v,g,u.draggable]),isDragging:v,listeners:o?void 0:j,node:x,over:f,setNodeRef:y,setActivatorNodeRef:N,transform:b}}const Kt={timeout:25};function Vt(t){let{data:n,disabled:r=!1,id:o,resizeObserverConfig:a}=t;const i=F("Droppable"),{active:s,dispatch:l,over:c,measureDroppableContainers:d}=e.useContext(Rt),u=e.useRef({disabled:r}),p=e.useRef(!1),f=e.useRef(null),h=e.useRef(null),{disabled:g,updateMeasurementsFor:m,timeout:v}={...Kt,...a},b=_(null!=m?m:o),x=ht({callback:e.useCallback(()=>{p.current?(null!=h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{d(Array.isArray(b.current)?b.current:[b.current]),h.current=null},v)):p.current=!0},[v]),disabled:g||!s}),y=e.useCallback((e,t)=>{x&&(t&&(x.unobserve(t),p.current=!1),e&&x.observe(e))},[x]),[w,N]=z(y),j=_(n);return e.useEffect(()=>{x&&w.current&&(x.disconnect(),p.current=!1,x.observe(w.current))},[w,x]),e.useEffect(()=>(l({type:ae.RegisterDroppable,element:{id:o,key:i,disabled:r,node:w,rect:f,data:j}}),()=>l({type:ae.UnregisterDroppable,key:i,id:o})),[o]),e.useEffect(()=>{r!==u.current.disabled&&(l({type:ae.SetDroppableDisabled,id:o,key:i,disabled:r}),u.current.disabled=r)},[o,i,r,l]),{active:s,rect:f,isOver:(null==c?void 0:c.id)===o,node:w,over:c,setNodeRef:N}}function Ft(n){let{animation:r,children:o}=n;const[a,i]=e.useState(null),[s,l]=e.useState(null),c=K(o);return o||a||!c||i(c),L(()=>{if(!s)return;const e=null==a?void 0:a.key,t=null==a?void 0:a.props.id;null!=e&&null!=t?Promise.resolve(r(t,s)).then(()=>{i(null)}):i(null)},[r,a,s]),t.createElement(t.Fragment,null,o,a?e.cloneElement(a,{ref:l}):null)}const Xt={x:0,y:0,scaleX:1,scaleY:1};function Yt(e){let{children:n}=e;return t.createElement(Rt.Provider,{value:Et},t.createElement(At.Provider,{value:Xt},n))}const Wt={position:"fixed",touchAction:"none"},Ut=e=>U(e)?"transform 250ms ease":void 0,qt=e.forwardRef((e,n)=>{let{as:r,activatorEvent:o,adjustScale:a,children:i,className:s,rect:l,style:c,transform:d,transition:u=Ut}=e;if(!l)return null;const p=a?d:{...d,scaleX:1,scaleY:1},f={...Wt,width:l.width,height:l.height,top:l.top,left:l.left,transform:J.Transform.toString(p),transformOrigin:a&&o?ce(o,l):void 0,transition:"function"==typeof u?u(o):u,...c};return t.createElement(r,{className:s,style:f,ref:n},i)}),Jt={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:J.Transform.toString(t)},{transform:J.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t;const o={},{styles:a,className:i}=e;if(null!=a&&a.active)for(const[e,s]of Object.entries(a.active))void 0!==s&&(o[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,s));if(null!=a&&a.dragOverlay)for(const[e,s]of Object.entries(a.dragOverlay))void 0!==s&&r.node.style.setProperty(e,s);return null!=i&&i.active&&n.node.classList.add(i.active),null!=i&&i.dragOverlay&&r.node.classList.add(i.dragOverlay),function(){for(const[e,t]of Object.entries(o))n.node.style.setProperty(e,t);null!=i&&i.active&&n.node.classList.remove(i.active)}})({styles:{active:{opacity:"0"}}})};function Ht(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:o}=e;return P((e,a)=>{if(null===t)return;const i=n.get(e);if(!i)return;const s=i.node.current;if(!s)return;const l=wt(a);if(!l)return;const{transform:c}=T(a).getComputedStyle(a),d=me(c);if(!d)return;const u="function"==typeof t?t:function(e){const{duration:t,easing:n,sideEffects:r,keyframes:o}={...Jt,...e};return e=>{let{active:a,dragOverlay:i,transform:s,...l}=e;if(!t)return;const c={x:i.rect.left-a.rect.left,y:i.rect.top-a.rect.top},d={scaleX:1!==s.scaleX?a.rect.width*s.scaleX/i.rect.width:1,scaleY:1!==s.scaleY?a.rect.height*s.scaleY/i.rect.height:1},u={x:s.x-c.x,y:s.y-c.y,...d},p=o({...l,active:a,dragOverlay:i,transform:{initial:s,final:u}}),[f]=p,h=p[p.length-1];if(JSON.stringify(f)===JSON.stringify(h))return;const g=null==r?void 0:r({active:a,dragOverlay:i,...l}),m=i.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(e=>{m.onfinish=()=>{null==g||g(),e()}})}}(t);return Ae(s,o.draggable.measure),u({active:{id:e,data:i.data,node:s,rect:o.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:o.dragOverlay.measure(l)},droppableContainers:r,measuringConfiguration:o,transform:d})})}let Zt=0;const Gt=t.memo(n=>{let{adjustScale:r=!1,children:o,dropAnimation:a,style:i,transition:s,modifiers:l,wrapperElement:c="div",className:d,zIndex:u=999}=n;const{activatorEvent:p,active:f,activeNodeRect:h,containerNodeRect:g,draggableNodes:m,droppableContainers:v,dragOverlay:b,over:x,measuringConfiguration:y,scrollableAncestors:w,scrollableAncestorRects:N,windowRect:j}=e.useContext(St),C=e.useContext(At),k=(D=null==f?void 0:f.id,e.useMemo(()=>{if(null!=D)return Zt++,Zt},[D]));var D;const E=Ot(l,{activatorEvent:p,active:f,activeNodeRect:h,containerNodeRect:g,draggingNodeRect:b.rect,over:x,overlayNodeRect:b.rect,scrollableAncestors:w,scrollableAncestorRects:N,transform:C,windowRect:j}),R=ft(h),S=Ht({config:a,draggableNodes:m,droppableContainers:v,measuringConfiguration:y}),M=R?b.setRef:void 0;return t.createElement(Yt,null,t.createElement(Ft,{animation:S},f&&k?t.createElement(qt,{key:k,id:f.id,ref:M,as:c,activatorEvent:p,adjustScale:r,className:d,transition:s,rect:R,style:{zIndex:u,...i},transform:E},o):null))}),Qt={ask_user:{icon:"💬",label:"问用户",color:"bg-pink-50 border-pink-300"},fai:{icon:"🤖",label:"AI 调用",color:"bg-orange-50 border-orange-300"},let:{icon:"📦",label:"命名变量",color:"bg-gray-50 border-gray-300"},return:{icon:"⬅️",label:"返回",color:"bg-purple-50 border-purple-300"}};function en(e){return"var"===e.kind?"@"+e.path.join("."):"lit"===e.kind?e.raw:"(triple)"}function tn({node:e,index:t,selected:n,onSelect:o,onDuplicate:a,onRemove:i}){const s=Qt[e.type],{attributes:l,listeners:c,setNodeRef:d,isDragging:u}=zt({id:`node:${e.id}`,data:{kind:"reorder",sourceIndex:t,nodeId:e.id}}),{setNodeRef:p,isOver:f}=Vt({id:`drop-before:${e.id}`,data:{kind:"drop-before",index:t}});let h="";return"ask_user"===e.type?h=`${e.outputVar} ← { ${e.fields.map(e=>e.key).join(", ")} }`:"fai"===e.type?h=`${e.outputVar} ← ${e.faiName}(${e.inputs.length} args)`:"let"===e.type?h=`${e.varName} = ${en(e.value)}`:"return"===e.type&&(h=`return ${en(e.value)}`),r.jsxs("div",{ref:p,className:"relative",children:[f&&r.jsx("div",{className:"absolute left-0 right-0 -top-1 h-0.5 bg-blue-500 z-10"}),r.jsxs("div",{ref:d,...l,...c,onClick:e=>{e.stopPropagation(),o()},className:["border rounded-lg p-3 cursor-pointer transition-all",s.color,n?"ring-2 ring-blue-500 shadow":"hover:shadow-sm",u?"opacity-50":""].join(" "),children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"text-xl",children:s.icon}),r.jsx("span",{className:"font-medium",children:s.label}),r.jsxs("div",{className:"ml-auto flex gap-1",children:[r.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),a()},className:"text-xs text-gray-500 hover:text-gray-800 px-1",children:"复制"}),r.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),i()},className:"text-xs text-red-500 hover:text-red-700 px-1",children:"删除"})]})]}),r.jsx("div",{className:"text-sm font-mono text-gray-700",children:h})]})]})}const nn={ask_user:"💬 问用户",fai:"🤖 AI 调用",let:"📦 命名变量",return:"⬅️ 返回"};function rn({graph:t,dispatch:n,selectedId:o,onSelect:a}){const[i,s]=e.useState(null),l=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.useMemo(()=>[...n].filter(e=>null!=e),[...n])}((d=Ge,u={activationConstraint:{distance:8}},e.useMemo(()=>({sensor:d,options:null!=u?u:{}}),[d,u])));var d,u;return r.jsxs(Pt,{sensors:l,onDragStart:e=>{const t=e.active.data.current;"create"===(null==t?void 0:t.kind)&&t.nodeType?s({kind:"create",label:nn[t.nodeType]}):"reorder"===(null==t?void 0:t.kind)&&s({kind:"reorder",label:"移动节点"})},onDragEnd:function(e){s(null);const{active:r,over:o}=e;if(!o)return;const a=r.data.current,i=o.data.current;if(a&&i){if("create"===a.kind&&"drop-before"===i.kind){const e=a.nodeType?c[a.nodeType]:void 0;e&&n({type:"add",node:e(),index:i.index??0})}if("create"===a.kind&&"drop-end"===i.kind){const e=a.nodeType?c[a.nodeType]:void 0;e&&n({type:"add",node:e(),index:t.body.length})}if("reorder"===a.kind&&"drop-before"===i.kind){const e=a.sourceIndex;if("number"!=typeof e)return;let t=i.index??0;e<t&&(t-=1),e!==t&&n({type:"move",from:e,to:t})}if("reorder"===a.kind&&"drop-end"===i.kind){const e=a.sourceIndex;if("number"!=typeof e)return;const r=t.body.length-1;e!==r&&n({type:"move",from:e,to:r})}}},onDragCancel:()=>s(null),children:[r.jsxs("main",{className:"flex-1 overflow-y-auto p-6",onClick:()=>a(null),children:[r.jsx("h1",{className:"text-xl font-semibold mb-4",children:t.trackName}),r.jsxs("div",{className:"flex flex-col gap-2",children:[0===t.body.length&&r.jsx(on,{}),t.body.map((e,t)=>r.jsx(tn,{node:e,index:t,selected:o===e.id,onSelect:()=>a(e.id),onDuplicate:()=>n({type:"duplicate",index:t}),onRemove:()=>n({type:"remove",index:t})},e.id)),t.body.length>0&&r.jsx(an,{})]})]}),r.jsx(Gt,{children:i&&r.jsx("div",{className:"px-3 py-2 bg-white border-2 border-blue-400 rounded shadow text-sm",children:i.label})})]})}function on(){const{setNodeRef:e,isOver:t}=Vt({id:"drop-end-empty",data:{kind:"drop-end"}});return r.jsx("div",{ref:e,className:["border-2 border-dashed rounded-lg p-12 text-center text-gray-400",t?"border-blue-500 bg-blue-50":"border-gray-300"].join(" "),children:"从左侧拖一个节点过来开始搭建"})}function an(){const{setNodeRef:e,isOver:t}=Vt({id:"drop-end",data:{kind:"drop-end"}});return r.jsx("div",{ref:e,className:["border-2 border-dashed rounded-lg p-4 text-center text-gray-400 text-sm",t?"border-blue-500 bg-blue-50":"border-gray-200"].join(" "),children:"拖节点到这里追加"})}const sn=[{type:"ask_user",icon:"💬",label:"问用户"},{type:"fai",icon:"🤖",label:"AI 调用"},{type:"let",icon:"📦",label:"命名变量"},{type:"return",icon:"⬅️",label:"返回"}];function ln({type:e,icon:t,label:n}){const{attributes:o,listeners:a,setNodeRef:i,isDragging:s}=zt({id:`palette:${e}`,data:{kind:"create",nodeType:e}});return r.jsxs("div",{ref:i,...o,...a,className:["flex items-center gap-2 p-2 rounded border border-gray-300 bg-white cursor-grab","hover:border-blue-400 hover:shadow-sm transition-all select-none",s?"opacity-50":""].join(" "),children:[r.jsx("span",{className:"text-xl",children:t}),r.jsx("span",{className:"text-sm",children:n})]})}function cn(){return r.jsxs("aside",{className:"flex flex-col gap-2 w-40 p-3 border-r border-gray-200 bg-gray-50 overflow-y-auto flex-shrink-0",children:[r.jsx("div",{className:"text-xs uppercase text-gray-500 mb-1 px-1",children:"节点"}),sn.map(e=>r.jsx(ln,{...e},e.type))]})}const dn=/^[a-zA-Z_][a-zA-Z0-9_]*$/;function un({value:t,onChange:n,className:o,placeholder:a}){const[i,s]=e.useState(!1),l=dn.test(t),c=i&&!l&&t.length>0;return r.jsxs("div",{className:"inline-flex flex-col gap-0.5",children:[r.jsx("input",{type:"text",value:t,onChange:e=>n(e.target.value),onBlur:()=>s(!0),placeholder:a,className:["px-2 py-0.5 rounded border text-sm font-mono",c?"border-red-500":"border-gray-300",o??""].join(" ")}),c&&r.jsx("span",{className:"text-[10px] text-red-600 leading-none",children:"只能用字母/数字/下划线,首字符不能是数字"})]})}function pn({node:e,onChange:t}){function n(n,r){const o=e.fields.map((e,t)=>t===n?{...e,...r}:e);t({fields:o})}return r.jsxs("div",{className:"p-4 flex flex-col gap-4",children:[r.jsxs("label",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-gray-600",children:"变量名:"}),r.jsx(un,{value:e.outputVar,onChange:e=>t({outputVar:e}),className:"flex-1"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-gray-600 mb-1",children:"字段:"}),e.fields.map((o,a)=>r.jsxs("div",{className:"border border-gray-200 rounded p-2 mb-2 flex flex-col gap-1 text-sm",children:[r.jsxs("label",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-12 text-gray-500",children:"key"}),r.jsx(un,{value:o.key,onChange:e=>n(a,{key:e}),className:"font-mono flex-1"})]}),r.jsxs("label",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-12 text-gray-500",children:"label"}),r.jsx("input",{value:o.label,onChange:e=>n(a,{label:e.target.value}),className:"px-2 py-0.5 rounded border border-gray-300 flex-1"})]}),r.jsxs("label",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-12 text-gray-500",children:"type"}),r.jsxs("select",{value:o.type,onChange:e=>{const t=e.target.value;n(a,"enum"===t?{type:t}:{type:t,variants:void 0})},className:"px-2 py-0.5 rounded border border-gray-300",children:[r.jsx("option",{value:"text",children:"text"}),r.jsx("option",{value:"number",children:"number"}),r.jsx("option",{value:"bool",children:"bool"}),r.jsx("option",{value:"enum",children:"enum"})]})]}),"enum"===o.type&&r.jsxs("label",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-12 text-gray-500",children:"variants"}),r.jsx("input",{value:(o.variants??[]).join(","),onChange:e=>n(a,{variants:e.target.value.split(",").map(e=>e.trim()).filter(Boolean)}),placeholder:"a,b,c",className:"px-2 py-0.5 rounded border border-gray-300 font-mono flex-1"})]}),r.jsxs("label",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-12 text-gray-500",children:"required"}),r.jsx("input",{type:"checkbox",checked:!1!==o.required,onChange:e=>n(a,{required:e.target.checked})})]}),r.jsx("button",{type:"button",onClick:()=>{return n=a,void t({fields:e.fields.filter((e,t)=>t!==n)});var n},className:"text-red-600 text-xs self-end",children:"删除该字段"})]},o.id)),r.jsx("button",{type:"button",onClick:function(){const n=new Set(e.fields.map(e=>e.key));let r=e.fields.length+1;for(;n.has("field_"+r);)r++;t({fields:[...e.fields,{id:i(),key:"field_"+r,label:"",type:"text",required:!0}]})},className:"text-blue-600 text-sm",children:"+ 添加字段"})]})]})}function fn({value:t,candidates:n,placeholder:o,onChange:a}){const[i,s]=e.useState(!1),[l,c]=e.useState(""),[d,u]=e.useState(!1),p=e.useRef(null),f=e.useRef(!1);function h(e){if(f.current=!0,e.startsWith("@")){if(e.endsWith("."))return void(f.current=!1);const t=e.slice(1).split(".").filter(e=>e.length>0);if(t.length>0)return a({kind:"var",path:t}),void s(!1)}a({kind:"lit",raw:e}),s(!1)}e.useEffect(()=>{i&&("var"===t.kind?c("@"+t.path.join(".")):c(t.raw),setTimeout(()=>{var e;return null==(e=p.current)?void 0:e.focus()},0))},[i,t]);const g=n.filter(e=>e.toLowerCase().includes(l.slice(1).toLowerCase()));return i?r.jsxs("div",{className:"relative inline-block",children:[r.jsx("input",{ref:p,type:"text",value:l,placeholder:o,onChange:e=>{c(e.target.value),u(e.target.value.startsWith("@"))},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),h(l)),"Escape"===e.key&&(e.preventDefault(),f.current=!0,s(!1))},onBlur:()=>setTimeout(()=>{f.current?f.current=!1:h(l)},100),className:"px-2 py-0.5 rounded border border-blue-400 text-sm font-mono outline-none w-48"}),d&&g.length>0&&r.jsx("ul",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow text-sm z-10 max-h-48 overflow-auto",children:g.slice(0,10).map(e=>r.jsxs("li",{className:"px-2 py-1 hover:bg-blue-50 cursor-pointer font-mono",onMouseDown:()=>h("@"+e),children:["@",e]},e))})]}):"var"===t.kind?r.jsxs("button",{type:"button",onClick:()=>s(!0),className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-blue-100 text-blue-800 border border-blue-300 text-sm font-mono",children:["@",t.path.join(".")]}):r.jsx("button",{type:"button",onClick:()=>s(!0),className:"px-2 py-0.5 rounded border border-gray-300 text-sm font-mono text-gray-700 hover:bg-gray-50",children:t.raw||r.jsx("span",{className:"italic text-gray-400",children:o??"(空)"})})}function hn({segments:e,candidates:t}){if(0===e.length)return r.jsx("div",{className:"text-xs italic text-gray-400",children:"(空 prompt)"});const n=new Set(t);return r.jsx("div",{className:"text-sm font-mono leading-relaxed border border-gray-200 rounded p-2 bg-gray-50",children:e.map((e,t)=>{if("text"===e.kind)return r.jsx("span",{className:"whitespace-pre-wrap",children:e.raw},t);const o=e.path.join("."),a=n.has(o),i=a?"bg-blue-100 text-blue-800 border border-blue-300":"bg-red-100 text-red-800 border border-red-300";return r.jsxs("span",{className:`inline-flex items-center px-1.5 py-0.5 mx-0.5 rounded ${i}`,title:a?"":`引用未找到: ${o}`,children:["@",o]},t)})})}function gn({node:e,candidates:t,onChange:n}){function o(t,r){n({inputs:e.inputs.map((e,n)=>n===t?{...e,...r}:e)})}function a(t,r){n({outputs:e.outputs.map((e,n)=>n===t?{...e,...r}:e)})}const s=e.promptTemplate.map(e=>"text"===e.kind?e.raw:`@{${e.path.join(".")}}`).join("");return r.jsxs("div",{className:"p-4 flex flex-col gap-4 text-sm",children:[r.jsxs("label",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-gray-600 w-20",children:"fai 名:"}),r.jsx(un,{value:e.faiName,onChange:e=>n({faiName:e}),className:"flex-1"})]}),r.jsxs("label",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-gray-600 w-20",children:"输出变量名:"}),r.jsx(un,{value:e.outputVar,onChange:e=>n({outputVar:e}),className:"flex-1"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-gray-600 mb-1",children:"输入:"}),e.inputs.map((a,i)=>r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(un,{value:a.argName,onChange:e=>o(i,{argName:e}),className:"w-28"}),r.jsxs("select",{value:a.argType,onChange:e=>o(i,{argType:e.target.value}),className:"px-2 py-0.5 rounded border border-gray-300",children:[r.jsx("option",{value:"string",children:"string"}),r.jsx("option",{value:"number",children:"number"}),r.jsx("option",{value:"bool",children:"bool"}),r.jsx("option",{value:"prompt",children:"prompt"})]}),r.jsx("span",{children:"="}),r.jsx(fn,{value:a.source,candidates:t,onChange:e=>o(i,{source:e})}),r.jsx("button",{type:"button",onClick:()=>{return t=i,void n({inputs:e.inputs.filter((e,n)=>n!==t)});var t},className:"text-red-600 text-xs ml-auto",children:"×"})]},a.id)),r.jsx("button",{type:"button",onClick:function(){const t=new Set(e.inputs.map(e=>e.argName));let r=e.inputs.length+1;for(;t.has("arg"+r);)r++;n({inputs:[...e.inputs,{id:i(),argName:"arg"+r,argType:"string",source:{kind:"lit",raw:'""'}}]})},className:"text-blue-600 text-xs",children:"+ 添加输入"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-gray-600 mb-1",children:"输出 (schema):"}),e.outputs.map((t,o)=>r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(un,{value:t.name,onChange:e=>a(o,{name:e}),className:"w-28"}),r.jsxs("select",{value:t.type,onChange:e=>a(o,{type:e.target.value}),className:"px-2 py-0.5 rounded border border-gray-300",children:[r.jsx("option",{value:"string",children:"string"}),r.jsx("option",{value:"int",children:"int"}),r.jsx("option",{value:"number",children:"number"}),r.jsx("option",{value:"bool",children:"bool"}),r.jsx("option",{value:"array",children:"array"})]}),"array"===t.type&&r.jsxs("select",{value:t.innerType??"string",onChange:e=>a(o,{innerType:e.target.value}),className:"px-2 py-0.5 rounded border border-gray-300",children:[r.jsx("option",{value:"string",children:"array<string>"}),r.jsx("option",{value:"int",children:"array<int>"}),r.jsx("option",{value:"number",children:"array<number>"}),r.jsx("option",{value:"bool",children:"array<bool>"})]}),r.jsx("button",{type:"button",onClick:()=>{return t=o,void n({outputs:e.outputs.filter((e,n)=>n!==t)});var t},className:"text-red-600 text-xs ml-auto",children:"×"})]},t.id)),r.jsx("button",{type:"button",onClick:function(){const t=new Set(e.outputs.map(e=>e.name));let r=e.outputs.length+1;for(;t.has("out"+r);)r++;n({outputs:[...e.outputs,{id:i(),name:"out"+r,type:"string"}]})},className:"text-blue-600 text-xs",children:"+ 添加输出"})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"text-gray-600 mb-1",children:["Prompt(用 @","{var.path}"," 引用上文变量):"]}),r.jsx("textarea",{value:s,onChange:e=>function(e){const t=[];let r=0;for(;r<e.length;){const n=e.indexOf("@{",r);if(-1===n){t.push({kind:"text",raw:e.slice(r)});break}n>r&&t.push({kind:"text",raw:e.slice(r,n)});const o=e.indexOf("}",n+2);if(-1===o){t.push({kind:"text",raw:e.slice(n)});break}const a=e.slice(n+2,o).split(".").filter(e=>e.length>0);a.length>0?t.push({kind:"ref",path:a}):t.push({kind:"text",raw:e.slice(n,o+1)}),r=o+1}n({promptTemplate:t})}(e.target.value),rows:5,className:"w-full px-2 py-1 rounded border border-gray-300 font-mono text-sm"}),r.jsxs("div",{className:"mt-1",children:[r.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"实际 AI 看到的内容预览:"}),r.jsx(hn,{segments:e.promptTemplate,candidates:t})]}),r.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:["可用变量: ",t.slice(0,8).map(e=>`@{${e}}`).join(" · "),t.length>8?` 等 ${t.length} 个`:""]})]})]})}function mn({node:e,candidates:t,onChange:n}){const o=e.value;return"triple"===o.kind?r.jsx("div",{className:"p-4 text-sm text-red-600",children:"M1 不支持 TripleSlot 值。请等 M2 三格拼装器实装。"}):r.jsxs("div",{className:"p-4 flex flex-col gap-3 text-sm",children:[r.jsxs("label",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-gray-600 w-16",children:"变量名:"}),r.jsx(un,{value:e.varName,onChange:e=>n({varName:e}),className:"flex-1"})]}),r.jsxs("label",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-gray-600 w-16",children:"值:"}),r.jsx(fn,{value:o,candidates:t,placeholder:'@变量 或字面量(如 "hello" / 42 / true)',onChange:e=>n({value:e})})]}),r.jsx("div",{className:"text-xs text-gray-500",children:"提示:M1 暂不支持 a + b 这种表达式。需要时先用 fai 节点中转,或等 M2 三格拼装器。"})]})}function vn({node:e,candidates:t,onChange:n}){const o=e.value;return"triple"===o.kind?r.jsx("div",{className:"p-4 text-sm text-red-600",children:"M1 不支持 TripleSlot 值。等 M2 三格拼装器。"}):r.jsx("div",{className:"p-4 flex flex-col gap-3 text-sm",children:r.jsxs("label",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-gray-600 w-16",children:"返回值:"}),r.jsx(fn,{value:o,candidates:t,placeholder:'@变量 或字面量(如 { foo: 1 } / "hello" / null)',onChange:e=>n({value:e})})]})})}function bn({node:e,candidates:t,onChange:n,onClose:o}){return e?r.jsxs("aside",{className:"flex flex-col w-96 border-l border-gray-200 bg-white overflow-hidden flex-shrink-0",children:[r.jsxs("header",{className:"flex items-center justify-between p-3 border-b border-gray-200 bg-gray-50 flex-shrink-0",children:[r.jsx("span",{className:"font-medium text-sm",children:"编辑节点"}),r.jsx("button",{type:"button",onClick:o,className:"text-gray-500 hover:text-gray-800 text-lg leading-none",children:"×"})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto",children:["ask_user"===e.type&&r.jsx(pn,{node:e,onChange:n}),"fai"===e.type&&r.jsx(gn,{node:e,candidates:t,onChange:n}),"let"===e.type&&r.jsx(mn,{node:e,candidates:t,onChange:n}),"return"===e.type&&r.jsx(vn,{node:e,candidates:t,onChange:n})]})]}):null}const xn=e.lazy(async()=>{const[e,t]=await Promise.all([o(()=>import("./editor.main-Dv96_EKG.js").then(e=>e.e),__vite__mapDeps([0,1,2,3])),o(()=>import("./index-dHRMoKUn.js"),__vite__mapDeps([4,1,2]))]),n=e.default??e;return t.loader.config({monaco:n}),{default:t.default}});function yn({open:t,source:n,errors:o,onClose:a}){return t?r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:a,children:r.jsxs("div",{className:"bg-white rounded-lg w-3/4 h-3/4 flex flex-col",onClick:e=>e.stopPropagation(),children:[r.jsxs("header",{className:"flex items-center justify-between p-3 border-b border-gray-200",children:[r.jsx("span",{className:"font-medium",children:"预览 .tr(只读)"}),r.jsx("button",{onClick:a,className:"text-gray-500 hover:text-gray-800 text-lg leading-none",children:"×"})]}),o&&o.length>0&&r.jsxs("div",{className:"bg-red-50 border-b border-red-200 p-2 text-sm text-red-700",children:[r.jsxs("div",{className:"font-medium mb-1",children:["codegen 报错(",o.length,"):"]}),o.slice(0,5).map((e,t)=>r.jsxs("div",{className:"font-mono text-xs",children:["节点 #",e.nodeIndex,": ",e.message]},t))]}),r.jsx("div",{className:"flex-1 overflow-hidden",children:r.jsx(e.Suspense,{fallback:r.jsx("div",{className:"p-4 text-sm text-gray-500",children:"加载预览中..."}),children:r.jsx(xn,{height:"100%",value:n,language:"javascript",options:{readOnly:!0,minimap:{enabled:!1},fontSize:13}})})})]})}):null}function wn(e,t){return function(e,t){switch(t.type){case"add":{const n=Math.max(0,Math.min(t.index,e.body.length)),r=[...e.body];return r.splice(n,0,t.node),{...e,body:r}}case"remove":{const n=e.body.filter((e,n)=>n!==t.index);return{...e,body:n}}case"move":{const n=[...e.body],[r]=n.splice(t.from,1);return r?(n.splice(t.to,0,r),{...e,body:n}):e}case"duplicate":{const n=e.body[t.index];if(!n)return e;let r=JSON.parse(JSON.stringify(n));r.id=a(),"ask_user"===r.type&&(r.fields=r.fields.map(e=>({...e,id:i()}))),"fai"===r.type&&(r.inputs=r.inputs.map(e=>({...e,id:i()})),r.outputs=r.outputs.map(e=>({...e,id:i()})));const o=d(r);if(o){const t=new Set(e.body.map(d).filter(e=>null!==e));let n=o,a=2;for(;t.has(n);)n=`${o}_${a++}`;n!==o&&(r=function(e,t){return"ask_user"===e.type||"fai"===e.type?{...e,outputVar:t}:"let"===e.type?{...e,varName:t}:e}(r,n))}const s=[...e.body];return s.splice(t.index+1,0,r),{...e,body:s}}case"update":{const n=e.body.map((e,n)=>n===t.index?{...e,...t.patch}:e);return{...e,body:n}}}}(e,t)}function Nn({initialGraph:t,trackName:n,onSave:o,onRequestClose:a,onDirtyChange:i}){const[s,l]=e.useReducer(wn,t??function(e){return{version:1,trackName:e,body:[]}}(n)),[c,d]=e.useState(null),[p,f]=e.useState(!1),[h,g]=e.useState(null),[m,v]=e.useState(!1),b=e.useRef(!1),x=e.useCallback(e=>{l(e),b.current||(b.current=!0,null==i||i(!0))},[i]),y=null===c?-1:s.body.findIndex(e=>e.id===c),w=y>=0?s.body[y]:null,N=e.useMemo(()=>u(s,y>=0?y:s.body.length),[s,y]);const j=e.useMemo(()=>D(s),[s]),C=j.ok?j.source:"// codegen 错误:\n"+(j.errors??[]).map(e=>`// #${e.nodeIndex}: ${e.message}`).join("\n");return r.jsxs("div",{className:"flex flex-col h-full w-full bg-gray-50",children:[r.jsxs("header",{className:"flex items-center gap-3 p-3 border-b border-gray-200 bg-white flex-shrink-0",children:[r.jsx("button",{onClick:a,className:"px-3 py-1 text-sm rounded border border-gray-300 hover:bg-gray-50",children:"← 返回列表"}),r.jsx("span",{className:"text-lg font-medium",children:n}),r.jsx("span",{className:"text-xs text-gray-400",children:"节点图模式"}),r.jsxs("div",{className:"ml-auto flex gap-2",children:[r.jsx("button",{onClick:()=>f(!0),className:"px-3 py-1 text-sm rounded border border-gray-300 hover:bg-gray-50",children:"预览代码"}),r.jsx("button",{onClick:async function(){var e;g(null);const t=D(s);if(!t.ok||!t.source){const n=(null==(e=t.errors)?void 0:e.length)??0;return g(`codegen 报 ${n} 个错。点"预览代码"查看详情。`),void f(!0)}v(!0);try{await o(t.source),b.current=!1,null==i||i(!1)}catch(n){g(n instanceof Error?n.message:String(n))}finally{v(!1)}},disabled:m,className:"px-3 py-1 text-sm rounded bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50",children:m?"保存中...":"保存"})]}),h&&r.jsx("div",{className:"ml-3 text-xs text-red-600 max-w-md truncate",title:h,children:h})]}),r.jsxs("div",{className:"flex flex-row flex-1 overflow-hidden",children:[r.jsx(cn,{}),r.jsx(rn,{graph:s,dispatch:x,selectedId:c,onSelect:d}),r.jsx(bn,{node:w,candidates:N,onChange:function(e){y<0||x({type:"update",index:y,patch:e})},onClose:()=>d(null)})]}),r.jsx(yn,{open:p,source:C,errors:j.ok?void 0:j.errors,onClose:()=>f(!1)})]})}export{Nn as TrackVisualEditor};
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-CoQOKlkh.js";
1
+ import{c as o}from"./index-7HzPvnim.js";
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *
@@ -1,4 +1,4 @@
1
- import{m as e}from"./editor.main-DL1nkpnc.js";import"./index-CoQOKlkh.js";
1
+ import{m as e}from"./editor.main-Dv96_EKG.js";import"./index-7HzPvnim.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)