@tickernelz/wardmote-ui 2026.1114.1 → 2026.1114.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ActiveAgentsPanel-CKzCe8AC.js → ActiveAgentsPanel-Budj8e9v.js} +1 -1
- package/dist/assets/{AdapterManager-DFPaPUUr.js → AdapterManager-DhiW44Eo.js} +1 -1
- package/dist/assets/{AdvancedToolsRoute-CN5fWS4T.js → AdvancedToolsRoute-CICI1XRd.js} +1 -1
- package/dist/assets/{AgentActionButtons-a9LacJPP.js → AgentActionButtons-DIhpv51Y.js} +1 -1
- package/dist/assets/{AgentChat-D5FDUYuV.js → AgentChat-CeuGtMXr.js} +1 -1
- package/dist/assets/{AgentChats-TN5SE_gN.js → AgentChats-CmDtTrMa.js} +1 -1
- package/dist/assets/{AgentDefaults-CiVVS_pQ.js → AgentDefaults-DpYaMGkf.js} +1 -1
- package/dist/assets/{AgentDetail-bCAmWRXs.js → AgentDetail-DFTeFc4-.js} +1 -1
- package/dist/assets/{AgentTodoCard-BpmvHEsm.js → AgentTodoCard-DRXZ7hmU.js} +1 -1
- package/dist/assets/{Agents-CToMMxGu.js → Agents-CClUUMUq.js} +3 -3
- package/dist/assets/{AppDetail-P807ou0a.js → AppDetail-DfHLFOtj.js} +1 -1
- package/dist/assets/{AppNotConnected-DuA4PukX.js → AppNotConnected-CcmXbFtD.js} +1 -1
- package/dist/assets/{ApprovalCard-BDdZDBMj.js → ApprovalCard-uT_9D_uH.js} +1 -1
- package/dist/assets/{ApprovalDetail-CVgy1uNi.js → ApprovalDetail-CE41WFbd.js} +1 -1
- package/dist/assets/{ApprovalPayload-H5zW6yQ4.js → ApprovalPayload-_zU9bukt.js} +1 -1
- package/dist/assets/{Approvals-DL6kx45P.js → Approvals-BXrjqpKc.js} +1 -1
- package/dist/assets/{AppsReview-Bf7oB0ES.js → AppsReview-C0Y3SxmZ.js} +1 -1
- package/dist/assets/{ArtifactCard-Cp4KPgZl.js → ArtifactCard-DKUUBZ0K.js} +1 -1
- package/dist/assets/{Artifacts-Dz3eHCaQ.js → Artifacts-Bsv5m0aU.js} +1 -1
- package/dist/assets/{AssistantConnection-5Y4fBVXq.js → AssistantConnection-Dm2PaSeU.js} +1 -1
- package/dist/assets/{AttentionInteractionResolver-DlP6a6AG.js → AttentionInteractionResolver-CBjNuhYo.js} +1 -1
- package/dist/assets/{AuditHub-Dz2UXl0c.js → AuditHub-DbUni0O_.js} +1 -1
- package/dist/assets/{BoardChat-DsMVXf5M.js → BoardChat-CgzCuFIL.js} +1 -1
- package/dist/assets/{BootstrapSetupUxLab-CWWisaHp.js → BootstrapSetupUxLab-D-niQCV5.js} +1 -1
- package/dist/assets/{Browse-Be6aSv-F.js → Browse-0bmB5mqw.js} +1 -1
- package/dist/assets/{BudgetPolicyCard-Dka022-Z.js → BudgetPolicyCard-CqFUHqOj.js} +1 -1
- package/dist/assets/{CaseDetail-DdJrlm0m.js → CaseDetail-DakrB2jI.js} +1 -1
- package/dist/assets/{Cases-Da1szfrr.js → Cases-DXbr4HJt.js} +1 -1
- package/dist/assets/{ChatEndpointDetail-DSOH-zfs.js → ChatEndpointDetail-BdDKo-Gq.js} +1 -1
- package/dist/assets/{ChatEndpointSetup-J23lq-xi.js → ChatEndpointSetup-BX3iDH7N.js} +1 -1
- package/dist/assets/{ChoiceControls-B9yrYshK.js → ChoiceControls-Bu-fd6qI.js} +1 -1
- package/dist/assets/{Companies-BkHWSxdB.js → Companies-FcUNLIkt.js} +1 -1
- package/dist/assets/{CompanyAccess-BaiGlxY1.js → CompanyAccess-BUcTNg7_.js} +1 -1
- package/dist/assets/{CompanyActivity-CMBXXwCw.js → CompanyActivity-ScpRBz1G.js} +1 -1
- package/dist/assets/{CompanyConnections-CVzsivTW.js → CompanyConnections-DMEwbZv7.js} +1 -1
- package/dist/assets/{CompanyEnvironments-K7piWRrx.js → CompanyEnvironments-EqXhVruZ.js} +1 -1
- package/dist/assets/{CompanyExport-Bo8tUPaY.js → CompanyExport-DQ9ffuua.js} +1 -1
- package/dist/assets/{CompanyImport-CBVjSXPA.js → CompanyImport-BhuZu4oc.js} +1 -1
- package/dist/assets/{CompanySettings-CuU9qSp5.js → CompanySettings-BSkg4ahA.js} +1 -1
- package/dist/assets/{CompanySettingsPluginPage-59_bMQQ3.js → CompanySettingsPluginPage-BzZkZqh-.js} +1 -1
- package/dist/assets/{CompanySkills-GBJMThWx.js → CompanySkills-BbA4RKIw.js} +1 -1
- package/dist/assets/{ConfigureBuiltInAgentModal-D8Xnl51H.js → ConfigureBuiltInAgentModal-BUJPbmWc.js} +1 -1
- package/dist/assets/{CopyableGatewayUrl-GuvA-DoQ.js → CopyableGatewayUrl-BZyE_jT9.js} +1 -1
- package/dist/assets/{Dashboard-Cgj9BeTt.js → Dashboard--lTwxjV-.js} +1 -1
- package/dist/assets/{DashboardLive-Ku1cHAj9.js → DashboardLive-BYyTgF5d.js} +1 -1
- package/dist/assets/{DecisionDateChips-Z97mgInq.js → DecisionDateChips-vXwAFdua.js} +1 -1
- package/dist/assets/{DecisionQueuePage-D8cyKm4V.js → DecisionQueuePage-BaaKuZBi.js} +1 -1
- package/dist/assets/{DesignGuide-DvO3NaE-.js → DesignGuide-DS6MuXWY.js} +1 -1
- package/dist/assets/{EmailEndpointSetup-Cm_KKjjw.js → EmailEndpointSetup-CJFYu2G0.js} +1 -1
- package/dist/assets/{ExecutionWorkspaceDetail-CVB4ZY8I.js → ExecutionWorkspaceDetail-CuD5xWOB.js} +1 -1
- package/dist/assets/{GatewayDetail-DB1J44bF.js → GatewayDetail-xNVOxSIs.js} +1 -1
- package/dist/assets/{GatewaysList-CKSwMmOi.js → GatewaysList-DsSKLm1h.js} +1 -1
- package/dist/assets/{GoalDetail-Bscma2qU.js → GoalDetail-oN5pyUUY.js} +1 -1
- package/dist/assets/{GoalTree-jEFB788p.js → GoalTree-DaFizciF.js} +1 -1
- package/dist/assets/{Goals-jLNZ4UKT.js → Goals-xgGKfQZi.js} +1 -1
- package/dist/assets/{ImageGalleryModal-CghUxjQC.js → ImageGalleryModal-CjHED0Lb.js} +1 -1
- package/dist/assets/{Inbox-DHwNNh-Z.js → Inbox-wHhHozfr.js} +1 -1
- package/dist/assets/{InstanceAdvanced-C5IIPBwh.js → InstanceAdvanced-Bdf2a4c_.js} +1 -1
- package/dist/assets/{InviteLanding-BHmCRaWY.js → InviteLanding-McBYpNeW.js} +1 -1
- package/dist/assets/{IssueChatLongThreadPerf-JH8rtLk0.js → IssueChatLongThreadPerf-DD3RLbBo.js} +1 -1
- package/dist/assets/{IssueChatThread-ByTyrsxz.js → IssueChatThread-BN-_8hT8.js} +1 -1
- package/dist/assets/{IssueDetail-BIif8Swu.js → IssueDetail-CsaD311l.js} +1 -1
- package/dist/assets/{IssueOutputSection-CFE6aU9L.js → IssueOutputSection-CDIMRaF0.js} +1 -1
- package/dist/assets/{IssueRecoveryActionCard-DBgE7aMm.js → IssueRecoveryActionCard-C9qJAHes.js} +1 -1
- package/dist/assets/{IssueThreadInteractionCard-C3LFe8cu.js → IssueThreadInteractionCard-BbigJB2U.js} +1 -1
- package/dist/assets/{Issues-B5QG33RC.js → Issues-BWoc80Y9.js} +1 -1
- package/dist/assets/{LiveNowTodoLine-D52WDE8-.js → LiveNowTodoLine-B9oTH2L0.js} +1 -1
- package/dist/assets/{ManagedAiConnectionDetails-C9nV0oIT.js → ManagedAiConnectionDetails-B0aWUPkf.js} +1 -1
- package/dist/assets/{McpConnect-Bk8Qskqw.js → McpConnect-Dzf7W2K6.js} +1 -1
- package/dist/assets/{MembershipAction-DjdBY6Bk.js → MembershipAction-oiLtxQm3.js} +1 -1
- package/dist/assets/{ModelsAndProviders-BtbhNxf_.js → ModelsAndProviders-BEb4Z38S.js} +1 -1
- package/dist/assets/{NewAgent-C4JqnMkp.js → NewAgent-C3MxIRJj.js} +1 -1
- package/dist/assets/{OmpAllSettings-aHENTYf5.js → OmpAllSettings-DBtL1qDL.js} +1 -1
- package/dist/assets/{PipelineSettings-CCoxV9Es.js → PipelineSettings-BcAtsehE.js} +1 -1
- package/dist/assets/{Pipelines-DaQPh688.js → Pipelines-CkiYUQS-.js} +1 -1
- package/dist/assets/{PixelsOffice-D1X7mdpk.js → PixelsOffice-BSlctoug.js} +1 -1
- package/dist/assets/{PluginPage-B4kdPADI.js → PluginPage-C6Qnf9ka.js} +1 -1
- package/dist/assets/{PluginSettings-yP8NX-sM.js → PluginSettings-Do37r6Zu.js} +1 -1
- package/dist/assets/{ProfileDetailRoute-DMdAvFmb.js → ProfileDetailRoute-DRFQNId6.js} +1 -1
- package/dist/assets/{ProfileSettings-DVm3Tqzs.js → ProfileSettings-BMwLBQDB.js} +1 -1
- package/dist/assets/{ProfileWizardRoute-CijS7-aN.js → ProfileWizardRoute-XnnvzH9S.js} +1 -1
- package/dist/assets/{ProjectDetail-DeLSGbmz.js → ProjectDetail-BW6Lr4Iq.js} +1 -1
- package/dist/assets/{ProjectWorkspaceDetail-DPajDjA-.js → ProjectWorkspaceDetail-DR4JCa1b.js} +1 -1
- package/dist/assets/{ProjectWorkspacesContent-BCATCcZI.js → ProjectWorkspacesContent-CadPZn0k.js} +1 -1
- package/dist/assets/{Projects-DPmo6PFV.js → Projects-DLBFbxcj.js} +1 -1
- package/dist/assets/{PublicIssueSharePage-B_W1Qpy_.js → PublicIssueSharePage-C9yRZOdP.js} +1 -1
- package/dist/assets/{ReviewQueueCard-DhfCjwYP.js → ReviewQueueCard-CIkiY-Lm.js} +1 -1
- package/dist/assets/{RichWorkProductCard-rJC8tWnB.js → RichWorkProductCard-JGHGU_RI.js} +1 -1
- package/dist/assets/{RoutineDetail-Cb0oYk5B.js → RoutineDetail-izWzADvA.js} +1 -1
- package/dist/assets/{RoutineRunVariablesDialog-CWNUGmiH.js → RoutineRunVariablesDialog-DiT_o5Dm.js} +1 -1
- package/dist/assets/{Routines-Ct6W3Ht-.js → Routines-CHtabiYj.js} +1 -1
- package/dist/assets/{ScrollToBottom-BvL4b3BQ.js → ScrollToBottom-pyHLjOjY.js} +1 -1
- package/dist/assets/{Search-CXiBakEC.js → Search-yNNB6kys.js} +1 -1
- package/dist/assets/{Secrets-XUpMCMhK.js → Secrets-BOyOk5BF.js} +1 -1
- package/dist/assets/{SkillSourceTree-Brg47aIX.js → SkillSourceTree-M58QwBFF.js} +1 -1
- package/dist/assets/{SkillSources-C3kuN9Hz.js → SkillSources-Cw4PU-Bz.js} +1 -1
- package/dist/assets/{SkillStudio-DVVVKjdn.js → SkillStudio-Cj_M3ZJa.js} +1 -1
- package/dist/assets/{SourceTrustBadge-D-MXuX_l.js → SourceTrustBadge-BZBQe5No.js} +1 -1
- package/dist/assets/{StatusCards-BmNOGr1d.js → StatusCards-DaJdQUN5.js} +1 -1
- package/dist/assets/{SummarySlotCard-DiTaQ4km.js → SummarySlotCard-DlSmN6PL.js} +1 -1
- package/dist/assets/{TaskChatLab-fOJfHKjI.js → TaskChatLab-CU5eA7nX.js} +1 -1
- package/dist/assets/{TaskChatMarker-Cgyrmeab.js → TaskChatMarker-wBVUFL3u.js} +1 -1
- package/dist/assets/{TaskChatProtocolCard-DrIe_IYV.js → TaskChatProtocolCard-D-Dwy2EL.js} +1 -1
- package/dist/assets/{TaskChatThreadView-DKqNA1fZ.js → TaskChatThreadView-Crlf9I05.js} +1 -1
- package/dist/assets/{TaskDetailRelationsPanel-C9mJfMvL.js → TaskDetailRelationsPanel-CkktN1EC.js} +1 -1
- package/dist/assets/{TaskTreeControls-B1CSnDVK.js → TaskTreeControls-B_ulMOi1.js} +1 -1
- package/dist/assets/{Terminal-CGmILZtz.js → Terminal-Bo-WuezO.js} +1 -1
- package/dist/assets/{TerminalView-BqCU9Vc3.js → TerminalView-AkFY5bLC.js} +1 -1
- package/dist/assets/{TrustPresetSection-D4qB_VZo.js → TrustPresetSection-DTc1Rj4q.js} +1 -1
- package/dist/assets/{UserProfile-Cavc3nhB.js → UserProfile-C6q55R0Q.js} +1 -1
- package/dist/assets/{WhatNeedsMe-B7BSt_wb.js → WhatNeedsMe-1igJA4gL.js} +1 -1
- package/dist/assets/{Workspaces-CDTiwIHd.js → Workspaces-rtQKliW0.js} +1 -1
- package/dist/assets/{connection-owner-Cx9obLlP.js → connection-owner-CZwxTEuM.js} +1 -1
- package/dist/assets/{index-B7mmhFG7.js → index-DDoARkPG.js} +3 -3
- package/dist/assets/{issue-properties-C_y5-tny.js → issue-properties-lmRBaUTG.js} +1 -1
- package/dist/assets/{issue-workspace-selection-ChtddJZC.js → issue-workspace-selection-4JI2Uh9p.js} +1 -1
- package/dist/assets/{pipeline-stage-presentation-jxAxpF6f.js → pipeline-stage-presentation-BSuBql6K.js} +1 -1
- package/dist/assets/{shared-hwt7Xn4W.js → shared-DDwmHbeD.js} +1 -1
- package/dist/assets/{tool-taxonomy-6170LibQ.js → tool-taxonomy-DR7Q8sVs.js} +1 -1
- package/dist/assets/{transcript-adapter-C9uEslxp.js → transcript-adapter-wiFIjKfq.js} +1 -1
- package/dist/assets/{useSummaryDraftStream-BulT3Wwh.js → useSummaryDraftStream-CWOQt25o.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/sw.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Be=Object.defineProperty;var d=(e,r)=>Be(e,"name",{value:r,configurable:!0});import{i as we}from"./rolldown-runtime-ZpX3ckPj.js";import{Ir as De,en as _e,l as ne,na as We,ta as Ue}from"./createLucideIcon-DJi9suAC.js";import{h as qe}from"./star-BZgQbzhV.js";import{_ as pe,t as G,v as X}from"./queryKeys-DYV5MhM_.js";import{o as Ke,u as te}from"./companies-query-D9PxIiMT.js";import{n as Ye}from"./CompanyContext-CSrVsSze.js";import{o as Ze,p as Ge}from"./router-2UfGeejU.js";import{t as fe}from"./MarkdownBody-BTjuUgFa.js";import{t as B}from"./package-CYC5MDhY.js";import{r as Xe,t as H}from"./button-CMwV3L1P.js";import{t as me}from"./rotate-ccw-CQEJ4ewP.js";import{t as He}from"./search-04O7m-IF.js";import{t as Ve}from"./x-DRDFdlYE.js";import{a as Qe}from"./ToastContext-DMdt9oTd.js";import{t as Je}from"./agents-DmlgUVso.js";import{t as et}from"./projects-mixWrT5q.js";import{n as tt}from"./BreadcrumbContext-BVZDZoC0.js";import{$ as st,Q as he,Ra as nt,T as D,Vn as rt,X as ot,Z as it,_ as at,aa as ct,et as lt,tt as dt}from"./index-
|
|
1
|
+
var Be=Object.defineProperty;var d=(e,r)=>Be(e,"name",{value:r,configurable:!0});import{i as we}from"./rolldown-runtime-ZpX3ckPj.js";import{Ir as De,en as _e,l as ne,na as We,ta as Ue}from"./createLucideIcon-DJi9suAC.js";import{h as qe}from"./star-BZgQbzhV.js";import{_ as pe,t as G,v as X}from"./queryKeys-DYV5MhM_.js";import{o as Ke,u as te}from"./companies-query-D9PxIiMT.js";import{n as Ye}from"./CompanyContext-CSrVsSze.js";import{o as Ze,p as Ge}from"./router-2UfGeejU.js";import{t as fe}from"./MarkdownBody-BTjuUgFa.js";import{t as B}from"./package-CYC5MDhY.js";import{r as Xe,t as H}from"./button-CMwV3L1P.js";import{t as me}from"./rotate-ccw-CQEJ4ewP.js";import{t as He}from"./search-04O7m-IF.js";import{t as Ve}from"./x-DRDFdlYE.js";import{a as Qe}from"./ToastContext-DMdt9oTd.js";import{t as Je}from"./agents-DmlgUVso.js";import{t as et}from"./projects-mixWrT5q.js";import{n as tt}from"./BreadcrumbContext-BVZDZoC0.js";import{$ as st,Q as he,Ra as nt,T as D,Vn as rt,X as ot,Z as it,_ as at,aa as ct,et as lt,tt as dt}from"./index-DDoARkPG.js";import{t as ut}from"./issue-output-CU3gasZ1.js";import{a as pt,i as ft,n as mt,r as ht,t as je}from"./portable-files-CloN_vbk.js";var h=we(We(),1),xt=["agents","projects","skills","routines","tasks","attachments"],gt={agents:"Agents",projects:"Projects",skills:"Skills",routines:"Routines",tasks:"Tasks",attachments:"Attachments"};function bt(){return{agents:!0,projects:!0,skills:!0,routines:!0,tasks:!0,attachments:!0}}d(bt,"buildDefaultExportCategorySelection");function ye(e){return e.tasks||e.routines}d(ye,"isAttachmentsCategoryEnabled");function ke(e){const r=new Set;for(const i of e){if(!i.recurring)continue;const n=i.path.trim();if(!n)continue;r.add(n);const o=n.lastIndexOf("/");o>=0&&r.add(`${n.slice(0,o+1)}`)}return r}d(ke,"buildRecurringTaskPrefixes");function wt(e,r){for(const i of r)if(e===i||e.startsWith(i))return!0;return!1}d(wt,"isRecurringTaskFile");function jt(e){const r=new Set,i=new Set;for(const n of e)for(const o of n.attachments??[]){const c=o.sha256.trim().toLowerCase();c&&(n.recurring?r:i).add(c)}return{recurring:r,oneOff:i}}d(jt,"buildAttachmentShaOwnership");var yt=new Set(["agents","projects","skills","routines","tasks"]);function kt(e){const r=new Map;for(const i of e){const n=i.sha256.trim().toLowerCase();if(!n)continue;const o=r.get(n)??new Set,c=i.ownedBy&&i.ownedBy.length>0?i.ownedBy:["always"];for(const p of c)o.add(p);r.set(n,o)}return r}d(kt,"buildEmbeddedAssetShaOwnership");function vt(e,r){for(const i of e)if(!yt.has(i)||r[i])return!0;return!1}d(vt,"isEmbeddedAssetBlobIncluded");function ve(e,r){return e.startsWith("agents/")?"agents":e.startsWith("projects/")?"projects":e.startsWith("skills/")?"skills":e.startsWith("tasks/")?wt(e,r)?"routines":"tasks":e.startsWith("blobs/")?"attachments":null}d(ve,"categorizeExportFile");function St(e,r){const i=ke(r),n={agents:0,projects:0,skills:0,routines:0,tasks:0,attachments:0};for(const o of e){const c=ve(o,i);c&&(n[c]+=1)}return n}d(St,"countExportFilesByCategory");function Ct(e){const{filePaths:r,issues:i,categories:n}=e,o=ke(i),c=jt(i),p=kt(e.embeddedAssets??[]),f=n.attachments&&ye(n),x=new Set;for(const l of r){const b=ve(l,o);if(b===null){x.add(l);continue}if(b==="attachments"){const a=l.slice(6).trim().toLowerCase(),g=p.get(a);if(g&&vt(g,n)){x.add(l);continue}if(!f)continue;const j=c.recurring.has(a),y=c.oneOff.has(a);!j&&!y?g||x.add(l):(y&&n.tasks||j&&n.routines)&&x.add(l);continue}n[b]&&x.add(l)}return x}d(Ct,"buildExportCheckedFiles");function Se(e,r){if(!r.has(e))return r.add(e),e;let i=2;for(;;){const n=`${e}-${i}`;if(!r.has(n))return r.add(n),n;i+=1}}d(Se,"uniqueSlug");function Et(e){const r=new Set,i=new Map,n=[...e].sort((o,c)=>o.name.localeCompare(c.name));for(const o of n){const c=De(o.name)??"agent";i.set(o.id,Se(c,r))}return i}d(Et,"buildPortableAgentSlugMap");function Nt(e){const r=new Set,i=new Map,n=[...e].sort((o,c)=>o.name.localeCompare(c.name));for(const o of n){const c=_e(o.name,o.name);i.set(o.id,Se(c,r))}return i}d(Nt,"buildPortableProjectSlugMap");function At(e){const r=Et(e.agents),i=Nt(e.projects),n={agents:e.orderedAgents.map(o=>r.get(o.id)).filter(o=>!!o),projects:e.orderedProjects.map(o=>i.get(o.id)).filter(o=>!!o)};return n.agents.length>0||n.projects.length>0?n:void 0}d(At,"buildPortableSidebarOrder");var t=we(Ue(),1);function Ce(e){const r=new Set,i=new Set,n=new Set;for(const o of e){const c=o.match(/^agents\/([^/]+)\//);c&&r.add(c[1]);const p=o.match(/^projects\/([^/]+)\//);p&&i.add(p[1]);const f=o.match(/^tasks\/([^/]+)\//);f&&n.add(f[1])}return{agents:r,projects:i,tasks:n,routines:new Set(n)}}d(Ce,"checkedSlugs");function Pt(e,r){const i=Ce(r),n=e.split(`
|
|
2
2
|
`),o=[],c=new Set(["agents","projects","tasks","routines"]),p=new Set(["agents","projects"]);let f=null,x=null,l=!0,b=null,a=null,g=[],j=null,y=[];function T(){a!==null&&g.length>0&&(y.push(a),y.push(...g)),a=null,g=[]}d(T,"flushSidebarSection");function N(){T(),j!==null&&y.length>0&&(o.push(j),o.push(...y)),j=null,y=[]}d(N,"flushSection");for(const w of n){const W=w.match(/^([a-zA-Z_][\w-]*):\s*(.*)$/);if(W&&!w.startsWith(" ")){N(),x=null,l=!0;const E=W[0].split(":")[0];if(c.has(E)){f=E,j=w;continue}else if(E==="sidebar"){f=E,b=null,j=w;continue}else{f=null,o.push(w);continue}}if(f==="sidebar"){const E=w.match(/^ ([\w-]+):\s*$/);if(E&&!w.startsWith(" ")){T();const A=E[1];b=A&&p.has(A)?A:null,a=b?w:null;continue}const L=w.match(/^ - ["']?([^"'\n]+)["']?\s*$/);if(L&&b){const A=L[1],U=i[b];A&&U.has(A)&&g.push(w);continue}if(b){g.push(w);continue}}if(f&&c.has(f)){const E=w.match(/^ ([\w][\w-]*):\s*(.*)$/);if(E&&!w.startsWith(" ")){const L=E[1];x=L,l=i[f].has(L),l&&y.push(w);continue}if(x!==null){l&&y.push(w);continue}y.push(w);continue}o.push(w)}N();let C=o.join(`
|
|
3
3
|
`);const _=C.match(/^\s{2}logoPath:\s*["']?([^"'\n]+)["']?\s*$/m);return _&&!r.has(_[1])&&(C=C.replace(/^\s{2}logoPath:\s*["']?([^"'\n]+)["']?\s*\n?/m,"")),C}d(Pt,"filterWardmoteYaml");function Ee(e,r){if(!r)return e;const i=r.toLowerCase();return e.map(n=>{if(n.kind==="file")return n.name.toLowerCase().includes(i)||n.path.toLowerCase().includes(i)?n:null;const o=Ee(n.children,r);return o.length>0?{...n,children:o}:null}).filter(n=>n!==null)}d(Ee,"filterTree");function Rt(e,r){const i=new Set,n=r.toLowerCase();function o(c,p){if(c.kind==="file"){if(c.name.toLowerCase().includes(n)||c.path.toLowerCase().includes(n))for(const f of p)i.add(f)}else for(const f of c.children)o(f,[...p,c.path])}d(o,"walk");for(const c of e)o(c,[]);return i}d(Rt,"collectMatchedParentDirs");var xe=10;function Tt(e,r,i,n){let o=0,c=0;return{nodes:e.map(p=>{if(p.kind==="dir"&&p.name==="tasks"){o=p.children.length;const f=[],x=[],l=i.toLowerCase();for(const g of p.children){const j=st([g],"file"),y=n!==null&&j.has(n),T=i&&(g.name.toLowerCase().includes(l)||g.path.toLowerCase().includes(l)||[...j].some(N=>N.toLowerCase().includes(l)));y||T?f.push(g):x.push(g)}const b=Math.max(0,r-f.length),a=[...f,...x.slice(0,b)];return c=a.length,{...p,children:a}}return p}),totalTaskChildren:o,visibleTaskChildren:c}}d(Tt,"paginateTaskNodes");function Ne(e,r,i){const n={};for(const o of Object.keys(e))r.has(o)&&(n[o]=i[o]??e[o]);return n}d(Ne,"filterExportForDownload");function Lt(e,r,i){const n=Ne(e.files,r,i),o=ft(n,e.rootPath),c=new ArrayBuffer(o.byteLength);new Uint8Array(c).set(o);const p=new Blob([c],{type:"application/zip"}),f=URL.createObjectURL(p),x=document.createElement("a");x.href=f,x.download=`${e.rootPath}.zip`,document.body.appendChild(x),x.click(),x.remove(),window.setTimeout(()=>URL.revokeObjectURL(f),1e3)}d(Lt,"downloadZip");function Ot({data:e,onSkillClick:r}){return(0,t.jsx)("div",{className:"rounded-md border border-line bg-bg-3/20 px-4 py-3 mb-4",children:(0,t.jsx)("dl",{className:"grid grid-cols-(--gtc-5) gap-x-4 gap-y-1.5 text-sm",children:Object.entries(e).map(([i,n])=>(0,t.jsxs)("div",{className:"contents",children:[(0,t.jsx)("dt",{className:"text-ink-3 whitespace-nowrap py-0.5",children:ot[i]??i}),(0,t.jsx)("dd",{className:"py-0.5",children:Array.isArray(n)?(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:n.map(o=>(0,t.jsx)("button",{type:"button",className:ne("inline-flex items-center rounded-md border border-line bg-bg px-2 py-0.5 text-xs",i==="skills"&&r&&"cursor-pointer hover:bg-bg-3/50 hover:border-ink/30 transition-colors"),onClick:d(()=>i==="skills"&&r?.(o),"onClick"),children:o},o))}):(0,t.jsx)("span",{children:n})})]},i))})})}d(Ot,"FrontmatterCard");var Mt={ceo:"CEO",cto:"CTO",cmo:"CMO",cfo:"CFO",coo:"COO",vp:"VP",manager:"Manager",engineer:"Engineer",agent:"Agent"};function Ft(e,r,i,n){const o=Ce(r),c=e.agents.filter(a=>o.agents.has(a.slug)),p=e.projects.filter(a=>o.projects.has(a.slug)),f=e.issues.filter(a=>o.tasks.has(a.slug)),x=e.skills.filter(a=>[...r].some(g=>g.startsWith(`skills/${a.key}/`)||g.startsWith("skills/")&&g.includes(`/${a.slug}/`))),l=[];l.push(`# ${i}`),l.push(""),n&&(l.push(`> ${n}`),l.push("")),c.length>0&&(l.push(""),l.push("")),l.push("## What's Inside"),l.push(""),l.push("This is an [Agent Company](https://agentcompanies.io) package."),l.push("");const b=[];if(c.length>0&&b.push(["Agents",c.length]),p.length>0&&b.push(["Projects",p.length]),x.length>0&&b.push(["Skills",x.length]),f.length>0&&b.push(["Tasks",f.length]),b.length>0){l.push("| Content | Count |"),l.push("|---------|-------|");for(const[a,g]of b)l.push(`| ${a} | ${g} |`);l.push("")}if(c.length>0){l.push("### Agents"),l.push(""),l.push("| Agent | Role | Reports To |"),l.push("|-------|------|------------|");for(const a of c){const g=Mt[a.role]??a.role,j=a.reportsToSlug??"—";l.push(`| ${a.name} | ${g} | ${j} |`)}l.push("")}if(p.length>0){l.push("### Projects"),l.push("");for(const a of p){const g=a.description?` — ${a.description}`:"";l.push(`- **${a.name}**${g}`)}l.push("")}return l.push("## Getting Started"),l.push(""),l.push("```bash"),l.push("npx @tickernelz/wardmote company import this-github-url-or-folder"),l.push("```"),l.push(""),l.push("See [Wardmote](https://github.com/tickernelz/wardmote) for more information."),l.push(""),l.push("---"),l.push(`Exported from [Wardmote](https://github.com/tickernelz/wardmote) on ${new Date().toISOString().split("T")[0]}`),l.push(""),l.join(`
|
|
4
4
|
`)}d(Ft,"generateReadmeFromSelection");function It(e){const{src:r,selectedFile:i,allFiles:n,orgChartPreviewUrl:o}=e;if(/^(?:https?:|data:)/i.test(r))return null;if(r.replace(/^\.\//,"")==="images/org-chart.png"&&o)return o;const c=(i.includes("/")?i.slice(0,i.lastIndexOf("/")+1):"")+r,p=n[c]??n[r];return p?je(c in n?c:r,p):null}d(It,"resolveExportPreviewImageSrc");function $t({selectedFile:e,content:r,allFiles:i,orgChartPreviewUrl:n,onSkillClick:o}){if(!e||r===null)return(0,t.jsx)(D,{icon:B,message:"Select a file to preview its contents."});const c=mt(r),p=e.endsWith(".md")&&c!==null,f=p&&c?dt(c):null,x=ht(e,r)?je(e,r):null,l=p?b=>It({src:b,selectedFile:e,allFiles:i,orgChartPreviewUrl:n}):void 0;return(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"border-b border-line px-5 py-3",children:(0,t.jsx)("div",{className:"truncate font-mono text-sm",children:e})}),(0,t.jsx)("div",{className:"min-h-(--sz-560px) px-5 py-5",children:f?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Ot,{data:f.data,onSkillClick:o}),f.body.trim()&&(0,t.jsx)(fe,{resolveImageSrc:l,softBreaks:!1,linkIssueReferences:!1,children:f.body})]}):p?(0,t.jsx)(fe,{resolveImageSrc:l,softBreaks:!1,linkIssueReferences:!1,children:c??""}):x?(0,t.jsx)("div",{className:"flex min-h-(--sz-520px) items-center justify-center rounded-lg border border-line bg-bg-3/10 p-6",children:(0,t.jsx)("img",{src:x,alt:e,className:"max-h-(--sz-480px) max-w-full object-contain"})}):c!==null?(0,t.jsx)("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words border-0 bg-transparent p-0 font-mono text-sm text-ink",children:(0,t.jsx)("code",{children:c})}):(0,t.jsx)("div",{className:"rounded-lg border border-line bg-bg-3/10 px-4 py-3 text-sm text-ink-3",children:"Binary asset preview is not available for this file type."})})]})}d($t,"ExportPreviewPane");function ge(e){const r="/company/export/files/",i=Ge(e),n=i.indexOf(r);return n===-1?null:decodeURIComponent(i.slice(n+22))||null}d(ge,"filePathFromLocation");function be(e){const r=e.split("/").slice(0,-1),i=[];let n="";for(const o of r)n=n?`${n}/${o}`:o,i.push(n);return i}d(be,"expandAncestors");function zt(e){return(e instanceof DOMException||e instanceof Error)&&e.name==="AbortError"}d(zt,"isAbortError");function se(e){return e instanceof Error?e.message:"Failed to load export data."}d(se,"previewErrorMessage");function is(){const{selectedCompanyId:e,selectedCompany:r}=Ye(),{setBreadcrumbs:i}=tt(),{pushToast:n}=Qe(),o=Ze(),c=qe(),p=(0,h.useRef)(ge(c.pathname)),{data:f}=X({queryKey:G.auth.session,queryFn:d(()=>Ke.getSession(),"queryFn")}),{data:x=[]}=X({queryKey:G.agents.list(e),queryFn:d(()=>Je.list(e),"queryFn"),enabled:!!e}),{data:l=[]}=X({queryKey:G.projects.list(e),queryFn:d(()=>et.list(e),"queryFn"),enabled:!!e}),{data:b}=X({queryKey:G.companies.exportFidelity(e),queryFn:d(()=>te.exportFidelity(e),"queryFn"),enabled:!!e}),[a,g]=(0,h.useState)(null),[j,y]=(0,h.useState)(null),[T,N]=(0,h.useState)(new Set),[C,_]=(0,h.useState)(()=>({...bt(),tasks:!1,routines:!1,attachments:!1})),[w,W]=(0,h.useState)(""),[E,L]=(0,h.useState)(xe),[A,U]=(0,h.useState)(!1),q=(0,h.useRef)(null),I=(0,h.useRef)(null),M=(0,h.useRef)(0),re=(0,h.useRef)(null),oe=f?.user?.id??f?.session?.userId??null,V=(0,h.useMemo)(()=>x.filter(s=>s.status!=="terminated"),[x]),Q=(0,h.useMemo)(()=>l,[l]),{orderedAgents:ie}=ct({agents:V,companyId:e,userId:oe}),{orderedProjects:ae}=rt({projects:Q,companyId:e,userId:oe}),ce=(0,h.useMemo)(()=>At({agents:V,orderedAgents:ie,projects:Q,orderedProjects:ae}),[ie,ae,V,Q]),J=C.tasks||C.routines,ee=(0,h.useCallback)((s,u=!1)=>{y(s),s?o(`/company/export/files/${encodeURI(s)}`,{replace:u}):o("/company/export",{replace:u})},[o]);(0,h.useEffect)(()=>{if(!a)return;const s=ge(c.pathname);s&&s in a.files&&s!==j?(y(s),N(u=>{const m=new Set(u);for(const k of be(s))m.add(k);return m})):!s&&j&&y(null)},[c.pathname,a]),(0,h.useEffect)(()=>{i([{label:r?.name??"Organization",href:"/dashboard"},{label:"Settings",href:"/company/settings"},{label:"Export"}])},[r?.name,i]);const P=pe({mutationFn:d(({includeIssues:s,includeSkills:u,signal:m})=>te.exportPreview(e,{include:{company:!0,agents:!0,projects:!0,issues:s,skills:u},sidebarOrder:ce},{signal:m}),"mutationFn"),onSuccess:d((s,u)=>{if(u.requestId!==M.current)return;g(s);const m=he(s.files),k=new Set;for(const v of m)v.kind==="dir"&&v.name!=="tasks"&&k.add(v.path);const S=p.current;if(S&&S in s.files){y(S);const v=be(S);N(new Set([...k,...v]))}else{const v="README.md"in s.files?"README.md":Object.keys(s.files)[0];v&&ee(v,!0),N(k)}},"onSuccess"),onError:d((s,u)=>{u.requestId!==M.current||zt(s)||n({tone:"error",title:"Export failed",body:se(s)})},"onError")});function F(){if(!e)return;I.current?.abort();const s=new AbortController,u=M.current+1;M.current=u,I.current=s,U(!1),P.mutate({includeIssues:J,includeSkills:C.skills,requestId:u,signal:s.signal})}d(F,"startPreviewRequest");const K=pe({mutationFn:d(()=>te.exportBundle(e,{include:{company:!0,agents:!0,projects:!0,issues:J,skills:C.skills},selectedFiles:Array.from(R).sort(),sidebarOrder:ce}),"mutationFn"),onSuccess:d(s=>{const u=new Set(Object.keys(s.files));Lt(s,u,s.files),n({tone:"success",title:"Export downloaded",body:`${u.size} file${u.size===1?"":"s"} exported as ${s.rootPath}.zip`})},"onSuccess"),onError:d(s=>{n({tone:"error",title:"Export failed",body:s instanceof Error?s.message:"Failed to build export package."})},"onError")});(0,h.useEffect)(()=>{e&&(re.current!==e&&(re.current=e,g(null),y(null)),F())},[e,J,C.skills]),(0,h.useEffect)(()=>()=>{M.current+=1,I.current?.abort()},[]);const O=(0,h.useMemo)(()=>a?he(a.files):[],[a]),R=(0,h.useMemo)(()=>a?Ct({filePaths:Object.keys(a.files),issues:a.manifest.issues,categories:C,embeddedAssets:a.manifest.embeddedAssets??[]}):new Set,[a,C]),Ae=(0,h.useMemo)(()=>a?St(Object.keys(a.files),a.manifest.issues):null,[a]),{displayTree:Pe,totalTaskChildren:le,visibleTaskChildren:de}=(0,h.useMemo)(()=>{let s=O;w&&(s=Ee(s,w));const u=Tt(s,E,w,j);return{displayTree:u.nodes,totalTaskChildren:u.totalTaskChildren,visibleTaskChildren:u.visibleTaskChildren}},[O,w,E,j]),Re=(0,h.useMemo)(()=>{const s={};function u(m){if(m.kind==="file"){const S=R.has(m.path);return S||(s[m.path]="muted"),S}let k=!1;for(const S of m.children)u(S)&&(k=!0);return k||(s[m.path]="muted"),k}d(u,"walk");for(const m of O)u(m);return s},[O,R]),Y=(0,h.useMemo)(()=>{if(!a)return{};const s={...a.files},u=a.wardmoteExtensionPath;if(u&&typeof a.files[u]=="string"&&(s[u]=Pt(a.files[u],R)),typeof a.files["README.md"]=="string"){const m=a.manifest.company?.name??r?.name??"Company",k=a.manifest.company?.description??null;s["README.md"]=Ft(a.manifest,R,m,k)}return s},[a,R,r?.name]),Te=(0,h.useMemo)(()=>a?pt(Ne(a.files,R,Y),a.rootPath):0,[a,R,Y]),ue=(0,h.useMemo)(()=>lt(O),[O]),$=R.size,z=(0,h.useMemo)(()=>a?a.warnings.filter(s=>!/terminated agent/i.test(s)):[],[a]);function Le(s){N(u=>{const m=new Set(u);return m.has(s)?m.delete(s):m.add(s),m})}d(Le,"handleToggleDir");function Oe(s){_(u=>({...u,[s]:!u[s]}))}d(Oe,"handleToggleCategory");function Me(s){const u=w.length>0,m=s.length>0;if(m&&!u&&(q.current=new Set(T)),W(s),m){const k=Rt(O,s);N(S=>{const v=new Set(S);for(const Z of k)v.add(Z);return v})}else u&&q.current&&(N(q.current),q.current=null)}d(Me,"handleSearchChange");function Fe(s){if(!a)return;const u=a.manifest.skills.find(m=>m.key===s||m.slug===s)?.path??`skills/${s}/SKILL.md`;u in a.files&&(ee(u),N(m=>{const k=new Set(m);k.add("skills");const S=u.split("/").slice(0,-1);let v="";for(const Z of S)v=v?`${v}/${Z}`:Z,k.add(v);return k}))}d(Fe,"handleSkillClick");function Ie(){!a||R.size===0||K.isPending||K.mutate()}d(Ie,"handleDownload");function $e(){M.current+=1,I.current?.abort(),I.current=null,P.reset(),U(!0)}if(d($e,"handleCancelPreview"),!e)return(0,t.jsx)(D,{icon:B,message:"Select an organization to export."});if(P.isPending&&!a)return(0,t.jsx)(at,{variant:"detail"});if(A&&!a)return(0,t.jsx)(D,{icon:B,title:"Export preview cancelled",message:"The preview request was cancelled. Your export settings are unchanged.",action:"Retry preview",onAction:F,hideActionIcon:!0});if(P.isError&&!a)return(0,t.jsx)(D,{icon:B,title:"Export preview failed",message:se(P.error),description:"Retry the preview. You do not need to reload this page.",action:"Retry preview",onAction:F,hideActionIcon:!0});if(!a)return(0,t.jsx)(D,{icon:B,title:"Export preview unavailable",message:"No export preview is loaded.",action:"Load preview",onAction:F,hideActionIcon:!0});const ze=j?Y[j]??null:null;return(0,t.jsxs)("div",{className:"max-w-6xl",children:[(0,t.jsx)("div",{className:"sticky top-0 z-10 border-b border-line bg-bg px-5 py-3",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-4 text-sm",children:[(0,t.jsxs)("span",{className:"font-medium",children:[r?.name??"Organization"," export"]}),(0,t.jsxs)("span",{className:"text-ink-3",children:["Exporting ",$.toLocaleString()," of ",ue.toLocaleString()," file",ue===1?"":"s",$>0&&` (~${ut(Te)})`]}),z.length>0&&(0,t.jsxs)("span",{className:"text-amber-500",children:[z.length," warning",z.length===1?"":"s"]})]}),(0,t.jsxs)(H,{size:"sm",onClick:Ie,disabled:$===0||K.isPending||P.isPending||P.isError||A,children:[(0,t.jsx)(nt,{className:"mr-1.5 h-3.5 w-3.5"}),K.isPending?"Building export...":`Export ${$.toLocaleString()} file${$===1?"":"s"}`]})]})}),z.length>0&&(0,t.jsx)("div",{className:"mx-5 mt-3 rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3",children:z.map(s=>(0,t.jsx)("div",{className:"text-xs text-amber-500",children:s},s))}),b&&b.warnings.length>0&&(0,t.jsxs)("div",{className:"mx-5 mt-3 rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3",children:[(0,t.jsx)("h3",{className:"mb-1.5 text-xs font-medium",children:"Not included in this export"}),b.warnings.map(s=>(0,t.jsx)("div",{className:ne("text-xs",s.severity==="blocker"?"font-medium text-bad":"text-amber-500"),children:s.message},s.code))]}),(0,t.jsxs)("div",{className:"grid gap-4 xl:h-(--sz-calc-30) xl:grid-cols-(--gtc-25) xl:gap-0",children:[(0,t.jsxs)("aside",{className:"flex max-h-(--sz-24rem) flex-col overflow-hidden border-b border-line xl:max-h-none xl:border-b-0 xl:border-r",children:[(0,t.jsx)("div",{className:"border-b border-line px-4 py-3 shrink-0",children:(0,t.jsx)("h2",{className:"text-base font-semibold",children:"Package files"})}),(0,t.jsxs)("div",{className:"border-b border-line px-4 py-3 shrink-0",children:[(0,t.jsx)("h3",{className:"mb-2 text-xs font-medium text-ink-3",children:"What to include"}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1.5",role:"group","aria-label":"What to include",children:xt.map(s=>{const u=s==="attachments"&&!ye(C),m=C[s]&&!u,k=Ae?.[s]??0,S=a.manifest.includes.issues||s!=="tasks"&&s!=="routines"&&s!=="attachments";return(0,t.jsxs)("label",{className:ne("flex items-center gap-2 text-sm",u?"cursor-not-allowed opacity-50":"cursor-pointer"),title:u?"Attachments travel with tasks and routines; re-enable one of them to include attachments.":void 0,children:[(0,t.jsx)("input",{type:"checkbox",checked:m,disabled:u,onChange:d(()=>Oe(s),"onChange"),className:"accent-ink","data-export-category":s}),(0,t.jsx)("span",{className:"min-w-0 truncate",children:gt[s]}),(0,t.jsx)("span",{className:"text-xs text-ink-3",children:S?k.toLocaleString():"—"})]},s)})}),(0,t.jsx)("p",{className:"mt-2 text-xs text-ink-3",children:"Task and routine history is opt-in because it can be large."})]}),(0,t.jsx)("div",{className:"border-b border-line px-3 py-2 shrink-0",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-line px-2 py-1",children:[(0,t.jsx)(He,{className:"h-3.5 w-3.5 text-ink-3 shrink-0"}),(0,t.jsx)("input",{type:"text",value:w,onChange:d(s=>Me(s.target.value),"onChange"),placeholder:"Search files...",className:"w-full bg-transparent text-sm outline-none placeholder:text-ink-3","data-page-search-target":"true"})]})}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,t.jsx)(it,{nodes:Pe,selectedFile:j,expandedDirs:T,onToggleDir:Le,onSelectFile:ee,fileTones:Re,showCheckboxes:!1,wrapLabels:!1}),le>de&&!w&&(0,t.jsx)("div",{className:"px-4 py-2",children:(0,t.jsxs)("button",{type:"button",onClick:d(()=>L(s=>s+xe),"onClick"),className:"w-full rounded-md border border-line px-3 py-1.5 text-xs text-ink-3 hover:bg-bg-3/30 hover:text-ink transition-colors",children:["Show more tasks (",de," of ",le,")"]})})]})]}),(0,t.jsxs)("div",{className:"relative min-w-0 overflow-y-auto xl:pl-6",children:[(0,t.jsx)($t,{selectedFile:j,content:ze,allFiles:Y,orgChartPreviewUrl:`/api/companies/${encodeURIComponent(e)}/org.svg`,onSkillClick:Fe}),P.isPending?(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex min-h-(--sz-520px) items-center justify-center bg-bg/90 px-6 text-center",role:"status","aria-live":"polite","aria-busy":"true","data-export-preview-state":"loading",children:(0,t.jsxs)("div",{className:"flex max-w-md flex-col items-center gap-3",children:[(0,t.jsx)(Xe,{className:"h-6 w-6 animate-spin text-ink-3"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:"Updating export preview…"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-ink-3",children:"Large task histories can take a minute. You can untick Tasks or cancel this update."})]}),(0,t.jsxs)(H,{type:"button",variant:"secondary",size:"sm",onClick:$e,children:[(0,t.jsx)(Ve,{}),"Cancel update"]})]})}):A?(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex min-h-(--sz-520px) items-center justify-center bg-bg/90 px-6 text-center","data-export-preview-state":"cancelled",children:(0,t.jsxs)("div",{className:"flex max-w-md flex-col items-center gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:"Preview update cancelled"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-ink-3",children:"The previous preview remains available. Retry when you are ready."})]}),(0,t.jsxs)(H,{type:"button",variant:"secondary",size:"sm",onClick:F,children:[(0,t.jsx)(me,{}),"Retry preview"]})]})}):P.isError?(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex min-h-(--sz-520px) items-center justify-center bg-bg/90 px-6 text-center",role:"alert","data-export-preview-state":"error",children:(0,t.jsxs)("div",{className:"flex max-w-md flex-col items-center gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-bad",children:"Export preview failed"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-ink-3",children:se(P.error)})]}),(0,t.jsxs)(H,{type:"button",variant:"secondary",size:"sm",onClick:F,children:[(0,t.jsx)(me,{}),"Retry preview"]})]})}):null]})]})]})}d(is,"CompanyExport");export{is as CompanyExport};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var Xt=Object.defineProperty;var r=(n,i)=>Xt(n,"name",{value:i,configurable:!0});import{i as xt}from"./rolldown-runtime-ZpX3ckPj.js";import{l as _,na as en,ta as tn}from"./createLucideIcon-DJi9suAC.js";import{X as nn,_ as st,n as Pe,t as L,v as re}from"./queryKeys-DYV5MhM_.js";import{d as sn,o as rt,u as E}from"./companies-query-D9PxIiMT.js";import{N as rn,T as an,_ as on,w as ln}from"./ConnectionSetupFlow-DKjP5RBZ.js";import{n as dn}from"./CompanyContext-CSrVsSze.js";import{t as gt}from"./arrow-right-BL5kYtCZ.js";import{t as cn}from"./check-Ctsrlfa-.js";import{t as pn}from"./chevron-right-s7L6hXXq.js";import{t as at}from"./MarkdownBody-BTjuUgFa.js";import{t as mn}from"./package-CYC5MDhY.js";import{r as Ae,t as U}from"./button-CMwV3L1P.js";import{t as W}from"./badge-DuA2EgZC.js";import{a as un}from"./ToastContext-DMdt9oTd.js";import{t as it}from"./agents-DmlgUVso.js";import{t as hn}from"./instanceSettings-D8g_QlS-.js";import{c as fn,r as xn}from"./agent-order-BE-pAWdx.js";import{t as gn}from"./sidebarPreferences-vEHBC54I.js";import{t as bn}from"./routines-KPtwxuS7.js";import{t as yn}from"./github-icon-Bbgf67tg.js";import{n as jn}from"./BreadcrumbContext-BVZDZoC0.js";import{t as wn}from"./chip-DsDe6yck.js";import{n as bt}from"./adapter-display-registry-Bk0KWAHT.js";import{a as ae,c as yt}from"./agent-config-primitives-BsZUnbf2.js";import{t as vn}from"./adapters-Dp0USyWg.js";import{$ as kn,Q as ot,Ra as lt,T as jt,X as Nn,Z as Sn,et as An,ga as In,tt as Cn}from"./index-B7mmhFG7.js";import{n as Pn,o as Tn,r as En,t as dt}from"./portable-files-CloN_vbk.js";var h=xt(en(),1),As=new TextEncoder;function le(n){return`${Math.max(1,Math.round(n/1048576))} MB`}r(le,"formatMegabytes");var _n=50331648,Ie=33554432;async function ct(n){const i=await crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(i),l=>l.toString(16).padStart(2,"0")).join("")}r(ct,"sha256Hex");async function On(n){const i=await ct(n),l=[];for(let o=0;o<n.byteLength;o+=Ie){const p=Math.min(Ie,n.byteLength-o);l.push({index:l.length,byteSize:p,sha256:await ct(new Uint8Array(n,o,p))})}return{totalBytes:n.byteLength,zipSha256:i,partSizeBytes:Ie,parts:l}}r(On,"buildImportTransferManifest");var Rn=3e3,wt="wardmote:company-import-job";function zn(n,i){return`${wt}:${n}:${i}`}r(zn,"importJobStorageKey");function Fn(n,i){try{sessionStorage.setItem(n,JSON.stringify(i))}catch{}}r(Fn,"writeStoredImportJob");function ie(n){try{sessionStorage.removeItem(n)}catch{}}r(ie,"clearStoredImportJob");function Mn(n){try{const i=`${wt}:${n}:`;for(let l=0;l<sessionStorage.length;l+=1){const o=sessionStorage.key(l);if(!o||!o.startsWith(i))continue;const p=sessionStorage.getItem(o);if(p)try{const u=JSON.parse(p);if(typeof u=="object"&&u!==null&&typeof u.jobId=="string")return{jobId:u.jobId,pauseAutomations:u.pauseAutomations===!0,storageKey:o}}catch{}sessionStorage.removeItem(o),l-=1}}catch{}return null}r(Mn,"readStoredImportJob");function Bn(n){return new Promise(i=>setTimeout(i,n))}r(Bn,"sleep");async function $n(n=Rn){do await Bn(n);while(typeof document<"u"&&document.hidden)}r($n,"waitForNextImportJobPoll");var e=xt(tn(),1);function pt(n){const i=new Map,l=n.manifest;for(const o of n.plan.agentPlans){const p=l.agents.find(u=>u.slug===o.slug);if(p){const u=M(p.path);i.set(u,o.action)}}for(const o of n.plan.projectPlans){const p=l.projects.find(u=>u.slug===o.slug);if(p){const u=M(p.path);i.set(u,o.action)}}for(const o of n.plan.issuePlans){const p=l.issues.find(u=>u.slug===o.slug);if(p){const u=M(p.path);i.set(u,o.action)}}for(const o of l.skills){const p=M(o.path);i.set(p,"create");for(const u of o.fileInventory)n.files[u.path]&&i.set(u.path,"create")}if(l.company){const o=M(l.company.path);i.set(o,n.plan.companyAction==="none"?"skip":n.plan.companyAction)}return i}r(pt,"buildActionMap");function M(n){return n.endsWith(".md")?n:`${n}.md`}r(M,"ensureMarkdownPath");var de={create:"text-emerald-500 border-emerald-500/30",update:"text-amber-500 border-amber-500/30",overwrite:"text-red-500 border-red-500/30",replace:"text-red-500 border-red-500/30",skip:"text-ink-3 border-line",none:"text-ink-3 border-line"};function Ln({data:n}){return(0,e.jsx)("div",{className:"rounded-md border border-line bg-bg-3/20 px-4 py-3 mb-4",children:(0,e.jsx)("dl",{className:"grid grid-cols-(--gtc-5) gap-x-4 gap-y-1.5 text-sm",children:Object.entries(n).map(([i,l])=>(0,e.jsxs)("div",{className:"contents",children:[(0,e.jsx)("dt",{className:"text-ink-3 whitespace-nowrap py-0.5",children:Nn[i]??i}),(0,e.jsx)("dd",{className:"py-0.5",children:Array.isArray(l)?(0,e.jsx)("div",{className:"flex flex-wrap gap-1.5",children:l.map(o=>(0,e.jsx)("span",{className:"inline-flex items-center rounded-md border border-line bg-bg px-2 py-0.5 text-xs",children:o},o))}):(0,e.jsx)("span",{children:l})})]},i))})})}r(Ln,"FrontmatterCard");function Un(n,i,l){const o=n.kind==="dir"?l.get(n.path):void 0,p=n.action?(0,e.jsx)(W,{variant:"outline",className:_("text-(length:--text-nano) uppercase tracking-wide",de[n.action]??de.skip),children:i?n.action:"skip"}):null;return!p&&!o?null:(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5 shrink-0",children:[o&&i&&(0,e.jsxs)("span",{className:"text-(length:--text-nano) text-cyan-500 font-mono truncate max-w-(--sz-7rem)",title:o,children:["→ ",o]}),p]})}r(Un,"renderImportFileExtra");function qn(n,i){return i?void 0:"opacity-50"}r(qn,"importFileRowClassName");function Dn({selectedFile:n,content:i,allFiles:l,action:o,renamedTo:p}){if(!n||i===null)return(0,e.jsx)(jt,{icon:mn,message:"Select a file to preview its contents."});const u=Pn(i),I=n.endsWith(".md")&&u!==null,b=I&&u?Cn(u):null,c=En(n,i)?dt(n,i):null,y=o?de[o]??de.skip:"",T=I?N=>{if(/^(?:https?:|data:)/i.test(N))return null;const C=(n.includes("/")?n.slice(0,n.lastIndexOf("/")+1):"")+N,k=l[C]??l[N];return k?dt(C in l?C:N,k):null}:void 0;return(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"border-b border-line px-5 py-3",children:(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0 flex items-center gap-2",children:[(0,e.jsx)("span",{className:"truncate font-mono text-sm",children:n}),p&&(0,e.jsxs)("span",{className:"shrink-0 font-mono text-sm text-cyan-500",children:["→ ",p]})]}),o&&(0,e.jsx)(W,{variant:"outline",className:_("uppercase tracking-wide",y),children:o})]})}),(0,e.jsx)("div",{className:"min-h-(--sz-560px) px-5 py-5",children:b?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Ln,{data:b.data}),b.body.trim()&&(0,e.jsx)(at,{resolveImageSrc:T,softBreaks:!1,linkIssueReferences:!1,children:b.body})]}):I?(0,e.jsx)(at,{resolveImageSrc:T,softBreaks:!1,linkIssueReferences:!1,children:u??""}):c?(0,e.jsx)("div",{className:"flex min-h-(--sz-520px) items-center justify-center rounded-lg border border-line bg-bg-3/10 p-6",children:(0,e.jsx)("img",{src:c,alt:n,className:"max-h-(--sz-480px) max-w-full object-contain"})}):u!==null?(0,e.jsx)("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words border-0 bg-transparent p-0 font-mono text-sm text-ink",children:(0,e.jsx)("code",{children:u})}):(0,e.jsx)("div",{className:"rounded-lg border border-line bg-bg-3/10 px-4 py-3 text-sm text-ink-3",children:"Binary asset preview is not available for this file type."})})]})}r(Dn,"ImportPreviewPane");function mt(n){const i=[],l=n.manifest;for(const o of n.plan.agentPlans)if(o.existingAgentId){const p=l.agents.find(u=>u.slug===o.slug);i.push({slug:o.slug,kind:"agent",originalName:p?.name??o.slug,plannedName:o.plannedName,filePath:p?M(p.path):null,action:o.action==="update"?"update":"rename"})}for(const o of n.plan.projectPlans)if(o.existingProjectId){const p=l.projects.find(u=>u.slug===o.slug);i.push({slug:o.slug,kind:"project",originalName:p?.name??o.slug,plannedName:o.plannedName,filePath:p?M(p.path):null,action:o.action==="update"?"update":"rename"})}return i}r(mt,"buildConflictList");function Kn(n,i,l,o){if(n==="local")return o?o.split("/").pop()??null:l&&l.replace(/\.zip$/i,"")||null;if(n==="github"){const p=i.trim();if(!p)return null;try{const u=new URL(p.startsWith("http")?p:`https://${p}`).pathname.split("/").filter(Boolean);return u.length>0?u[u.length-1]:null}catch{return null}}return null}r(Kn,"deriveSourcePrefix");function Jn(n,i){return n?`${n}-${i}`:i}r(Jn,"prefixedName");async function Wn(n,i,l){const o=n?.manifest.sidebar;if(!o||!l?.trim())return;const p=new Map(i.agents.filter(c=>typeof c.id=="string"&&c.id.length>0).map(c=>[c.slug,c.id])),u=new Map(i.projects.filter(c=>typeof c.id=="string"&&c.id.length>0).map(c=>[c.slug,c.id])),I=o.agents.map(c=>p.get(c)).filter(c=>!!c),b=o.projects.map(c=>u.get(c)).filter(c=>!!c);I.length>0&&fn(xn(i.company.id,l),I),b.length>0&&await gn.updateProjectOrder(i.company.id,{orderedIds:b})}r(Wn,"applyImportedSidebarOrder");function Ce(n){const i=[];for(const l of n.agents)!l.id||l.action==="skipped"||i.push({key:`agent:${l.id}`,kind:"agent",id:l.id,name:l.name});for(const l of n.routines)l.id&&i.push({key:`routine:${l.id}`,kind:"routine",id:l.id,name:l.title});return i}r(Ce,"buildActivationItems");function Hn({conflicts:n,nameOverrides:i,skippedSlugs:l,confirmedSlugs:o,onRename:p,onToggleSkip:u,onToggleConfirm:I}){return n.length===0?null:(0,e.jsx)("div",{className:"mx-5 mt-3",children:(0,e.jsxs)("div",{className:"rounded-md border border-line",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 border-b border-line px-4 py-2.5",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Renames"}),(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:[n.length," item",n.length===1?"":"s"]})]}),(0,e.jsx)("div",{className:"divide-y divide-line",children:n.map(b=>{const c=l.has(b.slug),y=o.has(b.slug),T=i[b.slug]??b.plannedName;return(0,e.jsxs)("div",{className:_("flex items-center gap-3 px-4 py-2.5 text-sm",c&&"opacity-40",y&&!c&&"bg-emerald-500/5"),children:[(0,e.jsx)("button",{type:"button",className:_("shrink-0 rounded-md border px-2.5 py-1 text-xs transition-colors",c?"border-ink bg-bg-3 text-ink":"border-line text-ink-3 hover:bg-bg-3/50"),onClick:r(()=>u(b.slug,b.filePath),"onClick"),children:c?"skipped":"skip"}),(0,e.jsx)(W,{variant:"outline",className:_("text-(length:--text-nano) uppercase tracking-wide",c?"text-ink-3 border-line":y?"text-emerald-500 border-emerald-500/30":"text-amber-500 border-amber-500/30"),children:b.kind}),(0,e.jsx)("span",{className:_("shrink-0 font-mono text-xs",c?"text-ink-3 line-through":"text-ink-3"),children:b.originalName}),!c&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(gt,{className:"h-3 w-3 shrink-0 text-ink-3"}),y?(0,e.jsx)("span",{className:"min-w-0 flex-1 font-mono text-xs text-emerald-500",children:T}):(0,e.jsx)("input",{className:"min-w-0 flex-1 rounded-md border border-line bg-transparent px-2 py-1 font-mono text-xs outline-none focus:border-ink",value:T,onChange:r(N=>p(b.slug,N.target.value),"onChange")})]}),!c&&(0,e.jsx)(wn,{selected:y,className:"ml-auto shrink-0",onClick:r(()=>I(b.slug),"onClick"),children:y?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(cn,{className:"h-3 w-3"}),"confirmed"]}):"confirm rename"})]},b.slug)})})]})})}r(Hn,"ConflictResolutionList");var oe="omp_local",Vn=[...an().map(n=>({value:n.type,label:yt[n.type]??bt(n.type)})),{value:"openai_dot",label:"OpenAI Dot (beta)"}];function Te(n,i){return{...rn,adapterType:n==="openai_dot"?"wardmote_runner":n,...n==="openai_dot"?{adapterSchemaValues:{provider:"openai_dot",allowUnmeteredProvider:i?.allowUnmeteredProvider===!0,dotAttachmentAccess:i?.dotAttachmentAccess===!0,dotWorkspaceAccess:i?.dotWorkspaceAccess===!0}}:{}}}r(Te,"importAdapterValues");function Gn({agents:n,adapterOptions:i,adapterOverrides:l,expandedSlugs:o,configValues:p,onChangeAdapter:u,onToggleExpand:I,onChangeConfig:b}){return n.length===0?null:(0,e.jsx)("div",{className:"mx-5 mt-3",children:(0,e.jsxs)("div",{className:"rounded-md border border-line",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 border-b border-line px-4 py-2.5",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Adapters"}),(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:[n.length," agent",n.length===1?"":"s"]})]}),(0,e.jsx)("div",{className:"divide-y divide-line",children:n.map(c=>{const y=l[c.slug]??c.fallbackAdapterType??c.adapterChoice,T=o.has(c.slug),N=p[c.slug]??Te(y,y===c.adapterChoice?c.adapterConfig:void 0);return(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5 text-sm",children:[(0,e.jsx)(W,{variant:"outline",className:_("text-(length:--text-nano) uppercase tracking-wide","text-blue-500 border-blue-500/30"),children:"agent"}),(0,e.jsx)("span",{className:"shrink-0 font-mono text-xs text-ink-3",children:c.name}),(0,e.jsx)(gt,{className:"h-3 w-3 shrink-0 text-ink-3"}),(0,e.jsx)("select",{className:"min-w-0 flex-1 rounded-md border border-line bg-transparent px-2 py-1 text-xs outline-none focus:border-ink",value:y,onChange:r(C=>u(c.slug,C.target.value),"onChange"),children:i.map(C=>(0,e.jsx)("option",{value:C.value,children:C.label},C.value))}),(0,e.jsxs)("button",{type:"button",className:_("ml-auto shrink-0 rounded-md border px-2.5 py-1 text-xs transition-colors inline-flex items-center gap-1.5",T?"border-ink bg-bg-3 text-ink":"border-line text-ink-3 hover:bg-bg-3/50"),onClick:r(()=>I(c.slug),"onClick"),children:[(0,e.jsx)(pn,{className:_("h-3 w-3 transition-transform",T&&"rotate-90")}),"configure adapter"]})]}),c.fallbackAdapterType&&(0,e.jsx)("div",{className:"mx-4 mb-2.5 rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2",children:(0,e.jsxs)("p",{className:"text-xs text-amber-500",children:["source adapter ",c.adapterChoice==="openai_dot"?"OpenAI Dot":c.adapterType," is not installed here — this agent will use ",yt[y]??bt(y)]})}),T&&(0,e.jsx)("div",{className:"border-t border-line bg-bg-3/10 px-4 py-3 space-y-3",children:(0,e.jsx)(on,{mode:"create",values:N,onChange:r(C=>b(c.slug,C),"onChange"),showAdapterTypeField:!1,showAdapterTestEnvironmentButton:!1,showCreateRunPolicySection:!1,hideInstructionsFile:!0,sectionLayout:"cards"})})]},c.slug)})})]})})}r(Gn,"AdapterPickerList");async function Qn(n){if(!/\.zip$/i.test(n.name))throw new Error("Select a .zip organization package.");const i=await Tn(await n.arrayBuffer());if(Object.keys(i.files).length===0)throw new Error("No package files were found in the selected zip archive.");return{name:n.name,file:n,compressedBytes:n.size,rootPath:i.rootPath,files:i.files}}r(Qn,"readLocalPackageZip");function ut(n){return n.size>_n}r(ut,"usesChunkedTransfer");function ht(n){return`Uploading part ${Math.min(n.uploadedParts+1,n.totalParts)} of ${n.totalParts} — ${le(n.uploadedBytes)} of ${le(n.totalBytes)} uploaded.`}r(ht,"formatTransferProgress");function Zn(n){if(!(n instanceof Pe)||n.status!==409)return null;const i=n.body,l=i?.job?.id;return typeof l!="string"||l.length===0?null:{job:{id:l,status:"running"},statusUrl:typeof i?.statusUrl=="string"?i.statusUrl:`/companies/import/jobs/${l}`}}r(Zn,"runningImportJobFromError");async function ft(n,i){for(;;){let l=null;try{l=(await E.getImportJob(n)).job}catch(o){if(o instanceof Pe&&o.status===404)throw ie(i),new Error("The server no longer reports this import job — it may have restarted while the import ran.");if(o instanceof Pe&&o.status>=400&&o.status<500&&o.status!==429)throw ie(i),new Error("The import status can no longer be read — your session may have expired. Reload and sign in to check on it.")}if(l?.status==="succeeded")return ie(i),l.importResult?{status:"completed",result:l.importResult}:{status:"completed-expired",companyId:l.result?.companyId??null};if(l?.status==="failed")throw ie(i),new Error(l.error?.message??"Import failed on the server.");await $n()}}r(ft,"watchImportJob");function Is(){const{selectedCompanyId:n,selectedCompany:i,setSelectedCompanyId:l}=dn(),{setBreadcrumbs:o}=jn(),{pushToast:p}=un(),u=nn(),I=(0,h.useRef)(null),{data:b}=re({queryKey:L.auth.session,queryFn:r(()=>rt.getSession(),"queryFn")}),c=b?.user?.id??b?.session?.userId??null,[y,T]=(0,h.useState)("github"),[N,C]=(0,h.useState)(""),[k,vt]=(0,h.useState)(null),[H,kt]=(0,h.useState)("new"),[Ee,Nt]=(0,h.useState)(""),[g,_e]=(0,h.useState)(null),[F,Oe]=(0,h.useState)(null),[St,Re]=(0,h.useState)(new Set),[ce,pe]=(0,h.useState)(new Set),[V,ze]=(0,h.useState)({}),[me,Fe]=(0,h.useState)(new Set),[At,ue]=(0,h.useState)(new Set),[Me,It]=(0,h.useState)("rename"),[he,Be]=(0,h.useState)({}),[Ct,fe]=(0,h.useState)(new Set),[$e,xe]=(0,h.useState)({}),[Le,Pt]=(0,h.useState)(!0),[S,Ue]=(0,h.useState)(null),[ge,qe]=(0,h.useState)(new Set),[be,De]=(0,h.useState)(new Set),[Tt,Ke]=(0,h.useState)({}),[G,Je]=(0,h.useState)(!1),[Et,ye]=(0,h.useState)(null),We=(0,h.useRef)(!1),je=(0,h.useRef)(null),[Q,we]=(0,h.useState)(null);async function _t(t){if(je.current?.file===t)return je.current.manifest;const a=await On(await t.arrayBuffer());return je.current={file:t,manifest:a},a}r(_t,"ensureTransferManifest");async function He(t){const a=await _t(t),s=await E.importTransferCreate(a);if(s.alreadyCompleted)throw new Error(sn(s.company));const d=new Set(s.missingParts);let f=a.parts.length-d.size,m=a.parts.reduce((x,j)=>d.has(j.index)?x:x+j.byteSize,0);try{we({uploadedParts:f,totalParts:a.parts.length,uploadedBytes:m,totalBytes:a.totalBytes});for(const x of a.parts){if(!d.has(x.index))continue;const j=x.index*a.partSizeBytes,w=t.slice(j,j+x.byteSize);let z=null,A=!1;for(let te=0;te<3&&!A;te+=1)try{await E.importTransferUploadPart(s.transferId,x.index,w),A=!0}catch(J){z=J}if(!A)throw z instanceof Error?z:new Error(`Part ${x.index+1} of ${a.parts.length} failed to upload.`);f+=1,m+=x.byteSize,we({uploadedParts:f,totalParts:a.parts.length,uploadedBytes:m,totalBytes:a.totalBytes})}}finally{we(null)}return s.transferId}r(He,"uploadImportTransfer");const{data:ve}=re({queryKey:n?L.agents.list(n):["agents","none"],queryFn:r(()=>it.list(n),"queryFn"),enabled:!!n}),B=(0,h.useMemo)(()=>ve?ve.find(t=>t.role==="ceo")?.adapterType??oe:oe,[ve]),{data:ke}=re({queryKey:L.adapters.all,queryFn:r(()=>vn.list(),"queryFn"),staleTime:3e5}),O=(0,h.useMemo)(()=>ke?new Set(ke.filter(t=>!t.disabled).map(t=>t.type)):null,[ke]),{data:Ve}=re({queryKey:L.instance.experimentalSettings,queryFn:r(()=>hn.getExperimental(),"queryFn"),retry:!1}),Ge=O?.has("wardmote_runner")===!0,q=Ge&&Ve?.enableNativeRunner===!0,Z=Ge&&Ve?.enableOpenAiDot===!0,Ot=(0,h.useMemo)(()=>Vn.filter(t=>t.value==="wardmote_runner"?q:t.value==="openai_dot"?Z:!0),[q,Z]),Rt="Upload a .zip exported directly from Wardmote. Re-zipped archives created by Finder, Explorer, or other zip tools may not import correctly.";(0,h.useEffect)(()=>{o([{label:i?.name??"Company",href:"/dashboard"},{label:"Settings",href:"/company/settings"},{label:"Import"}])},[i?.name,o]);function Qe(){const t=N.trim();return t?{type:"github",url:t}:null}r(Qe,"buildGithubSource");function Ze(){return{include:{company:!0,agents:!0,projects:!0,issues:!0},target:H==="new"?{mode:"new_company",newCompanyName:Ee||null}:{mode:"existing_company",companyId:n},collisionStrategy:Me}}r(Ze,"buildImportMetaCommon");const D=(0,h.useRef)(0),P=st({mutationFn:r(async t=>{const a=Ze();if(y==="local"){if(!k)throw new Error("No source configured.");if(ut(k.file)){const d=await He(k.file);return E.importTransferPreview(d,a)}return E.importPreviewPackage(k.file,a)}const s=Qe();if(!s)throw new Error("No source configured.");return E.importPreview({source:s,...a})},"mutationFn"),onSuccess:r((t,a)=>{if(a!==D.current)return;_e(t);const s=mt(t),d=Kn(y,N,k?.name??null,k?.rootPath??null),f={};for(const A of s)A.action==="rename"&&d&&(f[A.slug]=Jn(d,A.originalName));ze(f),Fe(new Set),ue(new Set),Be({}),fe(new Set),xe({});const m=new Set(Object.keys(t.files));if(H==="existing"&&t.manifest.company&&t.plan.companyAction==="update"){const A=M(t.manifest.company.path);m.delete(A)}pe(m);const x=pt(t),j=ot(t.files,x),w=new Set;for(const A of j)A.kind==="dir"&&w.add(A.path);for(const[A,te]of x)if(te==="update"){const J=A.split("/").filter(Boolean);let ne="";for(let se=0;se<J.length-1;se++)ne=ne?`${ne}/${J[se]}`:J[se],w.add(ne)}Re(w);const z=Object.keys(t.files)[0];z&&Oe(z)},"onSuccess"),onError:r((t,a)=>{a===D.current&&p({tone:"error",title:"Preview failed",body:t instanceof Error?t.message:"Failed to preview import."})},"onError")});function zt(){if(!g)return;const t={};for(const[a,s]of Object.entries(V))s.trim()&&(t[a]=s.trim());return Object.keys(t).length>0?t:void 0}r(zt,"buildFinalNameOverrides");function Ft(){const t=Array.from(ce).sort();return t.length>0?t:void 0}r(Ft,"buildSelectedFiles");function Mt(){const t=y==="local"?k?.name??"package":N.trim()||"package";return zn(n??"unknown-company",t)}r(Mt,"currentImportJobStorageKey");const v=st({mutationFn:r(async t=>{if(t.resume)return ft(t.resume.jobId,t.resume.storageKey);const a={...Ze(),nameOverrides:zt(),selectedFiles:Ft(),adapterOverrides:Gt(),pauseAutomations:t.pauseAutomations},s=y==="local"?k?.file:null,d=y==="local"?null:Qe();if(y==="local"?!s:!d)throw new Error("No source configured.");const f=Mt();let m;try{if(s&&ut(s)){const x=await He(s);m=await E.importTransferApply(x,a)}else m=s?await E.importBundlePackageAsync(s,a):await E.importBundleAsync({source:d,...a})}catch(x){const j=Zn(x);if(!j)throw x;m=j}return Fn(f,{jobId:m.job.id,pauseAutomations:t.pauseAutomations}),ft(m.job.id,f)},"mutationFn"),onSuccess:r(async(t,{previewForImport:a,pauseAutomations:s})=>{if(ye(null),await u.invalidateQueries({queryKey:L.companies.all}),t.status==="completed-expired"){let x=null,j=null;if(t.companyId)try{const w=await E.get(t.companyId);l(w.id),x=w.name,j=`/${w.issuePrefix}/dashboard`}catch{}Ue({kind:"expired",companyName:x,dashboardPath:j,pausedAutomations:s}),p({tone:"success",title:"Import completed",body:"Open the organization to view it."});return}const d=t.result,f=await E.get(d.company.id),m=c?null:await u.fetchQuery({queryKey:L.auth.session,queryFn:r(()=>rt.getSession(),"queryFn")});await Wn(a,d,c??m?.user?.id??m?.session?.userId??null),l(f.id),qe(new Set(Ce(d).map(x=>x.key))),De(new Set),Ke({}),Ue({kind:"full",result:d,dashboardPath:`/${f.issuePrefix}/dashboard`,pausedAutomations:s})},"onSuccess"),onError:r(t=>{ye(null),p({tone:"error",title:"Import failed",body:t instanceof Error?t.message:"Failed to apply import."})},"onError")}),Ye=v.mutate;(0,h.useEffect)(()=>{if(We.current||!n)return;We.current=!0;const t=Mn(n);t&&(ye(t.jobId),Ye({previewForImport:null,pauseAutomations:t.pauseAutomations,resume:{jobId:t.jobId,storageKey:t.storageKey}}))},[n,Ye]);function R(){P.isPending||P.reset(),v.isPending||v.reset()}r(R,"resetMutationState");function K(){D.current+=1,_e(null),R()}r(K,"resetImportFlowState");async function Bt(t){const a=t.target.files;if(!(!a||a.length===0))try{const s=await Qn(a[0]);vt(s),K()}catch(s){p({tone:"error",title:"Package read failed",body:s instanceof Error?s.message:"Failed to read folder."})}}r(Bt,"handleChooseLocalPackage");const Ne=(0,h.useMemo)(()=>g?pt(g):new Map,[g]),Y=(0,h.useMemo)(()=>g?ot(g.files,Ne):[],[g,Ne]),$=(0,h.useMemo)(()=>g?mt(g):[],[g]),Xe=(0,h.useMemo)(()=>{const t=new Map;if(!g)return t;for(const a of $){if(!a.filePath||me.has(a.slug))continue;const s=V[a.slug]??a.plannedName;if(s===a.originalName)continue;const d=a.filePath.split("/").slice(0,-1).join("/");d&&t.set(d,s),t.set(a.filePath,s)}return t},[g,$,V,me]),et=(0,h.useMemo)(()=>An(Y),[Y]),X=ce.size;function $t(t){Re(a=>{const s=new Set(a);return s.has(t)?s.delete(t):s.add(t),s})}r($t,"handleToggleDir");function Lt(t,a){g&&(R(),pe(s=>{const d=new Set(s);if(a==="file")d.has(t)?d.delete(t):d.add(t);else{const f=r((x,j)=>{for(const w of x){if(w.path===j)return w;const z=f(w.children,j);if(z)return z}return null},"findNode"),m=f(Y,t);if(m){const x=kn(m.children,"file");for(const w of m.children)w.kind==="file"&&x.add(w.path);const j=[...x].every(w=>d.has(w));for(const w of x)j?d.delete(w):d.add(w)}}return d}))}r(Lt,"handleToggleCheck");function Ut(t,a){R(),ze(s=>({...s,[t]:a})),ue(s=>{if(!s.has(t))return s;const d=new Set(s);return d.delete(t),d})}r(Ut,"handleConflictRename");function qt(t){R(),ue(a=>{const s=new Set(a);return s.has(t)?s.delete(t):s.add(t),s})}r(qt,"handleConflictToggleConfirm");function Dt(t,a){R(),Fe(s=>{const d=new Set(s),f=d.has(t);return f?d.delete(t):d.add(t),a&&pe(m=>{const x=new Set(m);return f?x.add(a):x.delete(a),x}),d})}r(Dt,"handleConflictToggleSkip");function Kt(t,a){R(),Be(s=>({...s,[t]:a})),xe(s=>{const d={...s};return a==="openai_dot"||a==="wardmote_runner"?d[t]=Te(a):delete d[t],d}),a==="openai_dot"&&fe(s=>new Set([...s,t]))}r(Kt,"handleAdapterChange");function Jt(t){fe(a=>{const s=new Set(a);return s.has(t)?s.delete(t):s.add(t),s})}r(Jt,"handleAdapterToggleExpand");function Wt(t,a){R();const s=Se.find(f=>f.slug===t),d=s?tt(s):he[t]??oe;xe(f=>({...f,[t]:{...f[t]??Te(d,d===s?.adapterChoice?s.adapterConfig:void 0),...a}}))}r(Wt,"handleAdapterConfigChange");function Ht(t){qe(a=>{const s=new Set(a);return s.has(t)?s.delete(t):s.add(t),s})}r(Ht,"handleToggleActivationItem");async function Vt(){if(!S||S.kind!=="full"||G)return;Je(!0);const t=new Set(be),a={};for(const d of Ce(S.result))if(!(!ge.has(d.key)||t.has(d.key)))try{d.kind==="agent"?await it.resume(d.id):await bn.update(d.id,{status:"active"}),t.add(d.key)}catch(f){a[d.key]=f instanceof Error?f.message:"Activation failed."}De(t),Ke(a),Je(!1);const s=Object.keys(a).length;s>0&&p({tone:"error",title:"Some items were not activated",body:`${s} item${s===1?"":"s"} failed to activate; the rest were activated.`})}r(Vt,"handleActivateSelected");const Se=(0,h.useMemo)(()=>g?g.manifest.agents.map(t=>{const a=t.adapterType==="wardmote_runner"&&t.adapterConfig?.provider==="openai_dot"?"openai_dot":t.adapterType;let s=null;if(t.adapterType==="wardmote_runner"&&!(a==="openai_dot"?Z:q)){const d=O?[...O].find(f=>f!=="wardmote_runner")??null:null;s=B!=="wardmote_runner"&&(!O||O.has(B))?B:d??oe}else if(O&&!O.has(t.adapterType)){const d=[...O].filter(f=>f!=="wardmote_runner"||q);s=d.includes(B)?B:d[0]??null}return{slug:t.slug,name:t.name,adapterType:t.adapterType,adapterChoice:a,adapterConfig:t.adapterConfig??{},fallbackAdapterType:s}}):[],[g,O,B,q,Z]);function tt(t){return he[t.slug]??t.fallbackAdapterType??t.adapterChoice}r(tt,"effectiveAdapterType");function Gt(){const t={};for(const a of Se){const s=tt(a),d=$e[a.slug];if(s===a.adapterChoice&&!d)continue;const f=s==="openai_dot"?"wardmote_runner":s,m={adapterType:f};if(d){if(s==="openai_dot"&&d.adapterSchemaValues?.allowUnmeteredProvider!==!0)throw new Error("OpenAI Dot requires acknowledgement of external billing. Configure the Dot adapter and enable Allow externally billed provider.");m.adapterConfig=ln(f).buildAdapterConfig(d)}t[a.slug]=m}return Object.keys(t).length>0?t:void 0}r(Gt,"buildFinalAdapterOverrides");const nt=y==="local"?!!k:N.trim().length>0,Qt=g?g.errors.length>0:!1,ee=y==="local"?k?.compressedBytes??null:null,Zt=F&&g?g.files[F]??null:null,Yt=F?Ne.get(F)??null:null;if(S&&S.kind==="expired")return(0,e.jsxs)("div",{className:"max-w-6xl space-y-4 px-5 py-5",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-base font-semibold",children:"Import completed"}),(0,e.jsx)("p",{className:"text-xs text-ink-3 mt-1",children:S.companyName?(0,e.jsxs)(e.Fragment,{children:["The import finished and ",(0,e.jsx)("span",{className:"font-medium text-ink",children:S.companyName})," is ready. Its detailed summary is no longer available."]}):"The import finished and your organization is ready. Its detailed summary is no longer available, but the organization has been added — select it from the organization switcher to view it."}),S.pausedAutomations?(0,e.jsx)("p",{className:"text-xs text-ink-3 mt-1",children:"Imported agents arrived paused — resume them from the company's Agents page so assigned tasks can start."}):null]}),S.dashboardPath?(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,e.jsx)(U,{size:"sm",variant:"secondary","data-testid":"import-expired-open-company",onClick:r(()=>window.location.assign(S.dashboardPath),"onClick"),children:"Open organization dashboard"})}):null]});if(S){const{result:t,dashboardPath:a}=S,s=t.skills??[],d=S.pausedAutomations?Ce(t):[],f=d.filter(m=>ge.has(m.key)&&!be.has(m.key)).length;return(0,e.jsxs)("div",{className:"max-w-6xl space-y-4 px-5 py-5",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-base font-semibold",children:"Import complete"}),(0,e.jsxs)("p",{className:"text-xs text-ink-3 mt-1",children:[t.company.name,": ",t.agents.length," agent",t.agents.length===1?"":"s",","," ",s.length," skill",s.length===1?"":"s",","," ",t.projects.length," project",t.projects.length===1?"":"s",", and"," ",t.routines.length," routine",t.routines.length===1?"":"s"," processed."]})]}),s.length>0&&(0,e.jsxs)("div",{className:"rounded-md border border-line",children:[(0,e.jsx)("div",{className:"border-b border-line px-4 py-2.5",children:(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Skill import results"})}),(0,e.jsx)("div",{className:"divide-y divide-line",children:s.map(m=>(0,e.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5 text-sm",children:[(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:m.originalSlug}),(0,e.jsx)("span",{className:"shrink-0 text-xs text-ink-3",children:m.action}),m.slug!==m.originalSlug&&(0,e.jsxs)("span",{className:"shrink-0 text-xs text-ink-3",children:["as ",m.slug]})]},`${m.originalKey}:${m.id}`))})]}),t.warnings.length>0&&(0,e.jsx)("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3",children:t.warnings.map(m=>(0,e.jsx)("div",{className:"text-xs text-amber-500",children:m},m))}),d.length>0&&(0,e.jsxs)("div",{className:"rounded-md border border-line",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 border-b border-line px-4 py-2.5",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Activate imported agents and routines"}),(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"imported paused"})]}),(0,e.jsx)("div",{className:"divide-y divide-line",children:d.map(m=>{const x=be.has(m.key),j=Tt[m.key];return(0,e.jsxs)("label",{className:"flex items-center gap-3 px-4 py-2.5 text-sm",children:[(0,e.jsx)("input",{type:"checkbox",checked:ge.has(m.key),disabled:x||G,onChange:r(()=>Ht(m.key),"onChange"),className:"accent-ink"}),(0,e.jsx)(W,{variant:"outline",className:_("text-(length:--text-nano) uppercase tracking-wide",m.kind==="agent"?"text-blue-500 border-blue-500/30":"text-purple-500 border-purple-500/30"),children:m.kind}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:m.name}),x?(0,e.jsx)("span",{className:"shrink-0 text-xs text-emerald-500",children:"activated"}):j?(0,e.jsxs)("span",{className:"shrink-0 text-xs text-bad",children:["failed: ",j]}):(0,e.jsx)("span",{className:"shrink-0 text-xs text-ink-3",children:"paused"})]},m.key)})}),(0,e.jsx)("div",{className:"flex justify-end border-t border-line px-4 py-2.5",children:(0,e.jsx)(U,{size:"sm",onClick:r(()=>{Vt()},"onClick"),disabled:G||f===0,children:G?"Activating...":`Activate selected (${f})`})})]}),S.pausedAutomations?(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"Anything left paused here stays visible on the company's Agents and Routines pages, which offer the same resume actions — nothing is lost if you leave this page."}):null,(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,e.jsx)(U,{size:"sm",variant:"secondary",onClick:r(()=>window.location.assign(a),"onClick"),children:"Go to dashboard"})})]})}return Et?(0,e.jsxs)("div",{className:"max-w-6xl space-y-4 px-5 py-5",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-base font-semibold",children:"Resume watching import"}),(0,e.jsx)("p",{className:"text-xs text-ink-3 mt-1",children:"An import you started earlier is still running on the server."})]}),(0,e.jsxs)("div",{className:"flex items-start gap-2 rounded-md border border-line bg-bg-3/30 px-3 py-2.5",children:[(0,e.jsx)(Ae,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-ink-3"}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"Import running on the server — safe to keep waiting; reconnecting won't lose it."})]})]}):n?(0,e.jsxs)("div",{className:"max-w-6xl",children:[(0,e.jsxs)("div",{className:"border-b border-line px-5 py-5 space-y-4",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-base font-semibold",children:"Import source"}),(0,e.jsx)("p",{className:"text-xs text-ink-3 mt-1",children:"Choose a GitHub repo or upload a local Wardmote zip package."})]}),(0,e.jsx)("div",{className:"grid gap-2 md:grid-cols-2",children:[{key:"github",icon:yn,label:"GitHub repo"},{key:"local",icon:In,label:"Local zip"}].map(({key:t,icon:a,label:s})=>(0,e.jsx)("button",{type:"button",className:_("rounded-md border px-3 py-2 text-left text-sm transition-colors",y===t?"border-ink bg-bg-3":"border-line hover:bg-bg-3/50",v.isPending&&"cursor-not-allowed opacity-50"),disabled:v.isPending,onClick:r(()=>{T(t),K()},"onClick"),children:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(a,{className:"h-4 w-4"}),s]})},t))}),y==="local"?(0,e.jsxs)("div",{className:"rounded-md border border-dashed border-line px-3 py-3",children:[(0,e.jsx)("input",{ref:I,type:"file",accept:".zip,application/zip",className:"hidden",onChange:Bt}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(U,{size:"sm",variant:"secondary",onClick:r(()=>I.current?.click(),"onClick"),disabled:v.isPending,children:"Choose zip"}),k&&(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:[k.name," with"," ",Object.keys(k.files).length," file",Object.keys(k.files).length===1?"":"s",ee!==null?` (${le(ee)} zip)`:""]})]}),!k&&(0,e.jsx)("p",{className:"mt-2 text-xs text-ink-3",children:Rt})]}):(0,e.jsx)(ae,{label:"GitHub URL",hint:"Repo tree path or blob URL to COMPANY.md (e.g. github.com/owner/repo/tree/main/company).",children:(0,e.jsx)("input",{className:"w-full rounded-md border border-line bg-transparent px-2.5 py-1.5 text-sm outline-none",type:"text",value:N,placeholder:"https://github.com/owner/repo/tree/main/company",disabled:v.isPending,onChange:r(t=>{C(t.target.value),K()},"onChange")})}),(0,e.jsx)(ae,{label:"Target",hint:"Import into this organization or create a new one.",children:(0,e.jsxs)("select",{className:"w-full rounded-md border border-line bg-transparent px-2.5 py-1.5 text-sm outline-none",value:H,disabled:v.isPending,onChange:r(t=>{kt(t.target.value),K()},"onChange"),children:[(0,e.jsx)("option",{value:"new",children:"Create new organization"}),(0,e.jsxs)("option",{value:"existing",children:["Existing company: ",i?.name]})]})}),H==="new"&&(0,e.jsx)(ae,{label:"New organization name",hint:"Optional override. Leave blank to use the package name.",children:(0,e.jsx)("input",{className:"w-full rounded-md border border-line bg-transparent px-2.5 py-1.5 text-sm outline-none",type:"text",value:Ee,onChange:r(t=>{Nt(t.target.value),R()},"onChange"),placeholder:"Imported Organization"})}),(0,e.jsx)(ae,{label:"Collision strategy",hint:"Board imports can rename, skip, or replace matching organization content.",children:(0,e.jsxs)("select",{className:"w-full rounded-md border border-line bg-transparent px-2.5 py-1.5 text-sm outline-none",value:Me,disabled:v.isPending,onChange:r(t=>{It(t.target.value),K()},"onChange"),children:[(0,e.jsx)("option",{value:"rename",children:"Rename on conflict"}),(0,e.jsx)("option",{value:"skip",children:"Skip on conflict"}),(0,e.jsx)("option",{value:"replace",children:"Replace existing"})]})}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(U,{size:"sm",variant:"secondary",onClick:r(()=>P.mutate(D.current),"onClick"),disabled:P.isPending||v.isPending||!nt,children:P.isPending?"Previewing...":"Preview import"}),!nt&&!P.isPending&&(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"Choose a package above to enable the preview."}),v.isPending&&(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"Import in progress — the package and settings unlock when it finishes."})]}),P.isPending&&(0,e.jsxs)("div",{className:"mt-3 flex items-start gap-2 rounded-md border border-line bg-bg-3/30 px-3 py-2.5",children:[(0,e.jsx)(Ae,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-ink-3"}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:Q?`${ht(Q)} An interrupted upload resumes from the finished parts.`:`Uploading and analyzing your package${ee!==null?` (${le(ee)} zip)`:""} — large packages can take a few minutes. Keep this page open.`})]}),P.isError&&!P.isPending&&P.variables===D.current&&(0,e.jsx)("div",{className:"mt-3 rounded-md border border-bad/40 bg-bad/5 px-3 py-2.5",children:(0,e.jsxs)("p",{className:"text-xs text-bad",children:["Preview failed:"," ",P.error instanceof Error?P.error.message:"the request did not complete."," ","Retry, or re-export the package without large attachments to shrink it."]})})]}),g&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"sticky top-0 z-10 border-b border-line bg-bg px-5 py-3",children:(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-4 text-sm",children:[(0,e.jsx)("span",{className:"font-medium",children:"Import preview"}),(0,e.jsxs)("span",{className:"text-ink-3",children:[X," / ",et," file",et===1?"":"s"," selected"]}),$.length>0&&(0,e.jsxs)("span",{className:"text-amber-500",children:[$.length," conflict",$.length===1?"":"s"]}),g.errors.length>0&&(0,e.jsxs)("span",{className:"text-bad",children:[g.errors.length," error",g.errors.length===1?"":"s"]})]})}),(0,e.jsx)(Hn,{conflicts:$,nameOverrides:V,skippedSlugs:me,confirmedSlugs:At,onRename:Ut,onToggleSkip:Dt,onToggleConfirm:qt}),(0,e.jsx)(Gn,{agents:Se,adapterOptions:Ot,adapterOverrides:he,expandedSlugs:Ct,configValues:$e,onChangeAdapter:Kt,onToggleExpand:Jt,onChangeConfig:Wt}),(0,e.jsxs)("div",{className:"mx-5 mt-3 flex flex-wrap items-center justify-end gap-3",children:[(0,e.jsxs)("label",{className:"flex items-center gap-2 text-xs text-ink-3",children:[(0,e.jsx)("input",{type:"checkbox",checked:Le,onChange:r(t=>{Pt(t.target.checked),R()},"onChange"),className:"accent-ink"}),"Start imported agents and routines paused"]}),(0,e.jsxs)(U,{size:"sm",onClick:r(()=>v.mutate({previewForImport:g,pauseAutomations:Le}),"onClick"),disabled:v.isPending||Qt||X===0,children:[(0,e.jsx)(lt,{className:"mr-1.5 h-3.5 w-3.5"}),v.isPending?"Importing...":`Import ${X} file${X===1?"":"s"}`]})]}),v.isPending&&(0,e.jsxs)("div",{className:"mx-5 mt-3 flex items-start gap-2 rounded-md border border-line bg-bg-3/30 px-3 py-2.5",children:[(0,e.jsx)(Ae,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-ink-3"}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:Q?`${ht(Q)} An interrupted upload resumes from the finished parts.`:"Import running on the server — safe to keep waiting; reconnecting won't lose it. Large packages can take several minutes."})]}),v.isError&&!v.isPending&&(0,e.jsx)("div",{className:"mx-5 mt-3 rounded-md border border-bad/40 bg-bad/5 px-3 py-2.5",children:(0,e.jsxs)("p",{className:"text-xs text-bad",children:["Import failed:"," ",v.error instanceof Error?v.error.message:"the request did not complete."," ","Nothing may have been created, or the import stopped partway — check the target company before retrying."]})}),g.warnings.length>0&&(0,e.jsx)("div",{className:"mx-5 mt-3 rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3",children:g.warnings.map(t=>(0,e.jsx)("div",{className:"text-xs text-amber-500",children:t},t))}),g.errors.length>0&&(0,e.jsx)("div",{className:"mx-5 mt-3 rounded-md border border-bad/30 bg-bad/5 px-4 py-3",children:g.errors.map(t=>(0,e.jsx)("div",{className:"text-xs text-bad",children:t},t))}),(0,e.jsxs)("div",{className:"grid gap-4 xl:h-(--sz-calc-31) xl:grid-cols-(--gtc-25) xl:gap-0",children:[(0,e.jsxs)("aside",{className:"flex max-h-(--sz-24rem) flex-col overflow-hidden border-b border-line xl:max-h-none xl:border-b-0 xl:border-r",children:[(0,e.jsx)("div",{className:"border-b border-line px-4 py-3 shrink-0",children:(0,e.jsx)("h2",{className:"text-base font-semibold",children:"Package files"})}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,e.jsx)(Sn,{nodes:Y,selectedFile:F,expandedDirs:St,checkedFiles:ce,onToggleDir:$t,onSelectFile:Oe,onToggleCheck:Lt,renderFileExtra:r((t,a)=>Un(t,a,Xe),"renderFileExtra"),fileRowClassName:qn,wrapLabels:!1})})]}),(0,e.jsx)("div",{className:"min-w-0 overflow-y-auto xl:pl-6",children:(0,e.jsx)(Dn,{selectedFile:F,content:Zt,allFiles:g?.files??{},action:Yt,renamedTo:F?Xe.get(F)??null:null})})]})]})]}):(0,e.jsx)(jt,{icon:lt,message:"Select an organization to import into."})}r(Is,"CompanyImport");export{Is as CompanyImport};
|
|
1
|
+
var Xt=Object.defineProperty;var r=(n,i)=>Xt(n,"name",{value:i,configurable:!0});import{i as xt}from"./rolldown-runtime-ZpX3ckPj.js";import{l as _,na as en,ta as tn}from"./createLucideIcon-DJi9suAC.js";import{X as nn,_ as st,n as Pe,t as L,v as re}from"./queryKeys-DYV5MhM_.js";import{d as sn,o as rt,u as E}from"./companies-query-D9PxIiMT.js";import{N as rn,T as an,_ as on,w as ln}from"./ConnectionSetupFlow-DKjP5RBZ.js";import{n as dn}from"./CompanyContext-CSrVsSze.js";import{t as gt}from"./arrow-right-BL5kYtCZ.js";import{t as cn}from"./check-Ctsrlfa-.js";import{t as pn}from"./chevron-right-s7L6hXXq.js";import{t as at}from"./MarkdownBody-BTjuUgFa.js";import{t as mn}from"./package-CYC5MDhY.js";import{r as Ae,t as U}from"./button-CMwV3L1P.js";import{t as W}from"./badge-DuA2EgZC.js";import{a as un}from"./ToastContext-DMdt9oTd.js";import{t as it}from"./agents-DmlgUVso.js";import{t as hn}from"./instanceSettings-D8g_QlS-.js";import{c as fn,r as xn}from"./agent-order-BE-pAWdx.js";import{t as gn}from"./sidebarPreferences-vEHBC54I.js";import{t as bn}from"./routines-KPtwxuS7.js";import{t as yn}from"./github-icon-Bbgf67tg.js";import{n as jn}from"./BreadcrumbContext-BVZDZoC0.js";import{t as wn}from"./chip-DsDe6yck.js";import{n as bt}from"./adapter-display-registry-Bk0KWAHT.js";import{a as ae,c as yt}from"./agent-config-primitives-BsZUnbf2.js";import{t as vn}from"./adapters-Dp0USyWg.js";import{$ as kn,Q as ot,Ra as lt,T as jt,X as Nn,Z as Sn,et as An,ga as In,tt as Cn}from"./index-DDoARkPG.js";import{n as Pn,o as Tn,r as En,t as dt}from"./portable-files-CloN_vbk.js";var h=xt(en(),1),As=new TextEncoder;function le(n){return`${Math.max(1,Math.round(n/1048576))} MB`}r(le,"formatMegabytes");var _n=50331648,Ie=33554432;async function ct(n){const i=await crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(i),l=>l.toString(16).padStart(2,"0")).join("")}r(ct,"sha256Hex");async function On(n){const i=await ct(n),l=[];for(let o=0;o<n.byteLength;o+=Ie){const p=Math.min(Ie,n.byteLength-o);l.push({index:l.length,byteSize:p,sha256:await ct(new Uint8Array(n,o,p))})}return{totalBytes:n.byteLength,zipSha256:i,partSizeBytes:Ie,parts:l}}r(On,"buildImportTransferManifest");var Rn=3e3,wt="wardmote:company-import-job";function zn(n,i){return`${wt}:${n}:${i}`}r(zn,"importJobStorageKey");function Fn(n,i){try{sessionStorage.setItem(n,JSON.stringify(i))}catch{}}r(Fn,"writeStoredImportJob");function ie(n){try{sessionStorage.removeItem(n)}catch{}}r(ie,"clearStoredImportJob");function Mn(n){try{const i=`${wt}:${n}:`;for(let l=0;l<sessionStorage.length;l+=1){const o=sessionStorage.key(l);if(!o||!o.startsWith(i))continue;const p=sessionStorage.getItem(o);if(p)try{const u=JSON.parse(p);if(typeof u=="object"&&u!==null&&typeof u.jobId=="string")return{jobId:u.jobId,pauseAutomations:u.pauseAutomations===!0,storageKey:o}}catch{}sessionStorage.removeItem(o),l-=1}}catch{}return null}r(Mn,"readStoredImportJob");function Bn(n){return new Promise(i=>setTimeout(i,n))}r(Bn,"sleep");async function $n(n=Rn){do await Bn(n);while(typeof document<"u"&&document.hidden)}r($n,"waitForNextImportJobPoll");var e=xt(tn(),1);function pt(n){const i=new Map,l=n.manifest;for(const o of n.plan.agentPlans){const p=l.agents.find(u=>u.slug===o.slug);if(p){const u=M(p.path);i.set(u,o.action)}}for(const o of n.plan.projectPlans){const p=l.projects.find(u=>u.slug===o.slug);if(p){const u=M(p.path);i.set(u,o.action)}}for(const o of n.plan.issuePlans){const p=l.issues.find(u=>u.slug===o.slug);if(p){const u=M(p.path);i.set(u,o.action)}}for(const o of l.skills){const p=M(o.path);i.set(p,"create");for(const u of o.fileInventory)n.files[u.path]&&i.set(u.path,"create")}if(l.company){const o=M(l.company.path);i.set(o,n.plan.companyAction==="none"?"skip":n.plan.companyAction)}return i}r(pt,"buildActionMap");function M(n){return n.endsWith(".md")?n:`${n}.md`}r(M,"ensureMarkdownPath");var de={create:"text-emerald-500 border-emerald-500/30",update:"text-amber-500 border-amber-500/30",overwrite:"text-red-500 border-red-500/30",replace:"text-red-500 border-red-500/30",skip:"text-ink-3 border-line",none:"text-ink-3 border-line"};function Ln({data:n}){return(0,e.jsx)("div",{className:"rounded-md border border-line bg-bg-3/20 px-4 py-3 mb-4",children:(0,e.jsx)("dl",{className:"grid grid-cols-(--gtc-5) gap-x-4 gap-y-1.5 text-sm",children:Object.entries(n).map(([i,l])=>(0,e.jsxs)("div",{className:"contents",children:[(0,e.jsx)("dt",{className:"text-ink-3 whitespace-nowrap py-0.5",children:Nn[i]??i}),(0,e.jsx)("dd",{className:"py-0.5",children:Array.isArray(l)?(0,e.jsx)("div",{className:"flex flex-wrap gap-1.5",children:l.map(o=>(0,e.jsx)("span",{className:"inline-flex items-center rounded-md border border-line bg-bg px-2 py-0.5 text-xs",children:o},o))}):(0,e.jsx)("span",{children:l})})]},i))})})}r(Ln,"FrontmatterCard");function Un(n,i,l){const o=n.kind==="dir"?l.get(n.path):void 0,p=n.action?(0,e.jsx)(W,{variant:"outline",className:_("text-(length:--text-nano) uppercase tracking-wide",de[n.action]??de.skip),children:i?n.action:"skip"}):null;return!p&&!o?null:(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5 shrink-0",children:[o&&i&&(0,e.jsxs)("span",{className:"text-(length:--text-nano) text-cyan-500 font-mono truncate max-w-(--sz-7rem)",title:o,children:["→ ",o]}),p]})}r(Un,"renderImportFileExtra");function qn(n,i){return i?void 0:"opacity-50"}r(qn,"importFileRowClassName");function Dn({selectedFile:n,content:i,allFiles:l,action:o,renamedTo:p}){if(!n||i===null)return(0,e.jsx)(jt,{icon:mn,message:"Select a file to preview its contents."});const u=Pn(i),I=n.endsWith(".md")&&u!==null,b=I&&u?Cn(u):null,c=En(n,i)?dt(n,i):null,y=o?de[o]??de.skip:"",T=I?N=>{if(/^(?:https?:|data:)/i.test(N))return null;const C=(n.includes("/")?n.slice(0,n.lastIndexOf("/")+1):"")+N,k=l[C]??l[N];return k?dt(C in l?C:N,k):null}:void 0;return(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"border-b border-line px-5 py-3",children:(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0 flex items-center gap-2",children:[(0,e.jsx)("span",{className:"truncate font-mono text-sm",children:n}),p&&(0,e.jsxs)("span",{className:"shrink-0 font-mono text-sm text-cyan-500",children:["→ ",p]})]}),o&&(0,e.jsx)(W,{variant:"outline",className:_("uppercase tracking-wide",y),children:o})]})}),(0,e.jsx)("div",{className:"min-h-(--sz-560px) px-5 py-5",children:b?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Ln,{data:b.data}),b.body.trim()&&(0,e.jsx)(at,{resolveImageSrc:T,softBreaks:!1,linkIssueReferences:!1,children:b.body})]}):I?(0,e.jsx)(at,{resolveImageSrc:T,softBreaks:!1,linkIssueReferences:!1,children:u??""}):c?(0,e.jsx)("div",{className:"flex min-h-(--sz-520px) items-center justify-center rounded-lg border border-line bg-bg-3/10 p-6",children:(0,e.jsx)("img",{src:c,alt:n,className:"max-h-(--sz-480px) max-w-full object-contain"})}):u!==null?(0,e.jsx)("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words border-0 bg-transparent p-0 font-mono text-sm text-ink",children:(0,e.jsx)("code",{children:u})}):(0,e.jsx)("div",{className:"rounded-lg border border-line bg-bg-3/10 px-4 py-3 text-sm text-ink-3",children:"Binary asset preview is not available for this file type."})})]})}r(Dn,"ImportPreviewPane");function mt(n){const i=[],l=n.manifest;for(const o of n.plan.agentPlans)if(o.existingAgentId){const p=l.agents.find(u=>u.slug===o.slug);i.push({slug:o.slug,kind:"agent",originalName:p?.name??o.slug,plannedName:o.plannedName,filePath:p?M(p.path):null,action:o.action==="update"?"update":"rename"})}for(const o of n.plan.projectPlans)if(o.existingProjectId){const p=l.projects.find(u=>u.slug===o.slug);i.push({slug:o.slug,kind:"project",originalName:p?.name??o.slug,plannedName:o.plannedName,filePath:p?M(p.path):null,action:o.action==="update"?"update":"rename"})}return i}r(mt,"buildConflictList");function Kn(n,i,l,o){if(n==="local")return o?o.split("/").pop()??null:l&&l.replace(/\.zip$/i,"")||null;if(n==="github"){const p=i.trim();if(!p)return null;try{const u=new URL(p.startsWith("http")?p:`https://${p}`).pathname.split("/").filter(Boolean);return u.length>0?u[u.length-1]:null}catch{return null}}return null}r(Kn,"deriveSourcePrefix");function Jn(n,i){return n?`${n}-${i}`:i}r(Jn,"prefixedName");async function Wn(n,i,l){const o=n?.manifest.sidebar;if(!o||!l?.trim())return;const p=new Map(i.agents.filter(c=>typeof c.id=="string"&&c.id.length>0).map(c=>[c.slug,c.id])),u=new Map(i.projects.filter(c=>typeof c.id=="string"&&c.id.length>0).map(c=>[c.slug,c.id])),I=o.agents.map(c=>p.get(c)).filter(c=>!!c),b=o.projects.map(c=>u.get(c)).filter(c=>!!c);I.length>0&&fn(xn(i.company.id,l),I),b.length>0&&await gn.updateProjectOrder(i.company.id,{orderedIds:b})}r(Wn,"applyImportedSidebarOrder");function Ce(n){const i=[];for(const l of n.agents)!l.id||l.action==="skipped"||i.push({key:`agent:${l.id}`,kind:"agent",id:l.id,name:l.name});for(const l of n.routines)l.id&&i.push({key:`routine:${l.id}`,kind:"routine",id:l.id,name:l.title});return i}r(Ce,"buildActivationItems");function Hn({conflicts:n,nameOverrides:i,skippedSlugs:l,confirmedSlugs:o,onRename:p,onToggleSkip:u,onToggleConfirm:I}){return n.length===0?null:(0,e.jsx)("div",{className:"mx-5 mt-3",children:(0,e.jsxs)("div",{className:"rounded-md border border-line",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 border-b border-line px-4 py-2.5",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Renames"}),(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:[n.length," item",n.length===1?"":"s"]})]}),(0,e.jsx)("div",{className:"divide-y divide-line",children:n.map(b=>{const c=l.has(b.slug),y=o.has(b.slug),T=i[b.slug]??b.plannedName;return(0,e.jsxs)("div",{className:_("flex items-center gap-3 px-4 py-2.5 text-sm",c&&"opacity-40",y&&!c&&"bg-emerald-500/5"),children:[(0,e.jsx)("button",{type:"button",className:_("shrink-0 rounded-md border px-2.5 py-1 text-xs transition-colors",c?"border-ink bg-bg-3 text-ink":"border-line text-ink-3 hover:bg-bg-3/50"),onClick:r(()=>u(b.slug,b.filePath),"onClick"),children:c?"skipped":"skip"}),(0,e.jsx)(W,{variant:"outline",className:_("text-(length:--text-nano) uppercase tracking-wide",c?"text-ink-3 border-line":y?"text-emerald-500 border-emerald-500/30":"text-amber-500 border-amber-500/30"),children:b.kind}),(0,e.jsx)("span",{className:_("shrink-0 font-mono text-xs",c?"text-ink-3 line-through":"text-ink-3"),children:b.originalName}),!c&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(gt,{className:"h-3 w-3 shrink-0 text-ink-3"}),y?(0,e.jsx)("span",{className:"min-w-0 flex-1 font-mono text-xs text-emerald-500",children:T}):(0,e.jsx)("input",{className:"min-w-0 flex-1 rounded-md border border-line bg-transparent px-2 py-1 font-mono text-xs outline-none focus:border-ink",value:T,onChange:r(N=>p(b.slug,N.target.value),"onChange")})]}),!c&&(0,e.jsx)(wn,{selected:y,className:"ml-auto shrink-0",onClick:r(()=>I(b.slug),"onClick"),children:y?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(cn,{className:"h-3 w-3"}),"confirmed"]}):"confirm rename"})]},b.slug)})})]})})}r(Hn,"ConflictResolutionList");var oe="omp_local",Vn=[...an().map(n=>({value:n.type,label:yt[n.type]??bt(n.type)})),{value:"openai_dot",label:"OpenAI Dot (beta)"}];function Te(n,i){return{...rn,adapterType:n==="openai_dot"?"wardmote_runner":n,...n==="openai_dot"?{adapterSchemaValues:{provider:"openai_dot",allowUnmeteredProvider:i?.allowUnmeteredProvider===!0,dotAttachmentAccess:i?.dotAttachmentAccess===!0,dotWorkspaceAccess:i?.dotWorkspaceAccess===!0}}:{}}}r(Te,"importAdapterValues");function Gn({agents:n,adapterOptions:i,adapterOverrides:l,expandedSlugs:o,configValues:p,onChangeAdapter:u,onToggleExpand:I,onChangeConfig:b}){return n.length===0?null:(0,e.jsx)("div",{className:"mx-5 mt-3",children:(0,e.jsxs)("div",{className:"rounded-md border border-line",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 border-b border-line px-4 py-2.5",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Adapters"}),(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:[n.length," agent",n.length===1?"":"s"]})]}),(0,e.jsx)("div",{className:"divide-y divide-line",children:n.map(c=>{const y=l[c.slug]??c.fallbackAdapterType??c.adapterChoice,T=o.has(c.slug),N=p[c.slug]??Te(y,y===c.adapterChoice?c.adapterConfig:void 0);return(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5 text-sm",children:[(0,e.jsx)(W,{variant:"outline",className:_("text-(length:--text-nano) uppercase tracking-wide","text-blue-500 border-blue-500/30"),children:"agent"}),(0,e.jsx)("span",{className:"shrink-0 font-mono text-xs text-ink-3",children:c.name}),(0,e.jsx)(gt,{className:"h-3 w-3 shrink-0 text-ink-3"}),(0,e.jsx)("select",{className:"min-w-0 flex-1 rounded-md border border-line bg-transparent px-2 py-1 text-xs outline-none focus:border-ink",value:y,onChange:r(C=>u(c.slug,C.target.value),"onChange"),children:i.map(C=>(0,e.jsx)("option",{value:C.value,children:C.label},C.value))}),(0,e.jsxs)("button",{type:"button",className:_("ml-auto shrink-0 rounded-md border px-2.5 py-1 text-xs transition-colors inline-flex items-center gap-1.5",T?"border-ink bg-bg-3 text-ink":"border-line text-ink-3 hover:bg-bg-3/50"),onClick:r(()=>I(c.slug),"onClick"),children:[(0,e.jsx)(pn,{className:_("h-3 w-3 transition-transform",T&&"rotate-90")}),"configure adapter"]})]}),c.fallbackAdapterType&&(0,e.jsx)("div",{className:"mx-4 mb-2.5 rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2",children:(0,e.jsxs)("p",{className:"text-xs text-amber-500",children:["source adapter ",c.adapterChoice==="openai_dot"?"OpenAI Dot":c.adapterType," is not installed here — this agent will use ",yt[y]??bt(y)]})}),T&&(0,e.jsx)("div",{className:"border-t border-line bg-bg-3/10 px-4 py-3 space-y-3",children:(0,e.jsx)(on,{mode:"create",values:N,onChange:r(C=>b(c.slug,C),"onChange"),showAdapterTypeField:!1,showAdapterTestEnvironmentButton:!1,showCreateRunPolicySection:!1,hideInstructionsFile:!0,sectionLayout:"cards"})})]},c.slug)})})]})})}r(Gn,"AdapterPickerList");async function Qn(n){if(!/\.zip$/i.test(n.name))throw new Error("Select a .zip organization package.");const i=await Tn(await n.arrayBuffer());if(Object.keys(i.files).length===0)throw new Error("No package files were found in the selected zip archive.");return{name:n.name,file:n,compressedBytes:n.size,rootPath:i.rootPath,files:i.files}}r(Qn,"readLocalPackageZip");function ut(n){return n.size>_n}r(ut,"usesChunkedTransfer");function ht(n){return`Uploading part ${Math.min(n.uploadedParts+1,n.totalParts)} of ${n.totalParts} — ${le(n.uploadedBytes)} of ${le(n.totalBytes)} uploaded.`}r(ht,"formatTransferProgress");function Zn(n){if(!(n instanceof Pe)||n.status!==409)return null;const i=n.body,l=i?.job?.id;return typeof l!="string"||l.length===0?null:{job:{id:l,status:"running"},statusUrl:typeof i?.statusUrl=="string"?i.statusUrl:`/companies/import/jobs/${l}`}}r(Zn,"runningImportJobFromError");async function ft(n,i){for(;;){let l=null;try{l=(await E.getImportJob(n)).job}catch(o){if(o instanceof Pe&&o.status===404)throw ie(i),new Error("The server no longer reports this import job — it may have restarted while the import ran.");if(o instanceof Pe&&o.status>=400&&o.status<500&&o.status!==429)throw ie(i),new Error("The import status can no longer be read — your session may have expired. Reload and sign in to check on it.")}if(l?.status==="succeeded")return ie(i),l.importResult?{status:"completed",result:l.importResult}:{status:"completed-expired",companyId:l.result?.companyId??null};if(l?.status==="failed")throw ie(i),new Error(l.error?.message??"Import failed on the server.");await $n()}}r(ft,"watchImportJob");function Is(){const{selectedCompanyId:n,selectedCompany:i,setSelectedCompanyId:l}=dn(),{setBreadcrumbs:o}=jn(),{pushToast:p}=un(),u=nn(),I=(0,h.useRef)(null),{data:b}=re({queryKey:L.auth.session,queryFn:r(()=>rt.getSession(),"queryFn")}),c=b?.user?.id??b?.session?.userId??null,[y,T]=(0,h.useState)("github"),[N,C]=(0,h.useState)(""),[k,vt]=(0,h.useState)(null),[H,kt]=(0,h.useState)("new"),[Ee,Nt]=(0,h.useState)(""),[g,_e]=(0,h.useState)(null),[F,Oe]=(0,h.useState)(null),[St,Re]=(0,h.useState)(new Set),[ce,pe]=(0,h.useState)(new Set),[V,ze]=(0,h.useState)({}),[me,Fe]=(0,h.useState)(new Set),[At,ue]=(0,h.useState)(new Set),[Me,It]=(0,h.useState)("rename"),[he,Be]=(0,h.useState)({}),[Ct,fe]=(0,h.useState)(new Set),[$e,xe]=(0,h.useState)({}),[Le,Pt]=(0,h.useState)(!0),[S,Ue]=(0,h.useState)(null),[ge,qe]=(0,h.useState)(new Set),[be,De]=(0,h.useState)(new Set),[Tt,Ke]=(0,h.useState)({}),[G,Je]=(0,h.useState)(!1),[Et,ye]=(0,h.useState)(null),We=(0,h.useRef)(!1),je=(0,h.useRef)(null),[Q,we]=(0,h.useState)(null);async function _t(t){if(je.current?.file===t)return je.current.manifest;const a=await On(await t.arrayBuffer());return je.current={file:t,manifest:a},a}r(_t,"ensureTransferManifest");async function He(t){const a=await _t(t),s=await E.importTransferCreate(a);if(s.alreadyCompleted)throw new Error(sn(s.company));const d=new Set(s.missingParts);let f=a.parts.length-d.size,m=a.parts.reduce((x,j)=>d.has(j.index)?x:x+j.byteSize,0);try{we({uploadedParts:f,totalParts:a.parts.length,uploadedBytes:m,totalBytes:a.totalBytes});for(const x of a.parts){if(!d.has(x.index))continue;const j=x.index*a.partSizeBytes,w=t.slice(j,j+x.byteSize);let z=null,A=!1;for(let te=0;te<3&&!A;te+=1)try{await E.importTransferUploadPart(s.transferId,x.index,w),A=!0}catch(J){z=J}if(!A)throw z instanceof Error?z:new Error(`Part ${x.index+1} of ${a.parts.length} failed to upload.`);f+=1,m+=x.byteSize,we({uploadedParts:f,totalParts:a.parts.length,uploadedBytes:m,totalBytes:a.totalBytes})}}finally{we(null)}return s.transferId}r(He,"uploadImportTransfer");const{data:ve}=re({queryKey:n?L.agents.list(n):["agents","none"],queryFn:r(()=>it.list(n),"queryFn"),enabled:!!n}),B=(0,h.useMemo)(()=>ve?ve.find(t=>t.role==="ceo")?.adapterType??oe:oe,[ve]),{data:ke}=re({queryKey:L.adapters.all,queryFn:r(()=>vn.list(),"queryFn"),staleTime:3e5}),O=(0,h.useMemo)(()=>ke?new Set(ke.filter(t=>!t.disabled).map(t=>t.type)):null,[ke]),{data:Ve}=re({queryKey:L.instance.experimentalSettings,queryFn:r(()=>hn.getExperimental(),"queryFn"),retry:!1}),Ge=O?.has("wardmote_runner")===!0,q=Ge&&Ve?.enableNativeRunner===!0,Z=Ge&&Ve?.enableOpenAiDot===!0,Ot=(0,h.useMemo)(()=>Vn.filter(t=>t.value==="wardmote_runner"?q:t.value==="openai_dot"?Z:!0),[q,Z]),Rt="Upload a .zip exported directly from Wardmote. Re-zipped archives created by Finder, Explorer, or other zip tools may not import correctly.";(0,h.useEffect)(()=>{o([{label:i?.name??"Company",href:"/dashboard"},{label:"Settings",href:"/company/settings"},{label:"Import"}])},[i?.name,o]);function Qe(){const t=N.trim();return t?{type:"github",url:t}:null}r(Qe,"buildGithubSource");function Ze(){return{include:{company:!0,agents:!0,projects:!0,issues:!0},target:H==="new"?{mode:"new_company",newCompanyName:Ee||null}:{mode:"existing_company",companyId:n},collisionStrategy:Me}}r(Ze,"buildImportMetaCommon");const D=(0,h.useRef)(0),P=st({mutationFn:r(async t=>{const a=Ze();if(y==="local"){if(!k)throw new Error("No source configured.");if(ut(k.file)){const d=await He(k.file);return E.importTransferPreview(d,a)}return E.importPreviewPackage(k.file,a)}const s=Qe();if(!s)throw new Error("No source configured.");return E.importPreview({source:s,...a})},"mutationFn"),onSuccess:r((t,a)=>{if(a!==D.current)return;_e(t);const s=mt(t),d=Kn(y,N,k?.name??null,k?.rootPath??null),f={};for(const A of s)A.action==="rename"&&d&&(f[A.slug]=Jn(d,A.originalName));ze(f),Fe(new Set),ue(new Set),Be({}),fe(new Set),xe({});const m=new Set(Object.keys(t.files));if(H==="existing"&&t.manifest.company&&t.plan.companyAction==="update"){const A=M(t.manifest.company.path);m.delete(A)}pe(m);const x=pt(t),j=ot(t.files,x),w=new Set;for(const A of j)A.kind==="dir"&&w.add(A.path);for(const[A,te]of x)if(te==="update"){const J=A.split("/").filter(Boolean);let ne="";for(let se=0;se<J.length-1;se++)ne=ne?`${ne}/${J[se]}`:J[se],w.add(ne)}Re(w);const z=Object.keys(t.files)[0];z&&Oe(z)},"onSuccess"),onError:r((t,a)=>{a===D.current&&p({tone:"error",title:"Preview failed",body:t instanceof Error?t.message:"Failed to preview import."})},"onError")});function zt(){if(!g)return;const t={};for(const[a,s]of Object.entries(V))s.trim()&&(t[a]=s.trim());return Object.keys(t).length>0?t:void 0}r(zt,"buildFinalNameOverrides");function Ft(){const t=Array.from(ce).sort();return t.length>0?t:void 0}r(Ft,"buildSelectedFiles");function Mt(){const t=y==="local"?k?.name??"package":N.trim()||"package";return zn(n??"unknown-company",t)}r(Mt,"currentImportJobStorageKey");const v=st({mutationFn:r(async t=>{if(t.resume)return ft(t.resume.jobId,t.resume.storageKey);const a={...Ze(),nameOverrides:zt(),selectedFiles:Ft(),adapterOverrides:Gt(),pauseAutomations:t.pauseAutomations},s=y==="local"?k?.file:null,d=y==="local"?null:Qe();if(y==="local"?!s:!d)throw new Error("No source configured.");const f=Mt();let m;try{if(s&&ut(s)){const x=await He(s);m=await E.importTransferApply(x,a)}else m=s?await E.importBundlePackageAsync(s,a):await E.importBundleAsync({source:d,...a})}catch(x){const j=Zn(x);if(!j)throw x;m=j}return Fn(f,{jobId:m.job.id,pauseAutomations:t.pauseAutomations}),ft(m.job.id,f)},"mutationFn"),onSuccess:r(async(t,{previewForImport:a,pauseAutomations:s})=>{if(ye(null),await u.invalidateQueries({queryKey:L.companies.all}),t.status==="completed-expired"){let x=null,j=null;if(t.companyId)try{const w=await E.get(t.companyId);l(w.id),x=w.name,j=`/${w.issuePrefix}/dashboard`}catch{}Ue({kind:"expired",companyName:x,dashboardPath:j,pausedAutomations:s}),p({tone:"success",title:"Import completed",body:"Open the organization to view it."});return}const d=t.result,f=await E.get(d.company.id),m=c?null:await u.fetchQuery({queryKey:L.auth.session,queryFn:r(()=>rt.getSession(),"queryFn")});await Wn(a,d,c??m?.user?.id??m?.session?.userId??null),l(f.id),qe(new Set(Ce(d).map(x=>x.key))),De(new Set),Ke({}),Ue({kind:"full",result:d,dashboardPath:`/${f.issuePrefix}/dashboard`,pausedAutomations:s})},"onSuccess"),onError:r(t=>{ye(null),p({tone:"error",title:"Import failed",body:t instanceof Error?t.message:"Failed to apply import."})},"onError")}),Ye=v.mutate;(0,h.useEffect)(()=>{if(We.current||!n)return;We.current=!0;const t=Mn(n);t&&(ye(t.jobId),Ye({previewForImport:null,pauseAutomations:t.pauseAutomations,resume:{jobId:t.jobId,storageKey:t.storageKey}}))},[n,Ye]);function R(){P.isPending||P.reset(),v.isPending||v.reset()}r(R,"resetMutationState");function K(){D.current+=1,_e(null),R()}r(K,"resetImportFlowState");async function Bt(t){const a=t.target.files;if(!(!a||a.length===0))try{const s=await Qn(a[0]);vt(s),K()}catch(s){p({tone:"error",title:"Package read failed",body:s instanceof Error?s.message:"Failed to read folder."})}}r(Bt,"handleChooseLocalPackage");const Ne=(0,h.useMemo)(()=>g?pt(g):new Map,[g]),Y=(0,h.useMemo)(()=>g?ot(g.files,Ne):[],[g,Ne]),$=(0,h.useMemo)(()=>g?mt(g):[],[g]),Xe=(0,h.useMemo)(()=>{const t=new Map;if(!g)return t;for(const a of $){if(!a.filePath||me.has(a.slug))continue;const s=V[a.slug]??a.plannedName;if(s===a.originalName)continue;const d=a.filePath.split("/").slice(0,-1).join("/");d&&t.set(d,s),t.set(a.filePath,s)}return t},[g,$,V,me]),et=(0,h.useMemo)(()=>An(Y),[Y]),X=ce.size;function $t(t){Re(a=>{const s=new Set(a);return s.has(t)?s.delete(t):s.add(t),s})}r($t,"handleToggleDir");function Lt(t,a){g&&(R(),pe(s=>{const d=new Set(s);if(a==="file")d.has(t)?d.delete(t):d.add(t);else{const f=r((x,j)=>{for(const w of x){if(w.path===j)return w;const z=f(w.children,j);if(z)return z}return null},"findNode"),m=f(Y,t);if(m){const x=kn(m.children,"file");for(const w of m.children)w.kind==="file"&&x.add(w.path);const j=[...x].every(w=>d.has(w));for(const w of x)j?d.delete(w):d.add(w)}}return d}))}r(Lt,"handleToggleCheck");function Ut(t,a){R(),ze(s=>({...s,[t]:a})),ue(s=>{if(!s.has(t))return s;const d=new Set(s);return d.delete(t),d})}r(Ut,"handleConflictRename");function qt(t){R(),ue(a=>{const s=new Set(a);return s.has(t)?s.delete(t):s.add(t),s})}r(qt,"handleConflictToggleConfirm");function Dt(t,a){R(),Fe(s=>{const d=new Set(s),f=d.has(t);return f?d.delete(t):d.add(t),a&&pe(m=>{const x=new Set(m);return f?x.add(a):x.delete(a),x}),d})}r(Dt,"handleConflictToggleSkip");function Kt(t,a){R(),Be(s=>({...s,[t]:a})),xe(s=>{const d={...s};return a==="openai_dot"||a==="wardmote_runner"?d[t]=Te(a):delete d[t],d}),a==="openai_dot"&&fe(s=>new Set([...s,t]))}r(Kt,"handleAdapterChange");function Jt(t){fe(a=>{const s=new Set(a);return s.has(t)?s.delete(t):s.add(t),s})}r(Jt,"handleAdapterToggleExpand");function Wt(t,a){R();const s=Se.find(f=>f.slug===t),d=s?tt(s):he[t]??oe;xe(f=>({...f,[t]:{...f[t]??Te(d,d===s?.adapterChoice?s.adapterConfig:void 0),...a}}))}r(Wt,"handleAdapterConfigChange");function Ht(t){qe(a=>{const s=new Set(a);return s.has(t)?s.delete(t):s.add(t),s})}r(Ht,"handleToggleActivationItem");async function Vt(){if(!S||S.kind!=="full"||G)return;Je(!0);const t=new Set(be),a={};for(const d of Ce(S.result))if(!(!ge.has(d.key)||t.has(d.key)))try{d.kind==="agent"?await it.resume(d.id):await bn.update(d.id,{status:"active"}),t.add(d.key)}catch(f){a[d.key]=f instanceof Error?f.message:"Activation failed."}De(t),Ke(a),Je(!1);const s=Object.keys(a).length;s>0&&p({tone:"error",title:"Some items were not activated",body:`${s} item${s===1?"":"s"} failed to activate; the rest were activated.`})}r(Vt,"handleActivateSelected");const Se=(0,h.useMemo)(()=>g?g.manifest.agents.map(t=>{const a=t.adapterType==="wardmote_runner"&&t.adapterConfig?.provider==="openai_dot"?"openai_dot":t.adapterType;let s=null;if(t.adapterType==="wardmote_runner"&&!(a==="openai_dot"?Z:q)){const d=O?[...O].find(f=>f!=="wardmote_runner")??null:null;s=B!=="wardmote_runner"&&(!O||O.has(B))?B:d??oe}else if(O&&!O.has(t.adapterType)){const d=[...O].filter(f=>f!=="wardmote_runner"||q);s=d.includes(B)?B:d[0]??null}return{slug:t.slug,name:t.name,adapterType:t.adapterType,adapterChoice:a,adapterConfig:t.adapterConfig??{},fallbackAdapterType:s}}):[],[g,O,B,q,Z]);function tt(t){return he[t.slug]??t.fallbackAdapterType??t.adapterChoice}r(tt,"effectiveAdapterType");function Gt(){const t={};for(const a of Se){const s=tt(a),d=$e[a.slug];if(s===a.adapterChoice&&!d)continue;const f=s==="openai_dot"?"wardmote_runner":s,m={adapterType:f};if(d){if(s==="openai_dot"&&d.adapterSchemaValues?.allowUnmeteredProvider!==!0)throw new Error("OpenAI Dot requires acknowledgement of external billing. Configure the Dot adapter and enable Allow externally billed provider.");m.adapterConfig=ln(f).buildAdapterConfig(d)}t[a.slug]=m}return Object.keys(t).length>0?t:void 0}r(Gt,"buildFinalAdapterOverrides");const nt=y==="local"?!!k:N.trim().length>0,Qt=g?g.errors.length>0:!1,ee=y==="local"?k?.compressedBytes??null:null,Zt=F&&g?g.files[F]??null:null,Yt=F?Ne.get(F)??null:null;if(S&&S.kind==="expired")return(0,e.jsxs)("div",{className:"max-w-6xl space-y-4 px-5 py-5",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-base font-semibold",children:"Import completed"}),(0,e.jsx)("p",{className:"text-xs text-ink-3 mt-1",children:S.companyName?(0,e.jsxs)(e.Fragment,{children:["The import finished and ",(0,e.jsx)("span",{className:"font-medium text-ink",children:S.companyName})," is ready. Its detailed summary is no longer available."]}):"The import finished and your organization is ready. Its detailed summary is no longer available, but the organization has been added — select it from the organization switcher to view it."}),S.pausedAutomations?(0,e.jsx)("p",{className:"text-xs text-ink-3 mt-1",children:"Imported agents arrived paused — resume them from the company's Agents page so assigned tasks can start."}):null]}),S.dashboardPath?(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,e.jsx)(U,{size:"sm",variant:"secondary","data-testid":"import-expired-open-company",onClick:r(()=>window.location.assign(S.dashboardPath),"onClick"),children:"Open organization dashboard"})}):null]});if(S){const{result:t,dashboardPath:a}=S,s=t.skills??[],d=S.pausedAutomations?Ce(t):[],f=d.filter(m=>ge.has(m.key)&&!be.has(m.key)).length;return(0,e.jsxs)("div",{className:"max-w-6xl space-y-4 px-5 py-5",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-base font-semibold",children:"Import complete"}),(0,e.jsxs)("p",{className:"text-xs text-ink-3 mt-1",children:[t.company.name,": ",t.agents.length," agent",t.agents.length===1?"":"s",","," ",s.length," skill",s.length===1?"":"s",","," ",t.projects.length," project",t.projects.length===1?"":"s",", and"," ",t.routines.length," routine",t.routines.length===1?"":"s"," processed."]})]}),s.length>0&&(0,e.jsxs)("div",{className:"rounded-md border border-line",children:[(0,e.jsx)("div",{className:"border-b border-line px-4 py-2.5",children:(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Skill import results"})}),(0,e.jsx)("div",{className:"divide-y divide-line",children:s.map(m=>(0,e.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5 text-sm",children:[(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:m.originalSlug}),(0,e.jsx)("span",{className:"shrink-0 text-xs text-ink-3",children:m.action}),m.slug!==m.originalSlug&&(0,e.jsxs)("span",{className:"shrink-0 text-xs text-ink-3",children:["as ",m.slug]})]},`${m.originalKey}:${m.id}`))})]}),t.warnings.length>0&&(0,e.jsx)("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3",children:t.warnings.map(m=>(0,e.jsx)("div",{className:"text-xs text-amber-500",children:m},m))}),d.length>0&&(0,e.jsxs)("div",{className:"rounded-md border border-line",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 border-b border-line px-4 py-2.5",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Activate imported agents and routines"}),(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"imported paused"})]}),(0,e.jsx)("div",{className:"divide-y divide-line",children:d.map(m=>{const x=be.has(m.key),j=Tt[m.key];return(0,e.jsxs)("label",{className:"flex items-center gap-3 px-4 py-2.5 text-sm",children:[(0,e.jsx)("input",{type:"checkbox",checked:ge.has(m.key),disabled:x||G,onChange:r(()=>Ht(m.key),"onChange"),className:"accent-ink"}),(0,e.jsx)(W,{variant:"outline",className:_("text-(length:--text-nano) uppercase tracking-wide",m.kind==="agent"?"text-blue-500 border-blue-500/30":"text-purple-500 border-purple-500/30"),children:m.kind}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:m.name}),x?(0,e.jsx)("span",{className:"shrink-0 text-xs text-emerald-500",children:"activated"}):j?(0,e.jsxs)("span",{className:"shrink-0 text-xs text-bad",children:["failed: ",j]}):(0,e.jsx)("span",{className:"shrink-0 text-xs text-ink-3",children:"paused"})]},m.key)})}),(0,e.jsx)("div",{className:"flex justify-end border-t border-line px-4 py-2.5",children:(0,e.jsx)(U,{size:"sm",onClick:r(()=>{Vt()},"onClick"),disabled:G||f===0,children:G?"Activating...":`Activate selected (${f})`})})]}),S.pausedAutomations?(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"Anything left paused here stays visible on the company's Agents and Routines pages, which offer the same resume actions — nothing is lost if you leave this page."}):null,(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,e.jsx)(U,{size:"sm",variant:"secondary",onClick:r(()=>window.location.assign(a),"onClick"),children:"Go to dashboard"})})]})}return Et?(0,e.jsxs)("div",{className:"max-w-6xl space-y-4 px-5 py-5",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-base font-semibold",children:"Resume watching import"}),(0,e.jsx)("p",{className:"text-xs text-ink-3 mt-1",children:"An import you started earlier is still running on the server."})]}),(0,e.jsxs)("div",{className:"flex items-start gap-2 rounded-md border border-line bg-bg-3/30 px-3 py-2.5",children:[(0,e.jsx)(Ae,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-ink-3"}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"Import running on the server — safe to keep waiting; reconnecting won't lose it."})]})]}):n?(0,e.jsxs)("div",{className:"max-w-6xl",children:[(0,e.jsxs)("div",{className:"border-b border-line px-5 py-5 space-y-4",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-base font-semibold",children:"Import source"}),(0,e.jsx)("p",{className:"text-xs text-ink-3 mt-1",children:"Choose a GitHub repo or upload a local Wardmote zip package."})]}),(0,e.jsx)("div",{className:"grid gap-2 md:grid-cols-2",children:[{key:"github",icon:yn,label:"GitHub repo"},{key:"local",icon:In,label:"Local zip"}].map(({key:t,icon:a,label:s})=>(0,e.jsx)("button",{type:"button",className:_("rounded-md border px-3 py-2 text-left text-sm transition-colors",y===t?"border-ink bg-bg-3":"border-line hover:bg-bg-3/50",v.isPending&&"cursor-not-allowed opacity-50"),disabled:v.isPending,onClick:r(()=>{T(t),K()},"onClick"),children:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(a,{className:"h-4 w-4"}),s]})},t))}),y==="local"?(0,e.jsxs)("div",{className:"rounded-md border border-dashed border-line px-3 py-3",children:[(0,e.jsx)("input",{ref:I,type:"file",accept:".zip,application/zip",className:"hidden",onChange:Bt}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(U,{size:"sm",variant:"secondary",onClick:r(()=>I.current?.click(),"onClick"),disabled:v.isPending,children:"Choose zip"}),k&&(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:[k.name," with"," ",Object.keys(k.files).length," file",Object.keys(k.files).length===1?"":"s",ee!==null?` (${le(ee)} zip)`:""]})]}),!k&&(0,e.jsx)("p",{className:"mt-2 text-xs text-ink-3",children:Rt})]}):(0,e.jsx)(ae,{label:"GitHub URL",hint:"Repo tree path or blob URL to COMPANY.md (e.g. github.com/owner/repo/tree/main/company).",children:(0,e.jsx)("input",{className:"w-full rounded-md border border-line bg-transparent px-2.5 py-1.5 text-sm outline-none",type:"text",value:N,placeholder:"https://github.com/owner/repo/tree/main/company",disabled:v.isPending,onChange:r(t=>{C(t.target.value),K()},"onChange")})}),(0,e.jsx)(ae,{label:"Target",hint:"Import into this organization or create a new one.",children:(0,e.jsxs)("select",{className:"w-full rounded-md border border-line bg-transparent px-2.5 py-1.5 text-sm outline-none",value:H,disabled:v.isPending,onChange:r(t=>{kt(t.target.value),K()},"onChange"),children:[(0,e.jsx)("option",{value:"new",children:"Create new organization"}),(0,e.jsxs)("option",{value:"existing",children:["Existing company: ",i?.name]})]})}),H==="new"&&(0,e.jsx)(ae,{label:"New organization name",hint:"Optional override. Leave blank to use the package name.",children:(0,e.jsx)("input",{className:"w-full rounded-md border border-line bg-transparent px-2.5 py-1.5 text-sm outline-none",type:"text",value:Ee,onChange:r(t=>{Nt(t.target.value),R()},"onChange"),placeholder:"Imported Organization"})}),(0,e.jsx)(ae,{label:"Collision strategy",hint:"Board imports can rename, skip, or replace matching organization content.",children:(0,e.jsxs)("select",{className:"w-full rounded-md border border-line bg-transparent px-2.5 py-1.5 text-sm outline-none",value:Me,disabled:v.isPending,onChange:r(t=>{It(t.target.value),K()},"onChange"),children:[(0,e.jsx)("option",{value:"rename",children:"Rename on conflict"}),(0,e.jsx)("option",{value:"skip",children:"Skip on conflict"}),(0,e.jsx)("option",{value:"replace",children:"Replace existing"})]})}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(U,{size:"sm",variant:"secondary",onClick:r(()=>P.mutate(D.current),"onClick"),disabled:P.isPending||v.isPending||!nt,children:P.isPending?"Previewing...":"Preview import"}),!nt&&!P.isPending&&(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"Choose a package above to enable the preview."}),v.isPending&&(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"Import in progress — the package and settings unlock when it finishes."})]}),P.isPending&&(0,e.jsxs)("div",{className:"mt-3 flex items-start gap-2 rounded-md border border-line bg-bg-3/30 px-3 py-2.5",children:[(0,e.jsx)(Ae,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-ink-3"}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:Q?`${ht(Q)} An interrupted upload resumes from the finished parts.`:`Uploading and analyzing your package${ee!==null?` (${le(ee)} zip)`:""} — large packages can take a few minutes. Keep this page open.`})]}),P.isError&&!P.isPending&&P.variables===D.current&&(0,e.jsx)("div",{className:"mt-3 rounded-md border border-bad/40 bg-bad/5 px-3 py-2.5",children:(0,e.jsxs)("p",{className:"text-xs text-bad",children:["Preview failed:"," ",P.error instanceof Error?P.error.message:"the request did not complete."," ","Retry, or re-export the package without large attachments to shrink it."]})})]}),g&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"sticky top-0 z-10 border-b border-line bg-bg px-5 py-3",children:(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-4 text-sm",children:[(0,e.jsx)("span",{className:"font-medium",children:"Import preview"}),(0,e.jsxs)("span",{className:"text-ink-3",children:[X," / ",et," file",et===1?"":"s"," selected"]}),$.length>0&&(0,e.jsxs)("span",{className:"text-amber-500",children:[$.length," conflict",$.length===1?"":"s"]}),g.errors.length>0&&(0,e.jsxs)("span",{className:"text-bad",children:[g.errors.length," error",g.errors.length===1?"":"s"]})]})}),(0,e.jsx)(Hn,{conflicts:$,nameOverrides:V,skippedSlugs:me,confirmedSlugs:At,onRename:Ut,onToggleSkip:Dt,onToggleConfirm:qt}),(0,e.jsx)(Gn,{agents:Se,adapterOptions:Ot,adapterOverrides:he,expandedSlugs:Ct,configValues:$e,onChangeAdapter:Kt,onToggleExpand:Jt,onChangeConfig:Wt}),(0,e.jsxs)("div",{className:"mx-5 mt-3 flex flex-wrap items-center justify-end gap-3",children:[(0,e.jsxs)("label",{className:"flex items-center gap-2 text-xs text-ink-3",children:[(0,e.jsx)("input",{type:"checkbox",checked:Le,onChange:r(t=>{Pt(t.target.checked),R()},"onChange"),className:"accent-ink"}),"Start imported agents and routines paused"]}),(0,e.jsxs)(U,{size:"sm",onClick:r(()=>v.mutate({previewForImport:g,pauseAutomations:Le}),"onClick"),disabled:v.isPending||Qt||X===0,children:[(0,e.jsx)(lt,{className:"mr-1.5 h-3.5 w-3.5"}),v.isPending?"Importing...":`Import ${X} file${X===1?"":"s"}`]})]}),v.isPending&&(0,e.jsxs)("div",{className:"mx-5 mt-3 flex items-start gap-2 rounded-md border border-line bg-bg-3/30 px-3 py-2.5",children:[(0,e.jsx)(Ae,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-ink-3"}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:Q?`${ht(Q)} An interrupted upload resumes from the finished parts.`:"Import running on the server — safe to keep waiting; reconnecting won't lose it. Large packages can take several minutes."})]}),v.isError&&!v.isPending&&(0,e.jsx)("div",{className:"mx-5 mt-3 rounded-md border border-bad/40 bg-bad/5 px-3 py-2.5",children:(0,e.jsxs)("p",{className:"text-xs text-bad",children:["Import failed:"," ",v.error instanceof Error?v.error.message:"the request did not complete."," ","Nothing may have been created, or the import stopped partway — check the target company before retrying."]})}),g.warnings.length>0&&(0,e.jsx)("div",{className:"mx-5 mt-3 rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3",children:g.warnings.map(t=>(0,e.jsx)("div",{className:"text-xs text-amber-500",children:t},t))}),g.errors.length>0&&(0,e.jsx)("div",{className:"mx-5 mt-3 rounded-md border border-bad/30 bg-bad/5 px-4 py-3",children:g.errors.map(t=>(0,e.jsx)("div",{className:"text-xs text-bad",children:t},t))}),(0,e.jsxs)("div",{className:"grid gap-4 xl:h-(--sz-calc-31) xl:grid-cols-(--gtc-25) xl:gap-0",children:[(0,e.jsxs)("aside",{className:"flex max-h-(--sz-24rem) flex-col overflow-hidden border-b border-line xl:max-h-none xl:border-b-0 xl:border-r",children:[(0,e.jsx)("div",{className:"border-b border-line px-4 py-3 shrink-0",children:(0,e.jsx)("h2",{className:"text-base font-semibold",children:"Package files"})}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,e.jsx)(Sn,{nodes:Y,selectedFile:F,expandedDirs:St,checkedFiles:ce,onToggleDir:$t,onSelectFile:Oe,onToggleCheck:Lt,renderFileExtra:r((t,a)=>Un(t,a,Xe),"renderFileExtra"),fileRowClassName:qn,wrapLabels:!1})})]}),(0,e.jsx)("div",{className:"min-w-0 overflow-y-auto xl:pl-6",children:(0,e.jsx)(Dn,{selectedFile:F,content:Zt,allFiles:g?.files??{},action:Yt,renamedTo:F?Xe.get(F)??null:null})})]})]})]}):(0,e.jsx)(jt,{icon:lt,message:"Select an organization to import into."})}r(Is,"CompanyImport");export{Is as CompanyImport};
|