@spencerboucher/switchyard 0.24.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/bridge/enroll.js +12 -3
- package/dist/catalog/worker.js +5913 -0
- package/dist/policies/worker.js +935 -950
- package/dist/switchyard.mjs +2413 -2484
- package/package.json +1 -1
- package/web-dist/assets/AutomationView-I80YGJ3M.js +2 -0
- package/web-dist/assets/{AutomationView-BiSxKpgA.js.map → AutomationView-I80YGJ3M.js.map} +1 -1
- package/web-dist/assets/{Checkbox-CneW7ZHn.js → Checkbox-BdFQsqCG.js} +2 -2
- package/web-dist/assets/{Checkbox-CneW7ZHn.js.map → Checkbox-BdFQsqCG.js.map} +1 -1
- package/web-dist/assets/{DangerZone-tpxj5S8V.js → DangerZone-C6qU1pp7.js} +2 -2
- package/web-dist/assets/{DangerZone-tpxj5S8V.js.map → DangerZone-C6qU1pp7.js.map} +1 -1
- package/web-dist/assets/{Field-0rAadZ7B.js → Field-DGV7eljt.js} +2 -2
- package/web-dist/assets/{Field-0rAadZ7B.js.map → Field-DGV7eljt.js.map} +1 -1
- package/web-dist/assets/{NavigationEditor-DE3vVnHw.js → NavigationEditor-COtm2NQY.js} +2 -2
- package/web-dist/assets/{NavigationEditor-DE3vVnHw.js.map → NavigationEditor-COtm2NQY.js.map} +1 -1
- package/web-dist/assets/{Overlay-kkZVSidv.js → Overlay-hRkfpjK4.js} +2 -2
- package/web-dist/assets/{Overlay-kkZVSidv.js.map → Overlay-hRkfpjK4.js.map} +1 -1
- package/web-dist/assets/{Priority-VTOBYjs9.js → Priority-DL3f-tRD.js} +2 -2
- package/web-dist/assets/{Priority-VTOBYjs9.js.map → Priority-DL3f-tRD.js.map} +1 -1
- package/web-dist/assets/{RadioCards-Oy23yrpF.js → RadioCards-9YvqB3va.js} +2 -2
- package/web-dist/assets/{RadioCards-Oy23yrpF.js.map → RadioCards-9YvqB3va.js.map} +1 -1
- package/web-dist/assets/{ScopeRepository-BU9I7Gs_.js → ScopeRepository-BPiPUjHi.js} +3 -3
- package/web-dist/assets/{ScopeRepository-BU9I7Gs_.js.map → ScopeRepository-BPiPUjHi.js.map} +1 -1
- package/web-dist/assets/{ScopeSelect-7ZYRzci5.js → ScopeSelect-DmWCXeIf.js} +2 -2
- package/web-dist/assets/{ScopeSelect-7ZYRzci5.js.map → ScopeSelect-DmWCXeIf.js.map} +1 -1
- package/web-dist/assets/{SegmentedControl-CCObjCnv.js → SegmentedControl-CefWecy1.js} +2 -2
- package/web-dist/assets/{SegmentedControl-CCObjCnv.js.map → SegmentedControl-CefWecy1.js.map} +1 -1
- package/web-dist/assets/{Select-CRC4mF4U.js → Select-CdANXO3X.js} +2 -2
- package/web-dist/assets/{Select-CRC4mF4U.js.map → Select-CdANXO3X.js.map} +1 -1
- package/web-dist/assets/StructuredValue-BjKzgQDM.js +5 -0
- package/web-dist/assets/StructuredValue-BjKzgQDM.js.map +1 -0
- package/web-dist/assets/{Switch-llihKH_2.js → Switch-DrrWalaQ.js} +2 -2
- package/web-dist/assets/{Switch-llihKH_2.js.map → Switch-DrrWalaQ.js.map} +1 -1
- package/web-dist/assets/{Tabs-CIolUgNo.js → Tabs-Cvyw8P4s.js} +4 -4
- package/web-dist/assets/{Tabs-CIolUgNo.js.map → Tabs-Cvyw8P4s.js.map} +1 -1
- package/web-dist/assets/TextLink-DMi_ZI43.js +2 -0
- package/web-dist/assets/{TextLink-BJlPjvKn.js.map → TextLink-DMi_ZI43.js.map} +1 -1
- package/web-dist/assets/{UINodeRenderer-DwZNt-8y.js → UINodeRenderer-CDPAUIOO.js} +2 -2
- package/web-dist/assets/{UINodeRenderer-DwZNt-8y.js.map → UINodeRenderer-CDPAUIOO.js.map} +1 -1
- package/web-dist/assets/{UnfilteredNote-B77oGOcW.js → UnfilteredNote-CgsOTad1.js} +2 -2
- package/web-dist/assets/{UnfilteredNote-B77oGOcW.js.map → UnfilteredNote-CgsOTad1.js.map} +1 -1
- package/web-dist/assets/{api-C7CMr6g-.js → api-Dlk6L3Cu.js} +2 -2
- package/web-dist/assets/{api-C7CMr6g-.js.map → api-Dlk6L3Cu.js.map} +1 -1
- package/web-dist/assets/{arrow-down-Bqx9CSB1.js → arrow-down-Cc6k_L7W.js} +2 -2
- package/web-dist/assets/{arrow-down-Bqx9CSB1.js.map → arrow-down-Cc6k_L7W.js.map} +1 -1
- package/web-dist/assets/{arrow-up-D0b2fv0Q.js → arrow-up-CW1a5Bhp.js} +2 -2
- package/web-dist/assets/{arrow-up-D0b2fv0Q.js.map → arrow-up-CW1a5Bhp.js.map} +1 -1
- package/web-dist/assets/attention-AZ2a-mzO.js +2 -0
- package/web-dist/assets/{attention-DMhF0I-p.js.map → attention-AZ2a-mzO.js.map} +1 -1
- package/web-dist/assets/{auth-vd8OFoQx.js → auth-Dzip9fVv.js} +2 -2
- package/web-dist/assets/{auth-vd8OFoQx.js.map → auth-Dzip9fVv.js.map} +1 -1
- package/web-dist/assets/{automations-Dz_JHvUj.js → automations-BYFgPSs2.js} +2 -2
- package/web-dist/assets/{automations-Dz_JHvUj.js.map → automations-BYFgPSs2.js.map} +1 -1
- package/web-dist/assets/board-D2LALQcR.js +6 -0
- package/web-dist/assets/board-D2LALQcR.js.map +1 -0
- package/web-dist/assets/{calendar-clock-C5cMYlld.js → calendar-clock-CkYP2-Qf.js} +2 -2
- package/web-dist/assets/{calendar-clock-C5cMYlld.js.map → calendar-clock-CkYP2-Qf.js.map} +1 -1
- package/web-dist/assets/chevron-right-Q-RTE0ar.js +2 -0
- package/web-dist/assets/{chevron-right-5ip-ZfOW.js.map → chevron-right-Q-RTE0ar.js.map} +1 -1
- package/web-dist/assets/code-BuAtgr-5.js +24 -0
- package/web-dist/assets/code-BuAtgr-5.js.map +1 -0
- package/web-dist/assets/{core.esm-C_QgTrGe.js → core.esm-yL4bmFrt.js} +2 -2
- package/web-dist/assets/{core.esm-C_QgTrGe.js.map → core.esm-yL4bmFrt.js.map} +1 -1
- package/web-dist/assets/{describe-Bd1JbydU.js → describe-B1R7Rpb3.js} +3 -3
- package/web-dist/assets/{describe-Bd1JbydU.js.map → describe-B1R7Rpb3.js.map} +1 -1
- package/web-dist/assets/{enroll-B_ZjVnEj.js → enroll-BJIkw0lm.js} +2 -2
- package/web-dist/assets/{enroll-B_ZjVnEj.js.map → enroll-BJIkw0lm.js.map} +1 -1
- package/web-dist/assets/{external-link-DeLk0jmb.js → external-link-BHZxy4tb.js} +2 -2
- package/web-dist/assets/{external-link-DeLk0jmb.js.map → external-link-BHZxy4tb.js.map} +1 -1
- package/web-dist/assets/{git-branch-DuApoZes.js → git-branch-C5Xwi6aW.js} +2 -2
- package/web-dist/assets/{git-branch-DuApoZes.js.map → git-branch-C5Xwi6aW.js.map} +1 -1
- package/web-dist/assets/{grip-vertical-DfKSP8jp.js → grip-vertical-kzr2x5pf.js} +2 -2
- package/web-dist/assets/{grip-vertical-DfKSP8jp.js.map → grip-vertical-kzr2x5pf.js.map} +1 -1
- package/web-dist/assets/{hand-ryhCgGbh.js → hand-DStB4fR7.js} +2 -2
- package/web-dist/assets/{hand-ryhCgGbh.js.map → hand-DStB4fR7.js.map} +1 -1
- package/web-dist/assets/index-D3WBnjbc.js +17 -0
- package/web-dist/assets/{index-BXoBPAUR.js.map → index-D3WBnjbc.js.map} +1 -1
- package/web-dist/assets/{link-2-pHvZvxCs.js → link-2-Cny9mRKW.js} +2 -2
- package/web-dist/assets/{link-2-pHvZvxCs.js.map → link-2-Cny9mRKW.js.map} +1 -1
- package/web-dist/assets/{logic-3so3T0af.js → logic-BOdOYgZ4.js} +3 -3
- package/web-dist/assets/{logic-3so3T0af.js.map → logic-BOdOYgZ4.js.map} +1 -1
- package/web-dist/assets/{logic-uhnfzaYJ.js → logic-CHh1lc3G.js} +2 -2
- package/web-dist/assets/{logic-uhnfzaYJ.js.map → logic-CHh1lc3G.js.map} +1 -1
- package/web-dist/assets/{more-C41VHBVG.js → more-BrHzsSfh.js} +2 -2
- package/web-dist/assets/{more-C41VHBVG.js.map → more-BrHzsSfh.js.map} +1 -1
- package/web-dist/assets/{pencil-BoQa6LEV.js → pencil-BmHgPcCk.js} +2 -2
- package/web-dist/assets/{pencil-BoQa6LEV.js.map → pencil-BmHgPcCk.js.map} +1 -1
- package/web-dist/assets/{play-DjTVY8Ej.js → play-Dul6ZDzY.js} +2 -2
- package/web-dist/assets/{play-DjTVY8Ej.js.map → play-Dul6ZDzY.js.map} +1 -1
- package/web-dist/assets/{plus-BQPgQYui.js → plus-DzBRN9tc.js} +2 -2
- package/web-dist/assets/{plus-BQPgQYui.js.map → plus-DzBRN9tc.js.map} +1 -1
- package/web-dist/assets/{policyLogic-cyMrhCM6.js → policyLogic-DVorBdH6.js} +2 -2
- package/web-dist/assets/{policyLogic-cyMrhCM6.js.map → policyLogic-DVorBdH6.js.map} +1 -1
- package/web-dist/assets/{prefs-CkiUftvR.js → prefs-CUMuH2EM.js} +2 -2
- package/web-dist/assets/{prefs-CkiUftvR.js.map → prefs-CUMuH2EM.js.map} +1 -1
- package/web-dist/assets/preload-helper-vwPq19u5.js +9 -0
- package/web-dist/assets/preload-helper-vwPq19u5.js.map +1 -0
- package/web-dist/assets/queue-hRZWM_pM.js +2 -0
- package/web-dist/assets/{queue-CSCmR2Xf.js.map → queue-hRZWM_pM.js.map} +1 -1
- package/web-dist/assets/{rotate-ccw-C07CP9JG.js → rotate-ccw-ByDiAA6o.js} +2 -2
- package/web-dist/assets/{rotate-ccw-C07CP9JG.js.map → rotate-ccw-ByDiAA6o.js.map} +1 -1
- package/web-dist/assets/{search-bqDM8qB0.js → search-DarT116I.js} +2 -2
- package/web-dist/assets/{search-bqDM8qB0.js.map → search-DarT116I.js.map} +1 -1
- package/web-dist/assets/settings-DHfdrqxv.js +6 -0
- package/web-dist/assets/settings-DHfdrqxv.js.map +1 -0
- package/web-dist/assets/{states-goHGz_CJ.js → states-hcvSpyb1.js} +5 -5
- package/web-dist/assets/states-hcvSpyb1.js.map +1 -0
- package/web-dist/assets/{terminal-BFJK8pLS.js → terminal-BmpsRI95.js} +2 -2
- package/web-dist/assets/{terminal-BFJK8pLS.js.map → terminal-BmpsRI95.js.map} +1 -1
- package/web-dist/assets/{terminal-login-DwI8gUw-.js → terminal-login-COaZPzQx.js} +2 -2
- package/web-dist/assets/{terminal-login-DwI8gUw-.js.map → terminal-login-COaZPzQx.js.map} +1 -1
- package/web-dist/assets/{useBreakpoint-C7ONetzK.js → useBreakpoint-CXotoLeq.js} +2 -2
- package/web-dist/assets/{useBreakpoint-C7ONetzK.js.map → useBreakpoint-CXotoLeq.js.map} +1 -1
- package/web-dist/assets/{useNow-BFhACgmu.js → useNow-BweXkeWc.js} +2 -2
- package/web-dist/assets/{useNow-BFhACgmu.js.map → useNow-BweXkeWc.js.map} +1 -1
- package/web-dist/assets/{useResource-Br3v4Sui.js → useResource-DAMkbbuf.js} +2 -2
- package/web-dist/assets/{useResource-Br3v4Sui.js.map → useResource-DAMkbbuf.js.map} +1 -1
- package/web-dist/assets/{useSwipeTabs-_JvGirwa.js → useSwipeTabs-3qLCxSS7.js} +2 -2
- package/web-dist/assets/{useSwipeTabs-_JvGirwa.js.map → useSwipeTabs-3qLCxSS7.js.map} +1 -1
- package/web-dist/assets/workboard-BEcRsjyQ.js +3 -0
- package/web-dist/assets/{workboard-IozvaLbf.js.map → workboard-BEcRsjyQ.js.map} +1 -1
- package/web-dist/index.html +7 -7
- package/web-dist/sw.js +1 -1
- package/web-dist/assets/AutomationView-BiSxKpgA.js +0 -2
- package/web-dist/assets/StructuredValue-DdwqFsZd.js +0 -5
- package/web-dist/assets/StructuredValue-DdwqFsZd.js.map +0 -1
- package/web-dist/assets/TextLink-BJlPjvKn.js +0 -2
- package/web-dist/assets/attention-DMhF0I-p.js +0 -2
- package/web-dist/assets/board-CMfIsKrb.js +0 -6
- package/web-dist/assets/board-CMfIsKrb.js.map +0 -1
- package/web-dist/assets/chevron-right-5ip-ZfOW.js +0 -2
- package/web-dist/assets/code-BpPDYwth.js +0 -24
- package/web-dist/assets/code-BpPDYwth.js.map +0 -1
- package/web-dist/assets/index-BXoBPAUR.js +0 -17
- package/web-dist/assets/preload-helper-B_HW6k8N.js +0 -9
- package/web-dist/assets/preload-helper-B_HW6k8N.js.map +0 -1
- package/web-dist/assets/queue-CSCmR2Xf.js +0 -2
- package/web-dist/assets/settings-iTwK6CzQ.js +0 -6
- package/web-dist/assets/settings-iTwK6CzQ.js.map +0 -1
- package/web-dist/assets/states-goHGz_CJ.js.map +0 -1
- package/web-dist/assets/workboard-IozvaLbf.js +0 -3
package/web-dist/index.html
CHANGED
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
<link rel="icon" type="image/svg+xml" href="/icon.svg" />
|
|
14
14
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
|
15
15
|
<title>Switchyard</title>
|
|
16
|
-
<script type="module" crossorigin src="/assets/index-
|
|
16
|
+
<script type="module" crossorigin src="/assets/index-D3WBnjbc.js"></script>
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
|
|
18
|
-
<link rel="modulepreload" crossorigin href="/assets/states-
|
|
19
|
-
<link rel="modulepreload" crossorigin href="/assets/useBreakpoint-
|
|
20
|
-
<link rel="modulepreload" crossorigin href="/assets/Overlay-
|
|
21
|
-
<link rel="modulepreload" crossorigin href="/assets/auth-
|
|
22
|
-
<link rel="modulepreload" crossorigin href="/assets/prefs-
|
|
23
|
-
<link rel="modulepreload" crossorigin href="/assets/preload-helper-
|
|
18
|
+
<link rel="modulepreload" crossorigin href="/assets/states-hcvSpyb1.js">
|
|
19
|
+
<link rel="modulepreload" crossorigin href="/assets/useBreakpoint-CXotoLeq.js">
|
|
20
|
+
<link rel="modulepreload" crossorigin href="/assets/Overlay-hRkfpjK4.js">
|
|
21
|
+
<link rel="modulepreload" crossorigin href="/assets/auth-Dzip9fVv.js">
|
|
22
|
+
<link rel="modulepreload" crossorigin href="/assets/prefs-CUMuH2EM.js">
|
|
23
|
+
<link rel="modulepreload" crossorigin href="/assets/preload-helper-vwPq19u5.js">
|
|
24
24
|
<link rel="stylesheet" crossorigin href="/assets/index-Bm6tklht.css">
|
|
25
25
|
<link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js" defer></script></head>
|
|
26
26
|
<body>
|
package/web-dist/sw.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
try{self[`workbox:core:7.4.0`]&&_()}catch{}var e=(e,...t)=>{let n=e;return t.length>0&&(n+=` :: ${JSON.stringify(t)}`),n},t=class extends Error{constructor(t,n){let r=e(t,n);super(r),this.name=t,this.details=n}},n={googleAnalytics:`googleAnalytics`,precache:`precache-v2`,prefix:`workbox`,runtime:`runtime`,suffix:typeof registration<`u`?registration.scope:``},r=e=>[n.prefix,e,n.suffix].filter(e=>e&&e.length>0).join(`-`),i=e=>{for(let t of Object.keys(n))e(t)},a={updateDetails:e=>{i(t=>{typeof e[t]==`string`&&(n[t]=e[t])})},getGoogleAnalyticsName:e=>e||r(n.googleAnalytics),getPrecacheName:e=>e||r(n.precache),getPrefix:()=>n.prefix,getRuntimeName:e=>e||r(n.runtime),getSuffix:()=>n.suffix};function o(e,t){let n=t();return e.waitUntil(n),n}try{self[`workbox:precaching:7.4.0`]&&_()}catch{}var s=`__WB_REVISION__`;function c(e){if(!e)throw new t(`add-to-cache-list-unexpected-type`,{entry:e});if(typeof e==`string`){let t=new URL(e,location.href);return{cacheKey:t.href,url:t.href}}let{revision:n,url:r}=e;if(!r)throw new t(`add-to-cache-list-unexpected-type`,{entry:e});if(!n){let e=new URL(r,location.href);return{cacheKey:e.href,url:e.href}}let i=new URL(r,location.href),a=new URL(r,location.href);return i.searchParams.set(s,n),{cacheKey:i.href,url:a.href}}var l=class{constructor(){this.updatedURLs=[],this.notUpdatedURLs=[],this.handlerWillStart=async({request:e,state:t})=>{t&&(t.originalRequest=e)},this.cachedResponseWillBeUsed=async({event:e,state:t,cachedResponse:n})=>{if(e.type===`install`&&t&&t.originalRequest&&t.originalRequest instanceof Request){let e=t.originalRequest.url;n?this.notUpdatedURLs.push(e):this.updatedURLs.push(e)}return n}}},u=class{constructor({precacheController:e}){this.cacheKeyWillBeUsed=async({request:e,params:t})=>{let n=t?.cacheKey||this._precacheController.getCacheKeyForURL(e.url);return n?new Request(n,{headers:e.headers}):e},this._precacheController=e}},d;function f(){if(d===void 0){let e=new Response(``);if(`body`in e)try{new Response(e.body),d=!0}catch{d=!1}d=!1}return d}async function p(e,n){let r=null;if(e.url&&(r=new URL(e.url).origin),r!==self.location.origin)throw new t(`cross-origin-copy-response`,{origin:r});let i=e.clone(),a={headers:new Headers(i.headers),status:i.status,statusText:i.statusText},o=n?n(a):a,s=f()?i.body:await i.blob();return new Response(s,o)}var m=e=>new URL(String(e),location.href).href.replace(RegExp(`^${location.origin}`),``);function h(e,t){let n=new URL(e);for(let e of t)n.searchParams.delete(e);return n.href}async function g(e,t,n,r){let i=h(t.url,n);if(t.url===i)return e.match(t,r);let a=Object.assign(Object.assign({},r),{ignoreSearch:!0}),o=await e.keys(t,a);for(let t of o)if(i===h(t.url,n))return e.match(t,r)}var v=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}},y=new Set;async function b(){for(let e of y)await e()}function x(e){return new Promise(t=>setTimeout(t,e))}try{self[`workbox:strategies:7.4.0`]&&_()}catch{}function S(e){return typeof e==`string`?new Request(e):e}var C=class{constructor(e,t){this._cacheKeys={},Object.assign(this,t),this.event=t.event,this._strategy=e,this._handlerDeferred=new v,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map;for(let e of this._plugins)this._pluginStateMap.set(e,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(e){let{event:n}=this,r=S(e);if(r.mode===`navigate`&&n instanceof FetchEvent&&n.preloadResponse){let e=await n.preloadResponse;if(e)return e}let i=this.hasCallback(`fetchDidFail`)?r.clone():null;try{for(let e of this.iterateCallbacks(`requestWillFetch`))r=await e({request:r.clone(),event:n})}catch(e){if(e instanceof Error)throw new t(`plugin-error-request-will-fetch`,{thrownErrorMessage:e.message})}let a=r.clone();try{let e;e=await fetch(r,r.mode===`navigate`?void 0:this._strategy.fetchOptions);for(let t of this.iterateCallbacks(`fetchDidSucceed`))e=await t({event:n,request:a,response:e});return e}catch(e){throw i&&await this.runCallbacks(`fetchDidFail`,{error:e,event:n,originalRequest:i.clone(),request:a.clone()}),e}}async fetchAndCachePut(e){let t=await this.fetch(e),n=t.clone();return this.waitUntil(this.cachePut(e,n)),t}async cacheMatch(e){let t=S(e),n,{cacheName:r,matchOptions:i}=this._strategy,a=await this.getCacheKey(t,`read`),o=Object.assign(Object.assign({},i),{cacheName:r});n=await caches.match(a,o);for(let e of this.iterateCallbacks(`cachedResponseWillBeUsed`))n=await e({cacheName:r,matchOptions:i,cachedResponse:n,request:a,event:this.event})||void 0;return n}async cachePut(e,n){let r=S(e);await x(0);let i=await this.getCacheKey(r,`write`);if(!n)throw new t(`cache-put-with-no-response`,{url:m(i.url)});let a=await this._ensureResponseSafeToCache(n);if(!a)return!1;let{cacheName:o,matchOptions:s}=this._strategy,c=await self.caches.open(o),l=this.hasCallback(`cacheDidUpdate`),u=l?await g(c,i.clone(),[`__WB_REVISION__`],s):null;try{await c.put(i,l?a.clone():a)}catch(e){if(e instanceof Error)throw e.name===`QuotaExceededError`&&await b(),e}for(let e of this.iterateCallbacks(`cacheDidUpdate`))await e({cacheName:o,oldResponse:u,newResponse:a.clone(),request:i,event:this.event});return!0}async getCacheKey(e,t){let n=`${e.url} | ${t}`;if(!this._cacheKeys[n]){let r=e;for(let e of this.iterateCallbacks(`cacheKeyWillBeUsed`))r=S(await e({mode:t,request:r,event:this.event,params:this.params}));this._cacheKeys[n]=r}return this._cacheKeys[n]}hasCallback(e){for(let t of this._strategy.plugins)if(e in t)return!0;return!1}async runCallbacks(e,t){for(let n of this.iterateCallbacks(e))await n(t)}*iterateCallbacks(e){for(let t of this._strategy.plugins)if(typeof t[e]==`function`){let n=this._pluginStateMap.get(t);yield r=>{let i=Object.assign(Object.assign({},r),{state:n});return t[e](i)}}}waitUntil(e){return this._extendLifetimePromises.push(e),e}async doneWaiting(){for(;this._extendLifetimePromises.length;){let e=this._extendLifetimePromises.splice(0),t=(await Promise.allSettled(e)).find(e=>e.status===`rejected`);if(t)throw t.reason}}destroy(){this._handlerDeferred.resolve(null)}async _ensureResponseSafeToCache(e){let t=e,n=!1;for(let e of this.iterateCallbacks(`cacheWillUpdate`))if(t=await e({request:this.request,response:t,event:this.event})||void 0,n=!0,!t)break;return n||t&&t.status!==200&&(t=void 0),t}},w=class{constructor(e={}){this.cacheName=a.getRuntimeName(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){let[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});let t=e.event,n=typeof e.request==`string`?new Request(e.request):e.request,r=`params`in e?e.params:void 0,i=new C(this,{event:t,request:n,params:r}),a=this._getResponse(i,n,t);return[a,this._awaitComplete(a,i,n,t)]}async _getResponse(e,n,r){await e.runCallbacks(`handlerWillStart`,{event:r,request:n});let i;try{if(i=await this._handle(n,e),!i||i.type===`error`)throw new t(`no-response`,{url:n.url})}catch(t){if(t instanceof Error){for(let a of e.iterateCallbacks(`handlerDidError`))if(i=await a({error:t,event:r,request:n}),i)break}if(!i)throw t}for(let t of e.iterateCallbacks(`handlerWillRespond`))i=await t({event:r,request:n,response:i});return i}async _awaitComplete(e,t,n,r){let i,a;try{i=await e}catch{}try{await t.runCallbacks(`handlerDidRespond`,{event:r,request:n,response:i}),await t.doneWaiting()}catch(e){e instanceof Error&&(a=e)}if(await t.runCallbacks(`handlerDidComplete`,{event:r,request:n,response:i,error:a}),t.destroy(),a)throw a}},T=class e extends w{constructor(t={}){t.cacheName=a.getPrecacheName(t.cacheName),super(t),this._fallbackToNetwork=t.fallbackToNetwork!==!1,this.plugins.push(e.copyRedirectedCacheableResponsesPlugin)}async _handle(e,t){return await t.cacheMatch(e)||(t.event&&t.event.type===`install`?await this._handleInstall(e,t):await this._handleFetch(e,t))}async _handleFetch(e,n){let r,i=n.params||{};if(this._fallbackToNetwork){let t=i.integrity,a=e.integrity,o=!a||a===t;r=await n.fetch(new Request(e,{integrity:e.mode===`no-cors`?void 0:a||t})),t&&o&&e.mode!==`no-cors`&&(this._useDefaultCacheabilityPluginIfNeeded(),await n.cachePut(e,r.clone()))}else throw new t(`missing-precache-entry`,{cacheName:this.cacheName,url:e.url});return r}async _handleInstall(e,n){this._useDefaultCacheabilityPluginIfNeeded();let r=await n.fetch(e);if(!await n.cachePut(e,r.clone()))throw new t(`bad-precaching-response`,{url:e.url,status:r.status});return r}_useDefaultCacheabilityPluginIfNeeded(){let t=null,n=0;for(let[r,i]of this.plugins.entries())i!==e.copyRedirectedCacheableResponsesPlugin&&(i===e.defaultPrecacheCacheabilityPlugin&&(t=r),i.cacheWillUpdate&&n++);n===0?this.plugins.push(e.defaultPrecacheCacheabilityPlugin):n>1&&t!==null&&this.plugins.splice(t,1)}};T.defaultPrecacheCacheabilityPlugin={async cacheWillUpdate({response:e}){return!e||e.status>=400?null:e}},T.copyRedirectedCacheableResponsesPlugin={async cacheWillUpdate({response:e}){return e.redirected?await p(e):e}};var E=class{constructor({cacheName:e,plugins:t=[],fallbackToNetwork:n=!0}={}){this._urlsToCacheKeys=new Map,this._urlsToCacheModes=new Map,this._cacheKeysToIntegrities=new Map,this._strategy=new T({cacheName:a.getPrecacheName(e),plugins:[...t,new u({precacheController:this})],fallbackToNetwork:n}),this.install=this.install.bind(this),this.activate=this.activate.bind(this)}get strategy(){return this._strategy}precache(e){this.addToCacheList(e),this._installAndActiveListenersAdded||=(self.addEventListener(`install`,this.install),self.addEventListener(`activate`,this.activate),!0)}addToCacheList(e){let n=[];for(let r of e){typeof r==`string`?n.push(r):r&&r.revision===void 0&&n.push(r.url);let{cacheKey:e,url:i}=c(r),a=typeof r!=`string`&&r.revision?`reload`:`default`;if(this._urlsToCacheKeys.has(i)&&this._urlsToCacheKeys.get(i)!==e)throw new t(`add-to-cache-list-conflicting-entries`,{firstEntry:this._urlsToCacheKeys.get(i),secondEntry:e});if(typeof r!=`string`&&r.integrity){if(this._cacheKeysToIntegrities.has(e)&&this._cacheKeysToIntegrities.get(e)!==r.integrity)throw new t(`add-to-cache-list-conflicting-integrities`,{url:i});this._cacheKeysToIntegrities.set(e,r.integrity)}if(this._urlsToCacheKeys.set(i,e),this._urlsToCacheModes.set(i,a),n.length>0){let e=`Workbox is precaching URLs without revision info: ${n.join(`, `)}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(e)}}}install(e){return o(e,async()=>{let t=new l;this.strategy.plugins.push(t);for(let[t,n]of this._urlsToCacheKeys){let r=this._cacheKeysToIntegrities.get(n),i=this._urlsToCacheModes.get(t),a=new Request(t,{integrity:r,cache:i,credentials:`same-origin`});await Promise.all(this.strategy.handleAll({params:{cacheKey:n},request:a,event:e}))}let{updatedURLs:n,notUpdatedURLs:r}=t;return{updatedURLs:n,notUpdatedURLs:r}})}activate(e){return o(e,async()=>{let e=await self.caches.open(this.strategy.cacheName),t=await e.keys(),n=new Set(this._urlsToCacheKeys.values()),r=[];for(let i of t)n.has(i.url)||(await e.delete(i),r.push(i.url));return{deletedURLs:r}})}getURLsToCacheKeys(){return this._urlsToCacheKeys}getCachedURLs(){return[...this._urlsToCacheKeys.keys()]}getCacheKeyForURL(e){let t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}getIntegrityForCacheKey(e){return this._cacheKeysToIntegrities.get(e)}async matchPrecache(e){let t=e instanceof Request?e.url:e,n=this.getCacheKeyForURL(t);if(n)return(await self.caches.open(this.strategy.cacheName)).match(n)}createHandlerBoundToURL(e){let n=this.getCacheKeyForURL(e);if(!n)throw new t(`non-precached-url`,{url:e});return t=>(t.request=new Request(e),t.params=Object.assign({cacheKey:n},t.params),this.strategy.handle(t))}},D,O=()=>(D||=new E,D);try{self[`workbox:routing:7.4.0`]&&_()}catch{}var k=e=>e&&typeof e==`object`?e:{handle:e},A=class{constructor(e,t,n=`GET`){this.handler=k(t),this.match=e,this.method=n}setCatchHandler(e){this.catchHandler=k(e)}},j=class extends A{constructor(e,t,n){super(({url:t})=>{let n=e.exec(t.href);if(n&&(t.origin===location.origin||n.index===0))return n.slice(1)},t,n)}},M=class{constructor(){this._routes=new Map,this._defaultHandlerMap=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener(`fetch`,(e=>{let{request:t}=e,n=this.handleRequest({request:t,event:e});n&&e.respondWith(n)}))}addCacheListener(){self.addEventListener(`message`,(e=>{if(e.data&&e.data.type===`CACHE_URLS`){let{payload:t}=e.data,n=Promise.all(t.urlsToCache.map(t=>{typeof t==`string`&&(t=[t]);let n=new Request(...t);return this.handleRequest({request:n,event:e})}));e.waitUntil(n),e.ports&&e.ports[0]&&n.then(()=>e.ports[0].postMessage(!0))}}))}handleRequest({request:e,event:t}){let n=new URL(e.url,location.href);if(!n.protocol.startsWith(`http`))return;let r=n.origin===location.origin,{params:i,route:a}=this.findMatchingRoute({event:t,request:e,sameOrigin:r,url:n}),o=a&&a.handler,s=e.method;if(!o&&this._defaultHandlerMap.has(s)&&(o=this._defaultHandlerMap.get(s)),!o)return;let c;try{c=o.handle({url:n,request:e,event:t,params:i})}catch(e){c=Promise.reject(e)}let l=a&&a.catchHandler;return c instanceof Promise&&(this._catchHandler||l)&&(c=c.catch(async r=>{if(l)try{return await l.handle({url:n,request:e,event:t,params:i})}catch(e){e instanceof Error&&(r=e)}if(this._catchHandler)return this._catchHandler.handle({url:n,request:e,event:t});throw r})),c}findMatchingRoute({url:e,sameOrigin:t,request:n,event:r}){let i=this._routes.get(n.method)||[];for(let a of i){let i,o=a.match({url:e,sameOrigin:t,request:n,event:r});if(o)return i=o,(Array.isArray(i)&&i.length===0||o.constructor===Object&&Object.keys(o).length===0||typeof o==`boolean`)&&(i=void 0),{route:a,params:i}}return{}}setDefaultHandler(e,t=`GET`){this._defaultHandlerMap.set(t,k(e))}setCatchHandler(e){this._catchHandler=k(e)}registerRoute(e){this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new t(`unregister-route-but-not-found-with-method`,{method:e.method});let n=this._routes.get(e.method).indexOf(e);if(n>-1)this._routes.get(e.method).splice(n,1);else throw new t(`unregister-route-route-not-registered`)}},N,P=()=>(N||(N=new M,N.addFetchListener(),N.addCacheListener()),N);function F(e,n,r){let i;if(typeof e==`string`){let t=new URL(e,location.href);i=new A(({url:e})=>e.href===t.href,n,r)}else if(e instanceof RegExp)i=new j(e,n,r);else if(typeof e==`function`)i=new A(e,n,r);else if(e instanceof A)i=e;else throw new t(`unsupported-route-type`,{moduleName:`workbox-routing`,funcName:`registerRoute`,paramName:`capture`});return P().registerRoute(i),i}function I(e,t=[]){for(let n of[...e.searchParams.keys()])t.some(e=>e.test(n))&&e.searchParams.delete(n);return e}function*L(e,{ignoreURLParametersMatching:t=[/^utm_/,/^fbclid$/],directoryIndex:n=`index.html`,cleanURLs:r=!0,urlManipulation:i}={}){let a=new URL(e,location.href);a.hash=``,yield a.href;let o=I(a,t);if(yield o.href,n&&o.pathname.endsWith(`/`)){let e=new URL(o.href);e.pathname+=n,yield e.href}if(r){let e=new URL(o.href);e.pathname+=`.html`,yield e.href}if(i){let e=i({url:a});for(let t of e)yield t.href}}var R=class extends A{constructor(e,t){super(({request:n})=>{let r=e.getURLsToCacheKeys();for(let i of L(n.url,t)){let t=r.get(i);if(t)return{cacheKey:t,integrity:e.getIntegrityForCacheKey(t)}}},e.strategy)}};function z(e){F(new R(O(),e))}var B=`-precache-`,V=async(e,t=B)=>{let n=(await self.caches.keys()).filter(n=>n.includes(t)&&n.includes(self.registration.scope)&&n!==e);return await Promise.all(n.map(e=>self.caches.delete(e))),n};function H(){self.addEventListener(`activate`,(e=>{let t=a.getPrecacheName();e.waitUntil(V(t).then(e=>{}))}))}function U(e){return O().matchPrecache(e)}function W(e){O().precache(e)}function G(e,t){W(e),z(t)}var K={type:`show`,title:`Switchyard`,body:`Something changed. Open Switchyard to see it.`,tag:`switchyard`,url:`/attention`,renotify:!1},q=e=>typeof e==`string`;function J(e){if(!e)return K;let t;try{t=e.json()}catch{let t=``;try{t=e.text()}catch{}return t?{...K,body:t}:K}return t?.type===`clear`&&q(t.tag)?{type:`clear`,tag:t.tag}:t?.type===`show`&&q(t.title)&&q(t.body)&&q(t.tag)&&q(t.url)?{type:`show`,title:t.title,body:t.body,tag:t.tag,url:t.url,renotify:t.renotify===!0}:K}function Y(e,t){let n=t?.data?.url;return{title:`Resolved`,options:{body:t?.title?`${t.title} no longer needs you.`:`A Switchyard item no longer needs you.`,tag:e,silent:!0,renotify:!1,data:{url:q(n)?n:`/attention`,resolved:!0}}}}G([{"revision":"1872c500de691dce40960bb85481de07","url":"registerSW.js"},{"revision":"13547519d4d57ed00992ea3ce674898f","url":"maskable-512.png"},{"revision":"084d6fa9e3414cf05b16226149d312f2","url":"index.html"},{"revision":"a2ab6346edf4afa0d3e92efa4eaffda0","url":"icon.svg"},{"revision":"5f6750eb3eac94f14e2c13ebc966b744","url":"icon-512.png"},{"revision":"1d18b7c0ba74b49ffa7c388dd59f33cf","url":"icon-192.png"},{"revision":"d35ba918f4293158ea83e9628573689a","url":"apple-touch-icon.png"},{"revision":null,"url":"assets/yaml-DijMHRDA.js"},{"revision":null,"url":"assets/yaml-DDA_XMNu.js"},{"revision":null,"url":"assets/xml-WY0zc4PG.js"},{"revision":null,"url":"assets/xml-DuKfbPI6.js"},{"revision":null,"url":"assets/workboard-IozvaLbf.js"},{"revision":null,"url":"assets/useSwipeTabs-_JvGirwa.js"},{"revision":null,"url":"assets/useResource-Br3v4Sui.js"},{"revision":null,"url":"assets/useNow-BFhACgmu.js"},{"revision":null,"url":"assets/useBreakpoint-C7ONetzK.js"},{"revision":null,"url":"assets/typescript-j_1H8WHN.js"},{"revision":null,"url":"assets/typescript-Bb1J8qyy.js"},{"revision":null,"url":"assets/tsx-CGosfAUg.js"},{"revision":null,"url":"assets/tsx-BOvsFOI6.js"},{"revision":null,"url":"assets/toml-CcmNWLt0.js"},{"revision":null,"url":"assets/terminal-login-DwI8gUw-.js"},{"revision":null,"url":"assets/terminal-BFJK8pLS.js"},{"revision":null,"url":"assets/swift-CyEgAFGc.js"},{"revision":null,"url":"assets/states-goHGz_CJ.js"},{"revision":null,"url":"assets/sql-CfM2IJm3.js"},{"revision":null,"url":"assets/sql-CNu3Or2W.js"},{"revision":null,"url":"assets/shellscript-CqHdAlCp.js"},{"revision":null,"url":"assets/shellscript-CVTB3cr6.js"},{"revision":null,"url":"assets/settings-iTwK6CzQ.js"},{"revision":null,"url":"assets/search-bqDM8qB0.js"},{"revision":null,"url":"assets/scss-8bKmll0B.js"},{"revision":null,"url":"assets/rust-DpiIf5JO.js"},{"revision":null,"url":"assets/ruby-Bx-U2qjP.js"},{"revision":null,"url":"assets/rotate-ccw-C07CP9JG.js"},{"revision":null,"url":"assets/rolldown-runtime-XKyaHtl9.js"},{"revision":null,"url":"assets/queue-CSCmR2Xf.js"},{"revision":null,"url":"assets/python-gzcpVVnB.js"},{"revision":null,"url":"assets/preload-helper-B_HW6k8N.js"},{"revision":null,"url":"assets/prefs-CkiUftvR.js"},{"revision":null,"url":"assets/policyLogic-cyMrhCM6.js"},{"revision":null,"url":"assets/plus-BQPgQYui.js"},{"revision":null,"url":"assets/play-DjTVY8Ej.js"},{"revision":null,"url":"assets/pencil-BoQa6LEV.js"},{"revision":null,"url":"assets/more-C41VHBVG.js"},{"revision":null,"url":"assets/lua-fPRBWD-V.js"},{"revision":null,"url":"assets/lua-DjuecEsk.js"},{"revision":null,"url":"assets/logic-uhnfzaYJ.js"},{"revision":null,"url":"assets/logic-3so3T0af.js"},{"revision":null,"url":"assets/link-2-pHvZvxCs.js"},{"revision":null,"url":"assets/jsx-D3KKoC5L.js"},{"revision":null,"url":"assets/jsx-C4yDKi0A.js"},{"revision":null,"url":"assets/jsonc-CYpm1nAK.js"},{"revision":null,"url":"assets/json-qhed-kSA.js"},{"revision":null,"url":"assets/javascript-CpIGwZ_Y.js"},{"revision":null,"url":"assets/javascript-BzbQS41l.js"},{"revision":null,"url":"assets/java-_ATy9zCa.js"},{"revision":null,"url":"assets/java-BtIQNnN0.js"},{"revision":null,"url":"assets/index-Bm6tklht.css"},{"revision":null,"url":"assets/index-BXoBPAUR.js"},{"revision":null,"url":"assets/html-BWDvXlHg.js"},{"revision":null,"url":"assets/html-BMn1ogTm.js"},{"revision":null,"url":"assets/haptics-O69vKVoK.js"},{"revision":null,"url":"assets/hand-ryhCgGbh.js"},{"revision":null,"url":"assets/grip-vertical-DfKSP8jp.js"},{"revision":null,"url":"assets/go-rLFTqkRN.js"},{"revision":null,"url":"assets/github-light-EUqPIrTm.js"},{"revision":null,"url":"assets/github-dark-C-LZuMrd.js"},{"revision":null,"url":"assets/git-branch-DuApoZes.js"},{"revision":null,"url":"assets/external-link-DeLk0jmb.js"},{"revision":null,"url":"assets/enroll-B_ZjVnEj.js"},{"revision":null,"url":"assets/dockerfile-IyjqRm3v.js"},{"revision":null,"url":"assets/diff-woXpYk--.js"},{"revision":null,"url":"assets/describe-Bd1JbydU.js"},{"revision":null,"url":"assets/css-DgaLhXQH.js"},{"revision":null,"url":"assets/css-BGIxQoYs.js"},{"revision":null,"url":"assets/cpp-DzjeI0uH.js"},{"revision":null,"url":"assets/cpp-Cts1PyIS.js"},{"revision":null,"url":"assets/core.esm-C_QgTrGe.js"},{"revision":null,"url":"assets/code-BpPDYwth.js"},{"revision":null,"url":"assets/code-B1njb2Cr.css"},{"revision":null,"url":"assets/chevron-right-5ip-ZfOW.js"},{"revision":null,"url":"assets/calendar-clock-C5cMYlld.js"},{"revision":null,"url":"assets/c-SSSlmE39.js"},{"revision":null,"url":"assets/c-Cz4nF6n_.js"},{"revision":null,"url":"assets/board-CMfIsKrb.js"},{"revision":null,"url":"assets/automations-Dz_JHvUj.js"},{"revision":null,"url":"assets/auth-vd8OFoQx.js"},{"revision":null,"url":"assets/attention-DMhF0I-p.js"},{"revision":null,"url":"assets/arrow-up-D0b2fv0Q.js"},{"revision":null,"url":"assets/arrow-down-Bqx9CSB1.js"},{"revision":null,"url":"assets/api-C7CMr6g-.js"},{"revision":null,"url":"assets/UnfilteredNote-B77oGOcW.js"},{"revision":null,"url":"assets/UINodeRenderer-DwZNt-8y.js"},{"revision":null,"url":"assets/TextLink-BJlPjvKn.js"},{"revision":null,"url":"assets/Tabs-CIolUgNo.js"},{"revision":null,"url":"assets/Switch-llihKH_2.js"},{"revision":null,"url":"assets/StructuredValue-DdwqFsZd.js"},{"revision":null,"url":"assets/Select-CRC4mF4U.js"},{"revision":null,"url":"assets/SegmentedControl-CCObjCnv.js"},{"revision":null,"url":"assets/ScopeSelect-7ZYRzci5.js"},{"revision":null,"url":"assets/ScopeRepository-BU9I7Gs_.js"},{"revision":null,"url":"assets/RadioCards-Oy23yrpF.js"},{"revision":null,"url":"assets/Priority-VTOBYjs9.js"},{"revision":null,"url":"assets/Overlay-kkZVSidv.js"},{"revision":null,"url":"assets/NavigationEditor-DE3vVnHw.js"},{"revision":null,"url":"assets/Field-0rAadZ7B.js"},{"revision":null,"url":"assets/DangerZone-tpxj5S8V.js"},{"revision":null,"url":"assets/Checkbox-CneW7ZHn.js"},{"revision":null,"url":"assets/AutomationView-BiSxKpgA.js"},{"revision":"a3eb00302b8325cfe5c4836ff54f4b4a","url":"manifest.webmanifest"}]),H(),self.addEventListener(`install`,()=>{self.skipWaiting()}),self.addEventListener(`activate`,e=>{e.waitUntil(self.clients.claim())});var X=/^\/(api|ws|adapter-frames|healthz|readyz)(\/|$)/;self.addEventListener(`fetch`,e=>{let t=e.request;if(t.mode!==`navigate`)return;let n=new URL(t.url);n.origin!==self.location.origin||X.test(n.pathname)||e.respondWith(fetch(t).catch(async()=>await U(`/index.html`)??Response.error()))});var Z=`/icon-192.png`;self.addEventListener(`push`,e=>{let t=J(e.data);e.waitUntil(t.type===`clear`?Q(t.tag):self.registration.showNotification(t.title,{body:t.body,tag:t.tag,data:{url:t.url},renotify:t.renotify,icon:Z,badge:Z}))});async function Q(e){let t=await self.registration.getNotifications({tag:e});if((await self.clients.matchAll({type:`window`,includeUncontrolled:!0})).some(e=>e.visibilityState===`visible`)){for(let e of t)e.close();return}let n=Y(e,t[0]?{title:t[0].title,data:t[0].data}:null);await self.registration.showNotification(n.title,{...n.options,icon:Z,badge:Z})}self.addEventListener(`notificationclick`,e=>{e.notification.close();let t=e.notification.data?.url??`/`,n=new URL(t,self.location.origin).href;e.waitUntil((async()=>{let e=(await self.clients.matchAll({type:`window`,includeUncontrolled:!0})).filter(e=>new URL(e.url).origin===self.location.origin),t=e.find(e=>e.url===n)??e[0];if(t)try{let e=await t.focus()??t;e.url!==n&&e.postMessage({type:`navigate`,url:n});return}catch{}await self.clients.openWindow(n)})())});
|
|
1
|
+
try{self[`workbox:core:7.4.0`]&&_()}catch{}var e=(e,...t)=>{let n=e;return t.length>0&&(n+=` :: ${JSON.stringify(t)}`),n},t=class extends Error{constructor(t,n){let r=e(t,n);super(r),this.name=t,this.details=n}},n={googleAnalytics:`googleAnalytics`,precache:`precache-v2`,prefix:`workbox`,runtime:`runtime`,suffix:typeof registration<`u`?registration.scope:``},r=e=>[n.prefix,e,n.suffix].filter(e=>e&&e.length>0).join(`-`),i=e=>{for(let t of Object.keys(n))e(t)},a={updateDetails:e=>{i(t=>{typeof e[t]==`string`&&(n[t]=e[t])})},getGoogleAnalyticsName:e=>e||r(n.googleAnalytics),getPrecacheName:e=>e||r(n.precache),getPrefix:()=>n.prefix,getRuntimeName:e=>e||r(n.runtime),getSuffix:()=>n.suffix};function o(e,t){let n=t();return e.waitUntil(n),n}try{self[`workbox:precaching:7.4.0`]&&_()}catch{}var s=`__WB_REVISION__`;function c(e){if(!e)throw new t(`add-to-cache-list-unexpected-type`,{entry:e});if(typeof e==`string`){let t=new URL(e,location.href);return{cacheKey:t.href,url:t.href}}let{revision:n,url:r}=e;if(!r)throw new t(`add-to-cache-list-unexpected-type`,{entry:e});if(!n){let e=new URL(r,location.href);return{cacheKey:e.href,url:e.href}}let i=new URL(r,location.href),a=new URL(r,location.href);return i.searchParams.set(s,n),{cacheKey:i.href,url:a.href}}var l=class{constructor(){this.updatedURLs=[],this.notUpdatedURLs=[],this.handlerWillStart=async({request:e,state:t})=>{t&&(t.originalRequest=e)},this.cachedResponseWillBeUsed=async({event:e,state:t,cachedResponse:n})=>{if(e.type===`install`&&t&&t.originalRequest&&t.originalRequest instanceof Request){let e=t.originalRequest.url;n?this.notUpdatedURLs.push(e):this.updatedURLs.push(e)}return n}}},u=class{constructor({precacheController:e}){this.cacheKeyWillBeUsed=async({request:e,params:t})=>{let n=t?.cacheKey||this._precacheController.getCacheKeyForURL(e.url);return n?new Request(n,{headers:e.headers}):e},this._precacheController=e}},d;function f(){if(d===void 0){let e=new Response(``);if(`body`in e)try{new Response(e.body),d=!0}catch{d=!1}d=!1}return d}async function p(e,n){let r=null;if(e.url&&(r=new URL(e.url).origin),r!==self.location.origin)throw new t(`cross-origin-copy-response`,{origin:r});let i=e.clone(),a={headers:new Headers(i.headers),status:i.status,statusText:i.statusText},o=n?n(a):a,s=f()?i.body:await i.blob();return new Response(s,o)}var m=e=>new URL(String(e),location.href).href.replace(RegExp(`^${location.origin}`),``);function h(e,t){let n=new URL(e);for(let e of t)n.searchParams.delete(e);return n.href}async function g(e,t,n,r){let i=h(t.url,n);if(t.url===i)return e.match(t,r);let a=Object.assign(Object.assign({},r),{ignoreSearch:!0}),o=await e.keys(t,a);for(let t of o)if(i===h(t.url,n))return e.match(t,r)}var v=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}},y=new Set;async function b(){for(let e of y)await e()}function x(e){return new Promise(t=>setTimeout(t,e))}try{self[`workbox:strategies:7.4.0`]&&_()}catch{}function S(e){return typeof e==`string`?new Request(e):e}var C=class{constructor(e,t){this._cacheKeys={},Object.assign(this,t),this.event=t.event,this._strategy=e,this._handlerDeferred=new v,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map;for(let e of this._plugins)this._pluginStateMap.set(e,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(e){let{event:n}=this,r=S(e);if(r.mode===`navigate`&&n instanceof FetchEvent&&n.preloadResponse){let e=await n.preloadResponse;if(e)return e}let i=this.hasCallback(`fetchDidFail`)?r.clone():null;try{for(let e of this.iterateCallbacks(`requestWillFetch`))r=await e({request:r.clone(),event:n})}catch(e){if(e instanceof Error)throw new t(`plugin-error-request-will-fetch`,{thrownErrorMessage:e.message})}let a=r.clone();try{let e;e=await fetch(r,r.mode===`navigate`?void 0:this._strategy.fetchOptions);for(let t of this.iterateCallbacks(`fetchDidSucceed`))e=await t({event:n,request:a,response:e});return e}catch(e){throw i&&await this.runCallbacks(`fetchDidFail`,{error:e,event:n,originalRequest:i.clone(),request:a.clone()}),e}}async fetchAndCachePut(e){let t=await this.fetch(e),n=t.clone();return this.waitUntil(this.cachePut(e,n)),t}async cacheMatch(e){let t=S(e),n,{cacheName:r,matchOptions:i}=this._strategy,a=await this.getCacheKey(t,`read`),o=Object.assign(Object.assign({},i),{cacheName:r});n=await caches.match(a,o);for(let e of this.iterateCallbacks(`cachedResponseWillBeUsed`))n=await e({cacheName:r,matchOptions:i,cachedResponse:n,request:a,event:this.event})||void 0;return n}async cachePut(e,n){let r=S(e);await x(0);let i=await this.getCacheKey(r,`write`);if(!n)throw new t(`cache-put-with-no-response`,{url:m(i.url)});let a=await this._ensureResponseSafeToCache(n);if(!a)return!1;let{cacheName:o,matchOptions:s}=this._strategy,c=await self.caches.open(o),l=this.hasCallback(`cacheDidUpdate`),u=l?await g(c,i.clone(),[`__WB_REVISION__`],s):null;try{await c.put(i,l?a.clone():a)}catch(e){if(e instanceof Error)throw e.name===`QuotaExceededError`&&await b(),e}for(let e of this.iterateCallbacks(`cacheDidUpdate`))await e({cacheName:o,oldResponse:u,newResponse:a.clone(),request:i,event:this.event});return!0}async getCacheKey(e,t){let n=`${e.url} | ${t}`;if(!this._cacheKeys[n]){let r=e;for(let e of this.iterateCallbacks(`cacheKeyWillBeUsed`))r=S(await e({mode:t,request:r,event:this.event,params:this.params}));this._cacheKeys[n]=r}return this._cacheKeys[n]}hasCallback(e){for(let t of this._strategy.plugins)if(e in t)return!0;return!1}async runCallbacks(e,t){for(let n of this.iterateCallbacks(e))await n(t)}*iterateCallbacks(e){for(let t of this._strategy.plugins)if(typeof t[e]==`function`){let n=this._pluginStateMap.get(t);yield r=>{let i=Object.assign(Object.assign({},r),{state:n});return t[e](i)}}}waitUntil(e){return this._extendLifetimePromises.push(e),e}async doneWaiting(){for(;this._extendLifetimePromises.length;){let e=this._extendLifetimePromises.splice(0),t=(await Promise.allSettled(e)).find(e=>e.status===`rejected`);if(t)throw t.reason}}destroy(){this._handlerDeferred.resolve(null)}async _ensureResponseSafeToCache(e){let t=e,n=!1;for(let e of this.iterateCallbacks(`cacheWillUpdate`))if(t=await e({request:this.request,response:t,event:this.event})||void 0,n=!0,!t)break;return n||t&&t.status!==200&&(t=void 0),t}},w=class{constructor(e={}){this.cacheName=a.getRuntimeName(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){let[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});let t=e.event,n=typeof e.request==`string`?new Request(e.request):e.request,r=`params`in e?e.params:void 0,i=new C(this,{event:t,request:n,params:r}),a=this._getResponse(i,n,t);return[a,this._awaitComplete(a,i,n,t)]}async _getResponse(e,n,r){await e.runCallbacks(`handlerWillStart`,{event:r,request:n});let i;try{if(i=await this._handle(n,e),!i||i.type===`error`)throw new t(`no-response`,{url:n.url})}catch(t){if(t instanceof Error){for(let a of e.iterateCallbacks(`handlerDidError`))if(i=await a({error:t,event:r,request:n}),i)break}if(!i)throw t}for(let t of e.iterateCallbacks(`handlerWillRespond`))i=await t({event:r,request:n,response:i});return i}async _awaitComplete(e,t,n,r){let i,a;try{i=await e}catch{}try{await t.runCallbacks(`handlerDidRespond`,{event:r,request:n,response:i}),await t.doneWaiting()}catch(e){e instanceof Error&&(a=e)}if(await t.runCallbacks(`handlerDidComplete`,{event:r,request:n,response:i,error:a}),t.destroy(),a)throw a}},T=class e extends w{constructor(t={}){t.cacheName=a.getPrecacheName(t.cacheName),super(t),this._fallbackToNetwork=t.fallbackToNetwork!==!1,this.plugins.push(e.copyRedirectedCacheableResponsesPlugin)}async _handle(e,t){return await t.cacheMatch(e)||(t.event&&t.event.type===`install`?await this._handleInstall(e,t):await this._handleFetch(e,t))}async _handleFetch(e,n){let r,i=n.params||{};if(this._fallbackToNetwork){let t=i.integrity,a=e.integrity,o=!a||a===t;r=await n.fetch(new Request(e,{integrity:e.mode===`no-cors`?void 0:a||t})),t&&o&&e.mode!==`no-cors`&&(this._useDefaultCacheabilityPluginIfNeeded(),await n.cachePut(e,r.clone()))}else throw new t(`missing-precache-entry`,{cacheName:this.cacheName,url:e.url});return r}async _handleInstall(e,n){this._useDefaultCacheabilityPluginIfNeeded();let r=await n.fetch(e);if(!await n.cachePut(e,r.clone()))throw new t(`bad-precaching-response`,{url:e.url,status:r.status});return r}_useDefaultCacheabilityPluginIfNeeded(){let t=null,n=0;for(let[r,i]of this.plugins.entries())i!==e.copyRedirectedCacheableResponsesPlugin&&(i===e.defaultPrecacheCacheabilityPlugin&&(t=r),i.cacheWillUpdate&&n++);n===0?this.plugins.push(e.defaultPrecacheCacheabilityPlugin):n>1&&t!==null&&this.plugins.splice(t,1)}};T.defaultPrecacheCacheabilityPlugin={async cacheWillUpdate({response:e}){return!e||e.status>=400?null:e}},T.copyRedirectedCacheableResponsesPlugin={async cacheWillUpdate({response:e}){return e.redirected?await p(e):e}};var E=class{constructor({cacheName:e,plugins:t=[],fallbackToNetwork:n=!0}={}){this._urlsToCacheKeys=new Map,this._urlsToCacheModes=new Map,this._cacheKeysToIntegrities=new Map,this._strategy=new T({cacheName:a.getPrecacheName(e),plugins:[...t,new u({precacheController:this})],fallbackToNetwork:n}),this.install=this.install.bind(this),this.activate=this.activate.bind(this)}get strategy(){return this._strategy}precache(e){this.addToCacheList(e),this._installAndActiveListenersAdded||=(self.addEventListener(`install`,this.install),self.addEventListener(`activate`,this.activate),!0)}addToCacheList(e){let n=[];for(let r of e){typeof r==`string`?n.push(r):r&&r.revision===void 0&&n.push(r.url);let{cacheKey:e,url:i}=c(r),a=typeof r!=`string`&&r.revision?`reload`:`default`;if(this._urlsToCacheKeys.has(i)&&this._urlsToCacheKeys.get(i)!==e)throw new t(`add-to-cache-list-conflicting-entries`,{firstEntry:this._urlsToCacheKeys.get(i),secondEntry:e});if(typeof r!=`string`&&r.integrity){if(this._cacheKeysToIntegrities.has(e)&&this._cacheKeysToIntegrities.get(e)!==r.integrity)throw new t(`add-to-cache-list-conflicting-integrities`,{url:i});this._cacheKeysToIntegrities.set(e,r.integrity)}if(this._urlsToCacheKeys.set(i,e),this._urlsToCacheModes.set(i,a),n.length>0){let e=`Workbox is precaching URLs without revision info: ${n.join(`, `)}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(e)}}}install(e){return o(e,async()=>{let t=new l;this.strategy.plugins.push(t);for(let[t,n]of this._urlsToCacheKeys){let r=this._cacheKeysToIntegrities.get(n),i=this._urlsToCacheModes.get(t),a=new Request(t,{integrity:r,cache:i,credentials:`same-origin`});await Promise.all(this.strategy.handleAll({params:{cacheKey:n},request:a,event:e}))}let{updatedURLs:n,notUpdatedURLs:r}=t;return{updatedURLs:n,notUpdatedURLs:r}})}activate(e){return o(e,async()=>{let e=await self.caches.open(this.strategy.cacheName),t=await e.keys(),n=new Set(this._urlsToCacheKeys.values()),r=[];for(let i of t)n.has(i.url)||(await e.delete(i),r.push(i.url));return{deletedURLs:r}})}getURLsToCacheKeys(){return this._urlsToCacheKeys}getCachedURLs(){return[...this._urlsToCacheKeys.keys()]}getCacheKeyForURL(e){let t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}getIntegrityForCacheKey(e){return this._cacheKeysToIntegrities.get(e)}async matchPrecache(e){let t=e instanceof Request?e.url:e,n=this.getCacheKeyForURL(t);if(n)return(await self.caches.open(this.strategy.cacheName)).match(n)}createHandlerBoundToURL(e){let n=this.getCacheKeyForURL(e);if(!n)throw new t(`non-precached-url`,{url:e});return t=>(t.request=new Request(e),t.params=Object.assign({cacheKey:n},t.params),this.strategy.handle(t))}},D,O=()=>(D||=new E,D);try{self[`workbox:routing:7.4.0`]&&_()}catch{}var k=e=>e&&typeof e==`object`?e:{handle:e},A=class{constructor(e,t,n=`GET`){this.handler=k(t),this.match=e,this.method=n}setCatchHandler(e){this.catchHandler=k(e)}},j=class extends A{constructor(e,t,n){super(({url:t})=>{let n=e.exec(t.href);if(n&&(t.origin===location.origin||n.index===0))return n.slice(1)},t,n)}},M=class{constructor(){this._routes=new Map,this._defaultHandlerMap=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener(`fetch`,(e=>{let{request:t}=e,n=this.handleRequest({request:t,event:e});n&&e.respondWith(n)}))}addCacheListener(){self.addEventListener(`message`,(e=>{if(e.data&&e.data.type===`CACHE_URLS`){let{payload:t}=e.data,n=Promise.all(t.urlsToCache.map(t=>{typeof t==`string`&&(t=[t]);let n=new Request(...t);return this.handleRequest({request:n,event:e})}));e.waitUntil(n),e.ports&&e.ports[0]&&n.then(()=>e.ports[0].postMessage(!0))}}))}handleRequest({request:e,event:t}){let n=new URL(e.url,location.href);if(!n.protocol.startsWith(`http`))return;let r=n.origin===location.origin,{params:i,route:a}=this.findMatchingRoute({event:t,request:e,sameOrigin:r,url:n}),o=a&&a.handler,s=e.method;if(!o&&this._defaultHandlerMap.has(s)&&(o=this._defaultHandlerMap.get(s)),!o)return;let c;try{c=o.handle({url:n,request:e,event:t,params:i})}catch(e){c=Promise.reject(e)}let l=a&&a.catchHandler;return c instanceof Promise&&(this._catchHandler||l)&&(c=c.catch(async r=>{if(l)try{return await l.handle({url:n,request:e,event:t,params:i})}catch(e){e instanceof Error&&(r=e)}if(this._catchHandler)return this._catchHandler.handle({url:n,request:e,event:t});throw r})),c}findMatchingRoute({url:e,sameOrigin:t,request:n,event:r}){let i=this._routes.get(n.method)||[];for(let a of i){let i,o=a.match({url:e,sameOrigin:t,request:n,event:r});if(o)return i=o,(Array.isArray(i)&&i.length===0||o.constructor===Object&&Object.keys(o).length===0||typeof o==`boolean`)&&(i=void 0),{route:a,params:i}}return{}}setDefaultHandler(e,t=`GET`){this._defaultHandlerMap.set(t,k(e))}setCatchHandler(e){this._catchHandler=k(e)}registerRoute(e){this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new t(`unregister-route-but-not-found-with-method`,{method:e.method});let n=this._routes.get(e.method).indexOf(e);if(n>-1)this._routes.get(e.method).splice(n,1);else throw new t(`unregister-route-route-not-registered`)}},N,P=()=>(N||(N=new M,N.addFetchListener(),N.addCacheListener()),N);function F(e,n,r){let i;if(typeof e==`string`){let t=new URL(e,location.href);i=new A(({url:e})=>e.href===t.href,n,r)}else if(e instanceof RegExp)i=new j(e,n,r);else if(typeof e==`function`)i=new A(e,n,r);else if(e instanceof A)i=e;else throw new t(`unsupported-route-type`,{moduleName:`workbox-routing`,funcName:`registerRoute`,paramName:`capture`});return P().registerRoute(i),i}function I(e,t=[]){for(let n of[...e.searchParams.keys()])t.some(e=>e.test(n))&&e.searchParams.delete(n);return e}function*L(e,{ignoreURLParametersMatching:t=[/^utm_/,/^fbclid$/],directoryIndex:n=`index.html`,cleanURLs:r=!0,urlManipulation:i}={}){let a=new URL(e,location.href);a.hash=``,yield a.href;let o=I(a,t);if(yield o.href,n&&o.pathname.endsWith(`/`)){let e=new URL(o.href);e.pathname+=n,yield e.href}if(r){let e=new URL(o.href);e.pathname+=`.html`,yield e.href}if(i){let e=i({url:a});for(let t of e)yield t.href}}var R=class extends A{constructor(e,t){super(({request:n})=>{let r=e.getURLsToCacheKeys();for(let i of L(n.url,t)){let t=r.get(i);if(t)return{cacheKey:t,integrity:e.getIntegrityForCacheKey(t)}}},e.strategy)}};function z(e){F(new R(O(),e))}var B=`-precache-`,V=async(e,t=B)=>{let n=(await self.caches.keys()).filter(n=>n.includes(t)&&n.includes(self.registration.scope)&&n!==e);return await Promise.all(n.map(e=>self.caches.delete(e))),n};function H(){self.addEventListener(`activate`,(e=>{let t=a.getPrecacheName();e.waitUntil(V(t).then(e=>{}))}))}function U(e){return O().matchPrecache(e)}function W(e){O().precache(e)}function G(e,t){W(e),z(t)}var K={type:`show`,title:`Switchyard`,body:`Something changed. Open Switchyard to see it.`,tag:`switchyard`,url:`/attention`,renotify:!1},q=e=>typeof e==`string`;function J(e){if(!e)return K;let t;try{t=e.json()}catch{let t=``;try{t=e.text()}catch{}return t?{...K,body:t}:K}return t?.type===`clear`&&q(t.tag)?{type:`clear`,tag:t.tag}:t?.type===`show`&&q(t.title)&&q(t.body)&&q(t.tag)&&q(t.url)?{type:`show`,title:t.title,body:t.body,tag:t.tag,url:t.url,renotify:t.renotify===!0}:K}function Y(e,t){let n=t?.data?.url;return{title:`Resolved`,options:{body:t?.title?`${t.title} no longer needs you.`:`A Switchyard item no longer needs you.`,tag:e,silent:!0,renotify:!1,data:{url:q(n)?n:`/attention`,resolved:!0}}}}G([{"revision":"1872c500de691dce40960bb85481de07","url":"registerSW.js"},{"revision":"13547519d4d57ed00992ea3ce674898f","url":"maskable-512.png"},{"revision":"d89c78399d2fb7d10d3e49e5803c031f","url":"index.html"},{"revision":"a2ab6346edf4afa0d3e92efa4eaffda0","url":"icon.svg"},{"revision":"5f6750eb3eac94f14e2c13ebc966b744","url":"icon-512.png"},{"revision":"1d18b7c0ba74b49ffa7c388dd59f33cf","url":"icon-192.png"},{"revision":"d35ba918f4293158ea83e9628573689a","url":"apple-touch-icon.png"},{"revision":null,"url":"assets/yaml-DijMHRDA.js"},{"revision":null,"url":"assets/yaml-DDA_XMNu.js"},{"revision":null,"url":"assets/xml-WY0zc4PG.js"},{"revision":null,"url":"assets/xml-DuKfbPI6.js"},{"revision":null,"url":"assets/workboard-BEcRsjyQ.js"},{"revision":null,"url":"assets/useSwipeTabs-3qLCxSS7.js"},{"revision":null,"url":"assets/useResource-DAMkbbuf.js"},{"revision":null,"url":"assets/useNow-BweXkeWc.js"},{"revision":null,"url":"assets/useBreakpoint-CXotoLeq.js"},{"revision":null,"url":"assets/typescript-j_1H8WHN.js"},{"revision":null,"url":"assets/typescript-Bb1J8qyy.js"},{"revision":null,"url":"assets/tsx-CGosfAUg.js"},{"revision":null,"url":"assets/tsx-BOvsFOI6.js"},{"revision":null,"url":"assets/toml-CcmNWLt0.js"},{"revision":null,"url":"assets/terminal-login-COaZPzQx.js"},{"revision":null,"url":"assets/terminal-BmpsRI95.js"},{"revision":null,"url":"assets/swift-CyEgAFGc.js"},{"revision":null,"url":"assets/states-hcvSpyb1.js"},{"revision":null,"url":"assets/sql-CfM2IJm3.js"},{"revision":null,"url":"assets/sql-CNu3Or2W.js"},{"revision":null,"url":"assets/shellscript-CqHdAlCp.js"},{"revision":null,"url":"assets/shellscript-CVTB3cr6.js"},{"revision":null,"url":"assets/settings-DHfdrqxv.js"},{"revision":null,"url":"assets/search-DarT116I.js"},{"revision":null,"url":"assets/scss-8bKmll0B.js"},{"revision":null,"url":"assets/rust-DpiIf5JO.js"},{"revision":null,"url":"assets/ruby-Bx-U2qjP.js"},{"revision":null,"url":"assets/rotate-ccw-ByDiAA6o.js"},{"revision":null,"url":"assets/rolldown-runtime-XKyaHtl9.js"},{"revision":null,"url":"assets/queue-hRZWM_pM.js"},{"revision":null,"url":"assets/python-gzcpVVnB.js"},{"revision":null,"url":"assets/preload-helper-vwPq19u5.js"},{"revision":null,"url":"assets/prefs-CUMuH2EM.js"},{"revision":null,"url":"assets/policyLogic-DVorBdH6.js"},{"revision":null,"url":"assets/plus-DzBRN9tc.js"},{"revision":null,"url":"assets/play-Dul6ZDzY.js"},{"revision":null,"url":"assets/pencil-BmHgPcCk.js"},{"revision":null,"url":"assets/more-BrHzsSfh.js"},{"revision":null,"url":"assets/lua-fPRBWD-V.js"},{"revision":null,"url":"assets/lua-DjuecEsk.js"},{"revision":null,"url":"assets/logic-CHh1lc3G.js"},{"revision":null,"url":"assets/logic-BOdOYgZ4.js"},{"revision":null,"url":"assets/link-2-Cny9mRKW.js"},{"revision":null,"url":"assets/jsx-D3KKoC5L.js"},{"revision":null,"url":"assets/jsx-C4yDKi0A.js"},{"revision":null,"url":"assets/jsonc-CYpm1nAK.js"},{"revision":null,"url":"assets/json-qhed-kSA.js"},{"revision":null,"url":"assets/javascript-CpIGwZ_Y.js"},{"revision":null,"url":"assets/javascript-BzbQS41l.js"},{"revision":null,"url":"assets/java-_ATy9zCa.js"},{"revision":null,"url":"assets/java-BtIQNnN0.js"},{"revision":null,"url":"assets/index-D3WBnjbc.js"},{"revision":null,"url":"assets/index-Bm6tklht.css"},{"revision":null,"url":"assets/html-BWDvXlHg.js"},{"revision":null,"url":"assets/html-BMn1ogTm.js"},{"revision":null,"url":"assets/haptics-O69vKVoK.js"},{"revision":null,"url":"assets/hand-DStB4fR7.js"},{"revision":null,"url":"assets/grip-vertical-kzr2x5pf.js"},{"revision":null,"url":"assets/go-rLFTqkRN.js"},{"revision":null,"url":"assets/github-light-EUqPIrTm.js"},{"revision":null,"url":"assets/github-dark-C-LZuMrd.js"},{"revision":null,"url":"assets/git-branch-C5Xwi6aW.js"},{"revision":null,"url":"assets/external-link-BHZxy4tb.js"},{"revision":null,"url":"assets/enroll-BJIkw0lm.js"},{"revision":null,"url":"assets/dockerfile-IyjqRm3v.js"},{"revision":null,"url":"assets/diff-woXpYk--.js"},{"revision":null,"url":"assets/describe-B1R7Rpb3.js"},{"revision":null,"url":"assets/css-DgaLhXQH.js"},{"revision":null,"url":"assets/css-BGIxQoYs.js"},{"revision":null,"url":"assets/cpp-DzjeI0uH.js"},{"revision":null,"url":"assets/cpp-Cts1PyIS.js"},{"revision":null,"url":"assets/core.esm-yL4bmFrt.js"},{"revision":null,"url":"assets/code-BuAtgr-5.js"},{"revision":null,"url":"assets/code-B1njb2Cr.css"},{"revision":null,"url":"assets/chevron-right-Q-RTE0ar.js"},{"revision":null,"url":"assets/calendar-clock-CkYP2-Qf.js"},{"revision":null,"url":"assets/c-SSSlmE39.js"},{"revision":null,"url":"assets/c-Cz4nF6n_.js"},{"revision":null,"url":"assets/board-D2LALQcR.js"},{"revision":null,"url":"assets/automations-BYFgPSs2.js"},{"revision":null,"url":"assets/auth-Dzip9fVv.js"},{"revision":null,"url":"assets/attention-AZ2a-mzO.js"},{"revision":null,"url":"assets/arrow-up-CW1a5Bhp.js"},{"revision":null,"url":"assets/arrow-down-Cc6k_L7W.js"},{"revision":null,"url":"assets/api-Dlk6L3Cu.js"},{"revision":null,"url":"assets/UnfilteredNote-CgsOTad1.js"},{"revision":null,"url":"assets/UINodeRenderer-CDPAUIOO.js"},{"revision":null,"url":"assets/TextLink-DMi_ZI43.js"},{"revision":null,"url":"assets/Tabs-Cvyw8P4s.js"},{"revision":null,"url":"assets/Switch-DrrWalaQ.js"},{"revision":null,"url":"assets/StructuredValue-BjKzgQDM.js"},{"revision":null,"url":"assets/Select-CdANXO3X.js"},{"revision":null,"url":"assets/SegmentedControl-CefWecy1.js"},{"revision":null,"url":"assets/ScopeSelect-DmWCXeIf.js"},{"revision":null,"url":"assets/ScopeRepository-BPiPUjHi.js"},{"revision":null,"url":"assets/RadioCards-9YvqB3va.js"},{"revision":null,"url":"assets/Priority-DL3f-tRD.js"},{"revision":null,"url":"assets/Overlay-hRkfpjK4.js"},{"revision":null,"url":"assets/NavigationEditor-COtm2NQY.js"},{"revision":null,"url":"assets/Field-DGV7eljt.js"},{"revision":null,"url":"assets/DangerZone-C6qU1pp7.js"},{"revision":null,"url":"assets/Checkbox-BdFQsqCG.js"},{"revision":null,"url":"assets/AutomationView-I80YGJ3M.js"},{"revision":"a3eb00302b8325cfe5c4836ff54f4b4a","url":"manifest.webmanifest"}]),H(),self.addEventListener(`install`,()=>{self.skipWaiting()}),self.addEventListener(`activate`,e=>{e.waitUntil(self.clients.claim())});var X=/^\/(api|ws|adapter-frames|healthz|readyz)(\/|$)/;self.addEventListener(`fetch`,e=>{let t=e.request;if(t.mode!==`navigate`)return;let n=new URL(t.url);n.origin!==self.location.origin||X.test(n.pathname)||e.respondWith(fetch(t).catch(async()=>await U(`/index.html`)??Response.error()))});var Z=`/icon-192.png`;self.addEventListener(`push`,e=>{let t=J(e.data);e.waitUntil(t.type===`clear`?Q(t.tag):self.registration.showNotification(t.title,{body:t.body,tag:t.tag,data:{url:t.url},renotify:t.renotify,icon:Z,badge:Z}))});async function Q(e){let t=await self.registration.getNotifications({tag:e});if((await self.clients.matchAll({type:`window`,includeUncontrolled:!0})).some(e=>e.visibilityState===`visible`)){for(let e of t)e.close();return}let n=Y(e,t[0]?{title:t[0].title,data:t[0].data}:null);await self.registration.showNotification(n.title,{...n.options,icon:Z,badge:Z})}self.addEventListener(`notificationclick`,e=>{e.notification.close();let t=e.notification.data?.url??`/`,n=new URL(t,self.location.origin).href;e.waitUntil((async()=>{let e=(await self.clients.matchAll({type:`window`,includeUncontrolled:!0})).filter(e=>new URL(e.url).origin===self.location.origin),t=e.find(e=>e.url===n)??e[0];if(t)try{let e=await t.focus()??t;e.url!==n&&e.postMessage({type:`navigate`,url:n});return}catch{}await self.clients.openWindow(n)})())});
|
|
2
2
|
//# sourceMappingURL=sw.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$t as t,D as n,F as r,G as i,Qt as a,Zt as o,_n as s,c,d as l,en as u,ft as d,g as f,hn as p,i as ee,lt as m,m as h,n as g,nn as _,pn as te,r as v,rn as y,s as ne,sn as re,t as b,u as x,v as ie,vn as S,y as C,z as ae}from"./states-goHGz_CJ.js";import{t as oe,u as w,w as T}from"./Overlay-kkZVSidv.js";import{t as E}from"./calendar-clock-C5cMYlld.js";import{a as D,i as O,t as k}from"./SegmentedControl-CCObjCnv.js";import{n as se,r as A,t as ce}from"./Priority-VTOBYjs9.js";import{t as le}from"./play-DjTVY8Ej.js";import{t as ue}from"./plus-BQPgQYui.js";import{n as de,t as fe}from"./DangerZone-tpxj5S8V.js";import{s as pe,t as me}from"./policyLogic-cyMrhCM6.js";import{r as he,t as ge}from"./useBreakpoint-C7ONetzK.js";import{$ as _e,B as ve,G as j,K as M,L as ye,St as be,W as N,_t as xe,ct as Se,dt as P,nt as Ce,vt as we,yt as F,z as Te}from"./index-BXoBPAUR.js";import{t as I}from"./TextLink-BJlPjvKn.js";import{n as Ee,t as L}from"./Field-0rAadZ7B.js";import{n as R,t as z}from"./RadioCards-Oy23yrpF.js";import{t as B}from"./Select-CRC4mF4U.js";import{t as V}from"./Switch-llihKH_2.js";import{E as H,O as De,S as Oe,T as U,a as W,b as ke,d as Ae,f as G,g as K,h as q,i as je,l as Me,m as Ne,n as Pe,o as Fe,p as Ie,r as Le,s as Re,t as ze,u as Be,v as Ve,w as J,x as He,y as Ue}from"./describe-Bd1JbydU.js";var Y={name:`scroll-text`,size:24,node:[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]};Y.node;var We=n(Y),X=e(S(),1),Z=h(),Ge=e=>`/tasks/${encodeURIComponent(e)}`;function Q(e){return y(e)&&(e.status===404||e.status===405||e.status===501)}function Ke({summary:e,errorCount:t}){return(0,Z.jsxs)(R,{stack:!0,title:`Summary`,testId:`automation-summary`,children:[(0,Z.jsx)(`p`,{className:`text-sm break-words`,children:e}),t>0&&(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5 text-sm text-danger`,children:[(0,Z.jsx)(C,{"aria-hidden":!0,className:`size-4 shrink-0`}),t===1?`1 field needs attention`:`${t} fields need attention`]})]})}async function qe(e,t,n){return e&&!n?a(J(e,`/preview`)):u(`/api/automations/preview`,t)}function Je({automationId:e,dirty:t,getInput:n,currentKey:r}){let[i,a]=(0,X.useState)({status:`idle`}),o=async()=>{let r=n();if(!r)M.error(`Fix the highlighted fields to preview the task`);else{a({status:`loading`});try{let n=await qe(e,r,t);a({status:`done`,preview:n,key:JSON.stringify(r)})}catch(e){a(Q(e)?{status:`unsupported`}:{status:`error`,error:e})}}};return(0,Z.jsxs)(R,{stack:!0,title:`Preview`,description:`See the task an occurrence would create, and when it would run next.`,testId:`automation-preview`,children:[(0,Z.jsx)(`div`,{children:(0,Z.jsx)(l,{icon:(0,Z.jsx)(P,{className:`size-4`}),busy:i.status===`loading`,onClick:()=>void o(),children:`Preview resulting task`})}),i.status===`unsupported`&&(0,Z.jsx)(x,{capability:`Task preview`,reason:`This coordinator does not offer automation previews.`,fallback:`Read the summary above, or save and use Run now to see a real task.`}),i.status===`error`&&(0,Z.jsx)(g,{compact:!0,title:`Could not preview`,error:i.error,onRetry:()=>void o()}),i.status===`done`&&(0,Z.jsx)(Ye,{preview:i.preview,stale:i.key!==r})]})}function Ye({preview:e,stale:t}){let{task:n}=e;return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[t&&(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-warning`,role:`status`,children:[(0,Z.jsx)(C,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),`The form changed since this preview. Preview again to refresh it.`]}),(0,Z.jsx)(`p`,{className:`text-sm break-words text-muted`,children:e.summary}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 rounded-md border border-border bg-surface-2 p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`min-w-0 font-medium break-words`,children:n.title}),(0,Z.jsx)(se,{priority:n.priority,muted:!0,className:`shrink-0 text-xs`})]}),n.objective?(0,Z.jsx)(`p`,{className:`text-sm break-words whitespace-pre-wrap`,children:n.objective}):(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No objective.`}),n.acceptanceCriteria.length>0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`h4`,{className:`flex items-center gap-1 text-xs font-medium text-muted`,children:[(0,Z.jsx)(T,{"aria-hidden":!0,className:`size-3.5`}),`Acceptance criteria`]}),(0,Z.jsx)(`ul`,{className:`mt-1 list-disc pl-5 text-sm`,children:n.acceptanceCriteria.map((e,t)=>(0,Z.jsx)(`li`,{className:`break-words`,children:e},t))})]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium`,children:`Next occurrences`}),e.next.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No scheduled times: this trigger fires on demand, on a webhook, or when a task is done.`}):(0,Z.jsx)(`ol`,{className:`mt-1 flex flex-col gap-0.5 text-sm`,children:e.next.slice(0,5).map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap gap-x-2`,children:[(0,Z.jsx)(`time`,{dateTime:e,children:Ie(e)}),(0,Z.jsx)(`span`,{className:`text-muted`,children:f(e)})]},e))})]})]})}function Xe({label:e,value:t,mono:n=!0}){return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:e}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 flex-1 rounded border border-border bg-surface px-2 py-1.5 text-xs break-all select-all ${n?`font-mono`:``}`,children:t}),(0,Z.jsx)(l,{size:`sm`,icon:(0,Z.jsx)(D,{className:`size-3.5`}),onClick:()=>void O(t,`${e} copied`),"aria-label":`Copy ${e.toLowerCase()}`,children:`Copy`})]})]})}function Ze({automation:e}){let[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)(!1),d=e.webhookTokenSet||a!==null,f=async()=>{i(!1),n(!0);try{let t=await u(J(e.id,`/webhook-token`)),n=m.safeParse(t);if(!n.success)throw Error(`The coordinator returned an unexpected token response`);let r=new URL(n.data.url,window.location.origin).toString();o({token:n.data.token,url:r}),M.success(d?`Webhook token rotated`:`Webhook token created`)}catch(e){Q(e)?c(!0):M.error(`Could not issue a webhook token: ${_(e)}`)}finally{n(!1)}};return(0,Z.jsxs)(R,{stack:!0,title:`Webhook`,description:`POST JSON to the URL with the token as a Bearer header. Filters decide which payloads fire.`,testId:`webhook-token`,children:[(0,Z.jsx)(`p`,{className:`flex items-center gap-1.5 text-sm`,children:d?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(F,{"aria-hidden":!0,className:`size-4 shrink-0 text-success`}),`A token is set`]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted`}),`No token yet: webhook calls are rejected until you create one`]})}),s?(0,Z.jsx)(x,{capability:`Webhook tokens`,reason:`This coordinator does not issue webhook tokens.`}):(0,Z.jsx)(`div`,{children:(0,Z.jsx)(l,{icon:(0,Z.jsx)(Se,{className:`size-4`}),busy:t,onClick:()=>d?i(!0):void f(),children:d?`Rotate token`:`Create token`})}),a&&(0,Z.jsxs)(`div`,{role:`alert`,className:`flex min-w-0 flex-col gap-3 rounded-md border border-warning bg-warning-soft p-3`,children:[(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5 text-sm font-medium`,children:[(0,Z.jsx)(C,{"aria-hidden":!0,className:`size-4 shrink-0 text-warning`}),`This token is shown once. Copy it now.`]}),(0,Z.jsx)(Xe,{label:`Token`,value:a.token}),(0,Z.jsx)(Xe,{label:`URL`,value:a.url}),(0,Z.jsx)(Xe,{label:`Example`,value:Fe(a.token,a.url)}),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(l,{size:`sm`,onClick:()=>o(null),children:`I have copied it`})})]}),(0,Z.jsx)(oe,{open:r,onClose:()=>i(!1),title:`Rotate webhook token?`,description:`The current token stops working immediately. Update every sender with the new token.`,confirmLabel:`Rotate token`,busy:t,onConfirm:()=>void f()})]})}var Qe=[];function $e({automationId:e,refreshKey:t,onRun:n}){let r=i(t=>t.occurrences[e]??Qe),o=i(e=>e.tasks),[s,l]=(0,X.useState)({status:`loading`}),u=(0,X.useCallback)(async t=>{l(e=>e.status===`done`?e:{status:`loading`});try{let n=await a(J(e,`/history`),{},t);l({status:`done`,items:Ve(n)})}catch(e){if(t?.aborted)return;l(Q(e)?{status:`unsupported`}:{status:`error`,error:e})}},[e]);(0,X.useEffect)(()=>{let e=new AbortController;return u(e.signal),()=>e.abort()},[u,t]);let d=K(s.status===`done`?s.items:[],r);return(0,Z.jsxs)(R,{stack:!0,title:`History`,description:`Occurrences of this automation. Routine successes are hidden from the board and appear only here.`,testId:`automation-history`,children:[s.status===`unsupported`&&(0,Z.jsx)(x,{capability:`Automation history`,reason:`This coordinator does not serve stored history; only occurrences seen live in this session are shown.`}),s.status===`error`&&(0,Z.jsx)(g,{compact:!0,title:`Could not load history`,error:s.error,onRetry:()=>void u()}),s.status===`loading`&&d.length===0?(0,Z.jsx)(c,{label:`Loading history…`,className:`py-4`}):d.length===0&&s.status!==`error`?(0,Z.jsx)(b,{className:`py-4`,icon:(0,Z.jsx)(We,{className:`size-6`}),title:`No occurrences yet`,description:`Occurrences appear here when the trigger fires or you run it.`,action:{label:`Run now`,onClick:n,icon:(0,Z.jsx)(le,{className:`size-4`})}}):(0,Z.jsx)(`ol`,{className:`flex flex-col divide-y divide-border`,children:d.map(e=>{let t=Ue(e),n=e.taskId?o[e.taskId]:void 0,r=[e.reason,e.outcome].filter(Boolean).join(` · `);return(0,Z.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-1 py-2 first:pt-0 last:pb-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,Z.jsx)(_e,{kind:`occurrence`,value:e.state,size:`sm`}),(0,Z.jsx)(`time`,{dateTime:t,className:`text-sm`,children:Ie(t)}),(0,Z.jsx)(`span`,{className:`text-xs text-muted`,children:f(t)})]}),r&&(0,Z.jsx)(`p`,{className:`text-sm break-words text-muted`,children:r}),e.taskId&&(0,Z.jsxs)(I,{to:Ge(e.taskId),variant:`action`,size:`sm`,className:`self-start`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:n?`Task: ${n.title}`:`Open task`}),n?.hiddenFromBoard&&(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted`,children:`(hidden from board)`})]})]},e.id)})})]})}var et=`/automations`,tt=e=>`/automations/${encodeURIComponent(e)}`,nt=`sy:automation-draft`;function rt(){let{automationId:e=`new`}=s();return(0,Z.jsx)(it,{automationId:e},e)}function it({automationId:e}){let t=e===`new`,n=i(e=>e.hydrated),r=H(t?void 0:e),[o,s]=(0,X.useState)({status:`idle`}),l=(0,X.useCallback)(async()=>{s({status:`loading`});try{let t=await a(J(e)),n=d.safeParse(t);if(!n.success){s({status:`fatal`,error:Error(`The coordinator returned this automation in an unexpected format.`)});return}U.getState().put(n.data),s({status:`idle`})}catch(e){y(e)&&e.status===404?s({status:`notfound`}):s({status:`error`,error:e})}},[e]),u=!t&&!r;return(0,X.useEffect)(()=>{u&&o.status===`idle`&&l()},[u,o.status,l]),t?(0,Z.jsx)(ct,{automation:null}):r?(0,Z.jsx)(ct,{automation:r}):o.status===`notfound`?(0,Z.jsx)(b,{icon:(0,Z.jsx)(Ce,{className:`size-8`}),title:`Automation not found`,description:`It may have been deleted, or the link is wrong.`,action:{label:`Back to automations`,to:et}}):o.status===`error`?(0,Z.jsx)(g,{title:`Could not load this automation`,error:o.error,onRetry:()=>void l()}):o.status===`fatal`?(0,Z.jsx)(v,{error:o.error}):(0,Z.jsx)(c,{label:n?`Loading automation…`:`Loading…`})}function at(e){let t=Ae({projectId:e,timezone:q()});try{let e=sessionStorage.getItem(nt);if(!e)return t;let n=JSON.parse(e);return!n||typeof n!=`object`?t:{...t,...n,filters:Array.isArray(n.filters)?n.filters:[]}}catch{return t}}function ot(e){try{e?sessionStorage.setItem(nt,JSON.stringify(e)):sessionStorage.removeItem(nt)}catch{}}var $=e=>JSON.stringify(Be(e));function st(e){if(!y(e))return{};let t=e.details,n=Array.isArray(t)?t:t&&typeof t==`object`&&Array.isArray(t.issues)?t.issues:[],r={};for(let e of n){if(!e||typeof e!=`object`)continue;let{path:t,message:n}=e;if(!Array.isArray(t)||typeof n!=`string`)continue;let i=G(t);i!==`form`&&!r[i]&&(r[i]=n)}return r}function ct({automation:e}){let n=p(),a=te(),s=ve(et),c=ge();ye(c===`mobile`?s:null);let d=c===`desktop`,f=ae(),m=r(),h=i(e=>e.hosts),g=i(e=>e.profiles),v=i(e=>e.tasks),y=i(e=>e.projects),b=e===null,x=(0,X.useId)(),S=(0,X.useRef)(null),[w,T]=(0,X.useState)(()=>e?Me(e):at(f[0]?.id)),[E,D]=(0,X.useState)(()=>$(w)),[O,k]=(0,X.useState)(!1),[se,A]=(0,X.useState)({}),[ce,ue]=(0,X.useState)(!1),[me,_e]=(0,X.useState)(!1),[j,N]=(0,X.useState)(!1),[Se,P]=(0,X.useState)(!1),[Ce,we]=(0,X.useState)(0),F=(0,X.useRef)(e?.updatedAt),I=$(w),L=I!==E;(0,X.useEffect)(()=>{if(!e||e.updatedAt===F.current)return;F.current=e.updatedAt;let t=Me(e),n=$(t);I===E?(T(t),P(!1)):n!==I&&P(!0),D(n)},[e,I,E]),(0,X.useEffect)(()=>{b&&ot(w)},[b,w]),(0,X.useEffect)(()=>{b&&!w.projectId&&f[0]&&T(e=>e.projectId?e:{...e,projectId:f[0].id})},[b,w.projectId,f]);let R=(0,X.useCallback)((e,t)=>{T(n=>({...n,[e]:t})),A(e=>Object.keys(e).length?{}:e)},[]),z=(0,X.useMemo)(()=>Oe(w),[w]),B={...se,...O?z.errors:{}},V=e=>B[e],H=y[w.projectId],W=w.hostId||H?.defaultHostId||null,G=W?h[W]:void 0,K=w.profileId||H?.defaultProfileId||null,je=(0,X.useCallback)(e=>v[e]?.title,[v]),Ne=(0,X.useMemo)(()=>ke(Be(w),{projectName:H?.name,hostName:w.hostId?h[w.hostId]?.name??null:null,profileName:w.profileId?g[w.profileId]?.name??null:null,taskTitle:je}),[w,H?.name,h,g,je]),Pe=()=>{requestAnimationFrame(()=>{S.current?.querySelector(`[aria-invalid="true"]`)?.focus()})},Fe=()=>(k(!0),z.input||Pe(),z.input),Ie=async()=>{let r=Fe();if(!r)M.error(`Fix the highlighted fields before saving`);else{ue(!0);try{if(b){let e=await u(`/api/automations`,r);if(!e||typeof e!=`object`||!e.id)throw Error(`The coordinator did not return the new automation`);U.getState().put(e),ot(null),M.success(`Created ${e.name}`),n(tt(e.id),{replace:!0,state:a.state});return}let i=await t(J(e.id),r);if(i&&typeof i==`object`&&i.id){U.getState().put(i),F.current=i.updatedAt;let e=Me(i);T(e),D($(e))}else D(I);P(!1),k(!1),M.success(`Saved ${r.name}`)}catch(e){let t=st(e);A(t),Object.keys(t).length&&Pe(),M.error(`Could not save: ${_(e)}. Your changes are kept.`)}finally{ue(!1)}}},Le=async()=>{if(e){_e(!0);try{await o(J(e.id)),N(!1),M.success(`Deleted ${e.name}`),s(),U.getState().remove(e.id)}catch(e){M.error(`Could not delete: ${_(e)}`)}finally{_e(!1)}}},{busy:Re,run:ze}=De(()=>we(e=>e+1)),Ve=e?!!Re[e.id]:!1,He=()=>e&&void ze(e),Ue=()=>{let e=Ae({projectId:f[0]?.id,timezone:q()});T(e),k(!1),ot(null)},Y=b?`New automation`:e.name,We=(0,Z.jsxs)(Z.Fragment,{children:[!b&&(0,Z.jsx)(l,{icon:(0,Z.jsx)(le,{className:`size-4`}),busy:Ve,onClick:He,title:L?`Runs the saved version`:void 0,children:`Run now`}),b&&L&&(0,Z.jsx)(l,{variant:`ghost`,icon:(0,Z.jsx)(he,{className:`size-4`}),onClick:Ue,children:`Discard draft`})]}),Ge=e=>(0,Z.jsx)(l,{type:`submit`,form:x,variant:`primary`,busy:ce,block:e,icon:(0,Z.jsx)(de,{className:`size-4`}),children:b?`Create automation`:`Save`}),Q=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ke,{summary:Ne,errorCount:O?Object.keys(z.errors).length:0}),(0,Z.jsx)(Je,{automationId:e?.id??null,dirty:L,getInput:Fe,currentKey:JSON.stringify(z.input)}),e&&e.trigger.kind===`webhook`&&(0,Z.jsx)(Ze,{automation:e}),e&&(0,Z.jsx)($e,{automationId:e.id,refreshKey:Ce,onRun:He})]});return(0,Z.jsxs)(`div`,{"data-testid":`automation-editor`,className:`flex w-full min-w-0 flex-col gap-4 px-4 pt-4 md:px-6`,children:[(0,Z.jsxs)(`header`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsxs)(re,{to:et,onClick:Te(s),className:`tap inline-flex items-center gap-1 self-start rounded text-sm text-muted hover:text-text`,children:[(0,Z.jsx)(be,{"aria-hidden":!0,className:`size-4`}),`Automations`]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`min-w-0 text-lg font-semibold break-words`,children:Y}),L&&(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted`,children:[(0,Z.jsx)(xe,{"aria-hidden":!0,className:`size-3.5`}),`Unsaved changes`]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[We,d&&Ge()]})]})]}),(0,Z.jsx)(ne,{subject:`automations`,consequence:`Changes are sent once the coordinator is reachable again.`}),G&&G.connectivity!==`connected`&&(0,Z.jsx)(ee,{compact:!0,hostName:G.name,connectivity:G.connectivity,lastSeenAt:G.lastSeenAt,detail:`Occurrences are still recorded; their tasks wait until the host is reachable.`}),Se&&(0,Z.jsxs)(`p`,{role:`status`,className:`flex items-start gap-1.5 rounded-md border border-border bg-warning-soft px-3 py-2 text-sm`,children:[(0,Z.jsx)(C,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-warning`}),`This automation changed elsewhere. Saving overwrites those changes with yours.`]}),(0,Z.jsxs)(`div`,{className:ie(`grid min-w-0 gap-4`,d?`grid-cols-[minmax(0,1fr)_minmax(320px,400px)] items-start`:`grid-cols-1`),children:[(0,Z.jsxs)(`form`,{id:x,ref:S,noValidate:!0,"aria-label":Y,onSubmit:e=>{e.preventDefault(),Ie()},className:`flex min-w-0 flex-col gap-4`,children:[(0,Z.jsx)(lt,{draft:w,update:R,err:V,projects:f}),(0,Z.jsx)(ft,{draft:w,update:R,err:V,tasks:v,projectsById:y,savedAutomation:e,segmented:c!==`mobile`}),(0,Z.jsx)(pt,{draft:w,setDraft:T,err:V}),(0,Z.jsx)(mt,{draft:w,update:R,err:V}),(0,Z.jsx)(ht,{draft:w,update:R,err:V,hosts:m,profiles:Object.values(g).sort((e,t)=>e.name.localeCompare(t.name)),defaultHostName:H?.defaultHostId?h[H.defaultHostId]?.name:void 0,defaultProfileName:H?.defaultProfileId?g[H.defaultProfileId]?.name:void 0,selectedProfileMissing:!!K&&!g[K]}),(0,Z.jsx)(gt,{draft:w,update:R}),(0,Z.jsx)(_t,{draft:w,update:R,err:V}),(0,Z.jsx)(vt,{draft:w,update:R,err:V,projectChecks:H?.checks}),B.form&&(0,Z.jsx)(Ee,{children:B.form})]}),(0,Z.jsx)(`aside`,{"aria-label":`Summary, preview and history`,className:`flex min-w-0 flex-col gap-4`,children:Q})]}),!b&&e&&(0,Z.jsx)(fe,{description:`Future occurrences stop. Tasks it already created stay on the board; its history is removed.`,children:(0,Z.jsx)(l,{variant:`danger`,icon:(0,Z.jsx)(pe,{className:`size-4`}),onClick:()=>N(!0),children:`Delete automation`})}),d?(0,Z.jsx)(`div`,{className:`h-4`}):(0,Z.jsxs)(`div`,{className:`sticky bottom-0 z-10 -mx-4 flex items-center gap-3 border-t border-border bg-surface px-4 py-2 md:-mx-6 md:px-6`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-muted`,children:L?`Unsaved changes`:b?`Not saved yet`:`All changes saved`}),Ge()]}),(0,Z.jsx)(oe,{open:j,onClose:()=>N(!1),title:`Delete ${e?.name??`automation`}?`,description:`Future occurrences stop. Tasks it already created stay on the board; its history is removed.`,confirmLabel:`Delete automation`,confirmIcon:(0,Z.jsx)(pe,{className:`size-4`}),busy:me,onConfirm:()=>void Le()})]})}function lt({draft:e,update:t,err:n,projects:r}){return(0,Z.jsxs)(R,{stack:!0,title:`Basics`,children:[(0,Z.jsx)(L,{label:`Name`,error:n(`name`),children:n=>(0,Z.jsx)(j,{...n,value:e.name,onChange:e=>t(`name`,e.target.value),placeholder:`Daily dependency check`,autoComplete:`off`})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(L,{label:`Project`,error:n(`projectId`),hint:r.length===0?(0,Z.jsxs)(Z.Fragment,{children:[`No active projects.`,` `,(0,Z.jsx)(I,{to:`/settings/projects`,children:`Connect a repository in Settings`}),`.`]}):void 0,children:n=>(0,Z.jsxs)(B,{...n,value:e.projectId,onChange:e=>t(`projectId`,e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`Choose a project`}),r.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),(0,Z.jsx)(L,{label:`Status`,hint:`Disabled automations keep their history and can still run manually.`,children:n=>(0,Z.jsx)(V,{...n,checked:e.enabled,onChange:e=>t(`enabled`,e),label:`Enabled`,onText:`Enabled`,offText:`Disabled`,className:`self-start`})})]})]})}var ut=[`manual`,`once`,`cron`,`webhook`,`dependency`],dt={manual:`Runs only when you press Run now (or from the CLI).`,once:`Runs a single time at the chosen moment.`,cron:`Runs on a timezone-aware cron schedule.`,webhook:`Runs when an authenticated JSON POST arrives at this automation's webhook URL.`,dependency:`Runs when the chosen task is done.`};function ft({draft:e,update:t,err:n,tasks:r,projectsById:a,savedAutomation:o,segmented:s}){let c=i(e=>e.hydrated),l=e.triggerKind===`cron`?He(e.cronExpr):null,u=e.triggerKind===`cron`&&!l?Re(e.cronExpr,e.cronTimezone.trim()||void 0)??`Valid expression (no plain-language description available)`:null,d=(0,X.useMemo)(()=>{try{return Intl.supportedValuesOf?.(`timeZone`)}catch{return}},[]),f=(0,X.useId)(),p=q(),ee=(0,X.useMemo)(()=>Object.values(r).filter(t=>t.state!==`canceled`||t.id===e.dependencyTaskId).sort((e,t)=>e.title.localeCompare(t.title)),[r,e.dependencyTaskId]),m=e.triggerKind===`once`?Ne(e.onceAt):``;return(0,Z.jsxs)(R,{stack:!0,title:`Trigger`,description:dt[e.triggerKind],children:[s?(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`text-sm font-medium`,children:`Trigger kind`}),(0,Z.jsx)(`div`,{className:`overflow-x-auto overscroll-x-contain`,children:(0,Z.jsx)(k,{label:`Trigger kind`,value:e.triggerKind,onChange:e=>t(`triggerKind`,e),options:ut.map(e=>({value:e,label:W[e]}))})})]}):(0,Z.jsx)(L,{label:`Trigger kind`,children:n=>(0,Z.jsx)(B,{...n,value:e.triggerKind,onChange:e=>t(`triggerKind`,e.target.value),children:ut.map(e=>(0,Z.jsx)(`option`,{value:e,children:W[e]},e))})}),e.triggerKind===`once`&&(0,Z.jsx)(L,{label:`Run at`,error:n(`onceAt`),hint:`Local time (${p})${m?`; saved as ${m}`:``}.`,children:n=>(0,Z.jsx)(j,{...n,type:`datetime-local`,value:e.onceAt,onChange:e=>t(`onceAt`,e.target.value)})}),e.triggerKind===`cron`&&(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(L,{label:`Cron expression`,error:n(`cronExpr`)??l??void 0,hint:`minute hour day-of-month month day-of-week, e.g. 0 9 * * 1-5`,children:n=>(0,Z.jsx)(j,{...n,"aria-invalid":l?!0:n[`aria-invalid`],value:e.cronExpr,onChange:e=>t(`cronExpr`,e.target.value),className:`font-mono`,autoComplete:`off`,spellCheck:!1,autoCapitalize:`off`})}),(0,Z.jsx)(L,{label:`Timezone`,error:n(`cronTimezone`),hint:e.cronTimezone.trim()===p?`IANA timezone name; daylight saving is handled.`:(0,Z.jsxs)(I,{onClick:()=>t(`cronTimezone`,p),children:[`Use this device's timezone (`,p,`)`]}),children:n=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(j,{...n,list:d?f:void 0,value:e.cronTimezone,onChange:e=>t(`cronTimezone`,e.target.value),autoComplete:`off`,spellCheck:!1,autoCapitalize:`off`}),d&&(0,Z.jsx)(`datalist`,{id:f,children:d.map(e=>(0,Z.jsx)(`option`,{value:e},e))})]})}),u&&(0,Z.jsxs)(`p`,{className:`flex items-start gap-1.5 text-sm sm:col-span-2`,"aria-live":`polite`,"data-testid":`cron-description`,children:[(0,Z.jsx)(E,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-muted`}),(0,Z.jsx)(`span`,{className:`min-w-0 break-words`,children:u})]})]}),e.triggerKind===`webhook`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm text-muted`,children:[(0,Z.jsxs)(`p`,{children:[`Senders POST a JSON body (up to 256 KB) with`,` `,(0,Z.jsx)(`code`,{children:`Authorization: Bearer <token>`}),`. Use the filters below to fire only for matching payloads, and `,(0,Z.jsx)(`code`,{children:`{{payload.<path>}}`}),` to copy payload values into the task.`]}),o?o.trigger.kind===`webhook`?(0,Z.jsxs)(`p`,{children:[`Token:`,` `,o.webhookTokenSet?`set (see Webhook below to rotate)`:`not created yet`]}):(0,Z.jsx)(`p`,{children:`Save to switch this automation to a webhook trigger, then create a token.`}):(0,Z.jsx)(`p`,{children:`Save the automation to create its webhook token and URL.`})]}),e.triggerKind===`dependency`&&(0,Z.jsx)(L,{label:`When this task is done`,error:n(`dependencyTaskId`),hint:`Fires once each time the task enters Done.`,children:n=>(0,Z.jsxs)(B,{...n,value:e.dependencyTaskId,onChange:e=>t(`dependencyTaskId`,e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`Choose a task`}),e.dependencyTaskId&&!r[e.dependencyTaskId]&&(0,Z.jsx)(`option`,{value:e.dependencyTaskId,children:c?`Deleted task`:`Loading task…`}),ee.map(e=>(0,Z.jsxs)(`option`,{value:e.id,children:[e.title,a[e.projectId]?` (${a[e.projectId].name})`:``,e.state===`done`?` - done`:``]},e.id))]})})]})}function pt({draft:e,setDraft:t,err:n}){let r=(e,n)=>t(t=>({...t,filters:t.filters.map((t,r)=>r===e?{...t,...n}:t)})),i=e.triggerKind===`webhook`;return(0,Z.jsxs)(R,{stack:!0,title:`Filters`,description:`Filters apply to webhook payloads. Each row compares a dot path (for example pull_request.base.ref) with an exact value; all rows must match. Payloads that do not match are recorded as Filtered out.`,children:[!i&&(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`Filters are ignored unless the trigger is Webhook.`}),e.filters.length===0&&(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No filters: every payload fires.`}),e.filters.map((e,i)=>(0,Z.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-end gap-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto]`,children:[(0,Z.jsx)(L,{label:`Path ${i+1}`,error:n(`filters.${i}.path`),children:t=>(0,Z.jsx)(j,{...t,value:e.path,onChange:e=>r(i,{path:e.target.value}),placeholder:`action`,className:`font-mono`,autoCapitalize:`off`,spellCheck:!1})}),(0,Z.jsx)(L,{label:`Equals ${i+1}`,error:n(`filters.${i}.equals`),className:`col-start-1 row-start-2 sm:col-start-auto sm:row-start-auto`,children:t=>(0,Z.jsx)(j,{...t,value:e.equals,onChange:e=>r(i,{equals:e.target.value}),placeholder:`opened`})}),(0,Z.jsx)(w,{label:`Remove filter ${i+1}`,icon:(0,Z.jsx)(he,{className:`size-4`}),onClick:()=>t(e=>({...e,filters:e.filters.filter((e,t)=>t!==i)}))})]},i)),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(l,{size:`sm`,icon:(0,Z.jsx)(ue,{className:`size-3.5`}),onClick:()=>t(e=>({...e,filters:[...e.filters,{path:``,equals:``}]})),children:`Add filter`})})]})}function mt({draft:e,update:t,err:n}){return(0,Z.jsxs)(R,{stack:!0,title:`Task template`,description:`Use ${je.join(`, `)} in the title, objective, criteria and grouping key.`,children:[(0,Z.jsx)(L,{label:`Task title`,error:n(`title`),children:n=>(0,Z.jsx)(j,{...n,value:e.title,onChange:e=>t(`title`,e.target.value),placeholder:`Triage new issues for {{date}}`})}),(0,Z.jsx)(L,{label:`Objective`,error:n(`objective`),children:n=>(0,Z.jsx)(N,{...n,minRows:4,value:e.objective,onChange:e=>t(`objective`,e.target.value)})}),(0,Z.jsx)(L,{label:`Acceptance criteria`,error:n(`criteria`),hint:`One criterion per line.`,optional:!0,children:n=>(0,Z.jsx)(N,{...n,minRows:3,value:e.criteria,onChange:e=>t(`criteria`,e.target.value)})}),(0,Z.jsx)(L,{label:`Priority`,error:n(`priority`),children:n=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(ce,{priority:e.priority}),(0,Z.jsx)(A,{...n,value:e.priority,onChange:e=>t(`priority`,e),className:`sm:max-w-48`})]})})]})}function ht({draft:e,update:t,err:n,hosts:r,profiles:i,defaultHostName:a,defaultProfileName:o,selectedProfileMissing:s}){return(0,Z.jsxs)(R,{stack:!0,title:`Where and how it runs`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(L,{label:`Host`,error:n(`hostId`),children:n=>(0,Z.jsxs)(B,{...n,value:e.hostId,onChange:e=>t(`hostId`,e.target.value),children:[(0,Z.jsxs)(`option`,{value:``,children:[`Project default`,a?` (${a})`:``]}),e.hostId&&!r.some(t=>t.id===e.hostId)&&(0,Z.jsx)(`option`,{value:e.hostId,children:`Unknown host`}),r.map(e=>(0,Z.jsxs)(`option`,{value:e.id,children:[e.name,e.connectivity===`connected`?``:` (${e.connectivity})`]},e.id))]})}),(0,Z.jsx)(L,{label:`Profile`,error:n(`profileId`),hint:s?`The selected profile is no longer available.`:void 0,children:n=>(0,Z.jsxs)(B,{...n,value:e.profileId,onChange:e=>t(`profileId`,e.target.value),children:[(0,Z.jsxs)(`option`,{value:``,children:[`Project default`,o?` (${o})`:``]}),e.profileId&&!i.some(t=>t.id===e.profileId)&&(0,Z.jsx)(`option`,{value:e.profileId,children:`Unknown profile`}),i.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id))]})})]}),(0,Z.jsx)(z,{legend:`Mode`,value:e.mode,options:Pe,onChange:e=>t(`mode`,e)}),(0,Z.jsx)(L,{label:`Grouping key`,optional:e.mode!==`continue`,error:n(`groupingKey`),hint:`Occurrences with the same rendered key are the same work: Continue reuses that task and overlap checks compare it. Supports template variables, e.g. pr-{{payload.number}}.`,children:n=>(0,Z.jsx)(j,{...n,value:e.groupingKey,onChange:e=>t(`groupingKey`,e.target.value),className:`font-mono`,autoCapitalize:`off`,spellCheck:!1})})]})}function gt({draft:e,update:t}){let n=e.triggerKind===`cron`||e.triggerKind===`once`;return(0,Z.jsxs)(R,{stack:!0,title:`Overlap and missed runs`,children:[(0,Z.jsx)(z,{legend:`When previous work is still open`,value:e.overlap,options:Le,onChange:e=>t(`overlap`,e)}),(0,Z.jsx)(z,{legend:`Missed runs`,value:e.missed,options:ze,onChange:e=>t(`missed`,e),hint:n?`A run is missed when the coordinator was down at its scheduled time.`:`Only applies to Schedule and Once triggers.`})]})}function _t({draft:e,update:t,err:n}){return(0,Z.jsxs)(R,{stack:!0,title:`Limits`,description:`Continuation prompts the agent to keep going after a turn ends without finishing. It is off by default.`,children:[(0,Z.jsx)(L,{label:`Automatic continuation`,children:n=>(0,Z.jsx)(V,{...n,checked:e.continuationEnabled,onChange:e=>t(`continuationEnabled`,e),label:`Automatic continuation`,className:`self-start`})}),e.continuationEnabled&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(L,{label:`Continuation objective`,error:n(`continuationObjective`),hint:`What the agent must achieve before it reports done.`,children:n=>(0,Z.jsx)(N,{...n,minRows:2,value:e.continuationObjective,onChange:e=>t(`continuationObjective`,e.target.value)})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(L,{label:`Max continuations`,error:n(`maxContinuations`),hint:`1–50`,children:n=>(0,Z.jsx)(j,{...n,type:`number`,inputMode:`numeric`,min:1,max:50,step:1,value:e.maxContinuations,onChange:e=>t(`maxContinuations`,e.target.value)})}),(0,Z.jsx)(L,{label:`Max elapsed minutes`,error:n(`maxElapsedMinutes`),hint:`1–1440`,children:n=>(0,Z.jsx)(j,{...n,type:`number`,inputMode:`numeric`,min:1,max:1440,step:1,value:e.maxElapsedMinutes,onChange:e=>t(`maxElapsedMinutes`,e.target.value)})}),(0,Z.jsx)(L,{label:`Continuation budget: tokens`,optional:!0,error:n(`maxTokens`),children:n=>(0,Z.jsx)(j,{...n,type:`number`,inputMode:`numeric`,min:1,step:1,value:e.maxTokens,onChange:e=>t(`maxTokens`,e.target.value)})}),(0,Z.jsx)(L,{label:`Continuation budget: cost (USD)`,optional:!0,error:n(`maxCostUsd`),children:n=>(0,Z.jsx)(j,{...n,type:`number`,inputMode:`decimal`,min:.01,step:.01,value:e.maxCostUsd,onChange:e=>t(`maxCostUsd`,e.target.value)})})]}),(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:me})]})]})}function vt({draft:e,update:t,err:n,projectChecks:r}){let i=r&&r.length>0?`the project's checks (${r.join(`, `)})`:`the project's checks`;return(0,Z.jsxs)(R,{stack:!0,title:`Review`,children:[(0,Z.jsx)(L,{label:`Checks`,optional:!0,error:n(`checks`),hint:`One command per line. Leave empty to use ${i}.`,children:n=>(0,Z.jsx)(N,{...n,minRows:2,value:e.checks,onChange:e=>t(`checks`,e.target.value),className:`font-mono`,spellCheck:!1,autoCapitalize:`off`})}),(0,Z.jsx)(L,{label:`Human review`,hint:`When on, finished work waits in Review for you instead of completing on passing checks.`,children:n=>(0,Z.jsx)(V,{...n,checked:e.requireHumanReview,onChange:e=>t(`requireHumanReview`,e),label:`Require human review`,onText:`Required`,offText:`Not required`,className:`self-start`})})]})}export{rt as default};
|
|
2
|
-
//# sourceMappingURL=AutomationView-BiSxKpgA.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$t as t,Bt as n,D as r,F as i,G as a,It as o,Lt as s,Mt as c,Qt as l,Rt as u,S as d,Zt as f,_ as p,a as m,c as h,d as g,en as _,f as v,g as y,hn as b,m as x,n as S,nn as C,rn as w,sn as T,v as E,vn as D,z as O}from"./states-goHGz_CJ.js";import{a as k,n as A,t as j,y as M}from"./Overlay-kkZVSidv.js";import{s as N}from"./auth-vd8OFoQx.js";import{y as P}from"./preload-helper-B_HW6k8N.js";import{a as ee,o as F}from"./SegmentedControl-CCObjCnv.js";import{t as I}from"./external-link-DeLk0jmb.js";import{t as te}from"./plus-BQPgQYui.js";import{t as ne}from"./search-bqDM8qB0.js";import{F as re,G as L,K as R,O as z,W as B,ct as ie,j as V,t as ae,u as oe}from"./index-BXoBPAUR.js";import{t as H}from"./TextLink-BJlPjvKn.js";import{r as se,t as U}from"./Field-0rAadZ7B.js";import{n as W,t as ce}from"./RadioCards-Oy23yrpF.js";import{t as le}from"./Select-CRC4mF4U.js";import{n as G}from"./Switch-llihKH_2.js";import{n as ue}from"./ScopeSelect-7ZYRzci5.js";import{t as K}from"./Checkbox-CneW7ZHn.js";var de={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};de.node;var fe=r(de),pe={name:`square-terminal`,size:24,node:[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]],aliases:[`terminal-square`]};pe.node;var me=r(pe),q=e(D(),1),J=x();function he({value:e,min:t,max:n,onChange:r,label:i,pane:a=`before`,step:o=16,onReset:s,orientation:c=`vertical`,className:l}){let u=(0,q.useRef)(null),d=e=>Math.round(Math.min(n,Math.max(t,e))),f=a===`before`?1:-1,p=c===`horizontal`,m=p?`ArrowDown`:`ArrowRight`,h=p?`ArrowUp`:`ArrowLeft`;return(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":c,"aria-label":i,"aria-valuenow":Math.round(e),"aria-valuemin":t,"aria-valuemax":n,tabIndex:0,className:E(`group relative z-10 shrink-0 touch-none select-none`,p?`h-1.5 w-full cursor-row-resize`:`w-1.5 cursor-col-resize`,`focus-visible:outline-none`,l),onPointerDown:t=>{t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),u.current={x:p?t.clientY:t.clientX,value:e}},onPointerMove:e=>{if(!u.current)return;let t=p?e.clientY:e.clientX;r(d(u.current.value+f*(t-u.current.x)))},onPointerUp:e=>{u.current=null,e.currentTarget.releasePointerCapture(e.pointerId)},onPointerCancel:()=>{u.current=null},onDoubleClick:s,onKeyDown:i=>{let a=i.shiftKey?o*4:o;if(i.key===m)r(d(e+f*a));else if(i.key===h)r(d(e-f*a));else if(i.key===`Home`)r(t);else if(i.key===`End`)r(n);else if(i.key===`Enter`&&s)s();else return;i.preventDefault()},children:(0,J.jsx)(`div`,{"aria-hidden":!0,className:E(`absolute bg-border group-hover:bg-accent group-focus-visible:bg-accent`,p?`inset-x-0 top-1/2 h-px -translate-y-1/2 group-hover:h-0.5 group-focus-visible:h-0.5`:`inset-y-0 left-1/2 w-px -translate-x-1/2 group-hover:w-0.5 group-focus-visible:w-0.5`)})})}var Y=`/api/catalog/connections`,X=V(`projects`),Z=V(`projects/connect`),ge=V(`projects/connect/pat`),_e=`https://github.com/settings/tokens/new?scopes=repo,read:org,project&description=Switchyard`,ve={to:X,label:`Projects`};function Q(e){if(e)try{let t=new URL(e);if(t.protocol===`https:`&&!t.username&&!t.password)return t.href}catch{}}function ye(){let[e,t]=(0,q.useState)(null),[n,r]=(0,q.useState)(null),[i,a]=(0,q.useState)(0);return(0,q.useEffect)(()=>{let e=new AbortController;return l(Y,void 0,e.signal).then(n=>{e.signal.aborted||(t(n),r(null))},n=>{e.signal.aborted||(w(n)&&(n.status===404||n.code===`unsupported_capability`)?(t({available:!1,connections:[],conflicts:[]}),r(null)):r(n))}),()=>e.abort()},[i]),(0,q.useEffect)(()=>{let e=window.setInterval(()=>a(e=>e+1),6e4);return()=>window.clearInterval(e)},[]),{inventory:e,error:n,reload:()=>a(e=>e+1)}}function be(e){return`${e.account} · ${e.kind===`pat`?`Personal token`:`GitHub App`}`}var xe={pending:`Waiting for installation or organization approval`,ready:`Connected`,stale:`Sync failed. Showing the last known repositories.`,suspended:`Installation suspended. Check its status on GitHub.`,removed:`Installation removed on GitHub`,disconnected:`Disconnected from Switchyard`},Se={ready:`success`,pending:`warning`,stale:`warning`,suspended:`danger`,removed:`danger`,disconnected:`neutral`};function Ce(e){if(e.kind!==`pat`)return null;let t=e.selection?.owners??[],n=e.selection?.repositories??[],r=[];return t.length>0&&r.push(t.join(`, `)),n.length>0&&r.push(`${n.length} repo${n.length===1?``:`s`}`),r.length>0?r.join(` · `):`No repositories selected yet`}function we({catalog:{inventory:e,error:t,reload:n},projects:r}){return!e&&!t?(0,J.jsx)(h,{label:`Loading repository connections…`}):(0,J.jsxs)(W,{title:`Repository connections`,description:`Connect with the GitHub App for personal accounts, or add a Personal Access Token for work organizations.`,actions:e?.available&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(T,{to:Z,className:v(`primary`,`sm`),children:[(0,J.jsx)(te,{"aria-hidden":!0,className:`size-3.5`}),`Connect GitHub`]}),(0,J.jsxs)(T,{to:ge,className:v(`secondary`,`sm`),children:[(0,J.jsx)(ie,{"aria-hidden":!0,className:`size-3.5`}),`Add Personal Token`]})]}),children:[t!=null&&(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(m,{error:t}),(0,J.jsx)(g,{size:`sm`,onClick:n,children:`Reload connections`})]}),e&&!e.available&&(0,J.jsx)(`p`,{className:`text-sm text-muted`,children:`The repository connector is unavailable. Existing projects show the last known catalog.`}),e?.available&&e.connections.length===0&&(0,J.jsx)(`p`,{className:`text-sm text-muted`,children:`No GitHub accounts connected.`}),e&&e.connections.length>0&&(0,J.jsx)(`div`,{className:`divide-y divide-border`,children:e.connections.map(t=>(0,J.jsx)(Te,{connection:t,available:e.available,reload:n},t.id))}),e?.conflicts.map(t=>(0,J.jsx)(Ee,{conflict:t,projects:r,disabled:!e.available,reload:n},JSON.stringify([t.connectionId,t.externalId])))]})}function Te({connection:e,available:t,reload:n}){let[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(!1),f=(0,q.useRef)(!1),h=e.kind===`pat`,b=e.state===`disconnected`,x=!h&&!b&&(e.state===`pending`||e.state===`removed`)?Q(e.installUrl):void 0,S=b?void 0:Q(e.manageUrl),C=async t=>{if(!r){i(t),o(null);try{await _(`${Y}/${encodeURIComponent(e.id)}/${t}`),t===`disconnect`&&c(!1)}catch(e){o(e)}finally{n(),i(null)}}};(0,q.useEffect)(()=>{if(!t||b)return;let e=()=>{document.visibilityState===`visible`&&f.current&&(f.current=!1,C(`refresh`))};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,e)}});let w=Ce(e);return(0,J.jsxs)(`div`,{"data-testid":`catalog-connection-${e.id}`,"data-account":e.account,className:`space-y-3 py-4 first:pt-1 last:pb-1`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.account}),(0,J.jsx)(M,{tone:`neutral`,children:h?`Personal token`:`GitHub App`}),(0,J.jsx)(`span`,{role:`status`,children:(0,J.jsx)(M,{tone:Se[e.state],children:xe[e.state]})})]}),e.lastSyncedAt&&(0,J.jsxs)(`span`,{className:`text-xs text-subtle`,children:[`Synced`,` `,(0,J.jsx)(`time`,{dateTime:e.lastSyncedAt,title:p(e.lastSyncedAt),children:y(e.lastSyncedAt)})]})]}),w&&(0,J.jsx)(`p`,{className:`truncate text-xs text-muted`,children:w}),e.lastError&&(0,J.jsx)(`p`,{className:`break-words text-sm text-warning`,children:e.lastError}),x&&(0,J.jsx)(`p`,{className:`text-xs text-muted`,children:`Install the app, select repositories on GitHub, then return here and refresh.`}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-0.5`,children:[x&&(0,J.jsxs)(`a`,{href:x,target:`_blank`,rel:`noopener noreferrer`,className:v(`primary`,`sm`),onClick:()=>{f.current=!0},children:[(0,J.jsx)(I,{"aria-hidden":!0,className:`size-3.5`}),`Install on GitHub`]}),h&&t&&!b&&(0,J.jsx)(g,{size:`sm`,disabled:!!r,onClick:()=>u(!0),children:`Edit repositories`}),S&&!x&&(0,J.jsxs)(`a`,{href:S,target:`_blank`,rel:`noopener noreferrer`,className:v(`secondary`,`sm`),onClick:()=>{f.current=!0},children:[(0,J.jsx)(I,{"aria-hidden":!0,className:`size-3.5`}),h?`Manage token on GitHub`:`Manage repositories on GitHub`]}),t&&!b&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(g,{size:`sm`,icon:(0,J.jsx)(d,{className:`size-3.5`}),busy:r===`refresh`,disabled:r===`disconnect`,onClick:()=>void C(`refresh`),children:e.state===`pending`||x?`Refresh connection`:`Refresh`}),(0,J.jsx)(g,{size:`sm`,variant:`ghost`,className:`ml-auto text-muted hover:text-danger`,disabled:!!r,onClick:()=>{o(null),c(!0)},children:`Disconnect`})]})]}),e.lastError?.startsWith(`Reconnect provider`)&&(0,J.jsx)(H,{to:h?ge:Z,variant:`action`,children:`Reconnect provider`}),!s&&(0,J.jsx)(m,{error:a}),(0,J.jsx)(j,{open:s,title:`Disconnect ${e.account}?`,onClose:()=>{r||c(!1)},onConfirm:()=>C(`disconnect`),confirmLabel:`Disconnect`,busy:r===`disconnect`,error:a,children:(0,J.jsx)(`p`,{className:`text-sm`,children:`Repositories shared only by this connection will move to Previous projects. Checkouts and session history will remain.`})}),h&&(0,J.jsx)(A,{open:l,onClose:()=>u(!1),title:`Edit repositories · ${e.account}`,description:`Choose organizations and individual repositories to include in Switchyard.`,children:(0,J.jsx)(je,{connectionId:e.id,initialSelection:e.selection,onSaved:()=>{u(!1),n(),R.success(`Repositories updated`)},onCancel:()=>u(!1)})})]})}function Ee({conflict:e,projects:t,disabled:n,reload:r}){let i=(0,q.useId)(),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(null),d=e.projectIds.filter(e=>t.some(t=>t.id===e));return(0,J.jsxs)(`form`,{className:`space-y-2 border-t border-border pt-3`,onSubmit:async t=>{if(t.preventDefault(),!(s||n||!d.includes(a))){c(!0),u(null);try{await _(`${Y}/${encodeURIComponent(e.connectionId)}/resolve-history`,{externalId:e.externalId,projectId:a}),r(),R.success(`Existing history selected`)}catch(e){u(e)}finally{c(!1)}}},children:[(0,J.jsx)(U,{id:i,label:`Choose existing history`,hint:`More than one previous project matches ${e.fullName}. Choose which history to keep using for this repository. The others remain available separately.`,children:(0,J.jsxs)(le,{id:i,value:d.includes(a)?a:``,disabled:n||s,onChange:e=>o(e.target.value),children:[(0,J.jsx)(`option`,{value:``,children:`Choose a previous project`}),d.map(e=>(0,J.jsxs)(`option`,{value:e,children:[t.find(t=>t.id===e)?.name,` · `,e]},e))]})}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(g,{size:`sm`,type:`submit`,busy:s,disabled:n||!d.includes(a),children:`Use selected history`}),d.includes(a)&&(0,J.jsx)(H,{to:V(`projects/${encodeURIComponent(a)}`),target:`_blank`,rel:`noreferrer`,children:`View selected project`})]}),(0,J.jsx)(m,{error:l})]})}function De({connection:e,onReady:t}){let[n,r]=(0,q.useState)(!1),[i,a]=(0,q.useState)(null),o=Q(e.installUrl),s=(0,q.useRef)(!1),c=async()=>{if(!n){r(!0),a(null);try{(await _(`${Y}/${encodeURIComponent(e.id)}/refresh`)).connections.find(t=>t.id===e.id)?.state===`ready`&&(R.success(`GitHub repositories synced`),t())}catch(e){a(e)}finally{r(!1)}}};return(0,q.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&s.current&&c()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,e)}}),(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsxs)(`p`,{className:`text-sm font-medium`,children:[`Signed in as `,e.account]}),(0,J.jsx)(`p`,{className:`text-sm text-muted`,children:`Choose which repositories to share on GitHub. Switchyard syncs them automatically when you return to this tab.`}),(0,J.jsx)(m,{error:i}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[o&&(0,J.jsxs)(`a`,{href:o,target:`_blank`,rel:`noreferrer`,className:v(`primary`),onClick:()=>{s.current=!0},children:[(0,J.jsx)(I,{"aria-hidden":!0,className:`size-4`}),`Choose repositories on GitHub`]}),(0,J.jsx)(g,{size:`sm`,busy:n,onClick:c,children:`Check now`}),(0,J.jsx)(T,{className:v(`secondary`),to:X,replace:!0,children:`Open Projects`})]})]})}function Oe(){let e=b(),[t,n]=(0,q.useState)(null),[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(null),p=(0,q.useRef)(!1),y=async()=>{if(!l){u(!0),f(null),i(null);try{let e=await _(`${Y}/begin`,{});if(e.mode===`oauth`){let t=Q(e.authorizeUrl);if(!t)throw Error(`GitHub did not return a valid sign-in URL.`);o(!0),window.location.assign(t);return}let t=Q(e.verificationUri);if(!t)throw Error(`GitHub did not return a valid sign-in URL.`);n({...e,verificationUri:t})}catch(e){f(e)}finally{u(!1)}}};return(0,q.useEffect)(()=>{p.current||(p.current=!0,y())},[]),(0,q.useEffect)(()=>{if(!t||r)return;let a=!0,o,s=r=>{o=window.setTimeout(async()=>{try{let r=await _(`${Y}/poll`,{flowId:t.flowId});if(!a)return;r.status===`complete`?(n(null),R.success(`Connected GitHub as ${r.connection.account}`),r.connection.state===`ready`?e(X,{replace:!0}):i(r.connection)):s(r.interval??t.interval)}catch(e){if(!a)return;f(e),n(null)}},Math.max(1,r)*1e3)};return s(t.interval),()=>{a=!1,o!==void 0&&window.clearTimeout(o)}},[t,r,e]),(0,J.jsx)(z,{title:`Connect GitHub`,description:`Sign in with GitHub once to list repositories across your personal account and organizations.`,back:ve,children:(0,J.jsx)(W,{children:a||l&&!t&&!d?(0,J.jsx)(h,{label:`Redirecting to GitHub…`}):r?(0,J.jsx)(De,{connection:r,onReady:()=>e(X,{replace:!0})}):t?(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsx)(`p`,{className:`text-sm text-muted`,children:`Enter this code on GitHub to authorize Switchyard. This page updates automatically once you approve it.`}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsx)(`code`,{"data-testid":`github-device-code`,className:`rounded-md border border-border bg-surface-2 px-3 py-2 font-mono text-lg font-semibold tracking-widest`,children:t.userCode}),(0,J.jsx)(g,{size:`sm`,icon:s?(0,J.jsx)(F,{className:`size-4`}):(0,J.jsx)(ee,{className:`size-4`}),onClick:async()=>{try{await navigator.clipboard.writeText(t.userCode),c(!0),window.setTimeout(()=>c(!1),2e3)}catch{R.error(`Could not copy code`)}},children:s?`Copied`:`Copy code`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`a`,{href:t.verificationUri,target:`_blank`,rel:`noreferrer`,className:v(`primary`),children:[(0,J.jsx)(I,{"aria-hidden":!0,className:`size-4`}),`Open GitHub`]}),(0,J.jsx)(g,{onClick:()=>{n(null),f(null)},children:`Cancel`})]}),(0,J.jsx)(`p`,{className:`text-xs text-subtle`,children:`Waiting for GitHub approval…`})]}):(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsx)(m,{error:d}),(0,J.jsx)(g,{variant:`primary`,busy:l,onClick:y,children:`Sign in with GitHub`})]})})})}function ke(){let e=b(),t=N(e=>e.status===`authenticated`),n=(0,q.useRef)(null),[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!t)return;if(!n.current){let e=oe();if(!e){o(!0);return}n.current=_(`${Y}/complete`,e)}let r=!0;return n.current.then(({connection:t})=>{r&&(R.success(`Connected GitHub as ${t.account}`),t.state===`ready`?e(X,{replace:!0}):i(t))},()=>{r&&o(!0)}),()=>{r=!1}},[t,e]),(0,J.jsx)(z,{title:`Connect GitHub`,back:ve,children:r?(0,J.jsx)(W,{children:(0,J.jsx)(De,{connection:r,onReady:()=>e(X,{replace:!0})})}):a?(0,J.jsxs)(W,{title:`Could not complete GitHub sign-in`,children:[(0,J.jsx)(`p`,{className:`text-sm text-muted`,children:`This sign-in expired or was cancelled. Try connecting GitHub again from this device.`}),(0,J.jsx)(`div`,{children:(0,J.jsx)(T,{className:v(`primary`),to:Z,replace:!0,children:`Try again`})})]}):(0,J.jsx)(h,{label:`Connecting GitHub…`})})}function Ae(e,t,n){let r=new Set(e);return n?r.add(t):r.delete(t),r}function je({connectionId:e,initialSelection:n,onSaved:r,onCancel:i}){let[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(null),[u,d]=(0,q.useState)(null),[f,p]=(0,q.useState)(!1),[_,v]=(0,q.useState)(``),[y,b]=(0,q.useState)(()=>new Set(n?.owners??[])),[x,S]=(0,q.useState)(()=>new Set(n?.repositories??[])),[C,w]=(0,q.useState)(0),T=(0,q.useCallback)(()=>w(e=>e+1),[]);(0,q.useEffect)(()=>{let t=new AbortController;return o(null),c(null),l(`${Y}/${encodeURIComponent(e)}/available`,void 0,t.signal).then(e=>{t.signal.aborted||o(e)},e=>{t.signal.aborted||c(e)}),()=>t.abort()},[e,C]);let E=_.trim().toLowerCase(),D=(0,q.useMemo)(()=>a?E?a.owners.filter(e=>e.login.toLowerCase().includes(E)||a.repositories.some(t=>t.owner.toLowerCase()===e.login.toLowerCase()&&`${t.owner}/${t.name}`.toLowerCase().includes(E))):a.owners:[],[a,E]),O=(0,q.useMemo)(()=>{if(!a)return[];let e=[...a.repositories].sort((e,t)=>`${e.owner}/${e.name}`.localeCompare(`${t.owner}/${t.name}`));return E?e.filter(e=>`${e.owner}/${e.name}`.toLowerCase().includes(E)):e},[a,E]),k=async()=>{if(!f){p(!0),d(null);try{await t(`${Y}/${encodeURIComponent(e)}/selection`,{selection:{owners:[...y],repositories:[...x]}}),r()}catch(e){d(e)}finally{p(!1)}}};if(!a&&!s)return(0,J.jsx)(h,{label:`Loading accessible organizations and repositories…`});if(s)return(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsx)(m,{error:s}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,J.jsx)(g,{size:`sm`,onClick:T,children:`Retry`}),i&&(0,J.jsx)(g,{size:`sm`,variant:`ghost`,onClick:i,children:`Cancel`})]})]});if(!a)return null;let A=O.slice(0,200);return(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(ne,{"aria-hidden":!0,className:`pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-subtle`}),(0,J.jsx)(L,{type:`search`,"aria-label":`Search organizations or repositories`,placeholder:`Search organizations or repositories`,value:_,onChange:e=>v(e.target.value),className:`pl-8`})]}),(0,J.jsxs)(`p`,{className:`text-xs text-muted`,children:[y.size,` organization`,y.size===1?``:`s`,` and `,x.size,` individual repositor`,x.size===1?`y`:`ies`,` selected.`]}),D.length>0&&(0,J.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,J.jsx)(`legend`,{className:`text-sm font-medium`,children:`Organizations & accounts`}),(0,J.jsx)(`p`,{className:`text-xs text-muted`,children:`Checking an account includes all repositories in it.`}),(0,J.jsx)(`div`,{className:`max-h-44 divide-y divide-border overflow-y-auto rounded-lg border border-border bg-surface-2/40`,children:D.map(e=>(0,J.jsx)(`div`,{className:`px-3 py-2`,children:(0,J.jsx)(K,{label:(0,J.jsxs)(`span`,{children:[e.login,` `,(0,J.jsxs)(`span`,{className:`text-xs text-muted`,children:[`(`,e.type,`)`]})]}),checked:y.has(e.login),onChange:t=>b(n=>Ae(n,e.login,t))})},e.login))})]}),(0,J.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,J.jsx)(`legend`,{className:`text-sm font-medium`,children:`Repositories`}),A.length===0?(0,J.jsx)(`p`,{className:`text-sm text-muted`,children:a.repositories.length===0?`No accessible repositories returned by this token.`:`No repositories match your search.`}):(0,J.jsxs)(`div`,{className:`max-h-64 divide-y divide-border overflow-y-auto rounded-lg border border-border bg-surface-2/40`,children:[A.map(e=>{let t=`${e.owner}/${e.name}`,n=y.has(e.owner);return(0,J.jsx)(`div`,{className:`px-3 py-2`,children:(0,J.jsx)(K,{label:(0,J.jsxs)(`span`,{children:[t,n&&(0,J.jsxs)(`span`,{className:`ml-1.5 text-xs text-muted`,children:[`(via `,e.owner,`)`]})]}),checked:x.has(t),onChange:e=>S(n=>Ae(n,t,e))})},e.externalId)}),O.length>A.length&&(0,J.jsxs)(`p`,{className:`px-3 py-2 text-xs text-muted`,children:[`Showing first `,A.length,` of `,O.length,` matches. Search to narrow the list.`]})]})]}),(0,J.jsx)(m,{error:u}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 border-t border-border pt-4`,children:[i&&(0,J.jsx)(g,{disabled:f,onClick:i,children:`Cancel`}),(0,J.jsx)(g,{variant:`primary`,busy:f,onClick:()=>void k(),children:`Save selection`})]})]})}function Me(){let e=b(),[t,n]=(0,q.useState)(``),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(null),l=async e=>{if(e.preventDefault(),r)return;let a=t.trim();if(a.length<10)o(Error(`Paste a valid GitHub Personal Access Token.`));else{i(!0),o(null);try{let e=await _(`${Y}/pat`,{token:a});n(``),R.success(`Connected GitHub as ${e.connection.account}`),c(e.connection)}catch(e){o(e)}finally{i(!1)}}};return(0,J.jsx)(z,{title:s?`Choose repositories · ${s.account}`:`Connect with Personal Access Token`,description:s?`Choose which organizations and individual repositories to include in Switchyard.`:`Use a Classic or Fine-Grained Personal Access Token to access work organizations without installing an app.`,back:ve,children:(0,J.jsx)(W,{children:s?(0,J.jsx)(je,{connectionId:s.id,initialSelection:s.selection,onSaved:()=>{R.success(`Repositories updated`),e(X,{replace:!0})},onCancel:()=>e(X,{replace:!0})}):(0,J.jsxs)(`form`,{className:`max-w-xl space-y-5`,onSubmit:e=>void l(e),children:[(0,J.jsxs)(`div`,{className:`space-y-2.5 rounded-lg border border-border bg-surface-2/50 p-3.5`,children:[(0,J.jsxs)(`p`,{className:`text-sm text-muted`,children:[`Classic PATs need `,(0,J.jsx)(`code`,{className:`text-xs`,children:`repo`}),`,`,` `,(0,J.jsx)(`code`,{className:`text-xs`,children:`read:org`}),`, and`,` `,(0,J.jsx)(`code`,{className:`text-xs`,children:`project`}),` scopes. Fine-Grained PATs are also supported.`]}),(0,J.jsx)(`div`,{children:(0,J.jsxs)(`a`,{href:_e,target:`_blank`,rel:`noopener noreferrer`,className:v(`secondary`,`sm`),children:[(0,J.jsx)(I,{"aria-hidden":!0,className:`size-3.5`}),`Create a Classic PAT on GitHub`]})})]}),(0,J.jsx)(U,{label:`Personal access token`,hint:`Your token is stored only on the coordinator.`,children:e=>(0,J.jsx)(L,{...e,type:`password`,autoComplete:`off`,spellCheck:!1,placeholder:`ghp_… or github_pat_…`,value:t,onChange:e=>n(e.target.value)})}),(0,J.jsx)(m,{error:a}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[(0,J.jsx)(g,{type:`submit`,variant:`primary`,busy:r,disabled:!t.trim(),children:`Continue`}),(0,J.jsx)(T,{className:v(`secondary`),to:X,children:`Cancel`})]})]})})})}function Ne({draft:e,errors:t,set:n,connections:r,hosts:i,columns:a}){let o=(0,q.useId)(),{inventory:s}=ye(),c=r??s?.connections??[],l=e.board.trim()!==``,u=c.some(t=>t.id===e.connectionId)?e.connectionId:``;return(0,q.useEffect)(()=>{if(r===void 0&&s&&!s.connections.some(t=>t.id===e.connectionId)&&(!e.connectionId||e.connectionId.startsWith(`hst_`))){let t=(s.connections.find(e=>e.state===`ready`)??s.connections[0])?.id??``;t!==e.connectionId&&n(`connectionId`,t)}},[r,s,e.connectionId,n]),(0,J.jsxs)(`div`,{"data-testid":`github-source-form`,className:`flex flex-col gap-3`,children:[(0,J.jsx)(U,{label:`GitHub connection`,hint:c.length===0&&(r!==void 0||s!==null)?(0,J.jsxs)(J.Fragment,{children:[`No GitHub connections yet.`,` `,(0,J.jsx)(H,{to:V(`projects`),variant:`inline`,children:`Connect GitHub in Settings › Projects`}),`.`]}):`Reads issues and moves board cards for this scope.`,error:t.connectionId,children:e=>(0,J.jsxs)(le,{...e,value:u,onChange:e=>n(`connectionId`,e.target.value),children:[(0,J.jsx)(`option`,{value:``,children:`Choose a GitHub connection`}),c.map(e=>(0,J.jsxs)(`option`,{value:e.id,children:[e.account,` (`,e.kind===`pat`?`Personal token`:`GitHub App`,`)`]},e.id))]})}),(0,J.jsx)(U,{label:`GitHub owner`,hint:`An organization or user, such as fieldgoalco.`,error:t.owner,children:t=>(0,J.jsx)(L,{...t,value:e.owner,spellCheck:!1,onChange:e=>n(`owner`,e.target.value)})}),(0,J.jsx)(U,{label:`Repositories`,optional:!0,hint:`One owner/name per line. Leave empty for every repository of the owner.`,error:t.repositories,children:t=>(0,J.jsx)(B,{...t,rows:3,value:e.repositories,spellCheck:!1,onChange:e=>n(`repositories`,e.target.value)})}),(0,J.jsx)(U,{label:`Repositories of other owners`,optional:!0,hint:`One owner/name per line. Their projects join this scope, and issues assigned to you there are tracked too.`,error:t.extraRepositories,children:t=>(0,J.jsx)(B,{...t,rows:2,value:e.extraRepositories,spellCheck:!1,onChange:e=>n(`extraRepositories`,e.target.value)})}),(0,J.jsxs)(`fieldset`,{className:`flex flex-col gap-3`,children:[(0,J.jsx)(`legend`,{className:`text-sm font-semibold`,children:`Projects board`}),(0,J.jsx)(U,{label:`Board number`,optional:!0,hint:`A GitHub Projects board of the owner. Needs Projects permission on the selected GitHub connection.`,error:t.board,children:t=>(0,J.jsx)(L,{...t,inputMode:`numeric`,value:e.board,onChange:e=>n(`board`,e.target.value)})}),l&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`datalist`,{id:o,children:a.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsx)(U,{label:`Issues to follow`,hint:`On the board, issues need no assignee.`,children:t=>(0,J.jsxs)(le,{...t,value:e.follow,onChange:e=>n(`follow`,e.target.value),children:[(0,J.jsx)(`option`,{value:`assigned`,children:`Assigned to me`}),(0,J.jsx)(`option`,{value:`board`,children:`Every open issue on the board`})]})}),(0,J.jsx)(U,{label:`Status field`,children:t=>(0,J.jsx)(L,{...t,value:e.statusField,onChange:e=>n(`statusField`,e.target.value)})}),(0,J.jsx)(U,{label:`Column when work starts`,optional:!0,children:t=>(0,J.jsx)(L,{...t,list:o,value:e.onStart,onChange:e=>n(`onStart`,e.target.value)})}),(0,J.jsx)(U,{label:`Column when a pull request opens`,optional:!0,children:t=>(0,J.jsx)(L,{...t,list:o,value:e.onReview,onChange:e=>n(`onReview`,e.target.value)})}),(0,J.jsx)(U,{label:`Backlog columns`,optional:!0,hint:`Cards in these columns are not tracked until they have a branch or pull request. Separate names with commas.`,error:t.backlog,children:t=>(0,J.jsx)(L,{...t,value:e.backlog,onChange:e=>n(`backlog`,e.target.value)})}),(0,J.jsx)(U,{label:`Priority field`,optional:!0,hint:`A single-select field, such as Priority. Not-started issues are listed by it.`,children:t=>(0,J.jsx)(L,{...t,value:e.priorityField,onChange:e=>n(`priorityField`,e.target.value)})}),(0,J.jsx)(G,{label:`Move cards on GitHub`,description:e.follow===`board`?`Cards assigned to you or to nobody, only the status field, and only from the column Switchyard last saw.`:`Only cards assigned to you, only the status field, and only from the column Switchyard last saw.`,checked:e.writeBack,onChange:e=>n(`writeBack`,e)}),e.writeBack&&(0,J.jsx)(G,{label:`Also move cards assigned to others too`,checked:e.moveShared,onChange:e=>n(`moveShared`,e)})]})]}),(0,J.jsx)(G,{label:`Make worktrees for issue branches`,description:`Off: Switchyard only links the worktrees you make and never creates one.`,checked:e.worktrees,onChange:e=>n(`worktrees`,e)}),(0,J.jsx)(G,{label:`Sync this scope`,checked:e.enabled,onChange:e=>n(`enabled`,e)}),(0,J.jsx)(`p`,{className:`text-xs text-muted`,children:`Its projects are the ones in Settings › Projects whose repositories this covers.`})]})}var Pe=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),$=e=>e.split(`
|
|
2
|
-
`).map(e=>e.trim()).filter(Boolean);function Fe(e,t=``){let n=e?.source??null;return n?{name:e?.name??``,connectionId:n.connectionId??t,owner:n.owner,repositories:(n.repositories??[]).join(`
|
|
3
|
-
`),extraRepositories:(n.extraRepositories??[]).join(`
|
|
4
|
-
`),board:n.board?String(n.board.projectNumber):``,statusField:n.board?.statusField??`Status`,onStart:n.board?.onStart??``,onReview:n.board?.onReview??``,follow:s(n),backlog:o(n).join(`, `),priorityField:n.board?.priorityField??``,writeBack:n.writeBack,moveShared:n.moveShared,worktrees:u(n),enabled:n.enabled}:{name:e?.name??``,connectionId:t,owner:``,repositories:``,extraRepositories:``,board:``,statusField:`Status`,onStart:``,onReview:``,follow:`assigned`,backlog:``,priorityField:``,writeBack:!1,moveShared:!0,worktrees:!0,enabled:!0}}function Ie(e){let t={},r=e.name.trim();r?r.length>60&&(t.name=`Use 60 characters or fewer.`):t.name=`Enter a name.`,e.connectionId||(t.connectionId=`Choose a GitHub connection.`),c.safeParse(e.owner.trim()).success||(t.owner=`Enter a GitHub organization or user name.`),$(e.repositories).some(e=>!n.safeParse(e).success)&&(t.repositories=`Use owner/name, one per line.`);let i=$(e.extraRepositories);i.some(e=>!n.safeParse(e).success)?t.extraRepositories=`Use owner/name, one per line.`:i.length>20&&(t.extraRepositories=`Use 20 repositories or fewer.`);let a=e.board.trim();return a&&!/^[1-9][0-9]*$/.test(a)&&(t.board=`Enter the board's number, as in its URL.`),Pe(e.backlog).length>20&&(t.backlog=`Use 20 columns or fewer.`),t}function Le(e){let t=$(e.repositories),n=e.board.trim(),r={connectionId:e.connectionId,owner:e.owner.trim(),repositories:t.length?t:null,extraRepositories:$(e.extraRepositories),board:n?{projectNumber:Number(n),statusField:e.statusField.trim()||`Status`,onStart:e.onStart.trim()||null,onReview:e.onReview.trim()||null,backlog:Pe(e.backlog),priorityField:e.priorityField.trim()||null}:null,follow:n?e.follow:`assigned`,writeBack:n?e.writeBack:!1,moveShared:e.moveShared,worktrees:e.worktrees,enabled:e.enabled};return{name:e.name.trim(),source:r}}function Re(e,t){let n=(()=>{if(!e.writeBack||!e.board)return`Off`;let t=[e.board.onStart?`To "${e.board.onStart}" when work starts`:null,e.board.onReview?`${e.board.onStart?`to`:`To`} "${e.board.onReview}" when a pull request opens`:null].filter(e=>!!e);return t.length===0?`On, but no columns are set`:`${t.join(`, `)}${e.moveShared?``:`; never shared cards`}`})(),r=t?e.login?`${t}, signed in as ${e.login}`:`${t}, not synced yet`:e.login?`Signed in as ${e.login}`:e.connectionId?`${e.connectionId}, not synced yet`:`Not connected (select a GitHub connection)`,i=[[`GitHub`,`${e.owner}${e.repositories?`: ${e.repositories.join(`, `)}`:` (all repositories)`}${e.extraRepositories?.length?`, plus ${e.extraRepositories.join(`, `)}`:``}`],[`Connection`,r]];return e.board&&(i.push([`Board`,`#${e.board.projectNumber}, field ${e.board.statusField}${e.board.priorityField?`, priority ${e.board.priorityField}`:``}${o(e).length?`; hides ${o(e).join(`, `)} until started`:``}`]),i.push([`Moves cards`,n])),i}var ze=[{value:`projects`,label:`Projects you choose`,explanation:`Sessions in the projects you check, plus any session you pin.`},{value:`pins`,label:`Pins only`,explanation:`Only the sessions you pin to it.`},{value:`github`,label:`GitHub issues`,explanation:`Issues assigned to you or on a Projects board, and the sessions working on them.`}];function Be(e){return e?.source?`github`:e?.mode===`pinned`?`pins`:`projects`}function Ve(e,t){return{name:e?.name??``,contents:Be(e),projectIds:e?.projectIds??[],hostIds:e?.hostIds??[],github:Fe(e,t)}}function He(e){let t=Ie({...e.github,name:e.name});return e.contents===`github`?t:t.name?{name:t.name}:{}}function Ue(e,t){let n=e.name.trim(),r=e.hostIds.length?e.hostIds:null;return e.contents===`github`?{name:n,mode:`all`,hostIds:r,source:Le({...e.github,name:n}).source}:{name:n,mode:e.contents===`pins`?`pinned`:`all`,projectIds:e.projectIds.length?e.projectIds:null,hostIds:r,...t?.source?{source:null}:{}}}function We(e,t){return!!t?.source&&e.contents!==`github`}function Ge({scope:e,describe:t,onNavigate:n}){let r=a(e=>e.clients),i=a(e=>e.hosts),o=P(e,Object.values(r),i),s=e.name.trim().replace(/\s+/g,`-`);return(0,J.jsxs)(`dl`,{"data-testid":`scope-about`,className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 rounded-md bg-surface-2 px-3 py-2 text-sm`,children:[(0,J.jsx)(`dt`,{className:`text-muted`,children:`Contains`}),(0,J.jsx)(`dd`,{className:`min-w-0`,children:t(e)}),(0,J.jsx)(`dt`,{className:`text-muted`,children:`Mirrored in`}),(0,J.jsxs)(`dd`,{className:`flex min-w-0 flex-col gap-0.5`,children:[o??(0,J.jsx)(`span`,{children:`No client.`}),!o&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`text-muted`,children:[`To mirror it in herdr, choose it in`,` `,(0,J.jsx)(H,{to:ae.settings(`clients`),onClick:n,children:`Settings › Clients`}),`, or run:`]}),(0,J.jsxs)(`code`,{className:`block break-all text-xs`,children:[`switchyard clients bind herdr:`,s,` --scope `,e.name]})]})]})]})}function Ke(e,t,n){return n?[...e,t]:e.filter(e=>e!==t)}function qe({editing:e,onClose:n,onSaved:r}){let{scopes:o,describe:s}=ue(),c=O(),l=i(),{inventory:u}=ye(),d=u?.connections??[],p=a(e=>e.issues),m=(d.find(e=>e.state===`ready`)??d[0])?.id??``,h=e&&e!==`new`?o[e]??null:null,v=e??`closed`,[y,b]=(0,q.useState)(null),[x,T]=(0,q.useState)(()=>Ve(null,m)),[E,D]=(0,q.useState)({}),[k,M]=(0,q.useState)(!1),[N,P]=(0,q.useState)(null),[ee,F]=(0,q.useState)(!1);y!==v&&(b(v),T(Ve(h,m)),D({}),P(null),F(!1));let I=(0,q.useMemo)(()=>h?Object.values(p).find(e=>e.scopeId===h.id&&e.board)?.board?.options.map(e=>e.name)??[]:[],[p,h]),te=(e,t)=>T(n=>({...n,github:{...n.github,[e]:t}})),ne=async()=>{let e=He(x);if(D(e),Object.keys(e).length>0)return;M(!0),P(null);let i=Ue(x,h);try{let e=h?await t(`/api/scopes/${encodeURIComponent(h.id)}`,i):await _(`/api/scopes`,i);R.success(`Scope ${e.name} saved`),r(e.id),n()}catch(e){P(e)}finally{M(!1)}},re=async()=>{if(h){M(!0);try{await f(`/api/scopes/${encodeURIComponent(h.id)}`),R.success(`Scope ${h.name} deleted`),F(!1),n()}catch(e){P(e)}finally{M(!1)}}},z=w(N,`conflict`)?C(N):null,B=e!==null;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(A,{open:B&&!ee,onClose:n,title:h?`Edit scope`:`New scope`,description:`A scope is a named part of your work, shown on Sessions and the Board.`,footer:(0,J.jsxs)(J.Fragment,{children:[h&&(0,J.jsx)(g,{variant:`danger`,onClick:()=>F(!0),className:`mr-auto`,children:`Delete`}),(0,J.jsx)(g,{onClick:n,children:`Cancel`}),(0,J.jsx)(g,{variant:`primary`,busy:k,disabled:!x.name.trim(),onClick:()=>void ne(),children:We(x,h)?`Save and disconnect GitHub`:`Save`})]}),children:(0,J.jsxs)(`div`,{"data-testid":`scope-form`,className:`flex flex-col gap-3`,children:[h&&(0,J.jsx)(Ge,{scope:h,describe:s,onNavigate:n}),(0,J.jsx)(U,{label:`Name`,id:`sy-scope-name`,error:E.name??z,children:e=>(0,J.jsx)(L,{...e,value:x.name,maxLength:60,onChange:e=>T({...x,name:e.target.value})})}),(0,J.jsx)(ce,{legend:`Contains`,columns:1,value:x.contents,options:ze,onChange:e=>T({...x,contents:e})}),We(x,h)&&(0,J.jsx)(`p`,{role:`status`,className:`rounded-md border border-border bg-warning-soft px-3 py-2 text-sm`,children:`Saving disconnects GitHub: this scope's issues leave the Board. Its sessions and worktrees stay.`}),x.contents===`projects`&&(0,J.jsxs)(`fieldset`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`legend`,{className:`text-sm font-medium`,children:`Projects (none checked: any)`}),c.map(e=>(0,J.jsx)(K,{label:e.name,checked:x.projectIds.includes(e.id),onChange:t=>T({...x,projectIds:Ke(x.projectIds,e.id,t)})},e.id))]}),x.contents===`github`&&(0,J.jsx)(Ne,{draft:x.github,errors:E,set:te,connections:d,columns:I}),x.contents!==`pins`&&!!h?.hostIds?.length&&(0,J.jsxs)(`fieldset`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`legend`,{className:`text-sm font-medium`,children:`Hosts (none checked: any)`}),l.map(e=>(0,J.jsx)(K,{label:e.name,checked:x.hostIds.includes(e.id),onChange:t=>T({...x,hostIds:Ke(x.hostIds,e.id,t)})},e.id))]}),N!==null&&!z&&(0,J.jsx)(S,{compact:!0,title:`Could not save`,error:C(N)})]})}),(0,J.jsx)(j,{open:B&&ee,onClose:()=>F(!1),title:`Delete this scope?`,description:`Sessions are not affected. Clients mirroring it then mirror nothing and keep their tabs.${h?.source?` Its issues are removed from the Board.`:``}`,confirmLabel:`Delete scope`,busy:k,error:N,onConfirm:()=>void re()})]})}function Je({open:e,onOpenChange:t,trigger:n,label:r,side:i=`bottom`,align:a=`start`,initialFocus:o,className:s,fitViewport:c,children:l}){let u=(0,q.useId)(),d=(0,q.useRef)(null),f=(0,q.useRef)(null);k(d,e,()=>t(!1),o);let[p,m]=(0,q.useState)(null);return(0,q.useLayoutEffect)(()=>{if(!e||!c){m(null);return}let t=()=>{let e=f.current?.getBoundingClientRect();if(!e)return;let t=Math.min(288,window.innerWidth-16),n=Math.min(Math.max(e.left,8),window.innerWidth-t-8);m(i===`top`?{position:`fixed`,width:t,left:n,bottom:window.innerHeight-e.top+4,maxHeight:e.top-12}:{position:`fixed`,width:t,left:n,top:e.bottom+4,maxHeight:window.innerHeight-e.bottom-12})};return t(),window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t)},[e,c,i]),(0,q.useEffect)(()=>{if(!e)return;let n=e=>{let n=e.target;!d.current?.contains(n)&&!f.current?.contains(n)&&t(!1)};return document.addEventListener(`pointerdown`,n),()=>document.removeEventListener(`pointerdown`,n)},[e,t]),(0,J.jsxs)(`div`,{className:`relative inline-flex`,children:[n({ref:f,onClick:()=>t(!e),"aria-haspopup":`dialog`,"aria-expanded":e,"aria-controls":u}),e&&(0,J.jsx)(`div`,{ref:d,id:u,role:`dialog`,"aria-label":r,tabIndex:-1,style:p??void 0,className:E(p?`fixed`:`absolute`,`z-40 max-h-[calc(100dvh-2rem)] max-w-[calc(100vw-1rem)] overflow-y-auto overscroll-contain rounded-lg border border-border bg-surface p-3 shadow-pop`,!p&&(i===`top`?`bottom-full mb-1`:`top-full mt-1`),!p&&(a===`end`?`right-0`:`left-0`),s),children:l})]})}function Ye(e){let t=e.trim();return t?t.length>128||t===`.`||t===`..`||/^\.git$/i.test(t)||/[/\\]/.test(t)||[...t].some(e=>e.charCodeAt(0)<32||e.charCodeAt(0)===127)?`Use one folder name, not a path or .git.`:null:`Enter a folder name.`}function Xe(e,t=!1){return e.revokedAt?`${e.name} was revoked. Enroll it again or choose another host.`:e.connectivity===`connected`?!e.checkoutProvision&&!t?`Update this host agent to prepare checkouts, or attach an existing clone.`:null:`${e.name} is offline. Reconnect it or choose another host.`}function Ze({project:e,host:t,hasCheckout:n,attachFallback:r,onBusyChange:i,onPrepared:o}){let s=(0,q.useId)(),[c,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(),[h,v]=(0,q.useState)(null),[y,b]=(0,q.useState)(null),x=(0,q.useRef)(!1),[S,C]=(0,q.useState)(null),[w,T]=(0,q.useState)(!1),E=`/api/projects/${encodeURIComponent(e.id)}/checkouts`;if(!t)return(0,J.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,J.jsx)(`p`,{className:`font-medium`,children:`No checkout yet`}),(0,J.jsxs)(`p`,{className:`text-muted`,children:[`Choose or connect a host to prepare a checkout.`,` `,(0,J.jsx)(H,{to:V(`hosts`),target:`_blank`,rel:`noreferrer`,variant:`action`,children:`Open Hosts`})]})]});let D=Xe(t,n),O=!n&&!t.checkoutRoot,k=u.trim()?Ye(u):null,A=r&&!t.revokedAt&&t.connectivity===`connected`&&!h,j=async e=>{if(!(x.current||D||O&&!h)){x.current=!0,b(`preview`),C(null);try{let n=await _(`${E}/preview`,{hostId:t.id,...e===void 0?{}:{folderName:e}});if(h&&n.path!==h)throw Error(`The checkout destination changed. Inspect the original path on the host before preparing a different checkout.`);l(n),p(e),v(null)}catch(e){C(e)}finally{x.current=!1,b(null)}}},M=async()=>{if(!(x.current||D||!c?.previewId||c.action===`collision`)){x.current=!0,b(`apply`),i?.(!0),C(null);try{let e=await _(`${E}/provision`,{previewId:c.previewId});a.getState().recordPreparedCheckout(e.checkout,e.workspaces),l(null),R.success(`Checkout ready`),o?.()}catch(e){v(c.path),l(null),C(e)}finally{x.current=!1,i?.(!1),b(null)}}};return(0,J.jsxs)(`div`,{className:`min-w-0 space-y-2 rounded-md border border-border p-3 text-sm`,children:[(0,J.jsx)(`p`,{className:`font-medium`,children:n?`Prepare checkout`:`No checkout yet`}),(0,J.jsxs)(`p`,{className:`text-muted`,children:[`Host: `,t.name]}),D&&(0,J.jsx)(`p`,{className:`text-muted`,children:D}),O&&(0,J.jsxs)(`p`,{className:`text-muted`,children:[`Set a`,` `,(0,J.jsx)(H,{to:V(`hosts/${encodeURIComponent(t.id)}`),target:`_blank`,rel:`noreferrer`,children:`checkout location`}),` `,`for this host, or attach an existing clone.`]}),h&&(0,J.jsxs)(`p`,{className:`break-words text-muted`,children:[`Check the checkout status at `,(0,J.jsx)(`span`,{className:`font-mono`,children:h}),` before trying again.`]}),(0,J.jsx)(m,{error:S}),c?(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsxs)(`p`,{className:`break-words`,children:[`Destination: `,(0,J.jsx)(`span`,{className:`font-mono`,children:c.path})]}),c.action===`collision`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{children:`Choose another folder. The existing path will not be changed.`}),(0,J.jsx)(U,{label:`Alternative folder name`,id:s,error:k,children:(0,J.jsx)(L,{id:s,value:u,disabled:!!y,onChange:e=>d(e.target.value),autoComplete:`off`,autoCapitalize:`off`,spellCheck:!1,...se(s,{error:k})})}),(0,J.jsx)(g,{disabled:!!D||!!y||!u.trim()||!!k||u.trim()===f,onClick:()=>void j(u.trim()),children:`Preview this folder`})]}):c.previewId?(0,J.jsx)(g,{variant:`primary`,busy:y===`apply`,disabled:!!D,onClick:()=>void M(),children:c.action===`reuse`?`Use existing checkout`:`Clone to ${t.name}`}):(0,J.jsx)(`p`,{children:`Cancel this preview and preview again before preparing this checkout.`}),(0,J.jsx)(g,{size:`sm`,variant:`ghost`,disabled:!!y,onClick:()=>{l(null),d(``),C(null)},children:`Cancel preview`})]}):!D&&(!O||h)?(0,J.jsx)(g,{busy:y===`preview`,onClick:()=>void j(h?f:void 0),children:h?`Check checkout status`:`Preview checkout`}):null,A&&(D||O||!t.checkoutProvision)&&(w?(0,J.jsx)(Qe,{project:e,host:t,onBusyChange:i,onAttached:()=>{T(!1),o?.()}}):(0,J.jsx)(`div`,{children:(0,J.jsx)(g,{onClick:()=>T(!0),children:`Attach existing checkout`})}))]})}function Qe({project:e,host:t,onBusyChange:n,onAttached:r}){let i=(0,q.useId)(),o=(0,q.useRef)(!1),[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(null),p=re(s);return(0,J.jsxs)(`form`,{className:`space-y-2`,onSubmit:async i=>{if(i.preventDefault(),!(o.current||p)){o.current=!0,u(!0),n?.(!0),f(null);try{let n=await _(`/api/projects/${encodeURIComponent(e.id)}/checkouts`,{hostId:t.id,path:s.trim()});a.getState().recordPreparedCheckout(n.checkout,n.workspaces),R.success(`Checkout attached`),r()}catch(e){f(e)}finally{u(!1),n?.(!1),o.current=!1}}},children:[(0,J.jsx)(U,{id:i,label:`Checkout path on the host`,hint:`Absolute path to an existing clone of this repository.`,children:(0,J.jsx)(L,{id:i,value:s,className:`font-mono`,onChange:e=>c(e.target.value),autoComplete:`off`,autoCapitalize:`off`,spellCheck:!1,...se(i,{hint:!0})})}),(0,J.jsx)(m,{error:d}),(0,J.jsx)(g,{type:`submit`,busy:l,disabled:!!p,children:`Attach checkout`})]})}function $e(e){return e.startsWith(`local:`)?`Local only`:e.replace(/^[a-z][a-z0-9+.-]*:\/\//i,``)}function et(e,t){let n=t.trim().toLowerCase();return!n||e.name.toLowerCase().includes(n)||e.repoIdentity.toLowerCase().includes(n)}function tt({value:e}){let t=200,n=new Set,r=()=>(0,J.jsx)(`span`,{children:`More data omitted`});function i(e,a){if(t<=0||(t--,a>8))return r();if(e===null)return`None`;if(typeof e==`string`)return e===``?`Empty text`:e.length>4e3?`${e.slice(0,4e3)}…`:e;if(typeof e==`number`)return Number.isFinite(e)?String(e):`Not available`;if(typeof e==`boolean`)return e?`Yes`:`No`;if(typeof e!=`object`)return`Not available`;let o=Array.isArray(e),s=Object.getPrototypeOf(e);if(!o&&s!==Object.prototype&&s!==null)return`Not available`;if(n.has(e))return r();n.add(e);let c=[];if(o)for(let n=0;n<e.length;n++){if(t<=0){c.push((0,J.jsx)(`li`,{children:r()},`omitted`));break}let o=Object.getOwnPropertyDescriptor(e,String(n));c.push((0,J.jsx)(`li`,{children:i(o&&`value`in o?o.value:void 0,a+1)},n))}else for(let n in e){if(!Object.hasOwn(e,n))continue;if(t<=0){c.push((0,J.jsx)(`div`,{children:r()},`omitted`));break}let o=Object.getOwnPropertyDescriptor(e,n);c.push((0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`dt`,{className:`font-medium break-words`,children:n}),(0,J.jsx)(`dd`,{className:`min-w-0 pl-3`,children:i(o&&`value`in o?o.value:void 0,a+1)})]},n))}return n.delete(e),c.length?o?(0,J.jsx)(`ol`,{className:`min-w-0 list-decimal space-y-1 pl-5`,children:c}):(0,J.jsx)(`dl`,{className:`min-w-0 space-y-1`,children:c}):o?`No items`:`No fields`}return(0,J.jsx)(`div`,{className:`min-w-0 text-xs break-words whitespace-pre-wrap`,children:i(e,0)})}export{fe as _,Je as a,Z as c,Me as d,we as f,me as g,he as h,Ze as i,Oe as l,ye as m,et as n,qe as o,be as p,$e as r,Re as s,tt as t,ke as u};
|
|
5
|
-
//# sourceMappingURL=StructuredValue-DdwqFsZd.js.map
|