@camstack/addon-admin-ui 1.2.707 → 1.2.709
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/assets/{AccessSection-CdCEsvPD.js → AccessSection-DsqpMtPJ.js} +1 -1
- package/dist/assets/{Addons-b61CNfYt.js → Addons-Cz2K9oJ8.js} +3 -3
- package/dist/assets/{AdminPage-D_ScR9To.js → AdminPage-Bl53zoyw.js} +1 -1
- package/dist/assets/{AdminSectionedPage-DGidDJBb.js → AdminSectionedPage-EAetNMH-.js} +1 -1
- package/dist/assets/{AiProfiles-DabE0DP8.js → AiProfiles-ChTO_Ydh.js} +2 -2
- package/dist/assets/Archive-CCM5CLiw.js +1 -0
- package/dist/assets/{BootstrapSettingsForm-DaIg6gq5.js → BootstrapSettingsForm-zFXKMvht.js} +1 -1
- package/dist/assets/Build-BUn8veoa.js +40 -0
- package/dist/assets/{Calendars-CdCIOI6j.js → Calendars-DnX6EFmJ.js} +1 -1
- package/dist/assets/{Cluster-B0FV-fZt.js → Cluster-BVy2twli.js} +1 -1
- package/dist/assets/CompositionBlockEditor-BdhVBszZ.js +2 -0
- package/dist/assets/{CompositionEditorPage-CKvufPBG.js → CompositionEditorPage-CSNZejAP.js} +1 -1
- package/dist/assets/{Data-C2vZTveq.js → Data-BmUkcx8m.js} +2 -2
- package/dist/assets/DeviceDetail-CI9pWEZx.js +1 -0
- package/dist/assets/{Devices-VYfr6Qjh.js → Devices-B4eWRgrT.js} +1 -1
- package/dist/assets/{EmbedDevicePage-R7WS-d3D.js → EmbedDevicePage-CAoaEQ1B.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-Z2tf61w_.js → EmbedPlayerPage-DN98Q6U8.js} +1 -1
- package/dist/assets/{History-Bo9FgRVX.js → History-DwFdQQ0F.js} +1 -1
- package/dist/assets/{Identity-D4kdH7U7.js → Identity-B69kRPPY.js} +1 -1
- package/dist/assets/InstancesTable-HNpVzE7s.js +1 -0
- package/dist/assets/IntegrationDetail-BQjAxMD0.js +1 -0
- package/dist/assets/Integrations-CxAO3rmA.js +1 -0
- package/dist/assets/{Integrations-BzM7SsEz.js → Integrations-ZaHklJZz.js} +2 -2
- package/dist/assets/{Library-BOlhpDfS.js → Library-CmkZkIyb.js} +1 -1
- package/dist/assets/{Locations-BEURX3s_.js → Locations-BtA7tzTS.js} +2 -2
- package/dist/assets/{Logs-Do0Qz1Xm.js → Logs-DcUmYZxQ.js} +1 -1
- package/dist/assets/{MaskShapeCanvas-CSF5f0x4.js → MaskShapeCanvas-BN6ufTmt.js} +1 -1
- package/dist/assets/{MotionZonesSettings-4G_zRdIV.js → MotionZonesSettings-DsM7FPZE.js} +1 -1
- package/dist/assets/{MyAccess-DRCDj6Xz.js → MyAccess-36quXrzY.js} +1 -1
- package/dist/assets/{Network-ZDD_Mojs.js → Network-BQNbI68p.js} +1 -1
- package/dist/assets/{NewExportModal-oXocqeh1.js → NewExportModal-DDvQiW17.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-v8si7yGj.js → NodeAddonsSettingsPanel-D1XKr-t3.js} +1 -1
- package/dist/assets/Notifications-drh-_18M.js +1 -0
- package/dist/assets/{PanelContent-CfStlJ6y.js → PanelContent-X6Ywa9XD.js} +1 -1
- package/dist/assets/{Pipeline-C5FSBQqW.js → Pipeline-CRNttd3s.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-WoQQopZx.js → PrivacyMaskSettings-m809AVSj.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-C70XKDO3.js → SceneMonitorEditor-BRoTpS7V.js} +1 -1
- package/dist/assets/{SessionsList-e1hGFA_b.js → SessionsList-BTFEy3vR.js} +1 -1
- package/dist/assets/{Showroom-BZ5FVUHJ.js → Showroom-COU-VFZB.js} +1 -1
- package/dist/assets/{StorageLocationsTable-BdX7iiy2.js → StorageLocationsTable-C32VlQPn.js} +1 -1
- package/dist/assets/{System-CXy2jAEJ.js → System-wwGQgV2N.js} +2 -2
- package/dist/assets/TemplateEditorDialog-Do8_Tkqa.js +1 -0
- package/dist/assets/{Terminal-BzVEx5-W.js → Terminal-l-QGE8OW.js} +1 -1
- package/dist/assets/{TrainingProviders-DcR68K6U.js → TrainingProviders-OLJbQPF7.js} +1 -1
- package/dist/assets/{Viewer-Cm8XLQl9.js → Viewer-BHhyWOaP.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-D8K0TmuG.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-GVnTVa9B.js} +1 -1
- package/dist/assets/{action-draft-C0aEYbbJ.js → action-draft-xWZeLJBc.js} +1 -1
- package/dist/assets/{ai-page.helpers-CMOPYT4m.js → ai-page.helpers-PZj63Lqj.js} +1 -1
- package/dist/assets/{assignment-candidates-BjQPH37S.js → assignment-candidates-DgKn7QW8.js} +1 -1
- package/dist/assets/{authed-media-CIYKXUSa.js → authed-media-BXbglKGb.js} +1 -1
- package/dist/assets/{board-model-B0lkkU_n.js → board-model-Deno4GUf.js} +1 -1
- package/dist/assets/{camera-block-model-Dll1DsHk.js → camera-block-model-BmK3dL9c.js} +1 -1
- package/dist/assets/client-D93RkunP.js +1125 -0
- package/dist/assets/{command-vocab-BvTOW30-.js → command-vocab-DGcpiUvY.js} +1 -1
- package/dist/assets/{device-integration-icon-DM1vonRZ.js → device-integration-icon-Ca748TOC.js} +1 -1
- package/dist/assets/device-picker-model-5TmG1RTl.js +1 -0
- package/dist/assets/dist-ClyHN0ce.js +1125 -0
- package/dist/assets/{dist-UoOeKkgf.js → dist-SwLD2DK1.js} +1 -1
- package/dist/assets/divide-Bmm9r7CP.js +1 -0
- package/dist/assets/{format-DZS30uCp.js → format-CzUOyOqz.js} +1 -1
- package/dist/assets/{hostInit-BDQA3BN9.js → hostInit-Bn0he4-M.js} +1 -1
- package/dist/assets/i18n-CEeel4Y-.js +1 -0
- package/dist/assets/icons-C4C8iPI_.js +1 -0
- package/dist/assets/index-BFuQYqWe.css +2 -0
- package/dist/assets/{index-BdZSFp7D.js → index-L2D_wmX_.js} +4 -4
- package/dist/assets/{linked-devices-model-iW46YpkQ.js → linked-devices-model-B5-OUbTR.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-d881d50d.js → mf-entry-bootstrap-0-d1cd0ee2.js} +2 -2
- package/dist/assets/mount-5TmG1RTl.js +1 -0
- package/dist/assets/{notification-rule-status-CMiSvQbc.js → notification-rule-status-Dced0U_-.js} +1 -1
- package/dist/assets/{player-overlays-DIlWLHUP.js → player-overlays-hLBmOC8C.js} +1 -1
- package/dist/assets/remoteEntry-BvFnmcAe.js +1 -0
- package/dist/assets/scan-eye-C862nWtV.js +1 -0
- package/dist/assets/shapes-D4IRNSXI.js +1 -0
- package/dist/assets/src-DBaqc0p7.js +279 -0
- package/dist/assets/{sso-popup-FtzI6ryL.js → sso-popup-B1dVbyW9.js} +1 -1
- package/dist/assets/{step-inspector-model-NCZ8oRWD.js → step-inspector-model-DvIFo0NZ.js} +1 -1
- package/dist/assets/{use-scenes-feed-lfckxPsP.js → use-scenes-feed-YtLOCajT.js} +1 -1
- package/dist/assets/{useAdminDeviceRemoval-BqnJTWmj.js → useAdminDeviceRemoval-D8Gqm3dV.js} +1 -1
- package/dist/assets/useEventInvalidation-5TmG1RTl.js +1 -0
- package/dist/assets/{useNodeUrlSelection-D7VEc_ts.js → useNodeUrlSelection-KMQXX7NA.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-VpC5Rl06.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BECtRrgF.js} +2 -2
- package/dist/index.html +9 -9
- package/dist/server/addon.js +376 -24
- package/package.json +2 -2
- package/dist/assets/Archive-tvC3GS9d.js +0 -1
- package/dist/assets/Build-FmDDr5Iv.js +0 -40
- package/dist/assets/CompositionBlockEditor-CHyI7DTr.js +0 -2
- package/dist/assets/DeviceDetail-BbhNElsK.js +0 -1
- package/dist/assets/InstancesTable-CnwNnIGg.js +0 -1
- package/dist/assets/IntegrationDetail-Bz-VToH2.js +0 -1
- package/dist/assets/Integrations-CE8kyRYx.js +0 -1
- package/dist/assets/Notifications-BnLCpPnP.js +0 -1
- package/dist/assets/client-BDuXx1QP.js +0 -1122
- package/dist/assets/create-composition-_Nnzu3CV.js +0 -1
- package/dist/assets/device-picker-model-CGRy9l3T.js +0 -1
- package/dist/assets/dist-i_V6azZ-.js +0 -1122
- package/dist/assets/i18n-edIqwiB1.js +0 -1
- package/dist/assets/icons-Dmo60g7m.js +0 -1
- package/dist/assets/index-BeEV7XaB.css +0 -2
- package/dist/assets/mount-CGRy9l3T.js +0 -1
- package/dist/assets/remoteEntry-CPn9l_TV.js +0 -1
- package/dist/assets/scan-eye-C7ejeyl9.js +0 -1
- package/dist/assets/shapes-CAlvyzli.js +0 -1
- package/dist/assets/src-DKJzc4UU.js +0 -279
- package/dist/assets/useEventInvalidation-CGRy9l3T.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{C as e,J as t,K as n,R as r,S as i,V as a,Y as o,a as s,et as c,o as l,t as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{$a as d,$i as f,In as p,Jn as m,Nr as h,Yn as g,Z as _,Zi as v,ar as y,ct as b,ft as x,va as S,wn as C,xr as w,yt as T,zr as E}from"./player-overlays-
|
|
2
|
-
`)}return`curl -sS ${n} \\\n ${Q(`${t}${r===null?``:`?input=${encodeURIComponent(r)}`}`)}`}function $(e,t){let n=e[t];return typeof n==`string`?n:null}function Ie(e){let t=e instanceof Error?e.message:String(e),n=U(e)||e instanceof Error?Reflect.get(e,`data`):void 0;if(!U(n))return{message:t,code:null,httpStatus:null,path:null,capRouteReason:null};let r=n.httpStatus;return{message:t,code:$(n,`code`),httpStatus:typeof r==`number`?r:null,path:$(n,`path`),capRouteReason:$(n,`capRouteReason`)}}function Le(e){if(e===void 0)return`undefined`;try{return JSON.stringify(e,null,2)??String(e)}catch{return String(e)}}var Re={searchText:e=>[e.path,e.scope?.capName??``],facetGroups:[{id:`router`,value:e=>e.router},{id:`kind`,value:e=>e.kind},{id:`tier`,value:e=>e.tier},{id:`source`,value:e=>e.source}]},ze={query:`info`,mutation:`warning`,subscription:`neutral`},Be={public:`success`,protected:`neutral`,admin:`primary`};function Ve({kind:e}){let{t}=z();return i(F,{variant:ze[e],size:`sm`,children:t(`system.apiExplorer.kind.${e}`)})}function He({tier:e}){let{t}=z();return i(F,{variant:Be[e],style:`outline`,size:`sm`,children:t(`system.apiExplorer.tier.${e}`)})}function Ue({methods:t,selectedPath:n,onSelect:r}){let{t:a}=z(),o=de(t,Re),s=e=>a(`system.apiExplorer.group.${e}`),c=e=>t=>e===`router`?t:a(`system.apiExplorer.${e}.${t}`),l=[{key:`path`,header:a(`system.apiExplorer.column.method`),sortValue:e=>e.path,render:t=>e(`span`,{className:`font-mono text-xs`,children:[e(`span`,{className:`text-foreground-muted`,children:[t.router,`.`]}),i(`span`,{className:`text-foreground`,children:t.method})]})},{key:`kind`,header:a(`system.apiExplorer.column.kind`),sortValue:e=>e.kind,render:e=>i(Ve,{kind:e.kind})},{key:`tier`,header:a(`system.apiExplorer.column.tier`),sortValue:e=>e.tier,render:e=>i(He,{tier:e.tier})},{key:`scope`,header:a(`system.apiExplorer.column.scope`),sortValue:e=>e.scope===null?null:`${e.scope.capName}:${e.scope.access}`,render:t=>t.scope===null?i(`span`,{className:`text-xs text-foreground-subtle`,children:a(`system.apiExplorer.coreRoute`)}):e(`span`,{className:`font-mono text-xs text-foreground-muted`,children:[t.scope.capName,` · `,t.scope.access]})}];return e(`div`,{className:`space-y-3`,children:[i(ie,{state:o.state,facets:o.facets,groups:o.groups.map(e=>({...e,label:s(e.id),facetLabel:c(e.id),...e.id===`router`?{display:`menu`}:{}})),labels:{searchPlaceholder:a(`system.apiExplorer.searchPlaceholder`),searchLabel:a(`system.apiExplorer.searchLabel`),facetsLabel:a(`system.apiExplorer.facetsLabel`),clearLabel:a(`system.apiExplorer.clearFilters`)},onSearch:o.setSearch,onToggleFacet:o.toggleFacet,onToggleGroupFacet:o.toggleGroupFacet,onClear:o.clear}),i(ve,{columns:l,rows:o.rows,rowKey:e=>e.path,onRowClick:e=>r(e.path),rowClassName:e=>e.path===n?`bg-primary/10`:void 0,minWidthPx:560,maxBodyHeight:re,defaultSort:{columnKey:`path`,dir:`asc`},emptyMessage:o.active?a(`system.apiExplorer.noMatch`):a(`system.apiExplorer.noMethods`)})]})}var We={yes:`success`,"per-device":`warning`,no:`danger`},Ge={yes:`system.apiExplorer.callableYes`,"per-device":`system.apiExplorer.callablePerDevice`,no:`system.apiExplorer.callableNo`};function Ke(e){let t=De(e);return t===void 0?``:JSON.stringify(t,null,2)}function qe({method:t}){let{t:r}=z(),s=b(),c=te(L.useUtils().client),l=L.apiCatalog.inputSchema.useQuery({path:t.path},{enabled:t.hasInput,staleTime:1/0}),u=l.data?.schema??null,[d,f]=o(``),[p,h]=o(null),[g,v]=o(!1);a(()=>{f(Ke(u))},[u]);let x=n(()=>Pe(d),[d]),C=x.ok?Ne(x.value,u):[],w=t.kind!==`subscription`&&t.callable!==`no`,T=w&&x.ok&&C.length===0&&!g,E=t.kind===`mutation`?`mutation`:`query`,D=Fe({hubBase:_(),path:t.path,kind:E,input:x.ok?x.value:void 0}),O=async()=>{if(!x.ok||t.kind===`mutation`&&!await s({title:r(`system.apiExplorer.confirmTitle`),message:r(`system.apiExplorer.confirmMessage`,{method:t.path}),confirmLabel:r(`system.apiExplorer.run`),variant:`danger`}))return;v(!0);let e=performance.now();try{h({kind:`ok`,value:E===`mutation`?await c.mutation(t.path,x.value):await c.query(t.path,x.value),ms:performance.now()-e})}catch(t){h({kind:`error`,error:Ie(t),ms:performance.now()-e})}finally{v(!1)}};return i(M,{headingId:`api-explorer-method`,title:r(`system.apiExplorer.column.method`),icon:S,actions:e(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[i(Ve,{kind:t.kind}),i(He,{tier:t.tier})]}),children:e(`div`,{className:`space-y-4 p-3 sm:p-4`,children:[i(`p`,{className:`break-all font-mono text-sm text-foreground`,children:t.path}),i(N,{items:[{key:r(`system.apiExplorer.column.scope`),value:t.scope===null?r(`system.apiExplorer.coreRouteLong`):r(`system.apiExplorer.scopeValue`,{cap:t.scope.capName,access:t.scope.access,capScope:t.scope.capScope})},{key:r(`system.apiExplorer.callable`),value:i(F,{variant:We[t.callable],size:`sm`,children:r(Ge[t.callable])})}]}),t.kind===`subscription`&&i(`p`,{className:`text-sm text-foreground-muted`,children:r(`system.apiExplorer.subscriptionNote`)}),t.hasInput&&i(Je,{loading:l.isPending,error:l.error?.message??l.data?.error??null,schema:u}),w&&e(`div`,{className:`space-y-2`,children:[i(`label`,{htmlFor:`api-explorer-input`,className:`text-xs font-medium text-foreground-muted`,children:r(`system.apiExplorer.input`)}),i(me,{id:`api-explorer-input`,value:d,onChange:e=>f(e.target.value),rows:t.hasInput?8:2,spellCheck:!1,placeholder:t.hasInput?void 0:r(`system.apiExplorer.noInput`),state:x.ok&&C.length===0?`default`:`error`,className:`font-mono text-xs`}),i(Ye,{parseError:x.ok?null:x.message,issues:C}),e(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e(R,{onClick:()=>void O(),disabled:!T,children:[i(y,{className:`h-3.5 w-3.5`}),r(g?`system.apiExplorer.running`:`system.apiExplorer.run`)]}),t.hasInput&&e(R,{variant:`ghost`,onClick:()=>f(Ke(u)),children:[i(m,{className:`h-3.5 w-3.5`}),r(`system.apiExplorer.resetInput`)]})]})]}),p!==null&&i(Xe,{outcome:p}),t.kind!==`subscription`&&e(`div`,{className:`space-y-2`,children:[e(`div`,{className:`flex items-center justify-between gap-2`,children:[i(`span`,{className:`text-xs font-medium text-foreground-muted`,children:r(`system.apiExplorer.curl`)}),i(le,{value:D,label:r(`system.apiExplorer.copy`),srLabel:r(`system.apiExplorer.curl`)})]}),i(A,{maxHeight:200,children:D}),i(`p`,{className:`text-xs text-foreground-subtle`,children:r(`system.apiExplorer.curlHint`)})]})]})})}function Je({loading:t,error:n,schema:r}){let{t:a}=z();return e(`div`,{className:`space-y-2`,children:[i(`span`,{className:`text-xs font-medium text-foreground-muted`,children:a(`system.apiExplorer.inputSchema`)}),t?i(k,{className:`h-24 w-full`}):n===null?i(A,{maxHeight:240,children:Le(r)}):i(j,{variant:`warning`,message:a(`system.apiExplorer.schemaUnavailable`,{error:n})})]})}function Ye({parseError:t,issues:n}){let{t:r}=z();return t===null&&n.length===0?null:e(`ul`,{className:`space-y-0.5 text-xs text-danger`,role:`alert`,children:[t!==null&&i(`li`,{children:r(`system.apiExplorer.invalidJson`,{error:t})}),n.map(e=>i(`li`,{children:r(`system.apiExplorer.issue.${e.code}`,{path:e.path===``?r(`system.apiExplorer.rootPath`):e.path,expected:e.expected})},`${e.path}:${e.code}`))]})}function Xe({outcome:t}){let{t:n}=z(),r=n(`system.apiExplorer.duration`,{ms:Math.round(t.ms)});if(t.kind===`ok`)return e(`div`,{className:`space-y-2`,children:[e(`div`,{className:`flex items-center gap-2`,children:[i(`span`,{className:`text-xs font-medium text-foreground-muted`,children:n(`system.apiExplorer.result`)}),i(F,{variant:`success`,size:`sm`,children:r})]}),i(A,{maxHeight:400,children:Le(t.value)})]});let{error:a}=t,o=[{key:n(`system.apiExplorer.errorCode`),value:a.code},{key:n(`system.apiExplorer.errorStatus`),value:a.httpStatus},{key:n(`system.apiExplorer.errorPath`),value:a.path},{key:n(`system.apiExplorer.errorCapRoute`),value:a.capRouteReason}].flatMap(e=>e.value===null?[]:[{key:e.key,value:String(e.value)}]);return i(j,{title:`${n(`system.apiExplorer.callFailed`)} · ${r}`,message:e(`div`,{className:`space-y-2`,children:[i(`p`,{className:`break-words`,children:a.message}),o.length>0&&i(N,{items:o})]})})}c();function Ze(){let{t:n}=z(),[o,s]=Se(),c=o.get(V),l=L.apiCatalog.list.useQuery(void 0,{staleTime:1/0}),u=t(null),d=l.data?.methods.find(e=>e.path===c)??null,f=r(e=>{s(t=>{let n=new URLSearchParams(t);return n.set(V,e),n},{replace:!0})},[s]),p=d?.path??null;return a(()=>{p!==null&&u.current?.scrollIntoView?.({block:`start`,behavior:`smooth`})},[p]),i(B,{embedded:!0,icon:S,title:n(`system.apiExplorer.title`),subtitle:n(`system.apiExplorer.subtitle`),children:l.isPending?i(k,{className:`h-64 w-full`}):l.error===null?e(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[i(M,{headingId:`api-explorer-methods`,title:n(`system.apiExplorer.methodsTitle`,{count:l.data.methods.length}),children:i(`div`,{className:`p-3 sm:p-4`,children:i(Ue,{methods:l.data.methods,selectedPath:c,onSelect:f})})}),i(`div`,{ref:u,className:`min-w-0 scroll-mt-4`,children:d===null?c===null?i(I,{icon:w,title:n(`system.apiExplorer.pickTitle`),description:n(`system.apiExplorer.pickDescription`)}):i(j,{variant:`warning`,message:n(`system.apiExplorer.unknownMethod`,{method:c})}):i(qe,{method:d},d.path)})]}):i(j,{title:n(`system.apiExplorer.couldNotLoad`),message:l.error.message,onRetry:()=>void l.refetch()})})}var Qe={detection:`border-green-500`,detector:`border-green-500`,streaming:`border-blue-500`,decode:`border-blue-500`,decoder:`border-blue-500`,recording:`border-orange-500`,recorder:`border-orange-500`,transcoding:`border-purple-500`,transcoder:`border-purple-500`,restream:`border-cyan-500`,restreamer:`border-cyan-500`,storage:`border-yellow-500`,notification:`border-pink-500`,notifier:`border-pink-500`,faces:`border-indigo-500`},$e={detection:`bg-green-500/5`,detector:`bg-green-500/5`,streaming:`bg-blue-500/5`,decode:`bg-blue-500/5`,decoder:`bg-blue-500/5`,recording:`bg-orange-500/5`,recorder:`bg-orange-500/5`,transcoding:`bg-purple-500/5`,transcoder:`bg-purple-500/5`,restream:`bg-cyan-500/5`,restreamer:`bg-cyan-500/5`,storage:`bg-yellow-500/5`,notification:`bg-pink-500/5`,notifier:`bg-pink-500/5`,faces:`bg-indigo-500/5`};function et({entry:t,actions:n}){let r=t.name.toLowerCase(),a=Qe[r]??`border-primary`,o=$e[r]??`bg-primary/5`,s=t.providers.find(e=>e.active),c=n?.pendingCapability===t.name;return e(`div`,{className:`rounded-lg border-t-2 border border-border ${a} ${o} p-3 space-y-2`,children:[e(`div`,{className:`flex items-center justify-between gap-2`,children:[e(`span`,{className:`text-xs font-semibold text-foreground capitalize flex items-center gap-1.5`,children:[t.name,c&&i(E,{className:`h-3 w-3 animate-spin text-primary`})]}),i(`span`,{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ${t.mode===`singleton`?`bg-primary/10 text-primary`:`bg-info/10 text-info`}`,children:t.mode})]}),t.mode===`singleton`?i(tt,{entry:t,actions:n,activeProvider:s,isPending:c}):i(nt,{entry:t,actions:n,isPending:c})]})}function tt({entry:t,actions:n,activeProvider:r,isPending:a}){let{t:o}=z();if(!n)return i(`div`,{children:r?e(`div`,{className:`flex items-center gap-1.5 text-[10px] text-foreground`,children:[i(v,{className:`h-3 w-3 text-green-400 shrink-0`}),i(`span`,{className:`font-medium`,children:r.addonName}),i(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto`,children:`ACTIVE`})]}):i(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:o(`addons.capabilityMap.noActiveProvider`,`No active provider`)})});if(t.providers.length===0)return i(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:o(`addons.capabilityMap.noProviders`,`No providers`)});let s=`__inherit__`;return e(`div`,{className:`space-y-2`,children:[i(`div`,{className:`space-y-1`,children:t.providers.map(r=>{let o=r.active;return e(R,{variant:`unstyled`,type:`button`,disabled:a||o,onClick:()=>n.onSelectSingleton(t.name,r.addonId),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${o?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[i(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${o?`border-green-400 bg-green-400`:`border-border`}`}),i(`span`,{className:`font-medium truncate`,children:r.addonName}),o&&i(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},r.addonId)})}),t.perNode&&t.perNode.length>0&&i(`div`,{className:`space-y-2 pt-1 border-t border-border/40`,children:t.perNode.map(r=>{let c=r.hasOverride&&r.resolvedActive?r.resolvedActive:s,l=[{value:s,label:r.resolvedActive?o(`addons.capabilityMap.inheritGlobalWith`,{provider:r.resolvedActive}):o(`addons.capabilityMap.inheritGlobal`)},...r.providers.map(e=>({value:e,label:e}))],u=e=>{e===s?n.onClearNodeSingleton(t.name,r.nodeId):n.onSelectNodeSingleton(t.name,r.nodeId,e)},d=a;return e(`div`,{className:`space-y-0.5`,children:[e(`div`,{className:`text-[9px] font-semibold uppercase tracking-widest text-foreground-subtle/60 px-1.5`,children:[r.nodeId,r.hasOverride&&i(`span`,{className:`ml-1.5 rounded-full bg-primary/10 text-primary px-1 py-0.5 normal-case tracking-normal font-medium`,children:o(`common.override`)})]}),l.map(t=>{let n=c===t.value;return e(R,{variant:`unstyled`,type:`button`,disabled:d||n,onClick:()=>u(t.value),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${n?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[i(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${n?`border-green-400 bg-green-400`:`border-border`}`}),i(`span`,{className:`font-medium truncate`,children:t.label}),n&&t.value!==s&&i(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},t.value)})]},r.nodeId)})})]})}function nt({entry:t,actions:n,isPending:r}){let{t:a}=z();if(t.providers.length===0)return i(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:a(`addons.capabilityMap.noProviders`,`No providers`)});if(!n)return i(`div`,{className:`space-y-1`,children:t.providers.map(t=>e(`div`,{className:`flex items-center justify-between gap-2 text-[10px]`,children:[i(`span`,{className:`text-foreground-subtle`,children:t.addonName}),t.active&&i(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium`,children:`ACTIVE`})]},t.addonId))});let o=t.providers.filter(e=>e.active).map(e=>e.addonId),s=(e,r)=>{let i=r?[...new Set([...o,e])]:o.filter(t=>t!==e);n.onToggleCollection(t.name,i)};return i(`div`,{className:`space-y-1`,children:t.providers.map(t=>e(`label`,{className:`flex items-center justify-between gap-2 text-[10px] rounded px-1.5 py-1 transition-colors ${r?`opacity-50`:`hover:bg-surface-hover cursor-pointer`}`,children:[e(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[i(d,{checked:t.active,disabled:r,onChange:e=>s(t.addonId,e.target.checked),className:`h-3 w-3 accent-green-500 shrink-0`}),i(`span`,{className:`text-foreground truncate`,children:t.addonName})]}),t.active&&i(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium shrink-0`,children:`ACTIVE`})]},t.addonId))})}function rt({capabilities:e,actions:t}){let{t:n}=z();return e.length===0?i(`div`,{className:`text-xs text-foreground-subtle text-center py-8`,children:n(`addons.capabilityMap.noCapabilitiesRegistered`,`No capabilities registered`)}):i(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3`,children:e.map(e=>i(et,{entry:e,actions:t},e.name))})}c();var it=[`capabilities`,`listCapabilities`];function at(e){return e===`singleton`||e===`collection`}function ot(e){let t=e.indexOf(`@`);return t===-1?ye.t(`system.capabilities.providerHub`,{addonId:e}):`${e.slice(0,t)} (${e.slice(t+1)})`}function st(e,t){return{name:e.name,mode:t,providers:e.providers.map(n=>({addonId:n,addonName:ot(n),active:t===`singleton`?e.activeProvider===n:!e.disabledProviders.includes(n)})),...t===`singleton`&&e.perNode?{perNode:e.perNode}:{}}}function ct(){let{t}=z(),r=T(),[a,c]=o(null),[l,d]=o(null),p=s({queryKey:it,queryFn:()=>r.trpcClient.capabilities.listCapabilities.query()}),m=n(()=>{let e=(p.data??[]).flatMap(e=>at(e.mode)?[st(e,e.mode)]:[]),t=e.filter(e=>e.mode===`singleton`).toSorted((e,t)=>e.name.localeCompare(t.name)),n=e.filter(e=>e.mode===`collection`).toSorted((e,t)=>e.name.localeCompare(t.name));return[...t,...n]},[p.data]),h=n(()=>m.filter(e=>e.mode===`singleton`),[m]),g=n(()=>m.filter(e=>e.mode===`collection`),[m]),_=u({mutationFn:e=>r.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId}),onMutate:e=>{c(e.capName),d(null)},onSuccess:async(e,n)=>{d({kind:`success`,message:t(`system.capabilities.isNowActive`,`{{capName}} → {{addonId}} is now active.`,{capName:n.capName,addonId:n.addonId})}),await p.refetch()},onError:(e,n)=>{d({kind:`error`,message:t(`system.capabilities.failedToSet`,{cap:n.capName,error:e instanceof Error?e.message:t(`common.unknownError`)})})},onSettled:()=>c(null)}),y=u({mutationFn:e=>r.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId,nodeId:e.nodeId}),onMutate:e=>{c(e.capName),d(null)},onSuccess:async(e,t)=>{d({kind:`success`,message:`${t.capName} @ ${t.nodeId} → ${t.addonId}.`}),await p.refetch()},onError:(e,n)=>{d({kind:`error`,message:t(`system.capabilities.failedToSetOnNode`,{cap:n.capName,node:n.nodeId,error:e instanceof Error?e.message:t(`common.unknownError`)})})},onSettled:()=>c(null)}),b=u({mutationFn:e=>r.trpcClient.capabilities.clearSingletonNodeOverride.mutate({capability:e.capName,nodeId:e.nodeId}),onMutate:e=>{c(e.capName),d(null)},onSuccess:async(e,n)=>{d({kind:`success`,message:t(`system.capabilities.nowInheritsTheGlobalDefault`,`{{capName}} @ {{nodeId}} now inherits the global default.`,{capName:n.capName,nodeId:n.nodeId})}),await p.refetch()},onError:(e,n)=>{d({kind:`error`,message:t(`system.capabilities.failedToClearOnNode`,{cap:n.capName,node:n.nodeId,error:e instanceof Error?e.message:t(`common.unknownError`)})})},onSettled:()=>c(null)}),x=u({mutationFn:e=>r.trpcClient.capabilities.setCollectionEnabledProviders.mutate({capability:e.capName,enabledAddonIds:[...e.enabledAddonIds]}),onMutate:e=>{c(e.capName),d(null)},onSuccess:async(e,n)=>{d({kind:`success`,message:t(`system.capabilities.providerSEnabled`,`{{capName}}: {{length}} provider(s) enabled.`,{capName:n.capName,length:n.enabledAddonIds.length})}),await p.refetch()},onError:(e,n)=>{d({kind:`error`,message:t(`system.capabilities.failedToUpdate`,{cap:n.capName,error:e instanceof Error?e.message:t(`common.unknownError`)})})},onSettled:()=>c(null)}),S={onSelectSingleton:(e,t)=>_.mutate({capName:e,addonId:t}),onSelectNodeSingleton:(e,t,n)=>y.mutate({capName:e,nodeId:t,addonId:n}),onClearNodeSingleton:(e,t)=>b.mutate({capName:e,nodeId:t}),onToggleCollection:(e,t)=>x.mutate({capName:e,enabledAddonIds:t}),pendingCapability:a};return e(B,{embedded:!0,icon:C,title:t(`system.capabilities.capabilities`,`Capabilities`),subtitle:t(`system.capabilities.chooseWhichProviderIsActive`,`Choose which provider is active for each system capability. Singleton caps pick exactly one provider; collection caps enable a set.`),children:[l&&e(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-xs ${l.kind===`success`?`border-success/30 bg-success/10 text-success`:`border-danger/40 bg-danger/10 text-danger`}`,children:[l.kind===`success`?i(v,{className:`h-3.5 w-3.5 shrink-0`}):i(f,{className:`h-3.5 w-3.5 shrink-0`}),i(`span`,{children:l.message})]}),p.isLoading&&i(`div`,{className:`flex items-center justify-center py-16`,children:i(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})}),p.isError&&!p.isLoading&&i(j,{title:t(`system.capabilities.failedToLoadCapabilities`,`Failed to load capabilities`),message:p.error instanceof Error?p.error.message:t(`system.capabilities.unknownError`,`Unknown error`),onRetry:()=>void p.refetch()}),!p.isLoading&&!p.isError&&m.length===0&&i(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:t(`system.capabilities.noCapabilitiesRegistered`,`No capabilities registered.`)}),!p.isLoading&&!p.isError&&m.length>0&&e(`div`,{className:`space-y-6`,children:[h.length>0&&e(`section`,{className:`space-y-2`,children:[i(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:t(`system.capabilities.singletonPickOneProvider`,`Singleton — pick one provider`)}),i(rt,{capabilities:h,actions:S})]}),g.length>0&&e(`section`,{className:`space-y-2`,children:[i(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:t(`system.capabilities.collectionEnableASet`,`Collection — enable a set`)}),i(rt,{capabilities:g,actions:S})]})]})]})}var lt={escape:`Esc`,enter:`Enter`};function ut(e,t){let n=fe(e),r=lt[n.key]??n.key.toUpperCase();return t===`mac`?`${n.alt?`⌥`:``}${n.shift?`⇧`:``}${n.mod?`⌘`:``}${r}`:[...n.mod?[`Ctrl`]:[],...n.alt?[`Alt`]:[],...n.shift?[`Shift`]:[],r].join(`+`)}function dt(){let{t}=z(),n=_e(),r=ne();return i(M,{headingId:`settings-hotkeys`,title:t(`systemPage.settings.hotkeys.title`,`Keyboard shortcuts`),icon:O,testId:`settings-hotkeys`,children:e(`div`,{className:`space-y-2 p-3`,children:[i(`p`,{className:`text-xs text-foreground-subtle`,children:t(`systemPage.settings.hotkeys.description`,`The shortcuts active on this page. They cannot be changed.`)}),n.length===0?i(I,{title:t(`systemPage.settings.hotkeys.empty`,`No shortcuts are active on this page.`)}):n.map(e=>i(P,{label:e.label??t(`systemPage.settings.hotkeys.unnamed`,`Shortcut`),children:i(`kbd`,{className:`rounded-md border border-border bg-surface px-1.5 py-0.5 font-mono text-xs text-foreground`,children:ut(e.combo,r)})},`${e.scope}|${e.combo}`))]})})}c();var ft=[[`system`]];function pt(e){return e.toFixed(6).replace(/0+$/,``).replace(/\.$/,``)}function mt(){let{t}=z(),n=l(),r=oe(),s=ue(),c=se(),[u,d]=o(``),[f,p]=o(``),[m,_]=o(null),v=r.data?.location??null;a(()=>{d(v===null?``:pt(v.latitude)),p(v===null?``:pt(v.longitude))},[v]);let y=async()=>{await n.invalidateQueries({queryKey:ft})},b=async e=>{e.preventDefault();let t=Number(u),n=Number(f);if(u.trim()===``||f.trim()===``){_(`Enter both a latitude and a longitude, or press Clear.`);return}if(!Number.isFinite(t)||t<-90||t>90){_(`Latitude must be between -90 and 90 decimal degrees.`);return}if(!Number.isFinite(n)||n<-180||n>180){_(`Longitude must be between -180 and 180 decimal degrees.`);return}_(null),await s.mutateAsync({latitude:t,longitude:n}),await y()},x=async()=>{_(null),await s.mutateAsync(null),await y()},S=async()=>{_(null),await c.mutateAsync(),await y()},C=s.isPending||c.isPending||r.isLoading;return e(he,{className:`space-y-3`,children:[e(`div`,{className:`flex items-start justify-between gap-3`,children:[e(`div`,{className:`flex items-start gap-2`,children:[i(h,{className:`h-4 w-4 mt-0.5 text-muted-foreground shrink-0`}),i(`div`,{children:i(`h3`,{className:`text-sm font-medium`,children:t(`settings.siteLocationCard.siteLocation`,`Site location`)})})]}),v===null?i(F,{variant:`warning`,children:t(`settings.siteLocationCard.notConfigured`,`Not configured`)}):i(F,{variant:v.source===`operator-set`?`success`:`info`,children:v.source===`operator-set`?t(`settings.siteLocationCard.setByYou`,`Set by you`):t(`settings.siteLocationCard.derivedFromIp`,`Derived from IP`)})]}),v?.label!==void 0&&v.label!==``?i(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.detectedNear`,{place:v.label})}):null,v===null&&r.data?.derivationAttemptedAt!==null?e(`p`,{className:`text-xs text-warning`,children:[t(`settings.siteLocationCard.automaticDetectionFromThePublic`,`Automatic detection from the public IP did not succeed`),r.data?.derivationError!==null&&r.data?.derivationError!==void 0?`: ${r.data.derivationError}`:`.`,` `,t(`settings.siteLocationCard.itIsNotRetriedOn`,`It is not retried on its own — enter the coordinates, or press Detect.`)]}):null,e(`form`,{className:`flex flex-wrap items-end gap-3`,onSubmit:b,children:[e(`label`,{className:`flex flex-col gap-1 text-xs`,children:[i(`span`,{className:`text-muted-foreground`,children:t(`settings.siteLocationCard.latitude`,`Latitude`)}),i(ae,{className:`w-40`,value:u,inputMode:`decimal`,placeholder:`40.851800`,onChange:e=>d(e.target.value),"aria-label":t(`settings.siteLocationCard.latitude`,`Latitude`)})]}),e(`label`,{className:`flex flex-col gap-1 text-xs`,children:[i(`span`,{className:`text-muted-foreground`,children:t(`settings.siteLocationCard.longitude`,`Longitude`)}),i(ae,{className:`w-40`,value:f,inputMode:`decimal`,placeholder:`14.268100`,onChange:e=>p(e.target.value),"aria-label":t(`settings.siteLocationCard.longitude`,`Longitude`)})]}),i(R,{type:`submit`,disabled:C,children:t(`common.save`,`Save`)}),e(R,{type:`button`,variant:`ghost`,disabled:C,onClick:S,children:[i(g,{className:`h-3.5 w-3.5 mr-1`}),t(`settings.siteLocationCard.detectFromIp`,`Detect from IP`)]}),v===null?null:i(R,{type:`button`,variant:`ghost`,disabled:C,onClick:x,children:t(`settings.siteLocationCard.clear`,`Clear`)})]}),m===null?null:i(`p`,{className:`text-xs text-danger`,children:m}),i(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.wgs84DecimalDegreesDetectAsks`,`WGS84 decimal degrees. Detect asks a public geo-IP service once and will not overwrite a value you typed — clear it first.`)})]})}c();function ht(e){return D.some(t=>t===e)}function gt(e){return ce.some(t=>t===e)}function _t(){let{t}=z(),n=ge(),[r,a]=o(!1),[s,c]=o(null),l=e=>{a(!0),c(null),n.update(e).catch(e=>c(e instanceof Error?e.message:String(e))).finally(()=>a(!1))},u=n.status!==`ok`||!n.writable||r;return i(M,{headingId:`settings-units`,title:t(`systemPage.myAccess.units.title`,`Units`),icon:ee,testId:`settings-units`,children:e(`div`,{className:`space-y-2 p-3`,children:[i(`p`,{className:`text-xs text-foreground-subtle`,children:t(`systemPage.myAccess.units.description`,`How readings are shown to you, on every device you sign in on. Stored values do not change.`)}),n.status===`error`&&i(j,{message:t(`systemPage.myAccess.units.loadError`,`Your unit preferences could not be read.`)}),n.status===`ok`&&!n.writable&&i(j,{message:t(`systemPage.myAccess.units.unreadable`,`The saved unit preferences are in a format this version cannot read, so they are left untouched.`)}),s!==null&&i(j,{message:s}),i(P,{label:t(`systemPage.myAccess.units.temperature`,`Temperature`),children:i(x,{"aria-label":t(`systemPage.myAccess.units.temperature`,`Temperature`),value:n.value.temperature,disabled:u,onChange:e=>{let t=e.target.value;gt(t)&&l({temperature:t})},options:[{value:`celsius`,label:t(`systemPage.myAccess.units.celsius`,`Celsius (°C)`)},{value:`fahrenheit`,label:t(`systemPage.myAccess.units.fahrenheit`,`Fahrenheit (°F)`)}]})}),i(P,{label:t(`systemPage.myAccess.units.system`,`Other measurements`),children:i(x,{"aria-label":t(`systemPage.myAccess.units.system`,`Other measurements`),value:n.value.system,disabled:u,onChange:e=>{let t=e.target.value;ht(t)&&l({system:t})},options:[{value:`metric`,label:t(`systemPage.myAccess.units.metric`,`Metric (km/h, hPa, mm)`)},{value:`imperial`,label:t(`systemPage.myAccess.units.imperial`,`Imperial (mph, inHg, in)`)}]})})]})})}function vt(){let{t}=z(),{nodes:n,isLoading:r}=pe(),a=n.find(e=>e.isHub&&e.isOnline);return e(B,{embedded:!0,children:[i(mt,{}),r?i(`div`,{className:`text-foreground-subtle text-sm py-12 text-center`,children:t(`admin.system.settings.loadingHubTopology`,`Loading hub topology…`)}):a?i(Ee,{emptyMessage:t(`admin.system.settings.bootstrapUnavailable`,`Not available — the addon that owns the server settings did not answer.`)}):e(`div`,{className:`flex flex-col items-center justify-center text-foreground-subtle text-sm gap-2 py-12`,children:[i(p,{className:`h-8 w-8 opacity-30`}),i(`p`,{children:t(`admin.system.settings.noOnlineHubNodeFound`,`No online hub node found.`)}),i(`p`,{className:`text-xs`,children:t(`admin.system.settings.settingsWillAppearOnceThe`,`Settings will appear once the hub is reachable.`)})]}),e(`section`,{"aria-labelledby":`settings-per-user`,className:`mt-3 sm:mt-4 space-y-3 sm:space-y-4`,children:[i(`h2`,{id:`settings-per-user`,className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:t(`systemPage.settings.perUser`,`Your settings`)}),i(_t,{}),i(dt,{})]})]})}function yt(){let{t:e}=z(),t=Ce(`/system/settings`,{t:e,isAdmin:!0})??{icon:p,title:e(`system.systemNav`,`System`)},{search:n,hash:r}=xe();return new URLSearchParams(n).get(`tab`)===`secrets`?i(we,{replace:!0,to:`${be(n)}${r}`}):i(Te,{icon:t.icon,title:t.title,defaultSection:`settings`,sectionsLabel:`${t.title} sections`,sections:[{id:`settings`,label:e(`system.system.settings`,`Settings`),content:i(vt,{})},{id:`capabilities`,label:e(`system.system.capabilities`,`Capabilities`),content:i(ct,{})},{id:`api-explorer`,label:e(`system.system.apiExplorer`),content:i(Ze,{}),ownedParams:[`method`]}]})}export{yt as SystemPage};
|
|
1
|
+
import{C as e,J as t,K as n,R as r,S as i,V as a,Y as o,a as s,et as c,o as l,t as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{$a as d,$i as f,In as p,Jn as m,Nr as h,Yn as g,Z as _,Zi as v,ar as y,ct as b,ft as x,va as S,wn as C,xr as w,yt as T,zr as E}from"./player-overlays-hLBmOC8C.js";import{Uc as D}from"./client-D93RkunP.js";import{n as O,t as ee}from"./ruler-Buxogset.js";import{r as te}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-8kv6pj9W.js";import{Aa as k,Ar as A,Bp as ne,Br as re,Da as j,Dr as ie,Ep as ae,Ff as oe,Ir as M,Lr as N,Mf as se,On as ce,Or as le,Rf as ue,Rr as P,Tr as de,Vp as fe,Zp as pe,hi as me,ia as he,ka as F,la as I,nm as L,p as ge,vp as R,zp as _e,zr as ve}from"./src-DBaqc0p7.js";import{t as ye}from"./i18n-CEeel4Y-.js";import{t as z}from"./useTranslation-BJr-n0es.js";import"./mount-5TmG1RTl.js";import{S as be,b as xe,bi as Se,wi as Ce,xi as we}from"./index-L2D_wmX_.js";import{t as Te}from"./AdminSectionedPage-EAetNMH-.js";import{t as B}from"./AdminPage-Bl53zoyw.js";import{t as Ee}from"./BootstrapSettingsForm-zFXKMvht.js";c();var V=`method`,H=8;function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function W(e){return Array.isArray(e)?e.filter(U):[]}function G(e,t){let n=e.$ref;if(typeof n!=`string`||!n.startsWith(`#/`))return e;let r=t;for(let e of n.slice(2).split(`/`))r=U(r)?r[e]:void 0;return U(r)?r:e}function K(e){let t=e.type;return typeof t==`string`?[t]:Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}function q(e){let t=e.required;return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}function J(e,t,n){let r=G(e,t);if(n>H)return null;if(`default`in r)return r.default;if(`const`in r)return r.const;let i=r.enum;if(Array.isArray(i)&&i.length>0)return i[0];let a=[...W(r.anyOf),...W(r.oneOf)];if(a.length>0){let e=a.find(e=>!K(G(e,t)).includes(`null`))??a[0];return e===void 0?null:J(e,t,n+1)}let o=W(r.allOf);if(o.length>0)return o.reduce((e,r)=>{let i=J(r,t,n+1);return U(e)&&U(i)?{...e,...i}:i},{});switch(K(r).find(e=>e!==`null`)){case`object`:return Y(r,t,n);case`array`:return[];case`string`:return``;case`number`:case`integer`:return typeof r.minimum==`number`?r.minimum:0;case`boolean`:return!1;default:return U(r.properties)?Y(r,t,n):null}}function Y(e,t,n){let r=U(e.properties)?e.properties:{},i={};for(let a of q(e)){let e=r[a];i[a]=U(e)?J(e,t,n+1):null}return i}function De(e){if(e!==null)return J(e,e,0)}function Oe(e){return e===null?`null`:Array.isArray(e)?`array`:typeof e==`number`?Number.isInteger(e)?`integer`:`number`:typeof e}function ke(e,t){let n=Oe(e);return n===t||t===`number`&&n===`integer`}function X(e,t){return e===``?String(t):`${e}.${t}`}function Z(e,t,n,r,i){let a=G(t,n);if(i>H*2)return[];let o=[...W(a.anyOf),...W(a.oneOf)];if(o.length>0&&!o.some(t=>Z(e,t,n,r,i+1).length===0))return[{path:r,code:`no-branch`,expected:`${o.length}`}];let s=[];for(let t of W(a.allOf))s.push(...Z(e,t,n,r,i+1));let c=K(a);if(c.length>0&&!c.some(t=>ke(e,t)))return[...s,{path:r,code:`type`,expected:c.join(` | `)}];`const`in a&&JSON.stringify(a.const)!==JSON.stringify(e)&&s.push({path:r,code:`const`,expected:JSON.stringify(a.const)});let l=a.enum;if(Array.isArray(l)){let t=l.map(e=>JSON.stringify(e));t.includes(JSON.stringify(e))||s.push({path:r,code:`enum`,expected:t.join(`, `)})}if(typeof e==`number`&&s.push(...Ae(e,a,r)),typeof e==`string`&&s.push(...je(e,a,r)),Array.isArray(e)&&U(a.items)){let t=a.items;e.forEach((e,a)=>s.push(...Z(e,t,n,X(r,a),i+1)))}return U(e)&&s.push(...Me(e,a,n,r,i)),s}function Ae(e,t,n){let r=[],i=t.minimum,a=t.maximum;return typeof i==`number`&&e<i&&r.push({path:n,code:`minimum`,expected:`${i}`}),typeof a==`number`&&e>a&&r.push({path:n,code:`maximum`,expected:`${a}`}),r}function je(e,t,n){let r=[],i=t.minLength,a=t.maxLength;return typeof i==`number`&&e.length<i&&r.push({path:n,code:`min-length`,expected:`${i}`}),typeof a==`number`&&e.length>a&&r.push({path:n,code:`max-length`,expected:`${a}`}),r}function Me(e,t,n,r,i){let a=[],o=U(t.properties)?t.properties:{};for(let n of q(t))n in e||a.push({path:X(r,n),code:`required`,expected:n});for(let[s,c]of Object.entries(e)){let e=o[s];U(e)?a.push(...Z(c,e,n,X(r,s),i+1)):t.additionalProperties===!1&&a.push({path:X(r,s),code:`unknown-field`,expected:s})}return a}function Ne(e,t){return t===null?[]:Z(e,t,t,``,0)}function Pe(e){if(e.trim()===``)return{ok:!0,value:void 0};try{return{ok:!0,value:JSON.parse(e)}}catch(e){return{ok:!1,message:e instanceof Error?e.message:String(e)}}}function Q(e){return`'${e.replaceAll(`'`,`'\\''`)}'`}function Fe(e){let t=`${e.hubBase}/trpc/${e.path}`,n=`-H "Authorization: Bearer $CAMSTACK_TOKEN"`,r=e.input===void 0?null:JSON.stringify({json:e.input});if(e.kind===`mutation`){let e=r??JSON.stringify({json:null});return[`curl -sS -X POST ${n} \\`,` -H 'Content-Type: application/json' \\`,` --data ${Q(e)} \\`,` ${Q(t)}`].join(`
|
|
2
|
+
`)}return`curl -sS ${n} \\\n ${Q(`${t}${r===null?``:`?input=${encodeURIComponent(r)}`}`)}`}function $(e,t){let n=e[t];return typeof n==`string`?n:null}function Ie(e){let t=e instanceof Error?e.message:String(e),n=U(e)||e instanceof Error?Reflect.get(e,`data`):void 0;if(!U(n))return{message:t,code:null,httpStatus:null,path:null,capRouteReason:null};let r=n.httpStatus;return{message:t,code:$(n,`code`),httpStatus:typeof r==`number`?r:null,path:$(n,`path`),capRouteReason:$(n,`capRouteReason`)}}function Le(e){if(e===void 0)return`undefined`;try{return JSON.stringify(e,null,2)??String(e)}catch{return String(e)}}var Re={searchText:e=>[e.path,e.scope?.capName??``],facetGroups:[{id:`router`,value:e=>e.router},{id:`kind`,value:e=>e.kind},{id:`tier`,value:e=>e.tier},{id:`source`,value:e=>e.source}]},ze={query:`info`,mutation:`warning`,subscription:`neutral`},Be={public:`success`,protected:`neutral`,admin:`primary`};function Ve({kind:e}){let{t}=z();return i(F,{variant:ze[e],size:`sm`,children:t(`system.apiExplorer.kind.${e}`)})}function He({tier:e}){let{t}=z();return i(F,{variant:Be[e],style:`outline`,size:`sm`,children:t(`system.apiExplorer.tier.${e}`)})}function Ue({methods:t,selectedPath:n,onSelect:r}){let{t:a}=z(),o=de(t,Re),s=e=>a(`system.apiExplorer.group.${e}`),c=e=>t=>e===`router`?t:a(`system.apiExplorer.${e}.${t}`),l=[{key:`path`,header:a(`system.apiExplorer.column.method`),sortValue:e=>e.path,render:t=>e(`span`,{className:`font-mono text-xs`,children:[e(`span`,{className:`text-foreground-muted`,children:[t.router,`.`]}),i(`span`,{className:`text-foreground`,children:t.method})]})},{key:`kind`,header:a(`system.apiExplorer.column.kind`),sortValue:e=>e.kind,render:e=>i(Ve,{kind:e.kind})},{key:`tier`,header:a(`system.apiExplorer.column.tier`),sortValue:e=>e.tier,render:e=>i(He,{tier:e.tier})},{key:`scope`,header:a(`system.apiExplorer.column.scope`),sortValue:e=>e.scope===null?null:`${e.scope.capName}:${e.scope.access}`,render:t=>t.scope===null?i(`span`,{className:`text-xs text-foreground-subtle`,children:a(`system.apiExplorer.coreRoute`)}):e(`span`,{className:`font-mono text-xs text-foreground-muted`,children:[t.scope.capName,` · `,t.scope.access]})}];return e(`div`,{className:`space-y-3`,children:[i(ie,{state:o.state,facets:o.facets,groups:o.groups.map(e=>({...e,label:s(e.id),facetLabel:c(e.id),...e.id===`router`?{display:`menu`}:{}})),labels:{searchPlaceholder:a(`system.apiExplorer.searchPlaceholder`),searchLabel:a(`system.apiExplorer.searchLabel`),facetsLabel:a(`system.apiExplorer.facetsLabel`),clearLabel:a(`system.apiExplorer.clearFilters`)},onSearch:o.setSearch,onToggleFacet:o.toggleFacet,onToggleGroupFacet:o.toggleGroupFacet,onClear:o.clear}),i(ve,{columns:l,rows:o.rows,rowKey:e=>e.path,onRowClick:e=>r(e.path),rowClassName:e=>e.path===n?`bg-primary/10`:void 0,minWidthPx:560,maxBodyHeight:re,defaultSort:{columnKey:`path`,dir:`asc`},emptyMessage:o.active?a(`system.apiExplorer.noMatch`):a(`system.apiExplorer.noMethods`)})]})}var We={yes:`success`,"per-device":`warning`,no:`danger`},Ge={yes:`system.apiExplorer.callableYes`,"per-device":`system.apiExplorer.callablePerDevice`,no:`system.apiExplorer.callableNo`};function Ke(e){let t=De(e);return t===void 0?``:JSON.stringify(t,null,2)}function qe({method:t}){let{t:r}=z(),s=b(),c=te(L.useUtils().client),l=L.apiCatalog.inputSchema.useQuery({path:t.path},{enabled:t.hasInput,staleTime:1/0}),u=l.data?.schema??null,[d,f]=o(``),[p,h]=o(null),[g,v]=o(!1);a(()=>{f(Ke(u))},[u]);let x=n(()=>Pe(d),[d]),C=x.ok?Ne(x.value,u):[],w=t.kind!==`subscription`&&t.callable!==`no`,T=w&&x.ok&&C.length===0&&!g,E=t.kind===`mutation`?`mutation`:`query`,D=Fe({hubBase:_(),path:t.path,kind:E,input:x.ok?x.value:void 0}),O=async()=>{if(!x.ok||t.kind===`mutation`&&!await s({title:r(`system.apiExplorer.confirmTitle`),message:r(`system.apiExplorer.confirmMessage`,{method:t.path}),confirmLabel:r(`system.apiExplorer.run`),variant:`danger`}))return;v(!0);let e=performance.now();try{h({kind:`ok`,value:E===`mutation`?await c.mutation(t.path,x.value):await c.query(t.path,x.value),ms:performance.now()-e})}catch(t){h({kind:`error`,error:Ie(t),ms:performance.now()-e})}finally{v(!1)}};return i(M,{headingId:`api-explorer-method`,title:r(`system.apiExplorer.column.method`),icon:S,actions:e(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[i(Ve,{kind:t.kind}),i(He,{tier:t.tier})]}),children:e(`div`,{className:`space-y-4 p-3 sm:p-4`,children:[i(`p`,{className:`break-all font-mono text-sm text-foreground`,children:t.path}),i(N,{items:[{key:r(`system.apiExplorer.column.scope`),value:t.scope===null?r(`system.apiExplorer.coreRouteLong`):r(`system.apiExplorer.scopeValue`,{cap:t.scope.capName,access:t.scope.access,capScope:t.scope.capScope})},{key:r(`system.apiExplorer.callable`),value:i(F,{variant:We[t.callable],size:`sm`,children:r(Ge[t.callable])})}]}),t.kind===`subscription`&&i(`p`,{className:`text-sm text-foreground-muted`,children:r(`system.apiExplorer.subscriptionNote`)}),t.hasInput&&i(Je,{loading:l.isPending,error:l.error?.message??l.data?.error??null,schema:u}),w&&e(`div`,{className:`space-y-2`,children:[i(`label`,{htmlFor:`api-explorer-input`,className:`text-xs font-medium text-foreground-muted`,children:r(`system.apiExplorer.input`)}),i(me,{id:`api-explorer-input`,value:d,onChange:e=>f(e.target.value),rows:t.hasInput?8:2,spellCheck:!1,placeholder:t.hasInput?void 0:r(`system.apiExplorer.noInput`),state:x.ok&&C.length===0?`default`:`error`,className:`font-mono text-xs`}),i(Ye,{parseError:x.ok?null:x.message,issues:C}),e(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e(R,{onClick:()=>void O(),disabled:!T,children:[i(y,{className:`h-3.5 w-3.5`}),r(g?`system.apiExplorer.running`:`system.apiExplorer.run`)]}),t.hasInput&&e(R,{variant:`ghost`,onClick:()=>f(Ke(u)),children:[i(m,{className:`h-3.5 w-3.5`}),r(`system.apiExplorer.resetInput`)]})]})]}),p!==null&&i(Xe,{outcome:p}),t.kind!==`subscription`&&e(`div`,{className:`space-y-2`,children:[e(`div`,{className:`flex items-center justify-between gap-2`,children:[i(`span`,{className:`text-xs font-medium text-foreground-muted`,children:r(`system.apiExplorer.curl`)}),i(le,{value:D,label:r(`system.apiExplorer.copy`),srLabel:r(`system.apiExplorer.curl`)})]}),i(A,{maxHeight:200,children:D}),i(`p`,{className:`text-xs text-foreground-subtle`,children:r(`system.apiExplorer.curlHint`)})]})]})})}function Je({loading:t,error:n,schema:r}){let{t:a}=z();return e(`div`,{className:`space-y-2`,children:[i(`span`,{className:`text-xs font-medium text-foreground-muted`,children:a(`system.apiExplorer.inputSchema`)}),t?i(k,{className:`h-24 w-full`}):n===null?i(A,{maxHeight:240,children:Le(r)}):i(j,{variant:`warning`,message:a(`system.apiExplorer.schemaUnavailable`,{error:n})})]})}function Ye({parseError:t,issues:n}){let{t:r}=z();return t===null&&n.length===0?null:e(`ul`,{className:`space-y-0.5 text-xs text-danger`,role:`alert`,children:[t!==null&&i(`li`,{children:r(`system.apiExplorer.invalidJson`,{error:t})}),n.map(e=>i(`li`,{children:r(`system.apiExplorer.issue.${e.code}`,{path:e.path===``?r(`system.apiExplorer.rootPath`):e.path,expected:e.expected})},`${e.path}:${e.code}`))]})}function Xe({outcome:t}){let{t:n}=z(),r=n(`system.apiExplorer.duration`,{ms:Math.round(t.ms)});if(t.kind===`ok`)return e(`div`,{className:`space-y-2`,children:[e(`div`,{className:`flex items-center gap-2`,children:[i(`span`,{className:`text-xs font-medium text-foreground-muted`,children:n(`system.apiExplorer.result`)}),i(F,{variant:`success`,size:`sm`,children:r})]}),i(A,{maxHeight:400,children:Le(t.value)})]});let{error:a}=t,o=[{key:n(`system.apiExplorer.errorCode`),value:a.code},{key:n(`system.apiExplorer.errorStatus`),value:a.httpStatus},{key:n(`system.apiExplorer.errorPath`),value:a.path},{key:n(`system.apiExplorer.errorCapRoute`),value:a.capRouteReason}].flatMap(e=>e.value===null?[]:[{key:e.key,value:String(e.value)}]);return i(j,{title:`${n(`system.apiExplorer.callFailed`)} · ${r}`,message:e(`div`,{className:`space-y-2`,children:[i(`p`,{className:`break-words`,children:a.message}),o.length>0&&i(N,{items:o})]})})}c();function Ze(){let{t:n}=z(),[o,s]=Ce(),c=o.get(V),l=L.apiCatalog.list.useQuery(void 0,{staleTime:1/0}),u=t(null),d=l.data?.methods.find(e=>e.path===c)??null,f=r(e=>{s(t=>{let n=new URLSearchParams(t);return n.set(V,e),n},{replace:!0})},[s]),p=d?.path??null;return a(()=>{p!==null&&u.current?.scrollIntoView?.({block:`start`,behavior:`smooth`})},[p]),i(B,{embedded:!0,icon:S,title:n(`system.apiExplorer.title`),subtitle:n(`system.apiExplorer.subtitle`),children:l.isPending?i(k,{className:`h-64 w-full`}):l.error===null?e(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[i(M,{headingId:`api-explorer-methods`,title:n(`system.apiExplorer.methodsTitle`,{count:l.data.methods.length}),children:i(`div`,{className:`p-3 sm:p-4`,children:i(Ue,{methods:l.data.methods,selectedPath:c,onSelect:f})})}),i(`div`,{ref:u,className:`min-w-0 scroll-mt-4`,children:d===null?c===null?i(I,{icon:w,title:n(`system.apiExplorer.pickTitle`),description:n(`system.apiExplorer.pickDescription`)}):i(j,{variant:`warning`,message:n(`system.apiExplorer.unknownMethod`,{method:c})}):i(qe,{method:d},d.path)})]}):i(j,{title:n(`system.apiExplorer.couldNotLoad`),message:l.error.message,onRetry:()=>void l.refetch()})})}var Qe={detection:`border-green-500`,detector:`border-green-500`,streaming:`border-blue-500`,decode:`border-blue-500`,decoder:`border-blue-500`,recording:`border-orange-500`,recorder:`border-orange-500`,transcoding:`border-purple-500`,transcoder:`border-purple-500`,restream:`border-cyan-500`,restreamer:`border-cyan-500`,storage:`border-yellow-500`,notification:`border-pink-500`,notifier:`border-pink-500`,faces:`border-indigo-500`},$e={detection:`bg-green-500/5`,detector:`bg-green-500/5`,streaming:`bg-blue-500/5`,decode:`bg-blue-500/5`,decoder:`bg-blue-500/5`,recording:`bg-orange-500/5`,recorder:`bg-orange-500/5`,transcoding:`bg-purple-500/5`,transcoder:`bg-purple-500/5`,restream:`bg-cyan-500/5`,restreamer:`bg-cyan-500/5`,storage:`bg-yellow-500/5`,notification:`bg-pink-500/5`,notifier:`bg-pink-500/5`,faces:`bg-indigo-500/5`};function et({entry:t,actions:n}){let r=t.name.toLowerCase(),a=Qe[r]??`border-primary`,o=$e[r]??`bg-primary/5`,s=t.providers.find(e=>e.active),c=n?.pendingCapability===t.name;return e(`div`,{className:`rounded-lg border-t-2 border border-border ${a} ${o} p-3 space-y-2`,children:[e(`div`,{className:`flex items-center justify-between gap-2`,children:[e(`span`,{className:`text-xs font-semibold text-foreground capitalize flex items-center gap-1.5`,children:[t.name,c&&i(E,{className:`h-3 w-3 animate-spin text-primary`})]}),i(`span`,{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ${t.mode===`singleton`?`bg-primary/10 text-primary`:`bg-info/10 text-info`}`,children:t.mode})]}),t.mode===`singleton`?i(tt,{entry:t,actions:n,activeProvider:s,isPending:c}):i(nt,{entry:t,actions:n,isPending:c})]})}function tt({entry:t,actions:n,activeProvider:r,isPending:a}){let{t:o}=z();if(!n)return i(`div`,{children:r?e(`div`,{className:`flex items-center gap-1.5 text-[10px] text-foreground`,children:[i(v,{className:`h-3 w-3 text-green-400 shrink-0`}),i(`span`,{className:`font-medium`,children:r.addonName}),i(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto`,children:`ACTIVE`})]}):i(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:o(`addons.capabilityMap.noActiveProvider`,`No active provider`)})});if(t.providers.length===0)return i(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:o(`addons.capabilityMap.noProviders`,`No providers`)});let s=`__inherit__`;return e(`div`,{className:`space-y-2`,children:[i(`div`,{className:`space-y-1`,children:t.providers.map(r=>{let o=r.active;return e(R,{variant:`unstyled`,type:`button`,disabled:a||o,onClick:()=>n.onSelectSingleton(t.name,r.addonId),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${o?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[i(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${o?`border-green-400 bg-green-400`:`border-border`}`}),i(`span`,{className:`font-medium truncate`,children:r.addonName}),o&&i(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},r.addonId)})}),t.perNode&&t.perNode.length>0&&i(`div`,{className:`space-y-2 pt-1 border-t border-border/40`,children:t.perNode.map(r=>{let c=r.hasOverride&&r.resolvedActive?r.resolvedActive:s,l=[{value:s,label:r.resolvedActive?o(`addons.capabilityMap.inheritGlobalWith`,{provider:r.resolvedActive}):o(`addons.capabilityMap.inheritGlobal`)},...r.providers.map(e=>({value:e,label:e}))],u=e=>{e===s?n.onClearNodeSingleton(t.name,r.nodeId):n.onSelectNodeSingleton(t.name,r.nodeId,e)},d=a;return e(`div`,{className:`space-y-0.5`,children:[e(`div`,{className:`text-[9px] font-semibold uppercase tracking-widest text-foreground-subtle/60 px-1.5`,children:[r.nodeId,r.hasOverride&&i(`span`,{className:`ml-1.5 rounded-full bg-primary/10 text-primary px-1 py-0.5 normal-case tracking-normal font-medium`,children:o(`common.override`)})]}),l.map(t=>{let n=c===t.value;return e(R,{variant:`unstyled`,type:`button`,disabled:d||n,onClick:()=>u(t.value),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${n?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[i(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${n?`border-green-400 bg-green-400`:`border-border`}`}),i(`span`,{className:`font-medium truncate`,children:t.label}),n&&t.value!==s&&i(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},t.value)})]},r.nodeId)})})]})}function nt({entry:t,actions:n,isPending:r}){let{t:a}=z();if(t.providers.length===0)return i(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:a(`addons.capabilityMap.noProviders`,`No providers`)});if(!n)return i(`div`,{className:`space-y-1`,children:t.providers.map(t=>e(`div`,{className:`flex items-center justify-between gap-2 text-[10px]`,children:[i(`span`,{className:`text-foreground-subtle`,children:t.addonName}),t.active&&i(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium`,children:`ACTIVE`})]},t.addonId))});let o=t.providers.filter(e=>e.active).map(e=>e.addonId),s=(e,r)=>{let i=r?[...new Set([...o,e])]:o.filter(t=>t!==e);n.onToggleCollection(t.name,i)};return i(`div`,{className:`space-y-1`,children:t.providers.map(t=>e(`label`,{className:`flex items-center justify-between gap-2 text-[10px] rounded px-1.5 py-1 transition-colors ${r?`opacity-50`:`hover:bg-surface-hover cursor-pointer`}`,children:[e(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[i(d,{checked:t.active,disabled:r,onChange:e=>s(t.addonId,e.target.checked),className:`h-3 w-3 accent-green-500 shrink-0`}),i(`span`,{className:`text-foreground truncate`,children:t.addonName})]}),t.active&&i(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium shrink-0`,children:`ACTIVE`})]},t.addonId))})}function rt({capabilities:e,actions:t}){let{t:n}=z();return e.length===0?i(`div`,{className:`text-xs text-foreground-subtle text-center py-8`,children:n(`addons.capabilityMap.noCapabilitiesRegistered`,`No capabilities registered`)}):i(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3`,children:e.map(e=>i(et,{entry:e,actions:t},e.name))})}c();var it=[`capabilities`,`listCapabilities`];function at(e){return e===`singleton`||e===`collection`}function ot(e){let t=e.indexOf(`@`);return t===-1?ye.t(`system.capabilities.providerHub`,{addonId:e}):`${e.slice(0,t)} (${e.slice(t+1)})`}function st(e,t){return{name:e.name,mode:t,providers:e.providers.map(n=>({addonId:n,addonName:ot(n),active:t===`singleton`?e.activeProvider===n:!e.disabledProviders.includes(n)})),...t===`singleton`&&e.perNode?{perNode:e.perNode}:{}}}function ct(){let{t}=z(),r=T(),[a,c]=o(null),[l,d]=o(null),p=s({queryKey:it,queryFn:()=>r.trpcClient.capabilities.listCapabilities.query()}),m=n(()=>{let e=(p.data??[]).flatMap(e=>at(e.mode)?[st(e,e.mode)]:[]),t=e.filter(e=>e.mode===`singleton`).toSorted((e,t)=>e.name.localeCompare(t.name)),n=e.filter(e=>e.mode===`collection`).toSorted((e,t)=>e.name.localeCompare(t.name));return[...t,...n]},[p.data]),h=n(()=>m.filter(e=>e.mode===`singleton`),[m]),g=n(()=>m.filter(e=>e.mode===`collection`),[m]),_=u({mutationFn:e=>r.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId}),onMutate:e=>{c(e.capName),d(null)},onSuccess:async(e,n)=>{d({kind:`success`,message:t(`system.capabilities.isNowActive`,`{{capName}} → {{addonId}} is now active.`,{capName:n.capName,addonId:n.addonId})}),await p.refetch()},onError:(e,n)=>{d({kind:`error`,message:t(`system.capabilities.failedToSet`,{cap:n.capName,error:e instanceof Error?e.message:t(`common.unknownError`)})})},onSettled:()=>c(null)}),y=u({mutationFn:e=>r.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId,nodeId:e.nodeId}),onMutate:e=>{c(e.capName),d(null)},onSuccess:async(e,t)=>{d({kind:`success`,message:`${t.capName} @ ${t.nodeId} → ${t.addonId}.`}),await p.refetch()},onError:(e,n)=>{d({kind:`error`,message:t(`system.capabilities.failedToSetOnNode`,{cap:n.capName,node:n.nodeId,error:e instanceof Error?e.message:t(`common.unknownError`)})})},onSettled:()=>c(null)}),b=u({mutationFn:e=>r.trpcClient.capabilities.clearSingletonNodeOverride.mutate({capability:e.capName,nodeId:e.nodeId}),onMutate:e=>{c(e.capName),d(null)},onSuccess:async(e,n)=>{d({kind:`success`,message:t(`system.capabilities.nowInheritsTheGlobalDefault`,`{{capName}} @ {{nodeId}} now inherits the global default.`,{capName:n.capName,nodeId:n.nodeId})}),await p.refetch()},onError:(e,n)=>{d({kind:`error`,message:t(`system.capabilities.failedToClearOnNode`,{cap:n.capName,node:n.nodeId,error:e instanceof Error?e.message:t(`common.unknownError`)})})},onSettled:()=>c(null)}),x=u({mutationFn:e=>r.trpcClient.capabilities.setCollectionEnabledProviders.mutate({capability:e.capName,enabledAddonIds:[...e.enabledAddonIds]}),onMutate:e=>{c(e.capName),d(null)},onSuccess:async(e,n)=>{d({kind:`success`,message:t(`system.capabilities.providerSEnabled`,`{{capName}}: {{length}} provider(s) enabled.`,{capName:n.capName,length:n.enabledAddonIds.length})}),await p.refetch()},onError:(e,n)=>{d({kind:`error`,message:t(`system.capabilities.failedToUpdate`,{cap:n.capName,error:e instanceof Error?e.message:t(`common.unknownError`)})})},onSettled:()=>c(null)}),S={onSelectSingleton:(e,t)=>_.mutate({capName:e,addonId:t}),onSelectNodeSingleton:(e,t,n)=>y.mutate({capName:e,nodeId:t,addonId:n}),onClearNodeSingleton:(e,t)=>b.mutate({capName:e,nodeId:t}),onToggleCollection:(e,t)=>x.mutate({capName:e,enabledAddonIds:t}),pendingCapability:a};return e(B,{embedded:!0,icon:C,title:t(`system.capabilities.capabilities`,`Capabilities`),subtitle:t(`system.capabilities.chooseWhichProviderIsActive`,`Choose which provider is active for each system capability. Singleton caps pick exactly one provider; collection caps enable a set.`),children:[l&&e(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-xs ${l.kind===`success`?`border-success/30 bg-success/10 text-success`:`border-danger/40 bg-danger/10 text-danger`}`,children:[l.kind===`success`?i(v,{className:`h-3.5 w-3.5 shrink-0`}):i(f,{className:`h-3.5 w-3.5 shrink-0`}),i(`span`,{children:l.message})]}),p.isLoading&&i(`div`,{className:`flex items-center justify-center py-16`,children:i(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})}),p.isError&&!p.isLoading&&i(j,{title:t(`system.capabilities.failedToLoadCapabilities`,`Failed to load capabilities`),message:p.error instanceof Error?p.error.message:t(`system.capabilities.unknownError`,`Unknown error`),onRetry:()=>void p.refetch()}),!p.isLoading&&!p.isError&&m.length===0&&i(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:t(`system.capabilities.noCapabilitiesRegistered`,`No capabilities registered.`)}),!p.isLoading&&!p.isError&&m.length>0&&e(`div`,{className:`space-y-6`,children:[h.length>0&&e(`section`,{className:`space-y-2`,children:[i(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:t(`system.capabilities.singletonPickOneProvider`,`Singleton — pick one provider`)}),i(rt,{capabilities:h,actions:S})]}),g.length>0&&e(`section`,{className:`space-y-2`,children:[i(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:t(`system.capabilities.collectionEnableASet`,`Collection — enable a set`)}),i(rt,{capabilities:g,actions:S})]})]})]})}var lt={escape:`Esc`,enter:`Enter`};function ut(e,t){let n=fe(e),r=lt[n.key]??n.key.toUpperCase();return t===`mac`?`${n.alt?`⌥`:``}${n.shift?`⇧`:``}${n.mod?`⌘`:``}${r}`:[...n.mod?[`Ctrl`]:[],...n.alt?[`Alt`]:[],...n.shift?[`Shift`]:[],r].join(`+`)}function dt(){let{t}=z(),n=_e(),r=ne();return i(M,{headingId:`settings-hotkeys`,title:t(`systemPage.settings.hotkeys.title`,`Keyboard shortcuts`),icon:O,testId:`settings-hotkeys`,children:e(`div`,{className:`space-y-2 p-3`,children:[i(`p`,{className:`text-xs text-foreground-subtle`,children:t(`systemPage.settings.hotkeys.description`,`The shortcuts active on this page. They cannot be changed.`)}),n.length===0?i(I,{title:t(`systemPage.settings.hotkeys.empty`,`No shortcuts are active on this page.`)}):n.map(e=>i(P,{label:e.label??t(`systemPage.settings.hotkeys.unnamed`,`Shortcut`),children:i(`kbd`,{className:`rounded-md border border-border bg-surface px-1.5 py-0.5 font-mono text-xs text-foreground`,children:ut(e.combo,r)})},`${e.scope}|${e.combo}`))]})})}c();var ft=[[`system`]];function pt(e){return e.toFixed(6).replace(/0+$/,``).replace(/\.$/,``)}function mt(){let{t}=z(),n=l(),r=oe(),s=ue(),c=se(),[u,d]=o(``),[f,p]=o(``),[m,_]=o(null),v=r.data?.location??null;a(()=>{d(v===null?``:pt(v.latitude)),p(v===null?``:pt(v.longitude))},[v]);let y=async()=>{await n.invalidateQueries({queryKey:ft})},b=async e=>{e.preventDefault();let t=Number(u),n=Number(f);if(u.trim()===``||f.trim()===``){_(`Enter both a latitude and a longitude, or press Clear.`);return}if(!Number.isFinite(t)||t<-90||t>90){_(`Latitude must be between -90 and 90 decimal degrees.`);return}if(!Number.isFinite(n)||n<-180||n>180){_(`Longitude must be between -180 and 180 decimal degrees.`);return}_(null),await s.mutateAsync({latitude:t,longitude:n}),await y()},x=async()=>{_(null),await s.mutateAsync(null),await y()},S=async()=>{_(null),await c.mutateAsync(),await y()},C=s.isPending||c.isPending||r.isLoading;return e(he,{className:`space-y-3`,children:[e(`div`,{className:`flex items-start justify-between gap-3`,children:[e(`div`,{className:`flex items-start gap-2`,children:[i(h,{className:`h-4 w-4 mt-0.5 text-muted-foreground shrink-0`}),i(`div`,{children:i(`h3`,{className:`text-sm font-medium`,children:t(`settings.siteLocationCard.siteLocation`,`Site location`)})})]}),v===null?i(F,{variant:`warning`,children:t(`settings.siteLocationCard.notConfigured`,`Not configured`)}):i(F,{variant:v.source===`operator-set`?`success`:`info`,children:v.source===`operator-set`?t(`settings.siteLocationCard.setByYou`,`Set by you`):t(`settings.siteLocationCard.derivedFromIp`,`Derived from IP`)})]}),v?.label!==void 0&&v.label!==``?i(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.detectedNear`,{place:v.label})}):null,v===null&&r.data?.derivationAttemptedAt!==null?e(`p`,{className:`text-xs text-warning`,children:[t(`settings.siteLocationCard.automaticDetectionFromThePublic`,`Automatic detection from the public IP did not succeed`),r.data?.derivationError!==null&&r.data?.derivationError!==void 0?`: ${r.data.derivationError}`:`.`,` `,t(`settings.siteLocationCard.itIsNotRetriedOn`,`It is not retried on its own — enter the coordinates, or press Detect.`)]}):null,e(`form`,{className:`flex flex-wrap items-end gap-3`,onSubmit:b,children:[e(`label`,{className:`flex flex-col gap-1 text-xs`,children:[i(`span`,{className:`text-muted-foreground`,children:t(`settings.siteLocationCard.latitude`,`Latitude`)}),i(ae,{className:`w-40`,value:u,inputMode:`decimal`,placeholder:`40.851800`,onChange:e=>d(e.target.value),"aria-label":t(`settings.siteLocationCard.latitude`,`Latitude`)})]}),e(`label`,{className:`flex flex-col gap-1 text-xs`,children:[i(`span`,{className:`text-muted-foreground`,children:t(`settings.siteLocationCard.longitude`,`Longitude`)}),i(ae,{className:`w-40`,value:f,inputMode:`decimal`,placeholder:`14.268100`,onChange:e=>p(e.target.value),"aria-label":t(`settings.siteLocationCard.longitude`,`Longitude`)})]}),i(R,{type:`submit`,disabled:C,children:t(`common.save`,`Save`)}),e(R,{type:`button`,variant:`ghost`,disabled:C,onClick:S,children:[i(g,{className:`h-3.5 w-3.5 mr-1`}),t(`settings.siteLocationCard.detectFromIp`,`Detect from IP`)]}),v===null?null:i(R,{type:`button`,variant:`ghost`,disabled:C,onClick:x,children:t(`settings.siteLocationCard.clear`,`Clear`)})]}),m===null?null:i(`p`,{className:`text-xs text-danger`,children:m}),i(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.wgs84DecimalDegreesDetectAsks`,`WGS84 decimal degrees. Detect asks a public geo-IP service once and will not overwrite a value you typed — clear it first.`)})]})}c();function ht(e){return D.some(t=>t===e)}function gt(e){return ce.some(t=>t===e)}function _t(){let{t}=z(),n=ge(),[r,a]=o(!1),[s,c]=o(null),l=e=>{a(!0),c(null),n.update(e).catch(e=>c(e instanceof Error?e.message:String(e))).finally(()=>a(!1))},u=n.status!==`ok`||!n.writable||r;return i(M,{headingId:`settings-units`,title:t(`systemPage.myAccess.units.title`,`Units`),icon:ee,testId:`settings-units`,children:e(`div`,{className:`space-y-2 p-3`,children:[i(`p`,{className:`text-xs text-foreground-subtle`,children:t(`systemPage.myAccess.units.description`,`How readings are shown to you, on every device you sign in on. Stored values do not change.`)}),n.status===`error`&&i(j,{message:t(`systemPage.myAccess.units.loadError`,`Your unit preferences could not be read.`)}),n.status===`ok`&&!n.writable&&i(j,{message:t(`systemPage.myAccess.units.unreadable`,`The saved unit preferences are in a format this version cannot read, so they are left untouched.`)}),s!==null&&i(j,{message:s}),i(P,{label:t(`systemPage.myAccess.units.temperature`,`Temperature`),children:i(x,{"aria-label":t(`systemPage.myAccess.units.temperature`,`Temperature`),value:n.value.temperature,disabled:u,onChange:e=>{let t=e.target.value;gt(t)&&l({temperature:t})},options:[{value:`celsius`,label:t(`systemPage.myAccess.units.celsius`,`Celsius (°C)`)},{value:`fahrenheit`,label:t(`systemPage.myAccess.units.fahrenheit`,`Fahrenheit (°F)`)}]})}),i(P,{label:t(`systemPage.myAccess.units.system`,`Other measurements`),children:i(x,{"aria-label":t(`systemPage.myAccess.units.system`,`Other measurements`),value:n.value.system,disabled:u,onChange:e=>{let t=e.target.value;ht(t)&&l({system:t})},options:[{value:`metric`,label:t(`systemPage.myAccess.units.metric`,`Metric (km/h, hPa, mm)`)},{value:`imperial`,label:t(`systemPage.myAccess.units.imperial`,`Imperial (mph, inHg, in)`)}]})})]})})}function vt(){let{t}=z(),{nodes:n,isLoading:r}=pe(),a=n.find(e=>e.isHub&&e.isOnline);return e(B,{embedded:!0,children:[i(mt,{}),r?i(`div`,{className:`text-foreground-subtle text-sm py-12 text-center`,children:t(`admin.system.settings.loadingHubTopology`,`Loading hub topology…`)}):a?i(Ee,{emptyMessage:t(`admin.system.settings.bootstrapUnavailable`,`Not available — the addon that owns the server settings did not answer.`)}):e(`div`,{className:`flex flex-col items-center justify-center text-foreground-subtle text-sm gap-2 py-12`,children:[i(p,{className:`h-8 w-8 opacity-30`}),i(`p`,{children:t(`admin.system.settings.noOnlineHubNodeFound`,`No online hub node found.`)}),i(`p`,{className:`text-xs`,children:t(`admin.system.settings.settingsWillAppearOnceThe`,`Settings will appear once the hub is reachable.`)})]}),e(`section`,{"aria-labelledby":`settings-per-user`,className:`mt-3 sm:mt-4 space-y-3 sm:space-y-4`,children:[i(`h2`,{id:`settings-per-user`,className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:t(`systemPage.settings.perUser`,`Your settings`)}),i(_t,{}),i(dt,{})]})]})}function yt(){let{t:e}=z(),t=xe(`/system/settings`,{t:e,isAdmin:!0})??{icon:p,title:e(`system.systemNav`,`System`)},{search:n,hash:r}=we();return new URLSearchParams(n).get(`tab`)===`secrets`?i(Se,{replace:!0,to:`${be(n)}${r}`}):i(Te,{icon:t.icon,title:t.title,defaultSection:`settings`,sectionsLabel:`${t.title} sections`,sections:[{id:`settings`,label:e(`system.system.settings`,`Settings`),content:i(vt,{})},{id:`capabilities`,label:e(`system.system.capabilities`,`Capabilities`),content:i(ct,{})},{id:`api-explorer`,label:e(`system.system.apiExplorer`),content:i(Ze,{}),ownedParams:[`method`]}]})}export{yt as SystemPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e,J as t,K as n,R as r,S as i,V as a,Y as o,a as s,et as c,i as l,o as u,q as d,x as f}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{$a as p,Bn as m,Ha as h,Ka as g,Ra as _,Wa as v,ft as y,ir as b,qt as x,tn as S,yt as C}from"./player-overlays-hLBmOC8C.js";import{An as w,Dr as T,Er as E,Ga as ee,Hs as te,Jr as D,Ka as O,Lr as ne,On as re,Pn as ie,Qs as ae,Rr as oe,Wa as k,_c as A,jn as se,kn as j,qr as M,ts as ce,zr as N}from"./client-D93RkunP.js";import{n as le,t as P}from"./shapes-D4IRNSXI.js";import{t as ue}from"./unlink-D3-IGpS8.js";import{$n as de,Aa as F,Bn as fe,D as pe,Da as me,Dp as I,Ea as he,Ep as L,Fn as ge,Gi as _e,Hn as ve,In as ye,Ji as be,Jn as xe,Kn as Se,Kt as R,Ln as Ce,O as we,Oa as Te,Op as Ee,Qn as De,Rn as Oe,Rp as ke,T as Ae,Ta as je,Uf as Me,Ui as Ne,Un as Pe,Vn as Fe,Wi as Ie,Wn as z,Xd as Le,Xn as Re,Yi as ze,Yn as Be,Zn as Ve,Zs as He,ar as Ue,cr as We,di as Ge,er as Ke,fi as qe,ir as Je,k as Ye,la as Xe,li as Ze,lr as Qe,mp as $e,nr as B,ns as et,or as V,q as tt,qi as nt,qn as rt,rr as it,rt as at,sr as ot,tr as st,ui as ct,ut as H,v as lt,vp as U,xa as ut,zf as dt,zn as ft}from"./src-DBaqc0p7.js";import{t as W}from"./useTranslation-BJr-n0es.js";import{a as pt,c as mt,d as ht,f as gt,i as _t,l as vt,n as yt,o as bt,r as xt,u as St}from"./command-vocab-DGcpiUvY.js";import{At as Ct,Ct as wt,St as Tt,kt as Et,wt as Dt,xt as Ot}from"./CompositionBlockEditor-BdhVBszZ.js";c();function G(e){return e.kind===`dynamic`}function kt(e){return e.replace(/-([a-z0-9])/g,(e,t)=>t.toUpperCase())}function K(e,t){return t.from===`status`&&t.cap!==void 0?t.cap:e}function q(e){return e.from===`method`?e.method:`getStatus`}function J(e,t){return typeof e==`object`&&e?Reflect.get(e,t):void 0}function At(e){return typeof e==`string`||typeof e==`number`}function jt(e,t){let n=t.from===`status`?J(e,t.field):e;if(!Array.isArray(n))return[];let r=[];for(let e of n){if(t.where!==void 0&&J(e,t.where.key)!==t.where.equals)continue;let n=t.valueKey===void 0?e:J(e,t.valueKey);if(!At(n))continue;let i=t.labelKey===void 0?n:J(e,t.labelKey);r.push({value:n,label:At(i)?String(i):String(n)})}return r}function Mt(e,t){let n=t.from===`status`?J(e,t.field):e;return Array.isArray(n)?{kind:`answered`,choiceCount:jt(e,t).length}:{kind:`failed`}}var Nt=3e4;function Pt(e){return typeof e==`object`&&!!e&&typeof Reflect.get(e,`query`)==`function`}function Ft(e,t,n,r){return{queryKey:[`build`,`dynamic-offer`,t,n,r],staleTime:Nt,retry:!1,queryFn:async()=>{let i=typeof e==`object`&&e?Reflect.get(e,kt(n)):void 0,a=typeof i==`object`&&i?Reflect.get(i,r):void 0;if(!Pt(a)||t===null)throw Error(`no readable ${n}.${r}`);return a.query({deviceId:t})}}}function Y(e,t){return`${e}.${t}`}function It(e){let t=new Map;for(let n of e)for(let e of n.openArgs){if(!G(e.offer))continue;let r=K(n.cap,e.offer),i=q(e.offer),a=Y(r,i);t.has(a)||t.set(a,{key:a,readCap:r,read:i,offer:e.offer})}return[...t.values()]}function Lt(e,t){let n=C(),r=It(t),i=l({queries:r.map(t=>({...Ft(n.trpcClient,e,t.readCap,t.read),enabled:e!==null&&e>0}))}),a=new Map;return r.forEach((e,t)=>{let n=i[t];n===void 0||n.isPending?a.set(e.key,{kind:`pending`}):n.isError?a.set(e.key,{kind:`failed`}):a.set(e.key,Mt(n.data,e.offer))}),(e,t)=>a.get(Y(K(e,t),q(t)))??{kind:`pending`}}function Rt(e){let t=new Map;for(let n of e){if(n.offeredWhen===null)continue;let e=`${Y(n.cap,n.offeredWhen.method)}#${n.offeredWhen.field}`;t.has(e)||t.set(e,{key:e,cap:n.cap,gate:n.offeredWhen})}return[...t.values()]}function zt(e,t){let n=C(),r=Rt(t),i=l({queries:r.map(t=>({...Ft(n.trpcClient,e,t.cap,t.gate.method),enabled:e!==null&&e>0}))}),a=new Map;return r.forEach((e,t)=>{let n=i[t];n===void 0||n.isPending?a.set(e.key,{kind:`pending`}):n.isError?a.set(e.key,{kind:`failed`}):a.set(e.key,re(n.data,e.gate))}),(e,t)=>a.get(`${Y(e,t.method)}#${t.field}`)??{kind:`pending`}}function Bt(e,t,n){let r=C(),i=n===null?``:q(n),a=n===null?t:K(t,n),o=s({...Ft(r.trpcClient,e,a,i),enabled:e!==null&&e>0&&n!==null});if(n===null||e===null)return{state:`unavailable`};if(o.isPending)return{state:`loading`};if(o.isError)return{state:`unavailable`};let c=jt(o.data,n);return c.length===0?{state:`unavailable`}:{state:`ready`,choices:c}}var Vt=`deviceId`;function Ht(e){return j(e.caps,e.type)}function Ut(e){let[t,...n]=e;if(t===void 0)return[];let r=n.map(e=>new Set(e.map(e=>e.id)));return t.filter(e=>r.every(t=>t.has(e.id))&&(n.length===0||!Wt(e)))}function Wt(e){return e.openArgs.some(e=>e.offer.kind===`dynamic`)}function Gt(e){let t=new Map;for(let n of e)for(let e of Ht(n))t.has(e.id)||t.set(e.id,e);return[...t.values()]}function Kt(e,t){return e.filter(e=>w(e.caps,[t],`any`,e.type))}function qt(e,t){return e.find(e=>e.id===t)??{id:t,caps:[]}}function Jt(e,t,n){if(t===null)return[];if(t.kind===`devices`)return t.ids.length===0?[]:Ut(t.ids.map(t=>Ht(qt(e,t))));if(t.kind===`var`&&t.name===`deviceId`)return Gt(e).filter(e=>!Wt(e));if(t.kind===`var`&&t.name===`item`){let t=n.roundDevices??[];return t.length===0?[]:Ut(t.map(t=>Ht(qt(e,t))))}return[]}function Yt(e){let t=new Map;for(let n of e)t.set(n.cap,[...t.get(n.cap)??[],n]);return[...t.entries()].map(([e,t])=>({cap:e,actions:t}))}function Xt(e,t,n,r){let i=Zt(r.trim());return i===``?!0:[e.label[t],e.phrase[t],n,e.id].some(e=>Zt(e).includes(i))}function Zt(e){return e.normalize(`NFD`).replace(/\p{Diacritic}/gu,``).toLowerCase()}function Qt(e){return e?.kind===`devices`?e.ids:[]}function $t(e,t,n,r){return n===null?null:Jt(e,t,r).some(e=>e.id===n)?n:null}function en(e,t,n){if(t?.kind!==`devices`)return t;let r=new Set(Kt(e,n).map(e=>e.id)),i=t.ids.filter(e=>r.has(e));return i.length===0?null:{kind:`devices`,ids:i}}function tn(e){return e.toLowerCase().startsWith(`it`)?`it`:`en`}function nn(e,t){return e===`error`||t===`error`?`failed`:e===`pending`||t===`pending`?`pending`:`answered`}function rn(e){let t=He({projection:`slim`}),r=n(()=>{let n=t.status===`success`?Et(t.data):[],r=new Set(e??[]);return n.filter(e=>!r.has(e.type))},[t.status,t.data,e]),i=Ct(r.map(e=>e.id)),a=n(()=>r.map(e=>({id:e.id,type:e.type,caps:i.data?.get(e.id)??[]})),[r,i.data]),o=r.length===0&&t.status===`success`?`success`:i.status;return{rows:r,fleet:a,listState:nn(t.status,o)}}function an(e,t,n){return Yt(e).map(e=>({cap:e.cap,title:Dt(e.cap,n),rows:e.actions.map(e=>({cap:e.cap,path:e.id,label:e.label[t],valueText:``}))}))}function on({target:t,allowTriggerDevice:n,round:r,onPick:a}){let{t:o}=W(),s=[...n?[{name:Vt,label:o(`customize.sourceSelector.action.triggerDevice`)}]:[],...r?[{name:ce,label:o(`customize.sourceSelector.action.roundDevice`)}]:[]];return s.length===0?null:i(`ul`,{className:`flex flex-col gap-1`,"data-testid":`action-pseudo-targets`,children:s.map(n=>i(`li`,{children:e(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground`,children:[i(Te,{name:`action-pseudo-target`,checked:t?.kind===`var`&&t.name===n.name,"data-testid":`action-target-var-${n.name}`,onChange:()=>a({kind:`var`,name:n.name})}),i(`span`,{children:n.label})]})},n.name))})}function sn(e,t){if(e?.kind!==`devices`||e.ids.length<=1||t===void 0||!t.openArgs.some(e=>e.offer.kind===`dynamic`))return e;let n=e.ids[e.ids.length-1];return n===void 0?e:{kind:`devices`,ids:[n]}}function cn({value:t,onChange:r,allowTriggerDevice:a=!1,roundDevices:s,multiple:c=!0,excludeTypes:l,args:u,fillHeight:d=!1}){let{t:f,i18n:p}=W(),m=tn(p.language),[h,g]=o(`by-device`),[_,v]=o(`devices`),[y,b]=o(``),{fleet:x,listState:S}=rn(l),C=je(`command-devices`),w=n(()=>s===void 0?{}:{roundDevices:s},[s]),T=n(()=>Jt(x,t.target,w),[x,t.target,w]),E=t.target?.kind===`devices`&&t.target.ids.length===1?t.target.ids[0]??null:null,ee=Lt(E,T),te=zt(E,T),D=E===null?T:se(T,ee,te),O=n(()=>Gt(x),[x]),ne=O.find(e=>e.id===t.actionId),re=e=>{let n=sn(e,h===`by-action`?ne:void 0);r({target:n,actionId:h===`by-device`?$t(x,n,t.actionId,w):t.actionId})},ie=e=>{r({target:h===`by-action`?en(x,t.target,e):t.target,actionId:e})},ae=h===`by-action`&&t.actionId!==null?{actions:[t.actionId]}:void 0,oe=Qt(t.target).map(e=>({deviceId:e})),k=e(`div`,{className:d?`flex min-h-0 flex-1 flex-col gap-2`:`flex min-h-0 flex-col gap-2`,"data-testid":`action-device-column`,children:[i(`h3`,{className:`text-[11px] font-medium text-foreground-muted`,children:f(`customize.sourceSelector.action.devicesHeading`)}),i(on,{target:t.target,allowTriggerDevice:a&&(h===`by-device`||t.actionId!==null),round:s!==void 0,onPick:re}),h===`by-action`&&t.actionId===null?i(`p`,{className:`text-[11px] text-foreground-subtle`,children:f(`customize.sourceSelector.action.pickActionFirst`)}):i(he,{requires:ae,excludeTypes:l,kind:`device`,multiple:c,picked:oe,onSelect:e=>{C.push(e.deviceId);let n=Qt(t.target),r=c?n.includes(e.deviceId)?n.filter(t=>t!==e.deviceId):[...n,e.deviceId]:n.length===1&&n[0]===e.deviceId?[]:[e.deviceId];re(r.length===0?null:{kind:`devices`,ids:r})},railFirst:!1,recentIds:C.ids,autoFocus:h===`by-device`,fill:d})]}),A=h===`by-device`?D:O,j=A.filter(e=>Xt(e,m,Dt(e.cap,p.language),y)),M=e(`div`,{className:`flex min-h-0 flex-col gap-2`,"data-testid":`action-command-column`,children:[i(`h3`,{className:`text-[11px] font-medium text-foreground-muted`,children:f(`customize.sourceSelector.action.actionsHeading`)}),(h===`by-action`||A.length>=8)&&i(L,{type:`search`,value:y,"aria-label":f(`customize.sourceSelector.action.search`),placeholder:f(`customize.sourceSelector.action.search`),"data-testid":`action-search`,onChange:e=>b(e.target.value)}),h===`by-device`&&t.target===null?i(`p`,{className:`text-[11px] text-foreground-subtle`,children:f(`customize.sourceSelector.action.pickDeviceFirst`)}):S===`pending`?i(`p`,{role:`status`,className:`text-[11px] text-foreground-subtle`,children:f(`customize.sourceSelector.action.loading`)}):j.length===0?i(`p`,{className:`text-[11px] text-foreground-subtle`,"data-testid":`action-none`,children:y.trim()===``?Qt(t.target).length>1?f(`customize.sourceSelector.action.noCommon`):f(`customize.sourceSelector.action.none`):f(`customize.sourceSelector.action.noMatch`,{query:y})}):i(Ae,{name:`action-command`,groups:an(j,m,p.language),value:t.actionId===null?null:{cap:A.find(e=>e.id===t.actionId)?.cap??``,path:t.actionId},rowTestId:e=>`action-row-${e.path}`,onPick:e=>ie(e.path)})]}),ce=h===`by-device`?t.target!==null:t.actionId!==null,N=h===`by-device`?t.target?.kind===`devices`?t.target.ids.length:t.target===null?0:1:t.actionId===null?0:1;return e(`div`,{className:d?`flex min-h-0 flex-1 flex-col gap-3`:`flex flex-col gap-3`,children:[i(tt,{label:f(`customize.sourceSelector.action.mode`),value:h,options:[{value:`by-device`,label:f(`customize.sourceSelector.action.byDevice`)},{value:`by-action`,label:f(`customize.sourceSelector.action.byAction`)}],onChange:e=>{if(e===`by-device`){let e=$t(x,t.target,t.actionId,w);e!==t.actionId&&r({target:t.target,actionId:e})}g(e),v(`devices`),b(``)}}),i(Ot,{step:_,devices:h===`by-device`?k:M,values:h===`by-device`?M:k,back:ce?{label:f(`customize.sourceSelector.backToDevices`),ariaLabel:f(`customize.sourceSelector.backToDevices`)}:null,onBack:()=>v(Tt()),done:{countLabel:f(`customize.sourceSelector.pickedCount`,{count:N}),label:f(`customize.sourceSelector.done`),disabled:!ce},onDone:()=>{let e=wt(N);e!==null&&v(e)},fillHeight:d}),u!=null&&t.actionId!==null&&t.target!==null&&i(`div`,{"data-testid":`action-args`,className:`flex max-h-[40%] shrink-0 flex-col gap-2 overflow-y-auto border-t border-border pt-3`,children:u})]})}c();function ln(e){return e===void 0||!Number.isFinite(e)?``:String(e)}function un({value:e,onValue:t,onBrace:n,onBlur:r,...a}){let[s,c]=o(null);return i(L,{...a,inputMode:`decimal`,value:s??ln(e),onChange:e=>{let r=e.target.value;if(r.includes(`{`)){n?.();return}c(r);let i=r.trim()===``?NaN:Number(r);t(Number.isFinite(i)?i:null)},onBlur:e=>{c(null),r?.(e)}})}function X({widthClass:e,...t}){return i(`span`,{className:`block max-w-full ${e}`,children:i(y,{...t})})}c();function dn(e){return e.kind===`fixed`?String(e.value):``}function fn({arg:t,locale:n,variables:r,value:a,onChange:s,choices:c}){let{t:l}=W(),[u,d]=o(!1),f=t.label[n],p=yt(t,a),m=a.kind===`var`?i($e,{label:a.name,onRemove:()=>s(_t(t))}):i(pn,{arg:t,locale:n,value:a,onChange:s,onBrace:()=>d(!0),choices:c});return e(`span`,{className:`inline-flex flex-col gap-0.5 align-top`,"data-testid":`arg-${t.key}`,children:[e(`span`,{className:`inline-flex items-center gap-1`,children:[m,r.length>0&&e(Ze,{open:u,onOpenChange:d,children:[i(qe,{"aria-label":l(`flow.arg.useVariable`,`Use a variable for {{label}}`,{label:f}),className:`h-8 rounded-md border border-border bg-surface px-2 font-mono text-xs text-foreground hover:bg-surface-hover`,children:`{x}`}),i(ct,{children:r.map(e=>i(Ge,{onClick:()=>s({kind:`var`,name:e.name}),children:`${e.name} · ${e.hint}`},e.name))})]})]}),i(hn,{arg:t,value:a,issue:p})]})}function pn({arg:e,locale:t,value:n,onChange:r,onBrace:a,choices:o}){let{t:s}=W(),c=e.offer,l=e.label[t];if(G(c)&&o?.state===`ready`){let t=o.choices.some(e=>e.value===n.value);return i(X,{widthClass:`w-48`,"aria-label":l,"data-testid":`dynamic-${e.key}`,value:String(n.value),onChange:e=>{let t=o.choices.find(t=>String(t.value)===e.target.value);t!==void 0&&r({kind:`fixed`,value:t.value})},options:[...t?[]:[{value:String(n.value),label:n.value===``?s(`flow.arg.choose`,`Choose…`):String(n.value)}],...o.choices.map(e=>({value:String(e.value),label:e.label}))]})}if(c.kind===`enum`)return i(X,{widthClass:`w-40`,"aria-label":l,value:String(n.value),onChange:e=>{let t=c.values.find(t=>String(t.value)===e.target.value);t!==void 0&&r({kind:`fixed`,value:t.value})},options:c.values.map(e=>({value:String(e.value),label:e.label[t]}))});if(c.kind===`boolean`)return i(X,{widthClass:`w-28`,"aria-label":l,value:n.value===!0?`yes`:`no`,onChange:e=>r({kind:`fixed`,value:e.target.value===`yes`}),options:[{value:`yes`,label:s(`common.yes`,`Yes`)},{value:`no`,label:s(`common.no`,`No`)}]});let u=vt(e);return u===void 0?c.kind===`number`?i(mn,{label:l,unit:c.unit,value:n,onChange:r,onBrace:a}):c.kind===`text`&&c.secret===!0?i(L,{"aria-label":l,type:`password`,className:`w-40`,value:dn(n),onChange:e=>r({kind:`fixed`,value:e.target.value})}):i(lt,{label:l,className:`flex w-56 flex-col gap-1`,testId:`arg-text-${e.key}`,value:dn(n),onChange:e=>r({kind:`fixed`,value:e})}):i(pe,{quantity:u.quantity,storedUnit:u.unit,value:typeof n.value==`number`?n.value:void 0,unit:n.unit,min:u.min,max:u.max,"aria-label":l,onBrace:a,onChange:e=>{let t=Ye(e,u.unit);r({kind:`fixed`,value:t.value,unit:t.unit})}})}function mn({label:t,unit:n,value:r,onChange:a,onBrace:o}){return e(f,{children:[i(un,{"aria-label":t,className:`w-20`,value:typeof r.value==`number`?r.value:void 0,onValue:e=>a({kind:`fixed`,value:e??NaN}),onBrace:o}),n!==void 0&&i(`span`,{className:`text-sm text-foreground-muted`,children:n})]})}function hn({arg:e,value:t,issue:n}){let{t:r}=W(),a=e.offer;if(t.kind!==`fixed`||a.kind!==`number`||a.min===void 0&&a.max===void 0)return null;let o=vt(e),s=o===void 0?a.unit:t.unit??o.unit,c=o===void 0?{min:a.min,max:a.max}:we({min:a.min,max:a.max},o.unit,s??o.unit),l=s??``,u=e=>e===void 0||o===void 0?e:Number(e.toPrecision(4)),d={min:u(c.min),max:u(c.max)},f=d.min!==void 0&&d.max!==void 0?r(`flow.arg.range`,`{{min}} to {{max}} {{unit}}`,{min:d.min,max:d.max,unit:l}):d.min===void 0?r(`flow.arg.atMost`,`at most {{max}} {{unit}}`,{max:d.max,unit:l}):r(`flow.arg.atLeast`,`at least {{min}} {{unit}}`,{min:d.min,unit:l});return i(`span`,{className:`text-[11px] ${n===null?`text-foreground-subtle`:`text-danger`}`,role:n===null?void 0:`alert`,children:f.trim()})}var gn=[ae.Container],_n=[ae.Camera];function vn(e,t){let n=te(e);if(n!==void 0)return j([n.cap],t).find(t=>t.id===e)}function yn(e,t){return e.kind===`devices`?e.ids.map(t.deviceName).join(`, `):e.kind===`var`?e.name===`deviceId`?t.triggerDevice:e.name===`item`?t.roundDevice:`{${e.name}}`:t.someDevices}function bn(e,t,n){if(t.kind===`var`)return`{${t.name}}`;let r=e.offer;if(r.kind===`enum`){let e=r.values.find(e=>e.value===t.value);return e===void 0?String(t.value):e.label[n]}return String(t.value)}function xn(e,t,n,r){if(e.actionId===``)return null;let i=vn(e.actionId,r);if(i===void 0)return null;let a=mt([i],e),o=yn(e.target,n);return ht(i.phrase[t]).map(e=>{if(e.kind===`text`)return e.text;if(e.key===`device`)return o;let n=i.openArgs.find(t=>t.key===e.key),r=a?.values[e.key];return n===void 0||r===void 0?`{${e.key}}`:bn(n,r,t)}).join(``)}function Sn({deviceId:e,cap:t,arg:n,...r}){return i(fn,{arg:n,choices:Bt(e,t,G(n.offer)?n.offer:null),...r})}c();function Cn(e){let{t}=W();return{deviceName:t=>e.find(e=>e.id===t)?.name??`#${String(t)}`,triggerDevice:t(`flow.command.triggerDevice`),roundDevice:t(`automation.repeat.itemHint`,`the device of this round`),someDevices:t(`flow.command.domainDevices`)}}function wn({step:t,devices:n,variables:r,roundDevices:a,singleTarget:s=!1,autoOpen:c=!0,onChange:l}){let{t:u,i18n:d}=W(),f=gt(d.language),p=Cn(n),[m,h]=o(c&&t.actionId===``);return e(`div`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`command-step`,children:[i(`p`,{className:`min-w-0 flex-1 text-sm text-foreground`,"data-testid":`command-step-phrase`,children:xn(t,f,p,Z(t.target,n))??i(`span`,{className:`text-foreground-subtle`,children:u(`flow.command.pickCommand`)})}),i(U,{variant:`outline`,size:`sm`,"data-testid":`command-step-change`,onClick:()=>h(!0),children:t.actionId===``?u(`flow.command.choose`):u(`flow.command.change`)}),m&&i(En,{step:t,devices:n,variables:r,singleTarget:s,...a===void 0?{}:{roundDevices:a},onCancel:()=>h(!1),onConfirm:e=>{h(!1),l(e)}})]})}function Z(e,t){if(e?.kind!==`devices`)return;let n=e.ids[0];return t.find(e=>e.id===n)?.type}function Tn(e){return{target:e.target.kind===`devices`&&e.target.ids.length===0?null:e.target,actionId:e.actionId===``?null:e.actionId}}function En({step:t,devices:n,variables:r,roundDevices:a,singleTarget:s,onCancel:c,onConfirm:l}){let{t:u,i18n:d}=W(),p=gt(d.language),[m,h]=o(()=>Tn(t)),g=m.actionId===null?void 0:vn(m.actionId,Z(m.target,n)),[_,v]=o(()=>g===void 0?{}:mt([g],t)?.values??pt(g)),y=g===void 0?null:bt(g,_),b=m.target!==null&&g!==void 0&&y===null;return i(at,{open:!0,onClose:c,title:u(`flow.command.dialogTitle`),width:`xl`,fill:!0,testId:`command-picker-dialog`,footer:e(f,{children:[i(U,{variant:`ghost`,onClick:c,children:u(`common.cancel`,`Cancel`)}),i(U,{disabled:!b,"data-testid":`command-picker-confirm`,onClick:()=>{m.target===null||g===void 0||y!==null||l(xt(g,m.target,_))},children:u(`flow.command.use`)})]}),children:i(cn,{value:m,onChange:e=>{if(e.actionId!==m.actionId){let t=e.actionId===null?void 0:vn(e.actionId,Z(e.target,n));v(t===void 0?{}:pt(t))}h(e)},allowTriggerDevice:!s,multiple:!s,excludeTypes:gn,fillHeight:!0,...a===void 0?{}:{roundDevices:a},args:g!==void 0&&g.openArgs.length>0?i(Dn,{action:g,deviceId:m.target===null?null:St({target:m.target}),values:_,locale:p,variables:r,onChange:v}):null})})}function Dn({action:t,deviceId:n,values:r,locale:a,variables:o,onChange:s}){return i(`div`,{className:`flex flex-wrap items-start gap-3`,"data-testid":`command-args`,children:t.openArgs.map(c=>{let l=r[c.key];if(l===void 0)return null;let u=e=>s({...r,[c.key]:e});return e(`label`,{className:`flex flex-col gap-1 text-[11px] text-foreground`,children:[c.label[a],n===null?i(fn,{arg:c,locale:a,variables:o,value:l,onChange:u}):i(Sn,{deviceId:n,cap:t.cap,arg:c,locale:a,variables:o,value:l,onChange:u})]},c.key)})})}c();var On=6e4;function kn(){let e=He({projection:`slim`});return n(()=>{let t=new Map((e.data??[]).map(e=>[e.id,e.name]));return(e.data??[]).filter(e=>ie(String(e.type))).map(e=>({id:e.id,name:e.name,stableId:e.stableId,addonId:e.addonId,type:String(e.type),location:e.location??null,parentName:e.parentDeviceId===null?null:t.get(e.parentDeviceId)??null})).toSorted((e,t)=>e.name.localeCompare(t.name))},[e.data])}function An(e){let t=C();return s({queryKey:[`automation`,`wireable-fields`,e],enabled:e>0,staleTime:On,queryFn:async()=>(await t.trpcClient.deviceManager.getWireableFields.query({deviceId:e})).caps})}function jn(e,t){return e.find(e=>e.cap===t)?.fields??[]}function Mn(){return et()}function Nn(e){let t=new Map;for(let n of e)for(let e of n)t.has(e.id)||t.set(e.id,e);let n=[...t.values()];return[...n.filter(e=>e.id.startsWith(`core:`)),...n.filter(e=>!e.id.startsWith(`core:`))]}function Pn(e,t){let n=e.nameI18n;return n===void 0?e.name:t.startsWith(`it`)?n.it:n.en}function Fn(e){let t=T({columns:e.size.cols,rows:e.size.rows,buttons:[]},e,{row:0,col:0});return t.ok?t.layout:null}function In(e,t,n,r){let i=t.trim().toLowerCase();return i===``?[...e]:e.filter(e=>Pn(e,n).toLowerCase().includes(i)||r(e.category).toLowerCase().includes(i))}function Ln(e,t){let n=E(e,t);return n!==null&&n>1}function Rn(e,t,n={}){let r=n.fillWidth===!0?E(e,t):null,i=r===null||r<2?{}:{scale:{cols:r}};if(n.at!==void 0)return T(e,t,n.at,i);let a=T(e,t,{row:0,col:0},i);if(a.ok||a.reason===`outside`||a.reason===`too-many`)return a;for(let n=0;n<e.rows;n+=1)for(let r=0;r<e.columns;r+=1){let a=T(e,t,{row:n,col:r},i);if(a.ok)return a}return a}c();function zn({open:t,grid:n,onOpenChange:r,onPick:a}){let{t:o,i18n:s}=W();return i(Ne,{open:t,onOpenChange:r,children:e(_e,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[i(be,{children:i(ze,{children:o(`remote.palette.title`)})}),i(Ie,{children:t&&i(Bn,{grid:n,language:s.language,onPick:a})})]})})}function Bn({grid:t,language:r,onPick:a}){let{t:s}=W(),c=Le({}),[l,u]=o(``),[d,f]=o(!1),[h,g]=o(null),_=e=>s(`remote.palette.category.${e}`,e),v=In(n(()=>Nn(c.data===void 0?[]:[c.data]),[c.data]),l,r,_),y=v.some(e=>Ln(t,e));return c.isError?i(me,{title:s(`remote.palette.errorTitle`),message:c.error.message,onRetry:()=>void c.refetch()}):c.data===void 0?e(`div`,{className:`grid gap-2 sm:grid-cols-2`,"data-testid":`palette-loading`,children:[i(F,{className:`h-24`}),i(F,{className:`h-24`}),i(F,{className:`h-24`}),i(F,{className:`h-24`})]}):e(`div`,{className:`space-y-3`,children:[e(`div`,{className:`relative`,children:[i(m,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-foreground-subtle`,"aria-hidden":!0}),i(L,{value:l,className:`pl-8`,placeholder:s(`remote.palette.search`),"aria-label":s(`remote.palette.search`),onChange:e=>u(e.target.value),"data-testid":`palette-search`})]}),y&&e(`label`,{className:`flex items-center gap-2 text-xs text-foreground-muted`,children:[i(p,{checked:d,onChange:e=>f(e.target.checked),"data-testid":`palette-fill-width`}),s(`remote.palette.fillWidth`)]}),h!==null&&i(`p`,{role:`status`,className:`text-xs text-success`,"data-testid":`palette-added`,children:s(`remote.palette.added`,{name:h})}),v.length===0?i(Xe,{icon:P,title:s(`remote.palette.emptyTitle`),description:s(`remote.palette.emptyDescription`)}):i(`ul`,{className:`grid gap-2 sm:grid-cols-2`,"data-testid":`palette-list`,children:v.map(e=>i(`li`,{children:i(Vn,{component:e,language:r,category:_(e.category),onPick:()=>{a(e,{fillWidth:d}),g(Pn(e,r))}})},e.id))})]})}function Vn({component:t,language:r,category:a,onPick:o}){let{t:s}=W(),c=n(()=>Fn(t),[t]),l=Pn(t,r);return e(`button`,{type:`button`,className:`flex h-full w-full items-center gap-3 rounded-lg border border-border bg-surface p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"data-testid":`palette-item-${t.id}`,onClick:o,children:[i(`span`,{className:`w-20 shrink-0`,children:c!==null&&i(ge,{grid:c,label:l,compact:!0})}),e(`span`,{className:`min-w-0`,children:[i(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:l}),e(`span`,{className:`block truncate text-xs text-foreground-muted`,children:[a,` ·`,` `,s(`remote.palette.size`,{cols:t.size.cols,rows:t.size.rows})]})]})]})}function Q(e,t){let n=t.kind===`group`?z(e,t.id):e.buttons.find(e=>e.id===t.id);return n===void 0?void 0:{row:n.row,col:n.col,rowSpan:n.rowSpan,colSpan:n.colSpan}}function Hn(e,t,n,r,i){if(e.width<=0||e.height<=0)return{row:0,col:0};let a=Math.floor((n-e.left)/e.width*t.columns),o=(r-e.top)/e.height;if(i===void 0||i.length!==t.rows||o<0)return{col:a,row:Math.floor(o*t.rows)};let s=i.reduce((e,t)=>e+t,0),c=0;for(let[e,t]of i.entries())if(c+=t/s,o<c)return{col:a,row:e};return{col:a,row:Math.max(t.rows,Math.floor(o*t.rows))}}function Un(e,t,n){return{row:n.row-(t.row-e.row),col:n.col-(t.col-e.col)}}function Wn(e,t,n){return t.kind===`group`?Ve(e,t.id,n.row,n.col):Re(e,t.id,n.row,n.col)}function Gn(e,t,n){let r=Q(e,t);if(r===void 0)return null;let i=Wn(e,t,n);return{rect:{...r,row:n.row,col:n.col},valid:i.status===`ok`,reason:i.status===`ok`?null:i.reason}}function Kn(e){switch(e){case`ArrowUp`:return{dRow:-1,dCol:0};case`ArrowDown`:return{dRow:1,dCol:0};case`ArrowLeft`:return{dRow:0,dCol:-1};case`ArrowRight`:return{dRow:0,dCol:1};default:return null}}function qn(e,t,n,r){let i=Q(e,t);return i===void 0?{status:`refused`,reason:`unknown-button`}:Wn(e,t,{row:i.row+n,col:i.col+r})}c();var Jn=4;function Yn(e,n,i){let[s,c]=o(null),l=t({grid:e,onDrop:i});l.current={grid:e,onDrop:i};let u=t(null),d=t(!1);return a(()=>()=>u.current?.(),[]),{drag:s,onItemPointerDown:r((e,t)=>{let r=n.current;if(r===null||t.button!==0)return;let i=r.getBoundingClientRect();if(Q(l.current.grid,e)===void 0)return;let a={item:e,startX:t.clientX,startY:t.clientY,grabbed:Hn(i,l.current.grid,t.clientX,t.clientY,st(l.current.grid)),active:!1,target:null},o=e=>{if(!a.active){if(Math.hypot(e.clientX-a.startX,e.clientY-a.startY)<Jn)return;a.active=!0}let t=l.current.grid,n=Hn(r.getBoundingClientRect(),t,e.clientX,e.clientY,st(t)),i=Q(t,a.item);i!==void 0&&(a.target=Un(i,a.grabbed,n),c({item:a.item,preview:Gn(t,a.item,a.target)}))},s=e=>{window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,f),window.removeEventListener(`pointercancel`,p),window.removeEventListener(`keydown`,m),u.current=null,c(null),a.active&&(d.current=!0,window.setTimeout(()=>{d.current=!1},0),e&&a.target!==null&&l.current.onDrop(Wn(l.current.grid,a.item,a.target)))},f=()=>s(!0),p=()=>s(!1),m=e=>{e.key===`Escape`&&s(!1)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,f),window.addEventListener(`pointercancel`,p),window.addEventListener(`keydown`,m),u.current=()=>s(!1)},[n]),consumeDragClick:r(()=>{let e=d.current;return d.current=!1,e},[])}}c();var Xn=`__custom__`;function Zn({value:n,onChange:r}){let{t:a}=W(),[s,c]=o(null),[l,u]=o(null),[d,f]=o(!1),p=t(null),m=s?.kind===`button`?s.id:null,h=s?.kind===`group`?s.id:null,g=n.buttons.find(e=>e.id===m)??null,_=h===null?void 0:z(n,h),v=(e,t)=>{if(e.status===`ok`){u(null),r(e.grid),t?.(e.grid);return}u(a(`remote.layout.refusal.${e.reason}`))},y=Yn(n,p,e=>v(e));return e(`div`,{className:`grid gap-4 md:grid-cols-[minmax(0,18rem)_minmax(0,1fr)]`,children:[e(`div`,{className:`space-y-3`,children:[e(`div`,{className:`grid grid-cols-2 gap-2`,children:[i(H,{label:a(`remote.layout.columns`),children:i(R,{value:n.columns,onDelta:e=>v(Ke(n,n.columns+e,n.rows))})}),i(H,{label:a(`remote.layout.rows`),children:i(R,{value:n.rows,onDelta:e=>v(Ke(n,n.columns,n.rows+e))})})]}),i(ge,{grid:n,label:a(`remote.layout.previewLabel`),selectedId:m,selectedGroupId:h,onSelect:e=>{y.consumeDragClick()||c({kind:`button`,id:e})},onSelectGroup:e=>{y.consumeDragClick()||c({kind:`group`,id:e})},showEmptyCells:!0,gridRef:p,drag:y.drag,onItemPointerDown:y.onItemPointerDown,onItemKeyDown:(e,t)=>{let r=Kn(t.key);r!==null&&(t.preventDefault(),v(qn(n,e,r.dRow,r.dCol)))}}),i(`p`,{className:`text-xs text-foreground-subtle`,children:a(`remote.layout.dragHint`)}),e(`div`,{className:`flex flex-wrap gap-2`,children:[e(U,{variant:`outline`,size:`sm`,onClick:()=>f(!0),"data-testid":`remote-add-component`,children:[i(P,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),a(`remote.layout.addComponent`)]}),e(U,{variant:`outline`,size:`sm`,onClick:()=>v(fe(n,`ok`),e=>{let t=e.buttons.at(-1);c(t===void 0?null:{kind:`button`,id:t.id})}),"data-testid":`remote-add-button`,children:[i(b,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),a(`remote.layout.addButton`)]})]}),l!==null&&i(`p`,{role:`alert`,className:`text-xs text-warning`,"data-testid":`remote-layout-refusal`,children:l})]}),i(`div`,{className:`min-w-0`,children:g===null?_===void 0?i(`p`,{className:`text-xs text-foreground-subtle`,children:a(`remote.layout.selectHint`)}):i(er,{grid:n,groupId:_.id,apply:v,onGone:()=>c(null)}):i($n,{grid:n,buttonId:g.id,apply:v,onRemove:()=>{r(De(n,g.id)),c(null),u(null)}})}),i(zn,{open:d,grid:n,onOpenChange:f,onPick:(e,t)=>{let i=Rn(n,e,t);if(!i.ok){u(a(`remote.layout.refusal.${i.reason}`));return}u(null),r(i.layout);let o=i.buttonIds[0];c(i.groupId===null?o===void 0?null:{kind:`button`,id:o}:{kind:`group`,id:i.groupId})}})]})}function Qn(e,t){return[...ft.flatMap(n=>rt(n).map(r=>({value:r,label:ye(r,t),group:e(`remote.roleGroup.${n}`)}))),{value:Xn,label:e(`remote.layout.customRole`),group:e(`remote.roleGroup.custom`)}]}function $n({grid:t,buttonId:n,apply:r,onRemove:a}){let{t:s,i18n:c}=W(),l=t.buttons.find(e=>e.id===n),u=l===void 0?null:k(l.role),[d,f]=o(null);if(l===void 0)return null;let m=Se(l.role)||d!==null,b=d??u??``,x=O(b),C={trigger:s(`remote.layout.pickIcon`),panel:s(`remote.layout.iconPanel`),searchPlaceholder:s(`deviceDisplay.iconSearchPlaceholder`),clear:s(`remote.layout.noIcon`),noMatches:s(`deviceDisplay.iconNoMatches`)},w=e=>s(`deviceDisplay.iconCategory.${e}`,{defaultValue:A(e)});return e(`div`,{className:`space-y-3 rounded-lg border border-border bg-surface p-3`,"data-testid":`remote-inspector`,children:[i(ut,{mode:`single`,singleDisplay:`field`,label:s(`remote.layout.role`),options:Qn((e,t)=>s(e,t??e),c.language),value:m?Xn:l.role,onChange:e=>{if(e===Xn){f(u??``);return}f(null),r(B(t,l.id,{role:e}))}}),m&&i(H,{label:s(`remote.layout.customKey`),...b!==``&&!x?{error:s(`remote.layout.customKeyInvalid`)}:{},children:i(L,{value:b,placeholder:`hdmi_1`,onChange:e=>{let n=e.target.value;f(n),O(n)&&r(B(t,l.id,{role:ee(n)}))}})}),e(`div`,{className:`grid grid-cols-[auto_minmax(0,1fr)] items-end gap-2`,children:[i(H,{label:s(`remote.layout.icon`),children:i(Ee,{value:l.icon??null,onPick:e=>r(B(t,l.id,{icon:e})),fallbackGlyph:P,categoryLabel:w,labels:C})}),i(H,{label:s(`remote.layout.label`),children:i(L,{value:l.label??``,maxLength:40,onChange:e=>r(B(t,l.id,{label:e.target.value}))})})]}),i(H,{label:s(`remote.layout.appIcon`),children:i(y,{value:Qe(l.icon)?.key??``,options:[{value:``,label:s(`remote.layout.noApp`)},...ot.map(e=>({value:e.key,label:e.label}))],onChange:e=>{let n=e.target.value;n===``?Qe(l.icon)!==void 0&&r(B(t,l.id,{icon:null})):r(B(t,l.id,{icon:We(n)}))},"data-testid":`remote-app-icon`})}),e(`div`,{className:`grid grid-cols-2 gap-3`,children:[i(H,{label:s(`remote.layout.shape`),children:i(y,{value:l.shape??``,options:[{value:``,label:s(`remote.layout.lookDefault`)},...M.map(e=>({value:e,label:s(`remote.layout.shapes.${e}`)}))],onChange:e=>{let n=M.find(t=>t===e.target.value);r(it(t,l.id,{shape:n??null}))},"data-testid":`remote-shape`})}),i(H,{label:s(`remote.layout.tone`),children:i(y,{value:l.tone??``,options:[{value:``,label:s(`remote.layout.lookDefault`)},...D.map(e=>({value:e,label:s(`remote.layout.tones.${e}`)}))],onChange:e=>{let n=D.find(t=>t===e.target.value);r(it(t,l.id,{tone:n??null}))},"data-testid":`remote-tone`})})]}),l.tone!==void 0&&[`red`,`green`,`yellow`,`blue`].includes(l.tone)&&e(`label`,{className:`flex items-center gap-2 text-xs text-foreground-muted`,children:[i(p,{checked:l.showLegend===!0,onChange:e=>r(it(t,l.id,{showLegend:e.target.checked})),"data-testid":`remote-show-legend`}),s(`remote.layout.showLegend`)]}),e(`div`,{className:`grid grid-cols-2 gap-3`,children:[i(H,{label:s(`remote.layout.move`),children:e(`div`,{className:`flex items-center gap-1`,children:[i(I,{icon:v,size:`sm`,variant:`secondary`,"aria-label":s(`remote.layout.moveLeft`),onClick:()=>r(V(t,l.id,0,-1))}),i(I,{icon:_,size:`sm`,variant:`secondary`,"aria-label":s(`remote.layout.moveUp`),onClick:()=>r(V(t,l.id,-1,0))}),i(I,{icon:g,size:`sm`,variant:`secondary`,"aria-label":s(`remote.layout.moveDown`),onClick:()=>r(V(t,l.id,1,0))}),i(I,{icon:h,size:`sm`,variant:`secondary`,"aria-label":s(`remote.layout.moveRight`),onClick:()=>r(V(t,l.id,0,1))})]})}),i(H,{label:s(`remote.layout.position`),children:i(`p`,{className:`text-xs text-foreground-muted`,"data-testid":`remote-position`,children:s(`remote.layout.positionValue`,{row:l.row+1,col:l.col+1})})}),i(H,{label:s(`remote.layout.height`),children:i(R,{value:l.rowSpan,onDelta:e=>r(de(t,l.id,l.rowSpan+e,l.colSpan))})}),i(H,{label:s(`remote.layout.width`),children:i(R,{value:l.colSpan,onDelta:e=>r(de(t,l.id,l.rowSpan,l.colSpan+e))})})]}),e(U,{variant:`danger`,size:`sm`,onClick:a,children:[i(S,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),s(`remote.layout.removeButton`)]})]})}function er({grid:t,groupId:n,apply:r,onGone:a}){let{t:o}=W(),s=z(t,n);if(s===void 0)return null;let c=Be(t,n).length;return e(`div`,{className:`space-y-3 rounded-lg border border-border bg-surface p-3`,"data-testid":`remote-group-inspector`,children:[i(`p`,{className:`text-xs text-foreground-muted`,children:o(`remote.layout.groupSummary`,{frame:o(`remote.layout.frames.${s.frame}`,s.frame),count:c,row:s.row+1,col:s.col+1})}),i(H,{label:o(`remote.layout.groupTitle`),children:i(L,{value:s.title??``,maxLength:40,onChange:e=>r(Je(t,s.id,e.target.value)),"data-testid":`remote-group-title`})}),s.frame===`divider`&&e(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[i(H,{label:o(`remote.layout.separatorSize`),children:i(y,{value:s.size??`compact`,options:[{value:`compact`,label:o(`remote.layout.separatorSizeCompact`)},{value:`normal`,label:o(`remote.layout.separatorSizeNormal`)}],onChange:e=>r(Ue(t,s.id,{size:e.target.value===`normal`?`normal`:`compact`})),"data-testid":`remote-separator-size`})}),e(`label`,{className:`flex items-center gap-2 self-end pb-2 text-xs text-foreground-muted`,children:[i(p,{checked:s.hideTitle===!0,onChange:e=>r(Ue(t,s.id,{hideTitle:e.target.checked})),"data-testid":`remote-separator-hide-title`}),o(`remote.layout.separatorHideLabel`)]})]}),e(`div`,{className:`flex flex-wrap gap-2`,children:[e(U,{variant:`outline`,size:`sm`,"data-testid":`remote-group-ungroup`,onClick:()=>{r(ve(t,s.id,!0)),a()},children:[i(ue,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),o(`remote.layout.ungroup`)]}),e(U,{variant:`danger`,size:`sm`,"data-testid":`remote-group-delete`,onClick:()=>{r(ve(t,s.id,!1)),a()},children:[i(S,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),o(`remote.layout.deleteGroup`)]})]})]})}var tr={remote:{label:e=>e(`remote.templates.kind.remote`),emptyPayload:Pe,summary:(e,t)=>{let n=xe(e);return t(`remote.templates.layoutSummary`,{columns:n.columns,rows:n.rows,count:n.buttons.length})},renderEditor:(e,t)=>i(Zn,{value:xe(e),onChange:t}),isSavable:e=>Fe(xe(e))!==null,presets:e=>Ce.map(t=>({id:t.id,label:e(`remote.templates.preset.${t.id}`),payload:()=>Oe(t.id)}))},automation:{label:e=>e(`build.templates.kindAutomation`,`Automation`),emptyPayload:()=>({version:1,body:{when:{kind:`any`,children:[]},actions:[]},inputs:[],bindings:[]}),summary:(e,t)=>{let n=N.safeParse(e);return n.success?t(`build.templates.inputsSummary`,{count:n.data.inputs.length}):``},renderEditor:()=>null,isSavable:e=>N.safeParse(e).success,presets:()=>[]}};function $(e){return tr[e]}var nr=ne.filter(e=>e!==`automation`);function rr(e,t){let n=oe(e,t);return n.ok?n.payload:null}c();function ir(e={}){let t=u(),n=dt(),r=Me(),[i,a]=o(null);return{save:async i=>{a(null);try{let o=i.id===null?await n.mutateAsync({kind:i.kind,name:i.name,payload:i.payload,...ar(i)}):await r.mutateAsync({id:i.id,name:i.name,payload:i.payload,...ar(i)});return o.status===`refused`?(a(o.detail),!1):(await t.invalidateQueries({queryKey:[[`template`]]}),i.id===null&&e.onCreated?.(o.template.id),!0)}catch(e){return a(e instanceof Error?e.message:String(e)),!1}},saving:n.isPending||r.isPending,error:i,clearError:()=>a(null)}}function ar(e){return e.tags===void 0?{}:{tags:[...e.tags]}}function or(e){return{past:[],present:e,future:[]}}var sr=e=>e.past.length>0,cr=e=>e.future.length>0;function lr(e,t){switch(t.type){case`edit`:return Object.is(t.value,e.present)?e:{past:[...e.past,e.present].slice(-100),present:t.value,future:[]};case`undo`:{let t=e.past.at(-1);return t===void 0?e:{past:e.past.slice(0,-1),present:t,future:[e.present,...e.future]}}case`redo`:{let[t,...n]=e.future;return t===void 0?e:{past:[...e.past,e.present],present:t,future:n}}}}c();function ur(e,t){let[n,r]=o(e.name);a(()=>r(e.name),[e.name]);let[i,s]=d(lr,{kind:e.kind,presetId:``,payload:e.payload},or),{kind:c,presetId:l,payload:u}=i.present,f=e=>s({type:`edit`,value:{...i.present,payload:e}}),p=()=>s({type:`undo`}),m=()=>s({type:`redo`});ke(`mod+z`,p,{allowInInput:!1,label:`Undo`}),ke(`mod+shift+z`,m,{allowInInput:!1,label:`Redo`});let h=$(c),g=rr(c,u),_=n.trim()!==``&&g!==null&&h.isSavable(u)&&!t;return{name:n,setName:r,kind:c,presetId:l,payload:u,setPayload:f,undo:p,redo:m,canUndo:sr(i),canRedo:cr(i),canSave:_,dispatch:s,toDraft:()=>g===null?null:{id:e.id,kind:c,name:n.trim(),payload:g,...e.tags===void 0?{}:{tags:e.tags}}}}function dr({editor:t}){let{t:n}=W();return e(f,{children:[i(I,{icon:x,size:`sm`,variant:`ghost`,"aria-label":n(`remote.history.undo`),title:n(`remote.history.undo`),disabled:!t.canUndo,onClick:t.undo,"data-testid":`template-undo`}),i(I,{icon:le,size:`sm`,variant:`ghost`,"aria-label":n(`remote.history.redo`),title:n(`remote.history.redo`),disabled:!t.canRedo,onClick:t.redo,"data-testid":`template-redo`})]})}function fr({editor:t,draftId:n,error:r}){let{t:a}=W(),{kind:o,presetId:s,payload:c,name:l,dispatch:u}=t,d=$(o),p=d.presets(a);return e(f,{children:[e(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[i(H,{label:a(`remote.templates.name`),children:i(L,{value:l,maxLength:120,onChange:e=>t.setName(e.target.value),"data-testid":`template-name`})}),n===null&&nr.length>1&&i(H,{label:a(`remote.templates.kind.label`),children:i(y,{value:o,options:nr.map(e=>({value:e,label:$(e).label(a)})),onChange:e=>{let t=nr.find(t=>t===e.target.value);t!==void 0&&u({type:`edit`,value:{kind:t,presetId:``,payload:$(t).emptyPayload()}})}})}),n===null&&p.length>0&&i(H,{label:a(`remote.templates.startFrom`),children:i(y,{value:s,options:[{value:``,label:a(`remote.templates.startBlank`)},...p.map(e=>({value:e.id,label:e.label}))],onChange:e=>{let n=p.find(t=>t.id===e.target.value);u({type:`edit`,value:{kind:o,presetId:n?.id??``,payload:n===void 0?d.emptyPayload():n.payload()}}),n!==void 0&&l.trim()===``&&t.setName(n.label)},"data-testid":`template-preset`})})]}),d.renderEditor(c,t.setPayload),r!==null&&i(`p`,{role:`alert`,className:`text-xs text-danger`,children:r})]})}function pr({draft:t,saving:n,error:r,onSave:a,onClose:o,back:s}){let{t:c}=W(),l=ur(t,n);return e(f,{children:[e(be,{className:`flex-row items-center justify-between gap-2`,children:[e(`div`,{className:`flex min-w-0 items-center gap-2`,children:[s!==void 0&&e(U,{size:`sm`,variant:`ghost`,onClick:s.onBack,"data-testid":`template-back`,children:[i(v,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),i(`span`,{className:`truncate`,children:s.label})]}),i(ze,{className:`truncate`,children:s===void 0?t.id===null?c(`remote.templates.newTitle`):c(`remote.templates.editTitle`):s.title})]}),i(`div`,{className:`flex shrink-0 items-center gap-1`,children:i(dr,{editor:l})})]}),i(Ie,{className:`space-y-4`,children:i(fr,{editor:l,draftId:t.id,error:r})}),e(nt,{children:[i(U,{variant:`ghost`,onClick:o,children:c(`common.cancel`)}),i(U,{disabled:!l.canSave,onClick:()=>{let e=l.toDraft();e!==null&&a(e)},"data-testid":`template-save`,children:c(`common.save`)})]})]})}export{Gt as _,ir as a,jn as c,Dn as d,wn as f,un as g,X as h,ur as i,kn as l,_n as m,fr as n,$ as o,gn as p,dr as r,Mn as s,pr as t,An as u,Wt as v,Jt as y};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-Cyuzqnbw.js";import{C as t,J as n,K as r,S as i,V as a,Y as o,et as s,x as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Tt as l,aa as u,ha as d,ir as f,wn as p,yt as m,zr as h}from"./player-overlays-
|
|
1
|
+
import{t as e}from"./rolldown-runtime-Cyuzqnbw.js";import{C as t,J as n,K as r,S as i,V as a,Y as o,et as s,x as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Tt as l,aa as u,ha as d,ir as f,wn as p,yt as m,zr as h}from"./player-overlays-hLBmOC8C.js";import{t as g}from"./chevron-down-CBb-F8DT.js";import{t as _}from"./terminal-DZ5OZpgC.js";import{Aa as v,Br as y,Ca as b,Cp as x,Da as S,Dp as C,Gf as w,Ir as T,Jf as E,Kf as D,Mi as O,Tp as k,Wf as A,Xf as j,Yf as M,Yp as N,Zf as P,Zp as F,ai as I,al as L,at as R,ci as z,ct as ee,ds as B,ji as V,ka as H,la as U,qf as W,si as G,vp as K,wp as q,zr as J}from"./src-DBaqc0p7.js";import{t as Y}from"./useTranslation-BJr-n0es.js";import{Z as te,wi as X,yi as ne}from"./index-L2D_wmX_.js";import{t as re}from"./InstancesTable-HNpVzE7s.js";import{n as Z}from"./format-CzUOyOqz.js";import{t as ie}from"./camera-block-model-BmK3dL9c.js";import{t as ae}from"./AdminPage-Bl53zoyw.js";import{r as oe}from"./AccessSection-DsqpMtPJ.js";import{t as se}from"./useInvalidateAddonSettings-CyofQfBo.js";function ce({tabs:e,defaultTab:n,paramName:r=`tab`}){let[a,o]=X(),s=a.get(r),c=n??e[0]?.id??``,l=e.some(e=>e.id===s)?s:c,u=e.find(e=>e.id===l)??e[0];return t(`div`,{className:`space-y-3`,children:[i(I,{value:l,onValueChange:e=>{let t=new URLSearchParams(a);if(e!==l)for(let e of u?.ownedParams??[])t.delete(e);t.set(r,e),o(t,{replace:!0})},children:i(G,{className:`border-border`,children:e.map(e=>{let n=e.icon;return t(z,{value:e.id,className:`h-auto py-2 border-b-2`,children:[n!==void 0&&i(n,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),e.label]},e.id)})})}),i(R,{tabKey:l,children:u?.content})]})}var le=e(((e,t)=>{(function(n,r){if(typeof e==`object`&&typeof t==`object`)t.exports=r();else if(typeof define==`function`&&define.amd)define([],r);else{var i=r();for(var a in i)(typeof e==`object`?e:n)[a]=i[a]}})(globalThis,(()=>(()=>{var e={4567:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;let a=n(9042),o=n(9924),s=n(844),c=n(4725),l=n(2585),u=n(3656),d=t.AccessibilityManager=class extends s.Disposable{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``,this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new o.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this.register(this._terminal.onResize((e=>this._handleResize(e.rows)))),this.register(this._terminal.onRender((e=>this._refreshRows(e.start,e.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((e=>this._handleChar(e)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
2
2
|
`)))),this.register(this._terminal.onA11yTab((e=>this._handleTab(e)))),this.register(this._terminal.onKey((e=>this._handleKey(e.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,u.addDisposableDomListener)(document,`selectionchange`,(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,s.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
3
3
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=a.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.innerText=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error(`anchorNode and/or focusNode are null`);let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=d=r([i(1,l.IInstantiationService),i(2,c.ICoreBrowserService),i(3,c.IRenderService)],d)},3614:(e,t)=>{function n(e){return e.replace(/\r?\n/g,`\r`)}function r(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function i(e,t,i,a){e=r(e=n(e),i.decPrivateModes.bracketedPasteMode&&!0!==a.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=``}function a(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=n,t.bracketTextForPaste=r,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,n,r){e.stopPropagation(),e.clipboardData&&i(e.clipboardData.getData(`text/plain`),t,n,r)},t.paste=i,t.moveTextAreaUnderMouseCursor=a,t.rightClickHandler=function(e,t,n,r,i){a(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}},7239:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;let r=n(1505);t.ColorContrastCache=class{constructor(){this._color=new r.TwoKeyMap,this._css=new r.TwoKeyMap}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},3656:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},3551:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;let a=n(3656),o=n(8460),s=n(844),c=n(2585),l=n(4725),u=t.Linkifier=class extends s.Disposable{get currentLink(){return this._currentLink}constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new o.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new o.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,s.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,s.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,a.addDisposableDomListener)(this._element,`mouseleave`,(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,`mousemove`,this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mousedown`,this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mouseup`,this._handleMouseUp.bind(this)))}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}this._lastBufferCell&&t.x===this._lastBufferCell.x&&t.y===this._lastBufferCell.y||(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){this._activeProviderReplies&&t||(this._activeProviderReplies?.forEach((e=>{e?.forEach((e=>{e.link.dispose&&e.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,(t=>{if(this._isMouseOut)return;let i=t?.map((e=>({link:e})));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)}))}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)this._activeProviderReplies.has(t)&&!this._activeProviderReplies.get(t)||(i=!0);if(!i&&r){let e=r.find((e=>this._linkAtPosition(e.link,t)));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find((e=>this._linkAtPosition(e.link,t)));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,s.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}}))))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};t.Linkifier=u=r([i(1,l.IMouseService),i(2,l.IRenderService),i(3,c.IBufferService),i(4,l.ILinkProviderService)],u)},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel=`Terminal input`,t.tooMuchOutput=`Too much output to announce, navigate to rows manually to read`},3730:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;let a=n(511),o=n(2585),s=t.OscLinkProvider=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n)return void t(void 0);let r=[],i=this._optionsService.rawOptions.linkHandler,o=new a.CellData,s=n.getTrimmedLength(),l=-1,u=-1,d=!1;for(let t=0;t<s;t++)if(u!==-1||n.hasContent(t)){if(n.loadCell(t,o),o.hasExtendedAttrs()&&o.extended.urlId){if(u===-1){u=t,l=o.extended.urlId;continue}d=o.extended.urlId!==l}else u!==-1&&(d=!0);if(d||u!==-1&&t===s-1){let n=this._oscLinkService.getLinkData(l)?.uri;if(n){let a={start:{x:u+1,y:e},end:{x:t+(d||t!==s-1?0:1),y:e}},o=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(o=!0)}catch{o=!0}o||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):c(0,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(u=t,l=o.extended.urlId):(u=-1,l=-1)}}t(r)}};function c(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}t.OscLinkProvider=s=r([i(0,o.IBufferService),i(1,o.IOptionsService),i(2,o.IOscLinkService)],s)},6193:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},3236:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;let r=n(3614),i=n(3656),a=n(3551),o=n(9042),s=n(3730),c=n(1680),l=n(3107),u=n(5744),d=n(2950),f=n(1296),p=n(428),m=n(4269),h=n(5114),g=n(8934),_=n(3230),v=n(9312),y=n(4725),b=n(6731),x=n(8055),S=n(8969),C=n(8460),w=n(844),T=n(6114),E=n(8437),D=n(2584),O=n(7399),k=n(5941),A=n(9074),j=n(2585),M=n(5435),N=n(4567),P=n(779);class F extends S.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(e={}){super(e),this.browser=T,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new w.MutableDisposable),this._onCursorMove=this.register(new C.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new C.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new C.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new C.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new C.EventEmitter),this._onBlur=this.register(new C.EventEmitter),this._onA11yCharEmitter=this.register(new C.EventEmitter),this._onA11yTabEmitter=this.register(new C.EventEmitter),this._onWillOpen=this.register(new C.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(A.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(P.LinkProviderService),this._instantiationService.setService(y.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(s.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((e,t)=>this.refresh(e,t)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((e=>this._reportWindowsOptions(e)))),this.register(this._inputHandler.onColor((e=>this._handleColorEvent(e)))),this.register((0,C.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,C.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((e=>this._afterResize(e.cols,e.rows)))),this.register((0,w.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=x.color.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${D.C0.ESC}]${n};${(0,k.toRgbString)(r)}${D.C1_ESCAPED.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors((e=>e.ansi[t.index]=x.channels.toColor(...t.color)));else{let n=e;this._themeService.modifyColors((e=>e[n]=x.channels.toColor(...t.color)))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this.register((0,i.addDisposableDomListener)(this.element,`copy`,(e=>{this.hasSelection()&&(0,r.copyHandler)(e,this._selectionService)})));let e=e=>(0,r.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,i.addDisposableDomListener)(this.textarea,`paste`,e)),this.register((0,i.addDisposableDomListener)(this.element,`paste`,e)),T.isFirefox?this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>{e.button===2&&(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,i.addDisposableDomListener)(this.element,`contextmenu`,(e=>{(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),T.isLinux&&this.register((0,i.addDisposableDomListener)(this.element,`auxclick`,(e=>{e.button===1&&(0,r.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,i.addDisposableDomListener)(this.textarea,`keyup`,(e=>this._keyUp(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keydown`,(e=>this._keyDown(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keypress`,(e=>this._keyPress(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionstart`,(()=>this._compositionHelper.compositionstart()))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionupdate`,(e=>this._compositionHelper.compositionupdate(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionend`,(()=>this._compositionHelper.compositionend()))),this.register((0,i.addDisposableDomListener)(this.textarea,`input`,(e=>this._inputEvent(e)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement(`div`),this._viewportScrollArea.classList.add(`xterm-scroll-area`),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this.register((0,i.addDisposableDomListener)(this.screenElement,`mousemove`,(e=>this.updateCursorStyle(e)))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement),this.textarea=this._document.createElement(`textarea`),this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,o.promptLabel),T.isChromeOS||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(h.CoreBrowserService,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(y.ICoreBrowserService,this._coreBrowserService),this.register((0,i.addDisposableDomListener)(this.textarea,`focus`,(e=>this._handleTextAreaFocus(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`blur`,(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(y.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(b.ThemeService),this._instantiationService.setService(y.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(m.CharacterJoinerService),this._instantiationService.setService(y.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(_.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(y.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((e=>this._onRender.fire(e)))),this.onResize((e=>this._renderService.resize(e.cols,e.rows))),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.MouseService),this._instantiationService.setService(y.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(a.Linkifier,this.screenElement)),this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(c.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(v.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(y.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,i.addDisposableDomListener)(this._viewportElement,`scroll`,(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(l.BufferDecorationRenderer,this.screenElement)),this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>this._selectionService.handleMouseDown(e)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,(e=>this._handleScreenReaderModeOptionChange(e)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRulerWidth`,(e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(f.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(t)||e.viewport.getLinesScrolled(t)===0)return!1;i=t.deltaY<0?0:1,r=4;break;default:return!1}return!(i===void 0||r===void 0||r>4)&&e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this.register(this.coreMouseService.onProtocolChange((e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),8&e?r.mousemove||=(t.addEventListener(`mousemove`,a.mousemove),a.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),16&e?r.wheel||=(t.addEventListener(`wheel`,a.wheel,{passive:!1}),a.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),2&e?r.mouseup||=a.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),4&e?r.mousedrag||=a.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,i.addDisposableDomListener)(t,`mousedown`,(e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)}))),this.register((0,i.addDisposableDomListener)(t,`wheel`,(e=>{if(!r.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(e))return!1;if(!this.buffer.hasScrollback){let t=this.viewport.getLinesScrolled(e);if(t===0)return;let n=D.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(e.deltaY<0?`A`:`B`),r=``;for(let e=0;e<Math.abs(t);e++)r+=n;return this.coreService.triggerDataEvent(r,!0),this.cancel(e,!0)}return this.viewport.handleWheel(e)?this.cancel(e):void 0}}),{passive:!1})),this.register((0,i.addDisposableDomListener)(t,`touchstart`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)}),{passive:!0})),this.register((0,i.addDisposableDomListener)(t,`touchmove`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)}),{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t,n=0){n===1?(super.scrollLines(e,t,n),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(e)}paste(e){(0,r.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;t||e.key!==`Dead`&&e.key!==`AltGraph`||(this._unprocessedDeadKey=!0);let n=(0,O.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}return n.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key||!!(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(n.key!==D.C0.ETX&&n.key!==D.C0.CR||(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else{if(e.which===0||e.charCode===0)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(E.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(D.C0.ESC+`[I`):this.coreService.triggerDataEvent(D.C0.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[4;${t};${e}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${D.C0.ESC}[6;${r};${n}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}}t.Terminal=F},9924:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=Date.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}}},1680:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;let a=n(3656),o=n(4725),s=n(8460),c=n(844),l=n(2585),u=t.Viewport=class extends c.Disposable{constructor(e,t,n,r,i,o,c,l){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=n,this._optionsService=r,this._charSizeService=i,this._renderService=o,this._coreBrowserService=c,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new s.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,a.addDisposableDomListener)(this._viewportElement,`scroll`,this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((e=>this._renderDimensions=e))),this._handleThemeChange(l.colors),this.register(l.onChangeColors((e=>this._handleThemeChange(e)))),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(e){if(e)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+`px`)}let e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,t){let n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&n<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)}handleWheel(e){let t=this._getPixelsScrolled(e);return t!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}scrollLines(e){if(e!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let t=e*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!1})}_getPixelsScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(e,t){let n,r=``,i=[],a=t??this._bufferService.buffer.lines.length,o=this._bufferService.buffer.lines;for(let t=e;t<a;t++){let e=o.get(t);if(!e)continue;let a=o.get(t+1)?.isWrapped;if(r+=e.translateToString(!a),!a||t===o.length-1){let e=document.createElement(`div`);e.textContent=r,i.push(e),r.length>0&&(n=e),r=``}}return{bufferElements:i,cursorElement:n}}getLinesScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){let n=this._optionsService.rawOptions.fastScrollModifier;return n===`alt`&&t.altKey||n===`ctrl`&&t.ctrlKey||n===`shift`&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){let t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=u=r([i(2,l.IBufferService),i(3,l.IOptionsService),i(4,o.ICharSizeService),i(5,o.IRenderService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],u)},3107:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;let a=n(4725),o=n(844),s=n(2585),c=t.BufferDecorationRenderer=class extends o.Disposable{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((e=>this._removeDecoration(e)))),this.register((0,o.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+`px`,t.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+`px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose((()=>{this._decorationElements.delete(e),n.remove()}))),n.style.top=t*this._renderService.dimensions.css.cell.height+`px`,n.style.display=this._altBufferIsActive?`none`:`block`,e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?n*this._renderService.dimensions.css.cell.width+`px`:``:t.style.left=n?n*this._renderService.dimensions.css.cell.width+`px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=c=r([i(1,s.IBufferService),i(2,a.ICoreBrowserService),i(3,s.IDecorationService),i(4,a.IRenderService)],c)},5871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},5744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;let a=n(5871),o=n(4725),s=n(844),c=n(2585),l={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},f=t.OverviewRulerRenderer=class extends s.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,n,r,i,o,c){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=o,this._coreBrowserService=c,this._colorZoneStore=new a.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let l=this._canvas.getContext(`2d`);if(!l)throw Error(`Ctx cannot be null`);this._ctx=l,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,s.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange(`overviewRulerWidth`,(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);u.full=this._canvas.width,u.left=e,u.center=t,u.right=e,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=u.left,d.right=u.left+u.center}_refreshDrawHeightConstants(){l.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);l.left=t,l.center=t,l.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1;let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(d[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-l[e.position||`full`]/2),u[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+l[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};t.OverviewRulerRenderer=f=r([i(2,c.IBufferService),i(3,c.IDecorationService),i(4,o.IRenderService),i(5,c.IOptionsService),i(6,o.ICoreBrowserService)],f)},2950:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;let a=n(4725),o=n(2585),s=n(2584),c=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}}),0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${s.C0.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}}),0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};t.CompositionHelper=c=r([i(2,o.IBufferService),i(3,o.IOptionsService),i(4,o.ICoreService),i(5,a.IRenderService)],c)},9806:(e,t)=>{function n(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=n,t.getCoords=function(e,t,r,i,a,o,s,c,l){if(!o)return;let u=n(e,t,r);return u?(u[0]=Math.ceil((u[0]+(l?s/2:0))/s),u[1]=Math.ceil(u[1]/c),u[0]=Math.min(Math.max(u[0],1),i+ +!!l),u[1]=Math.min(Math.max(u[1],1),a),u):void 0}},9504:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;let r=n(2584);function i(e,t,n,r){let i=e-a(e,n),s=t-a(t,n);return l(Math.abs(i-s)-function(e,t,n){let r=0,i=e-a(e,n),s=t-a(t,n);for(let a=0;a<Math.abs(i-s);a++){let s=o(e,t)===`A`?-1:1;n.buffer.lines.get(i+s*a)?.isWrapped&&r++}return r}(e,t,n),c(o(e,t),r))}function a(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function o(e,t){return e>t?`A`:`B`}function s(e,t,n,r,i,a){let o=e,s=t,c=``;for(;o!==n||s!==r;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function c(e,t){let n=t?`O`:`[`;return r.C0.ESC+n+e}function l(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}t.moveToCellSequence=function(e,t,n,r){let o=n.buffer.x,u=n.buffer.y;if(!n.buffer.hasScrollback)return function(e,t,n,r,o,u){return i(t,r,o,u).length===0?``:l(s(e,t,e,t-a(t,o),!1,o).length,c(`D`,u))}(o,u,0,t,n,r)+i(u,t,n,r)+function(e,t,n,r,o,u){let d;d=i(t,r,o,u).length>0?r-a(r,o):t;let f=r,p=function(e,t,n,r,o,s){let c;return c=i(n,r,o,s).length>0?r-a(r,o):t,e<n&&c<=r||e>=n&&c<r?`C`:`D`}(e,t,n,r,o,u);return l(s(e,d,n,f,p===`C`,o).length,c(p,u))}(o,u,e,t,n,r);let d;if(u===t)return d=o>e?`D`:`C`,l(Math.abs(o-e),c(d,r));d=u>t?`D`:`C`;let f=Math.abs(u-t);return l(function(e,t){return t.cols-e}(u>t?e:o,n)+(f-1)*n.cols+1+((u>t?o:e)-1),c(d,r))}},1296:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;let a=n(3787),o=n(2550),s=n(2223),c=n(6171),l=n(6052),u=n(4725),d=n(8055),f=n(8460),p=n(844),m=n(2585),h=`xterm-dom-renderer-owner-`,g=`xterm-rows`,_=`xterm-fg-`,v=`xterm-bg-`,y=`xterm-focus`,b=`xterm-selection`,x=1,S=t.DomRenderer=class extends p.Disposable{constructor(e,t,n,r,i,s,u,d,m,_,v,y,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=u,this._charSizeService=m,this._optionsService=_,this._bufferService=v,this._coreBrowserService=y,this._themeService=S,this._terminalClass=x++,this._rowElements=[],this._selectionRenderModel=(0,l.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new f.EventEmitter).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(g),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(b),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=(0,c.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((e=>this._injectCss(e)))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(h+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((e=>this._handleLinkHover(e)))),this.register(this._linkifier2.onHideLinkUnderline((e=>this._handleLinkLeave(e)))),this.register((0,p.toDisposable)((()=>{this._element.classList.remove(h+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new o.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${g} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${g} { color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${g} .xterm-dim { color: ${d.color.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${b} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${b} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${b} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${_}${n} { color: ${r.css}; }${this._terminalSelector} .${_}${n}.xterm-dim { color: ${d.color.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${v}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e.background).css}; }${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${v}${s.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(y),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(y),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;this._selectionRenderModel.update(this._terminal,e,t,n);let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow;if(a>=this._bufferService.rows||o<0)return;let s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=r*this.dimensions.css.cell.height+`px`,i.style.top=e*this.dimensions.css.cell.height+`px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._optionsService.rawOptions.cursorBlink,o=this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${h}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};t.DomRenderer=S=r([i(7,m.IInstantiationService),i(8,u.ICharSizeService),i(9,m.IOptionsService),i(10,m.IBufferService),i(11,u.ICoreBrowserService),i(12,u.IThemeService)],S)},3787:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;let a=n(2223),o=n(643),s=n(511),c=n(2585),l=n(8055),u=n(4725),d=n(4269),f=n(6171),p=n(3734),m=t.DomRendererRowFactory=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new s.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,c,u,f,m,g){let _=[],v=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,b,x=e.getNoBgTrimmedLength();n&&x<s+1&&(x=s+1);let S=0,C=``,w=0,T=0,E=0,D=!1,O=0,k=!1,A=0,j=[],M=m!==-1&&g!==-1;for(let N=0;N<x;N++){e.loadCell(N,this._workCell);let x=this._workCell.getWidth();if(x===0)continue;let P=!1,F=N,I=this._workCell;if(v.length>0&&N===v[0][0]){P=!0;let t=v.shift();I=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),F=t[1]-1,x=I.getWidth()}let L=this._isCellInSelection(N,t),R=n&&N===s,z=M&&N>=m&&N<=g,ee=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,(e=>{ee=!0}));let B=I.getChars()||o.WHITESPACE_CELL_CHAR;if(B===` `&&(I.isUnderline()||I.isOverline())&&(B=`\xA0`),A=x*u-f.get(B,I.isBold(),I.isItalic()),b){if(S&&(L&&k||!L&&!k&&I.bg===w)&&(L&&k&&y.selectionForeground||I.fg===T)&&I.extended.ext===E&&z===D&&A===O&&!R&&!P&&!ee){I.isInvisible()?C+=o.WHITESPACE_CELL_CHAR:C+=B,S++;continue}S&&(b.textContent=C),b=this._document.createElement(`span`),S=0,C=``}else b=this._document.createElement(`span`);if(w=I.bg,T=I.fg,E=I.extended.ext,D=z,O=A,k=L,P&&s>=N&&s<=F&&(s=N),!this._coreService.isCursorHidden&&R&&this._coreService.isCursorInitialized){if(j.push(`xterm-cursor`),this._coreBrowserService.isFocused)c&&j.push(`xterm-cursor-blink`),j.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:j.push(`xterm-cursor-outline`);break;case`block`:j.push(`xterm-cursor-block`);break;case`bar`:j.push(`xterm-cursor-bar`);break;case`underline`:j.push(`xterm-cursor-underline`)}}if(I.isBold()&&j.push(`xterm-bold`),I.isItalic()&&j.push(`xterm-italic`),I.isDim()&&j.push(`xterm-dim`),C=I.isInvisible()?o.WHITESPACE_CELL_CHAR:I.getChars()||o.WHITESPACE_CELL_CHAR,I.isUnderline()&&(j.push(`xterm-underline-${I.extended.underlineStyle}`),C===` `&&(C=`\xA0`),!I.isUnderlineColorDefault()))if(I.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(I.getUnderlineColor()).join(`,`)})`;else{let e=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&e<8&&(e+=8),b.style.textDecorationColor=y.ansi[e].css}I.isOverline()&&(j.push(`xterm-overline`),C===` `&&(C=`\xA0`)),I.isStrikethrough()&&j.push(`xterm-strikethrough`),z&&(b.style.textDecoration=`underline`);let V=I.getFgColor(),H=I.getFgColorMode(),U=I.getBgColor(),W=I.getBgColorMode(),G=!!I.isInverse();if(G){let e=V;V=U,U=e;let t=H;H=W,W=t}let K,q,J,Y=!1;switch(this._decorationService.forEachDecorationAtCell(N,t,void 0,(e=>{e.options.layer!==`top`&&Y||(e.backgroundColorRGB&&(W=50331648,U=e.backgroundColorRGB.rgba>>8&16777215,K=e.backgroundColorRGB),e.foregroundColorRGB&&(H=50331648,V=e.foregroundColorRGB.rgba>>8&16777215,q=e.foregroundColorRGB),Y=e.options.layer===`top`)})),!Y&&L&&(K=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,U=K.rgba>>8&16777215,W=50331648,Y=!0,y.selectionForeground&&(H=50331648,V=y.selectionForeground.rgba>>8&16777215,q=y.selectionForeground)),Y&&j.push(`xterm-decoration-top`),W){case 16777216:case 33554432:J=y.ansi[U],j.push(`xterm-bg-${U}`);break;case 50331648:J=l.channels.toColor(U>>16,U>>8&255,255&U),this._addStyle(b,`background-color:#${h((U>>>0).toString(16),`0`,6)}`);break;default:G?(J=y.foreground,j.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):J=y.background}switch(K||I.isDim()&&(K=l.color.multiplyOpacity(J,.5)),H){case 16777216:case 33554432:I.isBold()&&V<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(V+=8),this._applyMinimumContrast(b,J,y.ansi[V],I,K,void 0)||j.push(`xterm-fg-${V}`);break;case 50331648:let e=l.channels.toColor(V>>16&255,V>>8&255,255&V);this._applyMinimumContrast(b,J,e,I,K,q)||this._addStyle(b,`color:#${h(V.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(b,J,y.foreground,I,K,q)||G&&j.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}j.length&&=(b.className=j.join(` `),0),R||P||ee?b.textContent=C:S++,A!==this.defaultSpacing&&(b.style.letterSpacing=`${A}px`),_.push(b),N=F}return b&&S&&(b.textContent=C),_}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,f.treatGlyphAsBackgroundColor)(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(i||a||(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=l.color.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return!!s&&(this._addStyle(e,`color:${s.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!(!n||!r)&&(this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0])}};function h(e,t,n){for(;e.length<n;)e=t+e;return e}t.DomRendererRowFactory=m=r([i(1,u.ICharacterJoinerService),i(2,c.IOptionsService),i(3,u.ICoreBrowserService),i(4,c.ICoreService),i(5,c.IDecorationService),i(6,u.IThemeService)],m)},2550:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}}},2223:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},6171:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},6052:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},456:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;let a=n(2585),o=n(8460),s=n(844),c=t.CharSizeService=class extends s.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this.register(new o.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new u(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=c=r([i(2,a.IOptionsService)],c);class l extends s.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}}class u extends l{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class d extends l{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}}},4269:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;let a=n(3734),o=n(643),s=n(511),c=n(2585);class l extends a.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=l;let u=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new s.CellData}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,s=0,c=t.getFg(0),l=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==c||this._workCell.bg!==l){if(e-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,s=a,c=this._workCell.fg,l=this._workCell.bg}a+=this._workCell.getChars().length||o.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(t,n,r,i,a){let o=t.substring(n,r),s=[];try{s=this._characterJoiners[0].handler(o)}catch(e){console.error(e)}for(let t=1;t<this._characterJoiners.length;t++)try{let n=this._characterJoiners[t].handler(o);for(let t=0;t<n.length;t++)e._mergeRanges(s,n[t])}catch(e){console.error(e)}return this._stringRangesToCellRanges(s,i,a),s}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,s=e[r];if(s){for(let c=n;c<this._bufferService.cols;c++){let n=t.getWidth(c),l=t.getString(c).length||o.WHITESPACE_CELL_CHAR.length;if(n!==0){if(!i&&s[0]<=a&&(s[0]=c,i=!0),s[1]<=a){if(s[1]=c,s=e[++r],!s)break;s[0]<=a?(s[0]=c,i=!0):i=!1}a+=l}}s&&(s[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0)}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};t.CharacterJoinerService=u=r([i(0,c.IBufferService)],u)},5114:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;let r=n(844),i=n(8460),a=n(3656);class o extends r.Disposable{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new s(this._window),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new i.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,i.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener(`focus`,(()=>this._isFocused=!0)),this._textarea.addEventListener(`blur`,(()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}t.CoreBrowserService=o;class s extends r.Disposable{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this.register(new r.MutableDisposable),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,r.toDisposable)((()=>this.clearListener())))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,a.addDisposableDomListener)(this._parentWindow,`resize`,(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;let r=n(844);class i extends r.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,r.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}}t.LinkProviderService=i},8934:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;let a=n(4725),o=n(9806),s=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return(0,o.getCoords)(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=(0,o.getCoordsRelativeToElement)(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};t.MouseService=s=r([i(0,a.IRenderService),i(1,a.ICharSizeService)],s)},3230:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;let a=n(6193),o=n(4725),s=n(8460),c=n(844),l=n(7226),u=n(2585),d=t.RenderService=class extends c.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,n,r,i,o,u,d){super(),this._rowCount=e,this._charSizeService=r,this._renderer=this.register(new c.MutableDisposable),this._pausedResizeTask=new l.DebouncedIdleTask,this._observerDisposable=this.register(new c.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new s.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new s.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new s.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new s.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new a.RenderDebouncer(((e,t)=>this._renderRows(e,t)),u),this.register(this._renderDebouncer),this.register(u.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(o.onResize((()=>this._fullRefresh()))),this.register(o.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(n.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(i.onDecorationRegistered((()=>this._fullRefresh()))),this.register(i.onDecorationRemoved((()=>this._fullRefresh()))),this.register(n.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],(()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()}))),this.register(n.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],(()=>this.refreshRows(o.buffer.y,o.buffer.y,!0)))),this.register(d.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(u.window,t),this.register(u.onWindowChange((e=>this._registerIntersectionObserver(e,t))))}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver((e=>this._handleIntersectionChange(e[e.length-1])),{threshold:0});n.observe(t),this._observerDisposable.value=(0,c.toDisposable)((()=>n.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){this._isPaused?this._needsFullRefresh=!0:(n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((e=>this.refreshRows(e.start,e.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,t))):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};t.RenderService=d=r([i(2,u.IOptionsService),i(3,o.ICharSizeService),i(4,u.IDecorationService),i(5,u.IBufferService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],d)},9312:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;let a=n(9806),o=n(9504),s=n(456),c=n(4725),l=n(8460),u=n(844),d=n(6114),f=n(4841),p=n(511),m=n(2585),h=RegExp(`\xA0`,`g`),g=t.SelectionService=class extends u.Disposable{constructor(e,t,n,r,i,a,o,c,d){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=c,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new l.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new l.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new l.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((e=>this._handleTrim(e))),this.register(this._bufferService.buffers.onBufferActivate((e=>this._handleBufferActivate(e)))),this.enable(),this._model=new s.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map((e=>e.replace(h,` `))).join(d.isWindows?`\r
|
|
4
4
|
`:`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,S as t}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Ii as n,Wa as r}from"./player-overlays-
|
|
1
|
+
import{C as e,S as t}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Ii as n,Wa as r}from"./player-overlays-hLBmOC8C.js";import{vp as i}from"./src-DBaqc0p7.js";import{t as a}from"./useTranslation-BJr-n0es.js";import{Si as o}from"./index-L2D_wmX_.js";import{t as s}from"./InstancesTable-HNpVzE7s.js";import{t as c}from"./AdminPage-Bl53zoyw.js";var l=`/addon/training?tab=providers`;function u(){let{t:u}=a(),d=o();return t(c,{icon:n,title:u(`system.trainingProviders.title`,`Training providers`),actions:e(i,{size:`sm`,variant:`secondary`,onClick:()=>d(l),children:[t(r,{className:`h-3.5 w-3.5`}),u(`system.trainingProviders.backToTraining`,`Back to Training`)]}),children:t(s,{functionCap:`training-provider`,icon:n,title:u(`system.trainingProviders.accounts`,`Cloud accounts`),subtitle:u(`system.trainingProviders.accountsSubtitle`,`GPU-cloud accounts that run training jobs. Each account keeps its own token, GPU, cost cap and region; credentials stay in the CamStack keychain.`),emptyTitle:u(`system.trainingProviders.noProviders`,`No training providers installed`),emptyDescription:u(`system.trainingProviders.noProvidersDescription`,`Install a training provider addon (for example @camstack/addon-training) to train on your own GPU-cloud account.`),addLabel:u(`system.trainingProviders.addAccount`,`Add account`)})})}export{u as TrainingProvidersPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,S as t}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Q as n,rt as r}from"./player-overlays-
|
|
1
|
+
import{C as e,S as t}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Q as n,rt as r}from"./player-overlays-hLBmOC8C.js";import{t as i}from"./monitor-off-DnOkDa2s.js";import{t as a}from"./useTranslation-BJr-n0es.js";import"./mount-5TmG1RTl.js";function o(e=r()){return e===``?{kind:`frame`,src:n(`/viewer/camstack/`)}:{kind:`unavailable-under-mount`,mount:e}}var s=`autoplay; fullscreen; microphone; picture-in-picture`;function c(){let{t:n}=a(),r=o();return r.kind===`frame`?t(`div`,{className:`absolute inset-0`,"data-testid":`viewer-embed`,children:t(`iframe`,{title:n(`pages.viewer.frameTitle`,`CamStack viewer`),src:r.src,allow:s,className:`h-full w-full border-0 bg-background`})}):e(`div`,{className:`flex flex-col items-center justify-center px-4 py-16 text-foreground`,"data-testid":`viewer-unavailable-under-mount`,children:[t(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-2xl bg-warning/10`,children:t(i,{className:`h-8 w-8 text-warning`})}),t(`h1`,{className:`text-xl font-bold`,children:n(`pages.viewer.underMountTitle`,`The viewer cannot be shown through this relay`)}),t(`p`,{className:`mt-2 max-w-xl text-center text-sm text-foreground-subtle`,children:n(`pages.viewer.underMountBody`,`This admin UI is served under {{mount}}. The viewer app only runs at the hub’s own address — open it there, in a new tab.`,{mount:r.mount})})]})}export{c as ViewerPage};
|