farming-code 2.2.28 → 2.2.29
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/README.md +9 -31
- package/README.zh_cn.md +8 -30
- package/THIRD_PARTY_NOTICES.md +25 -6
- package/backend/acp/packaged-claude-acp.js +13 -0
- package/backend/acp/packaged-codex-acp.js +2 -2
- package/backend/acp-runtime.js +37 -2
- package/backend/acp-transcript.js +174 -9
- package/backend/agent-manager.js +27 -2
- package/backend/config-manager.js +44 -0
- package/backend/data/LICENSE.agent-browser +201 -0
- package/backend/data/runtime-dependency-manifest.json +199 -0
- package/backend/data/runtime-dependency-sources.json +5 -0
- package/backend/executable-discovery.js +7 -0
- package/backend/farming-agent-bootstrap.zh_cn.md +4 -2
- package/backend/farming-app-cli.js +160 -64
- package/backend/farming-cli.js +5 -3
- package/backend/index-html.js +13 -0
- package/backend/main-agent-skills.js +6 -10
- package/backend/npm-update-helper.js +43 -6
- package/backend/provider-adapters.js +10 -0
- package/backend/runtime-dependency-manager.js +759 -0
- package/backend/runtime-executable-invocation.js +20 -0
- package/backend/server-process-identity.js +47 -0
- package/backend/server.js +140 -157
- package/backend/slash-command-discovery.js +138 -1
- package/backend/storage-layout.js +15 -0
- package/backend/update-service.js +27 -1
- package/config/farming.install.env.example +4 -0
- package/dist/acp/LICENSE.claude-agent-acp +191 -0
- package/dist/acp/LICENSE.claude-agent-sdk +1 -0
- package/dist/acp/claude-agent-acp-0.59.0.mjs +41606 -0
- package/dist/assets/{App-CM7Cy-l4.css → App-BKNUILuL.css} +1 -1
- package/dist/assets/App-Ex2oVVXO.js +693 -0
- package/dist/assets/{FileEditorMarkdownPreview-DYOMm-b1.js → FileEditorMarkdownPreview-Cs9cLv8a.js} +1 -1
- package/dist/assets/FileEditorPane-CNtuGjQ3.js +2 -0
- package/dist/assets/IconGlyphs-BClgag6E.js +1 -0
- package/dist/assets/ProjectFilesSection-Cf2BEcAN.js +12 -0
- package/dist/assets/ReviewPage-BRuxFaH5.js +3 -0
- package/dist/assets/code-dark-BEZTQwYZ.css +1 -0
- package/dist/assets/{index-BzQO3pUr.js → index-CQNaZc3l.js} +2 -2
- package/dist/assets/main-DK9Sy7-c.css +1 -0
- package/dist/assets/{workspace-editor-monaco-tXA-udGx.js → workspace-editor-monaco-CJNwbpCy.js} +1 -1
- package/dist/assets/workspace-editor-monaco-CO9w8YV0.js +1 -0
- package/dist/assets/workspace-view-state-BjKPYp0E.js +7 -0
- package/dist/index.html +32 -3
- package/extensions/browser/backend/agent-browser-runtime.js +1041 -0
- package/extensions/browser/backend/browser-mcp-server.js +352 -0
- package/extensions/browser/backend/browser-resource-manager.js +899 -114
- package/extensions/browser/backend/browser-resource-store.js +47 -6
- package/extensions/browser/backend/browser-router.js +7 -2
- package/extensions/browser/backend/executable-discovery.js +146 -13
- package/extensions/browser/bin/farming-browser +384 -30
- package/extensions/browser/frontend/BrowserSidebarPortals.tsx +17 -19
- package/extensions/browser/frontend/BrowserViewer.tsx +217 -46
- package/extensions/browser/frontend/browser.css +68 -17
- package/extensions/browser/frontend/types.ts +6 -0
- package/extensions/browser/frontend/useBrowserResources.ts +10 -3
- package/index.html +31 -2
- package/package.json +10 -6
- package/shared/backend-connection-status.d.ts +12 -0
- package/shared/backend-connection-status.js +35 -4
- package/backend/agent-activity.js +0 -35
- package/dist/assets/App-CPG4WcjO.js +0 -658
- package/dist/assets/FileEditorPane-DXXq82aM.js +0 -2
- package/dist/assets/IconGlyphs-DrdPjYXr.js +0 -1
- package/dist/assets/ProjectFilesSection-CP66XVPl.js +0 -12
- package/dist/assets/ReviewPage-w21MEPD6.js +0 -3
- package/dist/assets/code-dark-BDjwj7Um.css +0 -1
- package/dist/assets/main-BlVUXfxa.css +0 -1
- package/dist/assets/workspace-editor-monaco-CFEfFNcA.js +0 -1
- package/dist/assets/workspace-view-state-BS_V8JVs.js +0 -7
- package/extensions/browser/backend/cdp-browser-runtime.js +0 -648
- package/extensions/browser/backend/cdp-client.js +0 -167
- /package/dist/acp/{codex-acp-1.1.4.js → codex-acp-1.1.4.mjs} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./chunk-DECur_0Z.js";import{i as r,n as i,t as a}from"./jsx-runtime-BthL93pI.js";import{t as o}from"./react-dom-gtU6X-Hj.js";import{a as s,b as c,d as l,g as u,h as d,r as f,t as p,u as m}from"./workspace-view-state-BjKPYp0E.js";import{$ as h,F as g,G as _,K as v,Q as y,St as b,X as x,Z as S,_ as C,at as w,bt as T,ct as E,dt as D,et as O,f as k,ft as A,gt as j,ht as M,i as N,it as P,lt as ee,m as te,mt as ne,n as F,o as re,ot as ie,p as ae,pt as I,q as oe,r as se,st as L,t as ce,u as le,ut as ue,x as de,y as fe,yt as pe}from"./file-icons-BOlcJ0ZF.js";import{D as me,E as he,g as R,h as ge,v as z}from"./IconGlyphs-BClgag6E.js";import{u as _e}from"./workspace-working-copy-C3FSR3N6.js";import{t as ve}from"./useWorkspaceMenuKeyboard-Bpy_s69Z.js";var B=t(r()),V=a();function ye(e){return{"--change-indent":`${18+e*12}px`,"--change-guide-width":`${e*12}px`}}function be(e){return e.sort((e,t)=>e.type===`directory`&&t.type!==`directory`?-1:e.type!==`directory`&&t.type===`directory`?1:e.name.localeCompare(t.name)||e.path.localeCompare(t.path)),e.forEach(e=>{e.type===`directory`&&be(e.children)}),e}function xe(e){return e.reduce((e,t)=>t.type===`file`?e+1:(t.descendantCount=+!!t.change+xe(t.children),e+t.descendantCount),0)}function Se(e){return e.map(e=>{if(e.type===`file`)return e;let t={...e,children:Se(e.children)};for(;!t.change&&t.children.length===1&&t.children[0]?.type===`directory`&&!t.children[0].change;){let e=t.children[0];t={...e,displayName:`${t.displayName??t.name}/${e.displayName??e.name}`}}return t})}function Ce(e,t){let n=[],r=new Map([[``,n]]),i=new Map,a=(e,n,a)=>{let o=i.get(e);if(o)return o;let s=[],c={id:`${t}:dir:${e}`,name:a,path:e,type:`directory`,children:s,descendantCount:0};return i.set(e,c),r.set(e,s),r.get(n)?.push(c),c};e.forEach(e=>{let n=e.path.replace(/\/+$/,``),o=n.split(`/`).filter(Boolean);if(o.length===0)return;let s=``,c=e.type===`directory`||e.path.endsWith(`/`),l=c?o.length:o.length-1;for(let e=0;e<l;e+=1){let t=o[e];if(!t)continue;let n=o.slice(0,e+1).join(`/`);a(n,s,t),s=n}if(c){let t=i.get(n);t&&(t.change=e);return}r.get(s)?.push({id:`${t}:file:${S(e)}`,name:o[o.length-1]||e.name,path:e.path,type:`file`,change:e})});let o=Se(be(n));return xe(o),o}function we({activeFilePath:e,change:t,copy:n,onOpenChange:r}){let i=e===t.path,a=n.gitStatus(t.gitStatus),o=t.gitStatus===`untracked`?``:t.gitStatusLabel,s=t.previousPath?x(t):``;return(0,V.jsx)(`div`,{className:`code-file-change-row ${i?`active`:``}`,"data-testid":`code-file-change-row`,"data-file-path":t.path,"data-file-type":`file`,title:y(t,a),children:(0,V.jsxs)(`button`,{type:`button`,className:`code-file-change-main`,onClick:()=>r(t),children:[(0,V.jsx)(`span`,{className:`code-file-chevron placeholder`,"aria-hidden":`true`}),(0,V.jsx)(`img`,{className:`code-file-type-icon file`,src:F(t.path),alt:``,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`code-file-change-name`,children:t.name}),(0,V.jsx)(`span`,{className:`code-file-change-path`,children:s}),(0,V.jsx)(`span`,{className:`code-file-change-status ${t.gitStatus}`,title:a,children:o})]})},S(t))}function Te({activeFilePath:e,copy:t,depth:n,nodes:r,openDirectoryIds:i,onOpenChange:a,onToggleDirectory:o}){return(0,V.jsx)(V.Fragment,{children:r.map(r=>{if(r.type===`file`)return(0,V.jsx)(`div`,{style:ye(n),children:(0,V.jsx)(we,{activeFilePath:e,change:r.change,copy:t,onOpenChange:a})},r.id);let s=r.children.length>0,c=s&&i.has(r.id);return(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`code-file-change-row directory`,"data-testid":`code-file-change-directory-row`,"data-file-path":r.path,"data-file-type":`directory`,title:r.path,style:ye(n),children:(0,V.jsxs)(`button`,{type:`button`,className:`code-file-change-main directory`,"aria-expanded":s?c:void 0,onClick:()=>{s&&o(r.id)},children:[(0,V.jsx)(`span`,{className:`code-file-chevron ${s?c?`expanded`:`collapsed`:`placeholder`}`,"aria-hidden":`true`,children:s?c?(0,V.jsx)(R,{}):(0,V.jsx)(z,{}):null}),(0,V.jsx)(`span`,{className:`code-file-change-name`,children:r.displayName??r.name}),(0,V.jsx)(`span`,{className:`code-file-change-status directory`,children:r.descendantCount||``})]})}),c&&(0,V.jsx)(Te,{activeFilePath:e,copy:t,depth:n+1,nodes:r.children,openDirectoryIds:i,onOpenChange:a,onToggleDirectory:o})]},r.id)})})}function Ee({activeFilePath:e,projectWorkspace:t,changes:n,collapsed:r,copy:a,projectId:o,refreshing:s,onOpenChange:c,onToggleCollapsed:l}){let[u,d]=(0,B.useState)(!0),[f,p]=(0,B.useState)(()=>new Set),m=(0,B.useMemo)(()=>n.items.filter(e=>e.gitStatus!==`untracked`),[n.items]),h=(0,B.useMemo)(()=>n.items.filter(e=>e.gitStatus===`untracked`),[n.items]),g=(0,B.useMemo)(()=>Ce(m,`tracked`),[m]),_=(0,B.useMemo)(()=>Ce(h,`untracked`),[h]),v=s||n.loading,y=v?`refreshing`:n.error?`stale`:`refreshed`;if(n.items.length===0&&!n.error)return null;let b=()=>{r&&n.refreshChanges(),l()},x=()=>{d(e=>(e&&n.refreshChanges(),!e))},S=e=>{p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},C=e=>{let n=new URLSearchParams({root:t,scope:e});e===`untracked`&&n.set(`modifiedWithinDays`,`3`),window.open(i(`/review?${n.toString()}`),`_blank`,`noopener,noreferrer`)};return(0,V.jsxs)(`div`,{className:`code-file-changes-section`,"data-testid":`code-file-changes-section`,"data-project-id":o,"aria-label":a.changedFiles,"aria-busy":v,children:[m.length>0&&(0,V.jsxs)(`div`,{className:`code-file-change-group tracked ${r?`collapsed`:``}`,"data-testid":`code-file-change-tracked-group`,children:[(0,V.jsxs)(`div`,{className:`code-file-change-group-header`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`code-file-change-group-toggle`,"aria-expanded":!r,onClick:b,children:[(0,V.jsx)(`span`,{className:`code-file-section-chevron ${r?`collapsed`:`expanded`}`,"aria-hidden":`true`,children:r?(0,V.jsx)(z,{}):(0,V.jsx)(R,{})}),(0,V.jsx)(`span`,{children:a.changes}),(0,V.jsx)(`span`,{className:`code-file-changes-count ${y}`,"data-testid":`code-file-changes-tracked-count`,"data-refresh-state":y,"aria-label":v?a.refreshingFiles:void 0,title:n.error??void 0,children:v?(0,V.jsx)(`span`,{className:`code-file-changes-count-loader`,"aria-hidden":`true`,children:`···`}):m.length})]}),(0,V.jsx)(`button`,{type:`button`,className:`code-file-change-review`,onClick:()=>C(`tracked`),children:a.reviewChanges})]}),!r&&(0,V.jsx)(Te,{activeFilePath:e,copy:a,depth:0,nodes:g,openDirectoryIds:f,onOpenChange:c,onToggleDirectory:S})]}),h.length>0&&(0,V.jsxs)(`div`,{className:`code-file-change-group untracked ${u?`collapsed`:``}`,"data-testid":`code-file-change-untracked-group`,children:[(0,V.jsxs)(`div`,{className:`code-file-change-group-header`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`code-file-change-group-toggle`,"aria-expanded":!u,onClick:x,children:[(0,V.jsx)(`span`,{className:`code-file-section-chevron ${u?`collapsed`:`expanded`}`,"aria-hidden":`true`,children:u?(0,V.jsx)(z,{}):(0,V.jsx)(R,{})}),(0,V.jsx)(`span`,{children:a.untrackedChanges}),(0,V.jsx)(`span`,{className:`code-file-changes-count ${y}`,"data-testid":`code-file-changes-untracked-count`,"data-refresh-state":y,"aria-label":v?a.refreshingFiles:void 0,title:n.error??void 0,children:v?(0,V.jsx)(`span`,{className:`code-file-changes-count-loader`,"aria-hidden":`true`,children:`···`}):(0,V.jsxs)(V.Fragment,{children:[h.length,n.truncated?`+`:``]})})]}),(0,V.jsx)(`button`,{type:`button`,className:`code-file-change-review`,onClick:()=>C(`untracked`),children:a.reviewChanges})]}),!u&&(0,V.jsx)(Te,{activeFilePath:e,copy:a,depth:0,nodes:_,openDirectoryIds:f,onOpenChange:c,onToggleDirectory:S})]}),n.error&&(0,V.jsx)(`div`,{className:`code-file-changes-status error`,"data-testid":`code-file-changes-error`,children:n.error})]})}function De(e){let t=e.trim().replace(/^\.\/+/,``);if(!t)return null;let n=t.match(/^(.+?)#L(\d+)(?:C(\d+))?$/i);if(n)return{path:n[1]||``,lineNumber:Number(n[2]),column:n[3]?Number(n[3]):void 0};let r=t.match(/^(.+?):(\d+)(?::(\d+))?$/);return r?{path:r[1]||``,lineNumber:Number(r[2]),column:r[3]?Number(r[3]):void 0}:null}function Oe(e){let t=e.ranges[0];return t?{lineNumber:e.lineNumber,column:t.start+1,endColumn:Math.max(t.start+1,t.end+1)}:{lineNumber:e.lineNumber}}function ke(e){return e.kind===`path`?{path:e.path}:{path:e.path,target:Oe(e)}}function Ae(e){let t=De(e);return t?{path:t.path,target:{lineNumber:t.lineNumber,column:t.column}}:null}function je({active:e,activeMatchIndex:t,jumpTarget:n,listboxId:r}){if(e)return n?`${r}-jump`:t>=0?`${r}-${t}`:void 0}function Me(e,t){let n=t.trim().replace(/^\.\/+/,``).toLowerCase();if(!e||!n)return null;let r=e.toLowerCase().indexOf(n);return r===-1?null:{start:r,end:r+n.length}}function Ne(e,t){if(t===0)return!0;let n=e[t-1]??``,r=e[t]??``;return/[-_\s./\\]/.test(n)?!0:/[a-z0-9]/.test(n)&&/[A-Z]/.test(r)}function Pe(e,t,n){let r=[],i=0;for(let a=0;a<e.length&&i<t.length;a+=1)n&&!Ne(e,a)||e[a]?.toLowerCase()===t[i]&&(r.push({start:a,end:a+1}),i+=1);return i===t.length?r:[]}function Fe(e,t){let n=t.trim().replace(/^\.\/+/,``).toLowerCase();if(!e||!n||n.length>6)return[];let r=Pe(e,n,!0);return r.length>0?r:Pe(e,n,!1)}function Ie(e,t){let n=[];return t.map(t=>({start:Math.max(0,Math.min(e.length,t.start)),end:Math.max(0,Math.min(e.length,t.end))})).filter(e=>e.end>e.start).sort((e,t)=>e.start-t.start||e.end-t.end).forEach(e=>{let t=n[n.length-1];if(t&&e.start<=t.end){t.end=Math.max(t.end,e.end);return}n.push(e)}),n}function Le(e,t){let n=Me(e,t);return n?[n]:Fe(e,t)}function Re(e,t=[]){let n=Ie(e,t);if(n.length===0)return e;let r=[],i=0;return n.forEach((t,n)=>{t.start>i&&r.push(e.slice(i,t.start)),r.push((0,V.jsx)(`span`,{className:`code-file-search-highlight`,children:e.slice(t.start,t.end)},`${t.start}:${t.end}:${n}`)),i=t.end}),i<e.length&&r.push(e.slice(i)),r}function ze(e,t){return Re(e,Le(e,t))}function Be(e){let t=e.replace(/\\/g,`/`),n=t.lastIndexOf(`/`);return n===-1?{directory:``,name:t}:{directory:t.slice(0,n),name:t.slice(n+1)||t}}function Ve(e){if(!e||typeof window>`u`)return null;let t=e.getBoundingClientRect();if(T()){let n=window.visualViewport,r=n?.offsetTop??0,i=n?.offsetLeft??0,a=n?.width??window.innerWidth,o=n?.height??window.innerHeight,s=e.closest(`.code-sidebar`)?.getBoundingClientRect(),c=Math.max(i+6,(s?.left??i)+6),l=Math.min(i+a-6,(s?.right??i+a)-6),u=r+o-t.bottom-10,d=t.top-r-10,f=u<120&&d>u,p=Math.max(72,Math.min(320,f?d:u));return{left:c,top:f?Math.max(r+6,t.top-p-4):Math.max(r+6,t.bottom+4),width:Math.max(180,l-c),maxHeight:p}}let n=Math.max(document.documentElement.clientWidth,window.innerWidth||0),r=Math.max(document.documentElement.clientHeight,window.innerHeight||0),i=Math.max(240,n-24),a=Math.min(620,i,Math.max(420,t.width)),o=Math.max(12,Math.min(t.left,n-a-12)),s=Math.min(t.bottom+6,r-12);return{left:o,top:s,width:a,maxHeight:Math.max(168,Math.min(420,r-s-12))}}function He({path:e,query:t}){let{directory:n,name:r}=Be(e);return(0,V.jsxs)(`span`,{className:`code-file-search-copy`,children:[(0,V.jsx)(`span`,{className:`code-file-search-name`,children:ze(r,t)}),n&&(0,V.jsx)(`span`,{className:`code-file-search-directory`,children:ze(n,t)})]})}function Ue({activeMatchIndex:e,anchorRef:t,copy:n,containerRef:r,error:i,jumpTarget:a,listboxId:o,loading:s,matches:c,openFileError:l,query:u,showIgnoredSearch:d,timeoutMs:f,truncated:p,onOpenJumpQuery:m,onOpenMatch:h,onSearchIgnored:g,onSelectMatchIndex:_}){let[v,y]=(0,B.useState)(()=>Ve(t.current)),b=(0,B.useCallback)(()=>{y(Ve(t.current))},[t]);return(0,B.useLayoutEffect)(()=>{b();let e=t.current?.closest(`.code-project-list`);return window.addEventListener(`resize`,b),window.addEventListener(`scroll`,b,!0),window.visualViewport?.addEventListener(`resize`,b),window.visualViewport?.addEventListener(`scroll`,b),e?.addEventListener(`scroll`,b,{passive:!0}),()=>{window.removeEventListener(`resize`,b),window.removeEventListener(`scroll`,b,!0),window.visualViewport?.removeEventListener(`resize`,b),window.visualViewport?.removeEventListener(`scroll`,b),e?.removeEventListener(`scroll`,b)}},[t,b]),(0,V.jsx)(`div`,{ref:r,id:o,className:`code-file-search-results`,"data-testid":`code-file-search-results`,role:`listbox`,"aria-label":n.searchFilesOrJump,style:v?{left:v.left,top:v.top,width:v.width,maxHeight:v.maxHeight}:void 0,children:a?l?(0,V.jsx)(`div`,{className:`code-file-search-state error`,children:l}):(0,V.jsxs)(`button`,{id:`${o}-jump`,type:`button`,className:`code-file-search-result jump active`,onClick:()=>m(u),role:`option`,"aria-selected":`true`,children:[(0,V.jsx)(`span`,{className:`code-file-search-kind`,children:n.go}),(0,V.jsx)(He,{path:a.path,query:u}),(0,V.jsx)(`span`,{className:`code-file-search-line`,children:a.lineNumber})]}):s?(0,V.jsx)(`div`,{className:`code-file-search-state`,children:n.searching}):i?(0,V.jsx)(`div`,{className:`code-file-search-state error`,children:i}):c.length===0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`code-file-search-state`,children:n.noMatches}),d&&(0,V.jsx)(`button`,{type:`button`,className:`code-file-search-ignored-action`,onClick:g,children:n.searchIgnoredFolders}),p&&(0,V.jsx)(`div`,{className:`code-file-search-state muted`,children:n.searchIncomplete(f)})]}):(0,V.jsxs)(V.Fragment,{children:[c.map((t,r)=>(0,V.jsxs)(`button`,{id:`${o}-${r}`,type:`button`,className:`code-file-search-result ${r===e?`active`:``}`,onPointerMove:e=>{e.pointerType===`mouse`&&_(r)},onClick:()=>h(t),title:t.entryType===`directory`?t.path:`${t.path}:${t.lineNumber}`,role:`option`,"aria-selected":r===e,children:[(0,V.jsx)(`img`,{className:`code-file-type-icon ${t.entryType===`directory`?`folder`:`file`}`,src:t.entryType===`directory`?ce(t.path,!1):F(t.path),alt:``,"aria-hidden":`true`}),(0,V.jsx)(He,{path:t.path,query:u}),t.kind===`path`?(0,V.jsx)(`span`,{className:`code-file-search-kind`,children:t.entryType===`directory`?n.folder:n.file}):(0,V.jsx)(`span`,{className:`code-file-search-line`,children:t.lineNumber}),t.lines&&(0,V.jsx)(`span`,{className:`code-file-search-preview`,children:Re(t.lines,t.ranges)})]},`${t.path}:${t.lineNumber}:${r}`)),d&&(0,V.jsx)(`button`,{type:`button`,className:`code-file-search-ignored-action`,onClick:g,children:n.searchIgnoredFolders}),p&&(0,V.jsx)(`div`,{className:`code-file-search-state muted`,children:n.moreMatchesOmitted})]})})}var We=12;function Ge(e,t){return e===`git`?t.containsUncommittedChanges:e===`external`?t.changedOnDisk:e===`dirty`?t.unsavedChanges:t.changedOnDisk}function H(e){return{"--file-indent":`${6+e*We}px`,"--file-status-indent":`${24+e*We}px`,"--file-guide-width":`${e*We}px`,"--file-depth":e}}function Ke(e){return e===`untracked`?void 0:e}function qe(e){let t=Ke(e);return t?`code-file-descendant-status ${t}`:``}function Je(e,t){for(let n of e)if(ne(t,n))return!0;return!1}function Ye({activeFilePath:e,editorDirtyFilePaths:t,editorExternalChangedFilePaths:n,openFilePendingPath:r,item:i,isFocused:a,isOpen:o,isSelected:s}){let c=i.type===`directory`,l=e===i.path,u=c&&i.loading===!0,d=!c&&r===i.path,f=!c&&t.has(i.path),p=!c&&n.has(i.path),m=c&&Je(t,i.path),h=c&&Je(n,i.path),g=Ke(i.gitStatus),_=Ke(i.descendantGitStatus),v=g?i.gitStatusLabel:void 0,y=!!g,b=c&&!!_,x=c&&(b||m||h),S=_??(h?`external`:m?`dirty`:void 0),C=_?qe(_):S?`code-file-descendant-status ${S}`:``,w=b?`git`:h?`external`:m?`dirty`:null,T=p?`external`:f?`dirty`:void 0,E=T?`code-file-changed ${T}`:``,D=p?`external`:f?`dirty`:null,O=g?`code-file-git-status ${g}`:``;return{active:l,chevronState:c?o?`expanded`:`collapsed`:`placeholder`,directoryLoading:u,directoryDotClassName:C,directoryDotKind:S,directoryDotTitleKind:w,editorDirty:f,editorExternalChanged:p,fileChangedClassName:E,fileChangedKind:T,fileChangedTitleKind:D,fileOpening:d,hasDescendantGitStatus:b,hasEditorDirtyDescendant:m,hasEditorExternalChangedDescendant:h,isDirectory:c,rowClasses:[`code-file-row`,c?`directory`:`file`,l?`active`:``,f?`editor-dirty`:``,p?`editor-external-changed`:``,m?`editor-descendant-dirty`:``,h?`editor-descendant-external-changed`:``,a?`focused`:``,s?`selected`:``,u?`loading`:``,d?`opening`:``,i.ignored?`ignored`:``,i.symbolicLink?`symbolic-link`:``,i.external?`external-link`:``,i.linkError?`link-error`:``,y?`git-status`:``,g?`git-${g}`:``,b?`git-descendant`:``,_?`git-descendant-${_}`:``].filter(Boolean).join(` `),showDirectoryDot:x,visibleGitStatus:g,visibleGitStatusClassName:O,visibleGitStatusLabel:v}}function Xe({label:e,options:t,testId:n,submenuTestId:r,onOpenDialog:i,onSelect:a}){let[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(`right`),f=(0,B.useRef)(null),p=(0,B.useRef)(null),m=(0,B.useRef)(null),h=(0,B.useRef)(null),g=t.length>0,_=(0,B.useCallback)(()=>{h.current!==null&&(window.clearTimeout(h.current),h.current=null)},[]),v=(0,B.useCallback)((e=p.current)=>{if(!g)return;_();let t=e?.getBoundingClientRect();t&&t.right+156+12>window.innerWidth?l(`left`):l(`right`),s(!0)},[_,g]),y=(0,B.useCallback)(()=>{_(),h.current=window.setTimeout(()=>{s(!1),h.current=null},120)},[_]),b=(0,B.useCallback)(e=>{v(e.currentTarget.querySelector(`button`))},[v]),x=(0,B.useCallback)(()=>{window.setTimeout(()=>{m.current?.querySelector(`button:not(:disabled)`)?.focus()},0)},[]),S=(0,B.useCallback)(e=>{g&&e.key===`ArrowRight`&&(e.preventDefault(),e.stopPropagation(),v(e.currentTarget),x())},[x,g,v]),C=(0,B.useCallback)(e=>{e.key===`ArrowLeft`&&(e.preventDefault(),e.stopPropagation(),s(!1),p.current?.focus())},[]);return(0,V.jsxs)(`div`,{ref:f,className:`code-agent-launch-submenu`,onPointerEnter:b,onPointerLeave:y,onFocus:()=>_(),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||s(!1)},children:[(0,V.jsxs)(`button`,{ref:p,type:`button`,role:`menuitem`,className:`code-agent-launch-submenu-trigger`,"data-testid":n,"aria-haspopup":g?`menu`:void 0,"aria-expanded":g?o:void 0,onClick:i,onKeyDown:S,children:[(0,V.jsx)(`span`,{children:e}),g&&(0,V.jsx)(z,{className:`code-agent-launch-submenu-arrow`})]}),g&&o&&(0,V.jsx)(`div`,{ref:m,className:`code-agent-launch-submenu-panel ${c}`,"data-testid":r,role:`menu`,onPointerEnter:()=>_(),onPointerLeave:y,onKeyDown:C,children:t.map(e=>(0,V.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`agent-launch-${e.name}`,onClick:()=>a(e.command||e.name),children:[(0,V.jsx)(d,{name:e.name}),(0,V.jsx)(`span`,{children:u(e.name)})]},e.name))})]})}function Ze({copy:e,agentLaunchOptions:t,fileMenu:n,menuRef:r,onClose:i,onCloseWithFocusRestore:a,onCopyRelativePath:o,onCopyShareUrl:s,onOpenNewAgent:c,onRefreshTarget:l,onStartAgent:u,onStartOperation:d,readOnly:f=!1}){let p=ve({menuOpen:!!n,menuRef:r,onClose:i,onCloseWithFocusRestore:a});if(!n)return null;let m=n.item?.readOnly===!0,h=!f&&!m,g=!f&&(!m||n.item?.symbolicLink===!0);return(0,V.jsxs)(`div`,{ref:r,className:`code-context-menu code-file-context-menu`,"data-testid":`code-file-context-menu`,style:{left:n.x,top:n.y},role:`menu`,onKeyDown:p,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},children:[h&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,role:`menuitem`,autoFocus:!0,onClick:()=>d(`new-file`),children:e.newFile}),(0,V.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>d(`new-folder`),children:e.newFolder}),(0,V.jsx)(`div`,{className:`code-context-menu-separator`,role:`separator`}),(0,V.jsx)(Xe,{label:e.newAgent,options:t,testId:`file-new-agent-submenu-trigger`,submenuTestId:`file-new-agent-submenu`,onOpenDialog:c,onSelect:u}),(0,V.jsx)(`div`,{className:`code-context-menu-separator`,role:`separator`})]}),(0,V.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:l,children:e.refresh}),n.item&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`code-context-menu-separator`,role:`separator`}),g&&(0,V.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>d(`rename`),children:e.rename}),(0,V.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:o,children:e.copyRelativePath}),(n.item.type===`file`||n.item.type===`directory`)&&(0,V.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:s,children:e.copyShareUrl}),g&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`code-context-menu-separator`,role:`separator`}),(0,V.jsx)(`button`,{type:`button`,role:`menuitem`,className:`danger`,onClick:()=>d(`delete`),children:e.delete})]})]})]})}var Qe=220,$e=8,et=26,tt=11,nt=10;function rt(e){return e?e.type===`directory`?e.path:M(e.path):``}function it(e,t){return e===`rename`||e===`delete`?t?.name??``:``}function at(e,t){return{kind:e,item:t,parentPath:rt(t),name:it(e,t),submitting:!1}}function ot(e){if(e.kind!==`rename`||e.item?.type!==`file`)return e.name.length;let t=e.name.lastIndexOf(`.`);return t>0?t:e.name.length}function U(e){let t=e.name.trim();if(e.kind!==`rename`||e.item?.type!==`file`)return t;let n=e.item.name.lastIndexOf(`.`);if(n<=0)return t;let r=e.item.name.slice(n);return t.endsWith(`${r}${r}`)?t.slice(0,-r.length):t}function st(e,t){return e.kind!==`delete`||!e.item||t.some(t=>t.path===e.item?.path)?null:{path:e.item.path,parentDirectory:M(e.item.path),type:e.item.type,version:e.item.version}}function ct(e,t,n){if(e.kind!==`new-file`&&e.kind!==`new-folder`)return null;let r=e.parentPath?`${e.parentPath}/${t}`:t,i=n.find(e=>e.path===r),a=e.kind===`new-folder`?`directory`:`file`;return i?.type===a?i:null}function lt(e,t,n){if(e.kind!==`rename`||!e.item)return null;let r=e.item.path,i=M(r),a=i?`${i}/${t}`:t;if(a===r||n.some(e=>e.path===r))return null;let o=n.find(e=>e.path===a);return!o||o.type!==e.item.type?null:{sourcePath:r,targetPath:a,sourceDirectory:i,targetDirectory:i,sourceVersion:e.item.version,targetVersion:o.version}}function ut(e,t){switch(e.kind){case`new-file`:return t.newFile;case`new-folder`:return t.newFolder;case`rename`:return t.rename;case`delete`:return t.delete}}function dt(e,t,n,r,i,a=0){let o=n?8:4,s=n?4:2,c=a>0?nt+a*et:0,l=nt+o*et+s*tt+c;return{x:Math.max($e,Math.min(e,r-Qe-$e)),y:Math.max($e,Math.min(t,i-l-$e))}}function ft({agentId:e,copy:t,fileOperation:n,inputRef:r,onCancel:i,onInputName:a,onSubmit:o,onUpdateName:s}){return!n||n.kind===`rename`?null:(0,V.jsx)(`div`,{className:n.kind===`delete`?`code-file-operation-shell delete-confirm`:`code-file-operation-shell`,"data-testid":`code-file-operation-backdrop`,onMouseDown:e=>{e.stopPropagation(),n.kind===`delete`&&e.target===e.currentTarget&&i()},children:(0,V.jsxs)(`form`,{className:`code-file-operation-dialog`,"data-testid":`code-file-operation-dialog`,role:`dialog`,"aria-busy":n.submitting,"aria-labelledby":`code-file-operation-title`,autoComplete:`off`,onMouseDown:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),i())},onSubmit:e=>{e.preventDefault(),o()},children:[(0,V.jsx)(`label`,{id:`code-file-operation-title`,htmlFor:`code-file-operation-input`,children:ut(n,t)}),n.kind===`delete`?(0,V.jsx)(`p`,{className:`code-file-operation-text`,children:n.item?.type===`directory`?t.deleteFolderContents(n.item?.path):t.deleteFile(n.item?.path)}):(0,V.jsx)(`input`,{id:`code-file-operation-input`,"data-testid":`code-file-operation-input`,name:`farming-file-${e}-${n.kind}`,type:`text`,inputMode:`text`,ref:r,value:n.name,disabled:n.submitting,autoComplete:`off`,"aria-autocomplete":`none`,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:`done`,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-bwignore":`true`,"data-form-type":`other`,autoFocus:!0,onInput:e=>{a(e.currentTarget.value)},onChange:e=>{s(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),o())}}),(0,V.jsxs)(`div`,{className:`code-rename-actions`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:i,children:t.cancel}),(0,V.jsx)(`button`,{type:`submit`,className:n.kind===`delete`?`danger`:`primary`,disabled:n.submitting||n.kind!==`delete`&&!n.name.trim(),children:n.kind===`delete`?t.delete:t.save})]})]})})}function pt({agentId:e,copy:t,agentLaunchOptions:n,fileMenu:r,fileMenuRef:i,fileOperation:a,fileOperationInputRef:o,onCloseFileMenu:s,onCloseFileMenuWithFocusRestore:c,onCloseFileOperation:l,onCopyFileMenuPath:u,onCopyFileMenuShareUrl:d,onOpenNewAgent:f,onRefreshFileMenuTarget:p,onRememberFileOperationName:m,onStartAgent:h,onStartFileMenuOperation:g,onSubmitFileOperation:_,onUpdateFileOperationName:v,readOnly:y=!1}){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ze,{copy:t,agentLaunchOptions:n,fileMenu:r,menuRef:i,onClose:s,onCloseWithFocusRestore:c,onCopyRelativePath:u,onCopyShareUrl:d,onOpenNewAgent:f,onRefreshTarget:p,onStartAgent:h,onStartOperation:g,readOnly:y}),(0,V.jsx)(ft,{agentId:e,copy:t,fileOperation:a,inputRef:o,onCancel:l,onInputName:m,onSubmit:()=>{_()},onUpdateName:v})]})}var mt=n((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),ht=n(((e,t)=>{t.exports=mt()})),gt=(0,B.createContext)(null);function W(){let e=(0,B.useContext)(gt);if(e===null)throw Error(`No Tree Api Provided`);return e}var _t=(0,B.createContext)(null);function vt(){let e=(0,B.useContext)(_t);if(e===null)throw Error(`Provide a NodesContext`);return e}var yt=(0,B.createContext)(null);function bt(){let e=(0,B.useContext)(yt);if(e===null)throw Error(`Provide a DnDContext`);return e}var xt=(0,B.createContext)(0);function St(){(0,B.useContext)(xt)}var Ct=e({access:()=>Rt,bound:()=>wt,dfs:()=>jt,focusNextElement:()=>Nt,focusPrevElement:()=>Pt,getInsertIndex:()=>Wt,getInsertParentId:()=>qt,getTreeLinePrefix:()=>Kt,identify:()=>Bt,identifyNull:()=>zt,indexOf:()=>kt,isClosed:()=>Et,isDescendant:()=>Ot,isItem:()=>Tt,isOpenWithEmptyChildren:()=>Dt,mergeRefs:()=>Vt,noop:()=>At,safeRun:()=>Ht,waitFor:()=>Ut,walk:()=>Mt});function wt(e,t,n){return Math.max(Math.min(e,n),t)}function Tt(e){return e&&e.isLeaf}function Et(e){return e&&e.isInternal&&!e.isOpen}function Dt(e){return e&&e.isOpen&&!e.children?.length}var Ot=(e,t)=>{let n=e;for(;n;){if(n.id===t.id)return!0;n=n.parent}return!1},kt=e=>{if(!e.parent)throw Error(`Node does not have a parent`);return e.parent.children.findIndex(t=>t.id===e.id)};function At(){}function jt(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let n of e.children){let e=jt(n,t);if(e)return e}return null}function Mt(e,t){if(t(e),e.children)for(let n of e.children)Mt(n,t)}function Nt(e){let t=Lt(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=Ft(t,r);break}n?.focus()}function Pt(e){let t=Lt(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=It(t,r);break}n?.focus()}function Ft(e,t){return t+1<e.length?e[t+1]:e[0]}function It(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Lt(e){return Array.from(document.querySelectorAll(`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)`)).filter(t=>t===e||!e.contains(t))}function Rt(e,t){return typeof t==`boolean`?t:typeof t==`string`?e[t]:t(e)}function zt(e){return e===null?null:Bt(e)}function Bt(e){return typeof e==`string`?e:e.id}function Vt(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}function Ht(e,...t){if(e)return e(...t)}function Ut(e){return new Promise((t,n)=>{let r=0;function i(){r+=1,r===100&&n(),e()?t():setTimeout(i,10)}i()})}function Wt(e){let t=e.focusedNode;return t?t.isOpen?0:t.parent?t.childIndex+1:0:e.root.children?.length??0}var Gt={last:`└ `,middle:`├ `,pipe:`│ `,blank:` `};function Kt(e,t={}){let n=Object.assign(Object.assign({},Gt),t);if(e.level===0)return``;let r=e.nextSibling===null?n.last:n.middle,i=e.parent;for(;i&&i.level>0;)r=(i.nextSibling===null?n.blank:n.pipe)+r,i=i.parent;return r}function qt(e){let t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}var Jt={display:`flex`,alignItems:`center`,zIndex:1},Yt={flex:1,height:`2px`,background:`#4B91E2`,borderRadius:`1px`},Xt={width:`4px`,height:`4px`,boxShadow:`0 0 0 3px #4B91E2`,borderRadius:`50%`},Zt=B.memo(function({top:e,left:t,indent:n}){let r={position:`absolute`,pointerEvents:`none`,top:e-2+`px`,left:t+`px`,right:n+`px`};return(0,V.jsxs)(`div`,{style:Object.assign(Object.assign({},Jt),r),children:[(0,V.jsx)(`div`,{style:Object.assign({},Xt)}),(0,V.jsx)(`div`,{style:Object.assign({},Yt)})]})});function Qt({node:e,attrs:t,innerRef:n,children:r}){return(0,V.jsx)(`div`,Object.assign({},t,{ref:n,onFocus:e=>e.stopPropagation(),onClick:e.handleClick,children:r}))}function $t(e){return(0,V.jsxs)(`div`,{ref:e.dragHandle,style:e.style,children:[(0,V.jsx)(`span`,{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?`🌳`:e.node.isOpen?`🗁`:`🗀`}),` `,e.node.isEditing?(0,V.jsx)(tn,Object.assign({},e)):(0,V.jsx)(en,Object.assign({},e))]})}function en(e){return(0,V.jsx)(V.Fragment,{children:(0,V.jsx)(`span`,{children:e.node.data.name})})}function tn({node:e}){let t=(0,B.useRef)();return(0,B.useEffect)(()=>{var e,n;(e=t.current)==null||e.focus(),(n=t.current)==null||n.select()},[]),(0,V.jsx)(`input`,{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:n=>{n.key===`Escape`&&e.reset(),n.key===`Enter`&&e.submit(t.current?.value||``)}})}var nn=`__REACT_ARBORIST_INTERNAL_ROOT__`;function rn(e){function t(n,r,i){let a=new an({tree:e,data:n,level:r,parent:i,id:e.accessId(n),children:null,isDraggable:e.isDraggable(n),rowIndex:null}),o=e.accessChildren(n);return o&&(a.children=o.map(e=>t(e,r+1,a))),a}let n=new an({tree:e,id:nn,data:{id:nn},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null});return n.children=(e.props.data??[]).map(e=>t(e,0,n)),n}var an=class e{constructor(e){this.handleClick=e=>{(e.metaKey||e.ctrlKey)&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():e.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=e.tree,this.id=e.id,this.data=e.data,this.level=e.level,this.children=e.children,this.parent=e.parent,this.isDraggable=e.isDraggable,this.rowIndex=e.rowIndex}get isRoot(){return this.id===nn}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return this.isLeaf?!1:this.tree.isOpen(this.id)}get isClosed(){return this.isLeaf?!1:!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isSelectable(){return this.tree.isSelectable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){return this.isSelected&&!this.prev?.isSelected}get isSelectedEnd(){return this.isSelected&&!this.next?.isSelected}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(e=>e.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){let e=this.childIndex;return this.parent?.children[e+1]??null}isAncestorOf(e){if(!e)return!1;let t=e;for(;t;){if(t.id===this.id)return!0;t=t.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(e){this.tree.submit(this,e)}reset(){this.tree.reset()}clone(){return new e(Object.assign({},this))}edit(){return this.tree.edit(this)}};function on(e){return{type:`EDIT`,id:e}}function sn(e={id:null},t){return t.type===`EDIT`?Object.assign(Object.assign({},e),{id:t.id}):e}function cn(e){return{type:`FOCUS`,id:e}}function ln(){return{type:`TREE_BLUR`}}function un(e={id:null,treeFocused:!1},t){return t.type===`FOCUS`?Object.assign(Object.assign({},e),{id:t.id,treeFocused:!0}):t.type===`TREE_BLUR`?Object.assign(Object.assign({},e),{treeFocused:!1}):e}var dn={open(e,t){return{type:`VISIBILITY_OPEN`,id:e,filtered:t}},close(e,t){return{type:`VISIBILITY_CLOSE`,id:e,filtered:t}},toggle(e,t){return{type:`VISIBILITY_TOGGLE`,id:e,filtered:t}},clear(e){return{type:`VISIBILITY_CLEAR`,filtered:e}}};function fn(e={},t){if(t.type===`VISIBILITY_OPEN`)return Object.assign(Object.assign({},e),{[t.id]:!0});if(t.type===`VISIBILITY_CLOSE`)return Object.assign(Object.assign({},e),{[t.id]:!1});if(t.type===`VISIBILITY_TOGGLE`){let n=e[t.id];return Object.assign(Object.assign({},e),{[t.id]:!n})}else if(t.type===`VISIBILITY_CLEAR`)return{};else return e}function pn(e={filtered:{},unfiltered:{}},t){return t.type.startsWith(`VISIBILITY`)?t.filtered?Object.assign(Object.assign({},e),{filtered:fn(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:fn(e.unfiltered,t)}):e}var mn=e=>({nodes:{open:{filtered:{},unfiltered:e?.initialOpenState??{}},focus:{id:null,treeFocused:!1},edit:{id:null},drag:{id:null,selectedIds:[],destinationParentId:null,destinationIndex:null},selection:{ids:new Set,anchor:null,mostRecent:null}},dnd:{cursor:{type:`none`},dragId:null,dragIds:[],parentId:null,index:-1}}),hn={clear:()=>({type:`SELECTION_CLEAR`}),only:e=>({type:`SELECTION_ONLY`,id:Bt(e)}),add:e=>({type:`SELECTION_ADD`,ids:(Array.isArray(e)?e:[e]).map(Bt)}),remove:e=>({type:`SELECTION_REMOVE`,ids:(Array.isArray(e)?e:[e]).map(Bt)}),set:e=>Object.assign({type:`SELECTION_SET`},e),mostRecent:e=>({type:`SELECTION_MOST_RECENT`,id:e===null?null:Bt(e)}),anchor:e=>({type:`SELECTION_ANCHOR`,id:e===null?null:Bt(e)})};function gn(e=mn().nodes.selection,t){let n=e.ids;switch(t.type){case`SELECTION_CLEAR`:return Object.assign(Object.assign({},e),{ids:new Set});case`SELECTION_ONLY`:return Object.assign(Object.assign({},e),{ids:new Set([t.id])});case`SELECTION_ADD`:return t.ids.length===0?e:(t.ids.forEach(e=>n.add(e)),Object.assign(Object.assign({},e),{ids:new Set(n)}));case`SELECTION_REMOVE`:return t.ids.length===0?e:(t.ids.forEach(e=>n.delete(e)),Object.assign(Object.assign({},e),{ids:new Set(n)}));case`SELECTION_SET`:return Object.assign(Object.assign({},e),{ids:t.ids,mostRecent:t.mostRecent,anchor:t.anchor});case`SELECTION_MOST_RECENT`:return Object.assign(Object.assign({},e),{mostRecent:t.id});case`SELECTION_ANCHOR`:return Object.assign(Object.assign({},e),{anchor:t.id});default:return e}}var _n={cursor(e){return{type:`DND_CURSOR`,cursor:e}},dragStart(e,t){return{type:`DND_DRAG_START`,id:e,dragIds:t}},dragEnd(){return{type:`DND_DRAG_END`}},hovering(e,t){return{type:`DND_HOVERING`,parentId:e,index:t}}};function vn(e=mn().dnd,t){switch(t.type){case`DND_CURSOR`:return Object.assign(Object.assign({},e),{cursor:t.cursor});case`DND_DRAG_START`:return Object.assign(Object.assign({},e),{dragId:t.id,dragIds:t.dragIds});case`DND_DRAG_END`:return mn().dnd;case`DND_HOVERING`:return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}var yn={position:`fixed`,pointerEvents:`none`,zIndex:100,left:0,top:0,width:`100%`,height:`100%`},bn=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t}px, ${n}px)`}},xn=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t+10}px, ${n+10}px)`}};function Sn({offset:e,mouse:t,id:n,dragIds:r,isDragging:i}){return(0,V.jsxs)(Cn,{isDragging:i,children:[(0,V.jsx)(wn,{offset:e,children:(0,V.jsx)(En,{id:n,dragIds:r})}),(0,V.jsx)(Tn,{mouse:t,count:r.length})]})}var Cn=(0,B.memo)(function(e){return e.isDragging?(0,V.jsx)(`div`,{style:yn,children:e.children}):null});function wn(e){return(0,V.jsx)(`div`,{className:`row preview`,style:bn(e.offset),children:e.children})}function Tn(e){let{count:t,mouse:n}=e;return t>1?(0,V.jsx)(`div`,{className:`selected-count`,style:xn(n),children:t}):null}var En=(0,B.memo)(function(e){let t=W(),n=t.get(e.id);return n?(0,V.jsx)(t.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*t.indent,opacity:.2,background:`transparent`},tree:t}):null});function Dn(){return Dn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Dn.apply(null,arguments)}function On(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function kn(e,t){return kn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},kn(e,t)}function An(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,kn(e,t)}var jn=Number.isNaN||function(e){return typeof e==`number`&&e!==e};function Mn(e,t){return!!(e===t||jn(e)&&jn(t))}function Nn(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!Mn(e[n],t[n]))return!1;return!0}function Pn(e,t){t===void 0&&(t=Nn);var n,r=[],i,a=!1;function o(){var o=[...arguments];return a&&n===this&&t(o,r)?i:(i=e.apply(this,o),a=!0,n=this,r=o,i)}return o}var Fn=typeof performance==`object`&&typeof performance.now==`function`?function(){return performance.now()}:function(){return Date.now()};function In(e){cancelAnimationFrame(e.id)}function Ln(e,t){var n=Fn();function r(){Fn()-n>=t?e.call(null):i.id=requestAnimationFrame(r)}var i={id:requestAnimationFrame(r)};return i}var Rn=-1;function zn(e){if(e===void 0&&(e=!1),Rn===-1||e){var t=document.createElement(`div`),n=t.style;n.width=`50px`,n.height=`50px`,n.overflow=`scroll`,document.body.appendChild(t),Rn=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Rn}var Bn=null;function Vn(e){if(e===void 0&&(e=!1),Bn===null||e){var t=document.createElement(`div`),n=t.style;n.width=`50px`,n.height=`50px`,n.overflow=`scroll`,n.direction=`rtl`;var r=document.createElement(`div`),i=r.style;return i.width=`100px`,i.height=`100px`,t.appendChild(r),document.body.appendChild(t),t.scrollLeft>0?Bn=`positive-descending`:(t.scrollLeft=1,Bn=t.scrollLeft===0?`negative`:`positive-ascending`),document.body.removeChild(t),Bn}return Bn}var Hn=150,Un=function(e,t){return e};function Wn(e){var t,n=e.getItemOffset,r=e.getEstimatedTotalSize,i=e.getItemSize,a=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,s=e.getStopIndexForStartIndex,c=e.initInstanceProps,l=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return t=function(e){An(t,e);function t(t){var r=e.call(this,t)||this;return r._instanceProps=c(r.props,On(r)),r._outerRef=void 0,r._resetIsScrollingTimeoutId=null,r.state={instance:On(r),isScrolling:!1,scrollDirection:`forward`,scrollOffset:typeof r.props.initialScrollOffset==`number`?r.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},r._callOnItemsRendered=void 0,r._callOnItemsRendered=Pn(function(e,t,n,i){return r.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:t,visibleStartIndex:n,visibleStopIndex:i})}),r._callOnScroll=void 0,r._callOnScroll=Pn(function(e,t,n){return r.props.onScroll({scrollDirection:e,scrollOffset:t,scrollUpdateWasRequested:n})}),r._getItemStyle=void 0,r._getItemStyle=function(e){var t=r.props,a=t.direction,o=t.itemSize,s=t.layout,c=r._getItemStyleCache(l&&o,l&&s,l&&a),u;if(c.hasOwnProperty(e))u=c[e];else{var d=n(r.props,e,r._instanceProps),f=i(r.props,e,r._instanceProps),p=a===`horizontal`||s===`horizontal`,m=a===`rtl`,h=p?d:0;c[e]=u={position:`absolute`,left:m?void 0:h,right:m?h:void 0,top:p?0:d,height:p?`100%`:f,width:p?f:`100%`}}return u},r._getItemStyleCache=void 0,r._getItemStyleCache=Pn(function(e,t,n){return{}}),r._onScrollHorizontal=function(e){var t=e.currentTarget,n=t.clientWidth,i=t.scrollLeft,a=t.scrollWidth;r.setState(function(e){if(e.scrollOffset===i)return null;var t=r.props.direction,o=i;if(t===`rtl`)switch(Vn()){case`negative`:o=-i;break;case`positive-descending`:o=a-n-i;break}return o=Math.max(0,Math.min(o,a-n)),{isScrolling:!0,scrollDirection:e.scrollOffset<o?`forward`:`backward`,scrollOffset:o,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._onScrollVertical=function(e){var t=e.currentTarget,n=t.clientHeight,i=t.scrollHeight,a=t.scrollTop;r.setState(function(e){if(e.scrollOffset===a)return null;var t=Math.max(0,Math.min(a,i-n));return{isScrolling:!0,scrollDirection:e.scrollOffset<t?`forward`:`backward`,scrollOffset:t,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._outerRefSetter=function(e){var t=r.props.outerRef;r._outerRef=e,typeof t==`function`?t(e):typeof t==`object`&&t&&t.hasOwnProperty(`current`)&&(t.current=e)},r._resetIsScrollingDebounced=function(){r._resetIsScrollingTimeoutId!==null&&In(r._resetIsScrollingTimeoutId),r._resetIsScrollingTimeoutId=Ln(r._resetIsScrolling,Hn)},r._resetIsScrolling=function(){r._resetIsScrollingTimeoutId=null,r.setState({isScrolling:!1},function(){r._getItemStyleCache(-1,null)})},r}t.getDerivedStateFromProps=function(e,t){return Gn(e,t),u(e),null};var d=t.prototype;return d.scrollTo=function(e){e=Math.max(0,e),this.setState(function(t){return t.scrollOffset===e?null:{scrollDirection:t.scrollOffset<e?`forward`:`backward`,scrollOffset:e,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},d.scrollToItem=function(e,t){t===void 0&&(t=`auto`);var n=this.props,r=n.itemCount,i=n.layout,o=this.state.scrollOffset;e=Math.max(0,Math.min(e,r-1));var s=0;if(this._outerRef){var c=this._outerRef;s=i===`vertical`?c.scrollWidth>c.clientWidth?zn():0:c.scrollHeight>c.clientHeight?zn():0}this.scrollTo(a(this.props,e,t,o,this._instanceProps,s))},d.componentDidMount=function(){var e=this.props,t=e.direction,n=e.initialScrollOffset,r=e.layout;if(typeof n==`number`&&this._outerRef!=null){var i=this._outerRef;t===`horizontal`||r===`horizontal`?i.scrollLeft=n:i.scrollTop=n}this._callPropsCallbacks()},d.componentDidUpdate=function(){var e=this.props,t=e.direction,n=e.layout,r=this.state,i=r.scrollOffset;if(r.scrollUpdateWasRequested&&this._outerRef!=null){var a=this._outerRef;if(t===`horizontal`||n===`horizontal`)if(t===`rtl`)switch(Vn()){case`negative`:a.scrollLeft=-i;break;case`positive-ascending`:a.scrollLeft=i;break;default:var o=a.clientWidth;a.scrollLeft=a.scrollWidth-o-i;break}else a.scrollLeft=i;else a.scrollTop=i}this._callPropsCallbacks()},d.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&In(this._resetIsScrollingTimeoutId)},d.render=function(){var e=this.props,t=e.children,n=e.className,i=e.direction,a=e.height,o=e.innerRef,s=e.innerElementType,c=e.innerTagName,l=e.itemCount,u=e.itemData,d=e.itemKey,f=d===void 0?Un:d,p=e.layout,m=e.outerElementType,h=e.outerTagName,g=e.style,_=e.useIsScrolling,v=e.width,y=this.state.isScrolling,b=i===`horizontal`||p===`horizontal`,x=b?this._onScrollHorizontal:this._onScrollVertical,S=this._getRangeToRender(),C=S[0],w=S[1],T=[];if(l>0)for(var E=C;E<=w;E++)T.push((0,B.createElement)(t,{data:u,key:f(E,u),index:E,isScrolling:_?y:void 0,style:this._getItemStyle(E)}));var D=r(this.props,this._instanceProps);return(0,B.createElement)(m||h||`div`,{className:n,onScroll:x,ref:this._outerRefSetter,style:Dn({position:`relative`,height:a,width:v,overflow:`auto`,WebkitOverflowScrolling:`touch`,willChange:`transform`,direction:i},g)},(0,B.createElement)(s||c||`div`,{children:T,ref:o,style:{height:b?`100%`:D,pointerEvents:y?`none`:void 0,width:b?D:`100%`}}))},d._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered==`function`&&this.props.itemCount>0){var e=this._getRangeToRender(),t=e[0],n=e[1],r=e[2],i=e[3];this._callOnItemsRendered(t,n,r,i)}if(typeof this.props.onScroll==`function`){var a=this.state,o=a.scrollDirection,s=a.scrollOffset,c=a.scrollUpdateWasRequested;this._callOnScroll(o,s,c)}},d._getRangeToRender=function(){var e=this.props,t=e.itemCount,n=e.overscanCount,r=this.state,i=r.isScrolling,a=r.scrollDirection,c=r.scrollOffset;if(t===0)return[0,0,0,0];var l=o(this.props,c,this._instanceProps),u=s(this.props,l,c,this._instanceProps),d=!i||a===`backward`?Math.max(1,n):1,f=!i||a===`forward`?Math.max(1,n):1;return[Math.max(0,l-d),Math.max(0,Math.min(t-1,u+f)),l,u]},t}(B.PureComponent),t.defaultProps={direction:`ltr`,itemData:void 0,layout:`vertical`,overscanCount:2,useIsScrolling:!1},t}var Gn=function(e,t){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,t.instance},Kn=50,qn=function(e,t,n){var r=e.itemSize,i=n.itemMetadataMap,a=n.lastMeasuredIndex;if(t>a){var o=0;if(a>=0){var s=i[a];o=s.offset+s.size}for(var c=a+1;c<=t;c++){var l=r(c);i[c]={offset:o,size:l},o+=l}n.lastMeasuredIndex=t}return i[t]},Jn=function(e,t,n){var r=t.itemMetadataMap,i=t.lastMeasuredIndex;return(i>0?r[i].offset:0)>=n?Yn(e,t,i,0,n):Xn(e,t,Math.max(0,i),n)},Yn=function(e,t,n,r,i){for(;r<=n;){var a=r+Math.floor((n-r)/2),o=qn(e,a,t).offset;if(o===i)return a;o<i?r=a+1:o>i&&(n=a-1)}return r>0?r-1:0},Xn=function(e,t,n,r){for(var i=e.itemCount,a=1;n<i&&qn(e,n,t).offset<r;)n+=a,a*=2;return Yn(e,t,Math.min(n,i-1),Math.floor(n/2),r)},Zn=function(e,t){var n=e.itemCount,r=t.itemMetadataMap,i=t.estimatedItemSize,a=t.lastMeasuredIndex,o=0;if(a>=n&&(a=n-1),a>=0){var s=r[a];o=s.offset+s.size}var c=(n-a-1)*i;return o+c},Qn=Wn({getItemOffset:function(e,t,n){return qn(e,t,n).offset},getItemSize:function(e,t,n){return n.itemMetadataMap[t].size},getEstimatedTotalSize:Zn,getOffsetForIndexAndAlignment:function(e,t,n,r,i,a){var o=e.direction,s=e.height,c=e.layout,l=e.width,u=o===`horizontal`||c===`horizontal`?l:s,d=qn(e,t,i),f=Zn(e,i),p=Math.max(0,Math.min(f-u,d.offset)),m=Math.max(0,d.offset-u+d.size+a);switch(n===`smart`&&(n=r>=m-u&&r<=p+u?`auto`:`center`),n){case`start`:return p;case`end`:return m;case`center`:return Math.round(m+(p-m)/2);default:return r>=m&&r<=p?r:r<m?m:p}},getStartIndexForOffset:function(e,t,n){return Jn(e,n,t)},getStopIndexForStartIndex:function(e,t,n,r){for(var i=e.direction,a=e.height,o=e.itemCount,s=e.layout,c=e.width,l=i===`horizontal`||s===`horizontal`?c:a,u=qn(e,t,r),d=n+l,f=u.offset+u.size,p=t;p<o-1&&f<d;)p++,f+=qn(e,p,r).size;return p},initInstanceProps:function(e,t){var n={itemMetadataMap:{},estimatedItemSize:e.estimatedItemSize||Kn,lastMeasuredIndex:-1};return t.resetAfterIndex=function(e,r){r===void 0&&(r=!0),n.lastMeasuredIndex=Math.min(n.lastMeasuredIndex,e-1),t._getItemStyleCache(-1),r&&t.forceUpdate()},n},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(e){e.itemSize}}),$n=Wn({getItemOffset:function(e,t){return t*e.itemSize},getItemSize:function(e,t){return e.itemSize},getEstimatedTotalSize:function(e){var t=e.itemCount;return e.itemSize*t},getOffsetForIndexAndAlignment:function(e,t,n,r,i,a){var o=e.direction,s=e.height,c=e.itemCount,l=e.itemSize,u=e.layout,d=e.width,f=o===`horizontal`||u===`horizontal`?d:s,p=Math.max(0,c*l-f),m=Math.min(p,t*l),h=Math.max(0,t*l-f+l+a);switch(n===`smart`&&(n=r>=h-f&&r<=m+f?`auto`:`center`),n){case`start`:return m;case`end`:return h;case`center`:var g=Math.round(h+(m-h)/2);return g<Math.ceil(f/2)?0:g>p+Math.floor(f/2)?p:g;default:return r>=h&&r<=m?r:r<h?h:m}},getStartIndexForOffset:function(e,t){var n=e.itemCount,r=e.itemSize;return Math.max(0,Math.min(n-1,Math.floor(t/r)))},getStopIndexForStartIndex:function(e,t,n){var r=e.direction,i=e.height,a=e.itemCount,o=e.itemSize,s=e.layout,c=e.width,l=r===`horizontal`||s===`horizontal`,u=t*o,d=Math.ceil(((l?c:i)+n-u)/o);return Math.max(0,Math.min(a-1,t+d-1))},initInstanceProps:function(e){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(e){e.itemSize}});function er(){let e=W(),t=bt().cursor;if(!t||t.type!==`line`)return null;let n=e.indent,r=e.rowTopPosition(t.index)+(e.props.padding??e.props.paddingTop??0),i=n*t.level,a=e.renderCursor;return(0,V.jsx)(a,{top:r,left:i,indent:n})}var tr=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},nr=(0,B.forwardRef)(function(e,t){let{children:n}=e,r=tr(e,[`children`]),i=W();return(0,V.jsxs)(`div`,Object.assign({ref:t},r,{onClick:e=>{e.currentTarget===e.target&&i.deselectAll()},children:[(0,V.jsx)(rr,{}),n]}))}),rr=()=>{let e=W();return(0,V.jsx)(`div`,{style:{height:e.rowTopPosition(e.visibleNodes.length),width:`100%`,position:`absolute`,left:`0`,right:`0`},children:(0,V.jsx)(er,{})})},ir=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},ar=(0,B.forwardRef)(function(e,t){var{style:n}=e,r=ir(e,[`style`]);let i=W(),a=i.props.padding??i.props.paddingTop??0,o=i.props.padding??i.props.paddingBottom??0;return(0,V.jsx)(`div`,Object.assign({ref:t,style:Object.assign(Object.assign({},n),{height:`${parseFloat(n.height)+a+o}px`})},r))}),or=(0,B.createContext)({dragDropManager:void 0}),G;(function(e){e.SOURCE=`SOURCE`,e.TARGET=`TARGET`})(G||={});function K(e,t){var n=[...arguments].slice(2);if(!e){var r;if(t===void 0)r=Error(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var i=0;r=Error(t.replace(/%s/g,function(){return n[i++]})),r.name=`Invariant Violation`}throw r.framesToPop=1,r}}var sr=`dnd-core/INIT_COORDS`,cr=`dnd-core/BEGIN_DRAG`,lr=`dnd-core/PUBLISH_DRAG_SOURCE`,ur=`dnd-core/HOVER`,dr=`dnd-core/DROP`,fr=`dnd-core/END_DRAG`;function pr(e,t){return{type:sr,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function mr(e){"@babel/helpers - typeof";return mr=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},mr(e)}function hr(e,t,n){return t.split(`.`).reduce(function(e,t){return e&&e[t]?e[t]:n||null},e)}function gr(e,t){return e.filter(function(e){return e!==t})}function _r(e){return mr(e)===`object`}function vr(e,t){var n=new Map,r=function(e){n.set(e,n.has(e)?n.get(e)+1:1)};e.forEach(r),t.forEach(r);var i=[];return n.forEach(function(e,t){e===1&&i.push(t)}),i}function yr(e,t){return e.filter(function(e){return t.indexOf(e)>-1})}var br={type:sr,payload:{clientOffset:null,sourceClientOffset:null}};function xr(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},r=n.publishSource,i=r===void 0?!0:r,a=n.clientOffset,o=n.getSourceClientOffset,s=e.getMonitor(),c=e.getRegistry();e.dispatch(pr(a)),Sr(t,s,c);var l=Tr(t,s);if(l===null){e.dispatch(br);return}var u=null;if(a){if(!o)throw Error(`getSourceClientOffset must be defined`);Cr(o),u=o(l)}e.dispatch(pr(a,u));var d=c.getSource(l).beginDrag(s,l);if(d!=null)return wr(d),c.pinSource(l),{type:cr,payload:{itemType:c.getSourceType(l),item:d,sourceId:l,clientOffset:a||null,sourceClientOffset:u||null,isSourcePublic:!!i}}}}function Sr(e,t,n){K(!t.isDragging(),`Cannot call beginDrag while dragging.`),e.forEach(function(e){K(n.getSource(e),`Expected sourceIds to be registered.`)})}function Cr(e){K(typeof e==`function`,`When clientOffset is provided, getSourceClientOffset must be a function.`)}function wr(e){K(_r(e),`Item must be an object.`)}function Tr(e,t){for(var n=null,r=e.length-1;r>=0;r--)if(t.canDragSource(e[r])){n=e[r];break}return n}function Er(e){return function(){if(e.getMonitor().isDragging())return{type:lr}}}function Dr(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(e){return e===t}):e===t}function Or(e){return function(t){var n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).clientOffset;kr(t);var r=t.slice(0),i=e.getMonitor(),a=e.getRegistry();return Ar(r,i,a),jr(r,a,i.getItemType()),Mr(r,i,a),{type:ur,payload:{targetIds:r,clientOffset:n||null}}}}function kr(e){K(Array.isArray(e),`Expected targetIds to be an array.`)}function Ar(e,t,n){K(t.isDragging(),`Cannot call hover while not dragging.`),K(!t.didDrop(),`Cannot call hover after drop.`);for(var r=0;r<e.length;r++){var i=e[r];K(e.lastIndexOf(i)===r,`Expected targetIds to be unique in the passed array.`),K(n.getTarget(i),`Expected targetIds to be registered.`)}}function jr(e,t,n){for(var r=e.length-1;r>=0;r--){var i=e[r];Dr(t.getTargetType(i),n)||e.splice(r,1)}}function Mr(e,t,n){e.forEach(function(e){n.getTarget(e).hover(t,e)})}function Nr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Pr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Nr(Object(n),!0).forEach(function(t){Fr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Fr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ir(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),r=e.getRegistry();Lr(n),Br(n).forEach(function(i,a){var o=Rr(i,a,r,n),s={type:dr,payload:{dropResult:Pr(Pr({},t),o)}};e.dispatch(s)})}}function Lr(e){K(e.isDragging(),`Cannot call drop while not dragging.`),K(!e.didDrop(),`Cannot call drop twice during one drag operation.`)}function Rr(e,t,n,r){var i=n.getTarget(e),a=i?i.drop(r,e):void 0;return zr(a),a===void 0&&(a=t===0?{}:r.getDropResult()),a}function zr(e){K(e===void 0||_r(e),`Drop result must either be an object or undefined.`)}function Br(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Vr(e){return function(){var t=e.getMonitor(),n=e.getRegistry();Hr(t);var r=t.getSourceId();return r!=null&&(n.getSource(r,!0).endDrag(t,r),n.unpinSource()),{type:fr}}}function Hr(e){K(e.isDragging(),`Cannot call endDrag while not dragging.`)}function Ur(e){return{beginDrag:xr(e),publishDragSource:Er(e),hover:Or(e),drop:Ir(e),endDrag:Vr(e)}}function Wr(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Gr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Kr(e,t,n){return t&&Gr(e.prototype,t),n&&Gr(e,n),e}function qr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Jr=function(){function e(t,n){var r=this;Wr(this,e),qr(this,`store`,void 0),qr(this,`monitor`,void 0),qr(this,`backend`,void 0),qr(this,`isSetUp`,!1),qr(this,`handleRefCountChange`,function(){var e=r.store.getState().refCount>0;r.backend&&(e&&!r.isSetUp?(r.backend.setup(),r.isSetUp=!0):!e&&r.isSetUp&&(r.backend.teardown(),r.isSetUp=!1))}),this.store=t,this.monitor=n,t.subscribe(this.handleRefCountChange)}return Kr(e,[{key:`receiveBackend`,value:function(e){this.backend=e}},{key:`getMonitor`,value:function(){return this.monitor}},{key:`getBackend`,value:function(){return this.backend}},{key:`getRegistry`,value:function(){return this.monitor.registry}},{key:`getActions`,value:function(){var e=this,t=this.store.dispatch;function n(n){return function(){var r=[...arguments],i=n.apply(e,r);i!==void 0&&t(i)}}var r=Ur(this);return Object.keys(r).reduce(function(e,t){var i=r[t];return e[t]=n(i),e},{})}},{key:`dispatch`,value:function(e){this.store.dispatch(e)}}]),e}();function q(e){return`Minified Redux error #`+e+`; visit https://redux.js.org/Errors?code=`+e+` for the full message or use the non-minified dev environment for full errors. `}var Yr=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})(),Xr=function(){return Math.random().toString(36).substring(7).split(``).join(`.`)},Zr={INIT:`@@redux/INIT`+Xr(),REPLACE:`@@redux/REPLACE`+Xr(),PROBE_UNKNOWN_ACTION:function(){return`@@redux/PROBE_UNKNOWN_ACTION`+Xr()}};function Qr(e){if(typeof e!=`object`||!e)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function $r(e,t,n){var r;if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(q(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(q(1));return n($r)(e,t)}if(typeof e!=`function`)throw Error(q(2));var i=e,a=t,o=[],s=o,c=!1;function l(){s===o&&(s=o.slice())}function u(){if(c)throw Error(q(3));return a}function d(e){if(typeof e!=`function`)throw Error(q(4));if(c)throw Error(q(5));var t=!0;return l(),s.push(e),function(){if(t){if(c)throw Error(q(6));t=!1,l();var n=s.indexOf(e);s.splice(n,1),o=null}}}function f(e){if(!Qr(e))throw Error(q(7));if(e.type===void 0)throw Error(q(8));if(c)throw Error(q(9));try{c=!0,a=i(a,e)}finally{c=!1}for(var t=o=s,n=0;n<t.length;n++){var r=t[n];r()}return e}function p(e){if(typeof e!=`function`)throw Error(q(10));i=e,f({type:Zr.REPLACE})}function m(){var e,t=d;return e={subscribe:function(e){if(typeof e!=`object`||!e)throw Error(q(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}},e[Yr]=function(){return this},e}return f({type:Zr.INIT}),r={dispatch:f,subscribe:d,getState:u,replaceReducer:p},r[Yr]=m,r}var ei=function(e,t){return e===t};function ti(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function ni(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ei;if(e.length!==t.length)return!1;for(var r=0;r<e.length;++r)if(!n(e[r],t[r]))return!1;return!0}function ri(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ii(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ri(Object(n),!0).forEach(function(t){ai(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ri(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ai(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var oi={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function si(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:oi,t=arguments.length>1?arguments[1]:void 0,n=t.payload;switch(t.type){case sr:case cr:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case ur:return ti(e.clientOffset,n.clientOffset)?e:ii(ii({},e),{},{clientOffset:n.clientOffset});case fr:case dr:return oi;default:return e}}var ci=`dnd-core/ADD_SOURCE`,li=`dnd-core/ADD_TARGET`,ui=`dnd-core/REMOVE_SOURCE`,di=`dnd-core/REMOVE_TARGET`;function fi(e){return{type:ci,payload:{sourceId:e}}}function pi(e){return{type:li,payload:{targetId:e}}}function mi(e){return{type:ui,payload:{sourceId:e}}}function hi(e){return{type:di,payload:{targetId:e}}}function gi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?gi(Object(n),!0).forEach(function(t){_i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var vi={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function yi(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:vi,t=arguments.length>1?arguments[1]:void 0,n=t.payload;switch(t.type){case cr:return J(J({},e),{},{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case lr:return J(J({},e),{},{isSourcePublic:!0});case ur:return J(J({},e),{},{targetIds:n.targetIds});case di:return e.targetIds.indexOf(n.targetId)===-1?e:J(J({},e),{},{targetIds:gr(e.targetIds,n.targetId)});case dr:return J(J({},e),{},{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case fr:return J(J({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function bi(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;switch((arguments.length>1?arguments[1]:void 0).type){case ci:case li:return e+1;case ui:case di:return e-1;default:return e}}var xi=[],Si=[];xi.__IS_NONE__=!0,Si.__IS_ALL__=!0;function Ci(e,t){return e===xi?!1:e===Si||t===void 0?!0:yr(t,e).length>0}function wi(){arguments.length>0&&arguments[0]!==void 0&&arguments[0];var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case ur:break;case ci:case li:case di:case ui:return xi;case cr:case lr:case fr:case dr:default:return Si}var t=e.payload,n=t.targetIds,r=n===void 0?[]:n,i=t.prevTargetIds,a=i===void 0?[]:i,o=vr(r,a);if(!(o.length>0||!ni(r,a)))return xi;var s=a[a.length-1],c=r[r.length-1];return s!==c&&(s&&o.push(s),c&&o.push(c)),o}function Ti(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:0)+1}function Ei(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Di(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ei(Object(n),!0).forEach(function(t){Oi(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ei(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Oi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ki(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:wi(e.dirtyHandlerIds,{type:t.type,payload:Di(Di({},t.payload),{},{prevTargetIds:hr(e,`dragOperation.targetIds`,[])})}),dragOffset:si(e.dragOffset,t),refCount:bi(e.refCount,t),dragOperation:yi(e.dragOperation,t),stateId:Ti(e.stateId)}}function Ai(e,t){return{x:e.x+t.x,y:e.y+t.y}}function ji(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Mi(e){var t=e.clientOffset,n=e.initialClientOffset,r=e.initialSourceClientOffset;return!t||!n||!r?null:ji(Ai(t,r),n)}function Ni(e){var t=e.clientOffset,n=e.initialClientOffset;return!t||!n?null:ji(t,n)}function Pi(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Fi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ii(e,t,n){return t&&Fi(e.prototype,t),n&&Fi(e,n),e}function Li(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ri=function(){function e(t,n){Pi(this,e),Li(this,`store`,void 0),Li(this,`registry`,void 0),this.store=t,this.registry=n}return Ii(e,[{key:`subscribeToStateChange`,value:function(e){var t=this,n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0}).handlerIds;K(typeof e==`function`,`listener must be a function.`),K(n===void 0||Array.isArray(n),`handlerIds, when specified, must be an array of strings.`);var r=this.store.getState().stateId;return this.store.subscribe(function(){var i=t.store.getState(),a=i.stateId;try{a===r||a===r+1&&!Ci(i.dirtyHandlerIds,n)||e()}finally{r=a}})}},{key:`subscribeToOffsetChange`,value:function(e){var t=this;K(typeof e==`function`,`listener must be a function.`);var n=this.store.getState().dragOffset;return this.store.subscribe(function(){var r=t.store.getState().dragOffset;r!==n&&(n=r,e())})}},{key:`canDragSource`,value:function(e){if(!e)return!1;var t=this.registry.getSource(e);return K(t,`Expected to find a valid source. sourceId=${e}`),this.isDragging()?!1:t.canDrag(this,e)}},{key:`canDropOnTarget`,value:function(e){if(!e)return!1;var t=this.registry.getTarget(e);return K(t,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop()?!1:Dr(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e)}},{key:`isDragging`,value:function(){return!!this.getItemType()}},{key:`isDraggingSource`,value:function(e){if(!e)return!1;var t=this.registry.getSource(e,!0);return K(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic()||this.registry.getSourceType(e)!==this.getItemType()?!1:t.isDragging(this,e)}},{key:`isOverTarget`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1};if(!e)return!1;var n=t.shallow;if(!this.isDragging())return!1;var r=this.registry.getTargetType(e),i=this.getItemType();if(i&&!Dr(r,i))return!1;var a=this.getTargetIds();if(!a.length)return!1;var o=a.indexOf(e);return n?o===a.length-1:o>-1}},{key:`getItemType`,value:function(){return this.store.getState().dragOperation.itemType}},{key:`getItem`,value:function(){return this.store.getState().dragOperation.item}},{key:`getSourceId`,value:function(){return this.store.getState().dragOperation.sourceId}},{key:`getTargetIds`,value:function(){return this.store.getState().dragOperation.targetIds}},{key:`getDropResult`,value:function(){return this.store.getState().dragOperation.dropResult}},{key:`didDrop`,value:function(){return this.store.getState().dragOperation.didDrop}},{key:`isSourcePublic`,value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:`getInitialClientOffset`,value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:`getInitialSourceClientOffset`,value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:`getClientOffset`,value:function(){return this.store.getState().dragOffset.clientOffset}},{key:`getSourceClientOffset`,value:function(){return Mi(this.store.getState().dragOffset)}},{key:`getDifferenceFromInitialOffset`,value:function(){return Ni(this.store.getState().dragOffset)}}]),e}(),zi=0;function Bi(){return zi++}function Vi(e){"@babel/helpers - typeof";return Vi=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Vi(e)}function Hi(e){K(typeof e.canDrag==`function`,`Expected canDrag to be a function.`),K(typeof e.beginDrag==`function`,`Expected beginDrag to be a function.`),K(typeof e.endDrag==`function`,`Expected endDrag to be a function.`)}function Ui(e){K(typeof e.canDrop==`function`,`Expected canDrop to be a function.`),K(typeof e.hover==`function`,`Expected hover to be a function.`),K(typeof e.drop==`function`,`Expected beginDrag to be a function.`)}function Wi(e,t){if(t&&Array.isArray(e)){e.forEach(function(e){return Wi(e,!1)});return}K(typeof e==`string`||Vi(e)===`symbol`,t?`Type can only be a string, a symbol, or an array of either.`:`Type can only be a string or a symbol.`)}var Gi=typeof global<`u`?global:self,Ki=Gi.MutationObserver||Gi.WebKitMutationObserver;function qi(e){return function(){let t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}function Ji(e){let t=1,n=new Ki(e),r=document.createTextNode(``);return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}var Yi=typeof Ki==`function`?Ji:qi,Xi=class{enqueueTask(e){let{queue:t,requestFlush:n}=this;t.length||(n(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{let{queue:e}=this;for(;this.index<e.length;){let t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,n=e.length-this.index;t<n;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=Yi(this.flush),this.requestErrorThrow=qi(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},Zi=class{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}},Qi=class{create(e){let t=this.freeTasks,n=t.length?t.pop():new Zi(this.onError,e=>t[t.length]=e);return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}},$i=new Xi,ea=new Qi($i.registerPendingError);function ta(e){$i.enqueueTask(ea.create(e))}function na(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function ra(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ia(e,t,n){return t&&ra(e.prototype,t),n&&ra(e,n),e}function aa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oa(e,t){return da(e)||ua(e,t)||ca(e,t)||sa()}function sa(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ca(e,t){if(e){if(typeof e==`string`)return la(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return la(e,t)}}function la(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ua(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function da(e){if(Array.isArray(e))return e}function fa(e){var t=Bi().toString();switch(e){case G.SOURCE:return`S${t}`;case G.TARGET:return`T${t}`;default:throw Error(`Unknown Handler Role: ${e}`)}}function pa(e){switch(e[0]){case`S`:return G.SOURCE;case`T`:return G.TARGET;default:K(!1,`Cannot parse handler ID: ${e}`)}}function ma(e,t){var n=e.entries(),r=!1;do{var i=n.next(),a=i.done;if(oa(i.value,2)[1]===t)return!0;r=!!a}while(!r);return!1}var ha=function(){function e(t){na(this,e),aa(this,`types`,new Map),aa(this,`dragSources`,new Map),aa(this,`dropTargets`,new Map),aa(this,`pinnedSourceId`,null),aa(this,`pinnedSource`,null),aa(this,`store`,void 0),this.store=t}return ia(e,[{key:`addSource`,value:function(e,t){Wi(e),Hi(t);var n=this.addHandler(G.SOURCE,e,t);return this.store.dispatch(fi(n)),n}},{key:`addTarget`,value:function(e,t){Wi(e,!0),Ui(t);var n=this.addHandler(G.TARGET,e,t);return this.store.dispatch(pi(n)),n}},{key:`containsHandler`,value:function(e){return ma(this.dragSources,e)||ma(this.dropTargets,e)}},{key:`getSource`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return K(this.isSourceId(e),`Expected a valid source ID.`),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}},{key:`getTarget`,value:function(e){return K(this.isTargetId(e),`Expected a valid target ID.`),this.dropTargets.get(e)}},{key:`getSourceType`,value:function(e){return K(this.isSourceId(e),`Expected a valid source ID.`),this.types.get(e)}},{key:`getTargetType`,value:function(e){return K(this.isTargetId(e),`Expected a valid target ID.`),this.types.get(e)}},{key:`isSourceId`,value:function(e){return pa(e)===G.SOURCE}},{key:`isTargetId`,value:function(e){return pa(e)===G.TARGET}},{key:`removeSource`,value:function(e){var t=this;K(this.getSource(e),`Expected an existing source.`),this.store.dispatch(mi(e)),ta(function(){t.dragSources.delete(e),t.types.delete(e)})}},{key:`removeTarget`,value:function(e){K(this.getTarget(e),`Expected an existing target.`),this.store.dispatch(hi(e)),this.dropTargets.delete(e),this.types.delete(e)}},{key:`pinSource`,value:function(e){var t=this.getSource(e);K(t,`Expected an existing source.`),this.pinnedSourceId=e,this.pinnedSource=t}},{key:`unpinSource`,value:function(){K(this.pinnedSource,`No source is pinned at the time.`),this.pinnedSourceId=null,this.pinnedSource=null}},{key:`addHandler`,value:function(e,t,n){var r=fa(e);return this.types.set(r,t),e===G.SOURCE?this.dragSources.set(r,n):e===G.TARGET&&this.dropTargets.set(r,n),r}}]),e}();function ga(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=_a(arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1),i=new Jr(r,new Ri(r,new ha(r))),a=e(i,t,n);return i.receiveBackend(a),i}function _a(e){var t=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__;return $r(ki,e&&t&&t({name:`dnd-core`,instanceId:`dnd-core`}))}var va=[`children`];function ya(e,t){return wa(e)||Ca(e,t)||xa(e,t)||ba()}function ba(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xa(e,t){if(e){if(typeof e==`string`)return Sa(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Sa(e,t)}}function Sa(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ca(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function wa(e){if(Array.isArray(e))return e}function Ta(e,t){if(e==null)return{};var n=Ea(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ea(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Da=0,Oa=Symbol.for(`__REACT_DND_CONTEXT_INSTANCE__`),ka=(0,B.memo)(function(e){var t=e.children,n=ya(Aa(Ta(e,va)),2),r=n[0],i=n[1];return(0,B.useEffect)(function(){if(i){var e=Ma();return++Da,function(){--Da===0&&(e[Oa]=null)}}},[]),(0,V.jsx)(or.Provider,Object.assign({value:r},{children:t}),void 0)});function Aa(e){return`manager`in e?[{dragDropManager:e.manager},!1]:[ja(e.backend,e.context,e.options,e.debugMode),!e.context]}function ja(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ma(),n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=t;return i[Oa]||(i[Oa]={dragDropManager:ga(e,t,n,r)}),i[Oa]}function Ma(){return typeof global<`u`?global:window}function Na(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Pa(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Fa(e,t,n){return t&&Pa(e.prototype,t),n&&Pa(e,n),e}function Ia(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var La=!1,Ra=!1,za=function(){function e(t){Na(this,e),Ia(this,`internalMonitor`,void 0),Ia(this,`sourceId`,null),this.internalMonitor=t.getMonitor()}return Fa(e,[{key:`receiveHandlerId`,value:function(e){this.sourceId=e}},{key:`getHandlerId`,value:function(){return this.sourceId}},{key:`canDrag`,value:function(){K(!La,`You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor`);try{return La=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{La=!1}}},{key:`isDragging`,value:function(){if(!this.sourceId)return!1;K(!Ra,`You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor`);try{return Ra=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Ra=!1}}},{key:`subscribeToStateChange`,value:function(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}},{key:`isDraggingSource`,value:function(e){return this.internalMonitor.isDraggingSource(e)}},{key:`isOverTarget`,value:function(e,t){return this.internalMonitor.isOverTarget(e,t)}},{key:`getTargetIds`,value:function(){return this.internalMonitor.getTargetIds()}},{key:`isSourcePublic`,value:function(){return this.internalMonitor.isSourcePublic()}},{key:`getSourceId`,value:function(){return this.internalMonitor.getSourceId()}},{key:`subscribeToOffsetChange`,value:function(e){return this.internalMonitor.subscribeToOffsetChange(e)}},{key:`canDragSource`,value:function(e){return this.internalMonitor.canDragSource(e)}},{key:`canDropOnTarget`,value:function(e){return this.internalMonitor.canDropOnTarget(e)}},{key:`getItemType`,value:function(){return this.internalMonitor.getItemType()}},{key:`getItem`,value:function(){return this.internalMonitor.getItem()}},{key:`getDropResult`,value:function(){return this.internalMonitor.getDropResult()}},{key:`didDrop`,value:function(){return this.internalMonitor.didDrop()}},{key:`getInitialClientOffset`,value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:`getInitialSourceClientOffset`,value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:`getSourceClientOffset`,value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:`getClientOffset`,value:function(){return this.internalMonitor.getClientOffset()}},{key:`getDifferenceFromInitialOffset`,value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function Ba(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Va(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ha(e,t,n){return t&&Va(e.prototype,t),n&&Va(e,n),e}function Ua(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Wa=!1,Ga=function(){function e(t){Ba(this,e),Ua(this,`internalMonitor`,void 0),Ua(this,`targetId`,null),this.internalMonitor=t.getMonitor()}return Ha(e,[{key:`receiveHandlerId`,value:function(e){this.targetId=e}},{key:`getHandlerId`,value:function(){return this.targetId}},{key:`subscribeToStateChange`,value:function(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}},{key:`canDrop`,value:function(){if(!this.targetId)return!1;K(!Wa,`You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor`);try{return Wa=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Wa=!1}}},{key:`isOver`,value:function(e){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,e):!1}},{key:`getItemType`,value:function(){return this.internalMonitor.getItemType()}},{key:`getItem`,value:function(){return this.internalMonitor.getItem()}},{key:`getDropResult`,value:function(){return this.internalMonitor.getDropResult()}},{key:`didDrop`,value:function(){return this.internalMonitor.didDrop()}},{key:`getInitialClientOffset`,value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:`getInitialSourceClientOffset`,value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:`getSourceClientOffset`,value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:`getClientOffset`,value:function(){return this.internalMonitor.getClientOffset()}},{key:`getDifferenceFromInitialOffset`,value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function Ka(e){if(typeof e.type!=`string`){var t=e.type.displayName||e.type.name||`the component`;throw Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}}function qa(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!(0,B.isValidElement)(t)){var r=t;return e(r,n),r}var i=t;return Ka(i),Xa(i,n?function(t){return e(t,n)}:e)}}function Ja(e){var t={};return Object.keys(e).forEach(function(n){var r=e[n];if(n.endsWith(`Ref`))t[n]=e[n];else{var i=qa(r);t[n]=function(){return i}}}),t}function Ya(e,t){typeof e==`function`?e(t):e.current=t}function Xa(e,t){var n=e.ref;return K(typeof n!=`string`,`Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs`),n?(0,B.cloneElement)(e,{ref:function(e){Ya(n,e),Ya(t,e)}}):(0,B.cloneElement)(e,{ref:t})}function Za(e){"@babel/helpers - typeof";return Za=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Za(e)}function Qa(e){return e!==null&&Za(e)===`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function $a(e,t,n,r){var i=n?n.call(r,e,t):void 0;if(i!==void 0)return!!i;if(e===t)return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var a=Object.keys(e),o=Object.keys(t);if(a.length!==o.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),c=0;c<a.length;c++){var l=a[c];if(!s(l))return!1;var u=e[l],d=t[l];if(i=n?n.call(r,u,d,l):void 0,i===!1||i===void 0&&u!==d)return!1}return!0}function eo(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function to(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function no(e,t,n){return t&&to(e.prototype,t),n&&to(e,n),e}function Y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ro=function(){function e(t){var n=this;eo(this,e),Y(this,`hooks`,Ja({dragSource:function(e,t){n.clearDragSource(),n.dragSourceOptions=t||null,Qa(e)?n.dragSourceRef=e:n.dragSourceNode=e,n.reconnectDragSource()},dragPreview:function(e,t){n.clearDragPreview(),n.dragPreviewOptions=t||null,Qa(e)?n.dragPreviewRef=e:n.dragPreviewNode=e,n.reconnectDragPreview()}})),Y(this,`handlerId`,null),Y(this,`dragSourceRef`,null),Y(this,`dragSourceNode`,void 0),Y(this,`dragSourceOptionsInternal`,null),Y(this,`dragSourceUnsubscribe`,void 0),Y(this,`dragPreviewRef`,null),Y(this,`dragPreviewNode`,void 0),Y(this,`dragPreviewOptionsInternal`,null),Y(this,`dragPreviewUnsubscribe`,void 0),Y(this,`lastConnectedHandlerId`,null),Y(this,`lastConnectedDragSource`,null),Y(this,`lastConnectedDragSourceOptions`,null),Y(this,`lastConnectedDragPreview`,null),Y(this,`lastConnectedDragPreviewOptions`,null),Y(this,`backend`,void 0),this.backend=t}return no(e,[{key:`receiveHandlerId`,value:function(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}},{key:`connectTarget`,get:function(){return this.dragSource}},{key:`dragSourceOptions`,get:function(){return this.dragSourceOptionsInternal},set:function(e){this.dragSourceOptionsInternal=e}},{key:`dragPreviewOptions`,get:function(){return this.dragPreviewOptionsInternal},set:function(e){this.dragPreviewOptionsInternal=e}},{key:`reconnect`,value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:`reconnectDragSource`,value:function(){var e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();if(t&&this.disconnectDragSource(),this.handlerId){if(!e){this.lastConnectedDragSource=e;return}t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions))}}},{key:`reconnectDragPreview`,value:function(){var e=this.dragPreview,t=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(t&&this.disconnectDragPreview(),this.handlerId){if(!e){this.lastConnectedDragPreview=e;return}t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=e,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,e,this.dragPreviewOptions))}}},{key:`didHandlerIdChange`,value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:`didConnectedDragSourceChange`,value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:`didConnectedDragPreviewChange`,value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:`didDragSourceOptionsChange`,value:function(){return!$a(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:`didDragPreviewOptionsChange`,value:function(){return!$a(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:`disconnectDragSource`,value:function(){this.dragSourceUnsubscribe&&=(this.dragSourceUnsubscribe(),void 0)}},{key:`disconnectDragPreview`,value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:`dragSource`,get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:`dragPreview`,get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}},{key:`clearDragSource`,value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:`clearDragPreview`,value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}}]),e}();function io(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function ao(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function oo(e,t,n){return t&&ao(e.prototype,t),n&&ao(e,n),e}function X(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var so=function(){function e(t){var n=this;io(this,e),X(this,`hooks`,Ja({dropTarget:function(e,t){n.clearDropTarget(),n.dropTargetOptions=t,Qa(e)?n.dropTargetRef=e:n.dropTargetNode=e,n.reconnect()}})),X(this,`handlerId`,null),X(this,`dropTargetRef`,null),X(this,`dropTargetNode`,void 0),X(this,`dropTargetOptionsInternal`,null),X(this,`unsubscribeDropTarget`,void 0),X(this,`lastConnectedHandlerId`,null),X(this,`lastConnectedDropTarget`,null),X(this,`lastConnectedDropTargetOptions`,null),X(this,`backend`,void 0),this.backend=t}return oo(e,[{key:`connectTarget`,get:function(){return this.dropTarget}},{key:`reconnect`,value:function(){var e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();var t=this.dropTarget;if(this.handlerId){if(!t){this.lastConnectedDropTarget=t;return}e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions))}}},{key:`receiveHandlerId`,value:function(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}},{key:`dropTargetOptions`,get:function(){return this.dropTargetOptionsInternal},set:function(e){this.dropTargetOptionsInternal=e}},{key:`didHandlerIdChange`,value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:`didDropTargetChange`,value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:`didOptionsChange`,value:function(){return!$a(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:`disconnectDropTarget`,value:function(){this.unsubscribeDropTarget&&=(this.unsubscribeDropTarget(),void 0)}},{key:`dropTarget`,get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:`clearDropTarget`,value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}]),e}();function co(e,t,n){var r=n.getRegistry(),i=r.addTarget(e,t);return[i,function(){return r.removeTarget(i)}]}function lo(e,t,n){var r=n.getRegistry(),i=r.addSource(e,t);return[i,function(){return r.removeSource(i)}]}var uo=typeof window<`u`?B.useLayoutEffect:B.useEffect;function fo(e){"@babel/helpers - typeof";return fo=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},fo(e)}function po(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function mo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ho(e,t,n){return t&&mo(e.prototype,t),n&&mo(e,n),e}function go(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var _o=function(){function e(t,n,r){po(this,e),go(this,`spec`,void 0),go(this,`monitor`,void 0),go(this,`connector`,void 0),this.spec=t,this.monitor=n,this.connector=r}return ho(e,[{key:`beginDrag`,value:function(){var e=this.spec,t=this.monitor,n=null;return n=fo(e.item)===`object`?e.item:typeof e.item==`function`?e.item(t):{},n??null}},{key:`canDrag`,value:function(){var e=this.spec,t=this.monitor;return typeof e.canDrag==`boolean`?e.canDrag:typeof e.canDrag==`function`?e.canDrag(t):!0}},{key:`isDragging`,value:function(e,t){var n=this.spec,r=this.monitor,i=n.isDragging;return i?i(r):t===e.getSourceId()}},{key:`endDrag`,value:function(){var e=this.spec,t=this.monitor,n=this.connector,r=e.end;r&&r(t.getItem(),t),n.reconnect()}}]),e}();function vo(e,t,n){var r=(0,B.useMemo)(function(){return new _o(e,t,n)},[t,n]);return(0,B.useEffect)(function(){r.spec=e},[e]),r}function yo(){var e=(0,B.useContext)(or).dragDropManager;return K(e!=null,`Expected drag drop context`),e}function bo(e){return(0,B.useMemo)(function(){var t=e.type;return K(t!=null,`spec.type must be defined`),t},[e])}function xo(e,t){return Eo(e)||To(e,t)||Co(e,t)||So()}function So(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
4
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Co(e,t){if(e){if(typeof e==`string`)return wo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return wo(e,t)}}function wo(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function To(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function Eo(e){if(Array.isArray(e))return e}function Do(e,t,n){var r=yo(),i=vo(e,t,n),a=bo(e);uo(function(){if(a!=null){var e=xo(lo(a,i,r),2),o=e[0],s=e[1];return t.receiveHandlerId(o),n.receiveHandlerId(o),s}},[r,t,n,i,a])}function Oo(e){return Mo(e)||jo(e)||Ao(e)||ko()}function ko(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
5
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ao(e,t){if(e){if(typeof e==`string`)return No(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return No(e,t)}}function jo(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Mo(e){if(Array.isArray(e))return No(e)}function No(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Po(e,t){var n=Oo(t||[]);return t==null&&typeof e!=`function`&&n.push(e),(0,B.useMemo)(function(){return typeof e==`function`?e():e},n)}function Fo(){var e=yo();return(0,B.useMemo)(function(){return new za(e)},[e])}function Io(e,t){var n=yo(),r=(0,B.useMemo)(function(){return new ro(n.getBackend())},[n]);return uo(function(){return r.dragSourceOptions=e||null,r.reconnect(),function(){return r.disconnectDragSource()}},[r,e]),uo(function(){return r.dragPreviewOptions=t||null,r.reconnect(),function(){return r.disconnectDragPreview()}},[r,t]),r}var Lo=t(n(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}}))());function Ro(e,t){return Uo(e)||Ho(e,t)||Bo(e,t)||zo()}function zo(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
6
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bo(e,t){if(e){if(typeof e==`string`)return Vo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Vo(e,t)}}function Vo(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ho(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function Uo(e){if(Array.isArray(e))return e}function Wo(e,t,n){var r=Ro((0,B.useState)(function(){return t(e)}),2),i=r[0],a=r[1],o=(0,B.useCallback)(function(){var r=t(e);(0,Lo.default)(i,r)||(a(r),n&&n())},[i,e,n]);return uo(o),[i,o]}function Go(e,t){return Xo(e)||Yo(e,t)||qo(e,t)||Ko()}function Ko(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
7
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qo(e,t){if(e){if(typeof e==`string`)return Jo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Jo(e,t)}}function Jo(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Yo(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function Xo(e){if(Array.isArray(e))return e}function Zo(e,t,n){var r=Go(Wo(e,t,n),2),i=r[0],a=r[1];return uo(function(){var t=e.getHandlerId();if(t!=null)return e.subscribeToStateChange(a,{handlerIds:[t]})},[e,a]),i}function Qo(e,t,n){return Zo(t,e||function(){return{}},function(){return n.reconnect()})}function $o(e){return(0,B.useMemo)(function(){return e.hooks.dragSource()},[e])}function es(e){return(0,B.useMemo)(function(){return e.hooks.dragPreview()},[e])}function ts(e,t){var n=Po(e,t);K(!n.begin,`useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)`);var r=Fo(),i=Io(n.options,n.previewOptions);return Do(n,r,i),[Qo(n.collect,r,i),$o(i),es(i)]}function ns(e){var t=e.accept;return(0,B.useMemo)(function(){return K(e.accept!=null,`accept must be defined`),Array.isArray(t)?t:[t]},[t])}function rs(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function is(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function as(e,t,n){return t&&is(e.prototype,t),n&&is(e,n),e}function os(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ss=function(){function e(t,n){rs(this,e),os(this,`spec`,void 0),os(this,`monitor`,void 0),this.spec=t,this.monitor=n}return as(e,[{key:`canDrop`,value:function(){var e=this.spec,t=this.monitor;return e.canDrop?e.canDrop(t.getItem(),t):!0}},{key:`hover`,value:function(){var e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}},{key:`drop`,value:function(){var e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}}]),e}();function cs(e,t){var n=(0,B.useMemo)(function(){return new ss(e,t)},[t]);return(0,B.useEffect)(function(){n.spec=e},[e]),n}function ls(e,t){return ms(e)||ps(e,t)||ds(e,t)||us()}function us(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
8
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ds(e,t){if(e){if(typeof e==`string`)return fs(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fs(e,t)}}function fs(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ps(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function ms(e){if(Array.isArray(e))return e}function hs(e,t,n){var r=yo(),i=cs(e,t),a=ns(e);uo(function(){var e=ls(co(a,i,r),2),o=e[0],s=e[1];return t.receiveHandlerId(o),n.receiveHandlerId(o),s},[r,t,i,n,a.map(function(e){return e.toString()}).join(`|`)])}function gs(){var e=yo();return(0,B.useMemo)(function(){return new Ga(e)},[e])}function _s(e){var t=yo(),n=(0,B.useMemo)(function(){return new so(t.getBackend())},[t]);return uo(function(){return n.dropTargetOptions=e||null,n.reconnect(),function(){return n.disconnectDropTarget()}},[e]),n}function vs(e){return(0,B.useMemo)(function(){return e.hooks.dropTarget()},[e])}function ys(e,t){var n=Po(e,t),r=gs(),i=_s(n.options);return hs(n,r,i),[Qo(n.collect,r,i),vs(i)]}function bs(e,t){return Ts(e)||ws(e,t)||Ss(e,t)||xs()}function xs(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
9
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ss(e,t){if(e){if(typeof e==`string`)return Cs(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Cs(e,t)}}function Cs(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ws(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function Ts(e){if(Array.isArray(e))return e}function Es(e){var t=yo().getMonitor(),n=bs(Wo(t,e),2),r=n[0],i=n[1];return(0,B.useEffect)(function(){return t.subscribeToOffsetChange(i)}),(0,B.useEffect)(function(){return t.subscribeToStateChange(i)}),r}function Ds(e){var t=null;return function(){return t??=e(),t}}function Os(e,t){return e.filter(function(e){return e!==t})}function ks(e,t){var n=new Set,r=function(e){return n.add(e)};e.forEach(r),t.forEach(r);var i=[];return n.forEach(function(e){return i.push(e)}),i}function As(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function js(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ms(e,t,n){return t&&js(e.prototype,t),n&&js(e,n),e}function Ns(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ps=function(){function e(t){As(this,e),Ns(this,`entered`,[]),Ns(this,`isNodeInDocument`,void 0),this.isNodeInDocument=t}return Ms(e,[{key:`enter`,value:function(e){var t=this,n=this.entered.length;return this.entered=ks(this.entered.filter(function(n){return t.isNodeInDocument(n)&&(!n.contains||n.contains(e))}),[e]),n===0&&this.entered.length>0}},{key:`leave`,value:function(e){var t=this.entered.length;return this.entered=Os(this.entered.filter(this.isNodeInDocument),e),t>0&&this.entered.length===0}},{key:`reset`,value:function(){this.entered=[]}}]),e}(),Fs=Ds(function(){return/firefox/i.test(navigator.userAgent)}),Is=Ds(function(){return!!window.safari});function Ls(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Rs(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function zs(e,t,n){return t&&Rs(e.prototype,t),n&&Rs(e,n),e}function Bs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Vs=function(){function e(t,n){Ls(this,e),Bs(this,`xs`,void 0),Bs(this,`ys`,void 0),Bs(this,`c1s`,void 0),Bs(this,`c2s`,void 0),Bs(this,`c3s`,void 0);for(var r=t.length,i=[],a=0;a<r;a++)i.push(a);i.sort(function(e,n){return t[e]<t[n]?-1:1});for(var o=[],s=[],c=[],l,u,d=0;d<r-1;d++)l=t[d+1]-t[d],u=n[d+1]-n[d],s.push(l),o.push(u),c.push(u/l);for(var f=[c[0]],p=0;p<s.length-1;p++){var m=c[p],h=c[p+1];if(m*h<=0)f.push(0);else{l=s[p];var g=s[p+1],_=l+g;f.push(3*_/((_+g)/m+(_+l)/h))}}f.push(c[c.length-1]);for(var v=[],y=[],b,x=0;x<f.length-1;x++){b=c[x];var S=f[x],C=1/s[x],w=S+f[x+1]-b-b;v.push((b-S-w)*C),y.push(w*C*C)}this.xs=t,this.ys=n,this.c1s=f,this.c2s=v,this.c3s=y}return zs(e,[{key:`interpolate`,value:function(e){var t=this.xs,n=this.ys,r=this.c1s,i=this.c2s,a=this.c3s,o=t.length-1;if(e===t[o])return n[o];for(var s=0,c=a.length-1,l;s<=c;){l=Math.floor(.5*(s+c));var u=t[l];if(u<e)s=l+1;else if(u>e)c=l-1;else return n[l]}o=Math.max(0,c);var d=e-t[o],f=d*d;return n[o]+r[o]*d+i[o]*f+a[o]*d*f}}]),e}(),Hs=1;function Us(e){var t=e.nodeType===Hs?e:e.parentElement;if(!t)return null;var n=t.getBoundingClientRect(),r=n.top;return{x:n.left,y:r}}function Ws(e){return{x:e.clientX,y:e.clientY}}function Gs(e){var t;return e.nodeName===`IMG`&&(Fs()||!((t=document.documentElement)!=null&&t.contains(e)))}function Ks(e,t,n,r){var i=e?t.width:n,a=e?t.height:r;return Is()&&e&&(a/=window.devicePixelRatio,i/=window.devicePixelRatio),{dragPreviewWidth:i,dragPreviewHeight:a}}function qs(e,t,n,r,i){var a=Gs(t),o=Us(a?e:t),s={x:n.x-o.x,y:n.y-o.y},c=e.offsetWidth,l=e.offsetHeight,u=r.anchorX,d=r.anchorY,f=Ks(a,t,c,l),p=f.dragPreviewWidth,m=f.dragPreviewHeight,h=function(){var e=new Vs([0,.5,1],[s.y,s.y/l*m,s.y+m-l]).interpolate(d);return Is()&&a&&(e+=(window.devicePixelRatio-1)*m),e},g=function(){return new Vs([0,.5,1],[s.x,s.x/c*p,s.x+p-c]).interpolate(u)},_=i.offsetX,v=i.offsetY,y=_===0||_,b=v===0||v;return{x:y?_:g(),y:b?v:h()}}var Js=e({FILE:()=>Ys,HTML:()=>Qs,TEXT:()=>Zs,URL:()=>Xs}),Ys=`__NATIVE_FILE__`,Xs=`__NATIVE_URL__`,Zs=`__NATIVE_TEXT__`,Qs=`__NATIVE_HTML__`;function $s(e,t,n){return t.reduce(function(t,n){return t||e.getData(n)},``)??n}var ec;function tc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var nc=(ec={},tc(ec,Ys,{exposeProperties:{files:function(e){return Array.prototype.slice.call(e.files)},items:function(e){return e.items},dataTransfer:function(e){return e}},matchesTypes:[`Files`]}),tc(ec,Qs,{exposeProperties:{html:function(e,t){return $s(e,t,``)},dataTransfer:function(e){return e}},matchesTypes:[`Html`,`text/html`]}),tc(ec,Xs,{exposeProperties:{urls:function(e,t){return $s(e,t,``).split(`
|
|
10
|
+
`)},dataTransfer:function(e){return e}},matchesTypes:[`Url`,`text/uri-list`]}),tc(ec,Zs,{exposeProperties:{text:function(e,t){return $s(e,t,``)},dataTransfer:function(e){return e}},matchesTypes:[`Text`,`text/plain`]}),ec);function rc(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function ic(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ac(e,t,n){return t&&ic(e.prototype,t),n&&ic(e,n),e}function oc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var sc=function(){function e(t){rc(this,e),oc(this,`item`,void 0),oc(this,`config`,void 0),this.config=t,this.item={},this.initializeExposedProperties()}return ac(e,[{key:`initializeExposedProperties`,value:function(){var e=this;Object.keys(this.config.exposeProperties).forEach(function(t){Object.defineProperty(e.item,t,{configurable:!0,enumerable:!0,get:function(){return console.warn(`Browser doesn't allow reading "${t}" until the drop event.`),null}})})}},{key:`loadDataTransfer`,value:function(e){var t=this;if(e){var n={};Object.keys(this.config.exposeProperties).forEach(function(r){n[r]={value:t.config.exposeProperties[r](e,t.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,n)}}},{key:`canDrag`,value:function(){return!0}},{key:`beginDrag`,value:function(){return this.item}},{key:`isDragging`,value:function(e,t){return t===e.getSourceId()}},{key:`endDrag`,value:function(){}}]),e}();function cc(e,t){var n=new sc(nc[e]);return n.loadDataTransfer(t),n}function lc(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(nc).filter(function(e){return nc[e].matchesTypes.some(function(e){return t.indexOf(e)>-1})})[0]||null}function uc(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function dc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function fc(e,t,n){return t&&dc(e.prototype,t),n&&dc(e,n),e}function pc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var mc=function(){function e(t,n){uc(this,e),pc(this,`ownerDocument`,null),pc(this,`globalContext`,void 0),pc(this,`optionsArgs`,void 0),this.globalContext=t,this.optionsArgs=n}return fc(e,[{key:`window`,get:function(){if(this.globalContext)return this.globalContext;if(typeof window<`u`)return window}},{key:`document`,get:function(){var e;if((e=this.globalContext)!=null&&e.document)return this.globalContext.document;if(this.window)return this.window.document}},{key:`rootElement`,get:function(){return this.optionsArgs?.rootElement||this.window}}]),e}();function hc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function gc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?hc(Object(n),!0).forEach(function(t){Z(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _c(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function vc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function yc(e,t,n){return t&&vc(e.prototype,t),n&&vc(e,n),e}function Z(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var bc=function(){function e(t,n,r){var i=this;_c(this,e),Z(this,`options`,void 0),Z(this,`actions`,void 0),Z(this,`monitor`,void 0),Z(this,`registry`,void 0),Z(this,`enterLeaveCounter`,void 0),Z(this,`sourcePreviewNodes`,new Map),Z(this,`sourcePreviewNodeOptions`,new Map),Z(this,`sourceNodes`,new Map),Z(this,`sourceNodeOptions`,new Map),Z(this,`dragStartSourceIds`,null),Z(this,`dropTargetIds`,[]),Z(this,`dragEnterTargetIds`,[]),Z(this,`currentNativeSource`,null),Z(this,`currentNativeHandle`,null),Z(this,`currentDragSourceNode`,null),Z(this,`altKeyPressed`,!1),Z(this,`mouseMoveTimeoutTimer`,null),Z(this,`asyncEndDragFrameId`,null),Z(this,`dragOverTargetIds`,null),Z(this,`lastClientOffset`,null),Z(this,`hoverRafId`,null),Z(this,`getSourceClientOffset`,function(e){var t=i.sourceNodes.get(e);return t&&Us(t)||null}),Z(this,`endDragNativeItem`,function(){i.isDraggingNativeItem()&&(i.actions.endDrag(),i.currentNativeHandle&&i.registry.removeSource(i.currentNativeHandle),i.currentNativeHandle=null,i.currentNativeSource=null)}),Z(this,`isNodeInDocument`,function(e){return!!(e&&i.document&&i.document.body&&i.document.body.contains(e))}),Z(this,`endDragIfSourceWasRemovedFromDOM`,function(){var e=i.currentDragSourceNode;e==null||i.isNodeInDocument(e)||i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),Z(this,`handleTopDragStartCapture`,function(){i.clearCurrentDragSourceNode(),i.dragStartSourceIds=[]}),Z(this,`handleTopDragStart`,function(e){if(!e.defaultPrevented){var t=i.dragStartSourceIds;i.dragStartSourceIds=null;var n=Ws(e);i.monitor.isDragging()&&i.actions.endDrag(),i.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:i.getSourceClientOffset,clientOffset:n});var r=e.dataTransfer,a=lc(r);if(i.monitor.isDragging()){if(r&&typeof r.setDragImage==`function`){var o=i.monitor.getSourceId(),s=i.sourceNodes.get(o),c=i.sourcePreviewNodes.get(o)||s;if(c){var l=i.getCurrentSourcePreviewNodeOptions(),u=l.anchorX,d=l.anchorY,f=l.offsetX,p=l.offsetY,m=qs(s,c,n,{anchorX:u,anchorY:d},{offsetX:f,offsetY:p});r.setDragImage(c,m.x,m.y)}}try{r?.setData(`application/json`,{})}catch{}i.setCurrentDragSourceNode(e.target),i.getCurrentSourcePreviewNodeOptions().captureDraggingState?i.actions.publishDragSource():setTimeout(function(){return i.actions.publishDragSource()},0)}else if(a)i.beginDragNativeItem(a);else if(r&&!r.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute(`draggable`)))return;else e.preventDefault()}}),Z(this,`handleTopDragEndCapture`,function(){i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),Z(this,`handleTopDragEnterCapture`,function(e){if(i.dragEnterTargetIds=[],!(!i.enterLeaveCounter.enter(e.target)||i.monitor.isDragging())){var t=e.dataTransfer,n=lc(t);n&&i.beginDragNativeItem(n,t)}}),Z(this,`handleTopDragEnter`,function(e){var t=i.dragEnterTargetIds;i.dragEnterTargetIds=[],i.monitor.isDragging()&&(i.altKeyPressed=e.altKey,t.length>0&&i.actions.hover(t,{clientOffset:Ws(e)}),t.some(function(e){return i.monitor.canDropOnTarget(e)})&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=i.getCurrentDropEffect())))}),Z(this,`handleTopDragOverCapture`,function(){i.dragOverTargetIds=[]}),Z(this,`handleTopDragOver`,function(e){var t=i.dragOverTargetIds;if(i.dragOverTargetIds=[],!i.monitor.isDragging()){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`none`);return}i.altKeyPressed=e.altKey,i.lastClientOffset=Ws(e),i.hoverRafId===null&&typeof requestAnimationFrame<`u`&&(i.hoverRafId=requestAnimationFrame(function(){i.monitor.isDragging()&&i.actions.hover(t||[],{clientOffset:i.lastClientOffset}),i.hoverRafId=null})),(t||[]).some(function(e){return i.monitor.canDropOnTarget(e)})?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=i.getCurrentDropEffect())):i.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`none`))}),Z(this,`handleTopDragLeaveCapture`,function(e){i.isDraggingNativeItem()&&e.preventDefault(),i.enterLeaveCounter.leave(e.target)&&i.isDraggingNativeItem()&&setTimeout(function(){return i.endDragNativeItem()},0)}),Z(this,`handleTopDropCapture`,function(e){if(i.dropTargetIds=[],i.isDraggingNativeItem()){var t;e.preventDefault(),(t=i.currentNativeSource)==null||t.loadDataTransfer(e.dataTransfer)}else lc(e.dataTransfer)&&e.preventDefault();i.enterLeaveCounter.reset()}),Z(this,`handleTopDrop`,function(e){var t=i.dropTargetIds;i.dropTargetIds=[],i.actions.hover(t,{clientOffset:Ws(e)}),i.actions.drop({dropEffect:i.getCurrentDropEffect()}),i.isDraggingNativeItem()?i.endDragNativeItem():i.monitor.isDragging()&&i.actions.endDrag()}),Z(this,`handleSelectStart`,function(e){var t=e.target;typeof t.dragDrop==`function`&&(t.tagName===`INPUT`||t.tagName===`SELECT`||t.tagName===`TEXTAREA`||t.isContentEditable||(e.preventDefault(),t.dragDrop()))}),this.options=new mc(n,r),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new Ps(this.isNodeInDocument)}return yc(e,[{key:`profile`,value:function(){return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:this.dragStartSourceIds?.length||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:this.dragOverTargetIds?.length||0}}},{key:`window`,get:function(){return this.options.window}},{key:`document`,get:function(){return this.options.document}},{key:`rootElement`,get:function(){return this.options.rootElement}},{key:`setup`,value:function(){var e=this.rootElement;if(e!==void 0){if(e.__isReactDndBackendSetUp)throw Error(`Cannot have two HTML5 backends at the same time.`);e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}},{key:`teardown`,value:function(){var e=this.rootElement;if(e!==void 0&&(e.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var t;(t=this.window)==null||t.cancelAnimationFrame(this.asyncEndDragFrameId)}}},{key:`connectDragPreview`,value:function(e,t,n){var r=this;return this.sourcePreviewNodeOptions.set(e,n),this.sourcePreviewNodes.set(e,t),function(){r.sourcePreviewNodes.delete(e),r.sourcePreviewNodeOptions.delete(e)}}},{key:`connectDragSource`,value:function(e,t,n){var r=this;this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,n);var i=function(t){return r.handleDragStart(t,e)},a=function(e){return r.handleSelectStart(e)};return t.setAttribute(`draggable`,`true`),t.addEventListener(`dragstart`,i),t.addEventListener(`selectstart`,a),function(){r.sourceNodes.delete(e),r.sourceNodeOptions.delete(e),t.removeEventListener(`dragstart`,i),t.removeEventListener(`selectstart`,a),t.setAttribute(`draggable`,`false`)}}},{key:`connectDropTarget`,value:function(e,t){var n=this,r=function(t){return n.handleDragEnter(t,e)},i=function(t){return n.handleDragOver(t,e)},a=function(t){return n.handleDrop(t,e)};return t.addEventListener(`dragenter`,r),t.addEventListener(`dragover`,i),t.addEventListener(`drop`,a),function(){t.removeEventListener(`dragenter`,r),t.removeEventListener(`dragover`,i),t.removeEventListener(`drop`,a)}}},{key:`addEventListeners`,value:function(e){e.addEventListener&&(e.addEventListener(`dragstart`,this.handleTopDragStart),e.addEventListener(`dragstart`,this.handleTopDragStartCapture,!0),e.addEventListener(`dragend`,this.handleTopDragEndCapture,!0),e.addEventListener(`dragenter`,this.handleTopDragEnter),e.addEventListener(`dragenter`,this.handleTopDragEnterCapture,!0),e.addEventListener(`dragleave`,this.handleTopDragLeaveCapture,!0),e.addEventListener(`dragover`,this.handleTopDragOver),e.addEventListener(`dragover`,this.handleTopDragOverCapture,!0),e.addEventListener(`drop`,this.handleTopDrop),e.addEventListener(`drop`,this.handleTopDropCapture,!0))}},{key:`removeEventListeners`,value:function(e){e.removeEventListener&&(e.removeEventListener(`dragstart`,this.handleTopDragStart),e.removeEventListener(`dragstart`,this.handleTopDragStartCapture,!0),e.removeEventListener(`dragend`,this.handleTopDragEndCapture,!0),e.removeEventListener(`dragenter`,this.handleTopDragEnter),e.removeEventListener(`dragenter`,this.handleTopDragEnterCapture,!0),e.removeEventListener(`dragleave`,this.handleTopDragLeaveCapture,!0),e.removeEventListener(`dragover`,this.handleTopDragOver),e.removeEventListener(`dragover`,this.handleTopDragOverCapture,!0),e.removeEventListener(`drop`,this.handleTopDrop),e.removeEventListener(`drop`,this.handleTopDropCapture,!0))}},{key:`getCurrentSourceNodeOptions`,value:function(){var e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return gc({dropEffect:this.altKeyPressed?`copy`:`move`},t||{})}},{key:`getCurrentDropEffect`,value:function(){return this.isDraggingNativeItem()?`copy`:this.getCurrentSourceNodeOptions().dropEffect}},{key:`getCurrentSourcePreviewNodeOptions`,value:function(){var e=this.monitor.getSourceId();return gc({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}},{key:`isDraggingNativeItem`,value:function(){var e=this.monitor.getItemType();return Object.keys(Js).some(function(t){return Js[t]===e})}},{key:`beginDragNativeItem`,value:function(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=cc(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:`setCurrentDragSourceNode`,value:function(e){var t=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout(function(){return t.rootElement?.addEventListener(`mousemove`,t.endDragIfSourceWasRemovedFromDOM,!0)},1e3)}},{key:`clearCurrentDragSourceNode`,value:function(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var e;(e=this.window)==null||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener(`mousemove`,this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:`handleDragStart`,value:function(e,t){e.defaultPrevented||(this.dragStartSourceIds||=[],this.dragStartSourceIds.unshift(t))}},{key:`handleDragEnter`,value:function(e,t){this.dragEnterTargetIds.unshift(t)}},{key:`handleDragOver`,value:function(e,t){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}},{key:`handleDrop`,value:function(e,t){this.dropTargetIds.unshift(t)}}]),e}(),xc;function Sc(){return xc||(xc=new Image,xc.src=`data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==`),xc}var Cc=function(e,t,n){return new bc(e,t,n)};function wc(e,t){return typeof e==`function`?e(t):e??`NODE`}function Tc(e){return e.isDraggable&&!e.isEditing}function Ec(e){let t=W(),n=t.selectedIds,[r,i,a]=ts(()=>({canDrag:()=>Tc(e),type:wc(t.props.dragType,e),item:()=>{let r=t.isSelected(e.id)?Array.from(n):[e.id];return t.dispatch(_n.dragStart(e.id,r)),{id:e.id,dragIds:r,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(_n.dragEnd())}}),[n,e,t.props.dragType]);return(0,B.useEffect)(()=>{a(Sc())},[a]),i}function Dc(e,t){let n=e.getBoundingClientRect(),r=t.x-Math.round(n.x),i=t.y-Math.round(n.y),a=n.height,o=i<a/2,s=!o,c=a/4,l=i>c&&i<a-c;return{x:r,inTopHalf:o,inBottomHalf:s,inMiddle:l,atTop:!l&&o,atBottom:!l&&s}}function Oc(e,t,n,r){return e?e.isInternal?r.atTop?[t,e]:r.inMiddle?[e,e]:[e,n]:r.inTopHalf?[t,e]:[e,n]:[t,null]}function kc(e,t){return{parentId:e||null,index:t}}function Ac(e,t){return{type:`line`,index:e,level:t}}function jc(e){return{type:`highlight`,id:e}}function Mc(e,t){let n=e;for(;n.parent&&n.level>t;)n=n.parent;return{parentId:n.parent?.id||null,index:kt(n)+1}}function Nc(e){let t=Dc(e.element,e.offset),n=e.indent,r=Math.round(Math.max(0,t.x-n)/n),{node:i,nextNode:a,prevNode:o}=e,[s,c]=Oc(i,o,a,t);if(i&&i.isInternal&&t.inMiddle)return{drop:kc(i.id,null),cursor:jc(i.id)};if(!s)return{drop:kc(c?.parent?.id,0),cursor:Ac(0,0)};if(Tt(s)){let e=wt(r,c?.level||0,s.level);return{drop:Mc(s,e),cursor:Ac(s.rowIndex+1,e)}}if(Et(s)){let e=wt(r,c?.level||0,s.level);return{drop:Mc(s,e),cursor:Ac(s.rowIndex+1,e)}}if(Dt(s)){let e=wt(r,0,s.level+1);return e>s.level?{drop:kc(s.id,0),cursor:Ac(s.rowIndex+1,e)}:{drop:Mc(s,e),cursor:Ac(s.rowIndex+1,e)}}return{drop:kc(s?.id,0),cursor:Ac(s.rowIndex+1,s.level+1)}}function Pc(e,t){let n=W(),[r,i]=ys(()=>({accept:`NODE`,canDrop:()=>n.canDrop(),hover:(r,i)=>{let a=i.getClientOffset();if(!e.current||!a)return;let{cursor:o,drop:s}=Nc({element:e.current,offset:a,indent:n.indent,node:t,prevNode:t.prev,nextNode:t.next});s&&n.dispatch(_n.hovering(s.parentId,s.index)),i.canDrop()?o&&n.showCursor(o):n.hideCursor()},drop:(e,t)=>{if(!t.canDrop())return null;n.drop()}}),[t,e.current,n.props]);return i}function Fc(e){let t=W(),n=t.at(e);if(!n)throw Error(`Could not find node for index: ${e}`);return(0,B.useMemo)(()=>{let r=n.clone();return t.visibleNodes[e]=r,r},[...Object.values(n.state),n])}var Ic=B.memo(function({index:e,style:t}){St(),vt();let n=W(),r=Fc(e),i=(0,B.useRef)(null),a=Ec(r),o=Pc(i,r),s=(0,B.useCallback)(e=>{i.current=e,o(e)},[o]),c=n.indent*r.level,l=(0,B.useMemo)(()=>({paddingLeft:c}),[c]),u=(0,B.useMemo)(()=>Object.assign(Object.assign({},t),{top:parseFloat(t.top)+(n.props.padding??n.props.paddingTop??0),minWidth:`max-content`}),[t,n.props.padding,n.props.paddingTop]),d={role:`treeitem`,"aria-level":r.level+1,"aria-selected":r.isSelected,"aria-expanded":r.isOpen,style:u,tabIndex:-1,className:n.props.rowClassName};(0,B.useEffect)(()=>{var e;!r.isEditing&&r.isFocused&&((e=i.current)==null||e.focus({preventScroll:!0}))},[r.isEditing,r.isFocused,i.current]);let f=n.renderNode,p=n.renderRow;return(0,V.jsx)(p,{node:r,innerRef:s,attrs:d,children:(0,V.jsx)(f,{node:r,tree:n,style:l,dragHandle:a})})}),Lc=``,Rc=null;function zc(){St();let e=W();return(0,V.jsx)(`div`,{role:`tree`,"aria-label":e.props[`aria-label`],"aria-labelledby":e.props[`aria-labelledby`],"aria-multiselectable":!e.props.disableMultiSelection||void 0,style:{height:e.height,width:e.width,minHeight:0,minWidth:0},onContextMenu:e.props.onContextMenu,onClick:e.props.onClick,tabIndex:0,onFocus:t=>{t.currentTarget.contains(t.relatedTarget)||e.onFocus()},onBlur:t=>{t.currentTarget.contains(t.relatedTarget)||e.onBlur()},onKeyDown:t=>{if(e.isEditing)return;if(t.key===`Backspace`){if(!e.props.onDelete)return;let t=Array.from(e.selectedIds);if(t.length>1){let n=e.mostRecentNode;for(;n&&n.isSelected;)n=n.nextSibling;n||=e.lastNode,e.focus(n,{scroll:!1}),e.delete(Array.from(t))}else{let t=e.focusedNode;if(t){let n=t.nextSibling,r=t.parent;e.focus(n||r,{scroll:!1}),e.delete(t)}}return}if(t.key===`Tab`&&!t.shiftKey){t.preventDefault(),Nt(t.currentTarget);return}if(t.key===`Tab`&&t.shiftKey){t.preventDefault(),Pt(t.currentTarget);return}if(t.key===`ArrowDown`){t.preventDefault();let n=e.nextNode;if(t.metaKey){e.select(e.focusedNode),e.activate(e.focusedNode);return}else if(!t.shiftKey||e.props.disableMultiSelection){e.focus(n);return}else{if(!n)return;let t=e.focusedNode;t?t.isSelected?e.selectContiguous(n):e.selectMulti(n):e.focus(e.firstNode);return}}if(t.key===`ArrowUp`){t.preventDefault();let n=e.prevNode;if(!t.shiftKey||e.props.disableMultiSelection){e.focus(n);return}else{if(!n)return;let t=e.focusedNode;t?t.isSelected?e.selectContiguous(n):e.selectMulti(n):e.focus(e.lastNode);return}}if(t.key===`ArrowRight`){let t=e.focusedNode;if(!t)return;t.isInternal&&t.isOpen?e.focus(e.nextNode):t.isInternal&&e.open(t.id);return}if(t.key===`ArrowLeft`){let t=e.focusedNode;if(!t||t.isRoot)return;t.isInternal&&t.isOpen?e.close(t.id):t.parent?.isRoot||e.focus(t.parent);return}if(t.key===`a`&&(t.metaKey||t.ctrlKey)&&!e.props.disableMultiSelection){t.preventDefault(),e.selectAll();return}if(t.key===`a`&&!t.metaKey&&!t.ctrlKey&&e.props.onCreate){e.createLeaf();return}if(t.key===`A`&&!t.metaKey&&!t.ctrlKey){if(!e.props.onCreate)return;e.createInternal();return}if(t.key===`Home`){t.preventDefault(),e.focus(e.firstNode);return}if(t.key===`End`){t.preventDefault(),e.focus(e.lastNode);return}if(t.key===`Enter`){let t=e.focusedNode;if(!t||!t.isEditable||!e.props.onRename)return;setTimeout(()=>{t&&e.edit(t)});return}if(t.key===` `){t.preventDefault();let n=e.focusedNode;if(!n)return;n.isLeaf?(n.select(),n.activate()):n.toggle();return}if(t.key===`*`){let t=e.focusedNode;if(!t)return;e.openSiblings(t);return}if(t.key===`PageUp`){t.preventDefault(),e.pageUp();return}t.key===`PageDown`&&(t.preventDefault(),e.pageDown()),clearTimeout(Rc),Lc+=t.key,Rc=setTimeout(()=>{Lc=``},600);let n=e.visibleNodes.find(e=>{let t=e.data.name;return typeof t==`string`?t.toLowerCase().startsWith(Lc):!1});n&&e.focus(n.id)},children:(0,V.jsx)(Bc,{})})}function Bc(){let e=W(),t={className:e.props.className,outerRef:e.listEl,itemCount:e.visibleNodes.length,height:e.height,width:e.width,overscanCount:e.overscanCount,itemKey:t=>e.visibleNodes[t]?.id||t,outerElementType:e.props.outerElementType??nr,innerElementType:e.props.innerElementType??ar,onScroll:e.props.onScroll,onItemsRendered:e.onItemsRendered.bind(e)};return typeof e.props.rowHeight==`function`?(0,V.jsx)(Qn,Object.assign({},t,{itemSize:e.rowHeightAt,ref:e.list,children:Ic})):(0,V.jsx)($n,Object.assign({},t,{itemSize:e.rowHeight,ref:e.list,children:Ic}))}function Vc(e){return e.isFiltered?Uc(e.root,e.isMatch.bind(e)):Hc(e.root)}function Hc(e){let t=[];function n(e){var r;e.level>=0&&t.push(e),e.isOpen&&((r=e.children)==null||r.forEach(n))}return n(e),t.forEach(Wc),t}function Uc(e,t){let n={},r=[];function i(e){if(!e.isRoot&&t(e)){n[e.id]=!0;let t=e.parent;for(;t;)n[t.id]=!0,t=t.parent}if(e.children)for(let t of e.children)i(t)}function a(e){var t;e.level>=0&&n[e.id]&&r.push(e),e.isOpen&&((t=e.children)==null||t.forEach(a))}return i(e),a(e),r.forEach(Wc),r}function Wc(e,t){e.rowIndex=t}var Gc=e=>e.reduce((e,t,n)=>(e[t.id]=n,e),{}),Kc=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},{safeRun:Q}=Ct,qc=class e{constructor(e,t,n,r){this.store=e,this.props=t,this.list=n,this.listEl=r,this.visibleStartIndex=0,this.visibleStopIndex=0,this.rowOffsets=null,this.rowHeightAt=e=>{let t=this.props.rowHeight;if(typeof t==`function`){let n=this.at(e);return n?t(n):this.rowHeight}return t??24},this.rowTopPosition=e=>{if(typeof this.props.rowHeight!=`function`)return e*this.rowHeight;let t=this.getRowOffsets();return t[Math.max(0,Math.min(e,t.length-1))]},this.redrawList=(e=0)=>{this.rowOffsets=null;let t=this.list.current;t&&`resetAfterIndex`in t&&t.resetAfterIndex(Math.max(0,e))},this.root=rn(this),this.visibleNodes=Vc(this),this.idToIndex=Gc(this.visibleNodes)}update(e){this.props=e,this.root=rn(this),this.visibleNodes=Vc(this),this.idToIndex=Gc(this.visibleNodes),this.rowOffsets=null;let t=this.list.current;t&&`resetAfterIndex`in t&&t.resetAfterIndex(0,!1)}dispatch(e){return this.store.dispatch(e)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){return this.props.width??300}get height(){return this.props.height??500}get indent(){return this.props.indent??24}get rowHeight(){return typeof this.props.rowHeight==`number`?this.props.rowHeight:24}getRowOffsets(){if(this.rowOffsets)return this.rowOffsets;let e=[0];for(let t=0;t<this.visibleNodes.length;t++)e.push(e[t]+this.rowHeightAt(t));return this.rowOffsets=e,e}get overscanCount(){return this.props.overscanCount??1}get searchTerm(){return(this.props.searchTerm||``).trim()}get matchFn(){let e=this.props.searchMatch??((e,t)=>JSON.stringify(Object.values(e.data)).toLocaleLowerCase().includes(t.toLocaleLowerCase()));return t=>e(t,this.searchTerm)}accessChildren(e){return Rt(e,this.props.childrenAccessor||`children`)??null}accessId(e){let t=Rt(e,this.props.idAccessor||`id`);if(!t)throw Error(`Data must contain an 'id' property or props.idAccessor must return a string`);return t}identify(e){return typeof e==`string`?e:e instanceof an?e.id:Rt(e,this.props.idAccessor||`id`)}identifyNull(e){return e==null?null:this.identify(e)}get firstNode(){return this.visibleNodes[0]??null}get lastNode(){return this.visibleNodes[this.visibleNodes.length-1]??null}get focusedNode(){return this.get(this.state.nodes.focus.id)??null}get mostRecentNode(){return this.get(this.state.nodes.selection.mostRecent)??null}get nextNode(){let e=this.indexOf(this.focusedNode);return e===null?null:this.at(e+1)}get prevNode(){let e=this.indexOf(this.focusedNode);return e===null?null:this.at(e-1)}get(e){return e&&e in this.idToIndex&&this.visibleNodes[this.idToIndex[e]]||null}at(e){return this.visibleNodes[e]||null}nodesBetween(e,t){if(e===null||t===null)return[];let n=this.indexOf(e)??0,r=this.indexOf(t);if(r===null)return[];let i=Math.min(n,r),a=Math.max(n,r);return this.visibleNodes.slice(i,a+1)}indexOf(e){let t=this.identifyNull(e);return t?this.idToIndex[t]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:`internal`})}createLeaf(){return this.create({type:`leaf`})}create(){return Kc(this,arguments,void 0,function*(e={}){let t=e.parentId===void 0?qt(this):e.parentId,n=e.index??Wt(this),r=e.type??`leaf`,i=yield Q(this.props.onCreate,{type:r,parentId:t,index:n,parentNode:this.get(t)});i&&(this.focus(i),setTimeout(()=>{this.edit(i).then(()=>{this.select(i),this.activate(i)})}))})}delete(e){return Kc(this,void 0,void 0,function*(){if(!e)return;let t=(Array.isArray(e)?e:[e]).map(e=>this.identify(e)),n=t.map(e=>this.get(e)).filter(e=>!!e),r=n.length?Math.min(...n.map(e=>e.rowIndex??0)):0;yield Q(this.props.onDelete,{nodes:n,ids:t}),this.redrawList(r)})}edit(t){let n=this.identify(t);return this.resolveEdit({cancelled:!0}),this.scrollTo(n),this.dispatch(on(n)),this.redrawList(this.get(n)?.rowIndex??0),new Promise(t=>{e.editPromise=t})}submit(e,t){return Kc(this,void 0,void 0,function*(){if(!e)return;let n=this.identify(e);yield Q(this.props.onRename,{id:n,name:t,node:this.get(n)}),this.dispatch(on(null)),this.resolveEdit({cancelled:!1,value:t}),this.redrawList(this.get(n)?.rowIndex??0),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(on(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(e){let t=this.get(this.identifyNull(e));t&&Q(this.props.onActivate,t)}resolveEdit(t){let n=e.editPromise;n&&n(t),e.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let e=[];for(let t of Array.from(this.selectedIds)){let n=this.get(t);n&&e.push(n)}return e}focus(e,t={}){e&&(this.props.selectionFollowsFocus?this.select(e):(this.dispatch(cn(this.identify(e))),t.scroll!==!1&&this.scrollTo(e),this.focusedNode&&Q(this.props.onFocus,this.focusedNode)))}pageUp(){let e=this.visibleStartIndex,t=this.visibleStopIndex-e,n=this.focusedNode?.rowIndex??0;n=n>e?e:Math.max(e-t,0),this.focus(this.at(n))}pageDown(){let e=this.visibleStartIndex,t=this.visibleStopIndex,n=t-e,r=this.focusedNode?.rowIndex??0;r=r<t?t:Math.min(r+n,this.visibleNodes.length-1),this.focus(this.at(r))}select(e,t={}){if(!e)return;let n=t.focus!==!1,r=this.identify(e);n&&this.dispatch(cn(r)),this.get(r)?.isSelectable&&this.setSelection({ids:[r],anchor:r,mostRecent:r}),this.scrollTo(r,t.align),this.focusedNode&&n&&Q(this.props.onFocus,this.focusedNode)}deselect(e){if(!e)return;let t=this.identify(e);this.dispatch(hn.remove(t)),Q(this.props.onSelect,this.selectedNodes)}selectMulti(e,t={}){let n=this.get(this.identifyNull(e));if(!n)return;let r=t.focus!==!1;r&&this.dispatch(cn(n.id)),n.isSelectable&&(this.dispatch(hn.add(n.id)),this.dispatch(hn.anchor(n.id)),this.dispatch(hn.mostRecent(n.id))),this.scrollTo(n,t.align),this.focusedNode&&r&&Q(this.props.onFocus,this.focusedNode),Q(this.props.onSelect,this.selectedNodes)}selectContiguous(e){if(!e)return;let t=this.identify(e);if(this.dispatch(cn(t)),this.get(t)?.isSelectable){let{anchor:e,mostRecent:n}=this.state.nodes.selection,r=this.filterSelectableNodes(this.nodesBetween(e,this.identifyNull(t)));this.dispatch(hn.remove(this.nodesBetween(e,n))),this.dispatch(hn.add(r)),this.dispatch(hn.mostRecent(t))}this.scrollTo(t),this.focusedNode&&Q(this.props.onFocus,this.focusedNode),Q(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null})}selectAll(){let e=this.filterSelectableNodes(Object.keys(this.idToIndex));this.setSelection({ids:e,anchor:e[0]??null,mostRecent:e[e.length-1]??null}),this.dispatch(cn(this.lastNode?.id)),this.focusedNode&&Q(this.props.onFocus,this.focusedNode)}filterSelectableNodes(e){return e.map(e=>this.get(this.identify(e))).filter(e=>!!e&&e.isSelectable)}setSelection(e){let t=new Set(e.ids?.map(e=>this.identify(e))),n=this.identifyNull(e.anchor),r=this.identifyNull(e.mostRecent);this.dispatch(hn.set({ids:t,anchor:n,mostRecent:r})),Q(this.props.onSelect,this.selectedNodes)}get cursorParentId(){let{cursor:e}=this.state.dnd;switch(e.type){case`highlight`:return e.id;default:return null}}get cursorOverFolder(){return this.state.dnd.cursor.type===`highlight`}get dragNodes(){return this.state.dnd.dragIds.map(e=>this.get(e)).filter(e=>!!e)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){if(this.isFiltered)return!1;let e=this.get(this.state.dnd.parentId)??this.root,t=this.dragNodes,n=this.props.disableDrop;for(let n of t)if(!n||!e||n.isInternal&&Ot(e,n))return!1;return typeof n==`function`?!n({parentNode:e,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof n==`string`?!e.data[n]:typeof n==`boolean`?!n:!0}drop(){let{parentId:e,index:t,dragIds:n}=this.state.dnd;Q(this.props.onMove,{dragIds:n,parentId:e===`__REACT_ARBORIST_INTERNAL_ROOT__`?null:e,index:t===null?0:t,dragNodes:this.dragNodes,parentNode:this.get(e)}),this.open(e)}hideCursor(){this.dispatch(_n.cursor({type:`none`}))}showCursor(e){this.dispatch(_n.cursor(e))}open(e,t=!0){let n=this.identifyNull(e);n&&(this.isOpen(n)||(this.dispatch(dn.open(n,this.isFiltered)),t&&this.redrawList(this.get(n)?.rowIndex??0),Q(this.props.onToggle,n)))}close(e,t=!0){let n=this.identifyNull(e);n&&this.isOpen(n)&&(this.dispatch(dn.close(n,this.isFiltered)),t&&this.redrawList(this.get(n)?.rowIndex??0),Q(this.props.onToggle,n))}toggle(e){let t=this.identifyNull(e);if(t)return this.isOpen(t)?this.close(t):this.open(t)}openParents(e){let t=this.identifyNull(e);if(!t)return;let n=jt(this.root,t)?.parent;for(;n;)this.open(n.id,!1),n=n.parent;this.redrawList()}openSiblings(e){let t=e.parent;if(!t)this.toggle(e.id);else if(t.children){let n=e.isOpen;for(let e of t.children)e.isInternal&&(n?this.close(e.id,!1):this.open(e.id,!1));this.redrawList(),this.scrollTo(this.focusedNode)}}openAll(){Mt(this.root,e=>{e.isInternal&&this.open(e.id,!1)}),this.redrawList()}closeAll(){Mt(this.root,e=>{e.isInternal&&this.close(e.id,!1)}),this.redrawList()}scrollTo(e,t=`smart`){if(!e)return;let n=this.identify(e);return this.openParents(n),Ut(()=>n in this.idToIndex).then(()=>{var e;let r=this.idToIndex[n];r!==void 0&&((e=this.list.current)==null||e.scrollToItem(r,t))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){return!!this.props.searchTerm?.trim()}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(e){return e?this.state.nodes.selection.ids.has(e):!1}isOpen(e){if(!e)return!1;if(e===`__REACT_ARBORIST_INTERNAL_ROOT__`)return!0;let t=this.props.openByDefault??!0;return this.isFiltered?this.state.nodes.open.filtered[e]??!0:this.state.nodes.open.unfiltered[e]??t}isEditable(e){return this.isActionPossible(e,this.props.disableEdit)}isDraggable(e){return this.isActionPossible(e,this.props.disableDrag)}isSelectable(e){return this.isActionPossible(e,this.props.disableSelect)}isActionPossible(e,t=()=>!1){return!Rt(e,t)}isDragging(e){let t=this.identifyNull(e);return t?this.state.nodes.drag.id===t:!1}isFocused(e){return this.hasFocus&&this.state.nodes.focus.id===e}isMatch(e){return this.matchFn(e)}willReceiveDrop(e){let t=this.identifyNull(e);if(!t)return!1;let{destinationParentId:n,destinationIndex:r}=this.state.nodes.drag;return t===n&&r===null}onFocus(){let e=this.focusedNode||this.firstNode;e&&this.dispatch(cn(e.id))}onBlur(){this.dispatch(ln())}onItemsRendered(e){this.visibleStartIndex=e.visibleStartIndex,this.visibleStopIndex=e.visibleStopIndex}get renderContainer(){return this.props.renderContainer||zc}get renderRow(){return this.props.renderRow||Qt}get renderNode(){return this.props.children||$t}get renderDragPreview(){return this.props.renderDragPreview||Sn}get renderCursor(){return this.props.renderCursor||Zt}};function $(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Jc=typeof Symbol==`function`&&Symbol.observable||`@@observable`,Yc=()=>Math.random().toString(36).substring(7).split(``).join(`.`),Xc={INIT:`@@redux/INIT${Yc()}`,REPLACE:`@@redux/REPLACE${Yc()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Yc()}`};function Zc(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Qc(e,t,n){if(typeof e!=`function`)throw Error($(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error($(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error($(1));return n(Qc)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error($(3));return i}function d(e){if(typeof e!=`function`)throw Error($(4));if(c)throw Error($(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error($(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!Zc(e))throw Error($(7));if(e.type===void 0)throw Error($(8));if(typeof e.type!=`string`)throw Error($(17));if(c)throw Error($(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error($(10));r=e,f({type:Xc.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error($(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[Jc](){return this}}}return f({type:Xc.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[Jc]:m}}function $c(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:Xc.INIT})===void 0)throw Error($(12));if(n(void 0,{type:Xc.PROBE_UNKNOWN_ACTION()})===void 0)throw Error($(13))})}function el(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let i=t[r];typeof e[i]==`function`&&(n[i]=e[i])}let r=Object.keys(n),i;try{$c(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let a=!1,o={};for(let i=0;i<r.length;i++){let s=r[i],c=n[s],l=e[s],u=c(l,t);if(u===void 0)throw t&&t.type,Error($(14));o[s]=u,a||=u!==l}return a||=r.length!==Object.keys(e).length,a?o:e}}function tl(e=mn().nodes.drag,t){switch(t.type){case`DND_DRAG_START`:return Object.assign(Object.assign({},e),{id:t.id,selectedIds:t.dragIds});case`DND_DRAG_END`:return Object.assign(Object.assign({},e),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case`DND_HOVERING`:return t.parentId!==e.destinationParentId||t.index!=e.destinationIndex?Object.assign(Object.assign({},e),{destinationParentId:t.parentId,destinationIndex:t.index}):e;default:return e}}var nl=el({nodes:el({focus:un,edit:sn,open:pn,selection:gn,drag:tl}),dnd:vn}),rl=ht(),il=mn();function al({treeProps:e,imperativeHandle:t,children:n}){let r=(0,B.useRef)(null),i=(0,B.useRef)(null),a=(0,B.useRef)(Qc(nl,mn(e))),o=(0,rl.useSyncExternalStore)(a.current.subscribe,a.current.getState,()=>il),s=(0,B.useMemo)(()=>new qc(a.current,e,r,i),[]),c=(0,B.useRef)(0);return(0,B.useMemo)(()=>{c.current+=1,s.update(e)},Object.values(e)),(0,B.useMemo)(()=>{c.current+=1,s.update(s.props)},[o.nodes.open]),(0,B.useImperativeHandle)(t,()=>s),(0,B.useEffect)(()=>{s.props.selection?s.select(s.props.selection,{focus:!1}):s.deselectAll()},[s.props.selection]),(0,B.useEffect)(()=>{s.props.searchTerm||a.current.dispatch(dn.clear(!0))},[s.props.searchTerm]),(0,V.jsx)(gt.Provider,{value:s,children:(0,V.jsx)(xt.Provider,{value:c.current,children:(0,V.jsx)(_t.Provider,{value:o.nodes,children:(0,V.jsx)(yt.Provider,{value:o.dnd,children:(0,V.jsx)(ka,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||Cc,options:{rootElement:s.props.dndRootElement||void 0}},{children:n}))})})})})}function ol(){let e=W(),[,t]=ys(()=>({accept:`NODE`,canDrop:(t,n)=>n.isOver({shallow:!0})?e.canDrop():!1,hover:(t,n)=>{if(!n.isOver({shallow:!0}))return;let r=n.getClientOffset();if(!e.listEl.current||!r)return;let{cursor:i,drop:a}=Nc({element:e.listEl.current,offset:r,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});a&&e.dispatch(_n.hovering(a.parentId,a.index)),n.canDrop()?i&&e.showCursor(i):e.hideCursor()},drop:(t,n)=>{if(!n.isOver({shallow:!0})||!n.canDrop())return null;e.drop()}}),[e]);t(e.listEl)}function sl(e){return ol(),e.children}function cl(){return(0,V.jsx)(V.Fragment,{children:(0,V.jsx)(W().props.renderContainer||zc,{})})}function ll(){let e=W(),{offset:t,mouse:n,item:r,isDragging:i}=Es(e=>({offset:e.getSourceClientOffset(),mouse:e.getClientOffset(),item:e.getItem(),isDragging:e.isDragging()}));return(0,V.jsx)(e.props.renderDragPreview||Sn,{offset:t,mouse:n,id:r?.id||null,dragIds:r?.dragIds||[],isDragging:i})}function ul(e={}){let t=e.idAccessor??`id`,n=e.childrenAccessor??`children`;return{getId:typeof t==`function`?t:e=>e[t],getChildren:typeof n==`function`?n:e=>e[n],childrenKey:typeof n==`string`?n:`children`}}var dl=class{constructor(e,t={}){this.accessors=ul(t),this.root=fl(e,this.accessors)}get data(){return this.root.children?.map(e=>e.data)??[]}create(e){let t=e.parentId?this.find(e.parentId):this.root;if(!t)return null;t.addChild(e.data,e.index)}move(e){let t=this.find(e.id),n=e.parentId?this.find(e.parentId):this.root;!t||!n||(n.addChild(t.data,e.index),t.drop())}update(e){let t=this.find(e.id);t&&t.update(e.changes)}drop(e){let t=this.find(e.id);t&&t.drop()}find(e,t=this.root){if(!t)return null;if(t.id===e)return t;if(t.children){for(let n of t.children){let t=this.find(e,n);if(t)return t}return null}return null}};function fl(e,t){let n=new ml({},null,t,`ROOT`);return n.children=e.map(e=>pl(e,n,t)),n}function pl(e,t,n){let r=new ml(e,t,n),i=n.getChildren(e);return i&&(r.children=i.map(e=>pl(e,r,n))),r}var ml=class{constructor(e,t,n,r){this.data=e,this.parent=t,this.accessors=n,this.id=r??n.getId(e)}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(e,t){let n=pl(e,this,this.accessors);this.children=this.children??[],this.children.splice(t,0,n);let r=this.accessors.childrenKey,i=this.data;i[r]=i[r]??[],i[r].splice(t,0,e)}removeChild(e){var t,n;(t=this.children)==null||t.splice(e,1),(n=this.data[this.accessors.childrenKey])==null||n.splice(e,1)}update(e){if(this.hasParent()){let t=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),e),t),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}},hl=0;function gl(e,t={}){let[n,r]=(0,B.useState)(e),i=t.idAccessor,a=t.childrenAccessor,o=(0,B.useMemo)(()=>new dl(n,{idAccessor:i,childrenAccessor:a}),[n,i,a]),s=e=>{for(let t of e.dragIds)o.move({id:t,parentId:e.parentId,index:e.index});r(o.data)},c=({name:e,id:t})=>{o.update({id:t,changes:{name:e}}),r(o.data)},l=typeof i==`string`?i:`id`,u=typeof a==`string`?a:`children`;return[n,{onMove:s,onRename:c,onCreate:({parentId:e,index:t,type:n})=>{if(typeof i==`function`)throw Error("React Arborist => initialData can't create nodes when idAccessor is a function: the generated id can't be written under a key the accessor reads. Use a string idAccessor, or the controlled `data` prop with your own onCreate.");if(n===`internal`&&typeof a==`function`)throw Error("React Arborist => initialData can't create folder nodes when childrenAccessor is a function: the new children array can't be written under a key the accessor reads. Use a string childrenAccessor, or the controlled `data` prop with your own onCreate.");let s={[l]:`simple-tree-id-${hl++}`,name:``};return n===`internal`&&(s[u]=[]),o.create({parentId:e,index:t,data:s}),r(o.data),s},onDelete:e=>{e.ids.forEach(e=>o.drop({id:e})),r(o.data)}}]}function _l(e){if(e.initialData&&e.data)throw Error(`React Arborist Tree => Provide either a data or initialData prop, but not both.`);if(e.initialData&&(e.onCreate||e.onDelete||e.onMove||e.onRename))throw Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
|
|
11
|
+
Use the data prop if you want to provide your own handlers.`);if(e.initialData){let[t,n]=gl(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),n),{data:t})}else return e}function vl(e,t){return(0,V.jsxs)(al,{treeProps:_l(e),imperativeHandle:t,children:[(0,V.jsx)(sl,{children:(0,V.jsx)(cl,{})}),(0,V.jsx)(ll,{})]})}var yl=(0,B.forwardRef)(vl),bl=[0,80,180,300,520,900,1200],xl=[80,180,360],Sl=new Set([`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`,`Enter`,` `,`F2`,`Delete`,`Backspace`,`ContextMenu`]);function Cl(e,t){return t.top<e.top?t.top-e.top:t.bottom>e.bottom?t.bottom-e.bottom:0}function wl(e){return e.focusRow&&!e.operationActive&&!e.activeElementIsSearchInput&&!e.searchInputValue}function Tl(e){return e.activeElementIsSearchInput&&!!e.searchInputValue}function El(e){return e.requestedSelect||!e.searchInputValue}function Dl(e){return Sl.has(e)}function Ol(e){return e.rows.find(t=>t.path===e.lastFocusedPath)?.path??e.rows.find(e=>e.selected)?.path??e.rows[0]?.path??null}function kl(e){return e.selectedPath??e.targetPath??e.focusedPath??e.lastFocusedPath??null}function Al(e,t){return Math.max(1,Math.floor(Math.max(0,e)/Math.max(1,t))-1)}function jl(e){if(e.rowCount<=0)return-1;let t=Math.max(0,Math.min(e.currentIndex,e.rowCount-1))+(e.key===`PageUp`?-1:1)*Math.max(1,e.pageSize);return Math.max(0,Math.min(t,e.rowCount-1))}function Ml(e){if(e.nodeType!==`directory`)return!1;let t=e.selectedRow.path===e.nodePath&&e.selectedRow.type===`directory`&&e.selectedRow.expanded===!0;return e.nodeOpen||t||e.openDirectoryPaths.has(e.nodePath)}function Nl(e){let t=!e.metaKey&&!e.ctrlKey&&!e.shiftKey;return e.nodeType===`directory`&&t?`toggle-directory`:e.nodeType===`file`&&t?`open-file`:`select`}function Pl(e){return e.nodeType===`directory`?e.nodeOpen?`close-directory`:`open-directory`:e.nodeType===`file`?`open-file`:`none`}function Fl(e,t=30,n=0,r=25){return e+t+n+r}function Il(e,t,n=1){return e<t+n}function Ll(e,t,n,r=1){return e.find(e=>e.bottom>t+r&&e.top<n)?.path??``}function Rl(e,t,n){if(!e)return[];let r=new Map(t.map(e=>[e.path,e.top]));return E(e).filter(e=>{let t=r.get(e);return typeof t==`number`&&t<n})}function zl(e){return!e.visible&&e.directoryNodes.length===0?[]:e.directoryNodes.map(e=>({kind:`directory`,key:e.path,node:e}))}function Bl(e){return e.map(e=>e.displayName??e.name).filter(Boolean).join(`/`)}function Vl(e){if(!e)return()=>{};let t=e.scrollTop,n=()=>{e.scrollTop=t};return n(),window.requestAnimationFrame(n),window.setTimeout(n,0),window.setTimeout(n,80),window.setTimeout(n,180),n}function Hl(e,t,n){let r=qe(e.node.descendantGitStatus);return(0,V.jsxs)(`button`,{type:`button`,className:`code-file-row directory code-file-sticky-row`,style:H(D(e.node.path)),title:e.node.path,onClick:t=>{t.preventDefault(),t.stopPropagation(),n(e.node)},children:[(0,V.jsx)(`span`,{className:`code-file-chevron expanded`,"aria-hidden":`true`,children:(0,V.jsx)(R,{})}),(0,V.jsx)(`span`,{className:`code-file-name`,children:e.node.displayName??e.node.name}),r&&(0,V.jsx)(`span`,{className:r,title:Ge(`git`,t)})]},e.key)}function Ul({copy:e,items:t,onFocusDirectory:n}){if(t.length===0)return null;let r=t.filter(e=>e.kind===`directory`),i=r[r.length-1];return(0,V.jsx)(`div`,{className:`code-file-sticky-shell`,children:(0,V.jsxs)(`div`,{className:`code-file-sticky-stack`,"data-testid":`code-file-sticky-stack`,"aria-label":e.stickyFolderPath,children:[(0,V.jsx)(`div`,{className:`code-file-sticky-expanded-rows`,children:r.map(t=>Hl(t,e,n))}),i&&(0,V.jsxs)(`button`,{type:`button`,className:`code-file-row directory code-file-sticky-row code-file-sticky-compact-row`,style:H(0),title:i.node.path,onClick:e=>{e.preventDefault(),e.stopPropagation(),n(i.node)},children:[(0,V.jsx)(`span`,{className:`code-file-chevron expanded`,"aria-hidden":`true`,children:(0,V.jsx)(R,{})}),(0,V.jsx)(`span`,{className:`code-file-name`,children:Bl(r.map(e=>e.node))})]})]})})}function Wl({agentId:e,copy:t,fileOperation:n,inputRef:r,item:i,onCancel:a,onInputName:o,onSubmit:s}){return(0,B.useLayoutEffect)(()=>{let e=r.current;e&&(e.focus({preventScroll:!0}),document.activeElement===e&&e.setSelectionRange(0,ot(n)))},[n.item?.path,r]),(0,V.jsx)(`form`,{className:`code-file-inline-operation`,"data-testid":`code-file-inline-operation`,"aria-busy":n.submitting,style:{gridColumn:`3 / -1`},autoComplete:`off`,onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),onSubmit:e=>{e.preventDefault(),e.stopPropagation(),s()},children:(0,V.jsx)(`input`,{id:`code-file-operation-input`,"data-testid":`code-file-operation-input`,name:`farming-file-${e}-rename`,type:`text`,inputMode:`text`,ref:r,defaultValue:n.name,disabled:n.submitting,"aria-label":t.renameEntry(i.name),autoComplete:`off`,"aria-autocomplete":`none`,autoCapitalize:`none`,autoCorrect:`off`,autoFocus:!0,spellCheck:!1,enterKeyHint:`done`,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-bwignore":`true`,"data-form-type":`other`,onInput:e=>{o(e.currentTarget.value)},onKeyDown:e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),a();return}e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),s())}})})}function Gl({copy:e,item:t,viewState:n}){let{directoryDotClassName:r,directoryDotTitleKind:i,fileChangedClassName:a,fileChangedTitleKind:o,fileOpening:s,isDirectory:c,showDirectoryDot:l,visibleGitStatus:u,visibleGitStatusClassName:d,visibleGitStatusLabel:f}=n;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`code-file-name`,children:t.displayName??t.name}),t.symbolicLink&&(0,V.jsx)(`span`,{className:`code-file-symbolic-link`,"aria-hidden":`true`,children:`↷`}),s&&(0,V.jsx)(`span`,{className:`code-file-open-spinner`,title:e.loading,"aria-hidden":`true`}),!s&&l&&(0,V.jsx)(`span`,{className:r,title:Ge(i,e)}),!s&&!c&&f&&(0,V.jsx)(`span`,{className:d,title:e.gitStatus(u||``),children:f}),!s&&!c&&!f&&a&&(0,V.jsx)(`span`,{className:a,title:Ge(o,e)})]})}function Kl(e){e?.focus({preventScroll:!0})}function ql({isDirectory:e,item:t,lastFocusedFilePathRef:n,node:r,treeViewportRef:i,onCancelPendingFileFocus:a,onFocusFileTreeTarget:o,onOpenFileContextMenu:s,onOpenFilePath:c,onToggleDirectory:l}){let u=(0,B.useCallback)(()=>{Kl(i.current?.querySelector(`[role="tree"]`))},[i]),d=(0,B.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),a(),n.current=t.path,r.select(),s(e.clientX,e.clientY,t)},[t,n,r,a,s]),f=(0,B.useCallback)(n=>{e||n.button!==0||n.metaKey||n.ctrlKey||n.shiftKey||c(t.path,{transient:!0})},[e,t.path,c]);return{handleRowClick:(0,B.useCallback)(s=>{a(),n.current=t.path;let d=Nl({nodeType:t.type,metaKey:s.metaKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey}),f=e?Vl(i.current?.closest(`.code-project-list`)):null;if(d===`toggle-directory`){s.preventDefault(),s.stopPropagation();let e=l(t.path);r.select(),r.focus(),u(),e?r.open():r.close(),o(t),f?.();return}if(d===`open-file`&&s.detail===0&&c(t.path,{transient:!0}),r.handleClick(s),r.focus(),u(),s.shiftKey){Kl(s.currentTarget),f?.();return}o(t),f?.()},[u,e,t,n,r,a,o,c,l,i]),handleRowContextMenu:d,handleRowMouseDown:f}}function Jl({activeFilePath:e,agentId:t,copy:n,editorDirtyFilePaths:r,editorExternalChangedFilePaths:i,fileOperation:a,fileOperationInputRef:o,lastFocusedFilePathRef:s,locatedFilePath:c,node:l,openFilePendingPath:u,treeViewportRef:d,onCancelPendingFileFocus:f,onCloseFileOperation:p,onFocusFileTreeTarget:m,onOpenFileContextMenu:h,onOpenFilePath:g,onRememberFileOperationName:_,onToggleDirectory:v,onSubmitFileOperation:y}){let b=l.data,x=Ye({activeFilePath:e,editorDirtyFilePaths:r,editorExternalChangedFilePaths:i,openFilePendingPath:u,item:b,isFocused:l.isFocused,isOpen:l.isOpen,isSelected:l.isSelected}),{chevronState:S,isDirectory:C}=x,w=`${x.rowClasses} ${c===b.path?`located`:``}`.trim(),T=C?``:F(b.path),E=a?.kind===`rename`&&a.item?.path===b.path?a:null,{handleRowClick:D,handleRowContextMenu:O,handleRowMouseDown:k}=ql({isDirectory:C,item:b,lastFocusedFilePathRef:s,node:l,treeViewportRef:d,onCancelPendingFileFocus:f,onFocusFileTreeTarget:m,onOpenFileContextMenu:h,onOpenFilePath:g,onToggleDirectory:v});return(0,V.jsxs)(`div`,{className:w,style:H(l.level),"data-testid":`code-file-row`,"data-file-path":b.path,"data-file-type":b.type,"data-tree-level":l.level,"aria-label":b.path,title:b.linkTarget?`${b.path} ↷ ${b.linkTarget}`:b.linkError?`${b.path} (${b.linkError})`:void 0,tabIndex:-1,"aria-expanded":C?l.isOpen:void 0,onContextMenu:O,onMouseDown:k,onClick:D,children:[(0,V.jsx)(`span`,{className:`code-file-chevron ${S}`,"aria-hidden":`true`,children:S===`expanded`?(0,V.jsx)(R,{}):S===`collapsed`?(0,V.jsx)(z,{}):null}),!C&&(0,V.jsx)(`img`,{className:`code-file-type-icon file`,src:T,alt:``,"aria-hidden":`true`}),E?(0,V.jsx)(Wl,{agentId:t,copy:n,fileOperation:E,inputRef:o,item:b,onCancel:p,onInputName:_,onSubmit:y}):(0,V.jsx)(Gl,{copy:n,item:b,viewState:x})]})}function Yl({activeFilePath:e,agentId:t,copy:n,editorDirtyFilePaths:r,editorExternalChangedFilePaths:i,fileOperation:a,fileOperationInputRef:o,handleTreeKeyDownCapture:s,lastFocusedFilePathRef:c,locatedFilePath:l,openFilePendingPath:u,renderFileTreeRow:d,rowHeight:f,stickyContextItems:p,treeData:m,treeHeight:h,treeRef:g,treeViewportRef:_,visibleTreeRowCount:v,onCancelPendingFileFocus:y,onCloseFileOperation:b,onFocusFileTreeTarget:x,onFocusStickyDirectory:S,onOpenFileContextMenu:C,onOpenFilePath:w,onRememberFileOperationName:T,onToggleDirectory:E,onSubmitFileOperation:D,onToggleTreeNode:O,onTreeFocus:k,onTreeSelect:A,onUpdateFileOperationName:j}){let M=(0,B.useCallback)(e=>{e.target?.closest(`[data-file-path]`)||(e.preventDefault(),y(),C(e.clientX,e.clientY,null))},[y,C]),N=(0,B.useCallback)(({node:s})=>(0,V.jsx)(Jl,{activeFilePath:e,agentId:t,copy:n,editorDirtyFilePaths:r,editorExternalChangedFilePaths:i,fileOperation:a,fileOperationInputRef:o,lastFocusedFilePathRef:c,locatedFilePath:l,node:s,openFilePendingPath:u,treeViewportRef:_,onCancelPendingFileFocus:y,onCloseFileOperation:b,onFocusFileTreeTarget:x,onOpenFileContextMenu:C,onOpenFilePath:w,onRememberFileOperationName:T,onToggleDirectory:E,onSubmitFileOperation:D,onUpdateFileOperationName:j}),[e,t,n,r,i,a,o,c,l,y,b,x,C,w,T,D,E,j,u,_]);return(0,V.jsxs)(`div`,{className:`code-file-tree-viewport`,ref:_,"data-visible-row-count":v,style:{height:h},onKeyDownCapture:s,onContextMenu:M,children:[(0,V.jsx)(Ul,{copy:n,items:p,onFocusDirectory:S}),(0,V.jsx)(yl,{ref:g,data:m,idAccessor:`id`,childrenAccessor:`children`,rowHeight:f,indent:0,height:h,width:`100%`,overscanCount:v,openByDefault:!1,selectionFollowsFocus:!0,className:`code-file-tree`,rowClassName:`code-file-tree-row`,renderRow:d,onToggle:O,onFocus:k,onSelect:A,disableDrag:!0,disableEdit:!0,disableDrop:!0,children:N})]})}function Xl({copy:e,agentLaunchOptions:t,fileMenu:n,fileMenuRef:r,openFileError:i,rootDirectoryError:a,rootDirectoryHasItems:o,rootDirectoryLoading:s,search:c,searchActions:l,tree:u,onCloseFileMenu:d,onCloseFileMenuWithFocusRestore:f,onCopyFileMenuPath:p,onCopyFileMenuShareUrl:m,onOpenNewAgentFromFileMenu:h,onRefreshFileMenuTarget:g,onStartAgentFromFileMenu:_,onStartFileMenuOperation:v,readOnly:y=!1}){return(0,V.jsxs)(V.Fragment,{children:[s&&!o&&(0,V.jsx)(`div`,{className:`code-file-status`,style:H(0),children:e.loading}),a&&(0,V.jsx)(`div`,{className:`code-file-status error`,style:H(0),children:a}),i&&!c.active&&(0,V.jsx)(`div`,{className:`code-file-status error`,"data-testid":`code-file-open-error`,style:H(0),children:i}),c.active&&(0,V.jsx)(Ue,{activeMatchIndex:c.activeMatchIndex,anchorRef:c.anchorRef,containerRef:c.resultsRef,copy:e,error:c.error,jumpTarget:c.jumpTarget,listboxId:c.listboxId,loading:c.loading,matches:c.matches,openFileError:i,query:c.query,showIgnoredSearch:!c.includeIgnored,timeoutMs:c.timeoutMs,truncated:c.truncated,onOpenJumpQuery:l.onOpenJumpQuery,onOpenMatch:l.onOpenMatch,onSearchIgnored:l.onSearchIgnored,onSelectMatchIndex:l.onSelectMatchIndex}),(0,V.jsx)(Yl,{...u,copy:e}),(0,V.jsx)(pt,{agentId:u.agentId,copy:e,agentLaunchOptions:t,fileMenu:n,fileOperation:u.fileOperation,fileMenuRef:r,fileOperationInputRef:u.fileOperationInputRef,onCloseFileMenu:d,onCloseFileMenuWithFocusRestore:f,onCloseFileOperation:u.onCloseFileOperation,onCopyFileMenuPath:p,onCopyFileMenuShareUrl:m,onOpenNewAgent:h,onRefreshFileMenuTarget:g,onRememberFileOperationName:u.onRememberFileOperationName,onStartAgent:_,onStartFileMenuOperation:v,onSubmitFileOperation:u.onSubmitFileOperation,onUpdateFileOperationName:u.onUpdateFileOperationName,readOnly:y})]})}function Zl({copy:e,filesCollapsed:t,refreshStatus:n,search:r,onCancelPendingFileFocus:i,onFileSearchKeyDown:a,onSearchQueryChange:o,onRefreshFiles:s,onToggleFilesCollapsed:c}){let l=n===`refreshing`?e.refreshingFiles:n===`success`?e.filesRefreshed:n===`error`?e.filesRefreshFailed:e.refreshFiles;return(0,V.jsxs)(`div`,{className:`code-files-header ${t?`collapsed`:``}`,children:[(0,V.jsxs)(`div`,{className:`code-files-heading`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`code-files-title`,"aria-expanded":!t,onClick:c,children:[(0,V.jsx)(`span`,{className:`code-file-section-chevron ${t?`collapsed`:`expanded`}`,"aria-hidden":`true`,children:t?(0,V.jsx)(z,{}):(0,V.jsx)(R,{})}),(0,V.jsx)(`span`,{children:e.files})]}),(0,V.jsx)(`button`,{type:`button`,className:`code-files-refresh`,"data-testid":`code-files-refresh`,"data-refresh-status":n,title:l,"aria-label":l,"aria-busy":n===`refreshing`,disabled:n===`refreshing`,onClick:s,children:(0,V.jsx)(`span`,{className:`code-files-refresh-glyph`,"aria-hidden":`true`,children:n===`success`?(0,V.jsx)(ge,{}):n===`error`?(0,V.jsx)(he,{}):`↻`})}),(0,V.jsx)(`span`,{className:`code-visually-hidden`,role:`status`,"aria-live":`polite`,children:n===`idle`?``:l})]}),!t&&(0,V.jsxs)(`label`,{className:`code-file-search-box`,children:[(0,V.jsx)(`span`,{className:`code-file-search-icon`,"aria-hidden":`true`}),(0,V.jsx)(`input`,{ref:r.inputRef,type:`search`,name:`farming-file-search`,inputMode:`search`,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,enterKeyHint:`search`,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-bwignore":`true`,"data-form-type":`other`,value:r.query,onChange:e=>{i(),o(e.target.value)},onFocus:i,onPointerDown:e=>{i(),b()&&(e.preventDefault(),e.currentTarget.focus({preventScroll:!0}))},onMouseDown:i,onKeyDownCapture:a,placeholder:e.searchOrPathLine,"aria-label":e.searchFilesOrJump,"aria-autocomplete":`list`,"aria-controls":r.active?r.listboxId:void 0,"aria-expanded":r.active,"aria-activedescendant":r.activeOptionId,role:`combobox`})]})]})}var Ql=o(),$l=[`#ffb000`,`#dc267f`,`#994f00`,`#40b0a6`,`#b66dff`],eu=`#2188ff`;function tu(e){return{...e}}function nu(e,t){for(let n of e.references??[]){let e=t.get(n.id);if(e!==void 0)return e}}function ru(e,t,n=new Map){let r=-1,i=[];for(let a of e){let o=a.id===t?`HEAD`:`node`,s=(i[i.length-1]?.outputSwimlanes??[]).map(tu),c=[],l=!1;if(a.parentIds.length>0)for(let e of s){if(e.id===a.id){l||=(c.push({id:a.parentIds[0],color:nu(a,n)??e.color}),!0);continue}c.push(tu(e))}for(let t=+!!l;t<a.parentIds.length;t+=1){let i;if(t===0)i=nu(a,n);else{let r=e.find(e=>e.id===a.parentIds[t]);i=r?nu(r,n):void 0}i||=(r=(r+1)%$l.length,$l[r]),c.push({id:a.parentIds[t],color:i})}i.push({historyItem:a,kind:o,inputSwimlanes:s,outputSwimlanes:c})}return i}var iu=5,au=4,ou=2,su=`http://www.w3.org/2000/svg`;function cu(e,t=1){let n=document.createElementNS(su,`path`);return n.setAttribute(`fill`,`none`),n.setAttribute(`stroke`,e),n.setAttribute(`stroke-width`,String(t)),n.setAttribute(`stroke-linecap`,`round`),n}function lu(e,t,n,r,i=!1){let a=document.createElementNS(su,`circle`);return a.setAttribute(`cx`,String(11*(e+1))),a.setAttribute(`cy`,`11`),a.setAttribute(`r`,String(t)),a.setAttribute(`stroke`,r),a.setAttribute(`stroke-width`,String(n)),a.setAttribute(`fill`,i?r:`var(--code-git-history-node-bg, #f6f7f3)`),a}function uu(e,t,n,r,i=1){let a=cu(r,i);return a.setAttribute(`d`,`M ${e} ${t} V ${n}`),a}function du(e,t){for(let n=e.length-1;n>=0;--n)if(e[n].id===t)return n;return-1}function fu(e){let t=document.createElementNS(su,`svg`);t.classList.add(`code-git-history-graph-svg`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`focusable`,`false`);let{historyItem:n,inputSwimlanes:r,outputSwimlanes:i}=e,a=r.findIndex(e=>e.id===n.id),o=a===-1?r.length:a,s=o<i.length?i[o].color:o<r.length?r[o].color:eu,c=0;for(let e=0;e<r.length;e+=1){let a=r[e],s=a.color;if(a.id===n.id){if(e!==o){let n=cu(s);n.setAttribute(`d`,[`M ${11*(e+1)} 0`,`A 11 11 0 0 1 ${11*e} 11`,`H ${11*(o+1)}`].join(` `)),t.append(n)}else c+=1;continue}if(c<i.length&&a.id===i[c].id){if(e===c)t.append(uu(11*(e+1),0,22,s));else{let n=cu(s);n.setAttribute(`d`,[`M ${11*(e+1)} 0`,`V 6`,`A ${iu} ${iu} 0 0 1 ${11*(e+1)-iu} ${22/2}`,`H ${11*(c+1)+iu}`,`A ${iu} ${iu} 0 0 0 ${11*(c+1)} ${22/2+iu}`,`V 22`].join(` `)),t.append(n)}c+=1}}for(let e=1;e<n.parentIds.length;e+=1){let r=du(i,n.parentIds[e]);if(r===-1)continue;let a=cu(i[r].color);a.setAttribute(`d`,[`M ${11*r} ${22/2}`,`A 11 11 0 0 1 ${11*(r+1)} 22`,`M ${11*r} ${22/2}`,`H ${11*(o+1)}`].join(` `)),t.append(a)}a!==-1&&t.append(uu(11*(o+1),0,22/2,r[a].color)),n.parentIds.length>0&&t.append(uu(11*(o+1),22/2,22,s)),e.kind===`HEAD`?(t.append(lu(o,au+3,ou,s)),t.append(lu(o,ou,1,s,!0))):n.parentIds.length>1?(t.append(lu(o,au+2,ou,s)),t.append(lu(o,au-1,ou,s))):t.append(lu(o,au+1,ou,s));let l=11*(Math.max(r.length,i.length,1)+1);return t.setAttribute(`width`,String(l)),t.setAttribute(`height`,`22`),t.setAttribute(`viewBox`,`0 0 ${l} 22`),t}function pu(e,t=22){let n=document.createElementNS(su,`svg`);n.classList.add(`code-git-history-graph-placeholder-svg`),n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`focusable`,`false`);for(let r=0;r<e.length;r+=1)n.append(uu(11*(r+1),0,t,e[r].color));let r=11*(Math.max(e.length,1)+1);return n.setAttribute(`width`,String(r)),n.setAttribute(`height`,String(t)),n.setAttribute(`viewBox`,`0 0 ${r} ${t}`),n}var mu=(0,B.memo)(function({viewModel:e}){let t=(0,B.useRef)(null);return(0,B.useLayoutEffect)(()=>{let n=t.current;n&&n.replaceChildren(fu(e))},[e]),(0,V.jsx)(`span`,{ref:t,className:`code-git-history-graph`,"aria-hidden":`true`})}),hu=(0,B.memo)(function({columns:e}){let t=(0,B.useRef)(null);return(0,B.useLayoutEffect)(()=>{let n=t.current;if(!n)return;let r=()=>{let t=Math.max(22,Math.round(n.getBoundingClientRect().height));n.replaceChildren(pu(e,t))};if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(n),()=>i.disconnect()},[e]),(0,V.jsx)(`span`,{ref:t,className:`code-git-history-graph-placeholder`,"aria-hidden":`true`})}),gu=50,_u=20;function vu(e){if(!e)return``;let t=new Date(e);if(!Number.isFinite(t.getTime()))return``;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function yu(e,t){let n=new Set(e.map(e=>e.id));return[...e,...t.filter(e=>!n.has(e.id))]}function bu(e){return e.previousPath?`${e.previousPath} → ${e.path}`:e.path}function xu(e){let t=e.message.trim();return!t||t===e.subject?``:t.startsWith(e.subject)?t.slice(e.subject.length).trim():t}function Su({agentId:e,copy:t,projectId:n,projectWorkspace:r}){let[a,o]=(0,B.useState)(!0),[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(`current`),[f,p]=(0,B.useState)(!1),[m,h]=(0,B.useState)(``),[g,_]=(0,B.useState)(``),[v,y]=(0,B.useState)(``),[b,x]=(0,B.useState)(null),[S,C]=(0,B.useState)(!1),[w,T]=(0,B.useState)(``),[E,D]=(0,B.useState)(null),O=(0,B.useCallback)(()=>D(null),[]),k=(0,B.useRef)(null),A=(0,B.useRef)(null),j=(0,B.useRef)(new Map),M=(0,B.useRef)(null),N=(0,B.useRef)(null),P=(0,B.useCallback)(()=>{A.current?.abort(),A.current=null,_(``),y(``),x(null),C(!1),T(``),D(null)},[]);(0,B.useEffect)(()=>(k.current?.abort(),A.current?.abort(),k.current=null,A.current=null,j.current.clear(),o(!0),l(null),d(`current`),p(!1),h(``),_(``),y(``),x(null),C(!1),T(``),()=>{k.current?.abort(),A.current?.abort()}),[e,n]),s(E!==null,N,M,O);let ee=(0,B.useCallback)(async(t,n,r=u)=>{k.current?.abort();let i=new AbortController;k.current=i,p(!0),h(``);try{let a=await ae(e,{limit:gu,skip:t,scope:r,signal:i.signal});if(i.signal.aborted)return;l(e=>n||!e?a:{...a,items:yu(e.items,a.items)})}catch(e){if(i.signal.aborted)return;h(e instanceof Error?e.message:`Git history request failed`)}finally{k.current===i&&(k.current=null,p(!1))}},[e,u]),ne=(0,B.useCallback)(async(t,n)=>{let r=`${t.id}:${n||`root`}`,i=j.current.get(r);if(A.current?.abort(),i){x(i),C(!1),T(``);return}let a=new AbortController;A.current=a,x(null),C(!0),T(``);try{let i=await te(e,t.id,{parent:n||void 0,signal:a.signal});if(a.signal.aborted)return;if(j.current.set(r,i),j.current.size>_u){let e=j.current.keys().next().value;e&&j.current.delete(e)}x(i)}catch(e){if(a.signal.aborted)return;T(e instanceof Error?e.message:`Commit changes request failed`)}finally{A.current===a&&(A.current=null,C(!1))}},[e]),re=()=>{o(e=>(e&&!c&&!f&&ee(0,!0),!e))},ie=()=>{j.current.clear(),P(),ee(0,!0)},I=e=>{D(null),e!==u&&(d(e),l(null),j.current.clear(),P(),ee(0,!0,e))},oe=()=>{D(e=>{if(e)return null;let t=M.current?.getBoundingClientRect();return t?{x:Math.max(8,Math.min(window.innerWidth-132-8,t.right-132)),y:t.bottom+66+8<=window.innerHeight?t.bottom+3:Math.max(8,t.top-66-3)}:null})},se=e=>{if(g===e.id){P();return}let t=e.parentIds[0]||``;_(e.id),y(t),ne(e,t)},L=(e,t)=>{y(t),ne(e,t)},ce=(e,t,n)=>{if(!t)return;let a=new URLSearchParams({root:r,base:t,head:e.id});n&&a.append(`path`,n),window.open(i(`/review?${a.toString()}`),`_blank`,`noopener,noreferrer`)},le=(0,B.useMemo)(()=>ru(c?.items??[],c?.head),[c?.head,c?.items]);return(0,V.jsxs)(`section`,{className:`code-git-history-section ${a?`collapsed`:``}`,"data-testid":`code-git-history-section`,"data-project-id":n,"aria-label":t.gitHistory,children:[(0,V.jsxs)(`div`,{className:`code-git-history-header`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`code-git-history-title`,"aria-expanded":!a,onClick:re,children:[(0,V.jsx)(`span`,{className:`code-file-section-chevron ${a?`collapsed`:`expanded`}`,"aria-hidden":`true`,children:a?(0,V.jsx)(z,{}):(0,V.jsx)(R,{})}),(0,V.jsx)(`span`,{children:t.gitHistory})]}),!a&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{ref:M,type:`button`,className:`code-git-history-scope`,"aria-label":t.gitHistoryView,title:t.gitHistoryView,"aria-haspopup":`menu`,"aria-expanded":E?!0:void 0,disabled:f,onClick:oe,children:[(0,V.jsx)(`span`,{children:u===`current`?t.gitHistoryCurrentScope:t.gitHistoryAllScope}),(0,V.jsx)(R,{"aria-hidden":`true`})]}),E&&typeof document<`u`&&(0,Ql.createPortal)((0,V.jsx)(`div`,{ref:N,className:`code-git-history-scope-menu`,"data-testid":`code-git-history-scope-menu`,role:`menu`,"aria-label":t.gitHistoryView,style:{left:E.x,top:E.y},children:[[`current`,t.gitHistoryCurrentBranch],[`all`,t.gitHistoryAllBranches]].map(([e,t])=>(0,V.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":u===e,onClick:()=>I(e),children:[(0,V.jsx)(`span`,{className:`code-git-history-scope-check`,"aria-hidden":`true`,children:u===e&&(0,V.jsx)(ge,{})}),(0,V.jsx)(`span`,{children:t})]},e))}),document.body),(0,V.jsx)(`button`,{type:`button`,className:`code-git-history-refresh ${f?`loading`:``}`,title:t.refresh,"aria-label":t.refresh,disabled:f,onClick:ie,children:`↻`})]})]}),!a&&(0,V.jsxs)(`div`,{className:`code-git-history-body`,children:[f&&!c&&(0,V.jsx)(`div`,{className:`code-git-history-status`,children:t.loading}),m&&(0,V.jsx)(`div`,{className:`code-git-history-status error`,children:m}),c&&!c.isGitRepo&&(0,V.jsx)(`div`,{className:`code-git-history-status`,children:t.gitHistoryNotRepository}),c?.isGitRepo&&c.items.length===0&&!f&&(0,V.jsx)(`div`,{className:`code-git-history-status`,children:t.gitHistoryEmpty}),le.map(e=>{let n=e.historyItem,r=g===n.id,i=vu(n.timestamp),a=xu(n),o=n.references.filter(e=>e.category!==`head`&&!(u===`current`&&c?.branch&&e.name===c.branch));return(0,V.jsxs)(`div`,{className:`code-git-history-entry ${r?`selected`:``}`,"data-testid":`code-git-history-entry`,"data-commit-id":n.id,children:[(0,V.jsxs)(`button`,{type:`button`,className:`code-git-history-commit`,"aria-expanded":r,title:`${n.message||n.subject}\n${n.id}\n${n.author}${i?` · ${i}`:``}`,onClick:()=>se(n),children:[(0,V.jsx)(mu,{viewModel:e}),(0,V.jsxs)(`span`,{className:`code-git-history-commit-content`,children:[(0,V.jsx)(`span`,{className:`code-git-history-subject`,children:n.subject||n.displayId}),(0,V.jsxs)(`span`,{className:`code-git-history-footer`,children:[(0,V.jsxs)(`span`,{className:`code-git-history-meta`,children:[(0,V.jsx)(`span`,{className:`code-git-history-hash`,children:n.displayId}),n.author&&(0,V.jsx)(`span`,{children:n.author}),i&&n.timestamp!==void 0&&(0,V.jsx)(`time`,{dateTime:new Date(n.timestamp).toISOString(),children:i})]}),o.length>0&&(0,V.jsxs)(`span`,{className:`code-git-history-references`,"aria-label":o.map(e=>e.name).join(`, `),children:[o.slice(0,1).map(e=>(0,V.jsx)(`span`,{className:`code-git-history-reference ${e.category}`,title:e.name,children:e.name},e.id)),o.length>1&&(0,V.jsxs)(`span`,{className:`code-git-history-reference-more`,children:[`+`,o.length-1]})]})]})]})]}),r&&(0,V.jsxs)(`div`,{className:`code-git-history-details`,"data-testid":`code-git-history-details`,children:[(0,V.jsx)(hu,{columns:e.outputSwimlanes}),(0,V.jsxs)(`div`,{className:`code-git-history-details-content`,children:[(n.parentIds.length>1||n.parentIds.length===0)&&(0,V.jsx)(`div`,{className:`code-git-history-details-header`,children:n.parentIds.length>1?(0,V.jsxs)(`label`,{className:`code-git-history-parent-select`,children:[(0,V.jsx)(`span`,{children:t.gitHistoryParent}),(0,V.jsx)(`select`,{value:v,onChange:e=>L(n,e.target.value),children:n.parentIds.map((e,t)=>(0,V.jsxs)(`option`,{value:e,children:[t+1,`: `,e.slice(0,8)]},e))})]}):(0,V.jsx)(`span`,{className:`code-git-history-root-label`,children:t.gitHistoryRootCommit})}),a&&(0,V.jsxs)(`div`,{className:`code-git-history-message`,children:[(0,V.jsx)(`span`,{className:`code-git-history-message-label`,children:t.gitHistoryCommitMessage}),(0,V.jsx)(`span`,{className:`code-git-history-message-body`,children:a})]}),S&&(0,V.jsx)(`div`,{className:`code-git-history-status compact`,children:t.loading}),w&&(0,V.jsx)(`div`,{className:`code-git-history-status compact error`,children:w}),b&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`code-git-history-change-summary-row`,children:[(0,V.jsx)(`span`,{className:`code-git-history-change-summary`,children:t.gitHistoryCommitChanges(b.items.length)}),b.comparisonBase&&(0,V.jsxs)(`button`,{type:`button`,className:`code-git-history-review`,"aria-label":t.gitHistoryReviewCommit,title:t.gitHistoryReviewCommit,onClick:()=>ce(n,b.comparisonBase),children:[(0,V.jsx)(`span`,{children:t.reviewChanges}),(0,V.jsx)(me,{})]})]}),b.items.length===0&&(0,V.jsx)(`div`,{className:`code-git-history-status compact`,children:t.gitHistoryNoChanges}),(0,V.jsx)(`div`,{className:`code-git-history-change-list`,children:b.items.map(e=>b.comparisonBase?(0,V.jsxs)(`button`,{type:`button`,className:`code-git-history-change`,title:bu(e),onClick:()=>ce(n,b.comparisonBase,e.path),children:[(0,V.jsx)(`img`,{src:F(e.path),alt:``,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`code-git-history-change-path`,children:e.path}),e.previousPath&&(0,V.jsxs)(`span`,{className:`code-git-history-change-previous`,children:[`← `,e.previousPath]}),(0,V.jsx)(`span`,{className:`code-git-history-change-status ${e.status}`,children:e.statusLabel})]},`${e.status}:${e.path}`):(0,V.jsxs)(`div`,{className:`code-git-history-change static`,title:bu(e),children:[(0,V.jsx)(`img`,{src:F(e.path),alt:``,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`code-git-history-change-path`,children:e.path}),(0,V.jsx)(`span`,{className:`code-git-history-change-status ${e.status}`,children:e.statusLabel})]},`${e.status}:${e.path}`))}),b.truncated&&(0,V.jsx)(`div`,{className:`code-git-history-status compact`,children:t.gitHistoryChangesTruncated})]})]})]})]},n.id)}),c?.hasMore&&(0,V.jsx)(`button`,{type:`button`,className:`code-git-history-load-more`,disabled:f||c.nextSkip===null,onClick:()=>{c.nextSkip!==null&&ee(c.nextSkip,!1)},children:f?t.loading:t.gitHistoryLoadMore})]})]})}function Cu(e){return e.split(`/`).filter(Boolean).pop()||e}function wu({activeFilePath:e,collapsed:t,copy:n,files:r,projectId:i,onCloseOpenFile:a,onOpenFileContextMenu:o,onSelectOpenFile:s,onToggleCollapsed:c}){let l=(0,B.useRef)(null),u=(0,B.useRef)(null),d=Math.min(r.length,7),f=(0,B.useMemo)(()=>({"--code-open-editors-visible-rows":d,"--code-open-editors-list-max-height":`${d*28}px`}),[d]);return(0,B.useEffect)(()=>{if(t)return;let e=l.current,n=u.current;if(!e||!n)return;let r=n.offsetTop,i=r+n.offsetHeight;r<e.scrollTop?e.scrollTop=r:i>e.scrollTop+e.clientHeight&&(e.scrollTop=i-e.clientHeight)},[e,t,r.length]),r.length===0?null:(0,V.jsxs)(`div`,{className:`code-open-editors ${t?`collapsed`:``}`,"data-testid":`code-open-editors`,"data-project-id":i,"data-open-editor-count":r.length,"data-visible-editor-count":d,style:f,children:[(0,V.jsx)(`div`,{className:`code-open-editors-header`,children:(0,V.jsxs)(`button`,{type:`button`,className:`code-open-editors-title`,"aria-expanded":!t,onClick:c,children:[(0,V.jsx)(`span`,{className:`code-file-section-chevron ${t?`collapsed`:`expanded`}`,"aria-hidden":`true`,children:t?(0,V.jsx)(z,{}):(0,V.jsx)(R,{})}),(0,V.jsx)(`span`,{children:n.openEditors})]})}),!t&&(0,V.jsx)(`div`,{ref:l,className:`code-open-editors-list`,children:r.map(t=>{let r=e===t.path,i=_e(t);return(0,V.jsxs)(`div`,{ref:r?u:void 0,className:`code-open-editor-row ${r?`active`:``}`,"data-testid":`code-open-editor-row`,"data-file-path":t.path,title:t.path,onContextMenu:e=>{o&&(e.preventDefault(),o(e.clientX,e.clientY,t))},children:[(0,V.jsxs)(`button`,{type:`button`,className:`code-open-editor-main`,onClick:()=>s?.(t.agentId,t.path),children:[(0,V.jsx)(`img`,{className:`code-file-type-icon file`,src:F(t.path),alt:``,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`code-open-editor-name`,children:Cu(t.path)}),(0,V.jsx)(`span`,{className:`code-open-editor-path`,children:M(t.path)}),i&&(0,V.jsx)(`span`,{className:`code-open-editor-state ${i}`,title:i===`external`?n.changedOnDisk:n.unsavedChanges})]}),a&&(0,V.jsx)(`button`,{type:`button`,className:`code-open-editor-close`,"aria-label":n.closeFile(t.path),title:n.closeFile(t.path),onClick:()=>a(t.agentId,t.path,t.workspaceRoot)})]},t.key)})})]})}function Tu({activeFilePath:e,activeSearchOptionId:t,agentId:n,agentLaunchOptions:r,copy:i,editorDirtyFilePaths:a,editorExternalChangedFilePaths:o,fileMenu:s,fileMenuRef:c,fileOperation:l,fileOperationInputRef:u,fileSearch:d,fileSearchInputRef:f,fileSearchListboxId:p,fileSearchResultsRef:m,filesCollapsed:h,handleFileSearchKeyDown:g,handleTreeKeyDownCapture:_,lastFocusedFilePathRef:v,locatedFilePath:y,openEditorsCollapsed:b,openFileError:x,openFilePendingPath:S,projectId:C,renderFileTreeRow:w,rootDirectoryError:T,rootDirectoryHasItems:E,rootDirectoryLoading:D,rowHeight:O,readOnly:k=!1,stickyContextItems:A,treeData:j,treeHeight:M,treeRef:N,treeViewportRef:P,visibleTreeRowCount:ee,onCancelPendingFileFocus:te,onCloseFileMenuWithFocusRestore:ne,onCloseFileMenuWithoutFocus:F,onCloseFileOperation:re,onCloseOpenFile:ie,onCopyFileMenuPath:ae,onCopyFileMenuShareUrl:I,onFocusFileTreeTarget:oe,onFocusStickyDirectory:se,onOpenFileContextMenu:L,onOpenFileJumpQuery:ce,onOpenFilePath:le,onOpenFileSearchMatch:ue,onOpenNewAgentFromFileMenu:de,onRefreshFileMenuTarget:fe,onRememberFileOperationName:pe,onSearchQueryChange:me,onSelectOpenFile:he,onSelectSearchMatchIndex:R,onToggleDirectory:ge,onStartAgentFromFileMenu:z,onStartFileMenuOperation:_e,onSubmitFileOperation:ve,onToggleFilesCollapsed:V,onToggleOpenEditorsCollapsed:ye,onToggleTreeNode:be,onTreeFocus:xe,onTreeSelect:Se,onUpdateFileOperationName:Ce}){let we=(0,B.useMemo)(()=>({active:d.active,activeOptionId:t,inputRef:f,listboxId:p,query:d.query}),[t,d.active,d.query,f,p]),Te=(0,B.useMemo)(()=>({active:d.active,activeMatchIndex:d.activeMatchIndex,anchorRef:f,error:d.error,includeIgnored:d.includeIgnored,jumpTarget:d.jumpTarget,listboxId:p,loading:d.loading,matches:d.matches,query:d.query,resultsRef:m,timeoutMs:d.timeoutMs,truncated:d.truncated}),[d.active,d.activeMatchIndex,d.error,d.includeIgnored,f,d.jumpTarget,d.loading,d.matches,d.query,d.timeoutMs,d.truncated,p,m]),Ee=(0,B.useMemo)(()=>({onOpenJumpQuery:ce,onOpenMatch:ue,onSearchIgnored:d.searchIgnored,onSelectMatchIndex:R}),[ce,ue,d.searchIgnored,R]),De=(0,B.useMemo)(()=>({activeFilePath:e,agentId:n,editorDirtyFilePaths:a,editorExternalChangedFilePaths:o,fileOperation:l,fileOperationInputRef:u,handleTreeKeyDownCapture:_,lastFocusedFilePathRef:v,locatedFilePath:y,openFilePendingPath:S,renderFileTreeRow:w,rowHeight:O,stickyContextItems:A,treeData:j,treeHeight:M,treeRef:N,treeViewportRef:P,visibleTreeRowCount:ee,onCancelPendingFileFocus:te,onCloseFileOperation:re,onFocusFileTreeTarget:oe,onFocusStickyDirectory:se,onOpenFileContextMenu:L,onOpenFilePath:le,onRememberFileOperationName:pe,onToggleDirectory:ge,onSubmitFileOperation:ve,onToggleTreeNode:be,onTreeFocus:xe,onTreeSelect:Se,onUpdateFileOperationName:Ce}),[e,n,a,o,l,u,_,v,y,S,w,O,A,j,M,N,P,ee,te,re,oe,se,L,le,pe,ge,ve,be,xe,Se,Ce]);return{bodySearch:Te,bodySearchActions:Ee,bodyTree:De,fileMenu:s,fileMenuRef:c,filesCollapsed:h,headerSearch:we,openEditors:{activeFilePath:e,collapsed:b,copy:i,projectId:C,onCloseOpenFile:ie,onSelectOpenFile:he,onToggleCollapsed:ye},sectionBody:{copy:i,agentLaunchOptions:r,fileMenu:s,fileMenuRef:c,openFileError:x,rootDirectoryError:T,rootDirectoryHasItems:E,rootDirectoryLoading:D,search:Te,searchActions:Ee,tree:De,onCloseFileMenu:F,onCloseFileMenuWithFocusRestore:ne,onCopyFileMenuPath:ae,onCopyFileMenuShareUrl:I,onOpenNewAgentFromFileMenu:de,onRefreshFileMenuTarget:fe,onStartAgentFromFileMenu:z,onStartFileMenuOperation:_e,readOnly:k},sectionHeader:{copy:i,filesCollapsed:h,search:we,onCancelPendingFileFocus:te,onFileSearchKeyDown:g,onSearchQueryChange:me,onToggleFilesCollapsed:V}}}var Eu=200,Du=15e3,Ou={error:null,items:[],loaded:!1,loading:!1,truncated:!1};function ku(e,t){let[n,r]=(0,B.useState)(Ou),i=(0,B.useRef)(null),a=(0,B.useRef)(0),o=(0,B.useRef)(new Map),s=(0,B.useRef)(t),l=(0,B.useRef)(!1),u=(0,B.useCallback)(()=>{if(!e)return i.current?.abort(),a.current+=1,r(Ou),Promise.resolve(!0);i.current?.abort();let t=new AbortController,n=!1,o=window.setTimeout(()=>{n=!0,t.abort()},Du);i.current=t;let s=a.current+1;return a.current=s,r(e=>({...e,error:null,loading:!0})),le(e,{limit:Eu,signal:t.signal}).then(e=>a.current===s?(r({error:null,items:e.items,loaded:!0,loading:!1,truncated:e.truncated}),!0):!1).catch(e=>{if(!n&&t.signal.aborted||a.current!==s)return!1;let i=!c().connected;return i&&(l.current=!0),r(t=>({...t,error:i?null:n?`File refresh timed out`:e instanceof Error?e.message:`Failed to refresh changes`,loaded:!0,loading:i})),!1}).finally(()=>window.clearTimeout(o))},[e]);return(0,B.useEffect)(()=>{s.current=t},[t]),(0,B.useEffect)(()=>{l.current=!1,o.current=O(s.current),u()},[e,u]),(0,B.useEffect)(()=>{let e=o.current,n=O(t);o.current=n,v(e,n)&&u()},[e,t,u]),(0,B.useEffect)(()=>{let e=()=>{l.current&&(l.current=!1,u())};return window.addEventListener(`farming:backend-connected`,e),()=>window.removeEventListener(`farming:backend-connected`,e)},[u]),(0,B.useEffect)(()=>()=>{i.current?.abort(),l.current=!1},[]),{...n,refreshChanges:u}}var Au=50,ju=60,Mu=6e3,Nu=80,Pu=100,Fu=2;function Iu(e){e?.focus({preventScroll:!0})}function Lu(){let e=document.activeElement;return e instanceof Element&&!!e.closest(`.code-file-monaco, .monaco-editor`)}function Ru(e,t){let n=e.getBoundingClientRect(),r=t.closest(`.code-project-group`),i=t.closest(`.code-files-section`),a=[r?.querySelector(`.code-project-row`),r?.querySelector(`.code-agents-section`),r?.querySelector(`[data-testid="code-open-editors"]`),i?.querySelector(`.code-files-header`),i?.querySelector(`.code-file-sticky-stack`)].reduce((e,t)=>{if(!t)return e;let r=t.getBoundingClientRect();return r.height<=0||r.bottom<=n.top||r.top>=n.bottom?e:Math.max(e,r.bottom)},n.top);return{top:Math.min(a,n.bottom),bottom:n.bottom}}function zu(e,t=!1){let n=e.closest(`.code-project-list`);if(!n)return;let r=Ru(n,e),i=e.getBoundingClientRect();n.scrollTop+=t?i.top-r.top-6:Cl(r,i)}function Bu({treeRef:e,treeViewportRef:t,fileSearchInputRef:n,fileOperationActiveRef:r,lastFocusedFilePathRef:i,treeData:a,isDirectoryLoaded:o,loadMissingDirectories:s,openDirectoriesInLayout:c,refreshTreeLayout:l}){let u=(0,B.useRef)(null),d=(0,B.useRef)([]),f=(0,B.useRef)(null),p=(0,B.useRef)([]),m=(0,B.useRef)([]),h=(0,B.useRef)([]),g=(0,B.useRef)([]),_=(0,B.useRef)(0),[v,y]=(0,B.useState)(null),b=(0,B.useRef)(null),x=(0,B.useRef)(a),S=(0,B.useRef)(o);(0,B.useEffect)(()=>{x.current=a},[a]),(0,B.useEffect)(()=>{S.current=o},[o]);let C=(0,B.useCallback)(()=>{y(null),b.current!==null&&(window.clearTimeout(b.current),b.current=null)},[]),w=(0,B.useCallback)(e=>{document.body.classList.contains(`code-file-location-dismissed`)||(C(),y(e),b.current=window.setTimeout(C,Mu))},[C]),T=(0,B.useCallback)(()=>{u.current!==null&&(window.cancelAnimationFrame(u.current),u.current=null),d.current.forEach(e=>window.clearTimeout(e)),d.current=[]},[]),D=(0,B.useCallback)(()=>{f.current!==null&&(window.cancelAnimationFrame(f.current),f.current=null),p.current.forEach(e=>window.clearTimeout(e)),p.current=[]},[]),O=(0,B.useCallback)(()=>{m.current.forEach(e=>window.clearTimeout(e)),m.current=[]},[]),k=(0,B.useCallback)(()=>{_.current+=1,D(),O(),h.current.forEach(e=>window.cancelAnimationFrame(e)),h.current=[],g.current.forEach(e=>window.clearTimeout(e)),g.current=[]},[O,D]),M=(0,B.useCallback)(()=>{T(),k(),C()},[T,k,C]),N=(0,B.useCallback)((i,a=!1,o=!1)=>{D(),O();let s=!1,c=()=>{let e=0,n=0,r=()=>{n+=1;let a=Array.from(t.current?.querySelectorAll(`[data-file-path]`)??[]).find(e=>e.dataset.filePath===i)??null;if(e=a?.classList.contains(`selected`)===!0?e+1:0,a&&e>=Fu){m.current=[],w(i);return}n>=Pu||(m.current=[window.setTimeout(r,Nu)])};r()},l=()=>{let e=n.current,s=wl({focusRow:a,operationActive:r.current,activeElementIsSearchInput:document.activeElement===e,searchInputValue:e?.value}),c=Array.from(t.current?.querySelectorAll(`[data-file-path]`)??[]).find(e=>e.dataset.filePath===i);c&&(c.scrollIntoView({block:`nearest`}),zu(c,o),s&&Iu(c.closest(`[role="tree"]`)))},u=()=>{let t=e.current;if(a&&!s){s=!0,t?.get(i)?.select();let e=t?.scrollTo(i,o?`start`:`smart`);e&&e.then(()=>{window.requestAnimationFrame(l)})}l()};u(),f.current=window.requestAnimationFrame(()=>{u(),f.current=window.requestAnimationFrame(u)}),xl.forEach(e=>{let t=window.setTimeout(u,e);p.current.push(t)}),o&&c()},[O,D,r,n,w,e,t]),P=(0,B.useCallback)((t,n=0,r=!1,i)=>{let a=i??_.current+1;i===void 0&&(_.current=a);let o=()=>_.current===a,s=e.current,u=x.current,d=j(u,t,r),f=A(u,t)??t,p=I(u,f),m=!!s;if(c(d),r&&(p?.type!==`directory`||!S.current(t))&&(m=!1),s&&(d.forEach(e=>{s.get(e)?s.open(e):m=!1}),r&&s.get(f)&&s.open(f),s.get(f)||(m=!1)),!m&&n<ju){let e=window.setTimeout(()=>{g.current=g.current.filter(t=>t!==e),o()&&P(t,n+1,r,a)},Au);g.current.push(e);return}(e=>{let t=window.requestAnimationFrame(()=>{h.current=h.current.filter(e=>e!==t),o()&&e()});h.current.push(t)})(()=>{o()&&(d.forEach(t=>e.current?.open(t)),l(d),N(f,!0,r))})},[c,l,N,e]),ee=(0,B.useCallback)(async e=>{await s([``,...E(e)]),P(e)},[s,P]),te=(0,B.useCallback)(async(e,t)=>{t===`directory`&&(document.body.classList.remove(`code-file-location-dismissed`),C()),await s([``,...E(e),...t===`directory`&&e?[e]:[]]),P(e,0,t===`directory`)},[C,s,P]),ne=(0,B.useCallback)(()=>{M();let e=(e=!1)=>{let t=n.current;t&&(Tl({activeElementIsSearchInput:document.activeElement===t,searchInputValue:t.value})||(t.focus(),El({requestedSelect:e,searchInputValue:t.value})&&t.select()))};e(!0),u.current=window.requestAnimationFrame(()=>e(!1)),bl.forEach(t=>{let n=window.setTimeout(()=>e(!1),t);d.current.push(n)})},[M,n]),F=(0,B.useCallback)(()=>{M();let r=()=>{if(n.current?.value)return;n.current?.blur();let r=t.current?.querySelector(`[role="tree"]`),a=Array.from(t.current?.querySelectorAll(`[data-file-path]`)??[]),o=Ol({lastFocusedPath:i.current,rows:a.map(e=>({path:e.dataset.filePath??``,selected:e.classList.contains(`selected`)})).filter(e=>e.path)});if(o&&a.find(e=>e.dataset.filePath===o)&&o){i.current=o,e.current?.get(o)?.select(),Iu(r);return}Iu(r)};r(),f.current=window.requestAnimationFrame(r),xl.forEach(e=>{let t=window.setTimeout(r,e);p.current.push(t)})},[M,n,i,e,t]),re=(0,B.useCallback)(n=>{D();let r=()=>{let r=Lu();if(n){e.current?.get(n)?.select();let i=Array.from(t.current?.querySelectorAll(`[data-file-path]`)??[]).find(e=>e.dataset.filePath===n),a=i?.closest(`[role="tree"]`)??t.current?.querySelector(`[role="tree"]`);if(r||Iu(a),i){i.scrollIntoView({block:`nearest`}),zu(i);return}}r||Iu(t.current?.querySelector(`[role="tree"]`))};r(),f.current=window.requestAnimationFrame(()=>{f.current=null,r()}),[80,180,360].forEach(e=>{let t=window.setTimeout(r,e);p.current.push(t)})},[D,e,t]),ie=(0,B.useCallback)(e=>{re(e?.path??null)},[re]);return(0,B.useEffect)(()=>{if(!v)return;let e=e=>{let t=e.target;(t instanceof Element?t.closest(`[data-file-path]`):null)?.dataset.filePath!==v&&(document.body.classList.add(`code-file-location-dismissed`),C())};return document.addEventListener(`pointerdown`,e,!0),document.addEventListener(`keydown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0),document.removeEventListener(`keydown`,e,!0)}},[C,v]),(0,B.useEffect)(()=>()=>{M(),C()},[M,C]),{cancelPendingFileFocus:M,focusFileSearchInput:ne,focusFileTreeFromSearch:F,focusFileTreePath:re,focusFileTreeTarget:ie,locatedFilePath:v,revealExplorerPath:te,revealFilePath:ee}}var Vu=15e3;function Hu(e){return e.replace(/^\/+|\/+$/g,``)}function Uu(e,t=e){let[n,r]=(0,B.useState)({}),i=(0,B.useRef)({}),a=(0,B.useRef)(new Map),o=(0,B.useRef)(new Map),s=(0,B.useRef)(new Set),l=(0,B.useRef)(0),u=(0,B.useCallback)((t=``)=>{if(!e)return Promise.resolve(null);let n=Hu(t),i=a.current.get(n);if(i)return i;let d=l.current;r(e=>({...e,[n]:{items:e[n]?.items??[],loading:!0,error:null}}));let f=null;return f=(async()=>{let t=new AbortController,i=!1,p=window.setTimeout(()=>{i=!0,t.abort()},Vu);try{let i=await C(e,n,{signal:t.signal});if(l.current!==d)return null;if(r(e=>({...e,[n]:{items:i.items,loading:!1,error:null,gitStatusPending:i.gitStatusPending}})),i.gitStatusPending&&!o.current.has(n)){let e=window.setTimeout(()=>{o.current.delete(n),u(n)},2e3);o.current.set(n,e)}return i}catch(e){if(l.current!==d)return null;let t=!c().connected;return t&&s.current.add(n),r(r=>({...r,[n]:{items:r[n]?.items??[],loading:t,error:t?null:i?`File refresh timed out`:e instanceof Error?e.message:`Failed to load directory`}})),null}finally{window.clearTimeout(p),f&&a.current.get(n)===f&&a.current.delete(n)}})(),a.current.set(n,f),f},[e]),d=(0,B.useCallback)(e=>{let t=Hu(e),n=i.current[t];return!n||n.loading||n.error?u(t):Promise.resolve({path:t,items:n.items,gitStatusPending:n.gitStatusPending})},[u]);return(0,B.useEffect)(()=>{i.current=n},[n]),(0,B.useEffect)(()=>{l.current+=1,a.current.clear(),s.current.clear(),o.current.forEach(e=>window.clearTimeout(e)),o.current.clear()},[e,t]),(0,B.useEffect)(()=>{r({}),i.current={}},[e,t]),(0,B.useEffect)(()=>()=>{a.current.clear(),o.current.forEach(e=>window.clearTimeout(e)),o.current.clear()},[]),(0,B.useEffect)(()=>{let e=()=>{let e=Array.from(s.current);s.current.clear(),e.forEach(e=>{u(e)})};return window.addEventListener(`farming:backend-connected`,e),()=>window.removeEventListener(`farming:backend-connected`,e)},[u]),(0,B.useMemo)(()=>({directories:n,loadDirectory:u,ensureDirectoryLoaded:d}),[n,d,u])}var Wu=12,Gu=6;function Ku(e){let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}function qu(e){return e.split(`/`).filter(Boolean).length}function Ju(e,t=e){let n=t||``,{directories:r,loadDirectory:i,ensureDirectoryLoaded:a}=Uu(e,t),[o,s]=(0,B.useState)(()=>new Set(p(n).openDirectoryPaths??[])),c=(0,B.useRef)(o),l=(0,B.useRef)(n),u=(0,B.useRef)(new Map),d=(0,B.useRef)(``),m=(0,B.useMemo)(()=>ee(r[``]?.items??[],r),[r]),h=(0,B.useMemo)(()=>Math.max(1,ue(m,o)),[o,m]),g=(0,B.useCallback)((e,t)=>{let n=c.current;if(n.has(e)===t)return;let r=new Set(n);t?r.add(e):r.delete(e),c.current=r,s(r)},[]),_=(0,B.useCallback)(e=>c.current.has(e),[]),v=(0,B.useCallback)(e=>{if(e.length===0)return;let t=new Set(c.current),n=!1;e.forEach(e=>{!e||t.has(e)||(t.add(e),n=!0)}),n&&(c.current=t,s(t))},[]),y=(0,B.useCallback)(()=>i(``),[i]),b=(0,B.useCallback)(e=>{let t=e.filter(e=>!r[e]);return Promise.all(t.map(e=>i(e)))},[r,i]),x=(0,B.useCallback)(e=>{let t=r[e];return!!(t&&!t.loading&&!t.error)},[r]),S=(0,B.useCallback)(e=>{let t=new Set([``]);e.forEach(e=>{let n=String(e??``).replace(/^\/+|\/+$/g,``);for(t.add(n);n;)n=Ku(n),t.add(n)});let n=Array.from(t).sort((e,t)=>qu(e)-qu(t)||e.localeCompare(t));return(async()=>{let e=new Map,t=new Set,r=!0,a=0;for(;a<n.length;){let o=qu(n[a]),s=[];for(;a<n.length&&qu(n[a])===o;)s.push(n[a]),a+=1;let c=s.filter(n=>{if(!n)return!0;if(Array.from(t).some(e=>n===e||n.startsWith(`${e}/`)))return!1;let i=Ku(n),a=e.get(i);return a===null?(r=!1,!1):a&&!a.items.some(e=>e.type===`directory`&&e.path===n)?(t.add(n),!1):!0}),l=0,u=Array.from({length:Math.min(Gu,c.length)},async()=>{for(;l<c.length;){let t=c[l];l+=1;let n=await i(t);e.set(t,n),n||(r=!1)}});await Promise.all(u)}if(t.size>0){let e=Array.from(t),n=new Set(Array.from(c.current).filter(t=>!e.some(e=>t===e||t.startsWith(`${e}/`))));c.current=n,s(n)}return r})()},[i]),C=(0,B.useCallback)(e=>{let t=u.current.get(e);if(t)return t;let n;return n=(async()=>{let t=e;for(let e=0;e<Wu;e+=1){let e=await a(t),n=e?.items.length===1&&e.items[0]?.type===`directory`?e.items[0]:null;if(!n)return;t=n.path}})().finally(()=>{u.current.get(e)===n&&u.current.delete(e)}),u.current.set(e,n),n},[a]);return(0,B.useEffect)(()=>{u.current.clear()},[e]),(0,B.useEffect)(()=>{l.current===n&&f(n,{openDirectoryPaths:Array.from(o)})},[n,o]),(0,B.useEffect)(()=>{if(l.current===n)return;l.current=n,d.current=``;let e=p(n).openDirectoryPaths??[],t=new Set(e);c.current=t,s(t)},[n]),(0,B.useEffect)(()=>{if(o.size===0)return;let e=`${n}:${Array.from(o).join(`
|
|
12
|
+
`)}`;d.current!==e&&(d.current=e,y(),b(Array.from(o)))},[b,y,n,o]),(0,B.useMemo)(()=>({directories:r,treeData:m,openDirectoryPaths:o,visibleTreeRowCount:h,loadRootDirectory:y,ensureDirectoryLoaded:a,isDirectoryLoaded:x,loadMissingDirectories:b,refreshDirectories:S,hydrateCompactDirectoryChains:C,isDirectoryOpen:_,setDirectoryOpen:g,openDirectoriesInLayout:v}),[r,a,C,_,x,b,y,v,o,S,g,m,h])}function Yu({agentId:e,agentLaunchOptionCount:t=0,cancelPendingFileFocus:n,clearFileOperation:r,focusFileTreeTarget:a,refreshDirectories:o,projectWorkspace:s,shareLinkFailed:c,setOpenFileError:u,startFileOperation:d}){let f=(0,B.useRef)(null),[p,h]=(0,B.useState)(null),g=(0,B.useCallback)(()=>{h(null)},[]),_=(0,B.useCallback)((e,i,a)=>{n(),u(null),r(),h({...dt(e,i,a,window.innerWidth,window.innerHeight,t),item:a})},[t,n,r,u]),v=(0,B.useCallback)((e=!1)=>{let t=p?.item??null;h(null),e&&a(t)},[p?.item,a]),y=(0,B.useCallback)(()=>{v(!1)},[v]),b=(0,B.useCallback)(()=>{v(!0)},[v]),x=(0,B.useCallback)((e,t=p?.item??null)=>{n(),h(null),d(e,t)},[n,p?.item,d]),S=(0,B.useCallback)(()=>{e&&(o([rt(p?.item??null)]),h(null))},[e,p?.item,o]);return{fileMenu:p,fileMenuRef:f,clearFileMenu:g,closeFileMenuWithFocusRestore:b,closeFileMenuWithoutFocus:y,copyFileMenuPath:(0,B.useCallback)(async()=>{let e=p?.item;if(e){h(null),u(null);try{await navigator.clipboard?.writeText(e.path)}catch{u(`Copy failed`)}}},[p?.item,u]),copyFileMenuShareUrl:(0,B.useCallback)(async()=>{let t=p?.item;if(!(!e||!t||t.type!==`file`&&t.type!==`directory`)){h(null),u(null);try{let n=t.type===`directory`?{kind:`folder`,agentId:e,folderPath:t.path,absolutePath:m(s,t.path),projectLabel:l(s)}:{kind:`file`,agentId:e,filePath:t.path,absolutePath:m(s,t.path),projectLabel:l(s)},r=await fetch(i(`/api/share/qr-ticket`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({target:n})}),a=await r.json();if(!r.ok||!a.longUrl||!await pe(a.longUrl))throw Error(a.error||c)}catch(e){u(e instanceof Error?e.message:c)}}},[e,p?.item,s,u,c]),fileMenuTargetDirectory:(0,B.useCallback)((e=p?.item??null)=>rt(e),[p?.item]),openFileContextMenu:_,refreshFileMenuTarget:S,startFileMenuOperation:x}}var Xu=220;function Zu({agentId:e,onClearSearch:t,onOpenFile:n,onRevealFilePath:r,onSelectOpenFile:i}){let a=(0,B.useRef)(0),o=(0,B.useRef)({agentId:e,mounted:!0}),s=(0,B.useRef)(null),[c,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(null);o.current.agentId=e;let f=(0,B.useCallback)(()=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),d(null)},[]),p=(0,B.useCallback)((e,t,n)=>{f(),s.current=window.setTimeout(()=>{a.current===e&&o.current.agentId===t&&o.current.mounted&&d(n),s.current=null},Xu)},[f]);return(0,B.useEffect)(()=>(o.current.mounted=!0,()=>{o.current.mounted=!1,a.current+=1,s.current!==null&&(window.clearTimeout(s.current),s.current=null)}),[]),(0,B.useEffect)(()=>{a.current+=1,f(),l(null)},[e,f]),{openFileError:c,openFilePendingPath:u,openFilePath:(0,B.useCallback)(async(s,c)=>{if(!e)return;let u=e,d=a.current+1;if(a.current=d,l(null),i?.(e,s,c)){f(),t(),oe(c)&&r(s);return}p(d,u,s);try{let e=await k(u,s);if(a.current!==d||o.current.agentId!==u||!o.current.mounted)return;f(),n(u,e,c),t(),oe(c)&&r(s)}catch(e){if(a.current!==d||o.current.agentId!==u||!o.current.mounted)return;if(f(),c&&e instanceof se&&e.status===404&&_(c)){n(u,g(s,c),c),t();return}l(e instanceof Error?e.message:`Failed to open file`)}},[e,f,t,n,r,i,p]),setOpenFileError:l}}var Qu=15e3;async function $u(e){let t=new AbortController,n=!1,r=window.setTimeout(()=>{n=!0,t.abort()},Qu);try{return await e(t.signal)}catch(e){if(n){let e=Error(`File operation timed out`);throw e.name=`TimeoutError`,e}throw e}finally{window.clearTimeout(r)}}function ed({agentId:e,fileOperationActiveRef:t,ensureDirectoryLoaded:n,focusFileTreePath:r,onDeleteEntries:i,onMoveEntries:a,onOpenFile:o,onWorkspaceChange:s,refreshDirectories:c,setOpenFileError:l}){let u=(0,B.useRef)(null),d=(0,B.useRef)(``),f=(0,B.useRef)(0),p=(0,B.useRef)(null),[m,h]=(0,B.useState)(null),g=(0,B.useCallback)(()=>{p.current=null,t.current=!1,h(null)},[]),_=(0,B.useCallback)(e=>{let t=p.current;return t?.generation===e.generation&&t.rootId===e.rootId},[]),v=(0,B.useCallback)(e=>_(e)?(p.current=null,t.current=!1,h(e=>p.current===null?null:e),!0):!1,[_]),y=(0,B.useCallback)(e=>{if(!_(e))return!1;let t={...e,generation:f.current+1,operation:{...e.operation,submitting:!1},submitted:!1};return f.current=t.generation,p.current=t,h(e=>p.current===t?t.operation:e),!0},[_]),b=(0,B.useCallback)((n,r)=>{if(!e||r?.readOnly&&!(r.symbolicLink&&(n===`rename`||n===`delete`)))return;let i=at(n,r),a=f.current+1;f.current=a,p.current={generation:a,operation:i,rootId:e,submitted:!1},d.current=i.name,t.current=!0,l(null),h(i)},[e,l]),x=(0,B.useCallback)(()=>{let e=p.current;e&&v(e)&&r(e.operation.item?.path??null)},[v,r]),S=(0,B.useCallback)(e=>{d.current=e;let t=p.current;t&&!t.submitted&&(t.operation={...t.operation,name:e})},[]),T=(0,B.useCallback)(e=>{d.current=e;let t=p.current;t&&!t.submitted&&(t.operation={...t.operation,name:e}),h(t=>t&&{...t,name:e})},[]),E=(0,B.useCallback)(async()=>{let t=p.current;if(!e||!t||t.rootId!==e||t.submitted)return;let u=t.operation.kind===`delete`?t.operation:{...t.operation,name:d.current},f=U(u);if(!(u.kind!==`delete`&&!f)){t.operation={...u,submitting:!0},t.submitted=!0,h(e=>_(t)?t.operation:e),l(null);try{if(u.kind===`new-file`||u.kind===`new-folder`){let e=await $u(e=>N(t.rootId,u.parentPath,f,u.kind===`new-folder`?`directory`:`file`,{signal:e}));c([u.parentPath]),s?.(),_(t)&&(e.entry.type===`directory`&&(n(e.entry.path),r(e.entry.path)),e.file&&o(t.rootId,e.file),v(t));return}if(u.kind===`rename`&&u.item){let e=u.item,n=await $u(n=>fe(t.rootId,e.path,f,e.version,{signal:n}));c(L(n)),a(t.rootId,[n]),s?.(),v(t)&&r(ie(n));return}if(u.kind===`delete`&&u.item){let e=u.item,n=await $u(n=>re(t.rootId,e.path,e.version,{signal:n}));c(w(n)),i(t.rootId,[n]),s?.(),v(t)&&r(P(n))}}catch(e){let d=u.kind===`new-file`||u.kind===`new-folder`?[u.parentPath]:u.item?[u.item.path.includes(`/`)?u.item.path.slice(0,u.item.path.lastIndexOf(`/`)):``]:[],p=!(e instanceof se)||e.status>=500;if(p&&(u.kind===`new-file`||u.kind===`new-folder`))try{let e=ct(u,f,(await $u(e=>C(t.rootId,u.parentPath,{signal:e}))).items);if(e){if(c([u.parentPath]),s?.(),e.type===`directory`&&_(t))n(e.path),r(e.path),v(t);else if(e.type===`file`&&_(t)){r(e.path);try{let n=await $u(n=>k(t.rootId,e.path,{signal:n}));_(t)&&o(t.rootId,n)}catch{}v(t)}return}}catch{}if(p&&u.item&&(u.kind===`rename`||u.kind===`delete`))try{let e=d[0]??``,n=await $u(n=>C(t.rootId,e,{signal:n}));if(u.kind===`rename`){let e=lt(u,f,n.items);if(e){c(L(e)),a(t.rootId,[e]),s?.(),v(t)&&r(ie(e));return}}if(u.kind===`delete`){let e=st(u,n.items);if(e){c(w(e)),i(t.rootId,[e]),s?.(),v(t)&&r(P(e));return}}}catch{}d.length>0&&(c(d),s?.()),y(t)&&l(e instanceof Error?e.message:`File operation failed`)}}},[e,v,n,r,_,i,a,o,s,c,y,l]);return(0,B.useLayoutEffect)(()=>{let t=p.current;t&&t.rootId!==e&&g()},[e,g]),(0,B.useLayoutEffect)(()=>()=>{p.current=null,t.current=!1},[]),(0,B.useEffect)(()=>{if(!m)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),x())};return document.addEventListener(`keydown`,e,!0),()=>{document.removeEventListener(`keydown`,e,!0)}},[x,m]),{fileOperation:m,fileOperationActiveRef:t,fileOperationInputRef:u,clearFileOperation:g,closeFileOperation:x,rememberFileOperationName:S,startFileOperation:b,submitFileOperation:E,updateFileOperationName:T}}var td=3e3;function nd(e){let[t,n]=(0,B.useState)(``),[r,i]=(0,B.useState)([]),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(0),[d,f]=(0,B.useState)(!1),[p,m]=(0,B.useState)(td),[h,g]=(0,B.useState)(!1),_=(0,B.useRef)(0),v=t.trim().length>0,y=(0,B.useMemo)(()=>v?De(t):null,[v,t]),b=r.length>0?Math.min(l,r.length-1):-1,x=b>=0?r[b]??null:null,S=(0,B.useCallback)(()=>{_.current+=1,n(``),i([]),c(null),u(0),f(!1),m(td),g(!1),o(!1)},[]),C=(0,B.useCallback)(e=>{g(!1),n(e)},[]),w=(0,B.useCallback)(()=>{g(!0)},[]),T=(0,B.useCallback)(()=>{r.length!==0&&u(e=>Math.min(e+1,r.length-1))},[r.length]),E=(0,B.useCallback)(()=>{r.length!==0&&u(e=>Math.max(e-1,0))},[r.length]),D=(0,B.useCallback)(e=>{u(Math.max(0,Math.min(e,Math.max(r.length-1,0))))},[r.length]);return(0,B.useEffect)(()=>{let n=t.trim(),r=_.current+1;if(_.current=r,u(0),!e||!n||De(n)){i([]),o(!1),c(null),f(!1);return}o(!0),c(null);let a=new AbortController,s=window.setTimeout(()=>{de(e,n,{includeIgnored:h,limit:60,signal:a.signal}).then(e=>{_.current===r&&(i(e.matches),f(e.truncated),m(e.timeoutMs??td),o(!1))}).catch(e=>{_.current===r&&(e instanceof DOMException&&e.name===`AbortError`||(i([]),f(!1),c(e instanceof Error?e.message:`Search failed`),o(!1)))})},180);return()=>{window.clearTimeout(s),a.abort()}},[e,h,t]),(0,B.useEffect)(()=>{u(e=>Math.min(e,Math.max(r.length-1,0)))},[r.length]),(0,B.useMemo)(()=>({query:t,setQuery:C,matches:r,loading:a,error:s,selectMatchIndex:D,truncated:d,timeoutMs:p,includeIgnored:h,active:v,jumpTarget:y,activeMatchIndex:b,selectedMatch:x,clear:S,searchIgnored:w,selectNext:T,selectPrevious:E}),[v,b,S,s,y,a,r,h,w,t,D,T,E,x,d,p])}function rd({fileMenuOpen:e,fileOperationActive:t,fileSearch:n,fileSearchResultsRef:r,filesCollapsed:i,focusFileTreeFromSearch:a,listboxId:o,onOpenFilePath:s,onRevealDirectoryPath:c}){let l=je({active:n.active,activeMatchIndex:n.activeMatchIndex,jumpTarget:n.jumpTarget,listboxId:o}),u=(0,B.useCallback)(e=>{if(e.kind===`path`&&e.entryType===`directory`){c(e.path),n.clear();return}let t=ke(e);s(t.path,t.target),n.clear()},[n,s,c]),d=(0,B.useCallback)(e=>{let t=Ae(e);return t?(s(t.path,t.target),n.clear(),!0):!1},[n,s]),f=(0,B.useCallback)(e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),n.clear(),a();return}if(e.key===`ArrowDown`){if(n.matches.length===0)return;e.preventDefault(),n.selectNext();return}if(e.key===`ArrowUp`){if(n.matches.length===0)return;e.preventDefault(),n.selectPrevious();return}if(e.key!==`Enter`||(e.preventDefault(),e.stopPropagation(),d(e.currentTarget.value)))return;let t=n.selectedMatch??n.matches[0];t&&u(t)},[n,a,d,u]);return(0,B.useEffect)(()=>{if(!n.active||n.matches.length===0)return;let e=r.current,t=e?.querySelector(`.code-file-search-result.active`);if(!e||!t)return;let i=t.offsetTop,a=i+t.offsetHeight;i<e.scrollTop?e.scrollTop=i:a>e.scrollTop+e.clientHeight&&(e.scrollTop=a-e.clientHeight)},[n.active,n.activeMatchIndex,n.matches.length,r]),(0,B.useEffect)(()=>{if(i||!n.active||e||t)return;let r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n.clear(),a())};return document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`keydown`,r,!0)}},[e,t,n,i,a]),{activeOptionId:l,handleFileSearchKeyDown:f,openFileJumpQuery:d,openFileSearchMatch:u}}function id({agentId:e,workspaceKey:t,clearFileMenu:n,clearFileOperation:r,clearFileSearch:i,focusFileSearchInput:a,focusSearchRequest:o,loadRootDirectory:s,openFilesCount:c,refreshTreeLayout:l,revealExplorerPath:u,revealRequest:d,rootDirectoryLoaded:m,setFileSearchQuery:h,setOpenFileError:g,treeData:_}){let[v,y]=(0,B.useState)(()=>p(t).filesCollapsed??!0),[b,x]=(0,B.useState)(!0),S=(0,B.useRef)(null),C=(0,B.useRef)(t),w=(0,B.useCallback)(()=>{let e=!v;e?(n(),r(),i()):m||s(),y(e)},[n,r,i,v,s,m]),T=(0,B.useCallback)(()=>{x(e=>!e)},[]);return(0,B.useEffect)(()=>{g(null),n(),r(),i()},[e,n,r,i,g]),(0,B.useEffect)(()=>{if(d){if(y(!1),!m){s();return}S.current!==d.requestId&&(S.current=d.requestId,u(d.path,d.kind))}},[s,u,d,m]),(0,B.useEffect)(()=>{o&&(y(!1),m||s(),typeof o.query==`string`&&h(o.query),a())},[a,o,s,m,h]),(0,B.useEffect)(()=>{c===0&&x(!0)},[c]),(0,B.useEffect)(()=>{C.current===t&&f(t,{filesCollapsed:v})},[v,t]),(0,B.useEffect)(()=>{C.current!==t&&(C.current=t,y(p(t).filesCollapsed??!0))},[t]),(0,B.useEffect)(()=>{!v&&!m&&s()},[v,s,m]),(0,B.useEffect)(()=>{v||l()},[v,l,_]),{filesCollapsed:v,openEditorsCollapsed:b,toggleFilesCollapsed:w,toggleOpenEditorsCollapsed:T}}function ad(e,t){let n=t.closest(`.code-project-group`),r=n?.querySelector(`.code-project-row`),i=n?.querySelector(`.code-agents-section`),a=n?.querySelector(`[data-testid="code-open-editors"]`);return Fl(e.getBoundingClientRect().top,r?.getBoundingClientRect().height??30,(i?.getBoundingClientRect().height??0)+(a?.getBoundingClientRect().height??0),25)}function od({filesCollapsed:e,focusFileTreePath:t,lastFocusedFilePathRef:n,openDirectoryPaths:r,refreshTreeLayout:i,resetKey:a,treeData:o,treeViewportRef:s}){let[c,l]=(0,B.useState)([]),[u,d]=(0,B.useState)(!1),f=(0,B.useMemo)(()=>c.map(e=>I(o,e)).filter(e=>!!e),[c,o]),p=(0,B.useMemo)(()=>zl({visible:u,directoryNodes:f}),[u,f]),m=(0,B.useCallback)(()=>{l(e=>e.length===0?e:[]),d(!1)},[]),h=(0,B.useCallback)(()=>{let t=s.current,n=t?.closest(`.code-project-list`);if(!t||!n||e){m();return}let r=n.getBoundingClientRect(),i=ad(n,t),a=t.getBoundingClientRect(),o=Array.from(t.querySelectorAll(`[data-file-path]`)).flatMap(e=>{let t=e.dataset.filePath;if(!t)return[];let n=e.getBoundingClientRect();return[{path:t,top:n.top,bottom:n.bottom}]}),c=Ll(o,i,r.bottom);if(!c){m();return}d(Il(a.top,i));let u=Rl(c,o,i);l(e=>e.length===u.length&&e.every((e,t)=>e===u[t])?e:u)},[m,e,s]),g=(0,B.useCallback)(e=>{n.current=e.path,t(e.path)},[t,n]);return(0,B.useEffect)(()=>{m()},[m,a]),(0,B.useEffect)(()=>{if(e){m();return}i();let t=window.requestAnimationFrame(()=>i()),n=window.setTimeout(i,80),r=window.setTimeout(i,180);return()=>{window.cancelAnimationFrame(t),window.clearTimeout(n),window.clearTimeout(r)}},[m,e,r,i,o]),(0,B.useLayoutEffect)(()=>{if(e)return;let t=s.current?.closest(`.code-project-list`),n=0,r=()=>{n||=window.requestAnimationFrame(()=>{n=0,(0,Ql.flushSync)(h)})};return h(),window.setTimeout(h,80),t?.addEventListener(`scroll`,r,{passive:!0}),window.addEventListener(`resize`,r),()=>{n&&window.cancelAnimationFrame(n),t?.removeEventListener(`scroll`,r),window.removeEventListener(`resize`,r)}},[e,r,h,o,s]),{focusStickyDirectory:g,stickyContextItems:p}}function sd({rowHeight:e,visibleTreeRowCount:t,openDirectoryPaths:n,treeData:r,hydrateCompactDirectoryChains:i,isDirectoryOpen:a,setDirectoryOpen:o}){let s=(0,B.useRef)(void 0),c=(0,B.useRef)(null),l=(0,B.useRef)(null),u=(0,B.useRef)(new Set),d=(0,B.useRef)(new Set),f=Math.max(e,t*e),p=(0,B.useCallback)(e=>{if(e.length===0)return!1;let t=s.current;if(!t)return!1;let n=!1;return e.forEach(e=>{!e||!t.get(e)||u.current.has(e)||t.isOpen(e)||(t.open(e,!1),n=!0)}),n},[]),m=(0,B.useCallback)((e=[])=>{let t=()=>{p(e),s.current?.redrawList()};t(),window.requestAnimationFrame(t),window.setTimeout(t,80)},[p]),h=(0,B.useCallback)((e,t)=>{t?(u.current.delete(e),d.current.delete(e)):(u.current.add(e),d.current.delete(e)),o(e,t)},[o]),g=(0,B.useCallback)(e=>{let t=!a(e);return h(e,t),t},[a,h]);(0,B.useEffect)(()=>{u.current.forEach(e=>{if(!n.has(e)){d.current.add(e);return}d.current.has(e)&&(u.current.delete(e),d.current.delete(e))})},[n]),(0,B.useEffect)(()=>{let e=Array.from(n);if(e.length===0)return;let t=()=>{p(e)&&s.current?.redrawList()};t();let r=window.requestAnimationFrame(t),i=window.setTimeout(t,80),a=window.setTimeout(t,180);return()=>{window.cancelAnimationFrame(r),window.clearTimeout(i),window.clearTimeout(a)}},[n,p,r]);let _=(0,B.useCallback)(({attrs:e,innerRef:t,children:n})=>{let{style:r,className:i,...a}=e;return(0,B.createElement)(`div`,{...a,ref:t,style:{...r,minWidth:`100%`,width:`100%`},className:`code-file-tree-row-frame ${i??``}`.trim()},n)},[]);return{treeRef:s,treeViewportRef:c,lastFocusedFilePathRef:l,treeHeight:f,handleTreeToggle:(0,B.useCallback)(e=>{Vl(c.current?.closest(`.code-project-list`)),a(e)?i(e).finally(()=>m([e])):m()},[i,a,m]),refreshTreeLayout:m,rememberFocusedTreeNode:(0,B.useCallback)(e=>{e&&(l.current=e.data.path)},[]),rememberSelectedTreeNodes:(0,B.useCallback)(e=>{let t=e[e.length-1];t&&(l.current=t.data.path)},[]),renderFileTreeRow:_,setTreePathOpen:h,toggleTreePathOpen:g}}function cd({treeRef:e,treeViewportRef:t,lastFocusedFilePathRef:n,fileOperation:r,openDirectoryPaths:i,cancelPendingFileFocus:a,closeFileOperation:o,focusFileSearchInput:s,focusFileTreePath:c,focusFileTreeTarget:l,openFileContextMenu:u,openFilePath:d,setDirectoryOpen:f,startFileOperation:p,toggleDirectoryOpen:m}){let h=(0,B.useCallback)(()=>t.current?.closest(`.code-project-list`)??null,[t]),g=(0,B.useCallback)(()=>{let e=t.current,n=(e?.querySelector(`[data-file-path]`))?.getBoundingClientRect().height||24;return Al((h()??e)?.getBoundingClientRect().height??n,n)},[h,t]),_=(0,B.useCallback)((e,t=!0)=>{Vl(h()),t&&f(e.data.path,!0),e.open(),n.current=e.data.path,l(e.data)},[l,n,h,f]),v=(0,B.useCallback)((t,r,i=!0)=>{Vl(h()),i&&f(t,!1),r?r.close():e.current?.close(t),n.current=t,r?l(r.data):c(t)},[c,l,n,h,f,e]),y=(0,B.useCallback)(c=>{if(c.defaultPrevented||c.altKey)return;if((c.ctrlKey||c.metaKey)&&!c.shiftKey&&c.key.toLowerCase()===`p`){c.preventDefault(),c.stopPropagation(),s();return}if(c.ctrlKey||c.metaKey)return;let f=e.current,h=c.target;if(r&&c.key===`Escape`&&h?.closest(`.code-file-inline-operation`)){c.preventDefault(),c.stopPropagation(),o();return}if(h?.closest(`input, textarea, [contenteditable="true"], .code-file-inline-operation`))return;Dl(c.key)&&a();let y=h?.closest(`[data-file-path]`)?.dataset.filePath,b=y?void 0:t.current?.querySelector(`[data-file-path].selected`),x={path:b?.dataset.filePath,type:b?.dataset.fileType,expanded:b?.getAttribute(`aria-expanded`)===`true`},S=f?.focusedNode&&!f.focusedNode.isRoot?f.focusedNode:null,C=kl({targetPath:y,selectedPath:x.path,focusedPath:S?.data.path,lastFocusedPath:n.current}),w=C?f?.get(C):f?.focusedNode??f?.mostRecentNode;if(!w||w.isRoot)return;if(n.current=w.data.path,c.key===`ContextMenu`||c.shiftKey&&c.key===`F10`){c.preventDefault(),c.stopPropagation();let e=(c.target?.closest(`[data-file-path]`))?.getBoundingClientRect();u(e?e.left+24:24,e?e.top+e.height:24,w.data);return}if(c.shiftKey)return;if(c.key===`ArrowDown`||c.key===`ArrowUp`){c.preventDefault(),c.stopPropagation();let e=c.key===`ArrowDown`?w.next:w.prev;if(!e||e.isRoot)return;e.focus(),e.select(),n.current=e.data.path;return}if(c.key===`Home`||c.key===`End`){c.preventDefault(),c.stopPropagation();let e=f?.visibleNodes.filter(e=>!e.isRoot)??[],t=c.key===`Home`?e[0]:e[e.length-1];if(!t)return;t.focus(),t.select(),n.current=t.data.path,l(t.data);return}if(c.key===`PageUp`||c.key===`PageDown`){c.preventDefault(),c.stopPropagation();let e=f?.visibleNodes.filter(e=>!e.isRoot)??[],t=jl({currentIndex:e.findIndex(e=>e.id===w.id),key:c.key,pageSize:g(),rowCount:e.length}),r=t>=0?e[t]:null;if(!r)return;r.focus(),r.select(),n.current=r.data.path,l(r.data);return}if(c.key===`F2`){c.preventDefault(),c.stopPropagation(),p(`rename`,w.data);return}if(c.key===`Delete`||c.key===`Backspace`){c.preventDefault(),c.stopPropagation(),p(`delete`,w.data);return}if(c.key===`ArrowRight`){if(w.data.type!==`directory`)return;if(c.preventDefault(),c.stopPropagation(),!w.isOpen){_(w);return}let e=w.children?.[0]??null;e&&(e.select(),e.focus(),n.current=e.data.path,l(e.data));return}if(c.key===`ArrowLeft`){if(c.preventDefault(),c.stopPropagation(),Ml({nodePath:w.data.path,nodeType:w.data.type,nodeOpen:w.isOpen,selectedRow:x,openDirectoryPaths:i})){v(w.data.path,w);return}let e=w.parent;e&&!e.isRoot&&(e.select(),e.focus(),n.current=e.data.path,l(e.data));return}if(c.key!==`Enter`&&c.key!==` `)return;c.preventDefault(),c.stopPropagation();let T=w.data.type===`directory`?m(w.data.path)?`open-directory`:`close-directory`:Pl({nodeType:w.data.type,nodeOpen:w.isOpen});if(T===`close-directory`){v(w.data.path,w,!1);return}if(T===`open-directory`){_(w,!1);return}T===`open-file`&&(n.current=w.data.path,d(w.data.path))},[a,o,v,r,s,l,n,_,i,u,d,g,p,m,e,t]);return(0,B.useEffect)(()=>{let n=n=>{if(n.key!==`ArrowLeft`||n.altKey||n.ctrlKey||n.metaKey)return;let r=t.current,i=document.activeElement;if(!r||!(i instanceof Element)||!r.contains(i))return;let a=r.querySelector(`[data-file-path].selected`),o=a?.dataset.filePath;if(!o||a?.dataset.fileType!==`directory`||a.getAttribute(`aria-expanded`)!==`true`)return;n.preventDefault(),n.stopPropagation();let s=e.current?.get(o);v(o,s)};return window.addEventListener(`keydown`,n,!0),()=>{window.removeEventListener(`keydown`,n,!0)}},[v,e,t]),{handleTreeKeyDownCapture:y}}var ld=24,ud=350,dd=1400,fd=new Set;function pd(e){return e.replace(/[^a-zA-Z0-9_-]+/g,`-`)||`root`}function md(e,t){let n=e.replace(/\/+$/,``)||`/`,r=t.replace(/^\/+|\/+$/g,``);return r?n===`/`?`/${r}`:`${n}/${r}`:n}function hd(e){return e.split(`/`).filter(Boolean).pop()||e}function gd(e){return{id:e.path,name:hd(e.path),path:e.path,type:`file`,size:0,mtimeMs:0}}function _d({projectId:e,projectWorkspace:t,agentId:n,agentLaunchOptions:r,activeFilePath:i,revealRequest:a,focusSearchRequest:o,editorDirtyFilePaths:s=fd,editorExternalChangedFilePaths:l=fd,openFiles:u=[],onOpenFile:d,onSelectOpenFile:f,onCloseOpenFile:p,onNewAgent:m,onStartAgent:g,onMoveEntries:_,onDeleteEntries:v,onRefreshOpenFiles:y,onFilesCollapsedChange:b,readOnly:x=!1,copy:S}){let{directories:C,treeData:w,openDirectoryPaths:T,visibleTreeRowCount:E,loadRootDirectory:D,ensureDirectoryLoaded:O,isDirectoryLoaded:k,loadMissingDirectories:A,refreshDirectories:j,hydrateCompactDirectoryChains:M,isDirectoryOpen:N,setDirectoryOpen:P,openDirectoriesInLayout:ee}=Ju(n,e),te=(0,B.useRef)(!1),ne=(0,B.useRef)(null),F=(0,B.useRef)(null),re=(0,B.useRef)(null),ie=(0,B.useRef)(!1),ae=(0,B.useRef)(0),I=(0,B.useRef)(null),[oe,se]=(0,B.useState)(`idle`),L=nd(n),ce=`code-file-search-results-${pd(e)}`,{treeRef:le,treeViewportRef:ue,lastFocusedFilePathRef:de,treeHeight:fe,handleTreeToggle:pe,refreshTreeLayout:me,rememberFocusedTreeNode:he,rememberSelectedTreeNodes:R,renderFileTreeRow:ge,setTreePathOpen:z,toggleTreePathOpen:_e}=sd({rowHeight:ld,visibleTreeRowCount:E,openDirectoryPaths:T,treeData:w,hydrateCompactDirectoryChains:M,isDirectoryOpen:N,setDirectoryOpen:P}),{cancelPendingFileFocus:ve,focusFileSearchInput:ye,focusFileTreeFromSearch:be,focusFileTreePath:xe,focusFileTreeTarget:Se,locatedFilePath:Ce,revealExplorerPath:we,revealFilePath:Te}=Bu({treeRef:le,treeViewportRef:ue,fileSearchInputRef:ne,fileOperationActiveRef:te,lastFocusedFilePathRef:de,treeData:w,isDirectoryLoaded:k,loadMissingDirectories:A,openDirectoriesInLayout:ee,refreshTreeLayout:me}),De=L.clear,{openFileError:Oe,openFilePendingPath:ke,openFilePath:Ae,setOpenFileError:je}=Zu({agentId:n,onClearSearch:De,onOpenFile:d,onRevealFilePath:Te,onSelectOpenFile:f}),Me=ku(x?null:n,u),[Ne,Pe]=(0,B.useState)(!0),Fe=(0,B.useCallback)(()=>{if(ie.current)return;ie.current=!0;let e=ae.current+1;ae.current=e,I.current!==null&&(window.clearTimeout(I.current),I.current=null),se(`refreshing`),je(null);let r=[``,...T],i=new Promise(e=>{window.setTimeout(e,ud)});(async()=>{let a=!1;try{let e=await Me.refreshChanges(),[o,s]=await Promise.all([j(r),n&&y?y(n,t):Promise.resolve(!0)]);await i,a=e&&o&&s}catch{await i}ae.current===e&&(ie.current=!1,se(a?`success`:c().connected?`error`:`idle`),a&&(I.current=window.setTimeout(()=>{ae.current===e&&se(`idle`),I.current=null},dd)))})()},[n,Me.refreshChanges,y,T,t,j,je]);(0,B.useEffect)(()=>{ae.current+=1,ie.current=!1,I.current!==null&&(window.clearTimeout(I.current),I.current=null),se(`idle`)},[n,e]),(0,B.useEffect)(()=>()=>{ae.current+=1,I.current!==null&&window.clearTimeout(I.current)},[]),(0,B.useEffect)(()=>{Pe(!0)},[n]);let Ie=(0,B.useCallback)(()=>{Pe(e=>!e)},[]),Le=(0,B.useCallback)(e=>{Ae(e.path,{...h(e),transient:!0})},[Ae]),{fileOperation:Re,fileOperationInputRef:ze,clearFileOperation:Be,closeFileOperation:Ve,rememberFileOperationName:He,startFileOperation:Ue,submitFileOperation:We,updateFileOperationName:Ge}=ed({agentId:n,fileOperationActiveRef:te,ensureDirectoryLoaded:O,focusFileTreePath:xe,onDeleteEntries:v,onMoveEntries:_,onOpenFile:d,onWorkspaceChange:Me.refreshChanges,refreshDirectories:j,setOpenFileError:je}),{fileMenu:H,fileMenuRef:Ke,clearFileMenu:qe,closeFileMenuWithFocusRestore:Je,closeFileMenuWithoutFocus:Ye,copyFileMenuPath:Xe,copyFileMenuShareUrl:Ze,fileMenuTargetDirectory:Qe,openFileContextMenu:$e,refreshFileMenuTarget:et,startFileMenuOperation:tt}=Yu({agentId:n,agentLaunchOptionCount:r.length,cancelPendingFileFocus:ve,clearFileOperation:Be,focusFileTreeTarget:Se,projectWorkspace:t,refreshDirectories:j,shareLinkFailed:S.shareLinkFailed,setOpenFileError:je,startFileOperation:Ue}),nt=(0,B.useCallback)(e=>{je(null),L.setQuery(e)},[L.setQuery,je]),rt=(0,B.useCallback)(()=>md(t,Qe()),[Qe,t]),it=(0,B.useCallback)(()=>{m&&(Ye(),m(t))},[Ye,m,t]),at=(0,B.useCallback)(e=>{if(!g)return;let n=rt();Ye(),g(e,n,n===t?void 0:{projectWorkspace:t})},[Ye,rt,g,t]),ot=(0,B.useCallback)((e,t,n)=>{$e(e,t,gd(n))},[$e]),{filesCollapsed:U,openEditorsCollapsed:st,toggleFilesCollapsed:ct,toggleOpenEditorsCollapsed:lt}=id({agentId:n,workspaceKey:e,clearFileMenu:qe,clearFileOperation:Be,clearFileSearch:De,focusFileSearchInput:ye,focusSearchRequest:o,loadRootDirectory:D,openFilesCount:u.length,refreshTreeLayout:me,revealExplorerPath:we,revealRequest:a,rootDirectoryLoaded:!!(C[``]&&!C[``].loading),setFileSearchQuery:L.setQuery,setOpenFileError:je,treeData:w});(0,B.useEffect)(()=>{b?.(U)},[U,b]);let ut=(0,B.useMemo)(()=>u.length===0?{"--code-open-editors-sticky-height":`0px`}:st?{"--code-open-editors-sticky-height":`25px`}:{"--code-open-editors-sticky-height":`${25+Math.min(u.length,7)*28}px`},[st,u.length]);(0,B.useEffect)(()=>{!i||U||!C[``]||re.current!==i&&(re.current=i,Te(i))},[i,C,U,Te]);let{focusStickyDirectory:dt,stickyContextItems:ft}=od({filesCollapsed:U,focusFileTreePath:xe,lastFocusedFilePathRef:de,openDirectoryPaths:T,refreshTreeLayout:me,resetKey:n,treeData:w,treeViewportRef:ue}),{activeOptionId:mt,handleFileSearchKeyDown:ht,openFileJumpQuery:gt,openFileSearchMatch:W}=rd({fileMenuOpen:!!H,fileOperationActive:!!Re,fileSearch:L,fileSearchResultsRef:F,filesCollapsed:U,focusFileTreeFromSearch:be,listboxId:ce,onOpenFilePath:Ae,onRevealDirectoryPath:e=>we(e,`directory`)}),{handleTreeKeyDownCapture:_t}=cd({treeRef:le,treeViewportRef:ue,lastFocusedFilePathRef:de,fileOperation:Re,openDirectoryPaths:T,cancelPendingFileFocus:ve,closeFileOperation:Ve,focusFileSearchInput:ye,focusFileTreePath:xe,focusFileTreeTarget:Se,openFileContextMenu:$e,openFilePath:Ae,setDirectoryOpen:z,startFileOperation:tt,toggleDirectoryOpen:_e}),vt=Tu({activeFilePath:i,activeSearchOptionId:mt,agentId:n??``,agentLaunchOptions:r,copy:S,editorDirtyFilePaths:s,editorExternalChangedFilePaths:l,fileMenu:H,fileMenuRef:Ke,fileOperation:Re,fileOperationInputRef:ze,fileSearch:L,fileSearchInputRef:ne,fileSearchListboxId:ce,fileSearchResultsRef:F,filesCollapsed:U,handleFileSearchKeyDown:ht,handleTreeKeyDownCapture:_t,lastFocusedFilePathRef:de,locatedFilePath:Ce,openEditorsCollapsed:st,openFileError:Oe,openFilePendingPath:ke,projectId:e,renderFileTreeRow:ge,rootDirectoryError:C[``]?.error??null,rootDirectoryHasItems:!!C[``]?.items.length,rootDirectoryLoading:!!C[``]?.loading,rowHeight:ld,readOnly:x,stickyContextItems:ft,treeData:w,treeHeight:fe,treeRef:le,treeViewportRef:ue,visibleTreeRowCount:E,onCancelPendingFileFocus:ve,onCloseFileMenuWithFocusRestore:Je,onCloseFileMenuWithoutFocus:Ye,onCloseFileOperation:Ve,onCloseOpenFile:p,onCopyFileMenuPath:Xe,onCopyFileMenuShareUrl:Ze,onFocusFileTreeTarget:Se,onFocusStickyDirectory:dt,onOpenFileContextMenu:$e,onOpenFileJumpQuery:gt,onOpenFilePath:Ae,onOpenFileSearchMatch:W,onOpenNewAgentFromFileMenu:it,onRefreshFileMenuTarget:et,onRememberFileOperationName:He,onSearchQueryChange:nt,onSelectOpenFile:f,onSelectSearchMatchIndex:L.selectMatchIndex,onToggleDirectory:_e,onStartAgentFromFileMenu:at,onStartFileMenuOperation:tt,onSubmitFileOperation:We,onToggleFilesCollapsed:ct,onToggleOpenEditorsCollapsed:lt,onToggleTreeNode:pe,onTreeFocus:he,onTreeSelect:R,onUpdateFileOperationName:Ge});return n?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(wu,{...vt.openEditors,files:u,onOpenFileContextMenu:ot}),(0,V.jsxs)(`div`,{className:`code-files-section ${U?`collapsed`:``}`,"data-testid":`code-files-section`,"data-project-id":e,style:ut,children:[(0,V.jsx)(Zl,{...vt.sectionHeader,refreshStatus:oe,onRefreshFiles:Fe}),!U&&(0,V.jsxs)(V.Fragment,{children:[!x&&(0,V.jsx)(Ee,{activeFilePath:i,projectWorkspace:t,changes:Me,collapsed:Ne,copy:S,projectId:e,refreshing:oe===`refreshing`,onOpenChange:Le,onToggleCollapsed:Ie}),!x&&(0,V.jsx)(Su,{agentId:n,copy:S,projectId:e,projectWorkspace:t}),(0,V.jsx)(Xl,{...vt.sectionBody})]})]}),U&&(0,V.jsx)(pt,{agentId:n,copy:S,agentLaunchOptions:r,fileMenu:H,fileOperation:Re,fileMenuRef:Ke,fileOperationInputRef:ze,onCloseFileMenu:Ye,onCloseFileMenuWithFocusRestore:Je,onCloseFileOperation:Ve,onCopyFileMenuPath:Xe,onCopyFileMenuShareUrl:Ze,onOpenNewAgent:it,onRefreshFileMenuTarget:et,onRememberFileOperationName:He,onStartAgent:at,onStartFileMenuOperation:tt,onSubmitFileOperation:We,onUpdateFileOperationName:Ge,readOnly:x})]}):null}export{_d as ProjectFilesSection};
|