@alwith/module-drive 0.1.1 → 0.1.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.
Files changed (125) hide show
  1. package/dist/badge-react.d.ts +2 -2
  2. package/dist/badge-react.js +1 -1
  3. package/dist/badge.d.ts +1 -1
  4. package/dist/badge.js +1 -1
  5. package/dist/browse.d.ts +1 -1
  6. package/dist/browse.js +1 -1
  7. package/dist/chunk-0mx45c8q.js +2 -0
  8. package/dist/chunk-13ret1k0.js +188 -0
  9. package/dist/chunk-2343nj4p.js +2 -0
  10. package/dist/chunk-2n0p7j2f.js +2 -0
  11. package/dist/chunk-2ss7362z.js +2 -0
  12. package/dist/chunk-34qgf6be.js +2 -0
  13. package/dist/chunk-3fpcak8h.js +2 -0
  14. package/dist/chunk-4rfsdwgj.js +2 -0
  15. package/dist/chunk-52ccz07b.js +2 -0
  16. package/dist/chunk-563we221.js +2 -0
  17. package/dist/chunk-8765ztht.js +2 -0
  18. package/dist/chunk-8gmexfjt.js +3 -0
  19. package/dist/chunk-8sdw30dr.js +2 -0
  20. package/dist/chunk-ayvem7j8.js +2 -0
  21. package/dist/chunk-bh4wjd78.js +2 -0
  22. package/dist/chunk-dep1erts.js +2 -0
  23. package/dist/chunk-fkz75xv1.js +2 -0
  24. package/dist/chunk-g3pmrhm2.js +2 -0
  25. package/dist/chunk-j234gbr1.js +4 -0
  26. package/dist/chunk-j2mc48dt.js +2 -0
  27. package/dist/chunk-jxs49r5w.js +2 -0
  28. package/dist/chunk-kzjc8c8g.js +3 -0
  29. package/dist/chunk-m3kvhnag.js +3 -0
  30. package/dist/chunk-m6a9k1p0.js +2 -0
  31. package/dist/chunk-mafn36hy.js +2 -0
  32. package/dist/chunk-mz5601y4.js +2 -0
  33. package/dist/chunk-n7wnyds6.js +2 -0
  34. package/dist/chunk-n9sgwcq1.js +2 -0
  35. package/dist/chunk-nf37g7p6.js +2 -0
  36. package/dist/chunk-njfqtysa.js +2 -0
  37. package/dist/chunk-nk64fv7b.js +2 -0
  38. package/dist/chunk-p7y39rr7.js +2 -0
  39. package/dist/chunk-pbxjprxa.js +2 -0
  40. package/dist/chunk-pc21jzd8.js +3 -0
  41. package/dist/chunk-qabnvepm.js +2 -0
  42. package/dist/chunk-qf5g053e.js +2 -0
  43. package/dist/chunk-rg43mads.js +2 -0
  44. package/dist/chunk-t4vq7jva.js +2 -0
  45. package/dist/chunk-vpew2mps.js +2 -0
  46. package/dist/chunk-vtjd21bw.js +8 -0
  47. package/dist/chunk-ws1dtw35.js +2 -0
  48. package/dist/chunk-zf44znpx.js +2 -0
  49. package/dist/content/chat-condense.d.ts +4 -4
  50. package/dist/content/chat-condense.js +1 -1
  51. package/dist/content/collab.d.ts +1 -1
  52. package/dist/content/collab.js +1 -1
  53. package/dist/content/comment-anchors.js +1 -2
  54. package/dist/content/comment-decorations.d.ts +1 -1
  55. package/dist/content/comment-decorations.js +1 -3
  56. package/dist/content/comment-drawer.d.ts +2 -2
  57. package/dist/content/comment-drawer.js +1 -1
  58. package/dist/content/comment-mentions.d.ts +1 -1
  59. package/dist/content/comment-mentions.js +1 -1
  60. package/dist/content/comment-surface.d.ts +3 -3
  61. package/dist/content/comment-surface.js +1 -1
  62. package/dist/content/condense-task.d.ts +2 -2
  63. package/dist/content/condense-task.js +1 -1
  64. package/dist/content/condense.d.ts +3 -3
  65. package/dist/content/condense.js +1 -1
  66. package/dist/content/editor.d.ts +1 -1
  67. package/dist/content/editor.js +1 -1
  68. package/dist/content/file-actions.d.ts +4 -4
  69. package/dist/content/file-actions.js +1 -1
  70. package/dist/content/file-link.d.ts +1 -1
  71. package/dist/content/file-link.js +1 -1
  72. package/dist/content/frontmatter-panel.js +1 -1
  73. package/dist/content/frontmatter.js +1 -7
  74. package/dist/content/host.d.ts +2 -2
  75. package/dist/content/host.js +1 -1
  76. package/dist/content/html-bridge.js +1 -187
  77. package/dist/content/html-comments.js +1 -1
  78. package/dist/content/markdown-comments.d.ts +1 -1
  79. package/dist/content/markdown-comments.js +1 -2
  80. package/dist/content/mention-picker.d.ts +2 -2
  81. package/dist/content/mention-picker.js +1 -1
  82. package/dist/content/save-version.d.ts +1 -1
  83. package/dist/content/save-version.js +1 -1
  84. package/dist/content/translations.d.ts +1 -1
  85. package/dist/content/translations.js +1 -1
  86. package/dist/content/use-file-comments.d.ts +1 -1
  87. package/dist/content/use-file-comments.js +1 -1
  88. package/dist/content/yuplink.d.ts +1 -1
  89. package/dist/content/yuplink.js +1 -2
  90. package/dist/content.d.ts +10 -10
  91. package/dist/content.js +1 -1
  92. package/dist/core.d.ts +4 -4
  93. package/dist/core.js +1 -1
  94. package/dist/files.d.ts +1 -1
  95. package/dist/files.js +1 -1
  96. package/dist/global-search.js +1 -1
  97. package/dist/icons.js +1 -1
  98. package/dist/launcher.d.ts +3 -3
  99. package/dist/launcher.js +1 -2
  100. package/dist/locales.d.ts +2 -2
  101. package/dist/locales.js +1 -1
  102. package/dist/mass-delete.d.ts +3 -3
  103. package/dist/mass-delete.js +1 -1
  104. package/dist/notifications.js +1 -1
  105. package/dist/pinned-docs.js +1 -1
  106. package/dist/pinned.d.ts +3 -3
  107. package/dist/pinned.js +1 -1
  108. package/dist/react.d.ts +14 -14
  109. package/dist/react.js +1 -1
  110. package/dist/roots.d.ts +1 -1
  111. package/dist/roots.js +1 -1
  112. package/dist/settings.d.ts +3 -3
  113. package/dist/settings.js +1 -1
  114. package/dist/sharing.d.ts +3 -3
  115. package/dist/sharing.js +1 -1
  116. package/dist/status.d.ts +4 -4
  117. package/dist/status.js +1 -1
  118. package/dist/summary.d.ts +1 -1
  119. package/dist/summary.js +1 -1
  120. package/dist/tauri.d.ts +1 -1
  121. package/dist/transfer-feed.d.ts +1 -1
  122. package/dist/transfer-feed.js +1 -1
  123. package/dist/ui.d.ts +3 -3
  124. package/dist/ui.js +1 -1
  125. package/package.json +10 -10
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
- import type { DriveController } from "./core.js";
3
- import { type DriveLocale } from "./locales.js";
2
+ import type { DriveController } from "./core";
3
+ import { type DriveLocale } from "./locales";
4
4
  export declare function DriveBadge({ controller, path, isDirectory, locale }: {
5
5
  controller: DriveController;
6
6
  path: string;
@@ -1 +1 @@
1
- import{jsx as e,Fragment as a,jsxs as r}from"react/jsx-runtime";import{aggregateDirBadge as g,badgeFor as v}from"./badge.js";import{driveTranslator as M}from"./locales.js";import{useDrive as f}from"./ui.js";var u={synced:e("path",{d:"m20 6-11 11-5-5"}),pending:r(a,{children:[e("circle",{cx:"12",cy:"12",r:"9"}),e("circle",{cx:"12",cy:"12",r:"2"})]}),uploading:e("path",{d:"m8 12 4-4 4 4M12 8v12M5 17a5 5 0 0 1-1-10 7 7 0 0 1 13-1 5 5 0 0 1 3 9"}),downloading:e("path",{d:"M12 2a10 10 0 1 1-10 10"}),notDownloaded:e("path",{d:"m8 16 4 4 4-4M12 8v12M5 17a5 5 0 0 1-1-10 7 7 0 0 1 13-1 5 5 0 0 1 3 9"}),cloudOnly:e("path",{d:"M6 18a5 5 0 0 1-1-10 7 7 0 0 1 13-2 6 6 0 0 1 0 12Z"}),conflict:r(a,{children:[e("path",{d:"m12 3 10 18H2Z"}),e("path",{d:"M12 9v4M12 17v.01"})]}),error:r(a,{children:[e("circle",{cx:"12",cy:"12",r:"9"}),e("path",{d:"m8 8 8 8M8 16l8-8"})]}),ignored:e(a,{children:e("path",{d:"M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12ZM3 3l18 18"})}),skippedTooLarge:r(a,{children:[e("circle",{cx:"12",cy:"12",r:"9"}),e("path",{d:"m5 19 14-14"})]}),forbidden:r(a,{children:[e("rect",{x:"5",y:"10",width:"14",height:"12",rx:"2"}),e("path",{d:"M8 10V6a4 4 0 0 1 8 0v4"})]}),readOnly:r(a,{children:[e("path",{d:"M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12V7Z"}),e("rect",{x:"9",y:"13",width:"8",height:"7",rx:"1"}),e("path",{d:"M11 13v-2a2 2 0 0 1 4 0v2"})]}),collab:r(a,{children:[e("circle",{cx:"9",cy:"7",r:"3"}),e("path",{d:"M3 21v-3a6 6 0 0 1 12 0v3M17 4a3 3 0 0 1 0 6M21 21v-3a5 5 0 0 0-4-5"})]})};function k({controller:o,path:s,isDirectory:h=!1,locale:p}){let{snapshot:m}=f(o),d=s.replaceAll("\\","/").replace(/\/$/,""),i=m?.files??[],c=i.find((t)=>t.localPath.replaceAll("\\","/")===d.replace(/\.yupcloud$/,"")),l=h?g(d,new Map(i.map((t)=>[t.localPath.replaceAll("\\","/"),t.state]))):c?v(c.state):null;if(!l)return null;let n=M(p)(l.labelKey);return e("span",{className:`alwith-drive-badge ${l.className}`,title:n,"aria-label":n,"data-state":l.state,children:e("svg",{className:l.spin?"alwith-drive-spin":void 0,width:"14",height:"14",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:u[l.state]})})}export{k as DriveBadge};
1
+ import{Ze}from"./chunk-0mx45c8q.js";import"./chunk-t4vq7jva.js";import"./chunk-ws1dtw35.js";import"./chunk-3fpcak8h.js";export{Ze as DriveBadge};
package/dist/badge.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { FileState } from "./core.js";
1
+ import type { FileState } from "./core";
2
2
  export type DriveBadgeDescriptor = {
3
3
  state: FileState;
4
4
  icon: "check" | "cloud-upload" | "triangle-alert" | "cloud" | "eye-off" | "circle-slash" | "circle-x" | "circle-dot" | "lock" | "file-lock" | "users" | "cloud-download" | "loader-circle";
package/dist/badge.js CHANGED
@@ -1 +1 @@
1
- var t={synced:{icon:"check",className:"text-primary",spin:!1},pending:{icon:"circle-dot",className:"text-primary",spin:!1},uploading:{icon:"cloud-upload",className:"text-primary",spin:!0},conflict:{icon:"triangle-alert",className:"text-destructive",spin:!1},cloudOnly:{icon:"cloud",className:"text-muted-foreground",spin:!1},notDownloaded:{icon:"cloud-download",className:"text-primary",spin:!1},downloading:{icon:"loader-circle",className:"text-primary",spin:!0},ignored:{icon:"eye-off",className:"text-muted-foreground",spin:!1},skippedTooLarge:{icon:"circle-slash",className:"text-primary",spin:!1},forbidden:{icon:"lock",className:"text-muted-foreground",spin:!1},readOnly:{icon:"file-lock",className:"text-primary",spin:!1},error:{icon:"circle-x",className:"text-destructive",spin:!1},collab:{icon:"users",className:"text-primary",spin:!1}};function r(e){return{state:e,labelKey:`drive.state.${e}`,...t[e]}}function c(e,i){let n=`${e}/`,a=null;for(let[o,s]of i){if(!o.startsWith(n))continue;if(s==="conflict")return r("conflict");if(s==="error")a="error"}return a?r(a):null}export{c as aggregateDirBadge,r as badgeFor};
1
+ import{g,T}from"./chunk-t4vq7jva.js";export{T as aggregateDirBadge,g as badgeFor};
package/dist/browse.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ProjectProgress, RemoteId, RootInfo } from "./core.js";
1
+ import type { ProjectProgress, RemoteId, RootInfo } from "./core";
2
2
  export type DriveGroupKey = "mine" | "shared";
3
3
  export declare const ARCHIVE_PROJECT_KEY = "ai-session-archive";
4
4
  export declare function isBrowsable(root: RootInfo): boolean;
package/dist/browse.js CHANGED
@@ -1 +1 @@
1
- var m="ai-session-archive";function p(e){return e.kind!=="SKILL"&&e.projectKey!=="ai-session-archive"&&h(e)}function h(e){return(e.drivePath??"").trim()!==""}function P(e){if(e.isMine===!0)return"mine";if(e.isMine===!1)return"shared";return e.scope==="PERSONAL"?"mine":"shared"}function O(e){if(e.scope==="PERSONAL")return"personal";if(e.scope==="TEAM")return"team";if(e.scope==="DEPT")return"dept";return"company"}var o={PERSONAL:0,DEPT:1,COMPANY:2};function s(e){return(e.container??e.kind)==="KNOWLEDGE"?"knowledge":"material"}function k(e){let t=new Map,a=new Map;for(let n of e){if(!p(n))continue;if(n.nodePath===null){let r=P(n),u=a.get(r)??{nodePath:null,label:null,legacy:r,items:[]};u.items.push(n),a.set(r,u);continue}let i=t.get(n.nodePath)??{nodePath:n.nodePath,label:E(n.nodePath),legacy:null,items:[]};i.items.push(n),t.set(n.nodePath,i)}for(let n of t.values())n.items.sort((i,r)=>Number(s(i)==="knowledge")-Number(s(r)==="knowledge"));let d=[...t.values()].toSorted((n,i)=>{let r=l(n)-l(i);return r!==0?r:(n.label??"").localeCompare(i.label??"","zh-Hans-CN")}),f=["mine","shared"].flatMap((n)=>a.get(n)??[]);return[...d,...f]}function l(e){let t=e.items[0]?.node;if(t!==null&&t!==void 0&&t in o)return o[t];if(e.nodePath==="公司")return o.COMPANY;if(e.nodePath==="我的空间")return o.PERSONAL;return o.DEPT}function E(e){return e.startsWith(c)?e.slice(c.length):e}var c="部门/";function g(e){return String(e)}function y(e){return e.cursor!==null}function N(e,t){if(e!==void 0)switch(e.phase){case"queued":return{kind:"queued"};case"syncing":return{kind:"syncing",done:e.done,total:e.total};case"failed":return{kind:"failed",message:e.message??null};case"done":if(e.failed>0)return{kind:"partial",failed:e.failed};break}return t?{kind:"opening"}:null}export{m as ARCHIVE_PROJECT_KEY,s as containerKey,P as groupOf,k as groupsOf,y as hasLanded,h as hasLocation,g as idKey,p as isBrowsable,N as rowStatusOf,O as sharedScopeKey};
1
+ import{vt,m,lt,ct,bt,A,Pe,wt,St,Ee}from"./chunk-2343nj4p.js";export{vt as ARCHIVE_PROJECT_KEY,A as containerKey,ct as groupOf,Pe as groupsOf,St as hasLanded,lt as hasLocation,wt as idKey,m as isBrowsable,Ee as rowStatusOf,bt as sharedScopeKey};
@@ -0,0 +1,2 @@
1
+ import{g,T}from"./chunk-t4vq7jva.js";import{e}from"./chunk-3fpcak8h.js";import{t}from"./chunk-ws1dtw35.js";import{jsxDEV as a,Fragment as r}from"react/jsx-dev-runtime";var M={synced:a("path",{d:"m20 6-11 11-5-5"},void 0,!1,void 0,this),pending:a(r,{children:[a("circle",{cx:"12",cy:"12",r:"9"},void 0,!1,void 0,this),a("circle",{cx:"12",cy:"12",r:"2"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),uploading:a("path",{d:"m8 12 4-4 4 4M12 8v12M5 17a5 5 0 0 1-1-10 7 7 0 0 1 13-1 5 5 0 0 1 3 9"},void 0,!1,void 0,this),downloading:a("path",{d:"M12 2a10 10 0 1 1-10 10"},void 0,!1,void 0,this),notDownloaded:a("path",{d:"m8 16 4 4 4-4M12 8v12M5 17a5 5 0 0 1-1-10 7 7 0 0 1 13-1 5 5 0 0 1 3 9"},void 0,!1,void 0,this),cloudOnly:a("path",{d:"M6 18a5 5 0 0 1-1-10 7 7 0 0 1 13-2 6 6 0 0 1 0 12Z"},void 0,!1,void 0,this),conflict:a(r,{children:[a("path",{d:"m12 3 10 18H2Z"},void 0,!1,void 0,this),a("path",{d:"M12 9v4M12 17v.01"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),error:a(r,{children:[a("circle",{cx:"12",cy:"12",r:"9"},void 0,!1,void 0,this),a("path",{d:"m8 8 8 8M8 16l8-8"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ignored:a(r,{children:a("path",{d:"M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12ZM3 3l18 18"},void 0,!1,void 0,this)},void 0,!1,void 0,this),skippedTooLarge:a(r,{children:[a("circle",{cx:"12",cy:"12",r:"9"},void 0,!1,void 0,this),a("path",{d:"m5 19 14-14"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),forbidden:a(r,{children:[a("rect",{x:"5",y:"10",width:"14",height:"12",rx:"2"},void 0,!1,void 0,this),a("path",{d:"M8 10V6a4 4 0 0 1 8 0v4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),readOnly:a(r,{children:[a("path",{d:"M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12V7Z"},void 0,!1,void 0,this),a("rect",{x:"9",y:"13",width:"8",height:"7",rx:"1"},void 0,!1,void 0,this),a("path",{d:"M11 13v-2a2 2 0 0 1 4 0v2"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),collab:a(r,{children:[a("circle",{cx:"9",cy:"7",r:"3"},void 0,!1,void 0,this),a("path",{d:"M3 21v-3a6 6 0 0 1 12 0v3M17 4a3 3 0 0 1 0 6M21 21v-3a5 5 0 0 0-4-5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};function Ze({controller:p,path:s,isDirectory:h=!1,locale:v}){let{snapshot:m}=t(p),c=s.replaceAll("\\","/").replace(/\/$/,""),i=m?.files??[],d=i.find((o)=>o.localPath.replaceAll("\\","/")===c.replace(/\.yupcloud$/,"")),l=h?T(c,new Map(i.map((o)=>[o.localPath.replaceAll("\\","/"),o.state]))):d?g(d.state):null;if(!l)return null;let n=e(v)(l.labelKey);return a("span",{className:`alwith-drive-badge ${l.className}`,title:n,"aria-label":n,"data-state":l.state,children:a("svg",{className:l.spin?"alwith-drive-spin":void 0,width:"14",height:"14",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:M[l.state]},void 0,!1,void 0,this)},void 0,!1,void 0,this)}
2
+ export{Ze};
@@ -0,0 +1,188 @@
1
+ var Y=`;(function () {
2
+ "use strict"
3
+ if (window.__yupCommentBridge) return
4
+ window.__yupCommentBridge = true
5
+
6
+ var HIGHLIGHT_CLASS = "yup-comment-highlight"
7
+ var MARKER_CLASS = "yup-comment-marker"
8
+ var STYLE_ID = "yup-comment-style"
9
+ var FLASH_CLASS = "yup-comment-flash"
10
+
11
+ function post(message) {
12
+ try {
13
+ window.parent.postMessage(message, "*")
14
+ } catch (error) { console.warn("Drive comment bridge could not notify its host", error) }
15
+ }
16
+
17
+ function ensureStyle() {
18
+ if (document.getElementById(STYLE_ID)) return
19
+ var style = document.createElement("style")
20
+ style.id = STYLE_ID
21
+ style.textContent = [
22
+ "." + HIGHLIGHT_CLASS + "{background:color-mix(in srgb,var(--primary,currentColor) 18%,transparent);border-bottom:2px solid var(--primary,currentColor);cursor:pointer;}",
23
+ "." + HIGHLIGHT_CLASS + ":hover{background:color-mix(in srgb,var(--primary,currentColor) 42%,transparent);}",
24
+ "." +
25
+ MARKER_CLASS +
26
+ "{display:inline-flex;align-items:center;justify-content:center;min-width:15px;height:15px;" +
27
+ "margin:0 2px;padding:0 3px;border-radius:8px;background:var(--primary,currentColor);color:var(--primary-foreground,Canvas);font-size:10px;" +
28
+ "line-height:1;font-weight:600;font-style:normal;vertical-align:super;cursor:pointer;user-select:none;}",
29
+ "." + FLASH_CLASS + "{animation:yup-comment-flash 1.2s ease-out;}",
30
+ "@keyframes yup-comment-flash{0%{background:color-mix(in srgb,var(--primary,currentColor) 35%,transparent);}100%{background:color-mix(in srgb,var(--primary,currentColor) 18%,transparent);}}"
31
+ ].join("")
32
+ ;(document.head || document.documentElement).appendChild(style)
33
+ }
34
+
35
+
36
+ function flatten() {
37
+ var walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT)
38
+ var segments = []
39
+ var text = ""
40
+ var node
41
+ while ((node = walker.nextNode())) {
42
+ var value = node.nodeValue || ""
43
+ if (value.length === 0) continue
44
+ segments.push({ start: text.length, end: text.length + value.length, node: node })
45
+ text += value
46
+ }
47
+ return { text: text, segments: segments }
48
+ }
49
+
50
+
51
+ function clearMarkers() {
52
+ var marks = document.querySelectorAll("." + MARKER_CLASS)
53
+ for (var i = 0; i < marks.length; i++) {
54
+ if (marks[i].parentNode) marks[i].parentNode.removeChild(marks[i])
55
+ }
56
+ var spans = document.querySelectorAll("." + HIGHLIGHT_CLASS)
57
+ for (var j = 0; j < spans.length; j++) {
58
+ var span = spans[j]
59
+ var parent = span.parentNode
60
+ if (!parent) continue
61
+ while (span.firstChild) parent.insertBefore(span.firstChild, span)
62
+ parent.removeChild(span)
63
+ }
64
+ document.body.normalize()
65
+ }
66
+
67
+
68
+ function wrapRange(segments, start, end, threadId) {
69
+ var wrapped = []
70
+ for (var i = 0; i < segments.length; i++) {
71
+ var segment = segments[i]
72
+ var from = Math.max(segment.start, start)
73
+ var to = Math.min(segment.end, end)
74
+ if (from >= to) continue
75
+ try {
76
+ var range = document.createRange()
77
+ range.setStart(segment.node, from - segment.start)
78
+ range.setEnd(segment.node, to - segment.start)
79
+ var span = document.createElement("span")
80
+ span.className = HIGHLIGHT_CLASS
81
+ span.setAttribute("data-thread-id", threadId)
82
+ range.surroundContents(span)
83
+ wrapped.push(span)
84
+ } catch (error) { console.warn("Drive comment quote changed during anchoring", error) }
85
+ }
86
+ return wrapped
87
+ }
88
+
89
+ var applying = false
90
+
91
+
92
+ function applyAnchors(anchors) {
93
+ applying = true
94
+ try {
95
+ clearMarkers()
96
+ ensureStyle()
97
+ var flat = flatten()
98
+ var anchored = []
99
+ for (var i = 0; i < anchors.length; i++) {
100
+ var anchor = anchors[i]
101
+ var spans = wrapRange(flat.segments, anchor.start, anchor.end, String(anchor.threadId))
102
+ if (spans.length === 0) continue
103
+ var marker = document.createElement("span")
104
+ marker.className = MARKER_CLASS
105
+ marker.setAttribute("data-thread-id", String(anchor.threadId))
106
+ marker.textContent = String(anchor.index)
107
+ var last = spans[spans.length - 1]
108
+ if (last.parentNode) last.parentNode.insertBefore(marker, last.nextSibling)
109
+ anchored.push(anchor.threadId)
110
+ }
111
+ post({ type: "yup:anchored", threadIds: anchored })
112
+ } finally {
113
+ applying = false
114
+ }
115
+ }
116
+
117
+ function scrollToThread(threadId) {
118
+ var target = document.querySelector("." + HIGHLIGHT_CLASS + '[data-thread-id="' + threadId + '"]')
119
+ if (!target) return
120
+ target.scrollIntoView({ behavior: "smooth", block: "center" })
121
+ target.classList.remove(FLASH_CLASS)
122
+ void target.offsetWidth // Restart the highlight animation.
123
+ target.classList.add(FLASH_CLASS)
124
+ }
125
+
126
+ document.addEventListener("click", function (event) {
127
+ var node = event.target
128
+ while (node && node !== document.body) {
129
+ if (node.classList && (node.classList.contains(MARKER_CLASS) || node.classList.contains(HIGHLIGHT_CLASS))) {
130
+ post({ type: "yup:marker-click", threadId: node.getAttribute("data-thread-id") })
131
+ return
132
+ }
133
+ node = node.parentNode
134
+ }
135
+ })
136
+
137
+ document.addEventListener("selectionchange", function () {
138
+ if (applying) return
139
+ var selection = document.getSelection()
140
+ if (!selection || selection.isCollapsed || selection.rangeCount === 0) {
141
+ post({ type: "yup:selection", quote: null })
142
+ return
143
+ }
144
+ var quote = selection.toString().trim()
145
+ if (quote.length === 0 || quote.length > 1000) {
146
+ post({ type: "yup:selection", quote: null })
147
+ return
148
+ }
149
+ var range = selection.getRangeAt(0)
150
+ var offset = 0
151
+ var walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT)
152
+ var node
153
+ var located = false
154
+ while ((node = walker.nextNode())) {
155
+ if (node === range.startContainer) {
156
+ offset += range.startOffset
157
+ located = true
158
+ break
159
+ }
160
+ offset += (node.nodeValue || "").length
161
+ }
162
+ var rect = range.getBoundingClientRect()
163
+ post({
164
+ type: "yup:selection",
165
+ quote: quote,
166
+ quoteOffset: located ? offset : null,
167
+ rect: { top: rect.top, left: rect.left, bottom: rect.bottom, right: rect.right }
168
+ })
169
+ })
170
+
171
+ window.addEventListener("message", function (event) {
172
+ if (event.source !== window.parent) return
173
+ var data = event.data
174
+ if (!data || typeof data.type !== "string") return
175
+ if (data.type === "yup:anchors") applyAnchors(data.anchors || [])
176
+ else if (data.type === "yup:scroll-to") scrollToThread(String(data.threadId))
177
+ else if (data.type === "yup:flatten") post({ type: "yup:flat", text: flatten().text })
178
+ })
179
+
180
+ function announce() {
181
+ post({ type: "yup:ready", text: flatten().text })
182
+ }
183
+
184
+ if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", announce)
185
+ else announce()
186
+ })()
187
+ `;
188
+ export{Y};
@@ -0,0 +1,2 @@
1
+ var vt="ai-session-archive";function m(e){return e.kind!=="SKILL"&&e.projectKey!=="ai-session-archive"&&lt(e)}function lt(e){return(e.drivePath??"").trim()!==""}function ct(e){if(e.isMine===!0)return"mine";if(e.isMine===!1)return"shared";return e.scope==="PERSONAL"?"mine":"shared"}function bt(e){if(e.scope==="PERSONAL")return"personal";if(e.scope==="TEAM")return"team";if(e.scope==="DEPT")return"dept";return"company"}var i={PERSONAL:0,DEPT:1,COMPANY:2};function A(e){return(e.container??e.kind)==="KNOWLEDGE"?"knowledge":"material"}function Pe(e){let t=new Map,a=new Map;for(let n of e){if(!m(n))continue;if(n.nodePath===null){let o=ct(n),u=a.get(o)??{nodePath:null,label:null,legacy:o,items:[]};u.items.push(n),a.set(o,u);continue}let r=t.get(n.nodePath)??{nodePath:n.nodePath,label:f(n.nodePath),legacy:null,items:[]};r.items.push(n),t.set(n.nodePath,r)}for(let n of t.values())n.items.sort((r,o)=>Number(A(r)==="knowledge")-Number(A(o)==="knowledge"));let d=[...t.values()].toSorted((n,r)=>{let o=l(n)-l(r);return o!==0?o:(n.label??"").localeCompare(r.label??"","zh-Hans-CN")}),c=["mine","shared"].flatMap((n)=>a.get(n)??[]);return[...d,...c]}function l(e){let t=e.items[0]?.node;if(t!==null&&t!==void 0&&t in i)return i[t];if(e.nodePath==="公司")return i.COMPANY;if(e.nodePath==="我的空间")return i.PERSONAL;return i.DEPT}function f(e){return e.startsWith(s)?e.slice(s.length):e}var s="部门/";function wt(e){return String(e)}function St(e){return e.cursor!==null}function Ee(e,t){if(e!==void 0)switch(e.phase){case"queued":return{kind:"queued"};case"syncing":return{kind:"syncing",done:e.done,total:e.total};case"failed":return{kind:"failed",message:e.message??null};case"done":if(e.failed>0)return{kind:"partial",failed:e.failed};break}return t?{kind:"opening"}:null}
2
+ export{vt,m,lt,ct,bt,A,Pe,wt,St,Ee};
@@ -0,0 +1,2 @@
1
+ import{l}from"./chunk-n7wnyds6.js";import{e}from"./chunk-3fpcak8h.js";import{C}from"./chunk-p7y39rr7.js";import{n,d}from"./chunk-ws1dtw35.js";import{useEffect as M,useEffectEvent as E,useState as u}from"react";import{jsxDEV as a}from"react/jsx-dev-runtime";function ke({host:r,controls:v,locale:P,generation:k,controller:p,onOpenProject:S}){let{Button:x}=v,c=e(P),{error:f,run:D}=n(),[m,g]=u(new Set),[w,y]=u(null),[I,N]=u(!0),j=r.pinnedDocs.map((t)=>t.path).join("\x00"),R=E(()=>r.pinnedDocs),b=E((t)=>r.pathExists(t));if(M(()=>{let t=!0;g(new Set),y(null);let h=R(),s=p.getSnapshot().snapshot?.roots??[];return Promise.all(h.map(async(i)=>({path:i.path,exists:s.some((o)=>o.drivePath&&o.localPath===i.path&&i.kind==="dir")||await b(i.path)}))).then((i)=>{if(t)g(new Set(i.filter((o)=>!o.exists).map((o)=>o.path)))}).catch((i)=>{if(t)y(String(i))}),()=>{t=!1}},[j,k,r.pathExists,p]),!r.pinnedDocs.length)return null;return a("details",{open:I,onToggle:(t)=>N(t.currentTarget.open),className:"alwith-drive-group",children:[a("summary",{children:[c("pinned.title"),a("span",{children:r.pinnedDocs.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(f||w)&&a("p",{role:"alert",className:"alwith-drive-error",children:f||w},void 0,!1,void 0,this),r.pinnedDocs.map((t)=>a(d,{controls:v,context:!0,label:t.name,items:[{label:c("pinned.unpin"),onSelect:()=>D(()=>r.onPinnedDocsChange(C(r.pinnedDocs,t.path)))}],children:a(x,{variant:"ghost",className:"alwith-drive-nav-open","data-missing":m.has(t.path),title:m.has(t.path)?`${t.path} — ${c("pinned.missing")}`:t.path,onClick:()=>D(async()=>{let h=p.getSnapshot().snapshot?.roots.find((s)=>s.drivePath&&s.localPath===t.path&&t.kind==="dir");if(h&&!await r.pathExists(t.path)){let s=await p.request({type:"land",projectId:h.projectId});if(s.type!=="root")throw Error("Drive did not return a landed project");await S(s.data);return}if(m.has(t.path)||!await r.pathExists(t.path))throw Error(c("pinned.missing"));await r.onOpenEntry({path:t.path,isDirectory:t.kind==="dir"})}),children:[a(l,{name:t.kind==="dir"?"folder":"file"},void 0,!1,void 0,this),a("span",{children:t.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},t.path,!1,void 0,this))]},void 0,!0,void 0,this)}
2
+ export{ke};
@@ -0,0 +1,2 @@
1
+ import{o}from"./chunk-mafn36hy.js";import{useCallback as h,useEffect as v,useRef as x,useState as u}from"react";function K(c){let{transport:t,onError:s}=o(),[d,f]=u({path:c,context:null}),p=d.path===c?d.context:null,[q,y]=u([]),[g,l]=u(!0),i=x(0),C=x(0),a=p?.fileId??null,m=h(async()=>{if(a===null)return;let e=i.current,r=++C.current,n=await t.request({type:"comments",fileId:a});if(n.type!=="comments")throw Error("Invalid comments response");if(e===i.current&&r===C.current)y(n.data)},[t,a]);return v(()=>{let e=i,r=++i.current;return f({path:c,context:null}),y([]),l(!0),t.request({type:"commentContext",path:c}).then((n)=>{if(n.type!=="commentContext")throw Error("Invalid comment context response");if(r!==i.current)return;if(f({path:c,context:n.data}),n.data===null)l(!1)}).catch((n)=>{if(r===i.current)l(!1),s(n)}),()=>{e.current++}},[c,t,s]),v(()=>{if(a===null)return;let e=!1,r=crypto.randomUUID(),n;return(async()=>{let w=await t.subscribe((I)=>{if(I.payload.type==="comment"&&String(I.payload.data.fileId)===String(a))m().catch(s)});if(e){w();return}if(n=w,await t.request({type:"commentWatch",ownerId:r,fileIds:[a]}),e){await t.request({type:"commentWatch",ownerId:r,fileIds:[]});return}await m()})().catch(s).finally(()=>{if(!e)l(!1)}),()=>{e=!0,n?.(),t.request({type:"commentWatch",ownerId:r,fileIds:[]}).catch(s)}},[a,t,m,s]),{context:p,comments:q,loading:g,reload:m,create:async(e)=>{if(a===null)throw Error("The file is not available for comments");await t.request({type:"commentCreate",fileId:a,request:e}),await m()},update:async(e,r)=>{await t.request({type:"commentUpdate",commentId:e,body:r}),await m()},remove:async(e)=>{await t.request({type:"commentDelete",commentId:e}),await m()},apply:async(e)=>{await t.request({type:"commentApply",commentId:e}),await m()}}}
2
+ export{K};
@@ -0,0 +1,2 @@
1
+ function Z(e,n,o,i){let t=!1;return async()=>{if(t||!o())return;t=!0,i(!0);try{if(await e.saveDocument(n),!o())throw Error("Drive write access changed while saving the document");let r=await e.transport.request({type:"saveVersion",path:n});if(r.type!=="id")throw Error("Invalid Drive save-version response");if(r.data===null)e.notify.error(e.translate("editor.markdown.frontmatter.notInDrive"));else e.notify.success(e.translate("editor.markdown.frontmatter.saved"))}catch(r){e.notify.error(e.translate("editor.markdown.frontmatter.saveFailed"),{description:String(r)})}finally{t=!1,i(!1)}}}
2
+ export{Z};
@@ -0,0 +1,2 @@
1
+ var Ne={en:{common:{title:"YUP Drive",massDelete:{title:"Delete {{count}} files from the cloud too?",desc:'You deleted {{count}} files locally in "{{project}}". Confirm to also delete them from the cloud (they go to the trash and can be recovered). Cancel to restore them from the cloud instead — use this if it was a mistake.',confirm:"Delete from cloud",cancel:"Cancel and restore",restoring:"Restoring the deleted files from the cloud…"},syncNow:"Sync now",pause:"Pause",resume:"Resume",openSettings:"Open settings",engine:{idle:"Up to date",scanning:"Scanning",syncing:"Syncing",paused:"Paused",error:"Error"},panel:{inFlight:"Transferring ({{count}})",recentDone:"Recently completed ({{count}})",retryOne:"Retry",reconcile:"Re-check",reconciling:"Re-checking…",reconcileHint:"If sync looks wrong, hit Re-check: it compares everything against the cloud. Files that already match aren't downloaded again.",retrying:"Retrying…",allQuiet:"Everything is up to date",signInHint:"Sign in to the company knowledge base to list your cloud projects here; click one to sync it locally and open it.",signIn:"Sign in to YUP Drive",openWeb:"Open on web",refresh:"Refresh",connecting:"Connecting to YUP Drive…",empty:"No cloud projects available yet",groups:{mine:"Mine",shared:"Shared",otherPersonal:"Other people's personal libraries"},filter:"Filter by name",filterEmpty:"No matching projects",open:"Open",openTimeout:"{{name}} has not synced locally yet, try again shortly",state:"State",progress:"Progress",progressValue:"{{downloading}} downloading · {{uploading}} uploading · {{synced}} synced",lastSync:"Last sync",never:"Never",conflicts:"Conflicts ({{count}})",errors:"Errors ({{count}})",reveal:"Reveal",push:"Change push",pushLive:"Live",pushPolling:"Polling",guard:{notice:"The server doesn't report personal-library ownership yet, so we can't tell which of these {{count}} are yours. Only the projects you've opened are syncing. This clears itself once the server is upgraded — nothing for you to do.",syncAll:"Sync all",confirmTitle:"Sync every personal space?",confirmDesc:"This turns off the safeguard and downloads all {{count}} personal spaces — your colleagues' included — onto this computer. You can turn the safeguard back on later in settings.",cancel:"Cancel"},containers:{material:"Materials",knowledge:"Knowledge"},scopes:{personal:"Personal",dept:"Department",team:"Team",company:"Company"},new:"New",more:"More",status:{queued:"Queued",syncing:"Syncing",syncingProgress:"{{done}} of {{total}}",opening:"Opening",failed:"Sync failed",retry:"Retry",partial:"{{count}} file(s) did not download"},importFromFeishu:"Import from Feishu…",notUploaded:"Not uploaded ({{count}})",notUploadedMeta:"Tried {{attempts}} time(s) · next retry {{next}}",notUploadedMetaDue:"Tried {{attempts}} times · retrying next round",notUploadedMetaSettled:"Same result after {{attempts}} tries; auto-retry stopped — this one needs a person",retryNow:"Retry now",notDownloaded:"Not downloaded ({{count}})",transferFailed:"Failed to sync ({{count}})",direction:{upload:"Up",download:"Down"}},state:{synced:"Synced",pending:"Pending upload",uploading:"Uploading",conflict:"Conflict",cloudOnly:"Cloud only",ignored:"Ignored",skippedTooLarge:"Skipped, too large",forbidden:"Forbidden",error:"Error",collab:"Collaborating",readOnly:"Read-only · needs a change request",notDownloaded:"Not downloaded · click to fetch",downloading:"Downloading"},condense:{action:"Condense into knowledge",scope:"Scope",close:"Close",cancelTask:"Cancel task",cancelling:"Cancelling…",cancelled:"Cancelled",succeeded:"Knowledge draft created",failed:"Condense failed",processing:"Processing…",uploadIssue:"A file needs attention. Review its sync details and cloud content:",uploading:"Uploading",uploadHint:"Closing keeps the task running. Cancelling prevents condensation; cloud file sync continues.",closeHint:"Closing keeps the task running. Reopen this dialog to see its status.",errorDetails:"Details",knowledgeSource:"The server does not accept a knowledge project as the source. Choose a materials or project space.",completed:"{{name}}: knowledge draft created",backgroundFailed:"{{name}}: condense failed. Reopen the dialog for details.",openResult:"Open draft",retry:"Try again",description:"Generate a knowledge draft from this project’s cloud content. You can edit the draft when it is ready.",phase:{preflight:"Checking uploads…",starting:"Starting…",running:"Condensing…",runningProgress:"Condensing… {{progress}}%",opening:"Opening the draft…"},toast:{working:"{{name}} · {{detail}}",opened:"{{name}}: draft ready — it is open in the editor, edit it right here",remoteOnly:"The draft “{{title}}” was created, but the knowledge base it lives in is not synced to this computer yet",noUrl:"The server returned no web link either — look for it in the knowledge base project.",openWeb:"Open on web",cancel:"Cancel"},propose:{title:"There has been activity in {{name}} — condense it into knowledge?",action:"Condense",dismiss:"Don't ask again",dismissed:"Won't ask about {{name}} again for a while."},unsynced:{title:"{{count}} file(s) have not been uploaded yet",desc:"Condensing runs on the cloud copy of this project, so anything not uploaded yet will be missing from the draft — and it will still look like it worked.",failed:"{{count}} of them failed to upload and need attention.",wait:"Wait for the upload",proceed:"Condense anyway"},errors:{engineOff:"YUP Drive sync is not running, so this project's local changes cannot be pushed up first. Start sync, then try again.",preflight:"Could not check what is still waiting to be uploaded, so condensing did not start.",start:"The server refused to start condensing — its exact wording is above.",poll:"Lost track of the condense job; it may still be running on the server.",jobFailed:"The condense job failed — the executor's exact wording is above.",jobFailedUnknown:"The condense job failed and the server gave no reason. Check the job on the web.",cancelled:"The condense job was cancelled before it finished.",noResult:"The server reported success but returned no draft, so nothing was created.",timeout:"Still not finished after 20 minutes, so we stopped watching. Check the job on the web.",badScopePath:"The server could not make sense of that path — right-click the file or folder again from inside the project.",scopePathNotFound:"There is nothing visible to condense inside that file or folder on the cloud copy — it may not be uploaded yet, or you may not have access to it.",outsideDrive:"This row is not inside any YUP Drive project, so there is nothing to condense."}},grants:{action:"Permissions & collaborators",title:"Permissions & collaborators",loading:"Loading permissions…",notInCloud:"This item isn't in the cloud yet, or isn't inside YUP Drive — nothing to set here for now.",loadFailed:"Couldn't load the permission list — the server's own words are above.",readOnly:"You don't manage permissions here, so this is view-only.",back:"Back to {{name}}",remove:"Remove",customHint:"Custom levels can only be changed in the admin console",customGrant:{title:"{{name}}'s permission includes a deny rule, so levels can't touch it",desc:"Change it in the web admin console."},who:{title:"Who can access",empty:"No collaborators yet",inheritedFrom:"From {{source}}",space:"space"},implicit:{PROJECT_MANAGER:"Project manager",OWNER:"File owner",FOLDER_CREATOR:"Folder creator",GLOBAL_ADMIN:"Global admin",other:"Implicit"},level:{label:"Level",VIEW:"Can view",EDIT:"Can edit",MANAGE:"Can manage",CUSTOM:"Custom"},inheritedRemove:{title:"{{name}} gets this permission from “{{source}}”, so it can't be removed here",desc:"Change it at the source; this item will follow.",action:"Go to the source",unknown:"a parent level"},add:{title:"Add collaborator",USER:"People",DEPT:"Department",ALL:"Everyone",all:"Everyone",allDesc:"Everyone in the company",searchUser:"Type a name or employee no.",searchDept:"Type a department name",hint:"Type to search",empty:"No matches",picked:"Selected: {{name}}",submit:"Add"},toast:{set:"{{name}} is now {{level}}",removed:"Removed {{name}}",setFailed:"Couldn't set the permission — the server's own words are above.",removeFailed:"Couldn't remove — the server's own words are above."}},newProject:{title:"New project",desc:"Pick a scope and template; it is pinned, pulled locally and opened",loading:"Loading templates and departments…",name:"Name",namePlaceholder:"Project name",scope:"Scope",scopes:{PERSONAL:"My space",DEPT:"Department",TEAM:"Team",COMPANY:"Company"},department:"Department",template:"Template",cancel:"Cancel",create:"Create",creating:"Creating…",done:"Created {{name}}",preview:"Will appear under {{node}} › {{container}}"},deviceMismatch:"Device mismatch, register this device again",summary:{upToDate:"Up to date",syncing:"Syncing {{count}} file(s)",scanning:"Scanning",paused:"Paused",conflicts:"{{count}} conflict(s)",failed:"{{count}} failed",error:"Sync error",notUploaded:"{{count}} not uploaded",notDownloaded:"{{count}} not downloaded",transferFailed:"{{count}} failed to sync"},readOnly:{changed:"{{name}} needs a change request — your edit stays on this computer and will not be uploaded.",requestOnWeb:"Request a change on the web"},cloudOnly:{restored:"Restored {{count}} files that were previously cloud-only",hidden:"{{count}} files are now cloud-only; their local copies were removed as required",repaired:"Restored local placeholders for {{count}} cloud-only files (their folders looked empty before)"},comments:{title:"Comments",expand:"Show comments",collapse:"Hide comments",loading:"Loading comments",empty:"No comments yet",placeholder:"Write a comment",newForFile:"Comment on this file",mention:{hint:"Type a name to mention someone",empty:"No matching people"},replyPlaceholder:"Write a reply",selectHint:"Select any text in the document to quote it in a comment or propose a replacement.",commentOnSelection:"Comment",send:"Send",cancel:"Cancel",save:"Save",reply:"Reply",edit:"Edit",edited:"Edited",delete:"Delete",deletedPlaceholder:"Deleted",aiBadge:"AI",suggestEdit:"Suggest a replacement",suggestPlaceholder:"Replacement text",suggestLabel:"Suggested replacement",applyAction:"Apply",applied:"Applied, a new version was created",appliedBy:"Applied by {{name}}",applyFailed:"Could not apply the suggestion",submitFailed:"Could not post the comment",deleteFailed:"Could not delete the comment",offline:"Offline",offlineHint:"Live updates are offline, reopen the file to see new comments",justNow:"Just now",minutesAgo:"{{count}} minutes ago",hoursAgo:"{{count}} hours ago",daysAgo:"{{count}} days ago"},placeholder:{tapToDownload:"Click to download",tapToDownloadSized:"Click to download · {{size}}",tapToDownloadHint:"This file is large, so it was not downloaded automatically. Click to fetch it — it opens as soon as it lands.",downloading:"Downloading…",downloadingSized:"Downloading… · {{size}}",retry:"Retry",cloudOnly:"Cloud only",cloudOnlyHint:"This content stays in the cloud by policy and is never downloaded to anyone's computer. Open this row to see how to read it on the web."},search:{placeholder:"Search all projects",indexing:"Indexing...",empty:"No matches",truncated:"Showing partial results (index capped)"},pinned:{title:"Pinned",pin:"Pin to sidebar",unpin:"Unpin from sidebar",missing:"This file no longer exists"},shared:{title:"Shared with me",open:"Open",openWeb:"Open on the web",rowTitle:"{{name}} — in {{project}}, shared by {{by}}",notInDrive:"{{name}} is not in your local Drive — opening it on the web",landTimeout:"{{name}} has not synced locally yet, try again shortly",folderMissing:"{{name}} has not landed locally yet — opened its project instead"},access:{request:"Request access",submitted:"Request submitted — you'll be notified once it's approved",alreadyPending:"You already have a pending request for this",cannotResolve:"Can't request access for this item"},chatHere:"Chat in this folder"},settings:{webBase:{title:"Web address",desc:'Knowledge base web URL used by "Open on web"; leave empty to use the address configured in the yup-kb plugin'},ai:{title:"AI & knowledge"},archive:{title:"AI session archive",desc:"Opt in: every 5 minutes, your local alwith conversations (your prompts and the AI's text replies only) are uploaded to the company knowledge base. A conversation goes to the project it happened in — chats inside a Drive project folder land there, everything else lands in your own personal library where nobody else can see it. Drop a <uuid>.private file next to a session to exclude it. Upload only: nothing is downloaded and nothing local is deleted; conversations stay in the cloud and never sync to anyone's machine",syncNow:"Sync now",syncing:"Syncing…",lastUpload:"Last upload: {{time}}",never:"never",synced:"{{count}} sessions archived"},knowledge:{title:"Knowledge into chats",desc:"When a project inside YUP Drive is open, search the company knowledge base by the README title / topic / department and inject related summaries and links into new chats (fails silently, cached 10 minutes)"},server:{title:"Server address",desc:"Knowledge server URL, without /api/v1"},ownership:{title:"Continue using this directory?",description:"{{path}} contains existing Drive files or belongs to another profile. Continuing will assign this directory to the current account. Existing files will be preserved and participate in synchronization, and may be uploaded to this account. Close any other app syncing this directory first.",cancel:"Cancel",continue:"Continue"},login:{title:"Sign in",desc:"Paste a personal access token, then register this device",tokenPlaceholder:"Personal access token",register:"Register this device",loading:"Signed in · reading device information…",loadFailed:"Signed in · could not read device information",registered:"Signed in · device {{deviceId}}",unregistered:"Signed in · device not registered",logout:"Sign out",done:"Signed in and device registered"},sso:{title:"SSO sign in",desc:"Sign in with your company account in the system browser; this device is registered automatically",open:"SSO sign in",waiting:"Waiting for browser sign in…"},collab:{title:"Collaboration relay",desc:"Yjs relay address (wss://…); leave empty to edit .md files in Drive locally only"},localRoot:{title:"Local root folder",choose:"Choose folder"},pause:{title:"Pause sync",desc:"Stop uploading and downloading until resumed"},roots:{title:"Synced roots",empty:"No roots available",readOnly:"read only",scope:{personal:"My space",otherPersonal:"Others' personal spaces",dept:"Department",team:"Team",company:"Company"}},errors:{title:"Error queue",empty:"No errors"},deviceMismatch:"Device mismatch, register this device again",guard:{title:"Sync all personal spaces",desc:"Your server does not report personal-space ownership, so {{count}} personal spaces cannot be told apart. Off (recommended): only the projects you pinned are synced. On: all of them are downloaded to this computer."},cleanup:{title:"Clean up unselected local copies",desc:"Project folders that are on disk but no longer in the sync selection are moved to a staging folder next to your local root — moved, not deleted.",scan:"Scan",nothing:"Nothing to clean up: every folder on disk is still in the sync selection.",confirm:"Move {{count}} folders to {{dir}}? They are moved, not deleted — move them back to restore.",move:"Move",cancel:"Cancel",done:"Moved {{count}} folders to {{dir}}",skipped:"Skipped {{count}}",skippedPinned:"{{count}} pinned",skippedPending:"{{count}} with unuploaded changes",failed:"{{count}} could not be moved"},cloudOnly:{title:"Recheck cloud-only files",desc:"When the server changes whether a file may be downloaded, the file itself does not change, so incremental sync never hears about it — a .yupcloud placeholder can sit there forever (or, the other way round, content that should have been withdrawn stays on disk). The first sync after launch rechecks automatically; use this if you suspect what you have is stale.",action:"Recheck",clean:"Checked {{count}} projects; nothing needed fixing"},skills:{title:"Installed department skills",empty:"No skill projects synced yet",installed:"Installed",notInstalled:"Not synced",auto:"Auto-installed (company or your department)",manual:"Pinned by you",notAuto:"Not auto-installed (other department)",desc:"Skill projects are not listed in the Drive panel — they are read by the machine. Company-wide and your own department's are installed automatically; others can be pinned by hand."},usage:{title:"Disk usage",desc:"See how much space Drive takes on this machine and what is taking it. Read-only — it changes no sync behaviour.",action:"Show",total:"{{size}} across {{count}} files",byProject:"Largest projects",byFile:"Largest files",files:"{{count}} files"},maxAutoDownload:{title:"Don't auto-download large files",desc:"Files above this size are not downloaded automatically. They are marked in the file tree with their name and size — click one to fetch it, and it opens as soon as it lands. Set 0 to download everything. Takes effect on the next sync: raise it and files now under the limit are fetched for you, no clicking needed.",unit:"MB"},advanced:{title:"Advanced (server addresses)"}}},"zh-CN":{common:{title:"YUP Drive",massDelete:{title:"确认从云端也删除这 {{count}} 个文件?",desc:"你在「{{project}}」本地删除了 {{count}} 个文件。确认将一并从云端删除(进回收站,可找回);如果是误删,请点取消,从云端把它们恢复回来。",confirm:"从云端删除",cancel:"取消并恢复",restoring:"正在从云端恢复被删除的文件…"},syncNow:"立即同步",pause:"暂停",resume:"继续",openSettings:"打开设置",engine:{idle:"已是最新",scanning:"扫描中",syncing:"同步中",paused:"已暂停",error:"错误"},panel:{inFlight:"正在传输({{count}})",recentDone:"最近完成({{count}})",retryOne:"重试",reconcile:"重新对账",reconciling:"对账中…",reconcileHint:"同步不对劲时点「重新对账」:跟云端从头核对一遍,已经一样的文件不会重下。",retrying:"重试中…",allQuiet:"已是最新",signInHint:"登录公司知识库后,这里会列出你的云端项目;点一下就同步到本地并打开。",signIn:"登录 YUP Drive",openWeb:"在网页打开",refresh:"刷新",connecting:"正在连接 YUP Drive…",empty:"还没有可用的云端项目",groups:{mine:"我的",shared:"共享",otherPersonal:"他人的个人库"},filter:"按名称筛选",filterEmpty:"没有匹配的项目",open:"打开",openTimeout:"{{name}} 还没同步到本地,稍后再试",state:"状态",progress:"进度",progressValue:"下载中 {{downloading}} · 上传中 {{uploading}} · 已同步 {{synced}}",lastSync:"上次同步",never:"从未",conflicts:"冲突({{count}})",errors:"错误({{count}})",reveal:"显示",push:"变更推送",pushLive:"实时",pushPolling:"轮询",guard:{notice:"服务端还没上归属字段,暂时分不清这 {{count}} 个个人库哪些是你的,已只同步你打开过的项目。服务端升级后自动恢复,无需你操作。",syncAll:"全部同步",confirmTitle:"同步全部个人库?",confirmDesc:"这会关掉这道保护,把全部 {{count}} 个个人库(含同事的)都下载到这台电脑上。之后可以在设置里改回来。",cancel:"取消"},containers:{material:"资料库",knowledge:"知识库"},scopes:{personal:"他人",dept:"部门",team:"团队",company:"公司"},new:"新建",more:"更多",status:{queued:"等待中",syncing:"同步中",syncingProgress:"已下 {{done}} / 共 {{total}}",opening:"打开中",failed:"同步失败",retry:"重试",partial:"{{count}} 个文件没下来"},importFromFeishu:"从飞书导入…",notUploaded:"没传上去({{count}})",notUploadedMeta:"已试 {{attempts}} 次 · 下次 {{next}}",notUploadedMetaDue:"已试 {{attempts}} 次 · 下一轮就再试",notUploadedMetaSettled:"试了 {{attempts}} 次都是同一个结果,已经不再自动重试 —— 这条要人去处理",retryNow:"立刻重试",notDownloaded:"没下下来({{count}})",transferFailed:"没同步成功({{count}})",direction:{upload:"上行",download:"下行"}},state:{synced:"已同步",pending:"待上传",uploading:"上传中",conflict:"冲突",cloudOnly:"仅云端",ignored:"已忽略",skippedTooLarge:"已跳过,过大",forbidden:"禁止",error:"错误",collab:"协同中",readOnly:"只读 · 需走修改申请",notDownloaded:"未下载 · 点一下就拉",downloading:"下载中"},condense:{action:"沉淀为知识",scope:"沉淀范围",close:"关闭",cancelTask:"取消任务",cancelling:"正在取消…",cancelled:"已取消",succeeded:"沉淀成功",failed:"沉淀失败",processing:"处理中…",uploadIssue:"文件同步异常,请在同步详情中查看并核对云端内容:",uploading:"正在上传",uploadHint:"关闭后任务继续。取消将停止后续沉淀,云盘文件同步仍会继续。",closeHint:"关闭后任务继续,可重新打开此弹窗查看状态。",errorDetails:"详细信息",knowledgeSource:"服务端不支持将知识库项目作为沉淀来源,请选择资料或项目空间。",completed:"{{name}}:沉淀成功",backgroundFailed:"{{name}}:沉淀失败,可重新打开弹窗查看详情。",openResult:"打开草稿",retry:"重试",description:"根据当前项目的云端内容生成知识草稿,生成后可继续编辑。",phase:{preflight:"正在核对上传…",starting:"正在发起…",running:"沉淀中…",runningProgress:"沉淀中… {{progress}}%",opening:"正在打开草稿…"},toast:{working:"{{name}} · {{detail}}",opened:"{{name}}:草稿已生成,已在编辑器里打开,可以直接改",remoteOnly:"草稿《{{title}}》已生成,但它所在的知识库项目本地还没同步",noUrl:"服务端也没给网页地址 —— 去那个知识库项目里找这份草稿。",openWeb:"在网页打开",cancel:"取消"},propose:{title:"{{name}} 最近有不少进展,要沉淀成一份知识吗?",action:"沉淀",dismiss:"别再问",dismissed:"这段时间不会再问你 {{name}} 了。"},unsynced:{title:"还有 {{count}} 个文件没传上去",desc:"沉淀跑的是这个项目在云端的那份内容,没传上去的东西不会进草稿 —— 而且它看起来还是成功的。",failed:"其中 {{count}} 个是传失败的,需要你处置。",wait:"先等等",proceed:"仍然沉淀"},errors:{engineOff:"YUP Drive 同步没在跑,没法先把这个项目的本地改动推上去。请先启动同步再试。",preflight:"查不出还有什么没传上去,沉淀没有发起。",start:"服务端拒绝了这次沉淀 —— 上面是它的原话。",poll:"跟丢了这条沉淀任务,它可能还在服务端跑着。",jobFailed:"沉淀任务失败 —— 上面是执行器的原话。",jobFailedUnknown:"沉淀任务失败,服务端没给原因。去网页上看这条任务。",cancelled:"沉淀任务在跑完之前被取消了。",noResult:"服务端说成功了却没给草稿,什么都没生成。",timeout:"跑了 20 分钟还没结束,已经不再盯着了。去网页上看这条任务。",badScopePath:"服务端认不出这个路径 —— 回到项目里重新右键那个文件或文件夹再试。",scopePathNotFound:"云端这份内容里,这个文件或文件夹下没有可见的东西可沉淀 —— 可能还没传上去,也可能你没有权限。",outsideDrive:"这一行不在任何 YUP Drive 项目里,没有可沉淀的内容。"}},grants:{action:"权限与协作者",title:"权限与协作者",loading:"正在读取权限…",notInCloud:"这一行还没上云,或不在 YUP Drive 里 —— 暂时没有可设的权限。",loadFailed:"读不到权限列表 —— 上面是服务端的原话。",readOnly:"你在这里没有管理权限,只能查看。",back:"返回 {{name}}",remove:"移除",customHint:"自定义档位要去管理后台改",customGrant:{title:"{{name}} 的权限里含有拒绝规则,档位接口不碰它",desc:"去网页管理后台改。"},who:{title:"谁能访问",empty:"还没有任何协作者",inheritedFrom:"来自 {{source}}",space:"空间"},implicit:{PROJECT_MANAGER:"项目管理员",OWNER:"文件所有者",FOLDER_CREATOR:"目录创建者",GLOBAL_ADMIN:"全局管理员",other:"隐含权限"},level:{label:"档位",VIEW:"只读",EDIT:"可编辑",MANAGE:"可管理",CUSTOM:"自定义"},inheritedRemove:{title:"{{name}} 的权限是从「{{source}}」继承来的,这里删不掉",desc:"去源头那一层改;改了之后这里会跟着变。",action:"去源头改",unknown:"上一层"},add:{title:"添加协作者",USER:"人",DEPT:"部门",ALL:"全公司",all:"全公司",allDesc:"公司里的所有人",searchUser:"输入姓名或工号",searchDept:"输入部门名",hint:"打字开始搜索",empty:"没有匹配的结果",picked:"已选:{{name}}",submit:"添加"},toast:{set:"已把 {{name}} 设为{{level}}",removed:"已移除 {{name}}",setFailed:"设置权限失败 —— 上面是服务端的原话。",removeFailed:"移除失败 —— 上面是服务端的原话。"}},newProject:{title:"新建项目",desc:"选择范围与模板,建好后固定并拉到本地,随即打开",loading:"正在读取模板与部门…",name:"名称",namePlaceholder:"项目名称",scope:"范围",scopes:{PERSONAL:"我的空间",DEPT:"部门",TEAM:"团队",COMPANY:"公司"},department:"部门",template:"模板",cancel:"取消",create:"创建",creating:"创建中…",done:"已创建 {{name}}",preview:"建好后出现在 {{node}} 的「{{container}}」下"},deviceMismatch:"设备不匹配,重新注册此设备",summary:{upToDate:"已是最新",syncing:"同步中 {{count}} 个文件",scanning:"扫描中",paused:"已暂停",conflicts:"有 {{count}} 个冲突",failed:"有 {{count}} 个失败",error:"同步出错",notUploaded:"{{count}} 个没传上去",notDownloaded:"{{count}} 个没下下来",transferFailed:"{{count}} 个没同步成功"},readOnly:{changed:"{{name}} 需要走修改申请 —— 你的改动只留在这台电脑上,不会上传。",requestOnWeb:"在网页申请修改"},cloudOnly:{restored:"已恢复 {{count}} 个此前只能在云端查看的文件",hidden:"{{count}} 个文件改为只能在云端查看,本地副本已按权限要求移除",repaired:"已为 {{count}} 个只能在云端查看的文件补回本地说明文件(此前它们所在的文件夹看起来是空的)"},comments:{title:"评论",expand:"显示评论",collapse:"隐藏评论",loading:"正在加载评论",empty:"暂无评论",placeholder:"写评论",newForFile:"评论这份文件",mention:{hint:"打字找人",empty:"没有匹配的人"},replyPlaceholder:"写回复",selectHint:"在正文里选中一段文字,可以引用它评论或发起建议替换。",commentOnSelection:"评论",send:"发送",cancel:"取消",save:"保存",reply:"回复",edit:"编辑",edited:"已编辑",delete:"删除",deletedPlaceholder:"已删除",aiBadge:"AI",suggestEdit:"建议替换",suggestPlaceholder:"替换文本",suggestLabel:"建议替换",applyAction:"采纳",applied:"已采纳,新版本已生成",appliedBy:"由 {{name}} 采纳",applyFailed:"采纳失败",submitFailed:"评论发送失败",deleteFailed:"评论删除失败",offline:"离线",offlineHint:"实时推送已离线,重新打开文件才能看到新评论",justNow:"刚刚",minutesAgo:"{{count}} 分钟前",hoursAgo:"{{count}} 小时前",daysAgo:"{{count}} 天前"},placeholder:{tapToDownload:"点一下下载",tapToDownloadSized:"点一下下载 · {{size}}",tapToDownloadHint:"这份文件太大,没有自动下载。点一下拉下来,下完直接打开。",downloading:"下载中…",downloadingSized:"下载中… · {{size}}",retry:"重试",cloudOnly:"仅云端",cloudOnlyHint:"这份内容按规定只留在云端,不会下载到任何人的电脑上。打开这一行可以看到怎么在网页读它。"},search:{placeholder:"搜索所有项目",indexing:"正在建立索引…",empty:"没有匹配项",truncated:"结果可能不全(索引已达上限)"},pinned:{title:"置顶",pin:"置顶到侧栏",unpin:"取消置顶",missing:"这个文件已经不存在了"},shared:{title:"分享给我的",open:"打开",openWeb:"在网页打开",rowTitle:"{{name}} —— 在《{{project}}》里,{{by}} 分享的",notInDrive:"{{name}} 不在本地云盘里,去网页版打开",landTimeout:"{{name}} 还没同步到本地,稍后再试",folderMissing:"{{name}} 还没落到本地,先打开它所在的项目"},access:{request:"申请权限",submitted:"已提交申请,通过后会收到通知",alreadyPending:"你已经申请过了,正在等待审批",cannotResolve:"这一项没法申请权限"},chatHere:"在这个文件夹里对话"},settings:{webBase:{title:"网页端地址",desc:"「在网页打开」用的知识库网页地址;留空则用 yup-kb 插件里配置的地址"},ai:{title:"AI 与知识"},archive:{title:"AI 对话归档",desc:"勾选即同意:每 5 分钟把本机 alwith 对话(只含你的输入与 AI 的文字回复)上传到公司知识库。对话归它发生的那个项目——在某个云盘项目目录里聊的进那个项目,其余进你自己的个人知识库,别人看不到。会话目录里放一个 <uuid>.private 文件可排除该会话。只上传,不下载、不删本地;对话只在云端,不会同步到任何人的电脑上",syncNow:"立即同步",syncing:"同步中…",lastUpload:"上次上传:{{time}}",never:"从未",synced:"已归档 {{count}} 个会话"},knowledge:{title:"知识回流到对话",desc:"打开 YUP Drive 内的项目时,按 README 的标题 / 专题 / 部门检索公司知识库,把相关沉淀的摘要与链接注入新对话(失败静默,10 分钟缓存)"},server:{title:"服务器地址",desc:"知识库服务器 URL,不含 /api/v1"},ownership:{title:"继续使用该目录?",description:"{{path}} 已有云盘文件或属于其他配置。继续后将由当前账号接管;现有文件会保留并参与同步,可能上传到当前账号。请先关闭正在同步此目录的其他 App。",cancel:"取消",continue:"继续"},login:{title:"登录",desc:"粘贴个人访问令牌,然后注册此设备",tokenPlaceholder:"个人访问令牌",register:"注册此设备",loading:"已登录 · 正在读取设备信息…",loadFailed:"已登录 · 设备信息读取失败",registered:"已登录 · 设备 {{deviceId}}",unregistered:"已登录 · 设备未注册",logout:"退出登录",done:"已登录并注册设备"},sso:{title:"SSO 登录",desc:"在系统浏览器里用公司账号登录,自动注册此设备",open:"SSO 登录",waiting:"等待浏览器登录…"},collab:{title:"协同中继",desc:"Yjs 中继地址(wss://…);留空则 Drive 内的 .md 只做本地编辑"},localRoot:{title:"本地根目录",choose:"选择文件夹"},pause:{title:"暂停同步",desc:"停止上传与下载,直到继续"},roots:{title:"已同步的根",empty:"没有可用的根",readOnly:"只读",scope:{personal:"我的空间",otherPersonal:"他人的个人库",dept:"部门",team:"团队",company:"公司"}},errors:{title:"错误队列",empty:"没有错误"},deviceMismatch:"设备不匹配,重新注册此设备",guard:{title:"同步全部个人库",desc:"服务端没有提供个人库归属信息,{{count}} 个个人库区分不出来。关(推荐):只同步你固定的项目;开:全部下载到这台电脑。"},cleanup:{title:"清理未选中的本地副本",desc:"把已落盘、但当前不在同步选择集里的项目目录移到本地根同级的暂存目录 —— 是移动不是删除。",scan:"扫描",nothing:"没什么可清理的:磁盘上的目录都还在同步选择集里。",confirm:"把 {{count}} 个目录移到 {{dir}}?是移动不是删除,挪回去即可恢复。",move:"移动",cancel:"取消",done:"已把 {{count}} 个目录移到 {{dir}}",skipped:"跳过 {{count}} 个",skippedPinned:"已固定 {{count}} 个",skippedPending:"有未上传改动 {{count}} 个",failed:"{{count}} 个没能移动"},cloudOnly:{title:"重新核对仅云端文件",desc:"服务端改了某份文件「能不能下载」的判定时,文件内容并没有变,增量同步收不到通知——本地会一直停在 .yupcloud 占位(或反过来,该收走的内容还留着)。启动后第一轮会自动核对一次;怀疑手上的东西不对就点这里重来。",action:"重新核对",clean:"{{count}} 个项目核对完毕,没有需要修正的文件"},skills:{title:"已装的部门 Skill",empty:"还没有同步下来的 Skill 项目",installed:"已装",notInstalled:"未同步",auto:"自动装(公司级或本部门)",manual:"手动固定",notAuto:"未自动装(他部门)",desc:"SKILL 项目不出现在云盘列表里——它是给机器读的。公司级和你所在部门的会自动装;别的部门的可在云盘面板手动固定。"},usage:{title:"磁盘占用",desc:"看看云盘在这台电脑上占了多少、都被谁占了。只是看,不改变任何同步行为。",action:"查看",total:"共 {{size}},{{count}} 个文件",byProject:"占用最多的项目",byFile:"占用最多的文件",files:"{{count}} 个文件"},maxAutoDownload:{title:"大文件不自动下载",desc:"超过这个大小的文件不自动下载,会在文件树里标出来(带文件名和大小),点一下再拉,下完直接打开。填 0 = 全都下载。改动在下一轮同步生效:调大之后,新够得着的文件会自动补下来,不用你逐个去点。",unit:"MB"},advanced:{title:"高级(服务器地址)"}}}};function e(a="en",i="common"){return(t,s={})=>{let n=Ne[a][i];for(let o of t.replace(/^drive\./,"").split(".")){if(typeof n!=="object"||n===null||!(o in n))throw Error(`Missing Drive translation: ${i}.${t}`);n=n[o]}if(typeof n!=="string")throw Error(`Invalid Drive translation: ${t}`);return n.replaceAll(/{{(\w+)}}/g,(o,l)=>String(s[l]??""))}}
2
+ export{Ne,e};
@@ -0,0 +1,2 @@
1
+ import{e}from"./chunk-3fpcak8h.js";import{_}from"./chunk-ayvem7j8.js";import{t}from"./chunk-ws1dtw35.js";import{O}from"./chunk-pbxjprxa.js";import{useEffect as z,useEffectEvent as A,useRef as J,useState as w,useSyncExternalStore as M}from"react";import{jsxDEV as n,Fragment as Q}from"react/jsx-dev-runtime";function Ge({controller:r,scope:a,controls:{Button:c},locale:S="en",initialJob:b,onClose:U,onOpenFile:x,onOpenExternal:T}){let s=e(S),C=_(),N=[a.projectId,a.scopePath,b?.id??""].join("\x00"),[k,F]=w(()=>({controller:r,taskKey:N,task:O(r,a,b)})),d=k.task;if(k.controller!==r||k.taskKey!==N)d=O(r,a,b),F({controller:r,taskKey:N,task:d});let v=M(d.subscribe,d.getSnapshot,d.getSnapshot),{snapshot:K}=t(r),{phase:i,job:D,unsynced:m,cancelling:P}=v,[L,R]=w([]),[B,f]=w(null),[p,q]=w(!1),j=J(!1),l=J(!0),H=A((o)=>{if(o==="succeeded")C?.success(s("condense.completed",{name:a.projectName}));else C?.error(s("condense.backgroundFailed",{name:a.projectName}))});z(()=>(l.current=!0,d.notify=(o)=>H(o),d.resume(),r.request({type:"proposedCondense",projectId:a.projectId}).then((o)=>{if(o.type!=="jobs")throw Error("Invalid proposed condense response");if(l.current)R(o.data)}).catch((o)=>{if(l.current)f(String(o))}),()=>{l.current=!1}),[r,d,a.projectId,a.projectName,C,S]);let I=async(o)=>{if(j.current)return;j.current=!0,q(!0),f(null);try{await o()}catch(u){if(l.current)f(String(u))}finally{if(j.current=!1,l.current)q(!1)}},g=i==="uploading"?K?.files.find((o)=>String(o.projectId)===String(a.projectId)&&o.state==="uploading"):void 0,E=["uploading","starting","running"].includes(i),G=["succeeded","failed","cancelled"].includes(i),y=v.error||B,h=D?.result;return n("section",{className:"alwith-drive-condense",role:"dialog","aria-label":s("condense.action"),children:[n("div",{className:"alwith-drive-dialog-summary",children:[n("p",{children:s("condense.scope")},void 0,!1,void 0,this),n("p",{className:"alwith-drive-dialog-scope",children:a.projectName},void 0,!1,void 0,this),a.scopePath&&n("p",{children:a.scopePath},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i==="idle"&&n("p",{children:s("condense.description")},void 0,!1,void 0,this),(E||G)&&n("div",{className:"alwith-drive-dialog-notice",role:"status","aria-live":"polite",children:[n("strong",{children:s(P?"condense.cancelling":i==="succeeded"?"condense.succeeded":i==="failed"?"condense.failed":i==="cancelled"?"condense.cancelled":g?"condense.uploading":"condense.processing")},void 0,!1,void 0,this),g&&n("p",{className:"alwith-drive-current-file",title:g.path,children:g.path},void 0,!1,void 0,this),E&&n("p",{className:"alwith-drive-task-hint",children:s(i==="uploading"||i==="starting"?"condense.uploadHint":"condense.closeHint")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v.uploadIssue&&n("div",{role:"alert",className:"alwith-drive-dialog-notice",children:[n("p",{children:s("condense.uploadIssue")},void 0,!1,void 0,this),n("p",{children:v.uploadIssue},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y&&n("div",{role:"alert",className:"alwith-drive-dialog-notice",children:y.includes("SOURCE_IS_KNOWLEDGE_PROJECT")?n(Q,{children:[n("p",{children:s("condense.knowledgeSource")},void 0,!1,void 0,this),n("details",{children:[n("summary",{children:s("condense.errorDetails")},void 0,!1,void 0,this),n("p",{children:y},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):n("p",{children:y},void 0,!1,void 0,this)},void 0,!1,void 0,this),m&&i==="unsynced"&&n("div",{className:"alwith-drive-dialog-notice",children:[n("h4",{children:s("condense.unsynced.title",{count:m.pending})},void 0,!1,void 0,this),n("p",{children:s("condense.unsynced.desc")},void 0,!1,void 0,this),m.failed>0&&n("p",{children:s("condense.unsynced.failed",{count:m.failed})},void 0,!1,void 0,this),n("ul",{children:m.paths.map((o)=>n("li",{children:o},o,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i==="idle"&&L.map((o)=>n("div",{className:"alwith-drive-dialog-notice",children:[n("p",{children:s("condense.propose.title",{name:a.projectName})},void 0,!1,void 0,this),n("div",{className:"alwith-drive-dialog-actions",children:[n(c,{variant:"outline",disabled:p,onClick:()=>void I(async()=>{if(await r.request({type:"cancelJob",jobId:o.id}),l.current)R((u)=>u.filter((W)=>W.id!==o.id))}),children:s("condense.propose.dismiss")},void 0,!1,void 0,this),n(c,{disabled:p,onClick:()=>void I(async()=>{await r.request({type:"approveJob",jobId:o.id});let u=await r.request({type:"job",jobId:o.id});if(u.type!=="job")throw Error("Invalid approved job response");d.adopt(u.data)}),children:s("condense.propose.action")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},String(o.id),!0,void 0,this)),n("div",{className:"alwith-drive-dialog-actions",children:[n(c,{variant:"outline",onClick:U,children:i==="unsynced"?s("condense.unsynced.wait"):s("condense.close")},void 0,!1,void 0,this),i==="idle"&&n(c,{disabled:p,onClick:()=>{f(null),d.start()},children:s("condense.action")},void 0,!1,void 0,this),i==="unsynced"&&n(c,{disabled:p,onClick:()=>void d.start(!0),children:s("condense.unsynced.proceed")},void 0,!1,void 0,this),E&&n(c,{variant:"outline",disabled:P,onClick:()=>void d.cancel(),children:s("condense.cancelTask")},void 0,!1,void 0,this),i==="succeeded"&&h&&n(c,{disabled:p,onClick:()=>void I(async()=>{let o=await r.request({type:"localPath",fileId:h.knowledgeFileId});if(o.type!=="path")throw Error("Invalid draft location response");if(o.data)await x(o.data);else if(h.humanUrl)await T(h.humanUrl);else throw Error(s("condense.toast.noUrl"))}),children:s("condense.openResult")},void 0,!1,void 0,this),!v.stale&&(i==="cancelled"||i==="failed"&&D?.status!=="SUCCEEDED")&&n(c,{disabled:p,onClick:()=>{f(null),d.start()},children:s("condense.retry")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}
2
+ export{Ge};
@@ -0,0 +1,2 @@
1
+ import{e}from"./chunk-3fpcak8h.js";import{t,n,D}from"./chunk-ws1dtw35.js";import{jsxDEV as l}from"react/jsx-dev-runtime";function He({controller:i,controls:s,locale:c}){let{snapshot:o}=t(i),r=o?.pendingDeletes[0];if(!r)return null;return l(y,{controller:i,controls:s,locale:c,current:r},`${o.generation}:${r.projectId}`,!1,void 0,this)}function y({controller:i,controls:s,locale:c,current:o}){let r=e(c),{Button:d}=s,{busy:a,error:p,run:u}=n(),v=()=>u(()=>i.request({type:"cancelDeletes",projectId:o.projectId}));return l(D,{controls:s,open:!0,title:r("massDelete.title",{count:o.count}),description:r("massDelete.desc",{count:o.count,project:o.drivePath}),onOpenChange:(m)=>{if(!m&&!a)v()},children:[p&&l("p",{role:"alert",className:"alwith-drive-error",children:p},void 0,!1,void 0,this),l("div",{className:"alwith-drive-actions",children:[l(d,{type:"button",variant:"outline",autoFocus:!0,disabled:a,onClick:v,children:r("massDelete.cancel")},void 0,!1,void 0,this),l(d,{type:"button",variant:"destructive",disabled:a,onClick:()=>u(()=>i.request({type:"confirmDeletes",projectId:o.projectId})),children:r("massDelete.confirm")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}
2
+ export{He};
@@ -0,0 +1,2 @@
1
+ import{k,R}from"./chunk-njfqtysa.js";import{useEffect as T,useEffectEvent as U,useRef as z,useState as m,useSyncExternalStore as q}from"react";import{jsxDEV as o,Fragment as O}from"react/jsx-dev-runtime";var N=(s)=>s.replaceAll("\\","/").replace(/\/+$/,"");function x(s,f){let t=N(s.replace(/\.yupcloud$/,"")),n=null;for(let g of f){if(!g.localPath||!g.drivePath.trim())continue;let i=N(g.localPath);if(t!==i&&!t.startsWith(`${i}/`))continue;if(!n||i.length>n.base.length)n={root:g,base:i}}return n}function h(s,f){let t=x(s,f);if(!t)return null;let n=N(s.replace(/\.yupcloud$/,"")).slice(t.base.length+1);return{projectId:t.root.projectId,projectName:t.root.name,scopePath:n||null}}function Le({path:s,kind:f,controller:t,controls:{Button:n},locale:g="en",host:i}){let I=q(t.subscribe,t.getSnapshot,t.getSnapshot),[p,a]=m(!1),S=z(!1),y=h(s,I.snapshot?.roots??[]),w=x(s,I.snapshot?.roots??[])?.root;if(!y||!w)return null;let b=s.replace(/\.yupcloud$/,""),d=(r)=>{if(S.current)return;S.current=!0,a(!0),r().catch(i.onError).finally(()=>{S.current=!1,a(!1)})},P=async(r)=>{let l=await t.request({type:"fileRemoteId",path:b});if(l.type!=="id")throw Error("Invalid Drive file identity response");if(l.data===null)throw Error(g==="zh-CN"?"文件尚未上传,暂时没有云端链接":"Upload this file before using its cloud link");await r(l.data)},c=(r,l)=>g==="zh-CN"?l:r;return o("div",{className:"alwith-drive-file-actions",children:[o(n,{disabled:p,onClick:()=>i.onSharing(b),children:c("Sharing and permissions","共享与权限")},void 0,!1,void 0,this),o(n,{disabled:p,onClick:()=>i.onCondense(y),children:c("Condense into knowledge","沉淀为知识")},void 0,!1,void 0,this),f==="file"&&o(O,{children:[o(n,{disabled:p,onClick:()=>d(()=>P(async(r)=>{let l=t.getSnapshot().snapshot?.webBaseUrl;if(!l)throw Error(c("Drive web address is unavailable","云盘网页地址不可用"));await i.writeClipboard(k(l,r))})),children:c("Copy web link","复制网页链接")},void 0,!1,void 0,this),o(n,{disabled:p,onClick:()=>d(()=>P((r)=>i.writeClipboard(R(r)))),children:c("Copy desktop link","复制桌面链接")},void 0,!1,void 0,this),o(n,{disabled:p,onClick:()=>d(()=>P((r)=>i.onPin(b,r))),children:c("Pin document","固定文档")},void 0,!1,void 0,this),w.canWrite&&!s.endsWith(".yupcloud")&&o(n,{disabled:p,onClick:()=>d(async()=>{await i.saveDocument(b),await t.request({type:"saveVersion",path:b})}),children:c("Save version now","立即保存版本")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w.canWrite&&y.scopePath!==null&&o(n,{disabled:p,onClick:()=>i.onMove(s,f),children:c("Move to another project…","移动到其他项目…")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Fe({path:s,kind:f,controller:t,controls:{Button:n},locale:g="en",host:i,onClose:I}){let p=q(t.subscribe,t.getSnapshot,t.getSnapshot),a=N(s.replace(/\.yupcloud$/,"")),S=x(a,p.snapshot?.roots??[])?.root,y=(p.snapshot?.roots??[]).filter((e)=>e.canWrite&&e.syncEnabled&&!e.cloudOnly&&e.kind!=="SKILL"&&e.drivePath.trim()&&e.localPath&&String(e.projectId)!==String(S?.projectId)),[w,b]=m(null),d=y.find((e)=>String(e.projectId)===w),[P,c]=m([]),[r,l]=m(""),[j,L]=m(!1),[M,A]=m(null),[D,B]=m(!1),[W,E]=m(null),F=z(!1),v=(e,u)=>g==="zh-CN"?u:e,H=U(()=>d);T(()=>{let e=!0;c([]),l(""),E(null);let u=H();if(!u)return;return L(!0),t.request({type:"cloudFolders",projectId:u.projectId}).then((C)=>{if(C.type!=="cloudFolders")throw Error("Invalid destination folders response");if(e)c(C.data)}).catch((C)=>{if(e)E(String(C))}).finally(()=>{if(e)L(!1)}),()=>{e=!1}},[t,w]);let K=async()=>{if(!d||F.current||M!==null)return;F.current=!0,B(!0),E(null);try{let e=a.slice(a.lastIndexOf("/")+1),u=`${N(d.localPath)}/${r?`${r}/`:""}${e}`,C=v(`Move ${f==="directory"?"this folder and all its contents":"this file"} from ${a} to ${u}? Cloud identity, history and comments are retained. The source entry will disappear after synchronization.`,`将${f==="directory"?"此目录及其全部内容":"此文件"}从 ${a} 移动到 ${u}?云端标识、历史与评论保留,同步后原位置条目会移除。`);if(!await i.confirm(C)||!await i.prepareMove(a))return;if((await t.request({type:"moveBetweenProjects",source:a,destination:u})).type!=="done")throw Error("Invalid Drive move response");A(u),await i.onMoved(a,u),I()}catch(e){E(String(e))}finally{F.current=!1,B(!1)}};return o("section",{className:"alwith-drive-move",role:"dialog","aria-label":v("Move to another project","移动到其他项目"),children:[o("div",{className:"alwith-drive-dialog-summary",children:[o("p",{children:v("Source","来源")},void 0,!1,void 0,this),o("p",{className:"alwith-drive-dialog-scope",children:a},void 0,!1,void 0,this)]},void 0,!0,void 0,this),o("div",{className:"alwith-drive-dialog-notice",children:[o("h4",{children:v("Destination project","目标项目")},void 0,!1,void 0,this),o("div",{className:"alwith-drive-move-targets",children:y.map((e)=>o(n,{disabled:D,variant:w===String(e.projectId)?"outline":"ghost",onClick:()=>b(String(e.projectId)),children:e.name},String(e.projectId),!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y.length===0&&o("p",{children:v("No other writable project is available","暂无其他可写项目")},void 0,!1,void 0,this),d&&o("div",{className:"alwith-drive-dialog-notice",children:[o("h4",{children:v("Destination folder","目标目录")},void 0,!1,void 0,this),o("div",{className:"alwith-drive-move-targets",children:[o(n,{disabled:D||j,variant:r===""?"outline":"ghost",onClick:()=>l(""),children:[d.name," /"]},void 0,!0,void 0,this),P.map((e)=>o(n,{disabled:D||j,variant:r===e.path?"outline":"ghost",onClick:()=>l(e.path),children:e.path},String(e.folderId),!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),j&&o("p",{role:"status",children:v("Loading folders…","正在加载目录…")},void 0,!1,void 0,this),W&&o("p",{role:"alert",children:W},void 0,!1,void 0,this),M&&o("p",{role:"status",children:[v("Moved to","已移动到")," ",M]},void 0,!0,void 0,this),o("div",{className:"alwith-drive-dialog-actions",children:[o(n,{variant:"outline",disabled:D,onClick:I,children:v("Cancel","取消")},void 0,!1,void 0,this),o(n,{disabled:!d||D||j||M!==null,onClick:()=>void K(),children:v("Move","移动")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}
2
+ export{x,h,Le,Fe};
@@ -0,0 +1,2 @@
1
+ import{e}from"./chunk-3fpcak8h.js";import{Ce}from"./chunk-vpew2mps.js";import{t,n,r,I}from"./chunk-ws1dtw35.js";import{S}from"./chunk-qf5g053e.js";import{useEffect as q,useState as h}from"react";import{jsxDEV as a,Fragment as oe}from"react/jsx-dev-runtime";function Se({controller:l,controls:b,host:B,locale:W,defaultBaseUrl:E="",chooseDirectory:J,confirm:O}){let{Button:v,Input:D,Dialog:U}=b,{snapshot:o}=t(l),{busy:c,error:Q,run:u}=n(),[m,V]=h(o?.baseUrl||E),[y,A]=h(o?.localRoot??""),[M,x]=h(""),[le,j]=h(!1),[P,X]=h(null),[N,Y]=h(""),[k,Z]=h(null),[_,R]=h([]),[w,L]=h(null),[C,ee]=h(null),[g,T]=h(null),[G,F]=h(null),[te,H]=h(null),[ae,ne]=h(null),s=e(W,"settings"),K=e(W);q(()=>{V(o?.baseUrl||E),A(o?.localRoot??""),x(""),ee(null),T(null),Z(null),R([])},[o?.generation,E,o?.baseUrl,o?.localRoot]),q(()=>{if(F(null),!o?.configured)return;let i=!0;return Promise.all([l.request({type:"maxAutoDownloadMb"}),l.request({type:"configuration"})]).then(([d,p])=>{if(d.type!=="maxAutoDownloadMb"||p.type!=="configuration")throw Error("Invalid Drive preferences");if(i)Y(String(d.data)),Z(p.data),F(null)}).catch((d)=>{if(i)F(String(d))}),()=>{i=!1}},[l,o?.generation,o?.configured]),q(()=>{if(H(null),L(null),R([]),!o?.configured||!o.running)return;let i=!0;return Promise.all([l.request({type:"ownershipGuard"}),l.request({type:"skillMirrors"})]).then(([d,p])=>{if(d.type!=="ownershipGuard"||p.type!=="skillMirrors")throw Error("Invalid Drive runtime preferences");if(i)L(d.data),R(p.data),H(null)}).catch((d)=>{if(i)H(String(d))}),()=>{i=!1}},[l,o?.generation,o?.configured,o?.running]),q(()=>{if(ne(null),o?.configured||!/^https?:\/\/\S+$/.test(m)){j(!1);return}let i=!0,d=setTimeout(()=>{l.request({type:"ssoConfig",baseUrl:m.trim()}).then((p)=>{if(p.type!=="ssoConfig")throw Error("Invalid SSO configuration");if(i)j(p.data.enabled)}).catch((p)=>{if(i)j(!1),ne(String(p))})},300);return()=>{i=!1,clearTimeout(d)}},[l,o?.configured,m]);let ie=async(i)=>{let d=M.trim();x("");let p=await l.request(i?{type:"ssoLogin",baseUrl:m.trim(),localRoot:y.trim()}:{type:"login",baseUrl:m.trim(),localRoot:y.trim(),token:d});if(p.type==="rootOwnershipConfirmation"){if(!U)throw await l.request({type:"resolveRootOwnership",generation:p.data.generation,accept:!1}),Error("Drive directory confirmation requires a dialog host");X({generation:p.data.generation,localRoot:p.data.localRoot});return}await l.request({type:"start"})},z=async(i)=>{if(!P)throw Error("No pending Drive directory confirmation");try{if(await l.request({type:"resolveRootOwnership",generation:P.generation,accept:i}),i)await l.request({type:"start"})}finally{X(null)}},f=o?.running??!1;return a(oe,{children:[U&&P&&a(U,{open:!0,title:s("ownership.title"),description:s("ownership.description",{path:P.localRoot}),onOpenChange:(i)=>{if(!i&&!c)u(()=>z(!1))},children:a("div",{className:"alwith-drive-actions",children:[a(v,{variant:"outline",disabled:c,onClick:()=>u(()=>z(!1)),children:s("ownership.cancel")},void 0,!1,void 0,this),a(v,{disabled:c,onClick:()=>u(()=>z(!0)),children:s("ownership.continue")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),a("header",{children:a("h2",{children:K("title")},void 0,!1,void 0,this)},void 0,!1,void 0,this),(Q||G||te||ae)&&a("p",{role:"alert",className:"alwith-drive-error",children:Q||G||te||ae},void 0,!1,void 0,this),a("section",{className:"alwith-drive-setting",children:[a("div",{children:[a("h3",{children:s("login.title")},void 0,!1,void 0,this),a("p",{children:o?.configured?k===null?s(G?"login.loadFailed":"login.loading"):k.deviceId?s("login.registered",{deviceId:k.deviceId}):s("login.unregistered"):s("login.desc")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),o?.configured?a("div",{className:"alwith-drive-actions",children:[a(v,{variant:"outline",disabled:c,onClick:()=>u(async()=>{if(await O(s("login.logout")))await l.request({type:"logout"})}),children:s("login.logout")},void 0,!1,void 0,this),!f&&a(v,{disabled:c,onClick:()=>u(()=>l.request({type:"start"})),children:K("resume")},void 0,!1,void 0,this)]},void 0,!0,void 0,this):a("form",{className:"alwith-drive-form",onSubmit:(i)=>{i.preventDefault(),u(()=>ie(!1))},children:[a(D,{type:"password",autoComplete:"off","aria-label":s("login.tokenPlaceholder"),placeholder:s("login.tokenPlaceholder"),value:M,onChange:(i)=>x(i.target.value)},void 0,!1,void 0,this),a("div",{className:"alwith-drive-actions",children:[a(v,{type:"submit",disabled:c||!M.trim()||!m.trim()||!y.trim(),children:s("login.register")},void 0,!1,void 0,this),le&&a(v,{type:"button",variant:"outline",disabled:c||!y.trim(),onClick:()=>u(()=>ie(!0)),children:s("sso.open")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a("section",{className:"alwith-drive-setting",children:[a("div",{children:[a("h3",{children:s("localRoot.title")},void 0,!1,void 0,this),a("p",{children:y},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("div",{className:"alwith-drive-actions",children:[!o?.configured&&a(D,{value:y,"aria-label":s("localRoot.title"),onChange:(i)=>A(i.target.value)},void 0,!1,void 0,this),J&&a(v,{variant:"outline",disabled:c,onClick:()=>u(async()=>{let i=await J();if(!i)return;if(o?.configured){if(!k)throw Error("Drive configuration is still loading");await l.request({type:"reconfigure",localRoot:i,userName:k.userName??""})}A(i)}),children:s("localRoot.choose")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),o?.configured&&a(oe,{children:[a("section",{className:"alwith-drive-setting",children:[a("div",{children:[a("h3",{children:s("maxAutoDownload.title")},void 0,!1,void 0,this),a("p",{children:s("maxAutoDownload.desc")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("div",{className:"alwith-drive-actions",children:[a(D,{type:"number",min:0,max:1048576,step:1,"aria-label":s("maxAutoDownload.title"),value:N,onChange:(i)=>Y(i.target.value),onBlur:()=>{if(/^\d+$/.test(N)&&Number(N)<=1048576)u(()=>l.request({type:"setMaxAutoDownloadMb",megabytes:Number(N)}))},disabled:c},void 0,!1,void 0,this),a("small",{children:s("maxAutoDownload.unit")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a("section",{className:"alwith-drive-setting",children:[a("div",{children:[a("h3",{children:s("pause.title")},void 0,!1,void 0,this),a("p",{children:s("pause.desc")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(I,{controls:b,"aria-label":s("pause.title"),checked:o.status?.state.kind==="paused",disabled:c||!f,onCheckedChange:(i)=>u(()=>l.request({type:"pause",paused:i}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w&&w.unknownPersonalRoots>w.threshold&&a("section",{className:"alwith-drive-setting",children:[a("div",{children:[a("h3",{children:s("guard.title")},void 0,!1,void 0,this),a("p",{children:s("guard.desc",{count:w.unknownPersonalRoots})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(I,{controls:b,"aria-label":s("guard.title"),checked:w.syncAllPersonal,disabled:c,onCheckedChange:(i)=>{let d=i;u(async()=>{if(d&&!await O(K("panel.guard.confirmDesc",{count:w.unknownPersonalRoots})))return;await l.request({type:"syncAllPersonal",enabled:d}),L({...w,syncAllPersonal:d,active:!d})})}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("details",{children:[a("summary",{children:s("roots.title")},void 0,!1,void 0,this),o.roots.filter((i)=>i.kind!=="SKILL"&&i.projectKey!=="ai-session-archive").map((i)=>a("label",{className:"alwith-drive-setting",children:[a("span",{children:[i.drivePath||i.name,!i.canWrite&&a("small",{children:[" · ",s("roots.readOnly")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a(I,{controls:b,"aria-label":i.name,checked:i.selected,disabled:c||!f||!Ce(i),onCheckedChange:(d)=>u(()=>l.request({type:"pin",projectId:i.projectId,pinned:d}))},void 0,!1,void 0,this)]},String(i.projectId),!0,void 0,this))]},void 0,!0,void 0,this),a("section",{className:"alwith-drive-setting",children:[a("div",{children:[a("h3",{children:s("usage.title")},void 0,!1,void 0,this),a("p",{children:s("usage.desc")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(v,{variant:"outline",disabled:c||!f,onClick:()=>u(async()=>{let i=await l.request({type:"diskUsage",limit:20});if(i.type!=="diskUsage")throw Error("Invalid disk usage response");ee(i.data)}),children:s("usage.action")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&a("section",{children:[a("p",{children:s("usage.total",{size:S(C.totalBytes),count:C.totalFiles})},void 0,!1,void 0,this),a("h4",{children:s("usage.byProject")},void 0,!1,void 0,this),C.projects.map((i)=>a(v,{variant:"ghost",className:"alwith-drive-row",onClick:()=>u(()=>r(B).onRevealPath(i.localPath)),children:[a("span",{children:i.name},void 0,!1,void 0,this),a("small",{children:[S(i.bytes)," · ",s("usage.files",{count:i.files})]},void 0,!0,void 0,this)]},String(i.projectId),!0,void 0,this)),a("h4",{children:s("usage.byFile")},void 0,!1,void 0,this),C.files.map((i)=>a(v,{variant:"ghost",className:"alwith-drive-row",onClick:()=>u(()=>r(B).onRevealPath(i.localPath)),children:[a("span",{children:[i.projectName," / ",i.path]},void 0,!0,void 0,this),a("small",{children:S(i.bytes)},void 0,!1,void 0,this)]},i.localPath,!0,void 0,this))]},void 0,!0,void 0,this),a("section",{className:"alwith-drive-setting",children:[a("div",{children:[a("h3",{children:s("cleanup.title")},void 0,!1,void 0,this),a("p",{children:s("cleanup.desc")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(v,{variant:"outline",disabled:c||!f,onClick:()=>u(async()=>{let i=await l.request({type:"cleanupScan"});if(i.type!=="cleanup")throw Error("Invalid cleanup response");T(i.data)}),children:s("cleanup.scan")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g&&a("section",{children:[!g.candidates.length&&!g.moved.length&&a("p",{children:s("cleanup.nothing")},void 0,!1,void 0,this),g.candidates.map((i)=>a("p",{children:[i.drivePath," · ",i.files]},i.localPath,!0,void 0,this)),g.skipped.length>0&&a("p",{children:[s("cleanup.skipped",{count:g.skipped.length}),":"," ",g.skipped.map((i)=>`${i.name} (${s(i.reason==="pinned"?"cleanup.skippedPinned":"cleanup.skippedPending",{count:1})})`).join(", ")]},void 0,!0,void 0,this),g.failed.map((i)=>a("p",{className:"alwith-drive-error",children:i},i,!1,void 0,this)),g.moved.length>0?a("p",{children:s("cleanup.done",{count:g.moved.length,dir:g.stagingDir})},void 0,!1,void 0,this):g.candidates.length>0&&a(v,{variant:"outline",disabled:c,onClick:()=>u(async()=>{if(!await O(s("cleanup.confirm",{count:g.candidates.length,dir:g.stagingDir})))return;let i=await l.request({type:"cleanup",paths:g.candidates.map((d)=>d.localPath)});if(i.type!=="cleanup")throw Error("Invalid cleanup response");T(i.data)}),children:s("cleanup.move")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("section",{className:"alwith-drive-setting",children:[a("div",{children:[a("h3",{children:s("cloudOnly.title")},void 0,!1,void 0,this),a("p",{children:s("cloudOnly.desc")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(v,{variant:"outline",disabled:c||!f,onClick:()=>u(()=>l.request({type:"recheckCloudOnly"})),children:s("cloudOnly.action")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),B?.integrations,a("section",{children:[a("h3",{children:s("skills.title")},void 0,!1,void 0,this),a("p",{children:s("skills.desc")},void 0,!1,void 0,this),_.map((i)=>a("div",{className:"alwith-drive-setting",children:[a("div",{children:[a("strong",{children:i.name},void 0,!1,void 0,this),a("p",{children:i.skillsPath??i.localPath},void 0,!1,void 0,this),a("small",{children:[s(i.installed?"skills.installed":"skills.notInstalled")," ·"," ",s(i.pinned?"skills.manual":i.autoInstalled?"skills.auto":"skills.notAuto")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a(I,{controls:b,checked:i.autoInstalled||i.pinned,"aria-label":i.name,disabled:c||!f||i.autoInstalled,onCheckedChange:(d)=>{let p=d;u(async()=>{await l.request({type:"pin",projectId:i.projectId,pinned:p});let se=await l.request({type:"skillMirrors"});if(se.type!=="skillMirrors")throw Error("Invalid skill installation response");R(se.data)})}},void 0,!1,void 0,this)]},String(i.projectId),!0,void 0,this)),!_.length&&a("p",{children:s("skills.empty")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a("details",{children:[a("summary",{children:s("advanced.title")},void 0,!1,void 0,this),a("label",{children:[s("server.title"),a(D,{type:"url",value:m,disabled:c||o?.configured,onChange:(i)=>V(i.target.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("p",{children:s("server.desc")},void 0,!1,void 0,this),o?.webBaseUrl&&a("p",{children:[s("webBase.title"),": ",o.webBaseUrl]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}
2
+ export{Se};
@@ -0,0 +1,3 @@
1
+ var dt=".yuplink";function X(n){return n.toLowerCase().endsWith(".yuplink")}function _e(n){return X(n)?n.slice(0,-8):n}function ze(n){let t;try{t=JSON.parse(n)}catch{return null}if(t===null||typeof t!=="object"||Array.isArray(t))return null;let l=t,{targetFileId:r,name:e,webUrl:i}=l;if(!(typeof r==="number"&&Number.isFinite(r)||typeof r==="string"&&r!==""))return null;if(typeof e!=="string"||e==="")return null;if(typeof i!=="string")return null;return{targetFileId:r,name:e,webUrl:i}}function Ue(n){return`${JSON.stringify({targetFileId:n.targetFileId,name:n.name,webUrl:n.webUrl},null,2)}
2
+ `}
3
+ export{dt,X,_e,ze,Ue};
@@ -0,0 +1,2 @@
1
+ import{e}from"./chunk-3fpcak8h.js";var m={en:{"frontmatter.title":"Properties","frontmatter.count":"{{count}} items","frontmatter.saveVersion":"Save version now","frontmatter.saving":"Saving…","frontmatter.saved":"Saved as a new version","frontmatter.saveFailed":"Failed to save version","frontmatter.notInDrive":"This file is not in the Drive index","frontmatter.listPlaceholder":"Separate values with 、","frontmatter.remove":"Remove property","frontmatter.addCustom":"Custom…","collab.live":"Live collaboration","collab.readOnly":"Read only","collab.alone":"No other collaborators yet"},"zh-CN":{"frontmatter.title":"属性","frontmatter.count":"{{count}} 项","frontmatter.saveVersion":"立即保存版本","frontmatter.saving":"保存中…","frontmatter.saved":"已保存为新版本","frontmatter.saveFailed":"保存版本失败","frontmatter.notInDrive":"此文件不在云盘索引中","frontmatter.listPlaceholder":"使用顿号分隔多个值","frontmatter.remove":"移除属性","frontmatter.addCustom":"自定义…","collab.live":"实时协作","collab.readOnly":"只读","collab.alone":"暂无其他协作者"}};function Te(n){let l=e(n);return(r,a={})=>{if(!r.startsWith("editor.markdown."))return l(r,Object.fromEntries(Object.entries(a).map(([s,t])=>[s,typeof t==="number"?t:String(t)])));let i=m[n][r.slice(16)];if(!i)throw Error(`Missing Drive content translation: ${r}`);return i.replaceAll(/\{\{(\w+)\}\}/g,(s,t)=>{let o=a[t];return typeof o==="string"||typeof o==="number"?String(o):`{{${t}}}`})}}
2
+ export{Te};
@@ -0,0 +1,2 @@
1
+ import{createContext as d,useContext as f,useEffect as a,useMemo as p}from"react";import{jsxDEV as c}from"react/jsx-dev-runtime";var i=d(null);function Ve({notify:e,children:t}){let s=p(()=>{let r=new Map;return{success:(o)=>e.success(o),error:(o)=>{let n=Date.now();for(let[l,N]of r)if(n-N>=30000)r.delete(l);if(r.has(o))return;r.set(o,n),e.error(o)}}},[e]);return c(i.Provider,{value:s,children:t},void 0,!1,void 0,this)}function _(){return f(i)}function u({message:e}){let t=_();return a(()=>{if(e&&t)t.error(e)},[e,t]),!t&&e?c("p",{role:"alert",className:"alwith-drive-error",children:e},void 0,!1,void 0,this):null}
2
+ export{Ve,_,u};
@@ -0,0 +1,2 @@
1
+ import{w,fe}from"./chunk-qabnvepm.js";import{o,i,s}from"./chunk-mafn36hy.js";import{useEffect as y,useMemo as v,useState as g}from"react";import{jsxDEV as a,Fragment as x}from"react/jsx-dev-runtime";function J({mention:m,onPick:d}){let{t:l}=i("common"),[c,u]=g([]),[n,e]=g(0),t=o(),r=v(()=>fe(t.searchUsers,u,t.onError),[t.searchUsers,t.onError]);y(()=>()=>r.cancel(),[r]);let f=m?.query??null;if(y(()=>{if(f===null){r.cancel(),u([]);return}e(0),r.query(f)},[f,r]),m===null)return null;return a("div",{"data-testid":"mention-picker",className:"bg-popover mt-1 max-h-40 overflow-y-auto rounded-md border p-1 shadow-md",children:c.length===0?a("div",{className:"text-muted-foreground px-2 py-1.5 text-[11px]",children:m.query===""?l("drive.comments.mention.hint"):l("drive.comments.mention.empty")},void 0,!1,void 0,this):c.map((p,h)=>a("button",{type:"button",className:s("flex w-full items-baseline gap-1.5 rounded px-2 py-1 text-start text-[11px]",h===n?"bg-accent":"hover:bg-accent/60"),onMouseEnter:()=>e(h),onMouseDown:(b)=>{b.preventDefault(),d(p)},children:[a("span",{className:"truncate font-medium",children:w(p)},void 0,!1,void 0,this),a("span",{className:"text-muted-foreground truncate text-[10px]",children:p.employeeNo},void 0,!1,void 0,this)]},String(p.id),!0,void 0,this))},void 0,!1,void 0,this)}function Q({body:m,mentions:d}){let l=(d??[]).map(w).filter((e)=>e.length>0);if(l.length===0)return a(x,{children:m},void 0,!1,void 0,this);let c=[...new Set(l)].toSorted((e,t)=>t.length-e.length),u=[],n=m;while(n.length>0){let e=null;for(let t of c){let r=n.indexOf(`@${t}`);if(r===-1)continue;if(e===null||r<e.index)e={index:r,name:t}}if(e===null)break;if(e.index>0)u.push(n.slice(0,e.index));u.push({name:e.name}),n=n.slice(e.index+1+e.name.length)}if(n.length>0)u.push(n);return a(x,{children:u.map((e,t)=>typeof e==="string"?a("span",{children:e},t,!1,void 0,this):a("span",{"data-testid":"mention-chip",className:"bg-primary/15 text-primary rounded px-0.5 font-medium",children:`@${e.name}`},t,!1,void 0,this))},void 0,!1,void 0,this)}
2
+ export{J,Q};
@@ -0,0 +1,2 @@
1
+ var Je={maxEntries:20000,maxDepth:6},d=new Set([".git","node_modules",".venv","__pycache__",".DS_Store","target","dist"]);async function be(i,o,a={}){let s=a.maxEntries??Je.maxEntries,h=a.maxDepth??Je.maxDepth,e=[],t=[],c=!1,p=i.filter((n)=>n.selected&&n.localPath).map((n)=>({dir:n.localPath,depth:0,projectName:n.name,rootPath:n.localPath}));while(p.length>0){if(e.length>=s){c=!0;break}let n=[];for(let{dir:m,depth:y,projectName:D,rootPath:u}of p){if(e.length>=s){c=!0;break}let g;try{g=await o(m)}catch(r){t.push({path:m,message:r instanceof Error?r.message:String(r)});continue}for(let r of g){if(r.name.startsWith("."))continue;if(r.isDirectory&&d.has(r.name))continue;if(e.length>=s){c=!0;break}let l=`${m}/${r.name}`;if(e.push({name:r.name,path:l,projectName:D,relPath:l.startsWith(`${u}/`)?l.slice(u.length+1):r.name,isDirectory:r.isDirectory}),r.isDirectory&&y+1<h)n.push({dir:l,depth:y+1,projectName:D,rootPath:u})}}p=n}return{entries:e,truncated:c,errors:t}}function it(i,o){let a=i.name.toLowerCase();if(a.startsWith(o))return 0;if(a.includes(o))return 1;if(`${i.projectName}/${i.relPath}`.toLowerCase().includes(o))return 2;return null}function we(i,o,a=50){let s=o.trim().toLowerCase();if(!s)return[];let h=[];for(let e of i){let t=it(e,s);if(t!==null)h.push({entry:e,score:t})}return h.sort((e,t)=>{if(e.score!==t.score)return e.score-t.score;if(e.entry.isDirectory!==t.entry.isDirectory)return e.entry.isDirectory?1:-1;let c=e.entry.relPath.split("/").length-t.entry.relPath.split("/").length;if(c!==0)return c;return e.entry.name.localeCompare(t.entry.name)}),h.slice(0,a).map((e)=>e.entry)}
2
+ export{Je,be,it,we};
@@ -0,0 +1,2 @@
1
+ async function Ae(t,e,i){let n=t.getSnapshot().snapshot,d=e.replaceAll("\\","/"),s=n?.localRoot.replaceAll("\\","/").replace(/\/$/,""),o=e.endsWith(".yupcloud");if(!n?.configured||!s||!d.startsWith(`${s}/`)){if(o)throw Error("Start the Drive profile that owns this cloud placeholder");return e}if(!n.running)throw Error("Start Drive before opening its files");let a=await t.request({type:"file",path:e});if(a.type!=="file")throw Error("Invalid Drive file response");let r=a.data;if(!r){if(o)throw Error("This placeholder is no longer in the Drive index");return e}if(["cloudOnly","forbidden"].includes(r.state))throw Error("This file is available only in the cloud");let l=e,c=r.size??0;if(o||r.state==="notDownloaded"){if(!await i.confirmDownload(r.path,c))return null;await t.request({type:"download",projectId:r.projectId,path:r.path}),l=o?e.slice(0,-9):e}if(c>i.maxEditorBytes)return await i.openExternal(l),null;return l}
2
+ export{Ae};
@@ -0,0 +1,2 @@
1
+ import{e}from"./chunk-3fpcak8h.js";import{n,c}from"./chunk-ws1dtw35.js";import{useEffect as K,useRef as te,useState as o}from"react";import{jsxDEV as s,Fragment as O}from"react/jsx-dev-runtime";function We({controller:u,path:h,controls:D,confirm:U,locale:X="en",host:B}){let{Button:v,Input:Y}=D,a=e(X),[L,C]=o([]),[F,M]=o(h),[d,A]=o(null),[b,R]=o(null),[p,Z]=o("USER"),[f,E]=o(""),[W,k]=o([]),[I,T]=o(null),[G,ee]=o("VIEW"),[q,w]=o(null),[V,N]=o(null),[S,_]=o(!0),m=te(0),{busy:g,error:H,run:y}=n();K(()=>{let t=m,l=++m.current;return _(!0),R(null),A(null),C([]),M(h),w(null),N(null),T(null),E(""),(async()=>{let r=await u.request({type:"grantTarget",path:h.replace(/\.yupcloud$/,"")});if(r.type!=="grantTarget")throw Error("Invalid sharing target");if(l!==m.current)return;if(A(r.data),r.data){let i=await u.request({type:"grants",target:r.data});if(i.type!=="grants")throw Error("Invalid sharing response");if(l===m.current)R(i.data)}})().catch((r)=>{if(l===m.current)N(String(r))}).finally(()=>{if(l===m.current)_(!1)}),()=>{t.current++}},[u,h]),K(()=>{if(k([]),T(null),!f.trim()||p==="ALL")return;let t=!0,l=setTimeout(()=>{u.request({type:p==="USER"?"searchUsers":"searchDepartments",query:f.trim()}).then((r)=>{if(!t)return;if(r.type==="users")k(r.data.map((i)=>({id:i.id,name:i.name??i.employeeNo??String(i.id)})));else if(r.type==="departments")k(r.data.map((i)=>({id:i.id,name:i.path??i.name})));else throw Error("Invalid collaborator search response")}).catch((r)=>{if(t)N(String(r))})},250);return()=>{t=!1,clearTimeout(l)}},[u,f,p]);let J=async(t,l,r=!1)=>{let i=m.current,z=await u.request({type:"grants",target:t});if(i!==m.current)return;if(z.type!=="grants")throw Error("Invalid sharing source response");if(r)C(L.slice(0,-1));else if(d)C([...L,{target:d,label:F}]);A(t),M(l),R(z.data),w(null),T(null),E("")},P=async(t)=>{let l=m.current,r=await u.request(t);if(l!==m.current)return;if(r.type!=="grantWrite")throw Error("Invalid sharing update");if(r.data.kind==="applied")R(r.data.list),T(null),E(""),w(null);else if(r.data.kind==="custom")w(a("grants.customHint"));else w(a("grants.inheritedRemove.title",{name:"",source:r.data.inheritedFrom.display??a("grants.inheritedRemove.unknown")}))},Q=u.getSnapshot().snapshot?.roots.filter((t)=>t.drivePath&&(h===t.localPath||h.startsWith(`${t.localPath}/`))).toSorted((t,l)=>l.localPath.length-t.localPath.length)[0],j=b?.callerLevel==="MANAGE",x=["VIEW","EDIT","MANAGE"].map((t)=>({value:t,label:a(`grants.level.${t}`)}));return s("div",{className:"alwith-drive alwith-drive-sharing","aria-busy":g||S,children:[s("h3",{children:a("grants.title")},void 0,!1,void 0,this),s("p",{children:F},void 0,!1,void 0,this),L.length>0&&s(v,{variant:"ghost",disabled:g,onClick:()=>y(async()=>{let t=L.at(-1);if(t)await J(t.target,t.label,!0)}),children:a("grants.back",{name:L.at(-1)?.label??h})},void 0,!1,void 0,this),(H||V)&&s("p",{className:"alwith-drive-error",role:"alert",children:H||V},void 0,!1,void 0,this),S&&s("p",{children:a("grants.loading")},void 0,!1,void 0,this),q&&s("p",{role:"status",children:q},void 0,!1,void 0,this),!S&&!d&&s("p",{children:a("grants.notInCloud")},void 0,!1,void 0,this),b&&s(O,{children:[s("h4",{children:a("grants.who.title")},void 0,!1,void 0,this),!j&&s("p",{children:a("grants.readOnly")},void 0,!1,void 0,this),(b.implicit??[]).map((t,l)=>s("div",{className:"alwith-drive-row",children:[s("span",{children:[t.subjectDisplay,s("small",{children:a(`grants.implicit.${["PROJECT_MANAGER","OWNER","FOLDER_CREATOR","GLOBAL_ADMIN"].includes(t.reason??"")?t.reason:"other"}`)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),s("small",{children:a(`grants.level.${t.level}`)},void 0,!1,void 0,this)]},`implicit:${l}`,!0,void 0,this)),(b.grants??[]).map((t)=>s("div",{className:"alwith-drive-row",children:[s("span",{children:[t.subjectDisplay??(t.subjectType==="ALL"?a("grants.add.all"):String(t.subjectId)),t.inherited&&(t.sourceResourceId!=null&&(t.source==="FILE"||t.source==="FOLDER")?s(v,{variant:"ghost",disabled:g,onClick:()=>y(()=>J({kind:t.source,id:t.sourceResourceId},t.sourceDisplay??String(t.sourceResourceId))),children:a("grants.who.inheritedFrom",{source:t.sourceDisplay??String(t.sourceResourceId)})},void 0,!1,void 0,this):s("small",{children:a("grants.who.inheritedFrom",{source:t.sourceDisplay??a("grants.who.space")})},void 0,!1,void 0,this)),t.level==="CUSTOM"&&s("small",{title:(t.actions??[]).join(", "),children:a("grants.customHint")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j&&t.editable&&!t.inherited&&t.level!=="CUSTOM"&&["USER","DEPT","ALL"].includes(t.subjectType)&&d?s(O,{children:[s(c,{controls:D,"aria-label":`${t.subjectDisplay??t.subjectId} ${a("grants.level.label")}`,value:t.level,options:x,disabled:g,onValueChange:(l)=>y(()=>P({type:"setGrant",target:d,request:{subjectType:t.subjectType,subjectId:t.subjectId,level:l}}))},void 0,!1,void 0,this),s(v,{variant:"ghost",disabled:g,onClick:()=>y(async()=>{if(await U(`${a("grants.remove")} ${t.subjectDisplay??t.subjectId}?`))await P({type:"removeGrant",target:d,subjectType:t.subjectType,subjectId:t.subjectId})}),children:a("grants.remove")},void 0,!1,void 0,this)]},void 0,!0,void 0,this):s("small",{children:a(`grants.level.${t.level}`)},void 0,!1,void 0,this)]},`${t.subjectType}:${t.subjectId}`,!0,void 0,this)),!b.grants?.length&&!b.implicit?.length&&s("p",{children:a("grants.who.empty")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j&&d&&s("section",{className:"alwith-drive-form",children:[s("h4",{children:a("grants.add.title")},void 0,!1,void 0,this),s(c,{controls:D,value:p,onValueChange:(t)=>{Z(t),E("")},options:["USER","DEPT","ALL"].map((t)=>({value:t,label:a(`grants.add.${t}`)}))},void 0,!1,void 0,this),p==="ALL"?s("p",{children:a("grants.add.allDesc")},void 0,!1,void 0,this):s(O,{children:[s(Y,{value:f,onChange:(t)=>E(t.target.value),"aria-label":a(p==="USER"?"grants.add.searchUser":"grants.add.searchDept"),placeholder:a(p==="USER"?"grants.add.searchUser":"grants.add.searchDept")},void 0,!1,void 0,this),s("div",{children:[W.map((t)=>s(v,{variant:"ghost","aria-pressed":I?.id===t.id,onClick:()=>T(t),children:t.name},String(t.id),!1,void 0,this)),f.trim()&&!W.length&&s("p",{children:a("grants.add.empty")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I&&s("p",{children:a("grants.add.picked",{name:I.name})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),s(c,{controls:D,"aria-label":a("grants.level.label"),value:G,onValueChange:(t)=>ee(t),options:x},void 0,!1,void 0,this),s(v,{disabled:g||p!=="ALL"&&!I,onClick:()=>y(async()=>{let t=p==="ALL"?{id:0,name:a("grants.add.all")}:I;if(!t)throw Error("Select a collaborator");if(p==="ALL"&&!await U(`${a("grants.add.allDesc")} · ${a(`grants.level.${G}`)}?`))return;await P({type:"setGrant",target:d,request:{subjectType:p,subjectId:t.id,level:G}})}),children:a("grants.add.submit")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!j&&!S&&(d?.kind==="FILE"||Q)&&s(v,{variant:"outline",disabled:g,onClick:()=>y(async()=>{let t=await u.request(d?.kind==="FILE"?{type:"requestAccess",requestType:"FILE_ACCESS",targetId:d.id,message:null}:{type:"requestAccess",requestType:"PROJECT_JOIN",targetId:Q.projectId,message:null});if(t.type!=="accessRequest")throw Error("Invalid access request response");w(a(t.data==="submitted"?"access.submitted":"access.alreadyPending"))}),children:a("access.request")},void 0,!1,void 0,this),q&&B&&u.getSnapshot().snapshot?.webBaseUrl&&s(v,{variant:"outline",onClick:()=>y(()=>B.onOpenExternal(u.getSnapshot().snapshot.webBaseUrl)),children:a("panel.openWeb")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
2
+ export{We};
@@ -0,0 +1,4 @@
1
+ import{v,q}from"./chunk-pc21jzd8.js";import{Plugin as p,PluginKey as f}from"@milkdown/prose/state";import{Decoration as l,DecorationSet as m}from"@milkdown/prose/view";var E=new f("yupCommentAnchors");function oe(){return{view:null,onMarkerClick:()=>{},onAnchoredChange:()=>{}}}function F(n){let t=[],e="";return n.descendants((o,c)=>{if(o.isText){let r=o.text??"";if(r.length===0)return!1;return t.push({start:e.length,end:e.length+r.length,origin:c}),e+=r,!1}if(o.isBlock&&e.length>0&&!e.endsWith(`
2
+ `))t.push({start:e.length,end:e.length+1,origin:c}),e+=`
3
+ `;return!0}),{text:e,segments:t}}function A(n,t,e){if(t.length===0)return{decorations:m.empty,anchored:[]};let{text:o,segments:c}=F(n),r=[],a=[];for(let i of t){let h=v(o,i.quote,i.quoteOffset);if(h===null)continue;let u=q(c,h.start),d=q(c,h.end);if(u===null||d===null||d<=u)continue;r.push(l.inline(u,d,{class:"yup-comment-highlight","data-thread-id":i.threadId})),r.push(l.widget(d,()=>{let s=document.createElement("span");return s.className="yup-comment-marker",s.dataset.threadId=i.threadId,s.textContent=String(i.index),s.addEventListener("mousedown",(g)=>g.preventDefault()),s.addEventListener("click",()=>e.onMarkerClick(i.threadId)),s})),a.push(i.threadId)}return{decorations:m.create(n,r),anchored:a}}function ie(n){let t="";return new p({key:E,state:{init:()=>({anchors:[],decorations:m.empty,anchored:[]}),apply(e,o,c,r){let a=e.getMeta(E);if(a===void 0&&!e.docChanged)return o;let i=a??o.anchors;return{anchors:i,...A(r.doc,i,n)}}},props:{decorations:(e)=>E.getState(e)?.decorations??m.empty},view:(e)=>(n.view=e,{update(o){let c=E.getState(o.state)?.anchored??[],r=c.join(",");if(r===t)return;t=r,n.onAnchoredChange(c)},destroy(){n.view=null}})})}function ae(n,t){n.dispatch(n.state.tr.setMeta(E,t))}function se(n,t){for(let e of n){let o=e.end-e.start;if(t>=e.origin&&t<e.origin+o)return e.start+(t-e.origin)}return null}
4
+ export{E,oe,F,ie,ae,se};
@@ -0,0 +1,2 @@
1
+ import{v}from"./chunk-pc21jzd8.js";import{y}from"./chunk-zf44znpx.js";import{f}from"./chunk-rg43mads.js";import{useCallback as I,useEffect as C,useRef as w,useState as c}from"react";import{jsxDEV as x,Fragment as E}from"react/jsx-dev-runtime";var k=1000;function G({iframeRef:r}){let[l,i]=c(null),[m,g]=c(null),[b,A]=c(null),[S,M]=c(new Set),h=w(null),q=w([]),o=I((n)=>{r.current?.contentWindow?.postMessage(n,"*")},[r]),{source:O,anchors:a}=f({selection:m,onSelectionUsed:()=>g(null),onFocusQuote:(n)=>o({type:"yup:scroll-to",threadId:n}),focusRequest:b,anchoredThreadIds:S}),d=O.context;q.current=a;let s=I((n)=>{let u=h.current;if(u===null)return;let e=n.flatMap((t)=>{let p=v(u,t.quote,t.quoteOffset);if(p===null)return[];return[{threadId:t.threadId,index:t.index,start:p.start,end:p.end}]});o({type:"yup:anchors",anchors:e})},[o]);if(C(()=>{if(d===null)return;let n=(u)=>{if(u.source!==r.current?.contentWindow)return;let e=u.data;if(e===null||typeof e!=="object"||typeof e.type!=="string")return;switch(e.type){case"yup:ready":case"yup:flat":if(typeof e.text!=="string")return;h.current=e.text,s(q.current);return;case"yup:anchored":if(!Array.isArray(e.threadIds)||!e.threadIds.every((t)=>typeof t==="string"))return;M(new Set(e.threadIds));return;case"yup:marker-click":if(typeof e.threadId!=="string")return;A((t)=>({threadId:e.threadId,nonce:(t?.nonce??0)+1}));return;case"yup:selection":{if(typeof e.quote!=="string"||e.quote.length===0||e.quote.length>k||!e.rect||!Number.isFinite(e.rect.top)||!Number.isFinite(e.rect.left)||e.quoteOffset!=null&&(!Number.isInteger(e.quoteOffset)||e.quoteOffset<0)){i(null);return}let t=r.current?.getBoundingClientRect();if(t===void 0)return;i({quote:e.quote,quoteOffset:e.quoteOffset??null,rect:{top:e.rect.top+t.top,left:e.rect.left+t.left}});return}}};return window.addEventListener("message",n),o({type:"yup:flatten"}),()=>window.removeEventListener("message",n)},[d,r,s,o]),C(()=>{s(a)},[s,a]),d===null)return null;return x(E,{children:l!==null&&m===null&&x(y,{rect:l.rect,onClick:()=>{g(l),i(null)}},void 0,!1,void 0,this)},void 0,!1,void 0,this)}
2
+ export{G};
@@ -0,0 +1,2 @@
1
+ import{e}from"./chunk-3fpcak8h.js";import{h}from"./chunk-563we221.js";import{SparklesIcon as H}from"lucide-react";import{useCallback as O,useEffect as M,useRef as I,useState as E,useSyncExternalStore as _}from"react";import{jsxDEV as o}from"react/jsx-dev-runtime";var Xe=2592000000;async function et(l,n,r,v=Date.now()){if((await n.readSnooze(r)??0)>v)return null;let s=await l.request({type:"proposedCondense",projectId:r});if(s.type!=="jobs")throw Error("Invalid proposed condense response");return s.data.find((c)=>c.status==="PROPOSED"&&(c.type??"condense")==="condense")??null}async function tt(l,n,r,v,s=Date.now()){let i=(await Promise.allSettled([l.request({type:"cancelJob",jobId:v}).then((d)=>{if(d.type!=="done")throw Error("Invalid proposal cancellation response")}),n.writeSnooze(r,s+Xe)])).flatMap((d)=>d.status==="rejected"?[d.reason]:[]);if(i.length)throw AggregateError(i,i.map(String).join("; "))}function je({cwd:l,controller:n,controls:{Button:r},locale:v="en",host:s,onCondense:c,onBackgroundError:i}){let d=_(n.subscribe,n.getSnapshot,n.getSnapshot),u=l?h(l,d.snapshot?.roots??[]):null,t=u?.projectId??null,R=u?.projectName??"",p=e(v),[P,S]=E(null),f=P&&String(P.projectId)===String(t)?P.job:null,[j,k]=E(!1),[z,x]=E(null),[q,N]=E(null),w=I(0),C=I(t);C.current=t;let y=I(!1),a=I(!1),b=O(()=>{if(y.current)return;let g=++w.current;if(t===null){S(null);return}et(n,s,t).then((m)=>{if(a.current&&g===w.current)S(m?{projectId:t,job:m}:null)}).catch(i)},[n,s,t,i]);M(()=>{let g=w;return a.current=!0,S(null),x(null),N(null),b(),window.addEventListener("focus",b),()=>{a.current=!1,g.current++,window.removeEventListener("focus",b)}},[b]);let J=async(g)=>{if(!f||!u||t===null||y.current)return;let m=t;y.current=!0,w.current++,k(!0),x(null),N(null);try{if(g){if((await n.request({type:"approveJob",jobId:f.id})).type!=="done")throw Error("Invalid proposal approval response");let L=await n.request({type:"job",jobId:f.id});if(L.type!=="job")throw Error("Invalid approved condense job response");if(a.current&&String(C.current)===String(m))S(null),c({...u,scopePath:null},L.data)}else if(S(null),await tt(n,s,t,f.id),a.current&&String(C.current)===String(m))N(p("condense.propose.dismissed",{name:R}))}catch(D){if(a.current&&String(C.current)===String(m))x(String(D));else i(D)}finally{if(y.current=!1,a.current)k(!1)}};if(!u)return null;return o("div",{className:"alwith-drive-chat-condense",children:[f?o("div",{role:"status",title:f.message??void 0,className:"text-muted-foreground flex flex-wrap items-center gap-3 text-xs",children:[o(H,{className:"size-3.5 shrink-0","aria-hidden":"true"},void 0,!1,void 0,this),o("span",{children:p("condense.propose.title",{name:R})},void 0,!1,void 0,this),o(r,{variant:"ghost",disabled:j,onClick:()=>void J(!0),children:p("condense.propose.action")},void 0,!1,void 0,this),o(r,{variant:"ghost",disabled:j,onClick:()=>void J(!1),children:p("condense.propose.dismiss")},void 0,!1,void 0,this)]},void 0,!0,void 0,this):o("span",{title:p("condense.action"),children:o(r,{variant:"ghost",className:"text-muted-foreground hover:text-foreground size-6 shrink-0 p-0",disabled:j,onClick:()=>c({...u,scopePath:null}),children:[o(H,{className:"size-3.5","aria-hidden":"true"},void 0,!1,void 0,this),o("span",{className:"sr-only",children:p("condense.action")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),z&&o("p",{role:"alert",children:z},void 0,!1,void 0,this),q&&o("p",{role:"status",children:q},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
2
+ export{Xe,et,tt,je};
@@ -0,0 +1,3 @@
1
+ import{F,ae,se}from"./chunk-j234gbr1.js";import{y}from"./chunk-zf44znpx.js";import{f}from"./chunk-rg43mads.js";import{useCallback as A,useEffect as a,useState as r}from"react";import{jsxDEV as S,Fragment as B}from"react/jsx-dev-runtime";var q=1000;function H({bridge:n}){let[s,c]=r(null),[h,d]=r(null),[w,k]=r(null),[M,T]=r(new Set),E=A((o)=>{let t=n.view;if(t===null)return;let e=t.dom.querySelector(`.yup-comment-highlight[data-thread-id="${o}"]`);if(e===null)return;e.scrollIntoView({behavior:"smooth",block:"center"}),e.classList.remove("yup-comment-flash"),e.offsetWidth,e.classList.add("yup-comment-flash")},[n]),{source:L,anchors:C}=f({selection:h,onSelectionUsed:()=>d(null),onFocusQuote:E,focusRequest:w,anchoredThreadIds:M}),u=L.context,g=A((o)=>{k((t)=>({threadId:o,nonce:(t?.nonce??0)+1}))},[]);if(a(()=>(n.onMarkerClick=g,n.onAnchoredChange=(o)=>T(new Set(o)),()=>{n.onMarkerClick=()=>{},n.onAnchoredChange=()=>{}}),[n,g]),a(()=>{if(n.view===null)return;ae(n.view,C)},[n,C]),a(()=>{if(u===null)return;let o=()=>{let t=n.view;if(t===null)return;let e=document.getSelection();if(e===null||e.isCollapsed||e.rangeCount===0){c(null);return}let l=e.getRangeAt(0);if(!t.dom.contains(l.commonAncestorContainer)){c(null);return}let i=t.posAtDOM(l.startContainer,l.startOffset),p=t.posAtDOM(l.endContainer,l.endOffset);if(i>=p){c(null);return}let m=t.state.doc.textBetween(i,p,`
2
+ `).trim();if(m.length===0||m.length>q){c(null);return}let{segments:O}=F(t.state.doc),v=l.getBoundingClientRect();c({quote:m,quoteOffset:se(O,i),rect:{top:v.top,left:v.left}})};return document.addEventListener("selectionchange",o),()=>document.removeEventListener("selectionchange",o)},[u,n]),u===null)return null;return S(B,{children:s!==null&&h===null&&S(y,{rect:s.rect,onClick:()=>{d(s),c(null)}},void 0,!1,void 0,this)},void 0,!1,void 0,this)}
3
+ export{H};