@capagents/forgeqe 3.2.7 → 3.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/forgeqe.js +2 -2
- package/dist/web/assets/{3d-force-graph-CUGt_TSW.js → 3d-force-graph-kBTSxXIh.js} +1 -1
- package/dist/web/assets/Agent-ChuLDhI_.js +8 -0
- package/dist/web/assets/AgentWork-WlgWcwdG.js +2 -0
- package/dist/web/assets/ApiTests-DCVgk8jz.js +15 -0
- package/dist/web/assets/Browse-D5VDHN9Z.js +1 -0
- package/dist/web/assets/Chat-DWppGlX3.js +3 -0
- package/dist/web/assets/CommandPalette-DO9zKXFd.js +1 -0
- package/dist/web/assets/Compare-5XT1-UhD.js +1 -0
- package/dist/web/assets/Cost-DoQKb2Zy.js +1 -0
- package/dist/web/assets/Data-C4qZP1Zy.js +6 -0
- package/dist/web/assets/Desktop-DjMxQX7K.js +1 -0
- package/dist/web/assets/DesktopReview-mdBcmNaP.js +2 -0
- package/dist/web/assets/DeviceScreen-CV1K-m6j.js +1 -0
- package/dist/web/assets/Evidence-CEHozW7v.js +1 -0
- package/dist/web/assets/Explore-BoMjZPSz.js +2 -0
- package/dist/web/assets/Features-BLadDcY1.js +1 -0
- package/dist/web/assets/Flags-zukSfOdZ.js +2 -0
- package/dist/web/assets/Flaky-DCXqd4pH.js +1 -0
- package/dist/web/assets/Impact-xAuYCgh-.js +3 -0
- package/dist/web/assets/Jobs-CSrSLvvc.js +5 -0
- package/dist/web/assets/KindPage-BETFILV0.js +6 -0
- package/dist/web/assets/LiveDevice-BXRKmyNu.js +1 -0
- package/dist/web/assets/Migration-BrdQI9rz.js +8 -0
- package/dist/web/assets/Mobile-yMqtEh5z.js +1 -0
- package/dist/web/assets/Observability-dpEjaJIg.js +1 -0
- package/dist/web/assets/PageAgent-Du6fFTwA.js +1 -0
- package/dist/web/assets/Product-CpfrZib1.js +12 -0
- package/dist/web/assets/Production-CP8dgfoD.js +1 -0
- package/dist/web/assets/Quality-BtJpCXCd.js +1 -0
- package/dist/web/assets/Readiness-DZCwM7s-.js +1 -0
- package/dist/web/assets/Record-CNOj_Iv_.js +1 -0
- package/dist/web/assets/Regression-CB1fF_Wk.js +5 -0
- package/dist/web/assets/RelationGraph-Bcuvouws.js +1 -0
- package/dist/web/assets/Reports-BeP3Z8J1.js +2 -0
- package/dist/web/assets/Responsive-B1IPx8lF.js +3 -0
- package/dist/web/assets/RunDiff-CgHEmzSa.js +1 -0
- package/dist/web/assets/Settings-CCkIjxYd.js +21 -0
- package/dist/web/assets/Steps-B-lZ5Wkb.js +3 -0
- package/dist/web/assets/TestData-DmO64YCV.js +2 -0
- package/dist/web/assets/TestManagement-8KGhwA5N.js +4 -0
- package/dist/web/assets/WhatsNew-DILHgdMf.js +1 -0
- package/dist/web/assets/agentSettingsSheet-DjuI_tWj.js +1 -0
- package/dist/web/assets/api-6pHfHEgB.js +1 -0
- package/dist/web/assets/choice-BOnFje99.js +1 -0
- package/dist/web/assets/{coverage-BhtF065n.js → coverage-DirEXtfZ.js} +3 -3
- package/dist/web/assets/dataParts-B5EYTVwa.js +3 -0
- package/dist/web/assets/desktopAppPath-Bl1BpEdl.js +1 -0
- package/dist/web/assets/frame-CYTuLtfk.js +13 -0
- package/dist/web/assets/index-CD5rZjkE.js +56 -0
- package/dist/web/assets/index-cgQKR5KY.css +2 -0
- package/dist/web/assets/line-icons-B-O8oBsY.js +1 -0
- package/dist/web/assets/markdown-DNMu6eug.js +8 -0
- package/dist/web/assets/nav-Ds_6IERv.js +1 -0
- package/dist/web/assets/pageBack-BlqqGkFF.js +3 -0
- package/dist/web/assets/palette-CtKDEs2m.js +1 -0
- package/dist/web/assets/{paletteCommands-DflHQ05x.js → paletteCommands-LXIICD4V.js} +1 -1
- package/dist/web/assets/parts-CPVWV-vf.js +1 -0
- package/dist/web/assets/preload-helper-DFU5gyja.js +1 -0
- package/dist/web/assets/productParts-DuUbWsKv.js +1 -0
- package/dist/web/assets/qualityParts-DngMe_6f.js +1 -0
- package/dist/web/assets/radio-Cqd6bllR.js +1 -0
- package/dist/web/assets/recordTest-D4lB_GpT.js +1 -0
- package/dist/web/assets/route-DjewvmpL.js +1 -0
- package/dist/web/assets/sectionList-0umoKvRv.js +1 -0
- package/dist/web/assets/step-mark-CjJ4mLr4.js +1 -0
- package/dist/web/assets/stepper-C0dKJtxi.js +1 -0
- package/dist/web/index.html +12 -9
- package/package.json +1 -1
- package/dist/web/assets/Agent-DiX8ljlC.js +0 -8
- package/dist/web/assets/AgentWork-BpfMY_xu.js +0 -2
- package/dist/web/assets/ApiTests-4jfzlfVd.js +0 -15
- package/dist/web/assets/Browse-ByDemInL.js +0 -1
- package/dist/web/assets/Chat-C3wKV0CI.js +0 -3
- package/dist/web/assets/CommandPalette-CKJHtRjo.js +0 -1
- package/dist/web/assets/Compare-DtW2g-qb.js +0 -1
- package/dist/web/assets/Cost-DW-kVEL8.js +0 -1
- package/dist/web/assets/Data--HGneNun.js +0 -6
- package/dist/web/assets/Desktop-DQf5gv7D.js +0 -1
- package/dist/web/assets/DesktopReview-BaPYt0kl.js +0 -2
- package/dist/web/assets/DeviceScreen-DzVNfMwl.js +0 -1
- package/dist/web/assets/Evidence-CxRMnZch.js +0 -1
- package/dist/web/assets/Explore-ChpAuezG.js +0 -2
- package/dist/web/assets/Features-VsLb8QTH.js +0 -1
- package/dist/web/assets/Flags-Do-pvmCF.js +0 -2
- package/dist/web/assets/Flaky-CyhTszAg.js +0 -1
- package/dist/web/assets/Impact-BWBAXRuw.js +0 -3
- package/dist/web/assets/Jobs-C_MjXv0_.js +0 -5
- package/dist/web/assets/KindPage-Bb3Kp4-q.js +0 -6
- package/dist/web/assets/LiveDevice-OyxEiqBt.js +0 -1
- package/dist/web/assets/Migration-C80mGA3h.js +0 -8
- package/dist/web/assets/Mobile-C4wVBYfr.js +0 -1
- package/dist/web/assets/Observability-DdTOLp2C.js +0 -1
- package/dist/web/assets/PageAgent-Bi53-H99.js +0 -1
- package/dist/web/assets/Product-0LXndvp-.js +0 -12
- package/dist/web/assets/Production-oTXhv40a.js +0 -1
- package/dist/web/assets/Quality-CY0CJF9e.js +0 -1
- package/dist/web/assets/Readiness-Bv9uTTiI.js +0 -1
- package/dist/web/assets/Record-C-kyOkYq.js +0 -1
- package/dist/web/assets/Regression-CwKxvG1h.js +0 -5
- package/dist/web/assets/RelationGraph-BQl3M4zd.js +0 -1
- package/dist/web/assets/Reports-Ck8rc3br.js +0 -2
- package/dist/web/assets/Responsive-COmV2NXo.js +0 -3
- package/dist/web/assets/RunDiff-BBT1sQLh.js +0 -1
- package/dist/web/assets/Settings-7aMk9Sqx.js +0 -21
- package/dist/web/assets/Steps-C_vL6-8p.js +0 -3
- package/dist/web/assets/TestData-KzMy9N9f.js +0 -2
- package/dist/web/assets/TestManagement-BCEhOGB9.js +0 -4
- package/dist/web/assets/WhatsNew-DTcaqdOJ.js +0 -1
- package/dist/web/assets/agentSettingsSheet-DM1aa237.js +0 -1
- package/dist/web/assets/choice-B6z9CWyZ.js +0 -1
- package/dist/web/assets/dataParts-BNDVxwFb.js +0 -3
- package/dist/web/assets/desktopAppPath-D4hHP56R.js +0 -1
- package/dist/web/assets/frame-CNYHTG4T.js +0 -13
- package/dist/web/assets/index-B1Q2Dlqw.js +0 -56
- package/dist/web/assets/index-sxUpjgyw.css +0 -2
- package/dist/web/assets/markdown-BhU7ng6c.js +0 -8
- package/dist/web/assets/pageBack-BoSbGSU6.js +0 -3
- package/dist/web/assets/palette-BsY8OLxd.js +0 -1
- package/dist/web/assets/parts-C4QMgN_N.js +0 -1
- package/dist/web/assets/preload-helper-qorOEK5q.js +0 -1
- package/dist/web/assets/productParts-Dxl-TQKY.js +0 -1
- package/dist/web/assets/qualityParts-ClGKtjEv.js +0 -1
- package/dist/web/assets/radio-DDxnnflQ.js +0 -1
- package/dist/web/assets/recordTest-B33rIncn.js +0 -1
- package/dist/web/assets/route-D9uPlFWw.js +0 -1
- package/dist/web/assets/sectionList-e5mFDaS2.js +0 -1
- package/dist/web/assets/stepper-DSDz0uu8.js +0 -1
package/dist/forgeqe.js
CHANGED
|
@@ -3577,8 +3577,8 @@ ${d.join(`
|
|
|
3577
3577
|
`)||"(no sheets)"))}catch(c){throw Error(`the file could not be read (${c.message})`)}}var $le,sct,cPn=50331648,oWs=2000,Sle=1048576,iWs=30,aWs=5000,cWs=500,lWs,rct=(e,t)=>new RegExp(`\\b${t}="([^"]*)"`).exec(e)?.[1];var uPn=J(()=>{r5e();$le=new Set([".docx",".xlsx",".pptx"]),sct={".doc":".docx",".xls":".xlsx",".ppt":".pptx"},lWs={".docx":"word/document.xml",".xlsx":"xl/workbook.xml",".pptx":"ppt/presentation.xml"}});import{spawnSync as fWs}from"child_process";import{readdirSync as mWs,statSync as gWs}from"fs";import pPn from"path";function vWs(e,t){if(!t)return 1;let n=pPn.posix.basename(e.replace(/\/$/,"")).toLowerCase(),r=e.toLowerCase(),s=t.toLowerCase().replace(/\/$/,"");if(!s)return 1;if(n===s)return 100;if(n.startsWith(s))return 80;if(n.includes(s))return 50;if(r.includes(s))return 20;return 0}function _Ws(e){let t=fWs("git",["-c","core.fsmonitor=false","-c","core.quotepath=false","ls-files","-z","--cached","--others","--exclude-standard"],{cwd:e,shell:!1,encoding:"utf8",maxBuffer:67108864,timeout:5000,env:{...process.env,GIT_OPTIONAL_LOCKS:"0",GIT_TERMINAL_PROMPT:"0"},windowsHide:!0});if(t.error||t.status!==0||typeof t.stdout!=="string")return null;return[...new Set(t.stdout.split("\x00").filter(Boolean))]}function SWs(e){let t=[],n=0,r=(s,o,a)=>{if(a>yWs||n>=dPn)return;let c;try{c=mWs(s)}catch{return}for(let l of c){if(n>=dPn)return;if(l.startsWith(".")||fPn.has(l)||Qd.test(l))continue;n++;let u=pPn.join(s,l),d;try{d=gWs(u)}catch{continue}let p=o?`${o}/${l}`:l;if(d.isDirectory())r(u,p,a+1);else if(d.isFile())t.push(p)}};return r(e,"",0),t}function $Ws(e,t=Date.now()){let n=xle.get(e);if(n&&t-n.at<bWs)return n.paths;let r=(_Ws(e)??SWs(e)).filter(kWs),s=new Set;for(let a of r){let c=a.split("/");for(let l=1;l<c.length;l++)s.add(`${c.slice(0,l).join("/")}/`)}let o=[...s,...r];if(xle.set(e,{at:t,paths:o}),xle.size>16)xle.delete(xle.keys().next().value);return o}function x1e(e,t){if(typeof t!=="string")throw Error("Find a file by its name.");if(t.length>wWs||/[\u0000-\u001f]/.test(t))throw Error("That search is not a file name.");let n=Db(e),r=t.trim().replace(/^"|"$/g,""),s=$Ws(n).map((a)=>({p:a,n:vWs(a,r)})).filter((a)=>a.n>0).sort((a,c)=>c.n-a.n||Number(a.p.endsWith("/"))-Number(c.p.endsWith("/"))||a.p.length-c.p.length||a.p.localeCompare(c.p)),o=[];for(let{p:a}of s){if(o.length>=hWs)break;try{let c=Lb(n,a);if(c.path===a)o.push({path:c.path,name:c.name})}catch{}}return o}var fPn,hWs=40,yWs=12,dPn=20000,wWs=200,bWs=15000,kWs=(e)=>e.split("/").every((t)=>t&&!t.startsWith(".")&&!fPn.has(t)&&!Qd.test(t)),xle;var oct=J(()=>{Ay();t$();fPn=new Set(["node_modules","dist","build","bin","obj","out","target","venv",".venv","__pycache__","coverage","playwright-report","test-results",".git",".forgeqe",".webpilot"]);xle=new Map});import{existsSync as gPn,mkdirSync as xWs,readdirSync as EWs,realpathSync as Bz,statSync as ict,unlinkSync as E1e,writeFileSync as hPn}from"fs";import _c from"path";function e1(e,t,n=!0){return _c.resolve(t,n&&e?e:".")}function PWs(e,t){if(e.startsWith("image/"))return HQe(e,t);if(e==="application/pdf")return t.subarray(0,5).toString("latin1")==="%PDF-";return(e==="text/plain"||e==="application/json"||e.startsWith("text/"))&&!t.includes(0)}function bPn(e,t){let n=Lb(e,t);return{path:n.path,name:n.name,...n.size!==void 0?{size:n.size}:{}}}function NWs(e,t=CWs,n=Date.now()){let r=0,s;try{s=EWs(e)}catch{return 0}for(let o of s){if(o.startsWith("."))continue;let a=_c.join(e,o);try{let c=ict(a,{throwIfNoEntry:!1});if(!c?.isFile()||Bz(a)!==_c.join(Bz(e),o))continue;if(n-c.mtimeMs>t)E1e(a),r++}catch{}}return r}function vPn(e){let t=_c.join(Db(e),...zQe.split("/"));return xWs(t,{recursive:!0}),Ga(t,"# Files dropped on a chat: the agent reads them; git does not keep them."),NWs(t),t}function IWs(e,t){let n=typeof e==="string"?_c.basename(e.trim()):"",r=_c.extname(n).toLowerCase()||(t==="image/png"?".png":t==="image/jpeg"?".jpg":t==="image/webp"?".webp":t==="image/gif"?".gif":t==="application/pdf"?".pdf":"");if(sct[r])throw Error(`Save the file as ${sct[r]} and attach that: the older ${r} format is not read.`);if(!(cxe(`x${r}`)||OWs.has(r)||r===yPn||$le.has(r)))throw Error("Attach an image (PNG, JPEG, WebP, GIF), a PDF, a Word, Excel or PowerPoint file, or a text or code file.");let o=_c.basename(n,_c.extname(n)).replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|(?<!-)-+$/g,"").slice(0,80);if(!jWs.test(o)||Qd.test(o)||Qd.test(`${o}${r}`))throw Error("Give the file a plain name (letters, digits, . _ -), not one that looks like credentials.");return{stem:o,ext:r}}function mPn(e,t){if(typeof e!=="string"||!e.trim())throw Error("The file has no contents.");let n=e.replace(/\s/g,""),s=`The file is too large to attach here (${t>=1048576?`${Math.round(t/1024/1024)} MB`:`${Math.round(t/1024)} KB`} at most): put it in the agent's folder and @ its path instead.`;if(/[^A-Za-z0-9+/=]/.test(n))throw Error("The file could not be read.");if(n.length>Math.ceil(t*4/3)+8)throw Error(s);let o=Buffer.from(n,"base64");if(!o.length)throw Error("The file could not be read.");if(o.length>t)throw Error(s);return o}function kPn(e,t){if(typeof t!=="string"||!axe.test(t.trim()))throw Error("Only a file dropped on a chat can be removed.");let n=t.trim(),r=Db(e),s=_c.resolve(r,n);if(!gPn(s))throw Error("Only a file dropped on a chat can be removed.");let o=Bz(s),a=_c.relative(r,o).split(_c.sep).join("/");if(a!==n||!axe.test(a))throw Error("Only a file dropped on a chat can be removed.");let c=_c.basename(a);if(c.startsWith(".")||Qd.test(c))throw Error("That file is not removed.");let l=_c.join(r,...zQe.split("/"));if(_c.dirname(o)!==Bz(l)||!ict(o).isFile())throw Error("Only a file dropped on a chat can be removed.");if(E1e(o),$le.has(_c.extname(c).toLowerCase())){let u=_c.join(_c.dirname(o),act(c));try{if(ict(u,{throwIfNoEntry:!1})?.isFile()&&Bz(u)===u)E1e(u)}catch{}}return{ok:!0}}function A1e(e,t,n={}){let r=typeof t.type==="string"?t.type.toLowerCase():"",{stem:s,ext:o}=IWs(t.name,r),a=cxe(`x${o}`);if($le.has(o))return MWs(e,s,o,mPn(t.data,TWs));let l=a||(o===yPn?"application/pdf":o===".json"?"application/json":"text/plain");if(a&&r&&r!==l&&!(o===".jpg"&&r==="image/jpg"))throw Error("The file's type does not match its name.");let u=mPn(t.data,a?n.maxImage??RWs:AWs);if(!PWs(l,u))throw Error(`That file is not a ${o.slice(1).toUpperCase()} file.`);let d=_Pn(vPn(e),s,o,u);return{path:_c.relative(Db(e),Bz(d)).split(_c.sep).join("/"),name:_c.basename(d)}}function _Pn(e,t,n,r,s){for(let o=0;o<=999;o++){let a=_c.join(e,o?`${t}-${o}${n}`:`${t}${n}`);if(s&&!s(a))continue;try{return hPn(a,r,{flag:"wx"}),a}catch(c){if(c.code!=="EEXIST")throw c}}throw Error("Too many files with that name in the inbox.")}function MWs(e,t,n,r){let s;try{s=lPn(n,r,`${t}${n}`)}catch(d){throw Error(`That file could not be attached: ${d.message}.`)}let o=vPn(e),a=_Pn(o,t,n,r,(d)=>!gPn(act(d))),c=act(a);try{hPn(c,s.replace(`# Text of ${t}${n}`,`# Text of ${_c.basename(a)}`),{flag:"wx"})}catch(d){throw E1e(a),d}let l=Db(e),u=(d)=>_c.relative(l,Bz(d)).split(_c.sep).join("/");return{path:u(a),name:_c.basename(a),text:u(c)}}var AWs=716800,TWs=5242880,act=(e)=>`${e}.md`,RWs,CWs=1209600000,OWs,yPn=".pdf",jWs,wPn;var cct=J(()=>{t$();uPn();oct();Ay();bn();RWs=ixe,OWs=new Set([".md",".txt",".csv",".tsv",".json",".xml",".yaml",".yml",".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".java",".cs",".go",".rb",".sql",".log",".feature",".toml",".ini",".sh",".ps1"]),jWs=/^[A-Za-z0-9][A-Za-z0-9._-]{0,80}$/,wPn=x1e});import{createHash as DWs}from"crypto";import{existsSync as Ele,mkdirSync as SPn,readdirSync as lct,readFileSync as $Pn,realpathSync as TQ,statSync as dct,writeFileSync as LWs}from"fs";import rg from"path";function xPn(e,t="",n=0,r=Ele(e)?TQ(e):e){if(n>3)return[];let s;try{s=lct(rg.join(e,t)).sort()}catch{return[]}let o=[];for(let a of s){if(a.startsWith(".")||a===iE)continue;let c=t?`${t}/${a}`:a,l=rg.join(e,c),u;try{u=dct(l);let d=rg.relative(r,TQ(l));if(d.startsWith("..")||rg.isAbsolute(d))continue}catch{continue}if(u.isDirectory())o.push(...xPn(e,c,n+1,r));else if(/\.(md|txt)$/i.test(a)&&a.toLowerCase()!=="readme.md")o.push(c)}return o.slice(0,qWs)}function EPn(e){let t=e.knowledge?.dir||"",n=xPn(t).map((r)=>{let s=rg.join(t,r),o=dct(s),a=o.size<=T1e?$Pn(s,"utf8"):"",c=Ug(t,r),l=c==="unchanged"?"template":c==="edited"?"edited":"own",u=a.replace(/<!--[\s\S]*?-->/g,"").replace(/^#.*$/gm,"").trim();return{rel:r,title:UWs(a,r),size:o.size,modified:o.mtime.toISOString(),state:l,used:l!=="template"&&o.size<=T1e&&u.length>0}});return{dir:t,maxChars:e.knowledge?.browserMaxChars??0,files:n}}function APn(e,t,n=!1){let r=e.knowledge?.dir;if(!r)throw Error("This project has no knowledge folder.");if(typeof t!=="string"||!FWs.test(t)||t.split("/").some((u)=>u===".."))throw Error("Name the file like products/checkout.md: letters, digits, spaces and _ . -, ending in .md or .txt.");let s=rg.join(r,t);if(!n&&!Ele(s))throw Object.assign(Error(`There is no ${t} in the knowledge folder.`),{status:404});SPn(r,{recursive:!0});let o=TQ(r),a=s;while(!Ele(a))a=rg.dirname(a);let c=TQ(a),l=rg.relative(o,c);if(l.startsWith("..")||rg.isAbsolute(l))throw Error(`${t} is outside the knowledge folder.`);return s}function pct(e,t){let n=APn(e,t);if(dct(n).size>T1e)throw Error("That file is too large to edit here.");return{rel:t,text:$Pn(n,"utf8")}}function TPn(e,t,n){if(typeof n!=="string")throw Error("Expected the file's text.");if(n.length>T1e)throw Error("That file is too long.");let r=APn(e,t,!0);return SPn(rg.dirname(r),{recursive:!0}),LWs(r,n.endsWith(`
|
|
3578
3578
|
`)||!n?n:`${n}
|
|
3579
3579
|
`,"utf8"),r}function R1e(e,t){return DWs("sha256").update(rg.relative(e,t).split(rg.sep).join("/")).digest("hex").slice(0,16)}function uct(e){let t=new Map,n=(o,a)=>t.set(o,[...t.get(o)||[],a]);for(let o of pi(e))n(`site:${o.host}`,o.file);for(let o of ub(e))n(o.host?`site:${o.host}`:`other:${BWs}`,o.file);for(let o of["mobile","desktop"]){let a=rg.join(e,o,"flows"),c=new Set(Ele(a)?lct(a):[]);for(let l of["controls","heals"]){let u=rg.join(e,o,l);for(let d of Ele(u)?lct(u):[])if(d.endsWith(".json"))c.add(d.slice(0,-5))}for(let l of c)for(let u of Aee(e,l))if(!(t.get(`app:${l}`)||[]).includes(u))n(`app:${l}`,u)}let r=[...pi(e).map((o)=>o.file),...ub(e).map((o)=>o.file),...Aee(e)];return{targets:[...t].map(([o,a])=>({name:o.slice(o.indexOf(":")+1),kind:o.slice(0,o.indexOf(":")),files:a.length})).sort((o,a)=>o.kind.localeCompare(a.kind)||o.name.localeCompare(a.name)),files:t,all:r}}function RPn(e,t,n,r){let s=(p)=>Object.assign(Error(p),{status:400}),o=()=>Object.assign(Error("Memory holds nothing for that."),{status:404});if(r!==!0)throw s("Clearing memory removes what runs learned: confirm it first.");let a=e.memory.dir,c,l="everything";if(t===""||t===void 0||t===null)c=uct(a).all;else if(typeof t!=="string")throw s("Clear everything, a site or app from the list, or one flow or page.");else if(n==="flow"||n==="page"){if(!/^[0-9a-f]{16}$/.test(t))throw o();let p=n==="flow"?ub(a).find((f)=>R1e(a,f.file)===t):pi(a).find((f)=>R1e(a,f.file)===t);if(!p)throw o();c=[p.file],l="goal"in p?`flow "${p.goal.slice(0,80)}"`:`page ${p.host}${p.path}`}else if(n==="site"||n==="app"||n==="other"){let p=uct(a).files.get(`${n}:${t}`);if(!p)throw o();c=p,l=n==="other"?"flows on no site":`${n} ${t}`}else throw s("Clear everything, a site or app from the list, or one flow or page.");let u;try{u=TQ(a)}catch{return{removed:0,what:l}}let d=c.filter((p)=>{try{let f=rg.relative(u,TQ(p));return!!f&&!f.startsWith("..")&&!rg.isAbsolute(f)}catch{return!1}});return n6(d),{removed:d.length,what:l}}function fct(e){let t=e.memory.dir,n=pi(t).map((o)=>({id:R1e(t,o.file),host:o.host,path:o.path,title:o.title||void 0,visits:o.visits??0,elements:Object.keys(o.elements||{}).length,lastSeen:o.last_seen})).sort((o,a)=>String(a.lastSeen||"").localeCompare(String(o.lastSeen||""))),r=ub(t).map((o)=>({id:R1e(t,o.file),goal:o.goal,host:o.host,runs:o.runs??0,successes:o.successes??0,failures:o.failures??0,replays:o.replays??0,modelSteps:o.llm_steps??0,replayedSteps:o.replayed_steps??0,lastRun:o.last_run,lastStatus:o.last_status,steps:o.steps.length})),s=uct(t);return{enabled:e.memory.enabled,replay:e.memory.replay,dir:t,pages:n,flows:r,stats:AOe(e),targets:s.targets,files:s.all.length}}var T1e=262144,qWs=500,FWs,UWs=(e,t)=>e.match(/^#\s+(.+)$/m)?.[1]?.trim()||t.replace(/\.(md|txt)$/i,""),BWs="Other";var CPn=J(()=>{WR();Am();Nst();FWs=/^(?:[A-Za-z0-9_][A-Za-z0-9 _.-]*\/){0,3}[A-Za-z0-9_][A-Za-z0-9 _.-]*\.(md|txt)$/});function jPn(e){let t={};for(let r of e.docs)t[r.kind]=(t[r.kind]||0)+1;let n=e.docs.filter((r)=>r.kind!=="skill"&&r.kind!=="chat");return{documents:n.length,sections:n.reduce((r,s)=>r+s.sections.length,0),byKind:t,builtAt:e.builtAt,waiting:e.notes.filter((r)=>r.includes("not read yet")).length,indexing:!!Ale}}async function PPn(e){return jPn(await Im(e,{folders:C1e(e)}))}async function NPn(e,t={}){if(!Ale)Ale=Im(e,{folders:C1e(e),office:!0,...t}).finally(()=>Ale=null);return jPn(await Ale)}async function IPn(e,t,n={}){let r=kr(String(t.query??""),zWs);if(!r)throw OPn("Type what to look for.");let s=t.scope==="chats"?"chats":t.scope==="skills"?"skills":"documents",o=Number(t.top_k)>0?Math.min(20,Math.floor(Number(t.top_k))):8,a=t.reasoning===!0?n.picker!==void 0?n.picker:NI(e,Wy(e)):void 0,c=await lh(e,r,{topK:o,scope:s,folders:C1e(e),...a!==void 0?{picker:a}:{}});return{documents:c.documents,reasoning:c.reasoning,hits:c.hits.map((l)=>({source:kr(l.source,80),file:kr(l.file,200),line:l.line,where:kr(l.where,300),text:l.text.slice(0,HWs),picked:l.picked}))}}async function MPn(e,t){let n=String(t??"");if(!n||n.length>300)throw OPn("Name a knowledge file.");let s=(await Im(e,{folders:C1e(e)})).docs.find((o)=>o.kind==="knowledge"&&o.file===n);if(!s)throw Object.assign(Error("That file has no sections yet: give it a heading and some text."),{status:404});return{rel:s.file,sections:s.sections.map((o)=>({where:kr(hE(o),300),title:kr(o.title,160),depth:o.depth,line:o.line}))}}var zWs=500,HWs=1500,OPn=(e)=>Object.assign(Error(e),{status:400}),Ale=null,C1e=(e)=>e.rag?.documents?.folders??[];var DPn=J(()=>{fO();mk();II();$8()});function t1(e,t){let n=String(e||"").trim().replace(/(?<!\/)\/+$/,"");if(!n)throw Error(`Add the ${t} first.`);let r;try{r=new URL(n)}catch{throw Error(`The ${t} is not an address: ${n}`)}if(r.protocol!=="https:"&&r.protocol!=="http:")throw Error(`The ${t} must start with https://`);if(r.username||r.password)throw Error(`Put the user name and password in their own fields, not in the ${t}.`);return n}function LPn(e,t){let n=t1(e,t);if(new URL(n).protocol!=="https:")throw Error(`The ${t} must start with https://`);if(new URL(n).search||new URL(n).hash)throw Error(`The ${t} must be a plain address, without ? or #.`);return n}function O1e(e,t,n){return(r,s,o,a=!1)=>{let c=String(e[r]??s),l=t[c]??n[c];if(!l&&!a)throw Error(`Add the ${o} first.`);return l||""}}async function FPn(e,t,n,r,s=process.env,o={}){let a={};for(let[m,g]of Object.entries(RQ(r))){if(!Pr(m))throw Error(`"${m}" cannot hold a value.`);if(typeof g==="string"&&g.trim())a[m]=g.trim()}let c=RQ(n),l=O1e(c,a,s),u=o.fetch||fetch,d=async(m,g)=>{let h=g.body===void 0?"GET":"POST",y;try{y=await u(m,{method:h,headers:{Accept:"application/json",...g.auth?{Authorization:g.auth}:{},...g.body===void 0?{}:{"Content-Type":"application/json"}},body:g.body===void 0?void 0:JSON.stringify(g.body),signal:AbortSignal.timeout(20000)})}catch(_){let S=_;throw Error(`${new URL(m).host} could not be reached: ${/timeout|abort/i.test(`${S.name} ${S.message}`)?"no answer in 20 seconds":S.message}`)}let b=await y.text();if(!y.ok){let _=new URL(m),S=y.status===401||y.status===403?" Check the user name, the token and its permissions.":y.status===404?" Check the address.":"";throw Error(`${h} ${_.host}${_.pathname} failed: ${y.status} ${y.statusText}.${S}`)}let k=null;try{k=b?JSON.parse(b):null}catch{}return{data:k}},p=(m,g)=>bXe(m)===g?s[dk(m)]?.trim()||"":"",f=async(m,g,h,y={})=>{let b;try{b=await u(m,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream",...y,...g?{Authorization:g}:{}},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"forgeqe-settings",version:"1"}}}),signal:AbortSignal.timeout(20000)})}catch(k){let _=k;throw Error(`${new URL(m).host} could not be reached: ${/timeout|abort/i.test(`${_.name} ${_.message}`)?"no answer in 20 seconds":_.message}`)}if(await b.body?.cancel().catch(()=>{}),b.status===401||b.status===403)return{ok:!1,message:`${h} refused the token (${b.status}).`};if(!b.ok)return{ok:!1,message:`${h} answered ${b.status} ${b.statusText}.`};return{ok:!0,message:`${h} answered.`}};try{if(e==="source")switch(t){case"jira":case"confluence":{let m=t1(c.url||(t==="jira"?s.JIRA_URL:s.CONFLUENCE_URL),"site address"),g=t==="jira"?"Jira":"Confluence",h=WWs(m),y=l("token_env",t==="jira"?"JIRA_API_TOKEN":"CONFLUENCE_TOKEN","token"),b=h?Bl(l("email_env",t==="jira"?"JIRA_EMAIL":"CONFLUENCE_EMAIL","account email"),y):`Bearer ${y}`,k=t==="jira"?`${m}/rest/api/${h?3:2}/myself`:`${m.replace(/\/wiki$/,"")}${h?"/wiki":""}/rest/api/user/current`,{data:_}=await d(k,{auth:b});if(!_?.displayName||_.type==="anonymous")return{ok:!1,message:`${g} did not accept the token.`};return{ok:!0,message:`Connected to ${g} as ${_.displayName}.`}}case"azure_devops":{let m=t1(c.org_url||s.ADO_ORG_URL,"organization address"),{data:g}=await d(`${m}/_apis/connectionData`,{auth:Bl("",l("token_env","ADO_PAT","personal access token"))}),h=g?.authenticatedUser?.providerDisplayName;if(!h||/anonymous/i.test(h))return{ok:!1,message:"Azure DevOps did not accept the token."};return{ok:!0,message:`Connected to Azure DevOps as ${h}.`}}case"github":{let m=l("token_env","GITHUB_TOKEN","token"),{data:g}=await d("https://api.github.com/user",{auth:`Bearer ${m}`});if(c.repo)await d(`https://api.github.com/repos/${String(c.repo).replace(/[^A-Za-z0-9_./-]/g,"")}`,{auth:`Bearer ${m}`});return{ok:!0,message:`Connected to GitHub as ${g?.login||"you"}${c.repo?`, with access to ${String(c.repo)}`:""}.`}}case"testrail":{let m=t1(c.url||s.TESTRAIL_URL,"site address"),g=l("email_env","TESTRAIL_EMAIL","email"),{data:h}=await d(`${m}/index.php?/api/v2/get_user_by_email&email=${encodeURIComponent(g)}`,{auth:Bl(g,l("token_env","TESTRAIL_API_KEY","API key"))});return{ok:!0,message:`Connected to TestRail as ${h?.name||g}.`}}case"zephyr":{let m=t1(c.url||s.ZEPHYR_URL||"https://api.zephyrscale.smartbear.com/v2","address");return await d(`${m}/projects?maxResults=1`,{auth:`Bearer ${l("token_env","ZEPHYR_API_TOKEN","API token")}`}),{ok:!0,message:"Connected to Zephyr Scale."}}case"qtest":{let m=t1(c.url||s.QTEST_URL,"site address");if(!c.project_id)return{ok:!1,message:"Add the project id first."};let{data:g}=await d(`${m}/api/v3/projects/${encodeURIComponent(String(c.project_id))}`,{auth:`Bearer ${l("token_env","QTEST_TOKEN","access token").replace(/^bearer\s+/i,"")}`});return{ok:!0,message:`Connected to qTest${g?.name?`, project ${g.name}`:""}.`}}case"gitlab":{let m=LPn(c.url||"https://gitlab.com","address"),g=l("token_env","GITLAB_TOKEN","token",!0)||p("gitlab",`${m}/api/v4/mcp`)||l("token_env","GITLAB_TOKEN","token, or sign in");return await f(`${m}/api/v4/mcp`,`Bearer ${g}`,"GitLab's MCP server")}case"postman":{let m=c.region==="eu"?wme.eu:wme.us,g=c.tools==="minimal"?"/minimal":c.tools==="code"?"/code":"/mcp",h=l("api_key_env","POSTMAN_API_KEY","API key",!0)||p("postman",`${m}${g}`)||l("api_key_env","POSTMAN_API_KEY","API key, or sign in");return await f(`${m}${g}`,`Bearer ${h}`,"Postman's MCP server")}case"browserstack_mcp":{let m=l("access_key_env","BROWSERSTACK_ACCESS_KEY","access key",!0)?"":p("browserstack",F7);if(m)return await f(F7,`Bearer ${m}`,"BrowserStack's MCP server");let g=l("username_env","BROWSERSTACK_USERNAME","user name");return await d("https://api.browserstack.com/automate/plan.json",{auth:Bl(g,l("access_key_env","BROWSERSTACK_ACCESS_KEY","access key"))}),{ok:!0,message:`Connected to BrowserStack as ${g}. Its MCP server starts with ForgeQE's agent.`}}case"sentry":{let m=LPn(c.url||"https://sentry.io","address"),g=l("token_env","SENTRY_ACCESS_TOKEN","auth token",!0)||new URL(m).host!=="sentry.io"?"":p("sentry",q7);if(g)return await f(q7,`Bearer ${g}`,"Sentry's MCP server");let{data:h}=await d(`${m}/api/0/organizations/`,{auth:`Bearer ${l("token_env","SENTRY_ACCESS_TOKEN","auth token")}`}),y=Array.isArray(h)?h.map((b)=>String(b?.slug||"")).filter(Boolean):[];if(c.organization&&!y.includes(String(c.organization)))return{ok:!1,message:`Sentry accepted the token, but it has no access to the organization ${String(c.organization)}.`};return{ok:!0,message:`Connected to Sentry${y.length?` (${y.length} organization${y.length===1?"":"s"})`:""}.`}}case"testmu_mcp":{let m=p("testmu",U7);if(!m)return{ok:!1,message:"Sign in to TestMu AI in the browser first (Sign in, above). Its MCP server takes no key."};return await f(U7,`Bearer ${m}`,"TestMu AI's MCP server")}case"azure":return{ok:!1,message:"Azure's MCP server signs in as this computer's Azure account (az login) when ForgeQE's agent starts it, so it cannot be tested from here. Ask ForgeQE's agent to use one of its tools."};case"dataverse":return{ok:!1,message:`Dataverse's MCP server signs in with the Dataverse CLI's saved profile when ForgeQE's agent starts it, so it cannot be tested from here. Sign in once with npx ${fk("@microsoft/dataverse",pN)} auth create --environment <address>, then ask ForgeQE's agent to use one of its tools.`};case"xray":{let m=t1(c.url||"https://xray.cloud.getxray.app","address");return await d(`${m}/api/v2/authenticate`,{auth:"",body:{client_id:l("client_id_env","XRAY_CLIENT_ID","client id"),client_secret:l("client_secret_env","XRAY_CLIENT_SECRET","client secret")}}),{ok:!0,message:"Connected to Xray."}}}if(e==="grid"){let m=RQ(c.remote),g=O1e(m,a,s);if(t==="browserstack"){let h=g("username_env","BROWSERSTACK_USERNAME","user name"),{data:y}=await d("https://api.browserstack.com/automate/plan.json",{auth:Bl(h,g("access_key_env","BROWSERSTACK_ACCESS_KEY","access key"))});return{ok:!0,message:`Connected to BrowserStack as ${h}${y?.automate_plan?`, plan ${y.automate_plan}`:""}${y?.parallel_sessions_max_allowed?` (${y.parallel_sessions_max_allowed} at once)`:""}.`}}if(t==="testmu"){let h=g("username_env","LT_USERNAME","user name");return await d("https://api.lambdatest.com/automation/api/v1/builds?limit=1",{auth:Bl(h,g("access_key_env","LT_ACCESS_KEY","access key"))}),{ok:!0,message:`Connected to TestMu AI as ${h}.`}}}if(e==="teams"){let m=RQ(c.teams),g=t1(O1e(m,a,s)("webhook_env","TEAMS_WEBHOOK_URL","webhook address"),"webhook address");return await(o.sendTeams||ZJe)(g,qPn("this Teams channel"),u),{ok:!0,message:"Sent a test message to the Teams channel. Check that it arrived."}}if(e==="email"){let m=RQ(c.email),g=O1e(m,a,s),h=String(m.host||s.SMTP_HOST||"").trim();if(!h)return{ok:!1,message:"Add the mail server first."};let y=Array.isArray(m.to)?m.to.map(String).filter(Boolean):[];if(!y.length)return{ok:!1,message:"Add who it goes to first."};let b=Number(m.port)||587,k=g("username_env","SMTP_USERNAME","user name",!0),_=g("password_env","SMTP_PASSWORD","password",!0),S={host:h,port:b,secure:b===465,usernameEnv:"FQ_WEB_TEST_SMTP_USER",passwordEnv:"FQ_WEB_TEST_SMTP_PASSWORD",...m.from?{from:String(m.from)}:{},to:y},E={u:process.env.FQ_WEB_TEST_SMTP_USER,p:process.env.FQ_WEB_TEST_SMTP_PASSWORD};try{if(k)process.env.FQ_WEB_TEST_SMTP_USER=k;if(_)process.env.FQ_WEB_TEST_SMTP_PASSWORD=_;await(o.sendEmail||eQe)(S,qPn("this email channel"))}finally{for(let[T,j]of[["FQ_WEB_TEST_SMTP_USER",E.u],["FQ_WEB_TEST_SMTP_PASSWORD",E.p]])if(j===void 0)delete process.env[T];else process.env[T]=j}return{ok:!0,message:`Sent a test email to ${y.join(", ")}. Check that it arrived.`}}if(e==="mcp"){if(c.command!==void 0)return{ok:!1,message:"A server started by a command runs inside ForgeQE's agent, so it cannot be tested from here. Ask ForgeQE's agent to use one of its tools."};let m=t1(c.url,"address"),g={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};for(let[y,b]of Object.entries(RQ(c.headers)))g[y]=String(b).replace(/\{env:([A-Za-z_][A-Za-z0-9_]*)\}/g,(k,_)=>a[_]??s[_]??"");let h=await u(m,{method:"POST",headers:g,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"forgeqe-settings",version:"1"}}}),signal:AbortSignal.timeout(20000)});if(await h.body?.cancel().catch(()=>{}),h.status===401||h.status===403)return{ok:!1,message:`The server refused the token (${h.status}).`};if(!h.ok)return{ok:!1,message:`The server answered ${h.status} ${h.statusText}.`};return{ok:!0,message:"The MCP server answered."}}return{ok:!1,message:"There is no test for this one."}}catch(m){let h=m.message||String(m);for(let y of Object.values(a))if(y.length>=4)h=h.split(y).join("[hidden]");return{ok:!1,message:h.length>400?`${h.slice(0,399)}\u2026`:h}}}var RQ=(e)=>e&&typeof e==="object"&&!Array.isArray(e)?e:{},WWs=(e)=>/\.atlassian\.net$/i.test(new URL(e).hostname),qPn=(e)=>({source:"ForgeQE",title:"Test message from ForgeQE",status:"good",subtitle:`Sent from Settings to check ${e}. Nothing to do.`,items:[{line:"If you can read this, ForgeQE can reach this channel.",status:"good"}]});var UPn=J(()=>{ps();ZB();x2();bme();KV();dl()});import{spawn as GWs}from"child_process";import{existsSync as hct,mkdirSync as VWs,readdirSync as KWs,readFileSync as zPn,realpathSync as HPn,statSync as WPn,writeFileSync as JWs}from"fs";import mct from"os";import n1 from"path";function zz(e){return GPn.some((t)=>hct(n1.join(e,t)))}function Tle(e){return GPn.map((t)=>n1.join(e,t)).find((t)=>hct(t))||n1.join(e,"forgeqe.yaml")}function P1e(e){let t=typeof e==="string"?e.trim().replace(/^~(?=$|[\\/])/,mct.homedir()):"";if(!t||!n1.isAbsolute(t))throw Error("Give the folder's full path, such as /Users/you/shop or C:\\work\\shop.");let n;try{n=HPn(t)}catch{throw Error(`There is no folder ${t}.`)}if(!WPn(n).isDirectory())throw Error(`${t} is a file, not a folder.`);return n}function N1e(){try{let e=JSON.parse(zPn(gct(),"utf8"));return Array.isArray(e.recent)?e.recent.filter((t)=>typeof t==="string"&&hct(t)).slice(0,VPn):[]}catch{return[]}}function I1e(e){try{VWs(Ht(),{recursive:!0});let t={};try{let n=JSON.parse(zPn(gct(),"utf8"));if(n&&typeof n==="object"&&!Array.isArray(n))t=n}catch{}JWs(gct(),`${JSON.stringify({...t,recent:[e,...N1e().filter((n)=>n!==e)].slice(0,VPn)},null,2)}
|
|
3580
|
-
`)}catch{}}function KPn(e){if(e)return n1.dirname(n1.resolve(e));let t=HPn(process.cwd());if(zz(t))return t;return N1e().find(zz)||t}function yct(e){let t=e===void 0||e===null||e===""?mct.homedir():P1e(e),n=[];try{n=KWs(t,{withFileTypes:!0}).filter((s)=>(s.isDirectory()||s.isSymbolicLink())&&!s.name.startsWith(".")&&s.name!=="node_modules"&&s.name!=="__pycache__").map((s)=>({name:s.name,path:n1.join(t,s.name)})).filter((s)=>{try{return WPn(s.path).isDirectory()}catch{return!1}}).sort((s,o)=>s.name.localeCompare(o.name,void 0,{sensitivity:"base"})).slice(0,QWs).map((s)=>({...s,project:zz(s.path)}))}catch(s){throw Error(`That folder cannot be read: ${s.message}`)}let r=n1.dirname(t);return{path:t,parent:r===t?null:r,home:mct.homedir(),project:zz(t),folders:n}}function JPn(e){return NM(e,{})}function M1e(e,t,n){let r=HS(e,t,n),s=(u)=>r.some((d)=>d.name.startsWith(u)&&d.ok),o=Object.entries(e?.profiles||{}),a=o.filter(([,u])=>!(u.provider==="github_copilot"?L_(u):Xr(u))),c=e?.activeProfile,l=!o.length?{ready:!1,detail:"No model yet."}:a.length?{ready:!0,detail:a.some(([u])=>u===c)?`${c} is ready.`:`${a.map(([u])=>u).join(", ")} ${a.length===1?"is":"are"} ready; the default (${c}) is not.`}:{ready:!1,detail:"No model has its key or sign-in yet."};return{version:Br(),checks:r,engine:s("Engine"),runtime:s("Agent runtime"),model:{...l,usable:a.map(([u])=>u),...c?{active:c}:{}}}}function QPn(){return j1e}function wct(e){if(j1e?.running)return j1e;let t={running:!0,lines:[],startedAt:new Date().toISOString()};j1e=t;let n=GWs(process.execPath,[sk,"setup"],{cwd:e,env:{...process.env,NO_COLOR:"1",FORCE_COLOR:"0"},stdio:["ignore","pipe","pipe"],shell:!1}),r=(s)=>{for(let o of s.toString("utf8").split(/\r?\n/)){let a=qi(o).replace(/\x1b\[[0-9;?]*[A-Za-z]|\x1b\][^\x07]*\x07/g,"").trimEnd();if(a)t.lines.push(a)}if(t.lines.length>BPn)t.lines.splice(0,t.lines.length-BPn)};return n.stdout.on("data",r),n.stderr.on("data",r),n.on("error",(s)=>{t.lines.push(`Could not start forgeqe setup: ${s.message}`),t.running=!1,t.ok=!1,t.endedAt=new Date().toISOString()}),n.on("close",(s)=>{t.running=!1,t.ok=s===0,t.endedAt=new Date().toISOString()}),t}var GPn,VPn=10,QWs=500,gct=()=>n1.join(Ht(),"web.json"),j1e=null,BPn=400;var YPn=J(()=>{Mg();RO();Sse();Wo();xo();Eo();bn();io();GPn=["forgeqe.yaml","webpilot.yaml"]});import{mkdirSync as YWs,readFileSync as XWs,renameSync as ZWs,writeFileSync as eGs}from"fs";import tGs from"path";function XPn(){try{let e=JSON.parse(XWs(bct(),"utf8"));return e&&typeof e==="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function ZPn(e,t){if(!Array.isArray(t))return[];return[...new Set(t.filter((n)=>typeof n==="string"&&nGs.test(n)))].slice(0,vct[e])}function kct(){let e=XPn().kept,t=e&&typeof e==="object"&&!Array.isArray(e)?e:{},n={};for(let r of Object.keys(vct))if(Array.isArray(t[r]))n[r]=ZPn(r,t[r]);return n}function eNn(e,t){if(typeof e!=="string"||!Object.hasOwn(vct,e))throw Object.assign(Error("Keep pins, recent pages or
|
|
3581
|
-
`),ZWs(s,bct()),r}var vct,nGs,bct=()=>tGs.join(Ht(),"web.json");var tNn=J(()=>{bn();vct={pins:8,recents:12,favourites:60},nGs=/^[a-z0-9][a-z0-9_/-]{0,79}(:[a-z][a-z0-9-]{0,79})?$/});import{existsSync as rGs,readdirSync as sGs,readFileSync as oGs,statSync as _ct}from"fs";import Rle from"path";function nNn(e,t,n=400){let r=aGs[t];if(!r)throw Error("kind is yaml or data");let s=[],o=(a,c)=>{if(c>5||s.length>=n)return;let l;try{l=sGs(a).sort()}catch{return}for(let u of l){if(s.length>=n)return;if(u.startsWith(".")||iGs.has(u))continue;let d=Rle.join(a,u),p;try{p=_ct(d)}catch{continue}if(p.isDirectory())o(d,c+1);else if(p.isFile()&&r.test(u)&&p.size<=52428800)s.push(Rle.relative(e,d).split(Rle.sep).join("/"))}};return o(e,0),s}function rNn(e,t){let n=typeof t.name==="string"?t.name:void 0;if(typeof t.file==="string"&&t.file){let r=Ka(t.file,e,"file");if(!/\.(ya?ml|json)$/i.test(r))throw Error("Pick a .yaml, .yml or .json file.");if(!rGs(r)||!_ct(r).isFile())throw Error(`No file ${t.file} in the project.`);if(_ct(r).size>zw)throw Error(`${t.file} is over ${zw/1024} KB.`);return{...K3(oGs(r,"utf8"),{name:n,base:e}),file:Rle.relative(e,r).split(Rle.sep).join("/")}}if(typeof t.text!=="string"||!t.text.trim())throw Error("Paste the YAML, or pick a file.");return K3(t.text,{name:n,base:e})}var iGs,aGs;var sNn=J(()=>{U_();Si();iGs=new Set(["node_modules","dist","build","bin","obj","out","target","venv","__pycache__","coverage","playwright-report","test-results"]),aGs={yaml:/\.(ya?ml|json)$/i,data:/\.(csv|tsv|json|ya?ml|xlsx|xls|xml|sql|txt)$/i}});import{randomBytes as iNn}from"crypto";import{existsSync as D1e,lstatSync as cGs,mkdirSync as aNn,readdirSync as lGs,readFileSync as uGs,renameSync as dGs,rmSync as pGs,writeFileSync as cNn}from"fs";import DL from"path";function fGs(e){return[...new Set(Rr.filter((t)=>e.includes(t.id)).flatMap((t)=>t.tools).filter((t)=>Ip(t).trustable===!0))]}function q1e(e,t){t.updatedAt=Sct(),aNn(Ect(e),{recursive:!0});let n=Act(e,t.sid);cNn(`${n}.tmp`,`${JSON.stringify(t,null,2)}
|
|
3580
|
+
`)}catch{}}function KPn(e){if(e)return n1.dirname(n1.resolve(e));let t=HPn(process.cwd());if(zz(t))return t;return N1e().find(zz)||t}function yct(e){let t=e===void 0||e===null||e===""?mct.homedir():P1e(e),n=[];try{n=KWs(t,{withFileTypes:!0}).filter((s)=>(s.isDirectory()||s.isSymbolicLink())&&!s.name.startsWith(".")&&s.name!=="node_modules"&&s.name!=="__pycache__").map((s)=>({name:s.name,path:n1.join(t,s.name)})).filter((s)=>{try{return WPn(s.path).isDirectory()}catch{return!1}}).sort((s,o)=>s.name.localeCompare(o.name,void 0,{sensitivity:"base"})).slice(0,QWs).map((s)=>({...s,project:zz(s.path)}))}catch(s){throw Error(`That folder cannot be read: ${s.message}`)}let r=n1.dirname(t);return{path:t,parent:r===t?null:r,home:mct.homedir(),project:zz(t),folders:n}}function JPn(e){return NM(e,{})}function M1e(e,t,n){let r=HS(e,t,n),s=(u)=>r.some((d)=>d.name.startsWith(u)&&d.ok),o=Object.entries(e?.profiles||{}),a=o.filter(([,u])=>!(u.provider==="github_copilot"?L_(u):Xr(u))),c=e?.activeProfile,l=!o.length?{ready:!1,detail:"No model yet."}:a.length?{ready:!0,detail:a.some(([u])=>u===c)?`${c} is ready.`:`${a.map(([u])=>u).join(", ")} ${a.length===1?"is":"are"} ready; the default (${c}) is not.`}:{ready:!1,detail:"No model has its key or sign-in yet."};return{version:Br(),checks:r,engine:s("Engine"),runtime:s("Agent runtime"),model:{...l,usable:a.map(([u])=>u),...c?{active:c}:{}}}}function QPn(){return j1e}function wct(e){if(j1e?.running)return j1e;let t={running:!0,lines:[],startedAt:new Date().toISOString()};j1e=t;let n=GWs(process.execPath,[sk,"setup"],{cwd:e,env:{...process.env,NO_COLOR:"1",FORCE_COLOR:"0"},stdio:["ignore","pipe","pipe"],shell:!1}),r=(s)=>{for(let o of s.toString("utf8").split(/\r?\n/)){let a=qi(o).replace(/\x1b\[[0-9;?]*[A-Za-z]|\x1b\][^\x07]*\x07/g,"").trimEnd();if(a)t.lines.push(a)}if(t.lines.length>BPn)t.lines.splice(0,t.lines.length-BPn)};return n.stdout.on("data",r),n.stderr.on("data",r),n.on("error",(s)=>{t.lines.push(`Could not start forgeqe setup: ${s.message}`),t.running=!1,t.ok=!1,t.endedAt=new Date().toISOString()}),n.on("close",(s)=>{t.running=!1,t.ok=s===0,t.endedAt=new Date().toISOString()}),t}var GPn,VPn=10,QWs=500,gct=()=>n1.join(Ht(),"web.json"),j1e=null,BPn=400;var YPn=J(()=>{Mg();RO();Sse();Wo();xo();Eo();bn();io();GPn=["forgeqe.yaml","webpilot.yaml"]});import{mkdirSync as YWs,readFileSync as XWs,renameSync as ZWs,writeFileSync as eGs}from"fs";import tGs from"path";function XPn(){try{let e=JSON.parse(XWs(bct(),"utf8"));return e&&typeof e==="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function ZPn(e,t){if(!Array.isArray(t))return[];return[...new Set(t.filter((n)=>typeof n==="string"&&nGs.test(n)))].slice(0,vct[e])}function kct(){let e=XPn().kept,t=e&&typeof e==="object"&&!Array.isArray(e)?e:{},n={};for(let r of Object.keys(vct))if(Array.isArray(t[r]))n[r]=ZPn(r,t[r]);return n}function eNn(e,t){if(typeof e!=="string"||!Object.hasOwn(vct,e))throw Object.assign(Error("Keep pins, recent pages, favourites or tabs only."),{status:400});if(!Array.isArray(t)||t.length>200)throw Object.assign(Error("A list of ids."),{status:400});let n=XPn(),r={...kct(),[e]:ZPn(e,t)};YWs(Ht(),{recursive:!0});let s=`${bct()}.${process.pid}.tmp`;return eGs(s,`${JSON.stringify({...n,kept:r},null,2)}
|
|
3581
|
+
`),ZWs(s,bct()),r}var vct,nGs,bct=()=>tGs.join(Ht(),"web.json");var tNn=J(()=>{bn();vct={pins:8,recents:12,favourites:60,tabs:60},nGs=/^[a-z0-9][a-z0-9_/-]{0,79}(:[a-z][a-z0-9-]{0,79})?$/});import{existsSync as rGs,readdirSync as sGs,readFileSync as oGs,statSync as _ct}from"fs";import Rle from"path";function nNn(e,t,n=400){let r=aGs[t];if(!r)throw Error("kind is yaml or data");let s=[],o=(a,c)=>{if(c>5||s.length>=n)return;let l;try{l=sGs(a).sort()}catch{return}for(let u of l){if(s.length>=n)return;if(u.startsWith(".")||iGs.has(u))continue;let d=Rle.join(a,u),p;try{p=_ct(d)}catch{continue}if(p.isDirectory())o(d,c+1);else if(p.isFile()&&r.test(u)&&p.size<=52428800)s.push(Rle.relative(e,d).split(Rle.sep).join("/"))}};return o(e,0),s}function rNn(e,t){let n=typeof t.name==="string"?t.name:void 0;if(typeof t.file==="string"&&t.file){let r=Ka(t.file,e,"file");if(!/\.(ya?ml|json)$/i.test(r))throw Error("Pick a .yaml, .yml or .json file.");if(!rGs(r)||!_ct(r).isFile())throw Error(`No file ${t.file} in the project.`);if(_ct(r).size>zw)throw Error(`${t.file} is over ${zw/1024} KB.`);return{...K3(oGs(r,"utf8"),{name:n,base:e}),file:Rle.relative(e,r).split(Rle.sep).join("/")}}if(typeof t.text!=="string"||!t.text.trim())throw Error("Paste the YAML, or pick a file.");return K3(t.text,{name:n,base:e})}var iGs,aGs;var sNn=J(()=>{U_();Si();iGs=new Set(["node_modules","dist","build","bin","obj","out","target","venv","__pycache__","coverage","playwright-report","test-results"]),aGs={yaml:/\.(ya?ml|json)$/i,data:/\.(csv|tsv|json|ya?ml|xlsx|xls|xml|sql|txt)$/i}});import{randomBytes as iNn}from"crypto";import{existsSync as D1e,lstatSync as cGs,mkdirSync as aNn,readdirSync as lGs,readFileSync as uGs,renameSync as dGs,rmSync as pGs,writeFileSync as cNn}from"fs";import DL from"path";function fGs(e){return[...new Set(Rr.filter((t)=>e.includes(t.id)).flatMap((t)=>t.tools).filter((t)=>Ip(t).trustable===!0))]}function q1e(e,t){t.updatedAt=Sct(),aNn(Ect(e),{recursive:!0});let n=Act(e,t.sid);cNn(`${n}.tmp`,`${JSON.stringify(t,null,2)}
|
|
3582
3582
|
`,{mode:384}),dGs(`${n}.tmp`,n)}function r1(e,t){let n=Act(e,t);if(!D1e(n)||!cGs(n).isFile())throw Object.assign(Error("No such agent being built."),{status:404});let r=JSON.parse(uGs(n,"utf8"));if(!r||r.sid!==t||typeof r.goal!=="string"||!Array.isArray(r.questions)||!Array.isArray(r.plan)||typeof r.reached!=="number")throw Object.assign(Error("This agent's draft cannot be read. Start again."),{status:400});return r}function uNn(e){let t=[];try{t=lGs(Ect(e)).filter((n)=>lNn.test(n.replace(/\.json$/,""))&&n.endsWith(".json"))}catch{}return t.flatMap((n)=>{try{let r=r1(e,n.replace(/\.json$/,""));return[{sid:r.sid,goal:r.goal.slice(0,200),step:CQ[Math.min(r.reached,CQ.length-1)],updatedAt:r.updatedAt,...r.saved?{saved:r.saved}:{}}]}catch{return[]}}).sort((n,r)=>r.updatedAt.localeCompare(n.updatedAt)).slice(0,20)}function dNn(e,t){pGs(Act(e,t),{force:!0})}function yGs(e,t,n){let r=n.environments,s=[],o=r.filter((h)=>L1e(t,h.name)),a=e.environments?.active,c=o[0]?.name||r.find((h)=>h.name===a&&!h.production)?.name||r.find((h)=>!h.production)?.name;if(r.length)s.push({id:"environment",text:"Which test environment should it work in?",why:"Every run, test and call it makes goes there, and only there.",kind:"many",options:r.map((h)=>({id:h.name,label:h.name,...h.production?{why:"Production: it reads there without asking; a person approves each run unless you say otherwise, and every change."}:{},...h.name===c?{recommended:!0,why:o.some((y)=>y.name===h.name)?`You named it.${h.production?" Every call there is approved by a person.":""}`:r.length===1?"Your only test environment.":"The one ForgeQE uses now."}:{}})),answer:c?[c]:[],...o.length===1||r.length===1?{assumed:o.length?`You named ${c}.`:`${c} is your only test environment.`}:{}});let l=[...new Set(r.flatMap((h)=>h.apps))];if(l.length>1){let h=l.find((y)=>L1e(t,y));s.push({id:"app",text:"Which app is it about?",why:"So it starts at the right place and its checks are about the right screens.",kind:"many",options:l.map((y)=>({id:y,label:y,...y===h?{recommended:!0,why:"You named it."}:{}})),answer:h?[h]:[],...h?{assumed:`You named ${h}.`}:{}})}if(n.systems.length){let h=n.systems.filter((y)=>bGs(y).some((b)=>L1e(t,b)));s.push({id:"systems",text:"Which of your systems should it work with?",why:"It reads them, and changes them only as you allow (a person approves each change unless you say otherwise).",kind:"many",options:n.systems.map((y)=>({id:y.name,label:y.label.replace(/\s+MCP\s*$/i,""),why:y.about.slice(0,160),...h.includes(y)?{recommended:!0}:{}})),answer:h.map((y)=>y.name),...h.length?{assumed:`It works with ${h.map((y)=>y.label.replace(/\s+MCP\s*$/i,"")).join(" and ")}, as you said.`}:{}})}let u=xct.find((h)=>h.cue.test(t));s.push({id:"schedule",text:"Should it run by itself?",why:"On a schedule it runs with nobody watching: it does alone only what you allow, and waits for a person for the rest.",kind:"one",options:xct.map((h)=>({id:h.id,label:h.label,...h.id===(u?.id||"ask")?{recommended:!0,...u?{why:"You said when."}:{}}:{}})),answer:[u?.id||"ask"],...u?{assumed:`It runs ${u.label.toLowerCase()}, as you said.`}:{}});let d=Cle.filter((h)=>h.cue?.test(t)).map((h)=>h.id);s.push({id:"outcome",text:"When it finds something wrong, what should it do?",why:"This decides what it may do beyond reading and running: writing a report, or changing something in another system.",kind:"many",options:Cle.map((h)=>({id:h.id,label:h.label,why:h.why,...h.id==="tell"||d.includes(h.id)?{recommended:!0}:{}})),answer:[...new Set(["tell",...d])]});let p=s.filter((h)=>!h.assumed),f=s.filter((h)=>h.assumed).map((h)=>h.assumed),m=t.replace(/^\s*(i want |i need |make |create |build )?(an? )?(agent )?(that |which |to )?/i,"").replace(/(?<![.\s])[.\s]+$/,""),g=[`You want an agent that will ${m.charAt(0).toLowerCase()}${m.slice(1)}.`,f.length?`${f.join(" ")}`:"",p.length?`Let's understand your requirements more clearly: ${p.length===1?"one thing":`${p.length} things`} I could not work out from that.`:"I could work out everything from that. Check it, then go on."].filter(Boolean).join(" ");return{questions:s,says:g}}function bGs(e){let t=[e.name.replace(/_/g," "),e.label.replace(/\s+MCP\s*$/i,"")];if(/azure|ado/i.test(e.name+e.label))t.push("ado","azure devops","devops","work item");if(/jira/i.test(e.name+e.label))t.push("jira","issue");if(/github/i.test(e.name+e.label))t.push("github","pull request");return t.map((n)=>n.toLowerCase())}function vGs(e,t,n){let r=[t.goal,...gv(t,"app")].join(" "),s=[..._Fe(r,e)].filter(([f])=>!dC.includes(f)).sort((f,m)=>m[1].score-f[1].score),o=new Map(n.capabilities.map((f)=>[f.id,f])),a=new Map,c=(f)=>{let m=o.get(f);return m.asks.length>0&&m.asks.length===new Set(m.tools).size};for(let[f,m]of s)if(o.has(f)&&a.size<4&&m.score>=(c(f)?5:2))a.set(f,`You said ${m.why.slice(0,3).join(", ")}.`);for(let f of wGs)if(f.cue.test(r)){for(let m of f.capabilities)if(o.has(m)&&!a.has(m))a.set(m,f.why)}for(let f of Cle)if(f.capability&&gv(t,"outcome").includes(f.id)&&o.has(f.capability))a.set(f.capability,`You want it to ${f.label.toLowerCase()}.`);if(![...a.keys()].some((f)=>f!=="reports"&&f!=="systems"&&f!=="notifications")&&o.has("browser-goals"))a.set("browser-goals","Most jobs start with the app in a real browser: it does what a user does and checks the outcome.");let l=n.capabilities.map((f)=>({capability:f.id,title:f.title,summary:f.summary,why:a.get(f.id)||"",state:f.state,gaps:f.gaps,agents:[...f.starts,...f.mayStart],actions:f.actions,on:a.has(f.id),suggested:a.has(f.id)}));for(let f of n.systems)l.push({capability:`system:${f.name}`,title:`Work with ${f.label.replace(/\s+MCP\s*$/i,"")}`,summary:f.about,why:gv(t,"systems").includes(f.name)?"You chose it.":"",state:"ready",gaps:[],agents:[],actions:["read","external"],on:gv(t,"systems").includes(f.name),suggested:gv(t,"systems").includes(f.name)});let u=l.filter((f)=>f.on),d=u.filter((f)=>f.state==="needs_setup"),p=[`It will ${u.map((f)=>f.title.charAt(0).toLowerCase()+f.title.slice(1)).join("; then ")}.`,d.length?`${d.map((f)=>f.title).join(" and ")} ${d.length===1?"is":"are"} not set up on this computer yet; it will work once ${d.length===1?"it is":"they are"}.`:"Everything it needs is ready here.","Turn off what it should not do, or add what is missing."].join(" ");return{plan:l,says:p}}function oNn(e){let t=e.boundaries?.trust||[],n=e.plan.filter((r)=>r.on&&!r.capability.startsWith("system:")).map((r)=>r.capability);return[...t.includes("external")?["external"]:[],...t.includes("coding")&&e.boundaries?.repository==="write"?fGs(n):[]]}function kGs(e){let t=e.plan.filter((c)=>c.on),n=gv(e,"outcome"),r={run:t.some((c)=>c.actions.includes("run")),change:t.some((c)=>c.actions.includes("change")&&!c.actions.includes("run")&&!c.actions.includes("read")),external:Cle.some((c)=>c.action==="external"&&n.includes(c.id))||t.some((c)=>c.capability.startsWith("system:")),repository:t.some((c)=>c.capability==="write-tests"||c.capability==="heal-tests")},s=["read",...r.run?["run"]:[],...r.change||r.repository?["change"]:[],...r.external?["external"]:[]],o={environments:gv(e,"environment"),actions:s,approve:r.run?["run","external"]:["external"],repository:r.repository?"write":"read",shell:!1,unattended:qT(e)&&r.run?["run"]:[],trust:[],production:[]},a=[`It will work only in ${o.environments.join(" and ")||"no environment yet"}${r.run?", where it reads and runs":", where it only reads"}.`,r.run?"While it is new, it asks you before each run; you can turn that off once you trust it.":"",r.external?"It changes another system only as you asked, and asks you before each change unless you turn that off.":"It changes nothing in other systems.",o.environments.some((c)=>/prod|live/i.test(c))?"In production, it reads without asking, asks you before each run unless you turn that off, and a person approves every change there.":"",qT(e)?`It runs ${qT(e).label.toLowerCase()}, with nobody watching: alone it ${r.run?"runs tests and apps":"only reads"}; anything else waits for a person, and the team is told.`:"",r.repository?"It may change your repository to write or heal tests: a coding agent does it, and asks you each time unless you turn that off.":"It never changes your repository."].filter(Boolean).join(" ");return{boundaries:o,needs:r,says:a}}function _Gs(e,t,n){let r=new Set($ct([t.goal,...gv(t,"app")].join(" ")).filter((u)=>!pNn.has(u))),s=(u)=>[...new Set($ct(u))].filter((d)=>r.has(d)),o=Di(e.knowledge?.dir).filter((u)=>!u.rel.startsWith("agents/")).map((u)=>{let d=s(`${u.title} ${u.rel} ${u.text.slice(0,4000)}`);return{file:u.rel,title:u.title,why:d.length?`It is about ${d.slice(0,3).join(", ")}.`:"",on:d.length>=2||d.length===1&&s(`${u.title} ${u.rel}`).length===1}}),a=n.skills.map((u)=>{let d=s(`${u.name.replace(/-/g," ")} ${u.about}`);return{name:u.name,about:u.about,why:d.length?`It is about ${d.slice(0,3).join(", ")}.`:"",on:d.length>=2}}),c=o.filter((u)=>u.on).length+a.filter((u)=>u.on).length,l=c?`I found ${c} ${c===1?"thing":"things"} in this project it should know. Anything else it should know, like business rules or test data, add as notes: they become its own knowledge.`:"I found nothing in this project's knowledge about this yet. Add what it should know as notes, like business rules, test accounts' roles or what \u201Cdone\u201D looks like: they become its own knowledge.";return{knowledge:{files:o,skills:a,notes:""},says:l}}function $Gs(e,t){let n=$ct(e).find((s)=>!pNn.has(s)&&s.length>3)||"team",r=SGs[t||""]||"assistant";return`${n.charAt(0).toUpperCase()}${n.slice(1)} ${r} agent`.replace(/\s+/g," ")}function mNn(e,t){let n=(r)=>D1e(DL.join(Os(e),`${r}.yaml`))||D1e(DL.join(Os(e),`${r}.yml`))||D1e(DL.join(Os(e),".releases",r));if(!n(t))return t;for(let r=2;r<100;r++){let s=`${t.slice(0,37)}-${r}`;if(!n(s))return s}return`${t.slice(0,31)}-${iNn(4).toString("hex")}`}function xGs(e,t,n){let r=t.plan.find((u)=>u.on),s=n.capabilities.find((u)=>u.id===r?.capability)?.area,o=$Gs(t.goal,s),a=t.goal.trim().replace(/\s+/g," "),c=[a.endsWith(".")?a:`${a}.`,gv(t,"app").length?`It is about ${gv(t,"app").join(" and ")}.`:"",...Cle.filter((u)=>gv(t,"outcome").includes(u.id)).map((u)=>u.line),...t.questions.filter((u)=>u.id.startsWith("extra")&&u.answer.length).map((u)=>`${u.text} ${u.options.filter((d)=>u.answer.includes(d.id)).map((d)=>d.label).join(", ")}.`),...(t.planSteps||[]).map((u,d)=>`${d+1}. ${u.title}`)].filter(Boolean);return{review:{name:o,id:mNn(e,fNn(o)),description:(a.split(/(?<=[.!?])\s/)[0]||a).slice(0,300),instructions:c.join(`
|
|
3583
3583
|
`).slice(0,8000),starters:[{label:"Run it now",text:a.slice(0,500)}]},says:`I've called it the ${o}. Change its name or first request if you like, then save it as a draft: it does not run until you have tried and approved it.`}}function gNn(e,t){let n=e.plan.filter((o)=>o.on),r=[...new Set(n.flatMap((o)=>o.agents))].filter((o)=>t.agents.some((a)=>a.name===o)),s=e.review;return{id:s?.id||"",name:s?.name||"",version:"1.0.0",...s?.icon&&z2(s.icon)?{icon:s.icon}:{},description:s?.description||e.goal.slice(0,300),instructions:s?.instructions||"",scope:{agents:r,capabilities:n.filter((o)=>!o.capability.startsWith("system:")).map((o)=>o.capability),systems:n.filter((o)=>o.capability.startsWith("system:")).map((o)=>o.capability.slice(7)),skills:e.knowledge?.skills.filter((o)=>o.on).map((o)=>o.name)||[],knowledge:[...e.knowledge?.files.filter((o)=>o.on).map((o)=>o.file)||[],...e.knowledge?.notes.trim()&&s?.id?[hNn(s.id)]:[]],environments:e.boundaries?.environments||gv(e,"environment")},permissions:{repository:e.boundaries?.repository||"read",actions:e.boundaries?.actions||["read"],approve:(e.boundaries?.approve||[]).filter((o)=>o!=="external"),shell:e.boundaries?.shell===!0,unattended:(e.boundaries?.unattended||[]).flatMap((o)=>o==="coding"?oNn(e).filter((a)=>a!=="external"):[o]),trust:oNn(e),production:e.boundaries?.production||[]},...qT(e)?{schedule:{...qT(e).every?{every:qT(e).every}:{},...qT(e).cron?{cron:qT(e).cron}:{},request:(s?.starters[0]?.text||e.goal).slice(0,500).replace(/^-+/,"")}}:{},runtime:{maxDelegationDepth:1,...s?.model?{model:s.model}:{},...s?.maxTokens?{maxTokens:s.maxTokens}:{},...s?.maxMinutes?{maxMinutes:s.maxMinutes}:{}},policies:[],starters:s?.starters||[]}}function Wz(e,t,n,r=LA(e,t)){let s=gNn(n,r),o=n.reached>=CQ.indexOf("review")?GB(e,t,s):{problems:[],advice:n.reached>=1?MYe(e,t,s,r):[]};return{...n,steps:CQ.map((a,c)=>({id:a,done:c<n.reached})),advice:o.advice,problems:o.problems.filter((a)=>!/notes|agents\//.test(a)),environments:r.environments.map((a)=>a.name),production:r.environments.filter((a)=>a.production).map((a)=>a.name),schedule:qT(n)?.label,models:(r.models||[]).map((a)=>({name:a.name,model:a.model}))}}function yNn(e,t,n){if(typeof n!=="string"||!n.trim())throw Object.assign(Error("Say what the agent should do."),{status:400});let r=n.trim().replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g,"").slice(0,mGs),s=LA(e,t),o=yGs(e,r,s),a={sid:iNn(8).toString("hex"),goal:r,createdAt:Sct(),updatedAt:Sct(),reached:0,says:{understand:o.says},questions:o.questions,plan:[]};return q1e(e,a),Wz(e,t,a,s)}function wNn(e,t,n,r,s){let o=r1(e,n),a=CQ.indexOf(r);if(a<0||a>o.reached)throw Object.assign(Error("That step is not open yet."),{status:400});if(o.saved&&a<CQ.indexOf("review"))throw Object.assign(Error(`It is saved as ${o.saved}. Change it on its page.`),{status:409});if(o.working)throw Object.assign(Error("ForgeQE is still working this out. A moment."),{status:409});let c=LA(e,t);if(r==="understand"){let l=s.answers&&typeof s.answers==="object"?s.answers:{};for(let d of o.questions){let p=LT(l[d.id]).filter((f)=>d.options.some((m)=>m.id===f));if(d.answer=d.kind==="one"?p.slice(0,1):p,d.id==="environment"&&!d.answer.length)throw Object.assign(Error("Pick at least one environment."),{status:400})}let u=vGs(e,o,c);Object.assign(o,{plan:u.plan,says:{...o.says,plan:u.says}})}else if(r==="plan"){let l=new Set(LT(s.capabilities).filter((d)=>o.plan.some((p)=>p.capability===d)));if(!l.size)throw Object.assign(Error("Keep at least one thing it does."),{status:400});for(let d of o.plan)d.on=l.has(d.capability);let u=kGs(o);Object.assign(o,{boundaries:u.boundaries,needs:u.needs,says:{...o.says,boundaries:u.says}})}else if(r==="boundaries"){let l=o.boundaries,u=LT(s.environments).filter((k)=>c.environments.some((_)=>_.name===k));if(!u.length)throw Object.assign(Error("Pick at least one environment."),{status:400});let d=new Set(["read",...o.needs?.run?["run"]:[],"change",...o.needs?.external?["external"]:[]]),p=[...new Set(["read",...LT(s.actions).filter((k)=>d.has(k))])],f=LT(s.approve).filter((k)=>p.includes(k)&&k!=="read"),m=o.plan.filter((k)=>k.on&&k.capability.startsWith("system:")).map((k)=>k.capability.slice(7)),g=s.repository==="write"&&p.includes("change")?"write":"read",h=LT(s.trust).filter((k)=>k==="external"&&p.includes("external")||k==="coding"&&g==="write"),y=qT(o)?LT(s.unattended).filter((k)=>k!=="read"&&p.includes(k)||m.some((_)=>k===`${_}_*`)||k==="coding"&&h.includes("coding")):[],b=u.some((k)=>c.environments.some((_)=>_.name===k&&_.production))&&p.includes("run")&<(s.production).includes("run")?["run"]:[];if(o.boundaries={environments:u,actions:p,approve:[...new Set([...f,...h.includes("external")?[]:["external"]])],repository:g,shell:s.shell===!0,unattended:y,trust:h,production:b},l){let k=_Gs(e,o,c);Object.assign(o,{knowledge:k.knowledge,says:{...o.says,knowledge:k.says}})}}else if(r==="knowledge"){let l=o.knowledge,u=new Set(LT(s.files)),d=new Set(LT(s.skills));for(let p of l.files)p.on=u.has(p.file);for(let p of l.skills)p.on=d.has(p.name);if(l.notes=Hz(s.notes,gGs),!o.saved){let p=xGs(e,o,c);Object.assign(o,{review:p.review,says:{...o.says,review:p.says}})}}else if(r==="review"){let l=o.review,u=Array.isArray(s.starters)?s.starters.filter((k)=>!!k&&typeof k==="object").slice(0,6).map((k)=>({label:Hz(k.label,40).trim(),text:Hz(k.text,500).trim()})).filter((k)=>k.label&&k.text):l.starters,d=z2(s.icon)?s.icon:s.icon===void 0&&z2(l.icon)?l.icon:void 0,p=typeof s.model==="string"&&(c.models||[]).some((k)=>k.name===s.model)?s.model:void 0,f=(k,_,S)=>typeof k==="number"&&Number.isInteger(k)&&k>=_&&k<=S?k:void 0,m=f(s.maxTokens,1000,1e8),g=f(s.maxMinutes,1,1440);if(o.review={name:Hz(s.name,60).trim()||l.name,id:o.saved||Hz(s.id,40).trim()||l.id,description:Hz(s.description,300).trim()||l.description,instructions:Hz(s.instructions,8000).trim()||l.instructions,...d?{icon:d}:{},starters:u,...p?{model:p}:{},...m?{maxTokens:m}:{},...g?{maxMinutes:g}:{}},!/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(o.review.id)||o.review.id.length>40)throw Object.assign(Error("Its id must be lower-case letters, digits and single hyphens, starting with a letter."),{status:400});let h=gNn(o,c),y=o.knowledge?.notes.trim();if(y)EGs(e,o.review.id,o.review.name,y);let b=m0(e,t,h,o.saved?{id:o.saved}:{create:!0});o.saved=b.id,o.says={...o.says,try:`The ${o.review.name} is saved as a draft. Try it on a real request: it may only read and run in ${o.boundaries?.environments.join(" and ")}, and asks you before each run. When it does what you want, approve it, and it is ready for you, your team and Atlas.`}}if(r!=="try")o.reached=a+1;return q1e(e,o),Wz(e,t,o,c)}function EGs(e,t,n,r){let s=e.knowledge?.dir;if(!s)return;let o=DL.join(s,hNn(t));if(DL.relative(s,o).startsWith(".."))return;aNn(DL.dirname(o),{recursive:!0}),cNn(o,`# ${n}: what it should know
|
|
3584
3584
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";import{AmbientLight as n,ArrayCamera as r,Box3 as i,BoxGeometry as a,BufferAttribute as o,BufferGeometry as s,ByteType as c,ClampToEdgeWrapping as l,Color as u,ColorManagement as d,Compatibility as f,ConeGeometry as p,Controls as m,CubeCamera as h,CubeDepthTexture as g,CubeTexture as _,CubicBezierCurve3 as v,CylinderGeometry as y,DataArrayTexture as b,DataTexture as x,DecrementStencilOp as S,DecrementWrapStencilOp as C,DepthFormat as ee,DepthStencilFormat as te,DepthTexture as w,DirectionalLight as ne,DynamicDrawUsage as re,EllipseCurve as ie,EventDispatcher as ae,Float16BufferAttribute as oe,Float32BufferAttribute as se,FloatType as ce,FramebufferTexture as le,Frustum as ue,FrustumArray as de,GridHelper as fe,Group as pe,HalfFloatType as me,HemisphereLight as he,IncrementStencilOp as ge,IncrementWrapStencilOp as _e,InstancedBufferAttribute as ve,InstancedInterleavedBuffer as ye,IntType as be,InterleavedBuffer as xe,InterleavedBufferAttribute as Se,InvertStencilOp as Ce,KeepStencilOp as we,LightProbe as Te,Line as Ee,LineBasicMaterial as De,LineDashedMaterial as Oe,LinearFilter as ke,LinearMipmapLinearFilter as Ae,LinearMipmapNearestFilter as je,LinearSRGBColorSpace as Me,LinearTransfer as Ne,MOUSE as Pe,Material as Fe,MathUtils as Ie,Matrix2 as Le,Matrix3 as Re,Matrix4 as ze,Mesh as Be,MeshBasicMaterial as Ve,MeshLambertMaterial as He,MeshMatcapMaterial as Ue,MeshNormalMaterial as We,MeshPhongMaterial as Ge,MeshPhysicalMaterial as Ke,MeshStandardMaterial as qe,MeshToonMaterial as Je,MirroredRepeatWrapping as Ye,NearestFilter as Xe,NearestMipmapLinearFilter as Ze,NearestMipmapNearestFilter as Qe,OrthographicCamera as $e,PerspectiveCamera as et,Plane as tt,PlaneGeometry as nt,PointLight as rt,PointsMaterial as it,QuadraticBezierCurve3 as at,Quaternion as ot,R11_EAC_Format as st,RED_GREEN_RGTC2_Format as ct,RED_RGTC1_Format as lt,RG11_EAC_Format as ut,RGBAFormat as dt,RGBAIntegerFormat as ft,RGBA_ASTC_10x10_Format as pt,RGBA_ASTC_10x5_Format as mt,RGBA_ASTC_10x6_Format as ht,RGBA_ASTC_10x8_Format as gt,RGBA_ASTC_12x10_Format as _t,RGBA_ASTC_12x12_Format as vt,RGBA_ASTC_4x4_Format as yt,RGBA_ASTC_5x4_Format as bt,RGBA_ASTC_5x5_Format as xt,RGBA_ASTC_6x5_Format as St,RGBA_ASTC_6x6_Format as Ct,RGBA_ASTC_8x5_Format as wt,RGBA_ASTC_8x6_Format as Tt,RGBA_ASTC_8x8_Format as Et,RGBA_BPTC_Format as Dt,RGBA_ETC2_EAC_Format as Ot,RGBA_S3TC_DXT1_Format as kt,RGBA_S3TC_DXT3_Format as At,RGBA_S3TC_DXT5_Format as jt,RGBFormat as Mt,RGBIntegerFormat as Nt,RGB_BPTC_SIGNED_Format as Pt,RGB_BPTC_UNSIGNED_Format as Ft,RGB_ETC1_Format as It,RGB_ETC2_Format as Lt,RGB_S3TC_DXT1_Format as Rt,RGFormat as zt,RGIntegerFormat as Bt,Ray as Vt,Raycaster as Ht,RectAreaLight as Ut,RedFormat as Wt,RedIntegerFormat as Gt,RenderObjectRefreshType as Kt,RenderTarget as qt,RepeatWrapping as Jt,ReplaceStencilOp as Yt,SIGNED_R11_EAC_Format as Xt,SIGNED_RED_GREEN_RGTC2_Format as Zt,SIGNED_RED_RGTC1_Format as Qt,SIGNED_RG11_EAC_Format as $t,SRGBColorSpace as en,Scene as tn,ShaderMaterial as nn,ShadowMaterial as rn,ShortType as an,Sphere as on,SphereGeometry as sn,Spherical as cn,SpotLight as ln,SpriteMaterial as un,StaticDrawUsage as dn,TOUCH as fn,Texture as pn,TextureLoader as mn,Timer as hn,TimestampQuery as gn,TubeGeometry as _n,Uint16BufferAttribute as vn,Uint32BufferAttribute as yn,UniformsUtils as bn,UnsignedByteType as xn,UnsignedInt101111Type as Sn,UnsignedInt248Type as Cn,UnsignedInt5999Type as wn,UnsignedIntType as Tn,UnsignedShortType as En,Vector2 as T,Vector3 as E,Vector4 as Dn,WebGLCoordinateSystem as On,WebGLRenderTarget as kn,WebGLRenderer as An,WebGPUCoordinateSystem as jn,WebXRController as Mn,a as Nn,createCanvasElement as Pn,error as D,i as Fn,log as In,n as Ln,r as Rn,t as zn,warn as O,warnOnce as Bn}from"./three.module-D480w7q4.js";import{g as Vn,h as Hn,m as Un}from"./RelationGraph-BQl3M4zd.js";import{a as Wn,i as Gn,n as Kn,o as qn,r as Jn,s as Yn}from"./Product-0LXndvp-.js";var Xn=new tt,Zn=new T,Qn=new E,$n=new T,er=new T,tr=new E,nr=new E,rr=new ze,ir=new E,ar=new E,or=null,sr=null,cr=[],lr={NONE:-1,PAN:0,ROTATE:1},ur=class extends m{constructor(e,t,n=null){super(t,n),this.objects=e,this.recursive=!0,this.transformGroup=!1,this.rotateSpeed=1,this.raycaster=new Ht,this.mouseButtons={LEFT:Pe.PAN,MIDDLE:Pe.PAN,RIGHT:Pe.ROTATE},this.touches={ONE:fn.PAN},this._onPointerMove=dr.bind(this),this._onPointerDown=fr.bind(this),this._onPointerCancel=pr.bind(this),this._onContextMenu=mr.bind(this),n!==null&&this.connect(n)}connect(e){super.connect(e),this.domElement.addEventListener(`pointermove`,this._onPointerMove),this.domElement.addEventListener(`pointerdown`,this._onPointerDown),this.domElement.addEventListener(`pointerup`,this._onPointerCancel),this.domElement.addEventListener(`pointerleave`,this._onPointerCancel),this.domElement.addEventListener(`contextmenu`,this._onContextMenu),this.domElement.style.touchAction=`none`}disconnect(){this.domElement.removeEventListener(`pointermove`,this._onPointerMove),this.domElement.removeEventListener(`pointerdown`,this._onPointerDown),this.domElement.removeEventListener(`pointerup`,this._onPointerCancel),this.domElement.removeEventListener(`pointerleave`,this._onPointerCancel),this.domElement.removeEventListener(`contextmenu`,this._onContextMenu),this.domElement.style.touchAction=``,this.domElement.style.cursor=``}dispose(){this.disconnect()}_updatePointer(e){let t=this.domElement.getBoundingClientRect();Zn.x=(e.clientX-t.left)/t.width*2-1,Zn.y=-(e.clientY-t.top)/t.height*2+1}_updateState(e){let t;if(e.pointerType===`touch`)t=this.touches.ONE;else switch(e.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=null}switch(t){case Pe.PAN:case fn.PAN:this.state=lr.PAN;break;case Pe.ROTATE:case fn.ROTATE:this.state=lr.ROTATE;break;default:this.state=lr.NONE}}};function dr(e){let t=this.object,n=this.domElement,r=this.raycaster;if(this.enabled!==!1){if(this._updatePointer(e),r.setFromCamera(Zn,t),or)this.state===lr.PAN?r.ray.intersectPlane(Xn,tr)&&(or.position.copy(tr.sub(Qn).applyMatrix4(rr)),this.dispatchEvent({type:`drag`,object:or})):this.state===lr.ROTATE&&($n.subVectors(Zn,er).multiplyScalar(this.rotateSpeed),or.rotateOnWorldAxis(ir,$n.x),or.rotateOnWorldAxis(ar.normalize(),-$n.y),this.dispatchEvent({type:`drag`,object:or})),er.copy(Zn);else if(e.pointerType===`mouse`||e.pointerType===`pen`){if(cr.length=0,r.setFromCamera(Zn,t),r.intersectObjects(this.objects,this.recursive,cr),cr.length>0){let e=cr[0].object;Xn.setFromNormalAndCoplanarPoint(t.getWorldDirection(Xn.normal),nr.setFromMatrixPosition(e.matrixWorld)),sr!==e&&sr!==null&&(this.dispatchEvent({type:`hoveroff`,object:sr}),n.style.cursor=`auto`,sr=null),sr!==e&&(this.dispatchEvent({type:`hoveron`,object:e}),n.style.cursor=`pointer`,sr=e)}else sr!==null&&(this.dispatchEvent({type:`hoveroff`,object:sr}),n.style.cursor=`auto`,sr=null)}er.copy(Zn)}}function fr(e){let t=this.object,n=this.domElement,r=this.raycaster;this.enabled!==!1&&(this._updatePointer(e),this._updateState(e),cr.length=0,r.setFromCamera(Zn,t),r.intersectObjects(this.objects,this.recursive,cr),cr.length>0&&(or=this.transformGroup===!0?hr(cr[0].object):cr[0].object,Xn.setFromNormalAndCoplanarPoint(t.getWorldDirection(Xn.normal),nr.setFromMatrixPosition(or.matrixWorld)),r.ray.intersectPlane(Xn,tr)&&(this.state===lr.PAN?(rr.copy(or.parent.matrixWorld).invert(),Qn.copy(tr).sub(nr.setFromMatrixPosition(or.matrixWorld)),n.style.cursor=`move`,this.dispatchEvent({type:`dragstart`,object:or})):this.state===lr.ROTATE&&(ir.set(0,1,0).applyQuaternion(t.quaternion).normalize(),ar.set(1,0,0).applyQuaternion(t.quaternion).normalize(),n.style.cursor=`move`,this.dispatchEvent({type:`dragstart`,object:or})))),er.copy(Zn))}function pr(){this.enabled!==!1&&(or&&=(this.dispatchEvent({type:`dragend`,object:or}),null),this.domElement.style.cursor=sr?`pointer`:`auto`,this.state=lr.NONE)}function mr(e){this.enabled!==!1&&e.preventDefault()}function hr(e,t=null){return e.isGroup&&(t=e),e.parent===null?t:hr(e.parent,t)}function gr(e,t,n){var r,i=1;e??=0,t??=0,n??=0;function a(){var a,o=r.length,s,c=0,l=0,u=0;for(a=0;a<o;++a)s=r[a],c+=s.x||0,l+=s.y||0,u+=s.z||0;for(c=(c/o-e)*i,l=(l/o-t)*i,u=(u/o-n)*i,a=0;a<o;++a)s=r[a],c&&(s.x-=c),l&&(s.y-=l),u&&(s.z-=u)}return a.initialize=function(e){r=e},a.x=function(t){return arguments.length?(e=+t,a):e},a.y=function(e){return arguments.length?(t=+e,a):t},a.z=function(e){return arguments.length?(n=+e,a):n},a.strength=function(e){return arguments.length?(i=+e,a):i},a}function _r(e){let t=+this._x.call(null,e);return vr(this.cover(t),t,e)}function vr(e,t,n){if(isNaN(t))return e;var r,i=e._root,a={data:n},o=e._x0,s=e._x1,c,l,u,d,f;if(!i)return e._root=a,e;for(;i.length;)if((u=t>=(c=(o+s)/2))?o=c:s=c,r=i,!(i=i[d=+u]))return r[d]=a,e;if(l=+e._x.call(null,i.data),t===l)return a.next=i,r?r[d]=a:e._root=a,e;do r=r?r[d]=[,,]:e._root=[,,],(u=t>=(c=(o+s)/2))?o=c:s=c;while((d=+u)==(f=+(l>=c)));return r[f]=i,r[d]=a,e}function yr(e){Array.isArray(e)||(e=Array.from(e));let t=e.length,n=new Float64Array(t),r=1/0,i=-1/0;for(let a=0,o;a<t;++a)isNaN(o=+this._x.call(null,e[a]))||(n[a]=o,o<r&&(r=o),o>i&&(i=o));if(r>i)return this;this.cover(r).cover(i);for(let r=0;r<t;++r)vr(this,n[r],e[r]);return this}function br(e){if(isNaN(e=+e))return this;var t=this._x0,n=this._x1;if(isNaN(t))n=(t=Math.floor(e))+1;else{for(var r=n-t||1,i=this._root,a,o;t>e||e>=n;)switch(o=+(e<t),a=[,,],a[o]=i,i=a,r*=2,o){case 0:n=t+r;break;case 1:t=n-r}this._root&&this._root.length&&(this._root=i)}return this._x0=t,this._x1=n,this}function xr(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Sr(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function Cr(e,t,n){this.node=e,this.x0=t,this.x1=n}function wr(e,t){var n,r=this._x0,i,a,o=this._x1,s=[],c=this._root,l,u;for(c&&s.push(new Cr(c,r,o)),t==null?t=1/0:(r=e-t,o=e+t);l=s.pop();)if(!(!(c=l.node)||(i=l.x0)>o||(a=l.x1)<r)){if(c.length){var d=(i+a)/2;s.push(new Cr(c[1],d,a),new Cr(c[0],i,d)),(u=+(e>=d))&&(l=s[s.length-1],s[s.length-1]=s[s.length-1-u],s[s.length-1-u]=l)}else{var f=Math.abs(e-+this._x.call(null,c.data));f<t&&(t=f,r=e-f,o=e+f,n=c.data)}}return n}function Tr(e){if(isNaN(c=+this._x.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._x1,c,l,u,d,f;if(!n)return this;if(n.length)for(;;){if((u=c>=(l=(o+s)/2))?o=l:s=l,t=n,!(n=n[d=+u]))return this;if(!n.length)break;t[d+1&1]&&(r=t,f=d)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[d]=a:delete t[d],(n=t[0]||t[1])&&n===(t[1]||t[0])&&!n.length&&(r?r[f]=n:this._root=n),this):(this._root=a,this)}function Er(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function Dr(){return this._root}function Or(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function kr(e){var t=[],n,r=this._root,i,a,o;for(r&&t.push(new Cr(r,this._x0,this._x1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.x1)&&r.length){var s=(a+o)/2;(i=r[1])&&t.push(new Cr(i,s,o)),(i=r[0])&&t.push(new Cr(i,a,s))}return this}function Ar(e){var t=[],n=[],r;for(this._root&&t.push(new Cr(this._root,this._x0,this._x1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.x1,c=(o+s)/2;(a=i[0])&&t.push(new Cr(a,o,c)),(a=i[1])&&t.push(new Cr(a,c,s))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.x1);return this}function jr(e){return e[0]}function Mr(e){return arguments.length?(this._x=e,this):this._x}function Nr(e,t){var n=new Pr(t??jr,NaN,NaN);return e==null?n:n.addAll(e)}function Pr(e,t,n){this._x=e,this._x0=t,this._x1=n,this._root=void 0}function Fr(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Ir=Nr.prototype=Pr.prototype;Ir.copy=function(){var e=new Pr(this._x,this._x0,this._x1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=Fr(t),e;for(n=[{source:t,target:e._root=[,,]}];t=n.pop();)for(var i=0;i<2;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=[,,]}):t.target[i]=Fr(r));return e},Ir.add=_r,Ir.addAll=yr,Ir.cover=br,Ir.data=xr,Ir.extent=Sr,Ir.find=wr,Ir.remove=Tr,Ir.removeAll=Er,Ir.root=Dr,Ir.size=Or,Ir.visit=kr,Ir.visitAfter=Ar,Ir.x=Mr;function Lr(e){let t=+this._x.call(null,e),n=+this._y.call(null,e),r=+this._z.call(null,e);return Rr(this.cover(t,n,r),t,n,r,e)}function Rr(e,t,n,r,i){if(isNaN(t)||isNaN(n)||isNaN(r))return e;var a,o=e._root,s={data:i},c=e._x0,l=e._y0,u=e._z0,d=e._x1,f=e._y1,p=e._z1,m,h,g,_,v,y,b,x,S,C,ee;if(!o)return e._root=s,e;for(;o.length;)if((b=t>=(m=(c+d)/2))?c=m:d=m,(x=n>=(h=(l+f)/2))?l=h:f=h,(S=r>=(g=(u+p)/2))?u=g:p=g,a=o,!(o=o[C=S<<2|x<<1|b]))return a[C]=s,e;if(_=+e._x.call(null,o.data),v=+e._y.call(null,o.data),y=+e._z.call(null,o.data),t===_&&n===v&&r===y)return s.next=o,a?a[C]=s:e._root=s,e;do a=a?a[C]=Array(8):e._root=Array(8),(b=t>=(m=(c+d)/2))?c=m:d=m,(x=n>=(h=(l+f)/2))?l=h:f=h,(S=r>=(g=(u+p)/2))?u=g:p=g;while((C=S<<2|x<<1|b)==(ee=(y>=g)<<2|(v>=h)<<1|_>=m));return a[ee]=o,a[C]=s,e}function zr(e){Array.isArray(e)||(e=Array.from(e));let t=e.length,n=new Float64Array(t),r=new Float64Array(t),i=new Float64Array(t),a=1/0,o=1/0,s=1/0,c=-1/0,l=-1/0,u=-1/0;for(let d=0,f,p,m,h;d<t;++d)isNaN(p=+this._x.call(null,f=e[d]))||isNaN(m=+this._y.call(null,f))||isNaN(h=+this._z.call(null,f))||(n[d]=p,r[d]=m,i[d]=h,p<a&&(a=p),p>c&&(c=p),m<o&&(o=m),m>l&&(l=m),h<s&&(s=h),h>u&&(u=h));if(a>c||o>l||s>u)return this;this.cover(a,o,s).cover(c,l,u);for(let a=0;a<t;++a)Rr(this,n[a],r[a],i[a],e[a]);return this}function Br(e,t,n){if(isNaN(e=+e)||isNaN(t=+t)||isNaN(n=+n))return this;var r=this._x0,i=this._y0,a=this._z0,o=this._x1,s=this._y1,c=this._z1;if(isNaN(r))o=(r=Math.floor(e))+1,s=(i=Math.floor(t))+1,c=(a=Math.floor(n))+1;else{for(var l=o-r||1,u=this._root,d,f;r>e||e>=o||i>t||t>=s||a>n||n>=c;)switch(f=(n<a)<<2|(t<i)<<1|e<r,d=Array(8),d[f]=u,u=d,l*=2,f){case 0:o=r+l,s=i+l,c=a+l;break;case 1:r=o-l,s=i+l,c=a+l;break;case 2:o=r+l,i=s-l,c=a+l;break;case 3:r=o-l,i=s-l,c=a+l;break;case 4:o=r+l,s=i+l,a=c-l;break;case 5:r=o-l,s=i+l,a=c-l;break;case 6:o=r+l,i=s-l,a=c-l;break;case 7:r=o-l,i=s-l,a=c-l}this._root&&this._root.length&&(this._root=u)}return this._x0=r,this._y0=i,this._z0=a,this._x1=o,this._y1=s,this._z1=c,this}function Vr(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Hr(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function Ur(e,t,n,r,i,a,o){this.node=e,this.x0=t,this.y0=n,this.z0=r,this.x1=i,this.y1=a,this.z1=o}function Wr(e,t,n,r){var i,a=this._x0,o=this._y0,s=this._z0,c,l,u,d,f,p,m=this._x1,h=this._y1,g=this._z1,_=[],v=this._root,y,b;for(v&&_.push(new Ur(v,a,o,s,m,h,g)),r==null?r=1/0:(a=e-r,o=t-r,s=n-r,m=e+r,h=t+r,g=n+r,r*=r);y=_.pop();)if(!(!(v=y.node)||(c=y.x0)>m||(l=y.y0)>h||(u=y.z0)>g||(d=y.x1)<a||(f=y.y1)<o||(p=y.z1)<s)){if(v.length){var x=(c+d)/2,S=(l+f)/2,C=(u+p)/2;_.push(new Ur(v[7],x,S,C,d,f,p),new Ur(v[6],c,S,C,x,f,p),new Ur(v[5],x,l,C,d,S,p),new Ur(v[4],c,l,C,x,S,p),new Ur(v[3],x,S,u,d,f,C),new Ur(v[2],c,S,u,x,f,C),new Ur(v[1],x,l,u,d,S,C),new Ur(v[0],c,l,u,x,S,C)),(b=(n>=C)<<2|(t>=S)<<1|e>=x)&&(y=_[_.length-1],_[_.length-1]=_[_.length-1-b],_[_.length-1-b]=y)}else{var ee=e-+this._x.call(null,v.data),te=t-+this._y.call(null,v.data),w=n-+this._z.call(null,v.data),ne=ee*ee+te*te+w*w;if(ne<r){var re=Math.sqrt(r=ne);a=e-re,o=t-re,s=n-re,m=e+re,h=t+re,g=n+re,i=v.data}}}return i}var Gr=(e,t,n,r,i,a)=>Math.sqrt((e-r)**2+(t-i)**2+(n-a)**2);function Kr(e,t,n,r){let i=[],a=e-r,o=t-r,s=n-r,c=e+r,l=t+r,u=n+r;return this.visit((d,f,p,m,h,g,_)=>{if(!d.length)do{let a=d.data;Gr(e,t,n,this._x(a),this._y(a),this._z(a))<=r&&i.push(a)}while(d=d.next);return f>c||p>l||m>u||h<a||g<o||_<s}),i}function qr(e){if(isNaN(f=+this._x.call(null,e))||isNaN(p=+this._y.call(null,e))||isNaN(m=+this._z.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._y0,c=this._z0,l=this._x1,u=this._y1,d=this._z1,f,p,m,h,g,_,v,y,b,x,S;if(!n)return this;if(n.length)for(;;){if((v=f>=(h=(o+l)/2))?o=h:l=h,(y=p>=(g=(s+u)/2))?s=g:u=g,(b=m>=(_=(c+d)/2))?c=_:d=_,t=n,!(n=n[x=b<<2|y<<1|v]))return this;if(!n.length)break;(t[x+1&7]||t[x+2&7]||t[x+3&7]||t[x+4&7]||t[x+5&7]||t[x+6&7]||t[x+7&7])&&(r=t,S=x)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[x]=a:delete t[x],(n=t[0]||t[1]||t[2]||t[3]||t[4]||t[5]||t[6]||t[7])&&n===(t[7]||t[6]||t[5]||t[4]||t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[S]=n:this._root=n),this):(this._root=a,this)}function Jr(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function Yr(){return this._root}function Xr(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function Zr(e){var t=[],n,r=this._root,i,a,o,s,c,l,u;for(r&&t.push(new Ur(r,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.y0,s=n.z0,c=n.x1,l=n.y1,u=n.z1)&&r.length){var d=(a+c)/2,f=(o+l)/2,p=(s+u)/2;(i=r[7])&&t.push(new Ur(i,d,f,p,c,l,u)),(i=r[6])&&t.push(new Ur(i,a,f,p,d,l,u)),(i=r[5])&&t.push(new Ur(i,d,o,p,c,f,u)),(i=r[4])&&t.push(new Ur(i,a,o,p,d,f,u)),(i=r[3])&&t.push(new Ur(i,d,f,s,c,l,p)),(i=r[2])&&t.push(new Ur(i,a,f,s,d,l,p)),(i=r[1])&&t.push(new Ur(i,d,o,s,c,f,p)),(i=r[0])&&t.push(new Ur(i,a,o,s,d,f,p))}return this}function Qr(e){var t=[],n=[],r;for(this._root&&t.push(new Ur(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,c=r.z0,l=r.x1,u=r.y1,d=r.z1,f=(o+l)/2,p=(s+u)/2,m=(c+d)/2;(a=i[0])&&t.push(new Ur(a,o,s,c,f,p,m)),(a=i[1])&&t.push(new Ur(a,f,s,c,l,p,m)),(a=i[2])&&t.push(new Ur(a,o,p,c,f,u,m)),(a=i[3])&&t.push(new Ur(a,f,p,c,l,u,m)),(a=i[4])&&t.push(new Ur(a,o,s,m,f,p,d)),(a=i[5])&&t.push(new Ur(a,f,s,m,l,p,d)),(a=i[6])&&t.push(new Ur(a,o,p,m,f,u,d)),(a=i[7])&&t.push(new Ur(a,f,p,m,l,u,d))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.z0,r.x1,r.y1,r.z1);return this}function $r(e){return e[0]}function ei(e){return arguments.length?(this._x=e,this):this._x}function ti(e){return e[1]}function ni(e){return arguments.length?(this._y=e,this):this._y}function ri(e){return e[2]}function ii(e){return arguments.length?(this._z=e,this):this._z}function ai(e,t,n,r){var i=new oi(t??$r,n??ti,r??ri,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function oi(e,t,n,r,i,a,o,s,c){this._x=e,this._y=t,this._z=n,this._x0=r,this._y0=i,this._z0=a,this._x1=o,this._y1=s,this._z1=c,this._root=void 0}function si(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var ci=ai.prototype=oi.prototype;ci.copy=function(){var e=new oi(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=si(t),e;for(n=[{source:t,target:e._root=Array(8)}];t=n.pop();)for(var i=0;i<8;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=Array(8)}):t.target[i]=si(r));return e},ci.add=Lr,ci.addAll=zr,ci.cover=Br,ci.data=Vr,ci.extent=Hr,ci.find=Wr,ci.findAllWithinRadius=Kr,ci.remove=qr,ci.removeAll=Jr,ci.root=Yr,ci.size=Xr,ci.visit=Zr,ci.visitAfter=Qr,ci.x=ei,ci.y=ni,ci.z=ii;function li(e){return function(){return e}}function ui(e){return(e()-.5)*1e-6}function di(e){return e.index}function fi(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function pi(e){var t=di,n=f,r,i=li(30),a,o,s,c,l,u,d=1;e??=[];function f(e){return 1/Math.min(c[e.source.index],c[e.target.index])}function p(t){for(var n=0,i=e.length;n<d;++n)for(var o=0,c,f,p,m=0,h=0,g=0,_,v;o<i;++o)c=e[o],f=c.source,p=c.target,m=p.x+p.vx-f.x-f.vx||ui(u),s>1&&(h=p.y+p.vy-f.y-f.vy||ui(u)),s>2&&(g=p.z+p.vz-f.z-f.vz||ui(u)),_=Math.sqrt(m*m+h*h+g*g),_=(_-a[o])/_*t*r[o],m*=_,h*=_,g*=_,p.vx-=m*(v=l[o]),s>1&&(p.vy-=h*v),s>2&&(p.vz-=g*v),f.vx+=m*(v=1-v),s>1&&(f.vy+=h*v),s>2&&(f.vz+=g*v)}function m(){if(o){var n,i=o.length,s=e.length,u=new Map(o.map((e,n)=>[t(e,n,o),e])),d;for(n=0,c=Array(i);n<s;++n)d=e[n],d.index=n,typeof d.source!=`object`&&(d.source=fi(u,d.source)),typeof d.target!=`object`&&(d.target=fi(u,d.target)),c[d.source.index]=(c[d.source.index]||0)+1,c[d.target.index]=(c[d.target.index]||0)+1;for(n=0,l=Array(s);n<s;++n)d=e[n],l[n]=c[d.source.index]/(c[d.source.index]+c[d.target.index]);r=Array(s),h(),a=Array(s),g()}}function h(){if(o)for(var t=0,i=e.length;t<i;++t)r[t]=+n(e[t],t,e)}function g(){if(o)for(var t=0,n=e.length;t<n;++t)a[t]=+i(e[t],t,e)}return p.initialize=function(e,...t){o=e,u=t.find(e=>typeof e==`function`)||Math.random,s=t.find(e=>[1,2,3].includes(e))||2,m()},p.links=function(t){return arguments.length?(e=t,m(),p):e},p.id=function(e){return arguments.length?(t=e,p):t},p.iterations=function(e){return arguments.length?(d=+e,p):d},p.strength=function(e){return arguments.length?(n=typeof e==`function`?e:li(+e),h(),p):n},p.distance=function(e){return arguments.length?(i=typeof e==`function`?e:li(+e),g(),p):i},p}var mi=1664525,hi=1013904223,gi=4294967296;function _i(){let e=1;return()=>(e=(mi*e+hi)%gi)/gi}var vi=3;function yi(e){return e.x}function bi(e){return e.y}function xi(e){return e.z}var Si=10,Ci=Math.PI*(3-Math.sqrt(5)),wi=Math.PI*20/(9+Math.sqrt(221));function Ti(e,t){t||=2;var n=Math.min(vi,Math.max(1,Math.round(t))),r,i=1,a=.001,o=1-a**(1/300),s=0,c=.6,l=new Map,u=Un(p),d=Hn(`tick`,`end`),f=_i();e??=[];function p(){m(),d.call(`tick`,r),i<a&&(u.stop(),d.call(`end`,r))}function m(t){var a,u=e.length,d;t===void 0&&(t=1);for(var f=0;f<t;++f)for(i+=(s-i)*o,l.forEach(function(e){e(i)}),a=0;a<u;++a)d=e[a],d.fx==null?d.x+=d.vx*=c:(d.x=d.fx,d.vx=0),n>1&&(d.fy==null?d.y+=d.vy*=c:(d.y=d.fy,d.vy=0)),n>2&&(d.fz==null?d.z+=d.vz*=c:(d.z=d.fz,d.vz=0));return r}function h(){for(var t=0,r=e.length,i;t<r;++t){if(i=e[t],i.index=t,i.fx!=null&&(i.x=i.fx),i.fy!=null&&(i.y=i.fy),i.fz!=null&&(i.z=i.fz),isNaN(i.x)||n>1&&isNaN(i.y)||n>2&&isNaN(i.z)){var a=Si*(n>2?Math.cbrt(.5+t):n>1?Math.sqrt(.5+t):t),o=t*Ci,s=t*wi;n===1?i.x=a:n===2?(i.x=a*Math.cos(o),i.y=a*Math.sin(o)):(i.x=a*Math.sin(o)*Math.cos(s),i.y=a*Math.cos(o),i.z=a*Math.sin(o)*Math.sin(s))}(isNaN(i.vx)||n>1&&isNaN(i.vy)||n>2&&isNaN(i.vz))&&(i.vx=0,n>1&&(i.vy=0),n>2&&(i.vz=0))}}function g(t){return t.initialize&&t.initialize(e,f,n),t}return h(),r={tick:m,restart:function(){return u.restart(p),r},stop:function(){return u.stop(),r},numDimensions:function(e){return arguments.length?(n=Math.min(vi,Math.max(1,Math.round(e))),l.forEach(g),r):n},nodes:function(t){return arguments.length?(e=t,h(),l.forEach(g),r):e},alpha:function(e){return arguments.length?(i=+e,r):i},alphaMin:function(e){return arguments.length?(a=+e,r):a},alphaDecay:function(e){return arguments.length?(o=+e,r):+o},alphaTarget:function(e){return arguments.length?(s=+e,r):s},velocityDecay:function(e){return arguments.length?(c=1-e,r):1-c},randomSource:function(e){return arguments.length?(f=e,l.forEach(g),r):f},force:function(e,t){return arguments.length>1?(t==null?l.delete(e):l.set(e,g(t)),r):l.get(e)},find:function(){var t=Array.prototype.slice.call(arguments),r=t.shift()||0,i=(n>1?t.shift():null)||0,a=(n>2?t.shift():null)||0,o=t.shift()||1/0,s=0,c=e.length,l,u,d,f,p,m;for(o*=o,s=0;s<c;++s)p=e[s],l=r-p.x,u=i-(p.y||0),d=a-(p.z||0),f=l*l+u*u+d*d,f<o&&(m=p,o=f);return m},on:function(e,t){return arguments.length>1?(d.on(e,t),r):d.on(e)}}}function Ei(){var e,t,n,r,i,a=li(-30),o,s=1,c=1/0,l=.81;function u(r){var a,o=e.length,s=(t===1?Nr(e,yi):t===2?Vn(e,yi,bi):t===3?ai(e,yi,bi,xi):null).visitAfter(f);for(i=r,a=0;a<o;++a)n=e[a],s.visit(p)}function d(){if(e){var t,n=e.length,r;for(o=Array(n),t=0;t<n;++t)r=e[t],o[r.index]=+a(r,t,e)}}function f(e){var n=0,r,i,a=0,s,c,l,u,d=e.length;if(d){for(s=c=l=u=0;u<d;++u)(r=e[u])&&(i=Math.abs(r.value))&&(n+=r.value,a+=i,s+=i*(r.x||0),c+=i*(r.y||0),l+=i*(r.z||0));n*=Math.sqrt(4/d),e.x=s/a,t>1&&(e.y=c/a),t>2&&(e.z=l/a)}else{r=e,r.x=r.data.x,t>1&&(r.y=r.data.y),t>2&&(r.z=r.data.z);do n+=o[r.data.index];while(r=r.next)}e.value=n}function p(e,a,u,d,f){if(!e.value)return!0;var p=[u,d,f][t-1],m=e.x-n.x,h=t>1?e.y-n.y:0,g=t>2?e.z-n.z:0,_=p-a,v=m*m+h*h+g*g;if(_*_/l<v)return v<c&&(m===0&&(m=ui(r),v+=m*m),t>1&&h===0&&(h=ui(r),v+=h*h),t>2&&g===0&&(g=ui(r),v+=g*g),v<s&&(v=Math.sqrt(s*v)),n.vx+=m*e.value*i/v,t>1&&(n.vy+=h*e.value*i/v),t>2&&(n.vz+=g*e.value*i/v)),!0;if(!(e.length||v>=c)){(e.data!==n||e.next)&&(m===0&&(m=ui(r),v+=m*m),t>1&&h===0&&(h=ui(r),v+=h*h),t>2&&g===0&&(g=ui(r),v+=g*g),v<s&&(v=Math.sqrt(s*v)));do e.data!==n&&(_=o[e.data.index]*i/v,n.vx+=m*_,t>1&&(n.vy+=h*_),t>2&&(n.vz+=g*_));while(e=e.next)}}return u.initialize=function(n,...i){e=n,r=i.find(e=>typeof e==`function`)||Math.random,t=i.find(e=>[1,2,3].includes(e))||2,d()},u.strength=function(e){return arguments.length?(a=typeof e==`function`?e:li(+e),d(),u):a},u.distanceMin=function(e){return arguments.length?(s=e*e,u):Math.sqrt(s)},u.distanceMax=function(e){return arguments.length?(c=e*e,u):Math.sqrt(c)},u.theta=function(e){return arguments.length?(l=e*e,u):Math.sqrt(l)},u}function Di(e,t,n,r){var i,a,o=li(.1),s,c;typeof e!=`function`&&(e=li(+e)),t??=0,n??=0,r??=0;function l(e){for(var o=0,l=i.length;o<l;++o){var u=i[o],d=u.x-t||1e-6,f=(u.y||0)-n||1e-6,p=(u.z||0)-r||1e-6,m=Math.sqrt(d*d+f*f+p*p),h=(c[o]-m)*s[o]*e/m;u.vx+=d*h,a>1&&(u.vy+=f*h),a>2&&(u.vz+=p*h)}}function u(){if(i){var t,n=i.length;for(s=Array(n),c=Array(n),t=0;t<n;++t)c[t]=+e(i[t],t,i),s[t]=isNaN(c[t])?0:+o(i[t],t,i)}}return l.initialize=function(e,...t){i=e,a=t.find(e=>[1,2,3].includes(e))||2,u()},l.strength=function(e){return arguments.length?(o=typeof e==`function`?e:li(+e),u(),l):o},l.radius=function(t){return arguments.length?(e=typeof t==`function`?t:li(+t),u(),l):e},l.x=function(e){return arguments.length?(t=+e,l):t},l.y=function(e){return arguments.length?(n=+e,l):n},l.z=function(e){return arguments.length?(r=+e,l):r},l}function Oi(e){Ai(e);let t=ki(e);return e.on=t.on,e.off=t.off,e.fire=t.fire,e}function ki(e){let t=Object.create(null);return{on:function(n,r,i){if(typeof r!=`function`)throw Error(`callback is expected to be a function`);let a=t[n];return a||=t[n]=[],a.push({callback:r,ctx:i}),e},off:function(n,r){if(n===void 0)return t=Object.create(null),e;if(t[n]){if(typeof r!=`function`)delete t[n];else{let e=t[n];for(let t=0;t<e.length;++t)e[t].callback===r&&e.splice(t,1)}}return e},fire:function(n){let r=t[n];if(!r)return e;let i;arguments.length>1&&(i=Array.prototype.slice.call(arguments,1));for(let e=0;e<r.length;++e){let t=r[e];t.callback.apply(t.ctx,i)}return e}}}function Ai(e){if(!e)throw Error(`Eventify cannot use falsy object as events subject`);let t=[`on`,`fire`,`off`];for(let n=0;n<t.length;++n)if(e.hasOwnProperty(t[n]))throw Error(`Subject cannot be eventified, since it already has property '`+t[n]+`'`)}var ji=Mi;function Mi(e){if(e||={},`uniqueLinkId`in e&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n",`
|
|
1
|
+
import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";import{AmbientLight as n,ArrayCamera as r,Box3 as i,BoxGeometry as a,BufferAttribute as o,BufferGeometry as s,ByteType as c,ClampToEdgeWrapping as l,Color as u,ColorManagement as d,Compatibility as f,ConeGeometry as p,Controls as m,CubeCamera as h,CubeDepthTexture as g,CubeTexture as _,CubicBezierCurve3 as v,CylinderGeometry as y,DataArrayTexture as b,DataTexture as x,DecrementStencilOp as S,DecrementWrapStencilOp as C,DepthFormat as ee,DepthStencilFormat as te,DepthTexture as w,DirectionalLight as ne,DynamicDrawUsage as re,EllipseCurve as ie,EventDispatcher as ae,Float16BufferAttribute as oe,Float32BufferAttribute as se,FloatType as ce,FramebufferTexture as le,Frustum as ue,FrustumArray as de,GridHelper as fe,Group as pe,HalfFloatType as me,HemisphereLight as he,IncrementStencilOp as ge,IncrementWrapStencilOp as _e,InstancedBufferAttribute as ve,InstancedInterleavedBuffer as ye,IntType as be,InterleavedBuffer as xe,InterleavedBufferAttribute as Se,InvertStencilOp as Ce,KeepStencilOp as we,LightProbe as Te,Line as Ee,LineBasicMaterial as De,LineDashedMaterial as Oe,LinearFilter as ke,LinearMipmapLinearFilter as Ae,LinearMipmapNearestFilter as je,LinearSRGBColorSpace as Me,LinearTransfer as Ne,MOUSE as Pe,Material as Fe,MathUtils as Ie,Matrix2 as Le,Matrix3 as Re,Matrix4 as ze,Mesh as Be,MeshBasicMaterial as Ve,MeshLambertMaterial as He,MeshMatcapMaterial as Ue,MeshNormalMaterial as We,MeshPhongMaterial as Ge,MeshPhysicalMaterial as Ke,MeshStandardMaterial as qe,MeshToonMaterial as Je,MirroredRepeatWrapping as Ye,NearestFilter as Xe,NearestMipmapLinearFilter as Ze,NearestMipmapNearestFilter as Qe,OrthographicCamera as $e,PerspectiveCamera as et,Plane as tt,PlaneGeometry as nt,PointLight as rt,PointsMaterial as it,QuadraticBezierCurve3 as at,Quaternion as ot,R11_EAC_Format as st,RED_GREEN_RGTC2_Format as ct,RED_RGTC1_Format as lt,RG11_EAC_Format as ut,RGBAFormat as dt,RGBAIntegerFormat as ft,RGBA_ASTC_10x10_Format as pt,RGBA_ASTC_10x5_Format as mt,RGBA_ASTC_10x6_Format as ht,RGBA_ASTC_10x8_Format as gt,RGBA_ASTC_12x10_Format as _t,RGBA_ASTC_12x12_Format as vt,RGBA_ASTC_4x4_Format as yt,RGBA_ASTC_5x4_Format as bt,RGBA_ASTC_5x5_Format as xt,RGBA_ASTC_6x5_Format as St,RGBA_ASTC_6x6_Format as Ct,RGBA_ASTC_8x5_Format as wt,RGBA_ASTC_8x6_Format as Tt,RGBA_ASTC_8x8_Format as Et,RGBA_BPTC_Format as Dt,RGBA_ETC2_EAC_Format as Ot,RGBA_S3TC_DXT1_Format as kt,RGBA_S3TC_DXT3_Format as At,RGBA_S3TC_DXT5_Format as jt,RGBFormat as Mt,RGBIntegerFormat as Nt,RGB_BPTC_SIGNED_Format as Pt,RGB_BPTC_UNSIGNED_Format as Ft,RGB_ETC1_Format as It,RGB_ETC2_Format as Lt,RGB_S3TC_DXT1_Format as Rt,RGFormat as zt,RGIntegerFormat as Bt,Ray as Vt,Raycaster as Ht,RectAreaLight as Ut,RedFormat as Wt,RedIntegerFormat as Gt,RenderObjectRefreshType as Kt,RenderTarget as qt,RepeatWrapping as Jt,ReplaceStencilOp as Yt,SIGNED_R11_EAC_Format as Xt,SIGNED_RED_GREEN_RGTC2_Format as Zt,SIGNED_RED_RGTC1_Format as Qt,SIGNED_RG11_EAC_Format as $t,SRGBColorSpace as en,Scene as tn,ShaderMaterial as nn,ShadowMaterial as rn,ShortType as an,Sphere as on,SphereGeometry as sn,Spherical as cn,SpotLight as ln,SpriteMaterial as un,StaticDrawUsage as dn,TOUCH as fn,Texture as pn,TextureLoader as mn,Timer as hn,TimestampQuery as gn,TubeGeometry as _n,Uint16BufferAttribute as vn,Uint32BufferAttribute as yn,UniformsUtils as bn,UnsignedByteType as xn,UnsignedInt101111Type as Sn,UnsignedInt248Type as Cn,UnsignedInt5999Type as wn,UnsignedIntType as Tn,UnsignedShortType as En,Vector2 as T,Vector3 as E,Vector4 as Dn,WebGLCoordinateSystem as On,WebGLRenderTarget as kn,WebGLRenderer as An,WebGPUCoordinateSystem as jn,WebXRController as Mn,a as Nn,createCanvasElement as Pn,error as D,i as Fn,log as In,n as Ln,r as Rn,t as zn,warn as O,warnOnce as Bn}from"./three.module-D480w7q4.js";import{g as Vn,h as Hn,m as Un}from"./RelationGraph-Bcuvouws.js";import{a as Wn,i as Gn,n as Kn,o as qn,r as Jn,s as Yn}from"./Product-CpfrZib1.js";var Xn=new tt,Zn=new T,Qn=new E,$n=new T,er=new T,tr=new E,nr=new E,rr=new ze,ir=new E,ar=new E,or=null,sr=null,cr=[],lr={NONE:-1,PAN:0,ROTATE:1},ur=class extends m{constructor(e,t,n=null){super(t,n),this.objects=e,this.recursive=!0,this.transformGroup=!1,this.rotateSpeed=1,this.raycaster=new Ht,this.mouseButtons={LEFT:Pe.PAN,MIDDLE:Pe.PAN,RIGHT:Pe.ROTATE},this.touches={ONE:fn.PAN},this._onPointerMove=dr.bind(this),this._onPointerDown=fr.bind(this),this._onPointerCancel=pr.bind(this),this._onContextMenu=mr.bind(this),n!==null&&this.connect(n)}connect(e){super.connect(e),this.domElement.addEventListener(`pointermove`,this._onPointerMove),this.domElement.addEventListener(`pointerdown`,this._onPointerDown),this.domElement.addEventListener(`pointerup`,this._onPointerCancel),this.domElement.addEventListener(`pointerleave`,this._onPointerCancel),this.domElement.addEventListener(`contextmenu`,this._onContextMenu),this.domElement.style.touchAction=`none`}disconnect(){this.domElement.removeEventListener(`pointermove`,this._onPointerMove),this.domElement.removeEventListener(`pointerdown`,this._onPointerDown),this.domElement.removeEventListener(`pointerup`,this._onPointerCancel),this.domElement.removeEventListener(`pointerleave`,this._onPointerCancel),this.domElement.removeEventListener(`contextmenu`,this._onContextMenu),this.domElement.style.touchAction=``,this.domElement.style.cursor=``}dispose(){this.disconnect()}_updatePointer(e){let t=this.domElement.getBoundingClientRect();Zn.x=(e.clientX-t.left)/t.width*2-1,Zn.y=-(e.clientY-t.top)/t.height*2+1}_updateState(e){let t;if(e.pointerType===`touch`)t=this.touches.ONE;else switch(e.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=null}switch(t){case Pe.PAN:case fn.PAN:this.state=lr.PAN;break;case Pe.ROTATE:case fn.ROTATE:this.state=lr.ROTATE;break;default:this.state=lr.NONE}}};function dr(e){let t=this.object,n=this.domElement,r=this.raycaster;if(this.enabled!==!1){if(this._updatePointer(e),r.setFromCamera(Zn,t),or)this.state===lr.PAN?r.ray.intersectPlane(Xn,tr)&&(or.position.copy(tr.sub(Qn).applyMatrix4(rr)),this.dispatchEvent({type:`drag`,object:or})):this.state===lr.ROTATE&&($n.subVectors(Zn,er).multiplyScalar(this.rotateSpeed),or.rotateOnWorldAxis(ir,$n.x),or.rotateOnWorldAxis(ar.normalize(),-$n.y),this.dispatchEvent({type:`drag`,object:or})),er.copy(Zn);else if(e.pointerType===`mouse`||e.pointerType===`pen`){if(cr.length=0,r.setFromCamera(Zn,t),r.intersectObjects(this.objects,this.recursive,cr),cr.length>0){let e=cr[0].object;Xn.setFromNormalAndCoplanarPoint(t.getWorldDirection(Xn.normal),nr.setFromMatrixPosition(e.matrixWorld)),sr!==e&&sr!==null&&(this.dispatchEvent({type:`hoveroff`,object:sr}),n.style.cursor=`auto`,sr=null),sr!==e&&(this.dispatchEvent({type:`hoveron`,object:e}),n.style.cursor=`pointer`,sr=e)}else sr!==null&&(this.dispatchEvent({type:`hoveroff`,object:sr}),n.style.cursor=`auto`,sr=null)}er.copy(Zn)}}function fr(e){let t=this.object,n=this.domElement,r=this.raycaster;this.enabled!==!1&&(this._updatePointer(e),this._updateState(e),cr.length=0,r.setFromCamera(Zn,t),r.intersectObjects(this.objects,this.recursive,cr),cr.length>0&&(or=this.transformGroup===!0?hr(cr[0].object):cr[0].object,Xn.setFromNormalAndCoplanarPoint(t.getWorldDirection(Xn.normal),nr.setFromMatrixPosition(or.matrixWorld)),r.ray.intersectPlane(Xn,tr)&&(this.state===lr.PAN?(rr.copy(or.parent.matrixWorld).invert(),Qn.copy(tr).sub(nr.setFromMatrixPosition(or.matrixWorld)),n.style.cursor=`move`,this.dispatchEvent({type:`dragstart`,object:or})):this.state===lr.ROTATE&&(ir.set(0,1,0).applyQuaternion(t.quaternion).normalize(),ar.set(1,0,0).applyQuaternion(t.quaternion).normalize(),n.style.cursor=`move`,this.dispatchEvent({type:`dragstart`,object:or})))),er.copy(Zn))}function pr(){this.enabled!==!1&&(or&&=(this.dispatchEvent({type:`dragend`,object:or}),null),this.domElement.style.cursor=sr?`pointer`:`auto`,this.state=lr.NONE)}function mr(e){this.enabled!==!1&&e.preventDefault()}function hr(e,t=null){return e.isGroup&&(t=e),e.parent===null?t:hr(e.parent,t)}function gr(e,t,n){var r,i=1;e??=0,t??=0,n??=0;function a(){var a,o=r.length,s,c=0,l=0,u=0;for(a=0;a<o;++a)s=r[a],c+=s.x||0,l+=s.y||0,u+=s.z||0;for(c=(c/o-e)*i,l=(l/o-t)*i,u=(u/o-n)*i,a=0;a<o;++a)s=r[a],c&&(s.x-=c),l&&(s.y-=l),u&&(s.z-=u)}return a.initialize=function(e){r=e},a.x=function(t){return arguments.length?(e=+t,a):e},a.y=function(e){return arguments.length?(t=+e,a):t},a.z=function(e){return arguments.length?(n=+e,a):n},a.strength=function(e){return arguments.length?(i=+e,a):i},a}function _r(e){let t=+this._x.call(null,e);return vr(this.cover(t),t,e)}function vr(e,t,n){if(isNaN(t))return e;var r,i=e._root,a={data:n},o=e._x0,s=e._x1,c,l,u,d,f;if(!i)return e._root=a,e;for(;i.length;)if((u=t>=(c=(o+s)/2))?o=c:s=c,r=i,!(i=i[d=+u]))return r[d]=a,e;if(l=+e._x.call(null,i.data),t===l)return a.next=i,r?r[d]=a:e._root=a,e;do r=r?r[d]=[,,]:e._root=[,,],(u=t>=(c=(o+s)/2))?o=c:s=c;while((d=+u)==(f=+(l>=c)));return r[f]=i,r[d]=a,e}function yr(e){Array.isArray(e)||(e=Array.from(e));let t=e.length,n=new Float64Array(t),r=1/0,i=-1/0;for(let a=0,o;a<t;++a)isNaN(o=+this._x.call(null,e[a]))||(n[a]=o,o<r&&(r=o),o>i&&(i=o));if(r>i)return this;this.cover(r).cover(i);for(let r=0;r<t;++r)vr(this,n[r],e[r]);return this}function br(e){if(isNaN(e=+e))return this;var t=this._x0,n=this._x1;if(isNaN(t))n=(t=Math.floor(e))+1;else{for(var r=n-t||1,i=this._root,a,o;t>e||e>=n;)switch(o=+(e<t),a=[,,],a[o]=i,i=a,r*=2,o){case 0:n=t+r;break;case 1:t=n-r}this._root&&this._root.length&&(this._root=i)}return this._x0=t,this._x1=n,this}function xr(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Sr(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function Cr(e,t,n){this.node=e,this.x0=t,this.x1=n}function wr(e,t){var n,r=this._x0,i,a,o=this._x1,s=[],c=this._root,l,u;for(c&&s.push(new Cr(c,r,o)),t==null?t=1/0:(r=e-t,o=e+t);l=s.pop();)if(!(!(c=l.node)||(i=l.x0)>o||(a=l.x1)<r)){if(c.length){var d=(i+a)/2;s.push(new Cr(c[1],d,a),new Cr(c[0],i,d)),(u=+(e>=d))&&(l=s[s.length-1],s[s.length-1]=s[s.length-1-u],s[s.length-1-u]=l)}else{var f=Math.abs(e-+this._x.call(null,c.data));f<t&&(t=f,r=e-f,o=e+f,n=c.data)}}return n}function Tr(e){if(isNaN(c=+this._x.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._x1,c,l,u,d,f;if(!n)return this;if(n.length)for(;;){if((u=c>=(l=(o+s)/2))?o=l:s=l,t=n,!(n=n[d=+u]))return this;if(!n.length)break;t[d+1&1]&&(r=t,f=d)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[d]=a:delete t[d],(n=t[0]||t[1])&&n===(t[1]||t[0])&&!n.length&&(r?r[f]=n:this._root=n),this):(this._root=a,this)}function Er(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function Dr(){return this._root}function Or(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function kr(e){var t=[],n,r=this._root,i,a,o;for(r&&t.push(new Cr(r,this._x0,this._x1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.x1)&&r.length){var s=(a+o)/2;(i=r[1])&&t.push(new Cr(i,s,o)),(i=r[0])&&t.push(new Cr(i,a,s))}return this}function Ar(e){var t=[],n=[],r;for(this._root&&t.push(new Cr(this._root,this._x0,this._x1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.x1,c=(o+s)/2;(a=i[0])&&t.push(new Cr(a,o,c)),(a=i[1])&&t.push(new Cr(a,c,s))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.x1);return this}function jr(e){return e[0]}function Mr(e){return arguments.length?(this._x=e,this):this._x}function Nr(e,t){var n=new Pr(t??jr,NaN,NaN);return e==null?n:n.addAll(e)}function Pr(e,t,n){this._x=e,this._x0=t,this._x1=n,this._root=void 0}function Fr(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Ir=Nr.prototype=Pr.prototype;Ir.copy=function(){var e=new Pr(this._x,this._x0,this._x1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=Fr(t),e;for(n=[{source:t,target:e._root=[,,]}];t=n.pop();)for(var i=0;i<2;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=[,,]}):t.target[i]=Fr(r));return e},Ir.add=_r,Ir.addAll=yr,Ir.cover=br,Ir.data=xr,Ir.extent=Sr,Ir.find=wr,Ir.remove=Tr,Ir.removeAll=Er,Ir.root=Dr,Ir.size=Or,Ir.visit=kr,Ir.visitAfter=Ar,Ir.x=Mr;function Lr(e){let t=+this._x.call(null,e),n=+this._y.call(null,e),r=+this._z.call(null,e);return Rr(this.cover(t,n,r),t,n,r,e)}function Rr(e,t,n,r,i){if(isNaN(t)||isNaN(n)||isNaN(r))return e;var a,o=e._root,s={data:i},c=e._x0,l=e._y0,u=e._z0,d=e._x1,f=e._y1,p=e._z1,m,h,g,_,v,y,b,x,S,C,ee;if(!o)return e._root=s,e;for(;o.length;)if((b=t>=(m=(c+d)/2))?c=m:d=m,(x=n>=(h=(l+f)/2))?l=h:f=h,(S=r>=(g=(u+p)/2))?u=g:p=g,a=o,!(o=o[C=S<<2|x<<1|b]))return a[C]=s,e;if(_=+e._x.call(null,o.data),v=+e._y.call(null,o.data),y=+e._z.call(null,o.data),t===_&&n===v&&r===y)return s.next=o,a?a[C]=s:e._root=s,e;do a=a?a[C]=Array(8):e._root=Array(8),(b=t>=(m=(c+d)/2))?c=m:d=m,(x=n>=(h=(l+f)/2))?l=h:f=h,(S=r>=(g=(u+p)/2))?u=g:p=g;while((C=S<<2|x<<1|b)==(ee=(y>=g)<<2|(v>=h)<<1|_>=m));return a[ee]=o,a[C]=s,e}function zr(e){Array.isArray(e)||(e=Array.from(e));let t=e.length,n=new Float64Array(t),r=new Float64Array(t),i=new Float64Array(t),a=1/0,o=1/0,s=1/0,c=-1/0,l=-1/0,u=-1/0;for(let d=0,f,p,m,h;d<t;++d)isNaN(p=+this._x.call(null,f=e[d]))||isNaN(m=+this._y.call(null,f))||isNaN(h=+this._z.call(null,f))||(n[d]=p,r[d]=m,i[d]=h,p<a&&(a=p),p>c&&(c=p),m<o&&(o=m),m>l&&(l=m),h<s&&(s=h),h>u&&(u=h));if(a>c||o>l||s>u)return this;this.cover(a,o,s).cover(c,l,u);for(let a=0;a<t;++a)Rr(this,n[a],r[a],i[a],e[a]);return this}function Br(e,t,n){if(isNaN(e=+e)||isNaN(t=+t)||isNaN(n=+n))return this;var r=this._x0,i=this._y0,a=this._z0,o=this._x1,s=this._y1,c=this._z1;if(isNaN(r))o=(r=Math.floor(e))+1,s=(i=Math.floor(t))+1,c=(a=Math.floor(n))+1;else{for(var l=o-r||1,u=this._root,d,f;r>e||e>=o||i>t||t>=s||a>n||n>=c;)switch(f=(n<a)<<2|(t<i)<<1|e<r,d=Array(8),d[f]=u,u=d,l*=2,f){case 0:o=r+l,s=i+l,c=a+l;break;case 1:r=o-l,s=i+l,c=a+l;break;case 2:o=r+l,i=s-l,c=a+l;break;case 3:r=o-l,i=s-l,c=a+l;break;case 4:o=r+l,s=i+l,a=c-l;break;case 5:r=o-l,s=i+l,a=c-l;break;case 6:o=r+l,i=s-l,a=c-l;break;case 7:r=o-l,i=s-l,a=c-l}this._root&&this._root.length&&(this._root=u)}return this._x0=r,this._y0=i,this._z0=a,this._x1=o,this._y1=s,this._z1=c,this}function Vr(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Hr(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function Ur(e,t,n,r,i,a,o){this.node=e,this.x0=t,this.y0=n,this.z0=r,this.x1=i,this.y1=a,this.z1=o}function Wr(e,t,n,r){var i,a=this._x0,o=this._y0,s=this._z0,c,l,u,d,f,p,m=this._x1,h=this._y1,g=this._z1,_=[],v=this._root,y,b;for(v&&_.push(new Ur(v,a,o,s,m,h,g)),r==null?r=1/0:(a=e-r,o=t-r,s=n-r,m=e+r,h=t+r,g=n+r,r*=r);y=_.pop();)if(!(!(v=y.node)||(c=y.x0)>m||(l=y.y0)>h||(u=y.z0)>g||(d=y.x1)<a||(f=y.y1)<o||(p=y.z1)<s)){if(v.length){var x=(c+d)/2,S=(l+f)/2,C=(u+p)/2;_.push(new Ur(v[7],x,S,C,d,f,p),new Ur(v[6],c,S,C,x,f,p),new Ur(v[5],x,l,C,d,S,p),new Ur(v[4],c,l,C,x,S,p),new Ur(v[3],x,S,u,d,f,C),new Ur(v[2],c,S,u,x,f,C),new Ur(v[1],x,l,u,d,S,C),new Ur(v[0],c,l,u,x,S,C)),(b=(n>=C)<<2|(t>=S)<<1|e>=x)&&(y=_[_.length-1],_[_.length-1]=_[_.length-1-b],_[_.length-1-b]=y)}else{var ee=e-+this._x.call(null,v.data),te=t-+this._y.call(null,v.data),w=n-+this._z.call(null,v.data),ne=ee*ee+te*te+w*w;if(ne<r){var re=Math.sqrt(r=ne);a=e-re,o=t-re,s=n-re,m=e+re,h=t+re,g=n+re,i=v.data}}}return i}var Gr=(e,t,n,r,i,a)=>Math.sqrt((e-r)**2+(t-i)**2+(n-a)**2);function Kr(e,t,n,r){let i=[],a=e-r,o=t-r,s=n-r,c=e+r,l=t+r,u=n+r;return this.visit((d,f,p,m,h,g,_)=>{if(!d.length)do{let a=d.data;Gr(e,t,n,this._x(a),this._y(a),this._z(a))<=r&&i.push(a)}while(d=d.next);return f>c||p>l||m>u||h<a||g<o||_<s}),i}function qr(e){if(isNaN(f=+this._x.call(null,e))||isNaN(p=+this._y.call(null,e))||isNaN(m=+this._z.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._y0,c=this._z0,l=this._x1,u=this._y1,d=this._z1,f,p,m,h,g,_,v,y,b,x,S;if(!n)return this;if(n.length)for(;;){if((v=f>=(h=(o+l)/2))?o=h:l=h,(y=p>=(g=(s+u)/2))?s=g:u=g,(b=m>=(_=(c+d)/2))?c=_:d=_,t=n,!(n=n[x=b<<2|y<<1|v]))return this;if(!n.length)break;(t[x+1&7]||t[x+2&7]||t[x+3&7]||t[x+4&7]||t[x+5&7]||t[x+6&7]||t[x+7&7])&&(r=t,S=x)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[x]=a:delete t[x],(n=t[0]||t[1]||t[2]||t[3]||t[4]||t[5]||t[6]||t[7])&&n===(t[7]||t[6]||t[5]||t[4]||t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[S]=n:this._root=n),this):(this._root=a,this)}function Jr(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function Yr(){return this._root}function Xr(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function Zr(e){var t=[],n,r=this._root,i,a,o,s,c,l,u;for(r&&t.push(new Ur(r,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.y0,s=n.z0,c=n.x1,l=n.y1,u=n.z1)&&r.length){var d=(a+c)/2,f=(o+l)/2,p=(s+u)/2;(i=r[7])&&t.push(new Ur(i,d,f,p,c,l,u)),(i=r[6])&&t.push(new Ur(i,a,f,p,d,l,u)),(i=r[5])&&t.push(new Ur(i,d,o,p,c,f,u)),(i=r[4])&&t.push(new Ur(i,a,o,p,d,f,u)),(i=r[3])&&t.push(new Ur(i,d,f,s,c,l,p)),(i=r[2])&&t.push(new Ur(i,a,f,s,d,l,p)),(i=r[1])&&t.push(new Ur(i,d,o,s,c,f,p)),(i=r[0])&&t.push(new Ur(i,a,o,s,d,f,p))}return this}function Qr(e){var t=[],n=[],r;for(this._root&&t.push(new Ur(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,c=r.z0,l=r.x1,u=r.y1,d=r.z1,f=(o+l)/2,p=(s+u)/2,m=(c+d)/2;(a=i[0])&&t.push(new Ur(a,o,s,c,f,p,m)),(a=i[1])&&t.push(new Ur(a,f,s,c,l,p,m)),(a=i[2])&&t.push(new Ur(a,o,p,c,f,u,m)),(a=i[3])&&t.push(new Ur(a,f,p,c,l,u,m)),(a=i[4])&&t.push(new Ur(a,o,s,m,f,p,d)),(a=i[5])&&t.push(new Ur(a,f,s,m,l,p,d)),(a=i[6])&&t.push(new Ur(a,o,p,m,f,u,d)),(a=i[7])&&t.push(new Ur(a,f,p,m,l,u,d))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.z0,r.x1,r.y1,r.z1);return this}function $r(e){return e[0]}function ei(e){return arguments.length?(this._x=e,this):this._x}function ti(e){return e[1]}function ni(e){return arguments.length?(this._y=e,this):this._y}function ri(e){return e[2]}function ii(e){return arguments.length?(this._z=e,this):this._z}function ai(e,t,n,r){var i=new oi(t??$r,n??ti,r??ri,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function oi(e,t,n,r,i,a,o,s,c){this._x=e,this._y=t,this._z=n,this._x0=r,this._y0=i,this._z0=a,this._x1=o,this._y1=s,this._z1=c,this._root=void 0}function si(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var ci=ai.prototype=oi.prototype;ci.copy=function(){var e=new oi(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=si(t),e;for(n=[{source:t,target:e._root=Array(8)}];t=n.pop();)for(var i=0;i<8;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=Array(8)}):t.target[i]=si(r));return e},ci.add=Lr,ci.addAll=zr,ci.cover=Br,ci.data=Vr,ci.extent=Hr,ci.find=Wr,ci.findAllWithinRadius=Kr,ci.remove=qr,ci.removeAll=Jr,ci.root=Yr,ci.size=Xr,ci.visit=Zr,ci.visitAfter=Qr,ci.x=ei,ci.y=ni,ci.z=ii;function li(e){return function(){return e}}function ui(e){return(e()-.5)*1e-6}function di(e){return e.index}function fi(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function pi(e){var t=di,n=f,r,i=li(30),a,o,s,c,l,u,d=1;e??=[];function f(e){return 1/Math.min(c[e.source.index],c[e.target.index])}function p(t){for(var n=0,i=e.length;n<d;++n)for(var o=0,c,f,p,m=0,h=0,g=0,_,v;o<i;++o)c=e[o],f=c.source,p=c.target,m=p.x+p.vx-f.x-f.vx||ui(u),s>1&&(h=p.y+p.vy-f.y-f.vy||ui(u)),s>2&&(g=p.z+p.vz-f.z-f.vz||ui(u)),_=Math.sqrt(m*m+h*h+g*g),_=(_-a[o])/_*t*r[o],m*=_,h*=_,g*=_,p.vx-=m*(v=l[o]),s>1&&(p.vy-=h*v),s>2&&(p.vz-=g*v),f.vx+=m*(v=1-v),s>1&&(f.vy+=h*v),s>2&&(f.vz+=g*v)}function m(){if(o){var n,i=o.length,s=e.length,u=new Map(o.map((e,n)=>[t(e,n,o),e])),d;for(n=0,c=Array(i);n<s;++n)d=e[n],d.index=n,typeof d.source!=`object`&&(d.source=fi(u,d.source)),typeof d.target!=`object`&&(d.target=fi(u,d.target)),c[d.source.index]=(c[d.source.index]||0)+1,c[d.target.index]=(c[d.target.index]||0)+1;for(n=0,l=Array(s);n<s;++n)d=e[n],l[n]=c[d.source.index]/(c[d.source.index]+c[d.target.index]);r=Array(s),h(),a=Array(s),g()}}function h(){if(o)for(var t=0,i=e.length;t<i;++t)r[t]=+n(e[t],t,e)}function g(){if(o)for(var t=0,n=e.length;t<n;++t)a[t]=+i(e[t],t,e)}return p.initialize=function(e,...t){o=e,u=t.find(e=>typeof e==`function`)||Math.random,s=t.find(e=>[1,2,3].includes(e))||2,m()},p.links=function(t){return arguments.length?(e=t,m(),p):e},p.id=function(e){return arguments.length?(t=e,p):t},p.iterations=function(e){return arguments.length?(d=+e,p):d},p.strength=function(e){return arguments.length?(n=typeof e==`function`?e:li(+e),h(),p):n},p.distance=function(e){return arguments.length?(i=typeof e==`function`?e:li(+e),g(),p):i},p}var mi=1664525,hi=1013904223,gi=4294967296;function _i(){let e=1;return()=>(e=(mi*e+hi)%gi)/gi}var vi=3;function yi(e){return e.x}function bi(e){return e.y}function xi(e){return e.z}var Si=10,Ci=Math.PI*(3-Math.sqrt(5)),wi=Math.PI*20/(9+Math.sqrt(221));function Ti(e,t){t||=2;var n=Math.min(vi,Math.max(1,Math.round(t))),r,i=1,a=.001,o=1-a**(1/300),s=0,c=.6,l=new Map,u=Un(p),d=Hn(`tick`,`end`),f=_i();e??=[];function p(){m(),d.call(`tick`,r),i<a&&(u.stop(),d.call(`end`,r))}function m(t){var a,u=e.length,d;t===void 0&&(t=1);for(var f=0;f<t;++f)for(i+=(s-i)*o,l.forEach(function(e){e(i)}),a=0;a<u;++a)d=e[a],d.fx==null?d.x+=d.vx*=c:(d.x=d.fx,d.vx=0),n>1&&(d.fy==null?d.y+=d.vy*=c:(d.y=d.fy,d.vy=0)),n>2&&(d.fz==null?d.z+=d.vz*=c:(d.z=d.fz,d.vz=0));return r}function h(){for(var t=0,r=e.length,i;t<r;++t){if(i=e[t],i.index=t,i.fx!=null&&(i.x=i.fx),i.fy!=null&&(i.y=i.fy),i.fz!=null&&(i.z=i.fz),isNaN(i.x)||n>1&&isNaN(i.y)||n>2&&isNaN(i.z)){var a=Si*(n>2?Math.cbrt(.5+t):n>1?Math.sqrt(.5+t):t),o=t*Ci,s=t*wi;n===1?i.x=a:n===2?(i.x=a*Math.cos(o),i.y=a*Math.sin(o)):(i.x=a*Math.sin(o)*Math.cos(s),i.y=a*Math.cos(o),i.z=a*Math.sin(o)*Math.sin(s))}(isNaN(i.vx)||n>1&&isNaN(i.vy)||n>2&&isNaN(i.vz))&&(i.vx=0,n>1&&(i.vy=0),n>2&&(i.vz=0))}}function g(t){return t.initialize&&t.initialize(e,f,n),t}return h(),r={tick:m,restart:function(){return u.restart(p),r},stop:function(){return u.stop(),r},numDimensions:function(e){return arguments.length?(n=Math.min(vi,Math.max(1,Math.round(e))),l.forEach(g),r):n},nodes:function(t){return arguments.length?(e=t,h(),l.forEach(g),r):e},alpha:function(e){return arguments.length?(i=+e,r):i},alphaMin:function(e){return arguments.length?(a=+e,r):a},alphaDecay:function(e){return arguments.length?(o=+e,r):+o},alphaTarget:function(e){return arguments.length?(s=+e,r):s},velocityDecay:function(e){return arguments.length?(c=1-e,r):1-c},randomSource:function(e){return arguments.length?(f=e,l.forEach(g),r):f},force:function(e,t){return arguments.length>1?(t==null?l.delete(e):l.set(e,g(t)),r):l.get(e)},find:function(){var t=Array.prototype.slice.call(arguments),r=t.shift()||0,i=(n>1?t.shift():null)||0,a=(n>2?t.shift():null)||0,o=t.shift()||1/0,s=0,c=e.length,l,u,d,f,p,m;for(o*=o,s=0;s<c;++s)p=e[s],l=r-p.x,u=i-(p.y||0),d=a-(p.z||0),f=l*l+u*u+d*d,f<o&&(m=p,o=f);return m},on:function(e,t){return arguments.length>1?(d.on(e,t),r):d.on(e)}}}function Ei(){var e,t,n,r,i,a=li(-30),o,s=1,c=1/0,l=.81;function u(r){var a,o=e.length,s=(t===1?Nr(e,yi):t===2?Vn(e,yi,bi):t===3?ai(e,yi,bi,xi):null).visitAfter(f);for(i=r,a=0;a<o;++a)n=e[a],s.visit(p)}function d(){if(e){var t,n=e.length,r;for(o=Array(n),t=0;t<n;++t)r=e[t],o[r.index]=+a(r,t,e)}}function f(e){var n=0,r,i,a=0,s,c,l,u,d=e.length;if(d){for(s=c=l=u=0;u<d;++u)(r=e[u])&&(i=Math.abs(r.value))&&(n+=r.value,a+=i,s+=i*(r.x||0),c+=i*(r.y||0),l+=i*(r.z||0));n*=Math.sqrt(4/d),e.x=s/a,t>1&&(e.y=c/a),t>2&&(e.z=l/a)}else{r=e,r.x=r.data.x,t>1&&(r.y=r.data.y),t>2&&(r.z=r.data.z);do n+=o[r.data.index];while(r=r.next)}e.value=n}function p(e,a,u,d,f){if(!e.value)return!0;var p=[u,d,f][t-1],m=e.x-n.x,h=t>1?e.y-n.y:0,g=t>2?e.z-n.z:0,_=p-a,v=m*m+h*h+g*g;if(_*_/l<v)return v<c&&(m===0&&(m=ui(r),v+=m*m),t>1&&h===0&&(h=ui(r),v+=h*h),t>2&&g===0&&(g=ui(r),v+=g*g),v<s&&(v=Math.sqrt(s*v)),n.vx+=m*e.value*i/v,t>1&&(n.vy+=h*e.value*i/v),t>2&&(n.vz+=g*e.value*i/v)),!0;if(!(e.length||v>=c)){(e.data!==n||e.next)&&(m===0&&(m=ui(r),v+=m*m),t>1&&h===0&&(h=ui(r),v+=h*h),t>2&&g===0&&(g=ui(r),v+=g*g),v<s&&(v=Math.sqrt(s*v)));do e.data!==n&&(_=o[e.data.index]*i/v,n.vx+=m*_,t>1&&(n.vy+=h*_),t>2&&(n.vz+=g*_));while(e=e.next)}}return u.initialize=function(n,...i){e=n,r=i.find(e=>typeof e==`function`)||Math.random,t=i.find(e=>[1,2,3].includes(e))||2,d()},u.strength=function(e){return arguments.length?(a=typeof e==`function`?e:li(+e),d(),u):a},u.distanceMin=function(e){return arguments.length?(s=e*e,u):Math.sqrt(s)},u.distanceMax=function(e){return arguments.length?(c=e*e,u):Math.sqrt(c)},u.theta=function(e){return arguments.length?(l=e*e,u):Math.sqrt(l)},u}function Di(e,t,n,r){var i,a,o=li(.1),s,c;typeof e!=`function`&&(e=li(+e)),t??=0,n??=0,r??=0;function l(e){for(var o=0,l=i.length;o<l;++o){var u=i[o],d=u.x-t||1e-6,f=(u.y||0)-n||1e-6,p=(u.z||0)-r||1e-6,m=Math.sqrt(d*d+f*f+p*p),h=(c[o]-m)*s[o]*e/m;u.vx+=d*h,a>1&&(u.vy+=f*h),a>2&&(u.vz+=p*h)}}function u(){if(i){var t,n=i.length;for(s=Array(n),c=Array(n),t=0;t<n;++t)c[t]=+e(i[t],t,i),s[t]=isNaN(c[t])?0:+o(i[t],t,i)}}return l.initialize=function(e,...t){i=e,a=t.find(e=>[1,2,3].includes(e))||2,u()},l.strength=function(e){return arguments.length?(o=typeof e==`function`?e:li(+e),u(),l):o},l.radius=function(t){return arguments.length?(e=typeof t==`function`?t:li(+t),u(),l):e},l.x=function(e){return arguments.length?(t=+e,l):t},l.y=function(e){return arguments.length?(n=+e,l):n},l.z=function(e){return arguments.length?(r=+e,l):r},l}function Oi(e){Ai(e);let t=ki(e);return e.on=t.on,e.off=t.off,e.fire=t.fire,e}function ki(e){let t=Object.create(null);return{on:function(n,r,i){if(typeof r!=`function`)throw Error(`callback is expected to be a function`);let a=t[n];return a||=t[n]=[],a.push({callback:r,ctx:i}),e},off:function(n,r){if(n===void 0)return t=Object.create(null),e;if(t[n]){if(typeof r!=`function`)delete t[n];else{let e=t[n];for(let t=0;t<e.length;++t)e[t].callback===r&&e.splice(t,1)}}return e},fire:function(n){let r=t[n];if(!r)return e;let i;arguments.length>1&&(i=Array.prototype.slice.call(arguments,1));for(let e=0;e<r.length;++e){let t=r[e];t.callback.apply(t.ctx,i)}return e}}}function Ai(e){if(!e)throw Error(`Eventify cannot use falsy object as events subject`);let t=[`on`,`fire`,`off`];for(let n=0;n<t.length;++n)if(e.hasOwnProperty(t[n]))throw Error(`Subject cannot be eventified, since it already has property '`+t[n]+`'`)}var ji=Mi;function Mi(e){if(e||={},`uniqueLinkId`in e&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n",`
|
|
2
2
|
`,`Note: there is also change in default behavior: From now on each graph
|
|
3
3
|
is considered to be not a multigraph by default (each edge is unique).`),e.multigraph=e.uniqueLinkId),e.multigraph===void 0&&(e.multigraph=!1),typeof Map!=`function`)throw Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var t=new Map,n=new Map,r={},i=0,a=e.multigraph?b:y,o=[],s=ce,c=ce,l=ce,u=ce,d={version:20,addNode:h,addLink:v,removeLink:ee,removeNode:_,getNode:g,getNodeCount:x,getLinkCount:S,getEdgeCount:S,getLinksCount:S,getNodesCount:x,getLinks:C,forEachNode:de,forEachLinkedNode:ae,forEachLink:ie,beginUpdate:l,endUpdate:u,clear:re,hasLink:w,hasNode:g,getLink:w,getLinkById:ne};return Oi(d),f(),d;function f(){var e=d.on;d.on=t;function t(){return d.beginUpdate=l=le,d.endUpdate=u=ue,s=p,c=m,d.on=e,e.apply(d,arguments)}}function p(e,t){o.push({link:e,changeType:t})}function m(e,t){o.push({node:e,changeType:t})}function h(e,n){if(e===void 0)throw Error(`Invalid node identifier`);l();var r=g(e);return r?(r.data=n,c(r,`update`)):(r=new Ni(e,n),c(r,`add`)),t.set(e,r),u(),r}function g(e){return t.get(e)}function _(e){var n=g(e);if(!n)return!1;l();var r=n.links;return r&&(r.forEach(te),n.links=null),t.delete(e),c(n,`remove`),u(),!0}function v(e,t,r){l();var i=g(e)||h(e),o=g(t)||h(t),c=a(e,t,r),d=n.has(c.id);return n.set(c.id,c),Pi(i,c),e!==t&&Pi(o,c),s(c,d?`update`:`add`),u(),c}function y(e,t,r){var i=Ii(e,t),a=n.get(i);return a?(a.data=r,a):new Fi(e,t,r,i)}function b(e,t,n){var i=Ii(e,t),a=r.hasOwnProperty(i);if(a||w(e,t)){a||(r[i]=0);var o=`@`+ ++r[i];i=Ii(e+o,t+o)}return new Fi(e,t,n,i)}function x(){return t.size}function S(){return n.size}function C(e){var t=g(e);return t?t.links:null}function ee(e,t){return t!==void 0&&(e=w(e,t)),te(e)}function te(e){if(!e||!n.get(e.id))return!1;l(),n.delete(e.id);var t=g(e.fromId),r=g(e.toId);return t&&t.links.delete(e),r&&r.links.delete(e),s(e,`remove`),u(),!0}function w(e,t){if(e!==void 0&&t!==void 0)return n.get(Ii(e,t))}function ne(e){if(e!==void 0)return n.get(e)}function re(){l(),de(function(e){_(e.id)}),u()}function ie(e){if(typeof e==`function`)for(var t=n.values(),r=t.next();!r.done;){if(e(r.value))return!0;r=t.next()}}function ae(e,t,n){var r=g(e);if(r&&r.links&&typeof t==`function`)return n?se(r.links,e,t):oe(r.links,e,t)}function oe(e,n,r){for(var i,a=e.values(),o=a.next();!o.done;){var s=o.value,c=s.fromId===n?s.toId:s.fromId;if(i=r(t.get(c),s),i)return!0;o=a.next()}}function se(e,n,r){for(var i,a=e.values(),o=a.next();!o.done;){var s=o.value;if(s.fromId===n&&(i=r(t.get(s.toId),s),i))return!0;o=a.next()}}function ce(){}function le(){i+=1}function ue(){--i,i===0&&o.length>0&&(d.fire(`changed`,o),o.length=0)}function de(e){if(typeof e!=`function`)throw Error(`Function is expected to iterate over graph nodes. You passed `+e);for(var n=t.values(),r=n.next();!r.done;){if(e(r.value))return!0;r=n.next()}}}function Ni(e,t){this.id=e,this.links=null,this.data=t}function Pi(e,t){e.links?e.links.add(t):e.links=new Set([t])}function Fi(e,t,n,r){this.fromId=e,this.toId=t,this.data=n,this.id=r}function Ii(e,t){return e.toString()+`👉 `+t.toString()}var Li=t(((e,t)=>{t.exports=function(e){return e===0?`x`:e===1?`y`:e===2?`z`:`c`+(e+1)}})),Ri=t(((e,t)=>{var n=Li();t.exports=function(e){return t;function t(t,r){let i=r&&r.indent||0,a=r&&r.join!==void 0?r.join:`
|
|
4
4
|
`,o=Array(i+1).join(` `),s=[];for(let r=0;r<e;++r){let e=n(r),i=r===0?``:o;s.push(i+t.replace(/{var}/g,e))}return s.join(a)}}})),zi=t(((e,t)=>{var n=Ri();t.exports=r,t.exports.generateCreateBodyFunctionBody=i,t.exports.getVectorCode=o,t.exports.getBodyCode=a;function r(e,t){let n=i(e,t),{Body:r}=Function(n)();return r}function i(e,t){return`
|