@rainbow-robotics/preview-host 0.1.2-dev.47 → 0.1.2-dev.49

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 (24) hide show
  1. package/README.md +104 -98
  2. package/dist/assets/{AmrCapabilityControl.DEC-3ZAW.js → AmrCapabilityControl.V6oiR3_5.js} +1 -1
  3. package/dist/assets/{__federation_expose_App.CEGQzKIi.js → __federation_expose_App.rWoLmFNr.js} +197 -205
  4. package/dist/assets/{cssMode.DbVSjsLx.js → cssMode.CiNmHTFv.js} +1 -1
  5. package/dist/assets/{freemarker2._fexy6pR.js → freemarker2.B7r_V28s.js} +1 -1
  6. package/dist/assets/{handlebars.CmIcCyqS.js → handlebars.3_K0j9Im.js} +1 -1
  7. package/dist/assets/{html.DRR6RUxW.js → html.DKWAB1mf.js} +1 -1
  8. package/dist/assets/{htmlMode.CoHatVoq.js → htmlMode.CZ2KmtuG.js} +1 -1
  9. package/dist/assets/{index.B_7c3sM4.js → index.Cn3FZx5U.js} +1 -1
  10. package/dist/assets/{index.FZ9eMVCs.js → index.DhDDHapK.js} +1 -1
  11. package/dist/assets/{javascript.pVVbdZDk.js → javascript.DE-dWGjy.js} +1 -1
  12. package/dist/assets/{jsonMode.DgG2kYVi.js → jsonMode.BoVz1jWE.js} +1 -1
  13. package/dist/assets/{liquid.DvX7AUBT.js → liquid.UXJC-JKJ.js} +1 -1
  14. package/dist/assets/{lspLanguageFeatures.Br1RlGKu.js → lspLanguageFeatures.BbVTGB6M.js} +1 -1
  15. package/dist/assets/{mdx.BXnm0chj.js → mdx.B7jHdcUF.js} +1 -1
  16. package/dist/assets/{python.C2Xd8iVA.js → python.DqZWylvN.js} +1 -1
  17. package/dist/assets/{razor.D0mLj0p_.js → razor.Dwj_e3ac.js} +1 -1
  18. package/dist/assets/remoteEntry.js +1 -1
  19. package/dist/assets/{tsMode.Dqbl0l0j.js → tsMode.DLDaOd78.js} +1 -1
  20. package/dist/assets/{typescript.Buj1nTDy.js → typescript.B4V2Badx.js} +1 -1
  21. package/dist/assets/{xml.DHpVTYfo.js → xml.BpqV0vd6.js} +1 -1
  22. package/dist/assets/{yaml.Dz87BMLn.js → yaml.BlIeL5XV.js} +1 -1
  23. package/dist/index.html +3 -3
  24. package/package.json +2 -2
package/README.md CHANGED
@@ -1,62 +1,62 @@
1
- # `@repo/preview-host`
1
+ # `@rainbow-robotics/preview-host`
2
2
 
3
- `@repo/preview-host`는 로봇과 백엔드 없이 Muscat 플러그인을 미리 확인할 수 있는 독립 실행형 **mini-Muscat(nexus) 셸**입니다.
3
+ `@rainbow-robotics/preview-host` is a standalone **mini-Muscat (nexus) shell** for previewing Muscat plugins without a robot or backend.
4
4
 
5
- `apps/web/nexus`를 `plugin-preview` 모드로 빌드하여 생성합니다.
5
+ It's built by building `apps/web/nexus` in `plugin-preview` mode.
6
6
 
7
- 이 프리뷰 셸은 실제 Muscat 환경과 최대한 동일한 UI를 제공합니다.
7
+ This preview shell provides a UI as close as possible to the real Muscat environment.
8
8
 
9
- * 실제 Header
10
- * 실제 LNB
11
- * 실제 패널 구조
12
- * 실제 `rb-components`
13
- * 플러그인 manifest 기반 로딩
9
+ * Real Header
10
+ * Real LNB
11
+ * Real panel structure
12
+ * Real `rb-components`
13
+ * Plugin manifest-based loading
14
14
 
15
- 반면 로봇 및 백엔드 관련 의존성은 모두 mock 처리합니다.
15
+ Robot- and backend-related dependencies, on the other hand, are all mocked.
16
16
 
17
- * 로봇 연결 불필요
18
- * 백엔드 서버 불필요
19
- * API 실패 toast 숨김
20
- * query 재시도 비활성화
21
- * RB 정적 리소스를 로컬에서 제공
17
+ * No robot connection required
18
+ * No backend server required
19
+ * API-failure toasts hidden
20
+ * Query retry disabled
21
+ * RB static resources served locally
22
22
 
23
- 이 패키지는 `muscat-plugin-kit`의 다음 명령에서 사용합니다.
23
+ This package is used by `muscat-plugin-kit`'s:
24
24
 
25
25
  ```bash
26
26
  muscat-pk dev:ui
27
27
  ```
28
28
 
29
- 이를 통해 외부 플러그인 개발자는 `web-rainbow-ui` 모노레포 소스 없이도 실제 Muscat과 유사한 환경에서 플러그인을 미리 확인할 수 있습니다.
29
+ This lets external plugin developers preview their plugin in a Muscat-like environment without the `web-rainbow-ui` monorepo source.
30
30
 
31
- ## 빌드
31
+ ## Build
32
32
 
33
33
  ```bash
34
34
  node build.mjs
35
35
  ```
36
36
 
37
- `nexus`를 `plugin-preview` 모드로 빌드한 뒤, 실행에 필요한 파일을 `./dist` 디렉터리에 구성합니다.
37
+ Builds `nexus` in `plugin-preview` mode, then assembles the files needed to run into the `./dist` directory.
38
38
 
39
- 이미 `nexus` 빌드가 완료된 상태라면 다음 옵션을 사용할 수 있습니다.
39
+ If `nexus` has already been built, you can use:
40
40
 
41
41
  ```bash
42
42
  node build.mjs --skip-build
43
43
  ```
44
44
 
45
- 이 경우 `nexus`를 다시 빌드하지 않고 기존 빌드 결과를 기준으로 `./dist`만 다시 구성합니다.
45
+ This skips rebuilding `nexus` and only reassembles `./dist` from the existing build output.
46
46
 
47
- 생성되는 `dist/` 디렉터리는 Git 관리 대상에서 제외됩니다.
47
+ The generated `dist/` directory is excluded from Git.
48
48
 
49
- `dist/`는 단독 실행 가능한 형태로 구성됩니다.
49
+ `dist/` is structured to be runnable standalone.
50
50
 
51
- 포함되는 주요 항목은 다음과 같습니다.
51
+ Main contents:
52
52
 
53
- * nexus 번들
54
- * RB 정적 리소스
55
- * 이미지
56
- * 폰트
57
- * 기타 런타임 리소스
53
+ * nexus bundle
54
+ * RB static resources
55
+ * images
56
+ * fonts
57
+ * other runtime resources
58
58
 
59
- 정적 리소스는 실제 런타임에서 사용하는 경로와 동일하게 제공됩니다.
59
+ Static resources are served at the same paths used at real runtime.
60
60
 
61
61
  ```text
62
62
  /imgs
@@ -64,23 +64,23 @@ node build.mjs --skip-build
64
64
  ...
65
65
  ```
66
66
 
67
- ## 실행
67
+ ## Run
68
68
 
69
69
  ```bash
70
70
  rb-preview-host --plugin <built-plugin-dir> [--port 4180] [--dist <dir>]
71
71
  ```
72
72
 
73
- ### 옵션
73
+ ### Options
74
74
 
75
- `--plugin`은 `muscat-pk build`로 생성된 플러그인 빌드 디렉터리를 지정합니다.
75
+ `--plugin` points to a plugin build directory produced by `muscat-pk build`.
76
76
 
77
77
  ```bash
78
78
  rb-preview-host --plugin ./dist/plugin
79
79
  ```
80
80
 
81
- `--port`는 preview host가 실행될 포트를 지정합니다.
81
+ `--port` sets the port preview-host runs on.
82
82
 
83
- 기본값은 `4180`입니다.
83
+ Defaults to `4180`.
84
84
 
85
85
  ```bash
86
86
  rb-preview-host \
@@ -88,7 +88,7 @@ rb-preview-host \
88
88
  --port 4180
89
89
  ```
90
90
 
91
- `--dist`는 preview-host의 정적 번들 디렉터리를 별도로 지정할 때 사용합니다.
91
+ `--dist` overrides the preview-host static bundle directory.
92
92
 
93
93
  ```bash
94
94
  rb-preview-host \
@@ -96,153 +96,159 @@ rb-preview-host \
96
96
  --dist ./preview-host-dist
97
97
  ```
98
98
 
99
- ## 플러그인 빌드 디렉터리 요구사항
99
+ The following options are also supported (all optional — `muscat-pk dev` fills them in internally).
100
100
 
101
- `--plugin`으로 지정한 디렉터리는 `muscat-pk build`의 출력 디렉터리여야 합니다.
101
+ * `--socket-url`: the Socket.IO URL the plugin connects to (`window.__RB_PLUGIN_PREVIEW_SOCKET_URL__`)
102
+ * `--robot-host`: robot host override (`window.__RB_ROBOT_HOST__`)
103
+ * `--dev-server-url`: the plugin's own Vite dev server URL (`window.__RB_PLUGIN_DEV_SERVER_URL__`) — used when mounting a `dev` UI entry directly
102
104
 
103
- 다음 파일을 포함해야 합니다.
105
+ ## Plugin build directory requirements
106
+
107
+ The directory passed to `--plugin` must be an output directory from `muscat-pk build`.
108
+
109
+ It must contain:
104
110
 
105
111
  ```text
106
112
  manifest.json
107
- sandbox.html
108
- content.js
113
+ <ui-entry>.js (e.g. content.js — one is generated per manifest contributes[].ui entry)
109
114
  assets/
110
115
  ```
111
116
 
112
- `assets/`는 플러그인에서 별도 정적 리소스를 사용하는 경우에만 존재할 수 있습니다.
117
+ The host mounts `<ui-entry>.js` by importing it directly as a plain ESM module — no `sandbox.html`/iframe is involved.
118
+
119
+ `assets/` is only present if the plugin uses its own static resources.
113
120
 
114
- 지정된 플러그인 디렉터리는 preview host에서 다음 경로로 마운트됩니다.
121
+ The plugin directory you specify is mounted in preview host at:
115
122
 
116
123
  ```text
117
124
  /plugin-dev/
118
125
  ```
119
126
 
120
- 프리뷰 셸은 `serve.mjs`가 주입한 전역 변수를 통해 플러그인과 정적 리소스 위치를 확인합니다.
127
+ The preview shell resolves the plugin and static-resource locations through the global variables `serve.mjs` injects.
121
128
 
122
- ## 전역 변수
129
+ ## Global variables
123
130
 
124
131
  ### `window.__RB_PLUGIN_PREVIEW_HOST__`
125
132
 
126
- preview-host 모드를 활성화합니다.
133
+ Activates preview-host mode.
127
134
 
128
135
  ```ts
129
136
  window.__RB_PLUGIN_PREVIEW_HOST__ = true;
130
137
  ```
131
138
 
132
- 이 값이 활성화되면 nexus는 실제 백엔드 대신 mock 환경으로 동작합니다.
139
+ When set, nexus runs against a mock environment instead of the real backend.
133
140
 
134
- 대표적으로 다음 처리가 적용됩니다.
141
+ Typical effects:
135
142
 
136
- * 로봇 연결 mock
137
- * 백엔드 API mock
138
- * API 실패 toast 억제
139
- * query 재시도 비활성화
143
+ * Mocked robot connection
144
+ * Mocked backend API
145
+ * Suppressed API-failure toasts
146
+ * Disabled query retry
140
147
 
141
148
  ### `window.__RB_PLUGIN_PREVIEW_BASE__`
142
149
 
143
- 플러그인이 제공되는 기본 URL입니다.
150
+ The base URL the plugin is served from.
144
151
 
145
- 기본값은 다음과 같습니다.
152
+ Defaults to:
146
153
 
147
154
  ```text
148
155
  /plugin-dev
149
156
  ```
150
157
 
151
- 예시:
158
+ Example:
152
159
 
153
160
  ```ts
154
161
  window.__RB_PLUGIN_PREVIEW_BASE__ = "/plugin-dev";
155
162
  ```
156
163
 
157
- 프리뷰 셸은 이 경로를 기준으로 다음 파일을 읽습니다.
164
+ The preview shell reads the following files relative to this path:
158
165
 
159
166
  ```text
160
167
  /plugin-dev/manifest.json
161
- /plugin-dev/sandbox.html
162
- /plugin-dev/content.js
168
+ /plugin-dev/<ui-entry>.js
163
169
  /plugin-dev/assets/*
164
170
  ```
165
171
 
166
172
  ### `window.__RB_ASSETS_BASE_URL__`
167
173
 
168
- RB 정적 리소스를 제공하는 origin을 지정합니다.
174
+ The origin RB static resources are served from.
169
175
 
170
- 예시:
176
+ Example:
171
177
 
172
178
  ```ts
173
179
  window.__RB_ASSETS_BASE_URL__ = "http://localhost:4180";
174
180
  ```
175
181
 
176
- 이를 통해 nexus 및 `rb-components`가 사용하는 정적 리소스를 preview host에서 로드할 수 있습니다.
182
+ This lets preview host load the static resources used by nexus and `rb-components`.
177
183
 
178
- 대표적인 리소스 경로는 다음과 같습니다.
184
+ Typical resource paths:
179
185
 
180
186
  ```text
181
187
  /imgs
182
188
  /fonts
183
189
  ```
184
190
 
185
- ## 전역 변수 정리
191
+ ## Global variable summary
186
192
 
187
- | 전역 변수 | 의미 |
193
+ | Global variable | Meaning |
188
194
  | ----------------------------------- | --------------------------------------- |
189
- | `window.__RB_PLUGIN_PREVIEW_HOST__` | preview-host 모드를 활성화하고 백엔드 의존성을 mock 처리 |
190
- | `window.__RB_PLUGIN_PREVIEW_BASE__` | 플러그인이 마운트된 기본 URL. 기본값은 `/plugin-dev` |
191
- | `window.__RB_ASSETS_BASE_URL__` | RB 이미지, 폰트 등 정적 리소스를 제공하는 origin |
195
+ | `window.__RB_PLUGIN_PREVIEW_HOST__` | Activates preview-host mode and mocks backend dependencies |
196
+ | `window.__RB_PLUGIN_PREVIEW_BASE__` | Base URL the plugin is mounted at. Defaults to `/plugin-dev` |
197
+ | `window.__RB_ASSETS_BASE_URL__` | Origin serving RB images, fonts, and other static resources |
192
198
 
193
- ## 개발 모드와의 관계
199
+ ## Relationship to dev mode
194
200
 
195
- `muscat-pk dev:ui`는 nexus의 Vite 개발 서버를 직접 실행합니다.
201
+ `muscat-pk dev:ui` runs nexus's Vite dev server directly.
196
202
 
197
203
  ```bash
198
204
  vite --mode plugin-preview
199
205
  ```
200
206
 
201
- 이 방식은 HMR이 활성화된 개발용 preview-host 런타임입니다.
207
+ This is a dev-mode preview-host runtime with HMR enabled.
202
208
 
203
- 즉, `muscat-pk dev:ui`와 `@repo/preview-host`는 서로 다른 구현이 아니라 동일한 preview-host 런타임을 다른 형태로 사용하는 구조입니다.
209
+ In other words, `muscat-pk dev:ui` and `@rainbow-robotics/preview-host` aren't separate implementations — they're the same preview-host runtime used in two different forms.
204
210
 
205
211
  ### `muscat-pk dev:ui`
206
212
 
207
- 모노레포 소스를 기준으로 Vite 개발 서버를 직접 실행합니다.
213
+ Runs the Vite dev server directly against the monorepo source.
208
214
 
209
- 특징은 다음과 같습니다.
215
+ Characteristics:
210
216
 
211
- * Vite 기반 개발 서버
212
- * HMR 지원
213
- * 소스 변경 즉시 반영
214
- * 개발 환경에 적합
217
+ * Vite-based dev server
218
+ * HMR support
219
+ * Source changes reflected immediately
220
+ * Suited for development
215
221
 
216
- ### `@repo/preview-host`
222
+ ### `@rainbow-robotics/preview-host`
217
223
 
218
- 동일한 런타임을 정적 번들로 패키징한 배포용 형태입니다.
224
+ The same runtime packaged as a static bundle for distribution.
219
225
 
220
- 특징은 다음과 같습니다.
226
+ Characteristics:
221
227
 
222
- * 모노레포 소스 불필요
223
- * 사전 빌드된 nexus 번들 사용
224
- * 독립 실행 가능
225
- * 외부 플러그인 개발자에게 배포 가능
228
+ * No monorepo source required
229
+ * Uses a prebuilt nexus bundle
230
+ * Runs standalone
231
+ * Distributable to external plugin developers
226
232
 
227
- 전체 관계는 다음과 같습니다.
233
+ The overall relationship:
228
234
 
229
235
  ```text
230
236
  apps/web/nexus
231
- └─ plugin-preview 모드
237
+ └─ plugin-preview mode
232
238
  ├─ muscat-pk dev:ui
233
- │ └─ Vite 개발 서버 직접 실행
234
- │ └─ HMR 지원
239
+ │ └─ runs the Vite dev server directly
240
+ │ └─ HMR support
235
241
  │
236
- └─ @repo/preview-host
237
- └─ 정적 번들로 패키징
238
- └─ 모노레포 소스 없이 실행
242
+ └─ @rainbow-robotics/preview-host
243
+ └─ packaged as a static bundle
244
+ └─ runs without the monorepo source
239
245
  ```
240
246
 
241
- 결과적으로 외부 개발자는 `web-rainbow-ui` 소스를 직접 보유하지 않아도 다음 요소를 포함한 실제 Muscat과 유사한 프리뷰 환경을 사용할 수 있습니다.
247
+ As a result, external developers get a Muscat-like preview environment — without holding a copy of the `web-rainbow-ui` source — that includes:
242
248
 
243
- * 실제 nexus 레이아웃
244
- * 실제 Header 및 LNB
245
- * 실제 패널
246
- * 실제 `rb-components`
247
- * 실제 manifest 기반 플러그인 로딩
248
- * mock 처리된 로봇 및 백엔드 환경
249
+ * Real nexus layout
250
+ * Real Header and LNB
251
+ * Real panels
252
+ * Real `rb-components`
253
+ * Real manifest-based plugin loading
254
+ * Mocked robot and backend environment
@@ -1 +1 @@
1
- import{importShared as f}from"./__federation_fn_import.DdkEuT6t.js";import{dr as g,aE as s,_ as t,aM as v,dl as p,a0 as b,dk as c,cv as O,bL as E,aC as F,aL as B,cg as P,cs as w,aO as D,f1 as _,fJ as L}from"./RBQrBarCodeGuideModal.CegVepfq.js";import{f as T}from"./index.FZ9eMVCs.js";const{useQuery:M}=await f("@tanstack/react-query"),C=[{key:"dock",endpoint:"/{robot_model}/capability/dock",labelKey:"move.amr.rightPanel.capability.dock"},{key:"io",endpoint:"/{robot_model}/capability/Io",labelKey:"move.amr.rightPanel.capability.io"},{key:"camera",endpoint:"/{robot_model}/capability/camera",labelKey:"move.amr.rightPanel.capability.camera"},{key:"lidar2d",endpoint:"/{robot_model}/capability/lidar2d",labelKey:"move.amr.rightPanel.capability.lidar2d"},{key:"lidar3d",endpoint:"/{robot_model}/capability/lidar3d",labelKey:"move.amr.rightPanel.capability.lidar3d"},{key:"imu",endpoint:"/{robot_model}/capability/imu",labelKey:"move.amr.rightPanel.capability.imu"},{key:"safetyBumper",endpoint:"/{robot_model}/capability/safetyBumper",labelKey:"move.amr.rightPanel.capability.safetyBumper"},{key:"safetyInterlock",endpoint:"/{robot_model}/capability/safetyInterlock",labelKey:"move.amr.rightPanel.capability.safetyInterlock"},{key:"safetyObstacle",endpoint:"/{robot_model}/capability/safetyObstacle",labelKey:"move.amr.rightPanel.capability.safetyObstacle"},{key:"safetyOperationStop",endpoint:"/{robot_model}/capability/safetyOperationStop",labelKey:"move.amr.rightPanel.capability.safetyOperationStop"},{key:"safetySpeedControl",endpoint:"/{robot_model}/capability/safetySpeedControl",labelKey:"move.amr.rightPanel.capability.safetySpeedControl"},{key:"tabos",endpoint:"/{robot_model}/capability/tabos",labelKey:"move.amr.rightPanel.capability.tabos"}],R=e=>typeof e=="object"&&e!==null&&"enabled"in e&&e.enabled===!1,K=e=>{if(e instanceof Error)return e.message;if(typeof e=="object"&&e!==null&&"message"in e){const a=e.message;if(typeof a=="string")return a}},q=async({robot_model:e})=>{const a=await Promise.allSettled(C.map(l=>{const n=l.endpoint.replace("{robot_model}",e);return T.get(n)}));return C.map((l,n)=>{const r=a[n];return r.status==="fulfilled"?{...l,supported:!R(r.value),data:r.value}:{...l,supported:!1,data:null,errorMessage:K(r.reason)}})},$=({robot_model:e,enabled:a=!0})=>M({queryKey:["amrCapabilities",e],queryFn:()=>q({robot_model:e}),enabled:!!e&&a,staleTime:5*1e3,gcTime:60*1e3}),{useMutation:U}=await f("@tanstack/react-query"),V=()=>U({mutationFn:({robot_model:e,target:a,frequency:l})=>T.post(`/${e}/control/streamFrequency`,{target:a,frequency:Math.min(10,Math.max(0,l))})}),{useState:k}=await f("react"),j=4294967295,x=e=>{if(!(e==null||e===j))return`${e} ms`},z={0:"NONE",1:"CHARGING",2:"COMPLETE",3:"FAIL",4:"CANCEL"},G={0:"DEFAULT",1:"TABOS"},Y={0:"CABLE",1:"CONTACT",2:"INDUCTIVE"},H={0:"RPLIDAR",1:"SICK",2:"LAKI",3:"LIVOX",4:"HOKUYO"},Q={0:"ORBBEC"},i=({label:e,children:a})=>s(p,{className:"items-center justify-between gap-3",children:[t("span",{className:"typo-compact-xs-normal text-fg-subtle shrink-0",children:e}),t("span",{className:b("typo-compact-xs-normal text-right",a!=null?"text-fg-default":"text-fg-subtler"),children:a??"—"})]}),X={default:"gray",success:"green",warning:"orange",danger:"red"},y=({label:e,variant:a="default"})=>t(D,{type:"soft",color:X[a],children:e}),h=({label:e,value:a})=>t(i,{label:e,children:t(y,{label:a?"ON":"OFF",variant:a?"success":"default"})}),u=({label:e,bits:a})=>s(c,{className:"gap-1",children:[t("span",{className:"typo-compact-xs-normal text-fg-subtle",children:e}),a?.length?t(p,{className:"gap-1",children:a.map((l,n)=>t("div",{className:b("size-4 rounded-sm border text-center leading-4",l?"border-fg-success bg-fill-success-subtlest":"border-border-subtler bg-fill-disabled"),children:t("span",{className:b("typo-compact-2xs-normal",l?"text-fg-success":"text-fg-subtler"),children:n})},n))}):t("span",{className:"typo-compact-xs-normal text-fg-subtler",children:"—"})]}),N=({label:e,connection:a,rows:l,children:n})=>{const{t:r}=g();return s(c,{className:"bg-fill-disabled gap-1.5 rounded-md p-2.5",children:[s(p,{className:"items-center justify-between gap-3",children:[t("span",{className:"typo-compact-xs-semibold text-fg-default min-w-0 break-words",children:e}),t("span",{className:b("typo-compact-2xs-medium shrink-0",a?"text-fg-success":"text-fg-subtler"),children:r(a?"settings.amr.frs.status.connected":"settings.amr.frs.status.disconnected")})]}),l.map(({key:o,value:d})=>t(i,{label:o,children:d},o)),n]})},J=({label:e,value:a})=>t(D,{type:"soft",color:a?"green":"gray",children:s(p,{className:"items-center gap-1",children:[a?t(_,{className:"size-3"}):t(L,{className:"size-3"}),t("span",{children:e}),t("span",{className:"font-semibold",children:a?"On":"Off"})]})}),I=({flags:e})=>t(p,{className:"flex-wrap gap-1.5",children:e.map(({label:a,value:l})=>t(J,{label:a,value:l},a))}),W=({streams:e})=>e.length?s(c,{className:"border-subtle mt-0.5 gap-1 border-t pt-1.5",children:[t("span",{className:"typo-compact-xs-normal text-fg-subtle",children:"Streams"}),t(p,{className:"flex-wrap gap-1",children:e.map(a=>s(p,{className:"border-subtle bg-alt-1 items-center gap-1 rounded px-1.5 py-1",children:[t("span",{className:"typo-compact-2xs-semibold text-fg-default",children:a.quality}),s("span",{className:"typo-compact-2xs-normal text-fg-subtle",children:[a.width,"x",a.height]}),s("span",{className:"typo-compact-2xs-normal text-fg-subtler",children:[a.fps,"fps"]})]},`${a.camId}-${a.quality}`))})]}):null,Z=({data:e})=>{const a=z[e.chargeState??-1]??String(e.chargeState),l=e.chargeState===1?"success":e.chargeState===3?"danger":e.chargeState===4?"warning":"default";return s(c,{className:"gap-2",children:[s(c,{className:"bg-fill-disabled gap-2 rounded-md p-2.5",children:[t(h,{label:"Dock State",value:e.dockState}),t(i,{label:"Charge State",children:t(y,{label:a,variant:l})}),s(i,{label:"Battery",children:[e.batteryPercent?.toFixed(1)," %"]}),s(i,{label:"Charge Current",children:[e.chargeCurrent?.toFixed(2)," A"]}),s(i,{label:"Contact Voltage",children:[e.contactVoltage?.toFixed(2)," V"]}),t(i,{label:"Battery Type",children:t(y,{label:G[e.batteryType??0]??"—"})})]}),s(p,{className:"items-center gap-1.5 px-0.5",children:[t("span",{className:"typo-compact-xs-normal text-fg-subtle shrink-0",children:"Charge Type"}),e.chargeType?.length?t(p,{className:"flex-wrap gap-1.5",children:e.chargeType.map(n=>t(y,{label:Y[n]??String(n),variant:"default"},n))}):t("span",{className:"typo-compact-xs-normal text-fg-subtler",children:"—"})]})]})},ee=({data:e})=>s(c,{className:"gap-3 p-0.5",children:[t(u,{label:"MCU0 DIO",bits:e.mcu0Dio}),t(u,{label:"MCU1 DIO",bits:e.mcu1Dio}),t(u,{label:"MCU0 DIN",bits:e.mcu0Din}),t(u,{label:"MCU1 DIN",bits:e.mcu1Din})]}),ae=({data:e})=>s(c,{className:"gap-2",children:[t(I,{flags:[{label:"Obstacle",value:e.enabledObs},{label:"Depth",value:e.enabledDepth},{label:"Filter",value:e.enabledFilter}]}),e.info?.length?e.info.map((a,l)=>{const n=typeof a.type=="number"?Q[a.type]??String(a.type):a.type??"—",r=a.camId??a.index??l,o=e.rtspInfo?.filter(d=>d.camId===r)??[];return t(N,{label:`Camera ${r}${a.serial?` · ${a.serial}`:""}`,connection:a.connection,rows:[{key:"Type",value:n},{key:"TF",value:a.tf?.length?a.tf.map(d=>d.toFixed(2)).join(", "):void 0},{key:"Data Age",value:x(a.dataAgeMs)}],children:t(W,{streams:o})},l)}):t("span",{className:"typo-compact-xs-normal text-fg-subtler px-0.5",children:"—"})]}),A=({data:e,is3d:a=!1})=>s(c,{className:"gap-2",children:[t(I,{flags:[{label:"Obstacle",value:e.enabledObs}]}),e.info?.length?e.info.map((l,n)=>t(N,{label:`Lidar ${l.index??n}${l.serial?` · ${l.serial}`:""}`,connection:l.connection,rows:[{key:"Type",value:H[l.type]??String(l.type??"—")},...a?[]:[{key:"IP",value:l.ip}],{key:"Safety",value:l.safety!==void 0?l.safety?"Safety":"Normal":void 0},{key:"TF",value:l.tf?.length?l.tf.map(r=>r.toFixed(2)).join(", "):void 0},{key:"Data Age",value:x(l.dataAgeMs)}]},n)):t("span",{className:"typo-compact-xs-normal text-fg-subtler px-0.5",children:"—"})]}),te=({data:e})=>t(c,{className:"gap-2",children:e.info?.length?e.info.map((a,l)=>t(N,{label:`IMU ${a.index??l}${a.serial?` · ${a.serial}`:""}`,connection:a.connection,rows:[{key:"Type",value:a.type===1?"IMU":"DEFAULT"},{key:"Data Age",value:x(a.dataAgeMs)}]},l)):t("span",{className:"typo-compact-xs-normal text-fg-subtler px-0.5",children:"—"})}),le=({data:e})=>{const a=[{label:"Bumper State",value:e.bumperState},{label:"Interlock State",value:e.interlockState},{label:"Obstacle Detect",value:e.obsDetect},{label:"Operation Stop",value:e.operationStopState},{label:"Speed Control",value:e.speedControlState}].filter(l=>l.value!==void 0);return s(c,{className:"bg-fill-disabled gap-2 rounded-md p-2.5",children:[t(h,{label:"Enabled",value:e.enabled}),a.map(l=>t(h,{label:l.label,value:l.value},l.label))]})},se=({data:e})=>s(c,{className:"bg-fill-disabled gap-2 rounded-md p-2.5",children:[s(i,{label:"Voltage",children:[e.tabosVoltage?.toFixed(2)," V"]}),s(i,{label:"Current",children:[e.tabosCurrent?.toFixed(2)," A"]}),s(i,{label:"SOC",children:[e.tabosSoc?.toFixed(1)," %"]}),s(i,{label:"SOH",children:[e.tabosSoh?.toFixed(1)," %"]}),s(i,{label:"Temp",children:[e.tabosTemp?.toFixed(1)," °C"]})]}),ne=({capKey:e,data:a})=>{switch(e){case"dock":return t(Z,{data:a});case"io":return t(ee,{data:a});case"camera":return t(ae,{data:a});case"lidar2d":return t(A,{data:a});case"lidar3d":return t(A,{data:a,is3d:!0});case"imu":return t(te,{data:a});case"tabos":return t(se,{data:a});default:return t(le,{data:a})}},re=[{label:"LiDAR 2D",value:"lidar2d"},{label:"LiDAR 3D",value:"lidar3d"},{label:"OBS Map",value:"obsMap"}],ce=({robotModel:e})=>{const[a,l]=k("lidar2d"),[n,r]=k("1"),{mutate:o,isPending:d}=V();return s(c,{className:"gap-2 pb-1",children:[s(p,{className:"items-center justify-between gap-2",children:[t("span",{className:"typo-compact-xs-normal text-fg-subtle",children:"Target"}),t(F,{size:"2xs",variant:"brand",disabled:d,onClick:()=>{const m=Math.min(10,Math.max(0,Number(n)));o({robot_model:e,target:a,frequency:m})},children:"Set"})]}),t(P,{size:"sm",value:a,handleChange:m=>l(m),children:re.map(({label:m,value:S})=>t(B,{value:S,children:m},S))}),t(p,{className:"items-center gap-2",children:t(w,{className:"flex-1",size:"sm",value:n,step:1,digit:0,fixedDigit:0,min:"0",max:"10",handleChange:m=>r(m)})})]})},oe=({item:e})=>{const{t:a}=g();return e.supported?e.data?t("div",{className:"pb-1",children:t(ne,{capKey:e.key,data:e.data})}):null:t("p",{className:"typo-compact-xs-normal text-fg-disabled px-1 py-2",children:a("move.amr.rightPanel.capability.status.notSupported")})},ie=()=>{const{t:e}=g();return t(E,{className:"flex-1 [&_[data-slot='empty-view-section']]:h-full",type:"icon",icon:t(O,{size:20}),message:e("move.amr.rightPanel.capability.status.loading")})},ue=({className:e,robotModel:a})=>{const{t:l}=g(),{data:n,isLoading:r}=$({robot_model:a});return s(c,{className:b("AmrCapabilityControl h-full min-h-0",e),children:[r&&t(ie,{}),(n??[]).map(o=>t("div",{className:"border-subtler border-b px-1 py-1",children:t(v,{disabled:!o.supported,title:t(p,{className:"w-full items-center justify-between gap-2",children:t("span",{className:b("typo-compact-sm2-semibold min-w-0 truncate",o.supported?"text-fg-default":"text-fg-disabled"),children:l(o.labelKey)})}),children:t(oe,{item:o})})},o.key)),t("div",{className:"border-subtler border-b px-1 py-1",children:t(v,{title:t("span",{className:"typo-compact-sm2-semibold text-fg-default",children:l("move.amr.rightPanel.capability.streamFrequency")}),children:t(ce,{robotModel:a})})})]})};export{ue as default};
1
+ import{importShared as f}from"./__federation_fn_import.DdkEuT6t.js";import{dr as g,aE as s,_ as t,aM as v,dl as p,a0 as b,dk as c,cv as O,bL as E,aC as F,aL as B,cg as P,cs as w,aO as D,f1 as _,fJ as L}from"./RBQrBarCodeGuideModal.CegVepfq.js";import{f as T}from"./index.DhDDHapK.js";const{useQuery:M}=await f("@tanstack/react-query"),C=[{key:"dock",endpoint:"/{robot_model}/capability/dock",labelKey:"move.amr.rightPanel.capability.dock"},{key:"io",endpoint:"/{robot_model}/capability/Io",labelKey:"move.amr.rightPanel.capability.io"},{key:"camera",endpoint:"/{robot_model}/capability/camera",labelKey:"move.amr.rightPanel.capability.camera"},{key:"lidar2d",endpoint:"/{robot_model}/capability/lidar2d",labelKey:"move.amr.rightPanel.capability.lidar2d"},{key:"lidar3d",endpoint:"/{robot_model}/capability/lidar3d",labelKey:"move.amr.rightPanel.capability.lidar3d"},{key:"imu",endpoint:"/{robot_model}/capability/imu",labelKey:"move.amr.rightPanel.capability.imu"},{key:"safetyBumper",endpoint:"/{robot_model}/capability/safetyBumper",labelKey:"move.amr.rightPanel.capability.safetyBumper"},{key:"safetyInterlock",endpoint:"/{robot_model}/capability/safetyInterlock",labelKey:"move.amr.rightPanel.capability.safetyInterlock"},{key:"safetyObstacle",endpoint:"/{robot_model}/capability/safetyObstacle",labelKey:"move.amr.rightPanel.capability.safetyObstacle"},{key:"safetyOperationStop",endpoint:"/{robot_model}/capability/safetyOperationStop",labelKey:"move.amr.rightPanel.capability.safetyOperationStop"},{key:"safetySpeedControl",endpoint:"/{robot_model}/capability/safetySpeedControl",labelKey:"move.amr.rightPanel.capability.safetySpeedControl"},{key:"tabos",endpoint:"/{robot_model}/capability/tabos",labelKey:"move.amr.rightPanel.capability.tabos"}],R=e=>typeof e=="object"&&e!==null&&"enabled"in e&&e.enabled===!1,K=e=>{if(e instanceof Error)return e.message;if(typeof e=="object"&&e!==null&&"message"in e){const a=e.message;if(typeof a=="string")return a}},q=async({robot_model:e})=>{const a=await Promise.allSettled(C.map(l=>{const n=l.endpoint.replace("{robot_model}",e);return T.get(n)}));return C.map((l,n)=>{const r=a[n];return r.status==="fulfilled"?{...l,supported:!R(r.value),data:r.value}:{...l,supported:!1,data:null,errorMessage:K(r.reason)}})},$=({robot_model:e,enabled:a=!0})=>M({queryKey:["amrCapabilities",e],queryFn:()=>q({robot_model:e}),enabled:!!e&&a,staleTime:5*1e3,gcTime:60*1e3}),{useMutation:U}=await f("@tanstack/react-query"),V=()=>U({mutationFn:({robot_model:e,target:a,frequency:l})=>T.post(`/${e}/control/streamFrequency`,{target:a,frequency:Math.min(10,Math.max(0,l))})}),{useState:k}=await f("react"),j=4294967295,x=e=>{if(!(e==null||e===j))return`${e} ms`},z={0:"NONE",1:"CHARGING",2:"COMPLETE",3:"FAIL",4:"CANCEL"},G={0:"DEFAULT",1:"TABOS"},Y={0:"CABLE",1:"CONTACT",2:"INDUCTIVE"},H={0:"RPLIDAR",1:"SICK",2:"LAKI",3:"LIVOX",4:"HOKUYO"},Q={0:"ORBBEC"},i=({label:e,children:a})=>s(p,{className:"items-center justify-between gap-3",children:[t("span",{className:"typo-compact-xs-normal text-fg-subtle shrink-0",children:e}),t("span",{className:b("typo-compact-xs-normal text-right",a!=null?"text-fg-default":"text-fg-subtler"),children:a??"—"})]}),X={default:"gray",success:"green",warning:"orange",danger:"red"},y=({label:e,variant:a="default"})=>t(D,{type:"soft",color:X[a],children:e}),h=({label:e,value:a})=>t(i,{label:e,children:t(y,{label:a?"ON":"OFF",variant:a?"success":"default"})}),u=({label:e,bits:a})=>s(c,{className:"gap-1",children:[t("span",{className:"typo-compact-xs-normal text-fg-subtle",children:e}),a?.length?t(p,{className:"gap-1",children:a.map((l,n)=>t("div",{className:b("size-4 rounded-sm border text-center leading-4",l?"border-fg-success bg-fill-success-subtlest":"border-border-subtler bg-fill-disabled"),children:t("span",{className:b("typo-compact-2xs-normal",l?"text-fg-success":"text-fg-subtler"),children:n})},n))}):t("span",{className:"typo-compact-xs-normal text-fg-subtler",children:"—"})]}),N=({label:e,connection:a,rows:l,children:n})=>{const{t:r}=g();return s(c,{className:"bg-fill-disabled gap-1.5 rounded-md p-2.5",children:[s(p,{className:"items-center justify-between gap-3",children:[t("span",{className:"typo-compact-xs-semibold text-fg-default min-w-0 break-words",children:e}),t("span",{className:b("typo-compact-2xs-medium shrink-0",a?"text-fg-success":"text-fg-subtler"),children:r(a?"settings.amr.frs.status.connected":"settings.amr.frs.status.disconnected")})]}),l.map(({key:o,value:d})=>t(i,{label:o,children:d},o)),n]})},J=({label:e,value:a})=>t(D,{type:"soft",color:a?"green":"gray",children:s(p,{className:"items-center gap-1",children:[a?t(_,{className:"size-3"}):t(L,{className:"size-3"}),t("span",{children:e}),t("span",{className:"font-semibold",children:a?"On":"Off"})]})}),I=({flags:e})=>t(p,{className:"flex-wrap gap-1.5",children:e.map(({label:a,value:l})=>t(J,{label:a,value:l},a))}),W=({streams:e})=>e.length?s(c,{className:"border-subtle mt-0.5 gap-1 border-t pt-1.5",children:[t("span",{className:"typo-compact-xs-normal text-fg-subtle",children:"Streams"}),t(p,{className:"flex-wrap gap-1",children:e.map(a=>s(p,{className:"border-subtle bg-alt-1 items-center gap-1 rounded px-1.5 py-1",children:[t("span",{className:"typo-compact-2xs-semibold text-fg-default",children:a.quality}),s("span",{className:"typo-compact-2xs-normal text-fg-subtle",children:[a.width,"x",a.height]}),s("span",{className:"typo-compact-2xs-normal text-fg-subtler",children:[a.fps,"fps"]})]},`${a.camId}-${a.quality}`))})]}):null,Z=({data:e})=>{const a=z[e.chargeState??-1]??String(e.chargeState),l=e.chargeState===1?"success":e.chargeState===3?"danger":e.chargeState===4?"warning":"default";return s(c,{className:"gap-2",children:[s(c,{className:"bg-fill-disabled gap-2 rounded-md p-2.5",children:[t(h,{label:"Dock State",value:e.dockState}),t(i,{label:"Charge State",children:t(y,{label:a,variant:l})}),s(i,{label:"Battery",children:[e.batteryPercent?.toFixed(1)," %"]}),s(i,{label:"Charge Current",children:[e.chargeCurrent?.toFixed(2)," A"]}),s(i,{label:"Contact Voltage",children:[e.contactVoltage?.toFixed(2)," V"]}),t(i,{label:"Battery Type",children:t(y,{label:G[e.batteryType??0]??"—"})})]}),s(p,{className:"items-center gap-1.5 px-0.5",children:[t("span",{className:"typo-compact-xs-normal text-fg-subtle shrink-0",children:"Charge Type"}),e.chargeType?.length?t(p,{className:"flex-wrap gap-1.5",children:e.chargeType.map(n=>t(y,{label:Y[n]??String(n),variant:"default"},n))}):t("span",{className:"typo-compact-xs-normal text-fg-subtler",children:"—"})]})]})},ee=({data:e})=>s(c,{className:"gap-3 p-0.5",children:[t(u,{label:"MCU0 DIO",bits:e.mcu0Dio}),t(u,{label:"MCU1 DIO",bits:e.mcu1Dio}),t(u,{label:"MCU0 DIN",bits:e.mcu0Din}),t(u,{label:"MCU1 DIN",bits:e.mcu1Din})]}),ae=({data:e})=>s(c,{className:"gap-2",children:[t(I,{flags:[{label:"Obstacle",value:e.enabledObs},{label:"Depth",value:e.enabledDepth},{label:"Filter",value:e.enabledFilter}]}),e.info?.length?e.info.map((a,l)=>{const n=typeof a.type=="number"?Q[a.type]??String(a.type):a.type??"—",r=a.camId??a.index??l,o=e.rtspInfo?.filter(d=>d.camId===r)??[];return t(N,{label:`Camera ${r}${a.serial?` · ${a.serial}`:""}`,connection:a.connection,rows:[{key:"Type",value:n},{key:"TF",value:a.tf?.length?a.tf.map(d=>d.toFixed(2)).join(", "):void 0},{key:"Data Age",value:x(a.dataAgeMs)}],children:t(W,{streams:o})},l)}):t("span",{className:"typo-compact-xs-normal text-fg-subtler px-0.5",children:"—"})]}),A=({data:e,is3d:a=!1})=>s(c,{className:"gap-2",children:[t(I,{flags:[{label:"Obstacle",value:e.enabledObs}]}),e.info?.length?e.info.map((l,n)=>t(N,{label:`Lidar ${l.index??n}${l.serial?` · ${l.serial}`:""}`,connection:l.connection,rows:[{key:"Type",value:H[l.type]??String(l.type??"—")},...a?[]:[{key:"IP",value:l.ip}],{key:"Safety",value:l.safety!==void 0?l.safety?"Safety":"Normal":void 0},{key:"TF",value:l.tf?.length?l.tf.map(r=>r.toFixed(2)).join(", "):void 0},{key:"Data Age",value:x(l.dataAgeMs)}]},n)):t("span",{className:"typo-compact-xs-normal text-fg-subtler px-0.5",children:"—"})]}),te=({data:e})=>t(c,{className:"gap-2",children:e.info?.length?e.info.map((a,l)=>t(N,{label:`IMU ${a.index??l}${a.serial?` · ${a.serial}`:""}`,connection:a.connection,rows:[{key:"Type",value:a.type===1?"IMU":"DEFAULT"},{key:"Data Age",value:x(a.dataAgeMs)}]},l)):t("span",{className:"typo-compact-xs-normal text-fg-subtler px-0.5",children:"—"})}),le=({data:e})=>{const a=[{label:"Bumper State",value:e.bumperState},{label:"Interlock State",value:e.interlockState},{label:"Obstacle Detect",value:e.obsDetect},{label:"Operation Stop",value:e.operationStopState},{label:"Speed Control",value:e.speedControlState}].filter(l=>l.value!==void 0);return s(c,{className:"bg-fill-disabled gap-2 rounded-md p-2.5",children:[t(h,{label:"Enabled",value:e.enabled}),a.map(l=>t(h,{label:l.label,value:l.value},l.label))]})},se=({data:e})=>s(c,{className:"bg-fill-disabled gap-2 rounded-md p-2.5",children:[s(i,{label:"Voltage",children:[e.tabosVoltage?.toFixed(2)," V"]}),s(i,{label:"Current",children:[e.tabosCurrent?.toFixed(2)," A"]}),s(i,{label:"SOC",children:[e.tabosSoc?.toFixed(1)," %"]}),s(i,{label:"SOH",children:[e.tabosSoh?.toFixed(1)," %"]}),s(i,{label:"Temp",children:[e.tabosTemp?.toFixed(1)," °C"]})]}),ne=({capKey:e,data:a})=>{switch(e){case"dock":return t(Z,{data:a});case"io":return t(ee,{data:a});case"camera":return t(ae,{data:a});case"lidar2d":return t(A,{data:a});case"lidar3d":return t(A,{data:a,is3d:!0});case"imu":return t(te,{data:a});case"tabos":return t(se,{data:a});default:return t(le,{data:a})}},re=[{label:"LiDAR 2D",value:"lidar2d"},{label:"LiDAR 3D",value:"lidar3d"},{label:"OBS Map",value:"obsMap"}],ce=({robotModel:e})=>{const[a,l]=k("lidar2d"),[n,r]=k("1"),{mutate:o,isPending:d}=V();return s(c,{className:"gap-2 pb-1",children:[s(p,{className:"items-center justify-between gap-2",children:[t("span",{className:"typo-compact-xs-normal text-fg-subtle",children:"Target"}),t(F,{size:"2xs",variant:"brand",disabled:d,onClick:()=>{const m=Math.min(10,Math.max(0,Number(n)));o({robot_model:e,target:a,frequency:m})},children:"Set"})]}),t(P,{size:"sm",value:a,handleChange:m=>l(m),children:re.map(({label:m,value:S})=>t(B,{value:S,children:m},S))}),t(p,{className:"items-center gap-2",children:t(w,{className:"flex-1",size:"sm",value:n,step:1,digit:0,fixedDigit:0,min:"0",max:"10",handleChange:m=>r(m)})})]})},oe=({item:e})=>{const{t:a}=g();return e.supported?e.data?t("div",{className:"pb-1",children:t(ne,{capKey:e.key,data:e.data})}):null:t("p",{className:"typo-compact-xs-normal text-fg-disabled px-1 py-2",children:a("move.amr.rightPanel.capability.status.notSupported")})},ie=()=>{const{t:e}=g();return t(E,{className:"flex-1 [&_[data-slot='empty-view-section']]:h-full",type:"icon",icon:t(O,{size:20}),message:e("move.amr.rightPanel.capability.status.loading")})},ue=({className:e,robotModel:a})=>{const{t:l}=g(),{data:n,isLoading:r}=$({robot_model:a});return s(c,{className:b("AmrCapabilityControl h-full min-h-0",e),children:[r&&t(ie,{}),(n??[]).map(o=>t("div",{className:"border-subtler border-b px-1 py-1",children:t(v,{disabled:!o.supported,title:t(p,{className:"w-full items-center justify-between gap-2",children:t("span",{className:b("typo-compact-sm2-semibold min-w-0 truncate",o.supported?"text-fg-default":"text-fg-disabled"),children:l(o.labelKey)})}),children:t(oe,{item:o})})},o.key)),t("div",{className:"border-subtler border-b px-1 py-1",children:t(v,{title:t("span",{className:"typo-compact-sm2-semibold text-fg-default",children:l("move.amr.rightPanel.capability.streamFrequency")}),children:t(ce,{robotModel:a})})})]})};export{ue as default};