@next-bricks/ai-portal 0.54.0 → 0.55.0

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 (76) hide show
  1. package/dist/bricks.json +36 -35
  2. package/dist/chunks/1864.4bd403fd.js +2 -0
  3. package/dist/chunks/1864.4bd403fd.js.map +1 -0
  4. package/dist/chunks/2761.561a580a.js +2 -0
  5. package/dist/chunks/2761.561a580a.js.map +1 -0
  6. package/dist/chunks/3227.689d8678.js +2 -0
  7. package/dist/chunks/3227.689d8678.js.map +1 -0
  8. package/dist/chunks/4888.42dd29a2.js +3 -0
  9. package/dist/chunks/4888.42dd29a2.js.map +1 -0
  10. package/dist/chunks/{6201.610c66e3.js → 6201.fa3b6e24.js} +2 -2
  11. package/dist/chunks/6201.fa3b6e24.js.map +1 -0
  12. package/dist/chunks/{6593.1afe9a04.js → 6593.58eda50f.js} +2 -2
  13. package/dist/chunks/6593.58eda50f.js.map +1 -0
  14. package/dist/chunks/7279.af201b60.js +3 -0
  15. package/dist/chunks/{6947.1cec7258.js.LICENSE.txt → 7279.af201b60.js.LICENSE.txt} +0 -6
  16. package/dist/chunks/7279.af201b60.js.map +1 -0
  17. package/dist/chunks/9388.e48bb229.js +2 -0
  18. package/dist/chunks/9388.e48bb229.js.map +1 -0
  19. package/dist/chunks/chat-box.8e064684.js +2 -0
  20. package/dist/chunks/chat-box.8e064684.js.map +1 -0
  21. package/dist/chunks/chat-input.dd3d2035.js +2 -0
  22. package/dist/chunks/chat-input.dd3d2035.js.map +1 -0
  23. package/dist/chunks/{cruise-canvas.60fa24a3.js → cruise-canvas.c494563b.js} +2 -2
  24. package/dist/chunks/{cruise-canvas.60fa24a3.js.map → cruise-canvas.c494563b.js.map} +1 -1
  25. package/dist/chunks/elevo-card.49b42ed0.js +3 -0
  26. package/dist/chunks/elevo-card.49b42ed0.js.map +1 -0
  27. package/dist/chunks/flow-tabs.ce40cc92.js +2 -0
  28. package/dist/chunks/flow-tabs.ce40cc92.js.map +1 -0
  29. package/dist/chunks/main.6b7402db.js +2 -0
  30. package/dist/chunks/main.6b7402db.js.map +1 -0
  31. package/dist/chunks/stage-flow.4c7ea7d9.js +2 -0
  32. package/dist/chunks/stage-flow.4c7ea7d9.js.map +1 -0
  33. package/dist/examples.json +16 -16
  34. package/dist/images/0e7e6764.png +0 -0
  35. package/dist/images/7944ebaf.png +0 -0
  36. package/dist/images/c7ec12fe.png +0 -0
  37. package/dist/index.14c08956.js +2 -0
  38. package/dist/index.14c08956.js.map +1 -0
  39. package/dist/manifest.json +300 -286
  40. package/dist/types.json +640 -601
  41. package/dist-types/chat-box/FileListComponent.d.ts +8 -0
  42. package/dist-types/chat-box/UploadButton.d.ts +9 -0
  43. package/dist-types/chat-box/bricks.d.ts +8 -0
  44. package/dist-types/chat-box/index.d.ts +3 -0
  45. package/dist-types/chat-box/interfaces.d.ts +8 -0
  46. package/dist-types/stage-flow/index.d.ts +2 -0
  47. package/package.json +2 -2
  48. package/dist/chunks/1334.aae33a33.js +0 -2
  49. package/dist/chunks/1334.aae33a33.js.map +0 -1
  50. package/dist/chunks/2142.0599aecd.js +0 -2
  51. package/dist/chunks/2142.0599aecd.js.map +0 -1
  52. package/dist/chunks/3020.acf9607e.js +0 -2
  53. package/dist/chunks/3020.acf9607e.js.map +0 -1
  54. package/dist/chunks/6201.610c66e3.js.map +0 -1
  55. package/dist/chunks/6593.1afe9a04.js.map +0 -1
  56. package/dist/chunks/6947.1cec7258.js +0 -3
  57. package/dist/chunks/6947.1cec7258.js.map +0 -1
  58. package/dist/chunks/7713.278cfb8b.js +0 -2
  59. package/dist/chunks/7713.278cfb8b.js.map +0 -1
  60. package/dist/chunks/chat-box.279647b5.js +0 -2
  61. package/dist/chunks/chat-box.279647b5.js.map +0 -1
  62. package/dist/chunks/chat-input.b09e4ba0.js +0 -3
  63. package/dist/chunks/chat-input.b09e4ba0.js.map +0 -1
  64. package/dist/chunks/elevo-card.731505e0.js +0 -3
  65. package/dist/chunks/elevo-card.731505e0.js.map +0 -1
  66. package/dist/chunks/flow-tabs.222a11ea.js +0 -3
  67. package/dist/chunks/flow-tabs.222a11ea.js.LICENSE.txt +0 -5
  68. package/dist/chunks/flow-tabs.222a11ea.js.map +0 -1
  69. package/dist/chunks/main.72d51c8f.js +0 -2
  70. package/dist/chunks/main.72d51c8f.js.map +0 -1
  71. package/dist/chunks/stage-flow.1ece0479.js +0 -2
  72. package/dist/chunks/stage-flow.1ece0479.js.map +0 -1
  73. package/dist/index.6e1371ec.js +0 -2
  74. package/dist/index.6e1371ec.js.map +0 -1
  75. /package/dist/chunks/{chat-input.b09e4ba0.js.LICENSE.txt → 4888.42dd29a2.js.LICENSE.txt} +0 -0
  76. /package/dist/chunks/{elevo-card.731505e0.js.LICENSE.txt → elevo-card.49b42ed0.js.LICENSE.txt} +0 -0
package/dist/bricks.json CHANGED
@@ -1,51 +1,44 @@
1
1
  {
2
2
  "id": "bricks/ai-portal",
3
3
  "bricks": [
4
- "ai-portal.home-container",
4
+ "ai-portal.cruise-canvas",
5
5
  "ai-portal.chat-box",
6
+ "ai-portal.home-container",
6
7
  "ai-portal.stat-with-mini-chart",
7
- "ai-portal.cruise-canvas",
8
8
  "ai-portal.elevo-sidebar",
9
9
  "ai-portal.icon-button",
10
10
  "ai-portal.show-cases",
11
11
  "ai-portal.mcp-tools",
12
- "ai-portal.ai-employees",
13
12
  "ai-portal.chat-stream",
14
- "ai-portal.call-tool",
13
+ "ai-portal.ai-employees",
15
14
  "ai-portal.ai-agents",
15
+ "ai-portal.call-tool",
16
16
  "ai-portal.save-request-store",
17
17
  "ai-portal.load-request-store",
18
18
  "ai-portal.clear-request-store",
19
19
  "ai-portal.set-chat-command",
20
20
  "ai-portal.page-container",
21
21
  "ai-portal.tab-list",
22
+ "ai-portal.dropdown-select",
22
23
  "ai-portal.preview-container",
23
24
  "ai-portal.action-buttons",
24
- "ai-portal.dropdown-select",
25
25
  "ai-portal.goal-card-list",
26
+ "ai-portal.project-conversations",
26
27
  "ai-portal.project-knowledges",
27
28
  "ai-portal.activity-timeline",
28
29
  "ai-portal.chat-input",
29
30
  "ai-portal.elevo-logo",
30
31
  "ai-portal.show-case",
31
- "ai-portal.project-conversations",
32
- "ai-portal.sticky-container",
33
32
  "ai-portal.blank-state",
34
- "ai-portal.flow-tabs",
33
+ "ai-portal.sticky-container",
35
34
  "ai-portal.elevo-card",
35
+ "ai-portal.flow-tabs",
36
36
  "ai-portal.stage-flow"
37
37
  ],
38
38
  "elements": [],
39
39
  "processors": [],
40
40
  "editors": [],
41
41
  "dependencies": {
42
- "ai-portal.chat-box": [
43
- "eo-icon",
44
- "eo-actions"
45
- ],
46
- "ai-portal.stat-with-mini-chart": [
47
- "eo-mini-line-chart"
48
- ],
49
42
  "ai-portal.cruise-canvas": [
50
43
  "eo-icon",
51
44
  "eo-button",
@@ -63,6 +56,14 @@
63
56
  "presentational.code-wrapper",
64
57
  "eo-avatar"
65
58
  ],
59
+ "ai-portal.chat-box": [
60
+ "eo-icon",
61
+ "eo-actions",
62
+ "ai-portal.icon-button"
63
+ ],
64
+ "ai-portal.stat-with-mini-chart": [
65
+ "eo-mini-line-chart"
66
+ ],
66
67
  "ai-portal.elevo-sidebar": [
67
68
  "ai-portal.elevo-logo",
68
69
  "eo-icon",
@@ -85,11 +86,6 @@
85
86
  "ai-portal.tab-list",
86
87
  "ai-portal.sticky-container"
87
88
  ],
88
- "ai-portal.ai-employees": [
89
- "eo-link",
90
- "eo-icon",
91
- "ai-portal.tab-list"
92
- ],
93
89
  "ai-portal.chat-stream": [
94
90
  "eo-icon",
95
91
  "eo-button",
@@ -105,6 +101,11 @@
105
101
  "basic.copy-to-clipboard",
106
102
  "presentational.code-wrapper"
107
103
  ],
104
+ "ai-portal.ai-employees": [
105
+ "eo-link",
106
+ "eo-icon",
107
+ "ai-portal.tab-list"
108
+ ],
108
109
  "ai-portal.ai-agents": [
109
110
  "eo-icon",
110
111
  "eo-link"
@@ -113,6 +114,14 @@
113
114
  "eo-link",
114
115
  "ai-portal.sticky-container"
115
116
  ],
117
+ "ai-portal.dropdown-select": [
118
+ "eo-popover",
119
+ "eo-icon",
120
+ "eo-loading-container",
121
+ "eo-menu",
122
+ "eo-menu-item",
123
+ "eo-input"
124
+ ],
116
125
  "ai-portal.preview-container": [
117
126
  "eo-icon",
118
127
  "eo-page-title",
@@ -123,20 +132,18 @@
123
132
  "eo-icon",
124
133
  "eo-button"
125
134
  ],
126
- "ai-portal.dropdown-select": [
127
- "eo-popover",
128
- "eo-icon",
129
- "eo-loading-container",
130
- "eo-menu",
131
- "eo-menu-item",
132
- "eo-input"
133
- ],
134
135
  "ai-portal.goal-card-list": [
135
136
  "eo-icon",
136
137
  "eo-dropdown-actions",
137
138
  "eo-easyops-avatar",
138
139
  "eo-button"
139
140
  ],
141
+ "ai-portal.project-conversations": [
142
+ "eo-link",
143
+ "eo-icon",
144
+ "eo-easyops-avatar",
145
+ "eo-mini-actions"
146
+ ],
140
147
  "ai-portal.project-knowledges": [
141
148
  "eo-link",
142
149
  "eo-icon",
@@ -156,12 +163,6 @@
156
163
  "eo-icon",
157
164
  "eo-link"
158
165
  ],
159
- "ai-portal.project-conversations": [
160
- "eo-link",
161
- "eo-icon",
162
- "eo-easyops-avatar",
163
- "eo-mini-actions"
164
- ],
165
166
  "ai-portal.elevo-card": [
166
167
  "eo-link",
167
168
  "eo-icon"
@@ -173,5 +174,5 @@
173
174
  "basic.show-dialog"
174
175
  ]
175
176
  },
176
- "filePath": "bricks/ai-portal/dist/index.6e1371ec.js"
177
+ "filePath": "bricks/ai-portal/dist/index.14c08956.js"
177
178
  }
@@ -0,0 +1,2 @@
1
+ "use strict";(globalThis.webpackChunk_next_bricks_ai_portal=globalThis.webpackChunk_next_bricks_ai_portal||[]).push([[1864],{7450:(e,t,n)=>{n.d(t,{s:()=>s});var i=n(18769),o=n.n(i),a=n(17753);const r={lib:"lucide",icon:"paperclip"};let l=0;const s=(0,i.forwardRef)(d);function d(e,t){let{onChange:n}=e;const s=(0,i.useRef)(null);return(0,i.useImperativeHandle)(t,(()=>({requestUpload:()=>{var e;null===(e=s.current)||void 0===e||e.click()}}))),o().createElement(o().Fragment,null,o().createElement("input",{type:"file",multiple:!0,hidden:!0,ref:s,onChange:e=>{const t=e.target.files;null==n||n(t?Array.from(t).map((e=>({uid:l++,file:e,status:"ready"}))):void 0),e.target.value=""}}),o().createElement(a.Py,{variant:"light",className:"btn-upload",icon:r,tooltip:"Upload files",onClick:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.click()}}))}},16195:(e,t,n)=>{n.d(t,{I:()=>s,K:()=>o,NS:()=>l,t:()=>d});var i=n(52616);let o=function(e){return e.ASK_ANY_THING="ASK_ANYTHING",e.COMMON_TASKS="COMMON_TASKS",e}({});const a={[o.ASK_ANY_THING]:"Ask anything",[o.COMMON_TASKS]:"Common tasks"},r={[o.ASK_ANY_THING]:"询问任何问题",[o.COMMON_TASKS]:"常用任务"},l="bricks/ai-portal/chat-box",s={en:a,zh:r},d=i.i18n.getFixedT(null,l)},17753:(e,t,n)=>{n.d(t,{Bj:()=>o,Py:()=>r,Tl:()=>a});var i=n(30981);const o=(0,i.wrapBrick)("eo-icon"),a=(0,i.wrapBrick)("eo-actions",{onActionClick:"action.click",onItemDragEnd:"item.drag.end",onItemDragStart:"item.drag.start"}),r=(0,i.wrapBrick)("ai-portal.icon-button")},47008:(e,t,n)=>{n.d(t,{A:()=>u});var i=n(36758),o=n.n(i),a=n(40935),r=n.n(a),l=n(20062),s=n.n(l),d=new URL(n(47336),n.b),c=r()(o()),p=s()(d);c.push([e.id,`:host{display:block}:host([hidden]){display:none}*{box-sizing:border-box}.root{color:#262626;background:url(${p}) no-repeat center bottom;background-size:100% 104px;padding:12px 12px 29px;margin:0 -12px}.container{position:relative;background:#ffffff;box-shadow:0px 2px 4px 0px rgba(38,45,65,0.1);border-radius:16px;border:1px solid #dadfe8}.container:has(textarea:focus){border-color:#b7c3d8}textarea{display:block;width:100%;padding:10px 16px 50px;color:var(--antd-input-color);border-radius:16px;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border:1px solid rgba(255,255,255,0.5);font:inherit;font-size:14px;line-height:22px;height:120px}textarea::placeholder{color:rgba(0,0,0,0.4)}button:focus,\ntextarea:focus{outline:none}button{margin:0;padding:0;font:inherit;background:none;border:none}.actions-bar{position:absolute;bottom:12px;left:14px;right:14px;display:flex;align-items:flex-end;justify-content:space-between;gap:6px}.btn-send{width:28px;height:28px;display:flex;align-items:center;justify-content:center;background:var(--elevo-color-brand);border:none;border-radius:8px;color:#fff;flex-shrink:0}.btn-send[disabled]{background:rgba(0,0,0,0.15)}.btn-send:not([disabled]){cursor:pointer}.btn-send:not([disabled]):hover{background:#5166ff}.btn-send:not([disabled]):active{background:#1e33cc}.mention-overlay{position:absolute;border-radius:4px;pointer-events:none;background:rgba(38,45,65,0.1)}.buttons{display:flex;align-items:center;gap:12px}.btn-divider{width:1px;height:16px;background:rgba(0,0,0,0.1)}.files{list-style:none;margin:0;padding:4px 0 0;position:absolute;display:flex;gap:8px;top:10px;left:16px;right:16px;overflow-x:auto}.file{background:rgba(0,0,0,0.04);border-radius:8px;display:flex;width:200px;height:60px;align-items:center;padding:0 8px;position:relative}.file-content{min-width:0;flex:1}.file-icon{margin:0 11px 0 6px}.file-image{margin-right:8px;object-fit:cover;border-radius:4px;max-width:44px;max-height:44px}.file-name,\n.file-metadata{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-name{color:rgba(0,0,0,0.88)}.file-metadata{color:rgba(0,0,0,0.45);font-size:12px;margin-top:3px}.file-remove{position:absolute;top:-4px;right:-4px;font-size:12px;padding:1px;display:flex;color:rgba(0,0,0,0.88);cursor:pointer;background:#fff;border-radius:14px}.file:not(:hover) .file-remove{display:none}.btn-add-file{border-radius:8px;border:1px dashed rgba(0,0,0,0.1);color:rgba(0,0,0,0.45);font-size:16px;display:flex;width:60px;height:60px;align-items:center;justify-content:center;cursor:pointer}.btn-add-file:hover{background:rgba(0,0,0,0.04)}.file.failed .file-status{color:var(--color-error)}.file.as-image{width:60px;border:1px solid rgba(0,0,0,0.1);padding:0;background:none;justify-content:center}.file.as-image .file-image{max-width:100%;max-height:100%;margin:0;border-radius:6px}.file.as-image.failed{border-color:#f24c25}.file-overlay{position:absolute;top:0;right:0;bottom:0;left:0;background:rgba(0,10,26,0.45);border-radius:6px;color:#fff;display:flex;align-items:center;justify-content:center;text-align:center;font-size:20px}.file.failed .file-overlay{color:#ff754f;font-size:12px}`,""]);const u=c.toString()},47336:(e,t,n)=>{e.exports=n.p+"images/25c20165.png"},78404:(e,t,n)=>{n.d(t,{U:()=>a});var i=n(80592);let o;function a(e,t){o||(o=document.createElement("div"),o.setAttribute("tab-index","-1"),o.setAttribute("aria-hidden","true"),document.body.appendChild(o)),o.setAttribute("style",(0,i.w)(e)),o.textContent=e.value.slice(0,t);const n=document.createElement("span");n.textContent="​",o.appendChild(n);const a=n.getBoundingClientRect();return n.remove(),{top:a.top,left:a.left}}},80592:(e,t,n)=>{n.d(t,{w:()=>a});const i="\n min-height: 0!important;\n max-height: none!important;\n height: 0!important;\n visibility: hidden!important;\n overflow: hidden!important;\n position: absolute!important;\n z-index: -1000!important;\n top: 0!important;\n left: 0!important;\n pointer-events: none!important;\n",o=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"];function a(e){const t=window.getComputedStyle(e);return`${o.map((e=>`${e}:${t.getPropertyValue(e)}`)).join(";")};${i}`}},86572:(e,t,n)=>{n.d(t,{I:()=>a});var i=n(80592);let o;function a(e,t,n){o||(o=document.createElement("div"),o.setAttribute("tab-index","-1"),o.setAttribute("aria-hidden","true"),document.body.appendChild(o)),o.setAttribute("style",(0,i.w)(e)),o.textContent=t;const a=document.createElement("span");a.textContent=n,o.appendChild(a);const r=a.getBoundingClientRect();if(a.remove(),n.length<=1)return[r];const l=n[0],s=document.createElement("span");s.textContent=l,o.appendChild(s);const d=s.getBoundingClientRect();s.remove(),o.textContent=`${t}${n.slice(0,-1)}`;const c=n[n.length-1],p=document.createElement("span");p.textContent=c,o.appendChild(p);const u=p.getBoundingClientRect();if(p.remove(),d.top===u.top)return[r];const f=[];f.push(new DOMRect(d.left,d.top,r.right-d.left,d.bottom-d.top));const m=u.top-d.bottom;return m>=10&&f.push(new DOMRect(r.left,d.bottom,r.width,m)),f.push(new DOMRect(r.left,u.top,u.right-r.left,u.bottom-u.top)),f}},89750:(e,t,n)=>{n.d(t,{Y:()=>c});var i=n(89575),o=n(18769),a=n.n(o),r=n(53373),l=n.n(r),s=n(17753),d=n(60136);function c(e){let{files:t,onRemove:n,onAdd:o}=e;const r=t.every((e=>e.file.type.startsWith("image/")));return a().createElement("ul",{className:"files"},t.map((e=>a().createElement(p,(0,i.A)({},e,{key:e.uid,showAsImage:r,onRemove:n})))),a().createElement("li",null,a().createElement("button",{className:"btn-add-file",onClick:o},a().createElement(s.Bj,{lib:"antd",icon:"plus"}))))}function p(e){let{uid:t,file:n,status:i,abortController:r,showAsImage:c,onRemove:p}=e;const[u,f]=(0,d.NL)(n.type,n.name),m=(0,d.v7)(n.size),g=n.type.startsWith("image/"),[b,x]=(0,o.useState)();(0,o.useEffect)((()=>{if(g){const e=URL.createObjectURL(n);return x(e),()=>{URL.revokeObjectURL(e)}}x(void 0)}),[n,g]);const h=a().createElement("button",{className:"file-remove",onClick:()=>{p(t,r)}},a().createElement(s.Bj,{lib:"antd",theme:"filled",icon:"close-circle"}));return c?a().createElement("li",{className:l()("file as-image",{failed:"failed"===i})},a().createElement("img",{className:"file-image",src:b}),"uploading"===i&&a().createElement("div",{className:"file-overlay"},a().createElement(s.Bj,{lib:"antd",icon:"loading-3-quarters",spinning:!0})),"failed"===i&&a().createElement("div",{className:"file-overlay"},"Upload failed"),h):a().createElement("li",{className:l()("file",{failed:"failed"===i})},g?a().createElement("img",{className:"file-image",src:b}):a().createElement("img",{className:"file-icon",src:f,width:26,height:32}),a().createElement("div",{className:"file-content"},a().createElement("div",{className:"file-name"},n.name),a().createElement("div",{className:"file-metadata"},a().createElement("span",{className:"file-status"},`${"uploading"===i?"Uploading...":"failed"===i?"Upload failed":u}`),` · ${m}`)),h)}},92879:(e,t,n)=>{n.d(t,{e:()=>c});var i=n(89575),o=n(18769),a=n(59435),r=n(99126),l=n(80592);let s;const d=/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"metaKey":"ctrlKey",c=o.forwardRef(p);function p(e,t){let{autoResize:n,minRows:c,maxRows:p,borderSize:u,paddingSize:f,containerRef:m,value:g,style:b,submitWhen:x,desiredSelectionRef:h,onChange:v,onSubmit:w,onKeyDown:y,onCompositionStart:k,onCompositionEnd:C,...E}=e;const S=null==n||n,[A,R]=(0,o.useState)(null!=g?g:""),N=(0,o.useRef)(null),[z,_]=(0,o.useState)(null);(0,o.useImperativeHandle)(t,(()=>({focus:()=>{const e=N.current;if(e){var t;const n=null===(t=e.value)||void 0===t?void 0:t.length;e.focus(),n&&e.setSelectionRange(n,n)}},element:N.current})),[]);const B=(0,o.useCallback)((()=>{const e=N.current;if(e&&S){const t=function(e,t){const{minRows:n=null,maxRows:i=null,borderSize:o=2,paddingSize:a=8}=null!=t?t:{};let r,d,c;s||(s=document.createElement("textarea"),s.setAttribute("tab-index","-1"),s.setAttribute("aria-hidden","true"),document.body.appendChild(s)),s.setAttribute("style",(0,l.w)(e)),s.value=e.value||e.placeholder||"";let p=s.scrollHeight+o;if(null!==n||null!==i){const e=parseFloat(window.getComputedStyle(s).getPropertyValue("line-height"));null!==n&&(r=e*n+a+o,p=Math.max(r,p)),null!==i&&(d=e*i+a+o,p<=d&&(c="hidden"),p=Math.min(d,p))}const u={height:p,overflowY:c,resize:"none"};return r&&(u.minHeight=r),d&&(u.maxHeight=d),u}(e,{minRows:c,maxRows:p,borderSize:u,paddingSize:f});(0,a.flushSync)((()=>{_(t)}))}}),[S,p,c,u,f]);(0,o.useEffect)((()=>{R(null!=g?g:"")}),[g]),(0,o.useEffect)((()=>{B()}),[B,A]);const K=(0,o.useRef)(!1),M=(0,o.useCallback)((e=>{K.current=!0,null==k||k(e)}),[k]),j=(0,o.useCallback)((e=>{K.current=!1,null==C||C(e)}),[C]),O=(0,o.useCallback)((e=>{K.current||!1!==(null==y?void 0:y(e))&&"Enter"===e.key&&("enter-without-shift"===x?!e.shiftKey:"enter-with-mod"===x&&e[d])&&(e.preventDefault(),e.stopPropagation(),null==w||w(e))}),[y,w,x]);return(0,o.useLayoutEffect)((()=>{const e=null==h?void 0:h.current,t=N.current;if(e&&t){const{start:n,end:i}=e;h.current=null,t.setSelectionRange(n,i)}}),[h,A]),(0,o.useEffect)((()=>{const e=null==m?void 0:m.current;if(!e||!S)return;let t;const n=new r.A((n=>{for(const i of n)if(i.target===e){const e=i.contentBoxSize?i.contentBoxSize[0]?i.contentBoxSize[0].inlineSize:i.contentBoxSize.inlineSize:i.contentRect.width;if(void 0!==e&&e!==t){const n=!t;t=e,n||requestAnimationFrame(B)}}}));return n.observe(e),()=>{n.disconnect()}}),[S,m,B]),o.createElement("textarea",(0,i.A)({},E,{ref:N,value:A,style:{...b,...z},onChange:e=>{R(e.target.value),null==v||v(e)},onCompositionStart:M,onCompositionEnd:j,onKeyDown:O}))}}}]);
2
+ //# sourceMappingURL=1864.4bd403fd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunks/1864.4bd403fd.js","mappings":"gMAKA,MAAMA,EAAgC,CACpCC,IAAK,SACLC,KAAM,aAGR,IAAIC,EAAM,EAUH,MAAMC,GAAeC,EAAAA,EAAAA,YAAWC,GAEvC,SAASA,EAAkBC,EAEzBC,GACA,IAFA,SAAEC,GAA6BF,EAG/B,MAAMG,GAAWC,EAAAA,EAAAA,QAAyB,MAsB1C,OANAC,EAAAA,EAAAA,qBAAoBJ,GAAK,KAAM,CAC7BK,cAAeA,KAAM,IAAAC,EACH,QAAhBA,EAAAJ,EAASK,eAAO,IAAAD,GAAhBA,EAA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K,CACTnJ,IAAKqJ,EACL/H,MAAOA,EACPsH,MAAO,IACFA,KACAU,GAELrJ,SAhHFY,IAEAuI,EAASvI,EAAEE,OAAOO,OAClBrB,SAAAA,EAAWY,EAAE,EA8GXoI,mBAAoB6B,EACpB5B,iBAAkB6B,EAClB/B,UAAWgC,IAGjB,C","sources":["webpack:///./src/chat-box/UploadButton.tsx","webpack:///./src/chat-box/i18n.ts","webpack:///./src/chat-box/bricks.ts","webpack:///./src/chat-box/styles.shadow.css","webpack:///../../src/getCaretPositionInTextarea.ts","webpack:///../../../src/utils/getMirroredStyle.ts","webpack:///../../src/getContentRectsInTextarea.ts","webpack:///./src/chat-box/FileListComponent.tsx","webpack:///../../../src/utils/calculateAutoSizeStyle.ts","webpack:///../../src/TextareaAutoResize.tsx"],"sourcesContent":["import React, { forwardRef, useImperativeHandle, useRef } from \"react\";\nimport type { GeneralIconProps } from \"@next-bricks/icons/general-icon\";\nimport { WrappedIconButton } from \"./bricks\";\nimport type { FileItem } from \"./interfaces\";\n\nconst ICON_UPLOAD: GeneralIconProps = {\n lib: \"lucide\",\n icon: \"paperclip\",\n};\n\nlet uid = 0;\n\nexport interface UploadButtonProps {\n onChange?: (files: FileItem[] | undefined) => void;\n}\n\nexport interface UploadButtonRef {\n requestUpload: () => void;\n}\n\nexport const UploadButton = forwardRef(LegacyUploadButton);\n\nfunction LegacyUploadButton(\n { onChange }: UploadButtonProps,\n ref: React.Ref<UploadButtonRef>\n) {\n const inputRef = useRef<HTMLInputElement>(null);\n\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const files = e.target.files;\n onChange?.(\n files\n ? Array.from(files).map((file) => ({\n uid: uid++,\n file,\n status: \"ready\",\n }))\n : undefined\n );\n e.target.value = \"\";\n };\n\n useImperativeHandle(ref, () => ({\n requestUpload: () => {\n inputRef.current?.click();\n },\n }));\n\n return (\n <>\n <input\n type=\"file\"\n multiple\n hidden\n ref={inputRef}\n onChange={handleInputChange}\n />\n <WrappedIconButton\n variant=\"light\"\n className=\"btn-upload\"\n icon={ICON_UPLOAD}\n tooltip=\"Upload files\"\n onClick={() => inputRef.current?.click()}\n />\n </>\n );\n}\n","import { i18n } from \"@next-core/i18n\";\n\nexport enum K {\n ASK_ANY_THING = \"ASK_ANYTHING\",\n COMMON_TASKS = \"COMMON_TASKS\",\n}\n\nconst en: Locale = {\n [K.ASK_ANY_THING]: \"Ask anything\",\n [K.COMMON_TASKS]: \"Common tasks\",\n};\n\nconst zh: Locale = {\n [K.ASK_ANY_THING]: \"询问任何问题\",\n [K.COMMON_TASKS]: \"常用任务\",\n};\n\nexport const NS = \"bricks/ai-portal/chat-box\";\n\nexport const locales = { en, zh };\n\nexport const t = i18n.getFixedT(null, NS);\n\ntype Locale = { [k in K]: string } & {\n [k in K as `${k}_plural`]?: string;\n};\n","import { wrapBrick } from \"@next-core/react-element\";\nimport type {\n GeneralIcon,\n GeneralIconProps,\n} from \"@next-bricks/icons/general-icon\";\nimport type {\n ActionsEvents,\n ActionsEventsMapping,\n ActionsProps,\n EoActions,\n} from \"@next-bricks/basic/actions\";\nimport type { IconButton, IconButtonProps } from \"../icon-button\";\n\nexport const WrappedIcon = wrapBrick<GeneralIcon, GeneralIconProps>(\"eo-icon\");\nexport const WrappedActions = wrapBrick<\n EoActions,\n ActionsProps & { activeKeys?: (string | number)[] },\n ActionsEvents,\n ActionsEventsMapping\n>(\"eo-actions\", {\n onActionClick: \"action.click\",\n onItemDragEnd: \"item.drag.end\",\n onItemDragStart: \"item.drag.start\",\n});\nexport const WrappedIconButton = wrapBrick<IconButton, IconButtonProps>(\n \"ai-portal.icon-button\"\n);\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nimport ___CSS_LOADER_GET_URL_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/getUrl.js\";\nvar ___CSS_LOADER_URL_IMPORT_0___ = new URL(\"./images/bg.png\", import.meta.url);\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\nvar ___CSS_LOADER_URL_REPLACEMENT_0___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_IMPORT_0___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `:host{display:block}:host([hidden]){display:none}*{box-sizing:border-box}.root{color:#262626;background:url(${___CSS_LOADER_URL_REPLACEMENT_0___}) no-repeat center bottom;background-size:100% 104px;padding:12px 12px 29px;margin:0 -12px}.container{position:relative;background:#ffffff;box-shadow:0px 2px 4px 0px rgba(38,45,65,0.1);border-radius:16px;border:1px solid #dadfe8}.container:has(textarea:focus){border-color:#b7c3d8}textarea{display:block;width:100%;padding:10px 16px 50px;color:var(--antd-input-color);border-radius:16px;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border:1px solid rgba(255,255,255,0.5);font:inherit;font-size:14px;line-height:22px;height:120px}textarea::placeholder{color:rgba(0,0,0,0.4)}button:focus,\ntextarea:focus{outline:none}button{margin:0;padding:0;font:inherit;background:none;border:none}.actions-bar{position:absolute;bottom:12px;left:14px;right:14px;display:flex;align-items:flex-end;justify-content:space-between;gap:6px}.btn-send{width:28px;height:28px;display:flex;align-items:center;justify-content:center;background:var(--elevo-color-brand);border:none;border-radius:8px;color:#fff;flex-shrink:0}.btn-send[disabled]{background:rgba(0,0,0,0.15)}.btn-send:not([disabled]){cursor:pointer}.btn-send:not([disabled]):hover{background:#5166ff}.btn-send:not([disabled]):active{background:#1e33cc}.mention-overlay{position:absolute;border-radius:4px;pointer-events:none;background:rgba(38,45,65,0.1)}.buttons{display:flex;align-items:center;gap:12px}.btn-divider{width:1px;height:16px;background:rgba(0,0,0,0.1)}.files{list-style:none;margin:0;padding:4px 0 0;position:absolute;display:flex;gap:8px;top:10px;left:16px;right:16px;overflow-x:auto}.file{background:rgba(0,0,0,0.04);border-radius:8px;display:flex;width:200px;height:60px;align-items:center;padding:0 8px;position:relative}.file-content{min-width:0;flex:1}.file-icon{margin:0 11px 0 6px}.file-image{margin-right:8px;object-fit:cover;border-radius:4px;max-width:44px;max-height:44px}.file-name,\n.file-metadata{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-name{color:rgba(0,0,0,0.88)}.file-metadata{color:rgba(0,0,0,0.45);font-size:12px;margin-top:3px}.file-remove{position:absolute;top:-4px;right:-4px;font-size:12px;padding:1px;display:flex;color:rgba(0,0,0,0.88);cursor:pointer;background:#fff;border-radius:14px}.file:not(:hover) .file-remove{display:none}.btn-add-file{border-radius:8px;border:1px dashed rgba(0,0,0,0.1);color:rgba(0,0,0,0.45);font-size:16px;display:flex;width:60px;height:60px;align-items:center;justify-content:center;cursor:pointer}.btn-add-file:hover{background:rgba(0,0,0,0.04)}.file.failed .file-status{color:var(--color-error)}.file.as-image{width:60px;border:1px solid rgba(0,0,0,0.1);padding:0;background:none;justify-content:center}.file.as-image .file-image{max-width:100%;max-height:100%;margin:0;border-radius:6px}.file.as-image.failed{border-color:#f24c25}.file-overlay{position:absolute;top:0;right:0;bottom:0;left:0;background:rgba(0,10,26,0.45);border-radius:6px;color:#fff;display:flex;align-items:center;justify-content:center;text-align:center;font-size:20px}.file.failed .file-overlay{color:#ff754f;font-size:12px}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n","import { getMirroredStyle } from \"./utils/getMirroredStyle.js\";\n\nlet hiddenElement: HTMLDivElement | undefined;\n\nexport function getCaretPositionInTextarea(\n textarea: HTMLTextAreaElement,\n index: number\n) {\n if (!hiddenElement) {\n hiddenElement = document.createElement(\"div\");\n hiddenElement.setAttribute(\"tab-index\", \"-1\");\n hiddenElement.setAttribute(\"aria-hidden\", \"true\");\n document.body.appendChild(hiddenElement);\n }\n\n hiddenElement.setAttribute(\"style\", getMirroredStyle(textarea));\n hiddenElement.textContent = textarea.value.slice(0, index);\n\n const span = document.createElement(\"span\");\n span.textContent = \"\\u200b\"; // 占位符\n hiddenElement.appendChild(span);\n\n const rect = span.getBoundingClientRect();\n span.remove();\n return {\n top: rect.top,\n left: rect.left,\n };\n}\n","const HIDDEN_STYLE = `\n min-height: 0!important;\n max-height: none!important;\n height: 0!important;\n visibility: hidden!important;\n overflow: hidden!important;\n position: absolute!important;\n z-index: -1000!important;\n top: 0!important;\n left: 0!important;\n pointer-events: none!important;\n`;\n\nconst SIZING_STYLE = [\n \"letter-spacing\",\n \"line-height\",\n \"padding-top\",\n \"padding-bottom\",\n \"font-family\",\n \"font-weight\",\n \"font-size\",\n \"font-variant\",\n \"text-rendering\",\n \"text-transform\",\n \"width\",\n \"text-indent\",\n \"padding-left\",\n \"padding-right\",\n \"border-width\",\n \"box-sizing\",\n \"word-break\",\n \"white-space\",\n];\n\n/**\n * 创建一个镜像元素,用于计算光标位置或文本尺寸。\n */\nexport function getMirroredStyle(element: HTMLElement) {\n const uiTextNodeStyle = window.getComputedStyle(element);\n const sizingStyle = SIZING_STYLE.map(\n (name) => `${name}:${uiTextNodeStyle.getPropertyValue(name)}`\n ).join(\";\");\n return `${sizingStyle};${HIDDEN_STYLE}`;\n}\n","import { getMirroredStyle } from \"./utils/getMirroredStyle.js\";\n\nlet hiddenElement: HTMLDivElement | undefined;\n\nexport function getContentRectsInTextarea(\n textarea: HTMLTextAreaElement,\n prefix: string,\n measureContent: string\n): DOMRect[] {\n if (!hiddenElement) {\n hiddenElement = document.createElement(\"div\");\n hiddenElement.setAttribute(\"tab-index\", \"-1\");\n hiddenElement.setAttribute(\"aria-hidden\", \"true\");\n document.body.appendChild(hiddenElement);\n }\n hiddenElement.setAttribute(\"style\", getMirroredStyle(textarea));\n\n hiddenElement.textContent = prefix;\n\n const span = document.createElement(\"span\");\n span.textContent = measureContent;\n hiddenElement.appendChild(span);\n\n const fullRect = span.getBoundingClientRect();\n span.remove();\n\n if (measureContent.length <= 1) {\n return [fullRect];\n }\n\n const leadingChar = measureContent[0];\n const leadingSpan = document.createElement(\"span\");\n leadingSpan.textContent = leadingChar;\n hiddenElement.appendChild(leadingSpan);\n const leadingRect = leadingSpan.getBoundingClientRect();\n leadingSpan.remove();\n\n hiddenElement.textContent = `${prefix}${measureContent.slice(0, -1)}`;\n const trailingChar = measureContent[measureContent.length - 1];\n const trailingSpan = document.createElement(\"span\");\n trailingSpan.textContent = trailingChar;\n hiddenElement.appendChild(trailingSpan);\n const trailingRect = trailingSpan.getBoundingClientRect();\n trailingSpan.remove();\n\n if (leadingRect.top === trailingRect.top) {\n return [fullRect];\n }\n\n const rects: DOMRect[] = [];\n\n // Leading rect\n rects.push(\n new DOMRect(\n leadingRect.left,\n leadingRect.top,\n fullRect.right - leadingRect.left,\n leadingRect.bottom - leadingRect.top\n )\n );\n\n // Middle rect\n const height = trailingRect.top - leadingRect.bottom;\n if (height >= 10) {\n rects.push(\n new DOMRect(fullRect.left, leadingRect.bottom, fullRect.width, height)\n );\n }\n\n // Trailing rect\n rects.push(\n new DOMRect(\n fullRect.left,\n trailingRect.top,\n trailingRect.right - fullRect.left,\n trailingRect.bottom - trailingRect.top\n )\n );\n\n return rects;\n}\n","import React, { useEffect, useState } from \"react\";\nimport classNames from \"classnames\";\nimport { WrappedIcon } from \"./bricks\";\nimport type { FileItem } from \"./interfaces\";\nimport {\n formatFileSize,\n getFileTypeAndIcon,\n} from \"../cruise-canvas/utils/file\";\n\nexport interface FileListComponentProps {\n files: FileItem[];\n onRemove: (uid: number, abortController: AbortController | undefined) => void;\n onAdd: () => void;\n}\n\nexport function FileListComponent({\n files,\n onRemove,\n onAdd,\n}: FileListComponentProps) {\n const showAsImage = files.every((file) =>\n file.file.type.startsWith(\"image/\")\n );\n\n return (\n <ul className=\"files\">\n {files.map((file) => (\n <FileComponent\n {...file}\n key={file.uid}\n showAsImage={showAsImage}\n onRemove={onRemove}\n />\n ))}\n <li>\n <button className=\"btn-add-file\" onClick={onAdd}>\n <WrappedIcon lib=\"antd\" icon=\"plus\" />\n </button>\n </li>\n </ul>\n );\n}\n\ninterface FileComponentProps extends FileItem {\n showAsImage?: boolean;\n onRemove: (uid: number, abortController: AbortController | undefined) => void;\n}\n\nfunction FileComponent({\n uid,\n file,\n status,\n abortController,\n showAsImage,\n onRemove,\n}: FileComponentProps) {\n const [type, icon] = getFileTypeAndIcon(file.type, file.name);\n const size = formatFileSize(file.size);\n const isImage = file.type.startsWith(\"image/\");\n const [image, setImage] = useState<string | undefined>();\n\n useEffect(() => {\n if (isImage) {\n const url = URL.createObjectURL(file);\n setImage(url);\n return () => {\n URL.revokeObjectURL(url);\n };\n } else {\n setImage(undefined);\n }\n }, [file, isImage]);\n\n const buttonRemove = (\n <button\n className=\"file-remove\"\n onClick={() => {\n onRemove(uid, abortController);\n }}\n >\n <WrappedIcon lib=\"antd\" theme=\"filled\" icon=\"close-circle\" />\n </button>\n );\n\n if (showAsImage) {\n return (\n <li\n className={classNames(\"file as-image\", { failed: status === \"failed\" })}\n >\n <img className=\"file-image\" src={image} />\n {status === \"uploading\" && (\n <div className=\"file-overlay\">\n <WrappedIcon lib=\"antd\" icon=\"loading-3-quarters\" spinning />\n </div>\n )}\n {status === \"failed\" && (\n <div className=\"file-overlay\">Upload failed</div>\n )}\n {buttonRemove}\n </li>\n );\n }\n\n return (\n <li className={classNames(\"file\", { failed: status === \"failed\" })}>\n {isImage ? (\n <img className=\"file-image\" src={image} />\n ) : (\n <img className=\"file-icon\" src={icon} width={26} height={32} />\n )}\n <div className=\"file-content\">\n <div className=\"file-name\">{file.name}</div>\n <div className=\"file-metadata\">\n <span className=\"file-status\">\n {`${status === \"uploading\" ? \"Uploading...\" : status === \"failed\" ? \"Upload failed\" : type}`}\n </span>\n {` · ${size}`}\n </div>\n </div>\n {buttonRemove}\n </li>\n );\n}\n","// istanbul ignore file\nimport type React from \"react\";\nimport { getMirroredStyle } from \"./getMirroredStyle.js\";\n\nlet hiddenTextarea: HTMLTextAreaElement | undefined;\n\nexport interface AutoSizeOptions {\n minRows?: number | null;\n maxRows?: number | null;\n borderSize?: number;\n paddingSize?: number;\n}\n\n/**\n * 计算 textarea 高度\n * https://github.com/react-component/textarea/blob/1c0026fbe30e5f7dff1fca695b2cf262246381ca/src/calculateNodeHeight.tsx\n */\nexport default function calculateAutoSizeStyle(\n uiTextNode: HTMLTextAreaElement,\n options?: AutoSizeOptions\n): React.CSSProperties {\n const {\n minRows = null,\n maxRows = null,\n borderSize = 2,\n paddingSize = 8,\n } = options ?? {};\n\n if (!hiddenTextarea) {\n hiddenTextarea = document.createElement(\"textarea\");\n hiddenTextarea.setAttribute(\"tab-index\", \"-1\");\n hiddenTextarea.setAttribute(\"aria-hidden\", \"true\");\n document.body.appendChild(hiddenTextarea);\n }\n\n // equal style\n hiddenTextarea.setAttribute(\"style\", getMirroredStyle(uiTextNode));\n hiddenTextarea.value = uiTextNode.value || uiTextNode.placeholder || \"\";\n\n let minHeight: number | undefined;\n let maxHeight: number | undefined;\n let overflowY: React.CSSProperties[\"overflowY\"];\n\n let height = hiddenTextarea.scrollHeight + borderSize;\n\n if (minRows !== null || maxRows !== null) {\n const singleRowHeight =\n process.env.NODE_ENV === \"test\"\n ? 22\n : parseFloat(\n window\n .getComputedStyle(hiddenTextarea)\n .getPropertyValue(\"line-height\")\n );\n if (minRows !== null) {\n minHeight = singleRowHeight * minRows + paddingSize + borderSize;\n height = Math.max(minHeight, height);\n }\n if (maxRows !== null) {\n maxHeight = singleRowHeight * maxRows + paddingSize + borderSize;\n if (height <= maxHeight) {\n overflowY = \"hidden\";\n }\n height = Math.min(maxHeight, height);\n }\n }\n\n const style: React.CSSProperties = {\n height,\n overflowY,\n resize: \"none\",\n };\n\n if (minHeight) {\n style.minHeight = minHeight;\n }\n if (maxHeight) {\n style.maxHeight = maxHeight;\n }\n\n return style;\n}\n","import React, {\n useCallback,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { flushSync } from \"react-dom\";\nimport ResizeObserver from \"resize-observer-polyfill\";\nimport calculateAutoSizeStyle from \"./utils/calculateAutoSizeStyle.js\";\n\n// istanbul ignore next\nconst modKey = /Mac|iPod|iPhone|iPad/.test(navigator.platform)\n ? \"metaKey\"\n : \"ctrlKey\";\n\nexport interface TextareaAutoResizeProps\n extends React.DetailedHTMLProps<\n React.TextareaHTMLAttributes<HTMLTextAreaElement>,\n HTMLTextAreaElement\n > {\n /** @default true */\n autoResize?: boolean;\n minRows?: number | null;\n maxRows?: number | null;\n /** @default 2 */\n borderSize?: number;\n /** @default 8 */\n paddingSize?: number;\n containerRef?: React.RefObject<HTMLElement>;\n submitWhen?: \"enter-without-shift\" | \"enter-with-mod\";\n desiredSelectionRef?: React.MutableRefObject<{\n start: number;\n end: number;\n } | null>;\n onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;\n /**\n * The handler can return false to prevent default behavior (submit)\n */\n onKeyDown?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void | false;\n}\n\nexport interface TextareaAutoResizeRef {\n focus(): void;\n element: HTMLTextAreaElement | null;\n}\n\nexport const TextareaAutoResize = React.forwardRef<\n TextareaAutoResizeRef,\n TextareaAutoResizeProps\n>(LegacyTextareaAutoResize);\n\nfunction LegacyTextareaAutoResize(\n {\n autoResize: _autoResize,\n minRows,\n maxRows,\n borderSize,\n paddingSize,\n containerRef,\n value: propValue,\n style,\n submitWhen,\n desiredSelectionRef,\n onChange,\n onSubmit,\n onKeyDown,\n onCompositionStart,\n onCompositionEnd,\n ...props\n }: TextareaAutoResizeProps,\n ref: React.ForwardedRef<TextareaAutoResizeRef>\n): React.JSX.Element {\n const autoResize = _autoResize ?? true;\n const [value, setValue] = useState(propValue ?? \"\");\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const [autoStyle, setAutoStyle] = useState<React.CSSProperties | null>(null);\n\n useImperativeHandle(\n ref,\n () => ({\n focus: () => {\n const textarea = textareaRef.current;\n // istanbul ignore else: defensive check\n if (textarea) {\n const valueLength = textarea.value?.length;\n textarea.focus();\n valueLength && textarea.setSelectionRange(valueLength, valueLength);\n }\n },\n element: textareaRef.current,\n }),\n []\n );\n\n const doAutoResize = useCallback(() => {\n const textarea = textareaRef.current;\n if (textarea && autoResize) {\n const style = calculateAutoSizeStyle(textarea, {\n minRows,\n maxRows,\n borderSize,\n paddingSize,\n });\n // istanbul ignore next\n if (process.env.NODE_ENV === \"test\") {\n setAutoStyle(style);\n } else {\n flushSync(() => {\n setAutoStyle(style);\n });\n }\n }\n }, [autoResize, maxRows, minRows, borderSize, paddingSize]);\n\n const handleInputChange = (\n e: React.ChangeEvent<HTMLTextAreaElement>\n ): void => {\n setValue(e.target.value);\n onChange?.(e);\n };\n\n useEffect(() => {\n setValue(propValue ?? \"\");\n }, [propValue]);\n\n useEffect(() => {\n doAutoResize();\n }, [doAutoResize, value]);\n\n const compositionRef = useRef(false);\n\n const handleCompositionStart = useCallback(\n (e: React.CompositionEvent<HTMLTextAreaElement>) => {\n compositionRef.current = true;\n onCompositionStart?.(e);\n },\n [onCompositionStart]\n );\n\n const handleCompositionEnd = useCallback(\n (e: React.CompositionEvent<HTMLTextAreaElement>) => {\n compositionRef.current = false;\n onCompositionEnd?.(e);\n },\n [onCompositionEnd]\n );\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (compositionRef.current) {\n // Ignore key events during composition\n return;\n }\n\n if (onKeyDown?.(e) === false) {\n return;\n }\n\n if (\n e.key === \"Enter\" &&\n (submitWhen === \"enter-without-shift\"\n ? !e.shiftKey\n : submitWhen === \"enter-with-mod\" && e[modKey])\n ) {\n e.preventDefault();\n e.stopPropagation();\n onSubmit?.(e);\n }\n },\n [onKeyDown, onSubmit, submitWhen]\n );\n\n useLayoutEffect(() => {\n const desiredSelection = desiredSelectionRef?.current;\n const textarea = textareaRef.current;\n if (desiredSelection && textarea) {\n const { start, end } = desiredSelection;\n desiredSelectionRef.current = null;\n textarea.setSelectionRange(start, end);\n }\n }, [desiredSelectionRef, value]);\n\n // istanbul ignore next\n useEffect(() => {\n const container = containerRef?.current;\n if (!container || !autoResize) {\n return;\n }\n let previousInlineSize: number | undefined;\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n if (entry.target === container) {\n // istanbul ignore next: compatibility\n const currentInlineSize = entry.contentBoxSize\n ? entry.contentBoxSize[0]\n ? entry.contentBoxSize[0].inlineSize\n : (entry.contentBoxSize as unknown as ResizeObserverSize)\n .inlineSize\n : entry.contentRect.width;\n if (\n currentInlineSize !== undefined &&\n currentInlineSize !== previousInlineSize\n ) {\n const isInitial = !previousInlineSize;\n previousInlineSize = currentInlineSize;\n if (!isInitial) {\n requestAnimationFrame(doAutoResize);\n }\n }\n }\n }\n });\n observer.observe(container);\n return () => {\n observer.disconnect();\n };\n }, [autoResize, containerRef, doAutoResize]);\n\n return (\n <textarea\n {...props}\n ref={textareaRef}\n value={value}\n style={{\n ...style,\n ...autoStyle,\n }}\n onChange={handleInputChange}\n onCompositionStart={handleCompositionStart}\n onCompositionEnd={handleCompositionEnd}\n onKeyDown={handleKeyDown}\n />\n );\n}\n"],"names":["ICON_UPLOAD","lib","icon","uid","UploadButton","forwardRef","LegacyUploadButton","_ref","ref","onChange","inputRef","useRef","useImperativeHandle","requestUpload","_inputRef$current","current","click","React","type","multiple","hidden","e","files","target","Array","from","map","file","status","undefined","value","WrappedIconButton","variant","className","tooltip","onClick","_inputRef$current2","K","en","ASK_ANY_THING","COMMON_TASKS","zh","NS","locales","t","i18n","getFixedT","WrappedIcon","wrapBrick","WrappedActions","onActionClick","onItemDragEnd","onItemDragStart","___CSS_LOADER_URL_IMPORT_0___","URL","___CSS_LOADER_EXPORT___","___CSS_LOADER_URL_REPLACEMENT_0___","push","module","id","toString","hiddenElement","getCaretPositionInTextarea","textarea","index","document","createElement","setAttribute","body","appendChild","getMirroredStyle","textContent","slice","span","rect","getBoundingClientRect","remove","top","left","HIDDEN_STYLE","SIZING_STYLE","element","uiTextNodeStyle","window","getComputedStyle","name","getPropertyValue","join","getContentRectsInTextarea","prefix","measureContent","fullRect","length","leadingChar","leadingSpan","leadingRect","trailingChar","trailingSpan","trailingRect","rects","DOMRect","right","bottom","height","width","FileListComponent","onRemove","onAdd","showAsImage","every","startsWith","FileComponent","_extends","key","_ref2","abortController","getFileTypeAndIcon","size","formatFileSize","isImage","image","setImage","useState","useEffect","url","createObjectURL","revokeObjectURL","buttonRemove","theme","classNames","failed","src","spinning","hiddenTextarea","modKey","test","navigator","platform","TextareaAutoResize","LegacyTextareaAutoResize","autoResize","_autoResize","minRows","maxRows","borderSize","paddingSize","containerRef","propValue","style","submitWhen","desiredSelectionRef","onSubmit","onKeyDown","onCompositionStart","onCompositionEnd","props","setValue","textareaRef","autoStyle","setAutoStyle","focus","_textarea$value","valueLength","setSelectionRange","doAutoResize","useCallback","uiTextNode","options","minHeight","maxHeight","overflowY","placeholder","scrollHeight","singleRowHeight","parseFloat","Math","max","min","resize","calculateAutoSizeStyle","flushSync","compositionRef","handleCompositionStart","handleCompositionEnd","handleKeyDown","shiftKey","preventDefault","stopPropagation","useLayoutEffect","desiredSelection","start","end","container","previousInlineSize","observer","ResizeObserver","entries","entry","currentInlineSize","contentBoxSize","inlineSize","contentRect","isInitial","requestAnimationFrame","observe","disconnect"],"sourceRoot":""}