@kky42/pievo-server 2.4.6 → 2.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/MachinesModal-ClNm1IAU.js +1 -0
  3. package/.output/public/assets/{index-BqiDqbyu.js → index-DM5pYU2E.js} +3 -3
  4. package/.output/public/assets/{invite._token-C7wSLe5z.js → invite._token-CjcTZgvV.js} +1 -1
  5. package/.output/public/assets/{loops._loopId-DEMMNA_5.js → loops._loopId-1WUV1NQv.js} +2 -2
  6. package/.output/public/assets/{loops._loopId_.runs._runId-DgThODTl.js → loops._loopId_.runs._runId-BgUc4GIy.js} +2 -2
  7. package/.output/public/assets/{routes-C581U2Ac.js → routes-DTmJ-YqP.js} +1 -1
  8. package/.output/public/assets/{t._teamId-D8prt2QZ.js → t._teamId-BmUhbnOU.js} +1 -1
  9. package/.output/server/_libs/@tanstack/react-router+[...].mjs +1 -1
  10. package/.output/server/_ssr/{DashboardView-CDGLNgi_.mjs → DashboardView-DTfEhixr.mjs} +8 -8
  11. package/.output/server/_ssr/{MachinesModal-BkHx2efW.mjs → MachinesModal-D54Uza6A.mjs} +45 -17
  12. package/.output/server/_ssr/{SignIn-DwHmFBg2.mjs → SignIn-C2JkrSfV.mjs} +2 -2
  13. package/.output/server/_ssr/{SocialLinks-y7JuqJqp.mjs → SocialLinks-dPCmZWvC.mjs} +2 -2
  14. package/.output/server/_ssr/{artifactFiles-1f04rZwG.mjs → artifactFiles-DBu2yk9a.mjs} +3 -3
  15. package/.output/server/_ssr/{artifactKind-DCMrrjl8.mjs → artifactKind-CJMjNtSC.mjs} +3 -3
  16. package/.output/server/_ssr/artifacts-8JYBE5zx.mjs +2 -0
  17. package/.output/server/_ssr/{auth-C_Xnj8JO.mjs → auth-b1o4lrGO.mjs} +22 -9
  18. package/.output/server/_ssr/{boot-D_THchbC.mjs → boot-CEPRQU5M.mjs} +48 -37
  19. package/.output/server/_ssr/{boot-DnVqzrBE.mjs → boot-dZdGfkZm.mjs} +1 -1
  20. package/.output/server/_ssr/{bun-sqlite-dialect-BW9W1_Ps-mjhr2FKB.mjs → bun-sqlite-dialect-BW9W1_Ps-D2QuIuwp.mjs} +2 -2
  21. package/.output/server/_ssr/{d1-sqlite-dialect-BLC8LXE6-57NKRt7v.mjs → d1-sqlite-dialect-BLC8LXE6-CdT8qARs.mjs} +2 -2
  22. package/.output/server/_ssr/db-CJUmGnnY.mjs +2 -0
  23. package/.output/server/_ssr/{dist-xlBlQKer.mjs → dist-E-fSrrAE.mjs} +2 -2
  24. package/.output/server/_ssr/{factory-CUICkr5b.mjs → factory-CzRRgvct.mjs} +2 -2
  25. package/.output/server/_ssr/invite._token-CGzJGIfm.mjs +1 -1
  26. package/.output/server/_ssr/{invite._token-CSENXkE5.mjs → invite._token-DDDd3vNf.mjs} +3 -3
  27. package/.output/server/_ssr/{invite._token-C3ik1Xca.mjs → invite._token-ZthOtmu9.mjs} +6 -6
  28. package/.output/server/_ssr/{kysely-adapter-8WrOeuSs.mjs → kysely-adapter-cB-XpVsU.mjs} +1 -1
  29. package/.output/server/_ssr/logger-Co0_q7fy.mjs +2 -0
  30. package/.output/server/_ssr/{loopApi-B7uUJlS3.mjs → loopApi-DxDYnPI7.mjs} +10 -10
  31. package/.output/server/_ssr/{loopProjection-B30cdu8n.mjs → loopProjection-CeH1HELf.mjs} +2 -2
  32. package/.output/server/_ssr/{loops._loopId-Dx0u0aw-.mjs → loops._loopId-BTAKWGvT.mjs} +8 -8
  33. package/.output/server/_ssr/{loops._loopId_.runs._runId-B2ONGiQe.mjs → loops._loopId_.runs._runId-BGl_4tUK.mjs} +5 -5
  34. package/.output/server/_ssr/{loops._loopId_.runs._runId-CeJuOVke.mjs → loops._loopId_.runs._runId-BRzoEUe1.mjs} +3 -3
  35. package/.output/server/_ssr/{machineFns-DslRixAv.mjs → machineFns-Bmh_4hnx.mjs} +21 -7
  36. package/.output/server/_ssr/{node-sqlite-dialect-D74sKAO_.mjs → node-sqlite-dialect-C8O4zOiM.mjs} +2 -2
  37. package/.output/server/_ssr/{router-DvhSmRzV.mjs → router-Vpcd2SDx.mjs} +21 -21
  38. package/.output/server/_ssr/{routes-CKoFPECd.mjs → routes-BczmJLuq.mjs} +5 -5
  39. package/.output/server/_ssr/routes-D5GHah06.mjs +1 -1
  40. package/.output/server/_ssr/{routes-Dr2NUhk0.mjs → routes-DBCYbmLW.mjs} +4 -4
  41. package/.output/server/_ssr/runDiff-Ce1DhI7z.mjs +2 -0
  42. package/.output/server/_ssr/ssr.mjs +39 -39
  43. package/.output/server/_ssr/store-BpbKfvFY.mjs +2 -0
  44. package/.output/server/_ssr/{t._teamId-xSDQfJUD.mjs → t._teamId-COKCNxP7.mjs} +4 -4
  45. package/.output/server/_ssr/t._teamId-CrZ7EkUL.mjs +1 -1
  46. package/.output/server/_ssr/{t._teamId-94LkBNB8.mjs → t._teamId-D0Y3DqcE.mjs} +5 -5
  47. package/.output/server/_ssr/{teamFns-BEvVeIHP.mjs → teamFns-BMR5TRJw.mjs} +2 -2
  48. package/.output/server/_ssr/{teamFns-C2jguwv8.mjs → teamFns-DctV7gTn.mjs} +3 -3
  49. package/.output/server/_ssr/tokens-BP8ltV6J.mjs +2 -0
  50. package/.output/server/{_tanstack-start-manifest_v-CjVWGjiv.mjs → _tanstack-start-manifest_v-CevOnXtc.mjs} +11 -11
  51. package/.output/server/index.mjs +60 -60
  52. package/package.json +1 -1
  53. package/.output/public/assets/MachinesModal-zPwcC1mr.js +0 -1
  54. package/.output/server/_ssr/artifacts-DM3Q8kSN.mjs +0 -2
  55. package/.output/server/_ssr/db-BUHGfj7t.mjs +0 -2
  56. package/.output/server/_ssr/logger-CQdxLIT9.mjs +0 -2
  57. package/.output/server/_ssr/runDiff-BIYvi0EH.mjs +0 -2
  58. package/.output/server/_ssr/store-B_RNzP1r.mjs +0 -2
  59. package/.output/server/_ssr/tokens-BzwlaFxs.mjs +0 -2
@@ -1 +1 @@
1
- import{M as e,P as t,j as n,s as r}from"./ui-s5IMg6RF.js";import{M as i,i as a,s as o}from"./preload-helper-Bs7oCAsw.js";import{c as s,n as c,s as l}from"./index-BqiDqbyu.js";import{t as u}from"./SignIn-Cf4HOpdF.js";var d=t(e()),f=n();function p({children:e}){return(0,f.jsxs)(`div`,{className:`mx-auto mt-32 max-w-sm text-center`,children:[(0,f.jsx)(a,{size:52}),(0,f.jsx)(`h1`,{className:`mt-4 text-2xl font-semibold tracking-tight text-display`,children:`Team invite`}),e]})}function m(){let e=c.useLoaderData(),{data:t,isPending:n}=o(),a=i(),[m,h]=(0,d.useState)(`idle`),[g,_]=(0,d.useState)(null),v=(0,d.useRef)(!1),y=e.auth.enabled,b=y?!!t:!1;return(0,d.useEffect)(()=>{!y||n||!b||v.current||(v.current=!0,h(`redeeming`),(async()=>{let t=await l({data:e.token});if(t.ok){s(t.teamId),a({to:`/t/$teamId`,params:{teamId:t.teamId}});return}_(t.error),h(`error`)})())},[y,n,b,e.token,a]),y?!n&&!b?(0,f.jsx)(u,{callbackURL:`/invite/${e.token}`}):m===`error`?(0,f.jsxs)(p,{children:[(0,f.jsx)(`p`,{className:`mt-3 text-sm text-accent`,children:g}),(0,f.jsx)(`button`,{className:`${r} mt-6`,onClick:()=>void a({to:`/`}),children:`Go to the dashboard`})]}):(0,f.jsx)(p,{children:(0,f.jsx)(`p`,{className:`mt-2 text-sm text-secondary`,children:`Joining the team…`})}):(0,f.jsxs)(p,{children:[(0,f.jsx)(`p`,{className:`mt-2 text-sm text-secondary`,children:`This Pievo server runs in open mode (a single shared workspace), so team invites don't apply here.`}),(0,f.jsx)(`button`,{className:`${r} mt-6`,onClick:()=>void a({to:`/`}),children:`Go to the dashboard`})]})}export{m as component};
1
+ import{M as e,P as t,j as n,s as r}from"./ui-s5IMg6RF.js";import{M as i,i as a,s as o}from"./preload-helper-Bs7oCAsw.js";import{c as s,n as c,s as l}from"./index-DM5pYU2E.js";import{t as u}from"./SignIn-Cf4HOpdF.js";var d=t(e()),f=n();function p({children:e}){return(0,f.jsxs)(`div`,{className:`mx-auto mt-32 max-w-sm text-center`,children:[(0,f.jsx)(a,{size:52}),(0,f.jsx)(`h1`,{className:`mt-4 text-2xl font-semibold tracking-tight text-display`,children:`Team invite`}),e]})}function m(){let e=c.useLoaderData(),{data:t,isPending:n}=o(),a=i(),[m,h]=(0,d.useState)(`idle`),[g,_]=(0,d.useState)(null),v=(0,d.useRef)(!1),y=e.auth.enabled,b=y?!!t:!1;return(0,d.useEffect)(()=>{!y||n||!b||v.current||(v.current=!0,h(`redeeming`),(async()=>{let t=await l({data:e.token});if(t.ok){s(t.teamId),a({to:`/t/$teamId`,params:{teamId:t.teamId}});return}_(t.error),h(`error`)})())},[y,n,b,e.token,a]),y?!n&&!b?(0,f.jsx)(u,{callbackURL:`/invite/${e.token}`}):m===`error`?(0,f.jsxs)(p,{children:[(0,f.jsx)(`p`,{className:`mt-3 text-sm text-accent`,children:g}),(0,f.jsx)(`button`,{className:`${r} mt-6`,onClick:()=>void a({to:`/`}),children:`Go to the dashboard`})]}):(0,f.jsx)(p,{children:(0,f.jsx)(`p`,{className:`mt-2 text-sm text-secondary`,children:`Joining the team…`})}):(0,f.jsxs)(p,{children:[(0,f.jsx)(`p`,{className:`mt-2 text-sm text-secondary`,children:`This Pievo server runs in open mode (a single shared workspace), so team invites don't apply here.`}),(0,f.jsx)(`button`,{className:`${r} mt-6`,onClick:()=>void a({to:`/`}),children:`Go to the dashboard`})]})}export{m as component};
@@ -1,4 +1,4 @@
1
- import{C as e,D as t,M as n,P as r,T as i,_ as a,a as o,b as s,c,d as l,h as u,j as d,m as f,n as ee,o as te,p as ne,r as re,s as ie,t as ae,u as p,v as m,x as h}from"./ui-s5IMg6RF.js";import{C as oe,M as se,S as ce,T as le,d as ue,h as de,j as fe,l as pe,s as me,u as he,w as ge,x as _e,y as ve}from"./preload-helper-Bs7oCAsw.js";import{c as ye,o as g,s as be,t as xe}from"./MachinesModal-zPwcC1mr.js";import{n as Se,r as Ce,t as we}from"./lifecycleUi-C0DaC6NM.js";import{c as Te,r as Ee}from"./index-BqiDqbyu.js";import{t as De}from"./SignIn-Cf4HOpdF.js";import{i as Oe,n as _,r as ke,t as v}from"./actionUi-yYVvoOTn.js";var y=r(n(),1),b={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,avif:`image/avif`,bmp:`image/bmp`,ico:`image/x-icon`,svg:`image/svg+xml`};function x(e){return(e.match(/\.([a-z0-9]+)$/i)?.[1]??``).toLowerCase()}function S(e){return b[x(e)]??null}var C=e=>S(e)!==null,Ae=e=>x(e)===`html`||x(e)===`htm`,je=e=>x(e)===`md`||x(e)===`markdown`;function Me(e){return C(e)?`image`:Ae(e)?`html`:je(e)?`markdown`:`text`}function w(e,t){let n=t.split(`/`).map(encodeURIComponent).join(`/`);return`/api/artifact/${encodeURIComponent(e)}/${n}`}function T(e,t){return`${w(e,t)}?view=inline`}function E(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ne(e){if(Array.isArray(e))return e}function D(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Pe(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{C as e,D as t,M as n,P as r,T as i,_ as a,a as o,b as s,c,d as l,h as u,j as d,m as f,n as ee,o as te,p as ne,r as re,s as ie,t as ae,u as p,v as m,x as h}from"./ui-s5IMg6RF.js";import{C as oe,M as se,S as ce,T as le,d as ue,h as de,j as fe,l as pe,s as me,u as he,w as ge,x as _e,y as ve}from"./preload-helper-Bs7oCAsw.js";import{c as ye,o as g,s as be,t as xe}from"./MachinesModal-ClNm1IAU.js";import{n as Se,r as Ce,t as we}from"./lifecycleUi-C0DaC6NM.js";import{i as Te,n as Ee,r as De,t as Oe}from"./actionUi-yYVvoOTn.js";import{c as _,r as ke}from"./index-DM5pYU2E.js";import{t as v}from"./SignIn-Cf4HOpdF.js";var y=r(n(),1),b={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,avif:`image/avif`,bmp:`image/bmp`,ico:`image/x-icon`,svg:`image/svg+xml`};function x(e){return(e.match(/\.([a-z0-9]+)$/i)?.[1]??``).toLowerCase()}function S(e){return b[x(e)]??null}var C=e=>S(e)!==null,Ae=e=>x(e)===`html`||x(e)===`htm`,je=e=>x(e)===`md`||x(e)===`markdown`;function Me(e){return C(e)?`image`:Ae(e)?`html`:je(e)?`markdown`:`text`}function w(e,t){let n=t.split(`/`).map(encodeURIComponent).join(`/`);return`/api/artifact/${encodeURIComponent(e)}/${n}`}function T(e,t){return`${w(e,t)}?view=inline`}function E(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ne(e){if(Array.isArray(e))return e}function D(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Pe(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fe(e,t){return Ne(e)||D(e,t)||O(e,t)||Pe()}function O(e,t){if(e){if(typeof e==`string`)return E(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?E(e,t):void 0}}var Ie=Object.entries,Le=Object.setPrototypeOf,Re=Object.isFrozen,ze=Object.getPrototypeOf,Be=Object.getOwnPropertyDescriptor,k=Object.freeze,A=Object.seal,Ve=Object.create,He=typeof Reflect<`u`&&Reflect,Ue=He.apply,We=He.construct;k||=function(e){return e},A||=function(e){return e},Ue||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},We||=function(e){return new e(...[...arguments].slice(1))};var Ge=P(Array.prototype.forEach),Ke=P(Array.prototype.lastIndexOf),qe=P(Array.prototype.pop),Je=P(Array.prototype.push),Ye=P(Array.prototype.splice),Xe=Array.isArray,Ze=P(String.prototype.toLowerCase),Qe=P(String.prototype.toString),$e=P(String.prototype.match),et=P(String.prototype.replace),tt=P(String.prototype.indexOf),nt=P(String.prototype.trim),rt=P(Number.prototype.toString),it=P(Boolean.prototype.toString),j=typeof BigInt>`u`?null:P(BigInt.prototype.toString),at=typeof Symbol>`u`?null:P(Symbol.prototype.toString),M=P(Object.prototype.hasOwnProperty),ot=P(Object.prototype.toString),N=P(RegExp.prototype.test),st=ct(TypeError);function P(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Ue(e,t,n)}}function ct(e){return function(){return We(e,[...arguments])}}function F(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ze;if(Le&&Le(e,null),!Xe(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Re(t)||(t[r]=e),i=e)}e[i]=!0}return e}function lt(e){for(let t=0;t<e.length;t++)M(e,t)||(e[t]=null);return e}function I(e){let t=Ve(null);for(let r of Ie(e)){var n=Fe(r,2);let i=n[0],a=n[1];M(e,i)&&(Xe(a)?t[i]=lt(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=I(a):t[i]=a)}return t}function ut(e){switch(typeof e){case`string`:return e;case`number`:return rt(e);case`boolean`:return it(e);case`bigint`:return j?j(e):`0`;case`symbol`:return at?at(e):`Symbol()`;case`undefined`:return ot(e);case`function`:case`object`:{if(e===null)return ot(e);let t=e,n=L(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:ot(e)}return ot(e)}default:return ot(e)}}function L(e,t){for(;e!==null;){let n=Be(e,t);if(n){if(n.get)return P(n.get);if(typeof n.value==`function`)return P(n.value)}e=ze(e)}function n(){return null}return n}function dt(e){try{return N(e,``),!0}catch{return!1}}var ft=k(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),pt=k(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),mt=k([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),ht=k([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),gt=k(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),_t=k([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),vt=k([`#text`]),yt=k(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),bt=k(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),xt=k(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),St=k([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Ct=A(/{{[\w\W]*|^[\w\W]*}}/g),wt=A(/<%[\w\W]*|^[\w\W]*%>/g),Tt=A(/\${[\w\W]*/g),Et=A(/^data-[\-\w.\u00B7-\uFFFF]+$/),Dt=A(/^aria-[\-\w]+$/),Ot=A(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),kt=A(/^(?:\w+script|data):/i),At=A(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),jt=A(/^html$/i),Mt=A(/^[a-z][.\w]*(-[.\w]+)+$/i),Nt=A(/<[/\w!]/g),Pt=A(/<[/\w]/g),Ft=A(/<\/no(script|embed|frames)/i),It=A(/\/>/i),R={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Lt=function(){return typeof window>`u`?null:window},Rt=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},zt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Bt=function(e,t,n,r){return M(e,t)&&Xe(e[t])?F(r.base?I(r.base):{},e[t],r.transform):n};function Vt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Lt(),t=e=>Vt(e);if(t.version=`3.4.11`,t.removed=[],!e||!e.document||e.document.nodeType!==R.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=L(d,`cloneNode`),ee=L(d,`remove`),te=L(d,`nextSibling`),ne=L(d,`childNodes`),re=L(d,`parentNode`),ie=L(d,`shadowRoot`),ae=L(d,`attributes`),p=o&&o.prototype?L(o.prototype,`nodeType`):null,m=o&&o.prototype?L(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let h,oe=``,se,ce=!1,le=0,ue=function(){if(le>0)throw st(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},de=function(e){ue(),le++;try{return h.createHTML(e)}finally{le--}},fe=function(e){ue(),le++;try{return h.createScriptURL(e)}finally{le--}},pe=function(){return ce||=(se=Rt(u,i),!0),se},me=n,he=me.implementation,ge=me.createNodeIterator,_e=me.createDocumentFragment,ve=me.getElementsByTagName,ye=r.importNode,g=zt();t.isSupported=typeof Ie==`function`&&typeof re==`function`&&he&&he.createHTMLDocument!==void 0;let be=Ct,xe=wt,Se=Tt,Ce=Et,we=Dt,Te=kt,Ee=At,De=Mt,Oe=Ot,_=null,ke=F({},[...ft,...pt,...mt,...gt,...vt]),v=null,y=F({},[...yt,...bt,...xt,...St]),b=Object.seal(Ve(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),x=null,S=null,C=Object.seal(Ve(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ae=!0,je=!0,Me=!1,w=!0,T=!1,E=!0,Ne=!1,D=!1,Pe=null,Fe=null,O=!1,Le=!1,Re=!1,ze=!1,Be=!0,He=!1,Ue=`user-content-`,We=!0,rt=!1,it={},j=null,at=F({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),ot=null,P=F({},[`audio`,`video`,`img`,`source`,`image`,`track`]),ct=null,lt=F({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ht=`http://www.w3.org/1998/Math/MathML`,Ut=`http://www.w3.org/2000/svg`,z=`http://www.w3.org/1999/xhtml`,Wt=z,B=!1,V=null,H=F({},[Ht,Ut,z],Qe),Gt=k([`mi`,`mo`,`mn`,`ms`,`mtext`]),U=F({},Gt),Kt=k([`annotation-xml`]),qt=F({},Kt),Jt=F({},[`title`,`style`,`font`,`a`,`script`]),W=null,Yt=[`application/xhtml+xml`,`text/html`],G=null,Xt=null,Zt=n.createElement(`form`),Qt=function(e){return e instanceof RegExp||e instanceof Function},$t=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Xt&&Xt===e)return;(!e||typeof e!=`object`)&&(e={}),e=I(e),W=Yt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,G=W===`application/xhtml+xml`?Qe:Ze,_=Bt(e,`ALLOWED_TAGS`,ke,{transform:G}),v=Bt(e,`ALLOWED_ATTR`,y,{transform:G}),V=Bt(e,`ALLOWED_NAMESPACES`,H,{transform:Qe}),ct=Bt(e,`ADD_URI_SAFE_ATTR`,lt,{transform:G,base:lt}),ot=Bt(e,`ADD_DATA_URI_TAGS`,P,{transform:G,base:P}),j=Bt(e,`FORBID_CONTENTS`,at,{transform:G}),x=Bt(e,`FORBID_TAGS`,I({}),{transform:G}),S=Bt(e,`FORBID_ATTR`,I({}),{transform:G}),it=M(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?I(e.USE_PROFILES):e.USE_PROFILES:!1,Ae=e.ALLOW_ARIA_ATTR!==!1,je=e.ALLOW_DATA_ATTR!==!1,Me=e.ALLOW_UNKNOWN_PROTOCOLS||!1,w=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,T=e.SAFE_FOR_TEMPLATES||!1,E=e.SAFE_FOR_XML!==!1,Ne=e.WHOLE_DOCUMENT||!1,Le=e.RETURN_DOM||!1,Re=e.RETURN_DOM_FRAGMENT||!1,ze=e.RETURN_TRUSTED_TYPE||!1,O=e.FORCE_BODY||!1,Be=e.SANITIZE_DOM!==!1,He=e.SANITIZE_NAMED_PROPS||!1,We=e.KEEP_CONTENT!==!1,rt=e.IN_PLACE||!1,Oe=dt(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Ot,Wt=typeof e.NAMESPACE==`string`?e.NAMESPACE:z,U=M(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?I(e.MATHML_TEXT_INTEGRATION_POINTS):F({},Gt),qt=M(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?I(e.HTML_INTEGRATION_POINTS):F({},Kt);let t=M(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?I(e.CUSTOM_ELEMENT_HANDLING):Ve(null);if(b=Ve(null),M(t,`tagNameCheck`)&&Qt(t.tagNameCheck)&&(b.tagNameCheck=t.tagNameCheck),M(t,`attributeNameCheck`)&&Qt(t.attributeNameCheck)&&(b.attributeNameCheck=t.attributeNameCheck),M(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(b.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),A(b),T&&(je=!1),Re&&(Le=!0),it&&(_=F({},vt),v=Ve(null),it.html===!0&&(F(_,ft),F(v,yt)),it.svg===!0&&(F(_,pt),F(v,bt),F(v,St)),it.svgFilters===!0&&(F(_,mt),F(v,bt),F(v,St)),it.mathMl===!0&&(F(_,gt),F(v,xt),F(v,St))),C.tagCheck=null,C.attributeCheck=null,M(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?C.tagCheck=e.ADD_TAGS:Xe(e.ADD_TAGS)&&(_===ke&&(_=I(_)),F(_,e.ADD_TAGS,G))),M(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?C.attributeCheck=e.ADD_ATTR:Xe(e.ADD_ATTR)&&(v===y&&(v=I(v)),F(v,e.ADD_ATTR,G))),M(e,`ADD_URI_SAFE_ATTR`)&&Xe(e.ADD_URI_SAFE_ATTR)&&F(ct,e.ADD_URI_SAFE_ATTR,G),M(e,`FORBID_CONTENTS`)&&Xe(e.FORBID_CONTENTS)&&(j===at&&(j=I(j)),F(j,e.FORBID_CONTENTS,G)),M(e,`ADD_FORBID_CONTENTS`)&&Xe(e.ADD_FORBID_CONTENTS)&&(j===at&&(j=I(j)),F(j,e.ADD_FORBID_CONTENTS,G)),We&&(_[`#text`]=!0),Ne&&F(_,[`html`,`head`,`body`]),_.table&&(F(_,[`tbody`]),delete x.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw st(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw st(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=h;h=e.TRUSTED_TYPES_POLICY;try{oe=de(``)}catch(e){throw h=t,e}}else e.TRUSTED_TYPES_POLICY===null?(h=void 0,oe=``):(h===void 0&&(h=pe()),h&&typeof oe==`string`&&(oe=de(``)));k&&k(e),Xt=e},en=F({},[...pt,...mt,...ht]),tn=F({},[...gt,..._t]),nn=function(e,t,n){return t.namespaceURI===z?e===`svg`:t.namespaceURI===Ht?e===`svg`&&(n===`annotation-xml`||U[n]):!!en[e]},rn=function(e,t,n){return t.namespaceURI===z?e===`math`:t.namespaceURI===Ut?e===`math`&&qt[n]:!!tn[e]},an=function(e,t,n){return t.namespaceURI===Ut&&!qt[n]||t.namespaceURI===Ht&&!U[n]?!1:!tn[e]&&(Jt[e]||!en[e])},on=function(e){let t=re(e);(!t||!t.tagName)&&(t={namespaceURI:Wt,tagName:`template`});let n=Ze(e.tagName),r=Ze(t.tagName);return V[e.namespaceURI]?e.namespaceURI===Ut?nn(n,t,r):e.namespaceURI===Ht?rn(n,t,r):e.namespaceURI===z?an(n,t,r):!!(W===`application/xhtml+xml`&&V[e.namespaceURI]):!1},sn=function(e){Je(t.removed,{element:e});try{re(e).removeChild(e)}catch{if(ee(e),!re(e))throw st(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},cn=function(e){let t=ne(e);if(t){let e=[];Ge(t,t=>{Je(e,t)}),Ge(e,e=>{try{ee(e)}catch{}})}let n=ae(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},K=function(e,n){try{Je(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{Je(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(Le||Re)try{sn(n)}catch{}else try{n.setAttribute(e,``)}catch{}},ln=function(e){let t=ae(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||v[G(i)]))try{e.removeAttribute(i)}catch{}}},un=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(p?p(e):e.nodeType)===R.element&&ln(e);let n=ne(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},dn=function(e){let t=null,r=null;if(O)e=`<remove></remove>`+e;else{let t=$e(e,/^[\r\n\t ]+/);r=t&&t[0]}W===`application/xhtml+xml`&&Wt===z&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=h?de(e):e;if(Wt===z)try{t=new l().parseFromString(i,W)}catch{}if(!t||!t.documentElement){t=he.createDocument(Wt,`template`,null);try{t.documentElement.innerHTML=B?oe:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Wt===z?ve.call(t,Ne?`html`:`body`)[0]:Ne?t.documentElement:a},fn=function(e){return ge.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},pn=function(e){return e=et(e,be,` `),e=et(e,xe,` `),e=et(e,Se,` `),e},mn=function(e){e.normalize();let t=ge.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;)n.data=pn(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&Ge(r,e=>{q(e.content)&&mn(e.content)})},hn=function(e){let t=m?m(e):null;return typeof t!=`string`||G(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==ae(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==p(e)||e.childNodes!==ne(e)},q=function(e){if(!p||typeof e!=`object`||!e)return!1;try{return p(e)===R.documentFragment}catch{return!1}},gn=function(e){if(!p||typeof e!=`object`||!e)return!1;try{return typeof p(e)==`number`}catch{return!1}};function J(e,n,r){e.length!==0&&Ge(e,e=>{e.call(t,n,r,Xt)})}let _n=function(e,t){return!!(E&&e.hasChildNodes()&&!gn(e.firstElementChild)&&N(Nt,e.textContent)&&N(Nt,e.innerHTML)||E&&e.namespaceURI===z&&t===`style`&&gn(e.firstElementChild)||e.nodeType===R.processingInstruction||E&&e.nodeType===R.comment&&N(Pt,e.data))},vn=function(e,t){if(!x[t]&&Sn(t)&&(b.tagNameCheck instanceof RegExp&&N(b.tagNameCheck,t)||b.tagNameCheck instanceof Function&&b.tagNameCheck(t)))return!1;if(We&&!j[t]){let t=re(e),n=ne(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=rt?n[i]:f(n[i],!0);t.insertBefore(r,te(e))}}}return sn(e),!0},yn=function(e){if(J(g.beforeSanitizeElements,e,null),hn(e))return sn(e),!0;let n=G(m?m(e):e.nodeName);if(J(g.uponSanitizeElement,e,{tagName:n,allowedTags:_}),_n(e,n))return sn(e),!0;if(x[n]||!(C.tagCheck instanceof Function&&C.tagCheck(n))&&!_[n])return vn(e,n);if((p?p(e):e.nodeType)===R.element&&!on(e)||(n===`noscript`||n===`noembed`||n===`noframes`)&&N(Ft,e.innerHTML))return sn(e),!0;if(T&&e.nodeType===R.text){let n=pn(e.textContent);e.textContent!==n&&(Je(t.removed,{element:e.cloneNode()}),e.textContent=n)}return J(g.afterSanitizeElements,e,null),!1},bn=function(e,t,r){if(S[t]||Be&&(t===`id`||t===`name`)&&(r in n||r in Zt))return!1;let i=v[t]||C.attributeCheck instanceof Function&&C.attributeCheck(t,e);if(!(je&&N(Ce,t))&&!(Ae&&N(we,t))){if(!i){if(!(Sn(e)&&(b.tagNameCheck instanceof RegExp&&N(b.tagNameCheck,e)||b.tagNameCheck instanceof Function&&b.tagNameCheck(e))&&(b.attributeNameCheck instanceof RegExp&&N(b.attributeNameCheck,t)||b.attributeNameCheck instanceof Function&&b.attributeNameCheck(t,e))||t===`is`&&b.allowCustomizedBuiltInElements&&(b.tagNameCheck instanceof RegExp&&N(b.tagNameCheck,r)||b.tagNameCheck instanceof Function&&b.tagNameCheck(r))))return!1}else if(!ct[t]&&!N(Oe,et(r,Ee,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&tt(r,`data:`)===0&&ot[e])&&!(Me&&!N(Te,et(r,Ee,``)))&&r)return!1}return!0},xn=F({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Sn=function(e){return!xn[Ze(e)]&&N(De,e)},Cn=function(e,t,n,r){if(h&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return de(r);case`TrustedScriptURL`:return fe(r)}return r},wn=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),hn(e)?sn(e):qe(t.removed)}catch{K(n,e)}},Tn=function(e){J(g.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||hn(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:v,forceKeepAttr:void 0},r=t.length,i=G(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=G(o),u=c,d=o===`value`?u:nt(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,J(g.uponSanitizeAttribute,e,n),d=n.attrValue,He&&(l===`id`||l===`name`)&&tt(d,Ue)!==0&&(K(o,e),d=Ue+d),E&&N(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){K(o,e);continue}if(l===`attributename`&&$e(d,`href`)){K(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){K(o,e);continue}if(!w&&N(It,d)){K(o,e);continue}if(T&&(d=pn(d)),!bn(i,l,d)){K(o,e);continue}d=Cn(i,l,s,d),d!==u&&wn(e,o,s,d)}}J(g.afterSanitizeAttributes,e,null)},En=function(e){let t=null,n=fn(e);for(J(g.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(J(g.uponSanitizeShadowNode,t,null),yn(t),Tn(t),q(t.content)&&En(t.content),(p?p(t):t.nodeType)===R.element){let e=ie(t);q(e)&&(Dn(e),En(e))}J(g.afterSanitizeShadowDOM,e,null)},Dn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){En(e.shadow);continue}let n=e.node,r=(p?p(n):n.nodeType)===R.element,i=ne(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=m?m(n):null;if(typeof e==`string`&&G(e)===`template`){let e=n.content;q(e)&&t.push({node:e,shadow:null})}}if(r){let e=ie(n);q(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(B=!e,B&&(e=`<!-->`),typeof e!=`string`&&!gn(e)&&(e=ut(e),typeof e!=`string`))throw st(`dirty is not a string, aborting`);if(!t.isSupported)return e;D?(_=Pe,v=Fe):$t(n),(g.uponSanitizeElement.length>0||g.uponSanitizeAttribute.length>0)&&(_=I(_)),g.uponSanitizeAttribute.length>0&&(v=I(v)),t.removed=[];let c=rt&&typeof e!=`string`&&gn(e);if(c){let t=m?m(e):e.nodeName;if(typeof t==`string`){let e=G(t);if(!_[e]||x[e])throw st(`root node is forbidden and cannot be sanitized in-place`)}if(hn(e))throw st(`root node is clobbered and cannot be sanitized in-place`);try{Dn(e)}catch(t){throw cn(e),t}}else if(gn(e))i=dn(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===R.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Dn(a);else{if(!Le&&!T&&!Ne&&e.indexOf(`<`)===-1)return h&&ze?de(e):e;if(i=dn(e),!i)return Le?null:ze?oe:``}i&&O&&sn(i.firstChild);let l=fn(c?e:i);try{for(;o=l.nextNode();)yn(o),Tn(o),q(o.content)&&En(o.content)}catch(t){throw c&&cn(e),t}if(c)return Ge(t.removed,e=>{e.element&&un(e.element)}),T&&mn(e),e;if(Le){if(T&&mn(i),Re)for(s=_e.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(v.shadowroot||v.shadowrootmode)&&(s=ye.call(r,s,!0)),s}let u=Ne?i.outerHTML:i.innerHTML;return Ne&&_[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&N(jt,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
3
3
  `+u),T&&(u=pn(u)),h&&ze?de(u):u},t.setConfig=function(){$t(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),D=!0,Pe=_,Fe=v},t.clearConfig=function(){Xt=null,D=!1,Pe=null,Fe=null,h=se,oe=``},t.isValidAttribute=function(e,t,n){return Xt||$t({}),bn(G(e),G(t),n)},t.addHook=function(e,t){typeof t==`function`&&M(g,e)&&Je(g[e],t)},t.removeHook=function(e,t){if(M(g,e)){if(t!==void 0){let n=Ke(g[e],t);return n===-1?void 0:Ye(g[e],n,1)[0]}return qe(g[e])}},t.removeHooks=function(e){M(g,e)&&(g[e]=[])},t.removeAllHooks=function(){g=zt()},t}var Ht=Vt();function Ut(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var z=Ut();function Wt(e){z=e}var B={exec:()=>null};function V(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function H(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(U.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Gt=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),U={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:V(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:V(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:V(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:V(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:V(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:V(e=>RegExp(`^ {0,${e}}>`))},Kt=/^(?:[ \t]*(?:\n|$))+/,qt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Jt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,W=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Yt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,G=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Xt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Zt=H(Xt).replace(/bull/g,G).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Qt=H(Xt).replace(/bull/g,G).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),$t=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,en=/^[^\n]+/,tn=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,nn=H(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,tn).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),rn=H(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,G).getRegex(),an=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,on=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sn=H(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,on).replace(`tag`,an).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),cn=H($t).replace(`hr`,W).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,an).getRegex(),K={blockquote:H(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,cn).getRegex(),code:qt,def:nn,fences:Jt,heading:Yt,hr:W,html:sn,lheading:Zt,list:rn,newline:Kt,paragraph:cn,table:B,text:en},ln=H(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,W).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,an).getRegex(),un={...K,lheading:Qt,table:ln,paragraph:H($t).replace(`hr`,W).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,ln).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,an).getRegex()},dn={...K,html:H(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,on).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:B,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:H($t).replace(`hr`,W).replace(`heading`,` *#{1,6} *[^
4
4
  ]`).replace(`lheading`,Zt).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},fn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,pn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,mn=/^( {2,}|\\)\n(?!\s*$)/,hn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,q=/[\p{P}\p{S}]/u,gn=/[\s\p{P}\p{S}]/u,J=/[^\s\p{P}\p{S}]/u,_n=H(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,gn).getRegex(),vn=/(?!~)[\p{P}\p{S}]/u,yn=/(?!~)[\s\p{P}\p{S}]/u,bn=/(?:[^\s\p{P}\p{S}]|~)/u,xn=H(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Gt?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Sn=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Cn=H(Sn,`u`).replace(/punct/g,q).getRegex(),wn=H(Sn,`u`).replace(/punct/g,vn).getRegex(),Tn=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,En=H(Tn,`gu`).replace(/notPunctSpace/g,J).replace(/punctSpace/g,gn).replace(/punct/g,q).getRegex(),Dn=H(Tn,`gu`).replace(/notPunctSpace/g,bn).replace(/punctSpace/g,yn).replace(/punct/g,vn).getRegex(),On=H(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,J).replace(/punctSpace/g,gn).replace(/punct/g,q).getRegex(),kn=H(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,q).getRegex(),An=H(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,J).replace(/punctSpace/g,gn).replace(/punct/g,q).getRegex(),jn=H(/\\(punct)/,`gu`).replace(/punct/g,q).getRegex(),Mn=H(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Nn=H(on).replace(`(?:-->|$)`,`-->`).getRegex(),Pn=H(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Nn).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Fn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,In=H(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Fn).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ln=H(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Fn).replace(`ref`,tn).getRegex(),Rn=H(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,tn).getRegex(),zn=H(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Ln).replace(`nolink`,Rn).getRegex(),Bn=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Vn={_backpedal:B,anyPunctuation:jn,autolink:Mn,blockSkip:xn,br:mn,code:pn,del:B,delLDelim:B,delRDelim:B,emStrongLDelim:Cn,emStrongRDelimAst:En,emStrongRDelimUnd:On,escape:fn,link:In,nolink:Rn,punctuation:_n,reflink:Ln,reflinkSearch:zn,tag:Pn,text:hn,url:B},Hn={...Vn,link:H(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Fn).getRegex(),reflink:H(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Fn).getRegex()},Un={...Vn,emStrongRDelimAst:Dn,emStrongLDelim:wn,delLDelim:kn,delRDelim:An,url:H(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Bn).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:H(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Bn).getRegex()},Wn={...Un,br:H(mn).replace(`{2,}`,`*`).getRegex(),text:H(Un.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Gn={normal:K,gfm:un,pedantic:dn},Kn={normal:Vn,gfm:Un,breaks:Wn,pedantic:Hn},qn={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Jn=e=>qn[e];function Y(e,t){if(t){if(U.escapeTest.test(e))return e.replace(U.escapeReplace,Jn)}else if(U.escapeTestNoEncode.test(e))return e.replace(U.escapeReplaceNoEncode,Jn);return e}function Yn(e){try{e=encodeURI(e).replace(U.percentDecode,`%`)}catch{return null}return e}function Xn(e,t){let n=e.replace(U.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(U.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(U.slashPipe,`|`);return n}function Zn(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Qn(e){let t=e.split(`
@@ -64,4 +64,4 @@ ${e}</tr>
64
64
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
65
65
  `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Y(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Yn(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Y(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Yn(e);if(i===null)return Y(n);e=i;let a=`<img src="${e}" alt="${Y(n)}"`;return t&&(a+=` title="${Y(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Y(e.text)}},ar=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},Z=class e{options;renderer;textRenderer;constructor(e){this.options=e||z,this.options.renderer=this.options.renderer||new ir,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ar}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},or=class{options;block;constructor(e){this.options=e||z}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?X.lex:X.lexInline}provideParser(e=this.block){return e?Z.parse:Z.parseInline}},sr=new class{defaults=Ut();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Z;Renderer=ir;TextRenderer=ar;Lexer=X;Tokenizer=rr;Hooks=or;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new ir(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new rr(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new or;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];or.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&or.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return X.lex(e,t??this.defaults)}parser(e,t){return Z.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?X.lex:X.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Z.parse:Z.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?X.lex:X.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Z.parse:Z.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
66
66
  Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Y(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Q(e,t){return sr.parse(e,t)}Q.options=Q.setOptions=function(e){return sr.setOptions(e),Q.defaults=sr.defaults,Wt(Q.defaults),Q},Q.getDefaults=Ut,Q.defaults=z,Q.use=function(...e){return sr.use(...e),Q.defaults=sr.defaults,Wt(Q.defaults),Q},Q.walkTokens=function(e,t){return sr.walkTokens(e,t)},Q.parseInline=sr.parseInline,Q.Parser=Z,Q.parser=Z.parse,Q.Renderer=ir,Q.TextRenderer=ar,Q.Lexer=X,Q.lexer=X.lex,Q.Tokenizer=rr,Q.Hooks=or,Q.parse=Q,Q.options,Q.setOptions,Q.use,Q.walkTokens,Q.parseInline,Z.parse,X.lex;var cr={ALLOWED_TAGS:`h1.h2.h3.h4.h5.h6.p.br.hr.strong.b.em.i.del.s.code.pre.blockquote.ul.ol.li.a.span.table.thead.tbody.tr.th.td.img`.split(`.`),ALLOWED_ATTR:[`href`,`title`,`target`,`rel`,`src`,`alt`]};function lr(e){return Ht.sanitize(Q.parse(e,{async:!1,gfm:!0}),cr)}var $=d();function ur({content:e}){return(0,$.jsx)(`div`,{className:`artifact-markdown px-5 py-4`,dangerouslySetInnerHTML:{__html:(0,y.useMemo)(()=>lr(e),[e])}})}function dr({path:e,meta:t,action:n}){return(0,$.jsxs)(`div`,{className:`sticky top-0 z-10 flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-hairline bg-surface px-5 py-2.5`,children:[(0,$.jsx)(`span`,{className:`break-all font-mono text-label text-primary`,children:e}),t&&(0,$.jsxs)(`span`,{className:`font-mono text-caption text-disabled`,children:[`· `,t]}),n&&(0,$.jsx)(`span`,{className:`ml-auto shrink-0`,children:n})]})}function fr({loopId:e,path:t,oversize:n}){return(0,$.jsx)(`div`,{className:`px-5 py-8 text-body text-secondary`,children:n?(0,$.jsx)(`span`,{className:`text-disabled`,children:`Too large to preview - stored as metadata only (no synced bytes).`}):(0,$.jsxs)($.Fragment,{children:[`Binary file - not previewable.`,` `,(0,$.jsx)(`a`,{href:w(e,t),download:!0,className:`text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Download`})]})})}function pr({loopId:e,path:t,mode:n,onMode:r,showToggle:i}){return(0,$.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-hairline bg-surface px-5 py-1.5`,children:[i&&n&&r&&(0,$.jsx)(`div`,{className:`inline-flex overflow-hidden rounded-control border border-hairline`,children:[`preview`,`source`].map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`cursor-pointer border-none px-2.5 py-0.5 text-caption font-medium transition-colors ${n===e?`bg-raised text-display`:`bg-transparent text-secondary hover:text-display`}`,children:e===`preview`?`Preview`:`Source`},e))}),(0,$.jsx)(`a`,{href:w(e,t),download:!0,className:`ml-auto shrink-0 text-caption font-medium text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Download ↓`})]})}function mr({html:e}){return(0,$.jsx)(`iframe`,{title:`Rendered HTML artifact (sandboxed)`,srcDoc:e,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,className:`h-[min(70vh,620px)] w-full border-0 bg-white`})}function hr({loopId:e,file:t}){let[n,r]=(0,y.useState)(!1);return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(pr,{loopId:e,path:t.path,showToggle:!1}),n?(0,$.jsxs)(`div`,{className:`px-5 py-8 text-body text-secondary`,children:[`Couldn't load this image.`,` `,(0,$.jsx)(`a`,{href:w(e,t.path),download:!0,className:`text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Download`}),` `,`instead.`]}):(0,$.jsx)(`div`,{className:`flex justify-center overflow-auto px-5 py-6`,children:(0,$.jsx)(`img`,{src:T(e,t.path),alt:t.path,onError:()=>r(!0),className:`max-w-full rounded-control border border-hairline bg-white object-contain`})})]})}function gr({loopId:e,file:t,kind:n}){let[r,i]=(0,y.useState)({loading:!0}),[a,o]=(0,y.useState)(`preview`);if((0,y.useEffect)(()=>{let n=!0;return i({loading:!0}),he({data:{loopId:e,path:t.path}}).then(e=>n&&i(e)).catch(e=>n&&i({error:String(e)})),()=>{n=!1}},[e,t.path,t.updatedAt]),`loading`in r)return(0,$.jsx)(`div`,{className:`px-5 py-6 text-body text-disabled`,children:`Loading…`});if(`binary`in r)return(0,$.jsx)(fr,{loopId:e,path:t.path,oversize:r.oversize});if(`error`in r)return(0,$.jsxs)(`div`,{className:`px-5 py-6 text-body text-accent`,children:[`Couldn't load this file - `,r.error]});let s=r.text||`(empty file)`,c=n===`html`||n===`markdown`,l=!c||a===`source`;return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(pr,{loopId:e,path:t.path,mode:a,onMode:o,showToggle:c}),n===`html`&&!l?(0,$.jsx)(mr,{html:r.text||``}):n===`markdown`&&!l?(0,$.jsx)(ur,{content:s}):(0,$.jsx)(`pre`,{className:`m-0 overflow-x-auto whitespace-pre-wrap px-5 py-4 font-mono text-label leading-relaxed text-secondary`,children:s})]})}function _r({loopId:e,file:t}){let n=Me(t.path);return t.oversize?(0,$.jsx)(fr,{loopId:e,path:t.path,oversize:!0}):n===`image`?(0,$.jsx)(hr,{loopId:e,file:t},`${t.path}:${t.updatedAt??``}`):t.binary?(0,$.jsx)(fr,{loopId:e,path:t.path,oversize:!1}):(0,$.jsx)(gr,{loopId:e,file:t,kind:n},t.path)}var vr=e=>e.split(`/`).pop()||e;function yr({loopId:t,configuredPaths:n,running:r}){let[i,a]=(0,y.useState)(null),[o,s]=(0,y.useState)(null),c=(0,y.useRef)(0),l=(0,y.useCallback)(async()=>{let e=++c.current;try{let n=await ue({data:{loopId:t}});e===c.current&&a(n)}catch{e===c.current&&a(e=>e??[])}},[t]);(0,y.useEffect)(()=>{a(null),s(null),l()},[t,l]),(0,y.useEffect)(()=>{let e=setInterval(()=>void l(),r?4e3:12e3);return()=>clearInterval(e)},[r,l]);let u=i??[],d=o&&u.some(e=>e.path===o)?o:u[0]?.path??null,f=u.find(e=>e.path===d)??null;return(0,$.jsxs)(`section`,{id:`files`,className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`mb-2.5 flex items-end justify-between gap-3 border-b border-hairline pb-1.5`,children:[(0,$.jsxs)(`h2`,{className:`text-label font-semibold text-secondary`,children:[`Artifacts`,i?` (${u.length})`:``]}),(0,$.jsxs)(`span`,{className:`text-caption font-medium text-disabled`,children:[`Configured exact paths: `,n.length]})]}),u.length===0?(0,$.jsx)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 py-10 text-center text-body text-disabled shadow-card`,children:i==null?`Loading…`:n.length?`No configured artifact has been collected yet.`:`No artifact paths configured.`}):(0,$.jsxs)(`div`,{className:`grid h-[min(600px,68vh)] grid-cols-1 overflow-hidden rounded-card border border-hairline bg-surface shadow-card sm:grid-cols-[210px_1fr]`,children:[(0,$.jsx)(`nav`,{className:`max-h-44 overflow-y-auto border-b border-hairline sm:max-h-none sm:border-b-0 sm:border-r`,children:(0,$.jsx)(`ul`,{className:`py-1.5`,children:u.map(e=>{let t=e.path===d;return(0,$.jsx)(`li`,{children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>s(e.path),className:`flex w-full items-center border-l-2 px-3 py-2 text-left transition-colors ${t?`border-display bg-raised`:`border-transparent hover:bg-raised/60`}`,children:(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate font-mono text-label ${t?`text-display`:`text-primary`}`,title:e.path,children:vr(e.path)}),(0,$.jsx)(`span`,{className:`block truncate font-mono text-micro text-disabled`,title:e.path,children:e.path})]})})},e.path)})})}),(0,$.jsx)(`div`,{className:`min-w-0 overflow-y-auto`,children:f&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(dr,{path:f.path,meta:[f.size==null?``:e(f.size),`collected ${h(f.updatedAt)}`].filter(Boolean).join(` · `)}),(0,$.jsx)(_r,{loopId:t,file:f})]})})]})]})}var br=[`claude-code`,`codex`],xr={"claude-code":`Claude Code`,codex:`Codex`},Sr=`mt-1 text-caption leading-snug text-disabled`;function Cr(e){let t=e?.schedule;return{name:e?.name??``,mode:t?.mode??`cron`,cron:t?.mode===`cron`?t.cron:`0 */3 * * *`,timezone:t?.mode===`cron`?t.timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`,overlap:t?.mode===`cron`?t.overlap:`queue-one`,delayMinutes:String(t?.mode===`continuous`?t.delayMinutes:1),workdir:e?.workdir??``,agent:e?.agent??`claude-code`,model:e?.model??``,reasoningEffort:e?.reasoningEffort??``,prompt:e?.prompt??``,keep:e?.statusDefinitions?.keep??``,noChange:e?.statusDefinitions?.noChange??``,block:e?.statusDefinitions?.block??``,artifacts:(e?.artifacts??[]).join(`
67
- `)}}function wr({title:e,hint:t}){return(0,$.jsxs)(`div`,{className:`mb-3 mt-7 border-b border-hairline pb-1.5 first:mt-2`,children:[(0,$.jsx)(`h2`,{className:f,children:e}),t&&(0,$.jsx)(`div`,{className:`mt-0.5 text-caption text-disabled`,children:t})]})}function Tr({label:e,value:t,onChange:n,mono:r,hint:i,placeholder:a}){let o=(0,y.useId)();return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{htmlFor:o,className:l,children:e}),(0,$.jsx)(`input`,{id:o,className:`${p} ${r?`font-mono`:``}`,value:t,placeholder:a,onChange:e=>n(e.target.value)}),i&&(0,$.jsx)(`div`,{className:Sr,children:i})]})}function Er({label:e,value:t,onChange:n,rows:r=4,mono:i,hint:a}){let o=(0,y.useId)();return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{htmlFor:o,className:l,children:e}),(0,$.jsx)(`textarea`,{id:o,rows:r,className:`${p} h-auto resize-y ${i?`font-mono`:``}`,value:t,onChange:e=>n(e.target.value)}),a&&(0,$.jsx)(`div`,{className:Sr,children:a})]})}var Dr=(0,y.forwardRef)(function({initial:e},t){let[n,r]=(0,y.useState)(()=>Cr(e)),[i,a]=(0,y.useState)(null),o=(e,t)=>r(n=>({...n,[e]:t}));return(0,y.useImperativeHandle)(t,()=>({read(){let e=[[`Name`,n.name],[`Working directory`,n.workdir],[`Prompt`,n.prompt],[`Keep definition`,n.keep],[`No-change definition`,n.noChange],[`Block definition`,n.block]].find(([,e])=>!e.trim());if(e)return a(`${e[0]} is required.`),null;let t=Number(n.delayMinutes);if(n.mode===`continuous`&&(!Number.isInteger(t)||t<1))return a(`Continuous delay must be an integer of at least 1 minute.`),null;let r=n.mode===`cron`?{mode:`cron`,cron:n.cron.trim(),timezone:n.timezone.trim(),overlap:n.overlap}:{mode:`continuous`,delayMinutes:t};return a(null),{name:n.name.trim(),schedule:r,workdir:n.workdir.trim(),agent:n.agent,model:n.model.trim()||null,reasoningEffort:n.reasoningEffort.trim()||null,prompt:n.prompt,statusDefinitions:{keep:n.keep,noChange:n.noChange,block:n.block},artifacts:n.artifacts.split(/\r?\n/).filter(e=>e.length>0)}}})),(0,$.jsxs)(`div`,{className:`grid gap-x-10 lg:grid-cols-[minmax(300px,380px)_minmax(0,1fr)]`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(wr,{title:`Basics`}),(0,$.jsx)(Tr,{label:`Name`,value:n.name,onChange:e=>o(`name`,e)}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{className:l,children:`Schedule`}),(0,$.jsxs)(`select`,{"aria-label":`Schedule`,className:u,value:n.mode,onChange:e=>o(`mode`,e.target.value),children:[(0,$.jsx)(`option`,{value:`cron`,children:`Cron`}),(0,$.jsx)(`option`,{value:`continuous`,children:`Continuous`})]})]}),n.mode===`cron`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Tr,{label:`Cron expression`,value:n.cron,onChange:e=>o(`cron`,e),mono:!0}),(0,$.jsx)(Tr,{label:`Timezone`,value:n.timezone,onChange:e=>o(`timezone`,e),mono:!0,hint:`IANA timezone, for example America/Los_Angeles.`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{className:l,children:`Cron overlap`}),(0,$.jsxs)(`select`,{"aria-label":`Cron overlap`,className:u,value:n.overlap,onChange:e=>o(`overlap`,e.target.value),children:[(0,$.jsx)(`option`,{value:`skip`,children:`Skip occurrence`}),(0,$.jsx)(`option`,{value:`queue-one`,children:`Queue one follow-up`})]}),(0,$.jsx)(`div`,{className:Sr,children:`Applies only when a cron occurrence is due while a run is still open.`})]})]}):(0,$.jsx)(Tr,{label:`Delay after terminal run (minutes)`,value:n.delayMinutes,onChange:e=>o(`delayMinutes`,e),mono:!0}),(0,$.jsx)(wr,{title:`Execution`}),(0,$.jsx)(Tr,{label:`Working directory`,value:n.workdir,onChange:e=>o(`workdir`,e),mono:!0,placeholder:`/Users/you/project`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{className:l,children:`Coding agent`}),(0,$.jsx)(`select`,{"aria-label":`Coding agent`,className:u,value:n.agent,onChange:e=>o(`agent`,e.target.value),children:br.map(e=>(0,$.jsx)(`option`,{value:e,children:xr[e]??e},e))})]}),(0,$.jsx)(Tr,{label:`Model`,value:n.model,onChange:e=>o(`model`,e),placeholder:`default`,hint:`Optional. Empty uses the agent default.`}),(0,$.jsx)(Tr,{label:`Reasoning effort`,value:n.reasoningEffort,onChange:e=>o(`reasoningEffort`,e),placeholder:`default`,hint:`Optional. Empty uses the agent default.`})]}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(wr,{title:`Prompt`,hint:`Sent unchanged before Pievo appends the report contract.`}),(0,$.jsx)(Er,{label:`User prompt`,value:n.prompt,onChange:e=>o(`prompt`,e),rows:10}),(0,$.jsx)(wr,{title:`Status definitions`,hint:`All three definitions are required and are appended to every run.`}),(0,$.jsx)(Er,{label:`keep`,value:n.keep,onChange:e=>o(`keep`,e),rows:2}),(0,$.jsx)(Er,{label:`no-change`,value:n.noChange,onChange:e=>o(`noChange`,e),rows:2}),(0,$.jsx)(Er,{label:`block`,value:n.block,onChange:e=>o(`block`,e),rows:2}),(0,$.jsx)(wr,{title:`Artifacts`,hint:`Optional exact paths relative to the working directory. One path per line; globs are not supported.`}),(0,$.jsx)(Er,{label:`Artifact paths`,value:n.artifacts,onChange:e=>o(`artifacts`,e),rows:6,mono:!0}),i&&(0,$.jsx)(`div`,{className:`mt-4 text-body text-accent`,children:i})]})]})}),Or={"claude-code":`Claude Code`,codex:`Codex`};function kr({id:e}){let t=se(),[n,r]=(0,y.useState)(null),[a,s]=(0,y.useState)(null),[c,l]=(0,y.useState)(null),[u,d]=(0,y.useState)(!1),[ne,p]=(0,y.useState)(!1),[m,h]=(0,y.useState)(null),[ue,me]=(0,y.useState)(!1),[he,be]=Oe(),[Ee,De]=(0,y.useState)([]),b=(0,y.useRef)(null),x=(0,y.useRef)(!1),S=(0,y.useCallback)(async(n=!1)=>{try{let t=await de({data:e});r(t),x.current=t.summary.deleteRequestedAt!=null,s(null)}catch(e){x.current?t({to:`/`}):n||s(String(e))}},[e]);(0,y.useEffect)(()=>{r(null),d(!1),me(!1),De([]),S()},[e,S]);let C=!!n?.summary.running;(0,y.useEffect)(()=>{if(u)return;let e=setInterval(()=>void S(!0),C||x.current?3e3:8e3);return()=>clearInterval(e)},[u,C,S]);async function Ae(){l(null),h(`run`);try{let t=await oe({data:e});if(t.error)return l(`Run failed: ${t.error}`);be({label:t.coalesced?`Already queued`:`Queued`,hold:4e3}),await S()}finally{h(null)}}async function je(n){l(null),h(`lifecycle`);try{let r=n===`pause`?await ce({data:e}):n===`start`?await ge({data:e}):n===`stop`?await le({data:e}):await pe({data:e});if(r.error)return l(`${n[0].toUpperCase()+n.slice(1)} failed: ${r.error}`);if(me(!1),r.deleted)return t({to:`/`});n===`delete`&&(x.current=!0),await S(),be({label:n===`start`?`Started`:n===`pause`?`Paused`:n===`stop`?`Stop requested`:`Deleting`})}finally{h(null)}}async function Me(){let t=b.current?.read();if(t){l(null),h(`save`);try{let n=await _e({data:{id:e,patch:t}});if(n.error)return l(`Save failed: ${n.error}`);d(!1),await S(),be({label:`Saved`})}finally{h(null)}}}let w=(0,$.jsxs)(fe,{to:`/`,className:`inline-flex items-center gap-1.5 text-meta font-medium text-secondary hover:text-display`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Loops`]});if(a)return(0,$.jsx)(Pr,{back:w,children:(0,$.jsx)(ke,{title:`Couldn't load this loop.`,detail:a,onRetry:()=>void S()})});if(!n)return(0,$.jsx)(Pr,{back:w,children:(0,$.jsx)(ee,{})});let{loop:T,summary:E,runs:Ne}=n,D=Ce(E)===`deleting`,Pe=E.enabled&&!D,Fe=!E.enabled&&!D,O=m!=null,Ie=Se(n.machine.daemonProtocol),Le=!D&&!!E.running&&Ie.supported,Re=n.machine.online,ze=n.machine.presence===`asleep`,Be=n.team&&!n.team.isActive?n.team:null;if(u)return(0,$.jsxs)(Pr,{back:w,children:[(0,$.jsx)(Nr,{name:E.name,onBack:()=>d(!1)}),(0,$.jsxs)(`div`,{className:`mt-5 rounded-card border border-hairline bg-surface px-6 pb-6 pt-2 shadow-card`,children:[(0,$.jsx)(Dr,{ref:b,initial:T}),(0,$.jsxs)(`div`,{className:`mt-7 border-t border-hairline pt-4`,children:[c&&(0,$.jsx)(ae,{message:c,onDismiss:()=>l(null),className:`mb-3`}),(0,$.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,$.jsx)(`button`,{className:ie,disabled:m===`save`,onClick:()=>void Me(),children:m===`save`?`Saving…`:`Save`}),(0,$.jsx)(`button`,{className:o,disabled:m===`save`,onClick:()=>d(!1),children:`Cancel`})]})]})]})]});let k=T.schedule.mode===`cron`?`${T.schedule.cron} · ${T.schedule.timezone} · overlap ${T.schedule.overlap}`:`continuous · ${T.schedule.delayMinutes}m after terminal`,A=T.model||`default`,Ve=T.reasoningEffort||`default`,He=Ee.length?ye(E.runs,Ee):E.runs,Ue=async()=>{let t=He[0];if(!t)return 0;let n=await ve({data:{loopId:e,beforeTs:t.ts,limit:16}});return n.length&&De(e=>ye(e,n)),n.length};return(0,$.jsxs)(Pr,{back:w,children:[(0,$.jsxs)(`header`,{className:`rounded-card border border-hairline bg-surface px-[26px] pb-5 pt-[22px] shadow-card`,children:[(0,$.jsx)(g,{loop:E,runs:He,onLoadMore:Ue,onPickRun:n=>t({to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:n.id}}),extraPill:Be?(0,$.jsx)(re,{tone:`outline`,children:Be.name}):void 0}),(0,$.jsxs)(`div`,{className:`mt-5 border-t border-hairline pt-4`,children:[Be&&(0,$.jsx)(jr,{team:Be,onSwitch:()=>{Te(Be.id),t({to:`/t/$teamId`,params:{teamId:Be.id}})}}),n.machine.needsUpdate&&(0,$.jsx)(Mr,{tone:`warn`,text:`Daemon update required · server requires v${n.machine.requiredDaemonVersion}; machine reports ${n.machine.daemonVersion?`v${n.machine.daemonVersion}`:`an unknown version`}.`,action:`Update daemon`,onAction:()=>p(!0)}),!Re&&(0,$.jsx)(Mr,{text:`Machine ${ze?`seems asleep or offline`:`is offline`}; queued work starts when it reconnects.${n.machine.lastSeen?` Last seen ${i(n.machine.lastSeen)}.`:``}`,action:`Reconnect`,onAction:()=>p(!0)}),c&&(0,$.jsx)(ae,{message:c,onDismiss:()=>l(null),className:`mb-2.5`}),he&&(0,$.jsx)(`div`,{className:`mb-2.5`,children:(0,$.jsx)(_,{label:he.label,tone:he.tone,onUndo:he.undo})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`button`,{className:ie,disabled:O||D,onClick:()=>void Ae(),children:m===`run`?`Queuing…`:`Run once`}),(0,$.jsx)(`button`,{className:o,disabled:O||D,onClick:()=>d(!0),children:`Settings`}),(0,$.jsx)(`button`,{className:o,disabled:O||!Fe,onClick:()=>void je(`start`),children:`Start`}),(0,$.jsx)(`button`,{className:o,disabled:O||!Pe,onClick:()=>void je(`pause`),children:`Pause`}),(0,$.jsx)(`button`,{className:te,disabled:O||!Le,title:E.running&&!Ie.supported?we:E.running?void 0:`No run is currently running`,onClick:()=>void je(`stop`),children:`Stop`}),(0,$.jsx)(`button`,{className:te,disabled:O||D,onClick:()=>me(!0),children:D?`Deleting…`:`Delete`})]}),ue&&!D&&(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(v,{prompt:`Stop this loop and delete its server data?`,note:`This stops the loop and deletes server history and collected artifacts. Files in the working directory are not deleted. If the machine is unreachable, its local process may continue running.`,cta:`Delete`,danger:!0,busy:O,onConfirm:()=>void je(`delete`),onCancel:()=>me(!1)})})]})]}),(0,$.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(300px,360px)]`,children:[(0,$.jsx)(yr,{loopId:e,configuredPaths:T.artifacts,running:C}),(0,$.jsx)(Fr,{loopId:e,summary:E,runs:Ne,older:Ee,onPickRun:n=>t({to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:n.id}}),onMore:Ue})]}),(0,$.jsxs)(`section`,{className:`mt-6 min-w-0 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,children:[(0,$.jsx)(`h2`,{className:`mb-4 border-b border-hairline pb-1.5 ${f}`,children:`Configuration`}),(0,$.jsxs)(`dl`,{className:`grid min-w-0 gap-x-6 gap-y-4 md:grid-cols-[180px_minmax(0,1fr)]`,children:[(0,$.jsx)(Ar,{label:`Schedule`,children:(0,$.jsx)(`code`,{className:`break-all font-mono`,children:k})}),(0,$.jsx)(Ar,{label:`Working directory`,children:(0,$.jsx)(`code`,{className:`break-all font-mono`,children:T.workdir})}),(0,$.jsx)(Ar,{label:`Agent`,children:Or[T.agent]}),(0,$.jsxs)(Ar,{label:`Model / effort`,children:[A,` / `,Ve]}),(0,$.jsx)(Ar,{label:`Prompt`,children:(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-sans`,children:T.prompt})}),(0,$.jsx)(Ar,{label:`Status definitions`,children:(0,$.jsxs)(`ul`,{className:`space-y-1`,children:[(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`b`,{children:`keep:`}),` `,T.statusDefinitions.keep]}),(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`b`,{children:`no-change:`}),` `,T.statusDefinitions.noChange]}),(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`b`,{children:`block:`}),` `,T.statusDefinitions.block]})]})}),(0,$.jsx)(Ar,{label:`Artifact paths`,children:T.artifacts.length?(0,$.jsx)(`ul`,{className:`space-y-1`,children:T.artifacts.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(`code`,{className:`break-all font-mono`,children:e})},e))}):(0,$.jsx)(`span`,{className:`text-disabled`,children:`None`})})]})]}),(0,$.jsx)(xe,{open:ne,onClose:()=>p(!1)})]})}function Ar({label:e,children:t}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-label font-medium text-secondary`,children:e}),(0,$.jsx)(`dd`,{className:`min-w-0 text-body text-primary`,children:t})]})}function jr({team:e,onSwitch:t}){return(0,$.jsxs)(`div`,{className:`mb-2.5 flex flex-wrap items-center gap-3 rounded-control border border-hairline bg-raised px-4 py-2.5 text-meta text-secondary`,children:[(0,$.jsxs)(`span`,{children:[`Viewing a loop in `,e.name,` - not your active team.`]}),(0,$.jsx)(`button`,{onClick:t,className:`ml-auto font-medium text-interactive underline`,children:`Switch to this team`})]})}function Mr({text:e,action:t,onAction:n,tone:r}){return(0,$.jsxs)(`div`,{className:`mb-2.5 flex flex-wrap items-center gap-3 rounded-control border px-4 py-2.5 text-meta ${r===`warn`?`border-warn/40 bg-warn/10`:`border-hairline bg-raised`}`,children:[(0,$.jsx)(`span`,{className:`text-secondary`,children:e}),(0,$.jsx)(`button`,{onClick:n,className:`ml-auto font-medium text-interactive underline`,children:t})]})}function Nr({name:e,onBack:t}){return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:t,className:c,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Back to loop`]}),(0,$.jsxs)(`h1`,{className:`mt-2.5 text-[24px] font-semibold text-display`,children:[`Settings · `,e]}),(0,$.jsx)(`p`,{className:`mt-1.5 text-meta text-secondary`,children:`Edit the stored schedule, execution settings, prompt, status definitions, and exact artifact paths.`})]})}function Pr({back:e,children:t}){return(0,$.jsxs)(`main`,{className:`mx-auto max-w-[1360px] px-8 pb-24 pt-10`,children:[(0,$.jsx)(`div`,{className:`mb-5`,children:e}),t]})}function Fr({loopId:e,summary:n,runs:r,older:i,onMore:o,onPickRun:c}){let l=(0,y.useMemo)(()=>i.length?ye(n.runs,i):n.runs,[n.runs,i]);return(0,$.jsxs)(`section`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-2.5 border-b border-hairline pb-1.5`,children:(0,$.jsxs)(`h2`,{className:f,children:[`Runs (`,n.runCount,`)`]})}),n.runCount===0?(0,$.jsx)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 py-10 text-center text-body text-disabled`,children:`Never run`}):(0,$.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 pb-4 pt-5 shadow-card`,children:[(0,$.jsx)(be,{loop:n,runs:l,total:n.runCount,onLoadMore:o,onPickRun:c}),(0,$.jsx)(`ul`,{className:`mt-5 max-h-[clamp(280px,46vh,520px)] divide-y divide-hairline overflow-y-auto border-t border-hairline`,children:r.map(n=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(fe,{to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:n.id},className:`flex items-start gap-2.5 py-2.5 hover:bg-raised`,children:[(0,$.jsx)(`span`,{className:`mt-1 inline-block size-2.5 shrink-0 rounded-[2px]`,style:{background:a(n)},title:m(n)}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-label text-secondary`,children:t(n.ts)}),(0,$.jsx)(`span`,{className:`font-mono text-caption text-disabled`,children:s(n.durationMs)})]}),(0,$.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-meta text-primary`,children:n.phase===`pending`?`Queued`:n.phase===`running`?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:ne}),`Running`]}):n.error||n.message||m(n)})]})]})},n.id))})]})]})}function Ir(){let{loopId:e}=Ee.useParams(),{auth:t}=Ee.useLoaderData()??{auth:{enabled:!1}},{data:n,isPending:r}=me();return t?.enabled&&!r&&!n?(0,$.jsx)(De,{callbackURL:`/loops/${e}`}):(0,$.jsx)(kr,{id:e})}export{Ir as component};
67
+ `)}}function wr({title:e,hint:t}){return(0,$.jsxs)(`div`,{className:`mb-3 mt-7 border-b border-hairline pb-1.5 first:mt-2`,children:[(0,$.jsx)(`h2`,{className:f,children:e}),t&&(0,$.jsx)(`div`,{className:`mt-0.5 text-caption text-disabled`,children:t})]})}function Tr({label:e,value:t,onChange:n,mono:r,hint:i,placeholder:a}){let o=(0,y.useId)();return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{htmlFor:o,className:l,children:e}),(0,$.jsx)(`input`,{id:o,className:`${p} ${r?`font-mono`:``}`,value:t,placeholder:a,onChange:e=>n(e.target.value)}),i&&(0,$.jsx)(`div`,{className:Sr,children:i})]})}function Er({label:e,value:t,onChange:n,rows:r=4,mono:i,hint:a}){let o=(0,y.useId)();return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{htmlFor:o,className:l,children:e}),(0,$.jsx)(`textarea`,{id:o,rows:r,className:`${p} h-auto resize-y ${i?`font-mono`:``}`,value:t,onChange:e=>n(e.target.value)}),a&&(0,$.jsx)(`div`,{className:Sr,children:a})]})}var Dr=(0,y.forwardRef)(function({initial:e},t){let[n,r]=(0,y.useState)(()=>Cr(e)),[i,a]=(0,y.useState)(null),o=(e,t)=>r(n=>({...n,[e]:t}));return(0,y.useImperativeHandle)(t,()=>({read(){let e=[[`Name`,n.name],[`Working directory`,n.workdir],[`Prompt`,n.prompt],[`Keep definition`,n.keep],[`No-change definition`,n.noChange],[`Block definition`,n.block]].find(([,e])=>!e.trim());if(e)return a(`${e[0]} is required.`),null;let t=Number(n.delayMinutes);if(n.mode===`continuous`&&(!Number.isInteger(t)||t<1))return a(`Continuous delay must be an integer of at least 1 minute.`),null;let r=n.mode===`cron`?{mode:`cron`,cron:n.cron.trim(),timezone:n.timezone.trim(),overlap:n.overlap}:{mode:`continuous`,delayMinutes:t};return a(null),{name:n.name.trim(),schedule:r,workdir:n.workdir.trim(),agent:n.agent,model:n.model.trim()||null,reasoningEffort:n.reasoningEffort.trim()||null,prompt:n.prompt,statusDefinitions:{keep:n.keep,noChange:n.noChange,block:n.block},artifacts:n.artifacts.split(/\r?\n/).filter(e=>e.length>0)}}})),(0,$.jsxs)(`div`,{className:`grid gap-x-10 lg:grid-cols-[minmax(300px,380px)_minmax(0,1fr)]`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(wr,{title:`Basics`}),(0,$.jsx)(Tr,{label:`Name`,value:n.name,onChange:e=>o(`name`,e)}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{className:l,children:`Schedule`}),(0,$.jsxs)(`select`,{"aria-label":`Schedule`,className:u,value:n.mode,onChange:e=>o(`mode`,e.target.value),children:[(0,$.jsx)(`option`,{value:`cron`,children:`Cron`}),(0,$.jsx)(`option`,{value:`continuous`,children:`Continuous`})]})]}),n.mode===`cron`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Tr,{label:`Cron expression`,value:n.cron,onChange:e=>o(`cron`,e),mono:!0}),(0,$.jsx)(Tr,{label:`Timezone`,value:n.timezone,onChange:e=>o(`timezone`,e),mono:!0,hint:`IANA timezone, for example America/Los_Angeles.`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{className:l,children:`Cron overlap`}),(0,$.jsxs)(`select`,{"aria-label":`Cron overlap`,className:u,value:n.overlap,onChange:e=>o(`overlap`,e.target.value),children:[(0,$.jsx)(`option`,{value:`skip`,children:`Skip occurrence`}),(0,$.jsx)(`option`,{value:`queue-one`,children:`Queue one follow-up`})]}),(0,$.jsx)(`div`,{className:Sr,children:`Applies only when a cron occurrence is due while a run is still open.`})]})]}):(0,$.jsx)(Tr,{label:`Delay after terminal run (minutes)`,value:n.delayMinutes,onChange:e=>o(`delayMinutes`,e),mono:!0}),(0,$.jsx)(wr,{title:`Execution`}),(0,$.jsx)(Tr,{label:`Working directory`,value:n.workdir,onChange:e=>o(`workdir`,e),mono:!0,placeholder:`/Users/you/project`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{className:l,children:`Coding agent`}),(0,$.jsx)(`select`,{"aria-label":`Coding agent`,className:u,value:n.agent,onChange:e=>o(`agent`,e.target.value),children:br.map(e=>(0,$.jsx)(`option`,{value:e,children:xr[e]??e},e))})]}),(0,$.jsx)(Tr,{label:`Model`,value:n.model,onChange:e=>o(`model`,e),placeholder:`default`,hint:`Optional. Empty uses the agent default.`}),(0,$.jsx)(Tr,{label:`Reasoning effort`,value:n.reasoningEffort,onChange:e=>o(`reasoningEffort`,e),placeholder:`default`,hint:`Optional. Empty uses the agent default.`})]}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(wr,{title:`Prompt`,hint:`Sent unchanged before Pievo appends the report contract.`}),(0,$.jsx)(Er,{label:`User prompt`,value:n.prompt,onChange:e=>o(`prompt`,e),rows:10}),(0,$.jsx)(wr,{title:`Status definitions`,hint:`All three definitions are required and are appended to every run.`}),(0,$.jsx)(Er,{label:`keep`,value:n.keep,onChange:e=>o(`keep`,e),rows:2}),(0,$.jsx)(Er,{label:`no-change`,value:n.noChange,onChange:e=>o(`noChange`,e),rows:2}),(0,$.jsx)(Er,{label:`block`,value:n.block,onChange:e=>o(`block`,e),rows:2}),(0,$.jsx)(wr,{title:`Artifacts`,hint:`Optional exact paths relative to the working directory. One path per line; globs are not supported.`}),(0,$.jsx)(Er,{label:`Artifact paths`,value:n.artifacts,onChange:e=>o(`artifacts`,e),rows:6,mono:!0}),i&&(0,$.jsx)(`div`,{className:`mt-4 text-body text-accent`,children:i})]})]})}),Or={"claude-code":`Claude Code`,codex:`Codex`};function kr({id:e}){let t=se(),[n,r]=(0,y.useState)(null),[a,s]=(0,y.useState)(null),[c,l]=(0,y.useState)(null),[u,d]=(0,y.useState)(!1),[ne,p]=(0,y.useState)(!1),[m,h]=(0,y.useState)(null),[ue,me]=(0,y.useState)(!1),[he,be]=Te(),[ke,v]=(0,y.useState)([]),b=(0,y.useRef)(null),x=(0,y.useRef)(!1),S=(0,y.useCallback)(async(n=!1)=>{try{let t=await de({data:e});r(t),x.current=t.summary.deleteRequestedAt!=null,s(null)}catch(e){x.current?t({to:`/`}):n||s(String(e))}},[e]);(0,y.useEffect)(()=>{r(null),d(!1),me(!1),v([]),S()},[e,S]);let C=!!n?.summary.running;(0,y.useEffect)(()=>{if(u)return;let e=setInterval(()=>void S(!0),C||x.current?3e3:8e3);return()=>clearInterval(e)},[u,C,S]);async function Ae(){l(null),h(`run`);try{let t=await oe({data:e});if(t.error)return l(`Run failed: ${t.error}`);be({label:t.coalesced?`Already queued`:`Queued`,hold:4e3}),await S()}finally{h(null)}}async function je(n){l(null),h(`lifecycle`);try{let r=n===`pause`?await ce({data:e}):n===`start`?await ge({data:e}):n===`stop`?await le({data:e}):await pe({data:e});if(r.error)return l(`${n[0].toUpperCase()+n.slice(1)} failed: ${r.error}`);if(me(!1),r.deleted)return t({to:`/`});n===`delete`&&(x.current=!0),await S(),be({label:n===`start`?`Started`:n===`pause`?`Paused`:n===`stop`?`Stop requested`:`Deleting`})}finally{h(null)}}async function Me(){let t=b.current?.read();if(t){l(null),h(`save`);try{let n=await _e({data:{id:e,patch:t}});if(n.error)return l(`Save failed: ${n.error}`);d(!1),await S(),be({label:`Saved`})}finally{h(null)}}}let w=(0,$.jsxs)(fe,{to:`/`,className:`inline-flex items-center gap-1.5 text-meta font-medium text-secondary hover:text-display`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Loops`]});if(a)return(0,$.jsx)(Pr,{back:w,children:(0,$.jsx)(De,{title:`Couldn't load this loop.`,detail:a,onRetry:()=>void S()})});if(!n)return(0,$.jsx)(Pr,{back:w,children:(0,$.jsx)(ee,{})});let{loop:T,summary:E,runs:Ne}=n,D=Ce(E)===`deleting`,Pe=E.enabled&&!D,Fe=!E.enabled&&!D,O=m!=null,Ie=Se(n.machine.daemonProtocol),Le=!D&&!!E.running&&Ie.supported,Re=n.machine.online,ze=n.machine.presence===`asleep`,Be=n.team&&!n.team.isActive?n.team:null;if(u)return(0,$.jsxs)(Pr,{back:w,children:[(0,$.jsx)(Nr,{name:E.name,onBack:()=>d(!1)}),(0,$.jsxs)(`div`,{className:`mt-5 rounded-card border border-hairline bg-surface px-6 pb-6 pt-2 shadow-card`,children:[(0,$.jsx)(Dr,{ref:b,initial:T}),(0,$.jsxs)(`div`,{className:`mt-7 border-t border-hairline pt-4`,children:[c&&(0,$.jsx)(ae,{message:c,onDismiss:()=>l(null),className:`mb-3`}),(0,$.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,$.jsx)(`button`,{className:ie,disabled:m===`save`,onClick:()=>void Me(),children:m===`save`?`Saving…`:`Save`}),(0,$.jsx)(`button`,{className:o,disabled:m===`save`,onClick:()=>d(!1),children:`Cancel`})]})]})]})]});let k=T.schedule.mode===`cron`?`${T.schedule.cron} · ${T.schedule.timezone} · overlap ${T.schedule.overlap}`:`continuous · ${T.schedule.delayMinutes}m after terminal`,A=T.model||`default`,Ve=T.reasoningEffort||`default`,He=ke.length?ye(E.runs,ke):E.runs,Ue=async()=>{let t=He[0];if(!t)return 0;let n=await ve({data:{loopId:e,beforeTs:t.ts,limit:16}});return n.length&&v(e=>ye(e,n)),n.length};return(0,$.jsxs)(Pr,{back:w,children:[(0,$.jsxs)(`header`,{className:`rounded-card border border-hairline bg-surface px-[26px] pb-5 pt-[22px] shadow-card`,children:[(0,$.jsx)(g,{loop:E,runs:He,onLoadMore:Ue,onPickRun:n=>t({to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:n.id}}),extraPill:Be?(0,$.jsx)(re,{tone:`outline`,children:Be.name}):void 0}),(0,$.jsxs)(`div`,{className:`mt-5 border-t border-hairline pt-4`,children:[Be&&(0,$.jsx)(jr,{team:Be,onSwitch:()=>{_(Be.id),t({to:`/t/$teamId`,params:{teamId:Be.id}})}}),n.machine.needsUpdate&&(0,$.jsx)(Mr,{tone:`warn`,text:`Daemon update required · server requires v${n.machine.requiredDaemonVersion}; machine reports ${n.machine.daemonVersion?`v${n.machine.daemonVersion}`:`an unknown version`}.`,action:`Update daemon`,onAction:()=>p(!0)}),!Re&&(0,$.jsx)(Mr,{text:`Machine ${ze?`seems asleep or offline`:`is offline`}; queued work starts when it reconnects.${n.machine.lastSeen?` Last seen ${i(n.machine.lastSeen)}.`:``}`,action:`Reconnect`,onAction:()=>p(!0)}),c&&(0,$.jsx)(ae,{message:c,onDismiss:()=>l(null),className:`mb-2.5`}),he&&(0,$.jsx)(`div`,{className:`mb-2.5`,children:(0,$.jsx)(Ee,{label:he.label,tone:he.tone,onUndo:he.undo})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`button`,{className:ie,disabled:O||D,onClick:()=>void Ae(),children:m===`run`?`Queuing…`:`Run once`}),(0,$.jsx)(`button`,{className:o,disabled:O||D,onClick:()=>d(!0),children:`Settings`}),(0,$.jsx)(`button`,{className:o,disabled:O||!Fe,onClick:()=>void je(`start`),children:`Start`}),(0,$.jsx)(`button`,{className:o,disabled:O||!Pe,onClick:()=>void je(`pause`),children:`Pause`}),(0,$.jsx)(`button`,{className:te,disabled:O||!Le,title:E.running&&!Ie.supported?we:E.running?void 0:`No run is currently running`,onClick:()=>void je(`stop`),children:`Stop`}),(0,$.jsx)(`button`,{className:te,disabled:O||D,onClick:()=>me(!0),children:D?`Deleting…`:`Delete`})]}),ue&&!D&&(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(Oe,{prompt:`Stop this loop and delete its server data?`,note:`This stops the loop and deletes server history and collected artifacts. Files in the working directory are not deleted. If the machine is unreachable, its local process may continue running.`,cta:`Delete`,danger:!0,busy:O,onConfirm:()=>void je(`delete`),onCancel:()=>me(!1)})})]})]}),(0,$.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(300px,360px)]`,children:[(0,$.jsx)(yr,{loopId:e,configuredPaths:T.artifacts,running:C}),(0,$.jsx)(Fr,{loopId:e,summary:E,runs:Ne,older:ke,onPickRun:n=>t({to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:n.id}}),onMore:Ue})]}),(0,$.jsxs)(`section`,{className:`mt-6 min-w-0 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,children:[(0,$.jsx)(`h2`,{className:`mb-4 border-b border-hairline pb-1.5 ${f}`,children:`Configuration`}),(0,$.jsxs)(`dl`,{className:`grid min-w-0 gap-x-6 gap-y-4 md:grid-cols-[180px_minmax(0,1fr)]`,children:[(0,$.jsx)(Ar,{label:`Schedule`,children:(0,$.jsx)(`code`,{className:`break-all font-mono`,children:k})}),(0,$.jsx)(Ar,{label:`Working directory`,children:(0,$.jsx)(`code`,{className:`break-all font-mono`,children:T.workdir})}),(0,$.jsx)(Ar,{label:`Agent`,children:Or[T.agent]}),(0,$.jsxs)(Ar,{label:`Model / effort`,children:[A,` / `,Ve]}),(0,$.jsx)(Ar,{label:`Prompt`,children:(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-sans`,children:T.prompt})}),(0,$.jsx)(Ar,{label:`Status definitions`,children:(0,$.jsxs)(`ul`,{className:`space-y-1`,children:[(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`b`,{children:`keep:`}),` `,T.statusDefinitions.keep]}),(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`b`,{children:`no-change:`}),` `,T.statusDefinitions.noChange]}),(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`b`,{children:`block:`}),` `,T.statusDefinitions.block]})]})}),(0,$.jsx)(Ar,{label:`Artifact paths`,children:T.artifacts.length?(0,$.jsx)(`ul`,{className:`space-y-1`,children:T.artifacts.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(`code`,{className:`break-all font-mono`,children:e})},e))}):(0,$.jsx)(`span`,{className:`text-disabled`,children:`None`})})]})]}),(0,$.jsx)(xe,{open:ne,onClose:()=>p(!1)})]})}function Ar({label:e,children:t}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-label font-medium text-secondary`,children:e}),(0,$.jsx)(`dd`,{className:`min-w-0 text-body text-primary`,children:t})]})}function jr({team:e,onSwitch:t}){return(0,$.jsxs)(`div`,{className:`mb-2.5 flex flex-wrap items-center gap-3 rounded-control border border-hairline bg-raised px-4 py-2.5 text-meta text-secondary`,children:[(0,$.jsxs)(`span`,{children:[`Viewing a loop in `,e.name,` - not your active team.`]}),(0,$.jsx)(`button`,{onClick:t,className:`ml-auto font-medium text-interactive underline`,children:`Switch to this team`})]})}function Mr({text:e,action:t,onAction:n,tone:r}){return(0,$.jsxs)(`div`,{className:`mb-2.5 flex flex-wrap items-center gap-3 rounded-control border px-4 py-2.5 text-meta ${r===`warn`?`border-warn/40 bg-warn/10`:`border-hairline bg-raised`}`,children:[(0,$.jsx)(`span`,{className:`text-secondary`,children:e}),(0,$.jsx)(`button`,{onClick:n,className:`ml-auto font-medium text-interactive underline`,children:t})]})}function Nr({name:e,onBack:t}){return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:t,className:c,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Back to loop`]}),(0,$.jsxs)(`h1`,{className:`mt-2.5 text-[24px] font-semibold text-display`,children:[`Settings · `,e]}),(0,$.jsx)(`p`,{className:`mt-1.5 text-meta text-secondary`,children:`Edit the stored schedule, execution settings, prompt, status definitions, and exact artifact paths.`})]})}function Pr({back:e,children:t}){return(0,$.jsxs)(`main`,{className:`mx-auto max-w-[1360px] px-8 pb-24 pt-10`,children:[(0,$.jsx)(`div`,{className:`mb-5`,children:e}),t]})}function Fr({loopId:e,summary:n,runs:r,older:i,onMore:o,onPickRun:c}){let l=(0,y.useMemo)(()=>i.length?ye(n.runs,i):n.runs,[n.runs,i]);return(0,$.jsxs)(`section`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-2.5 border-b border-hairline pb-1.5`,children:(0,$.jsxs)(`h2`,{className:f,children:[`Runs (`,n.runCount,`)`]})}),n.runCount===0?(0,$.jsx)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 py-10 text-center text-body text-disabled`,children:`Never run`}):(0,$.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 pb-4 pt-5 shadow-card`,children:[(0,$.jsx)(be,{loop:n,runs:l,total:n.runCount,onLoadMore:o,onPickRun:c}),(0,$.jsx)(`ul`,{className:`mt-5 max-h-[clamp(280px,46vh,520px)] divide-y divide-hairline overflow-y-auto border-t border-hairline`,children:r.map(n=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(fe,{to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:n.id},className:`flex items-start gap-2.5 py-2.5 hover:bg-raised`,children:[(0,$.jsx)(`span`,{className:`mt-1 inline-block size-2.5 shrink-0 rounded-[2px]`,style:{background:a(n)},title:m(n)}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-label text-secondary`,children:t(n.ts)}),(0,$.jsx)(`span`,{className:`font-mono text-caption text-disabled`,children:s(n.durationMs)})]}),(0,$.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-meta text-primary`,children:n.phase===`pending`?`Queued`:n.phase===`running`?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:ne}),`Running`]}):n.error||n.message||m(n)})]})]})},n.id))})]})]})}function Ir(){let{loopId:e}=ke.useParams(),{auth:t}=ke.useLoaderData()??{auth:{enabled:!1}},{data:n,isPending:r}=me();return t?.enabled&&!r&&!n?(0,$.jsx)(v,{callbackURL:`/loops/${e}`}):(0,$.jsx)(kr,{id:e})}export{Ir as component};
@@ -1,3 +1,3 @@
1
- import{C as e,M as t,P as n,S as r,a as i,b as a,i as o,j as s,m as c,n as l,o as u,p as d,r as f,x as p}from"./ui-s5IMg6RF.js";import{E as m,g as h,h as g,j as _,s as v,y}from"./preload-helper-Bs7oCAsw.js";import"./lifecycleUi-C0DaC6NM.js";import{t as b}from"./index-BqiDqbyu.js";import{t as x}from"./SignIn-Cf4HOpdF.js";import{r as S}from"./actionUi-yYVvoOTn.js";var C=n(t(),1);function w(e,t){return e.startsWith(`@@`)?{kind:`hunk`,text:e,gutter:``}:t?e.startsWith(`+`)?{kind:`add`,text:e.slice(1),gutter:`+`}:e.startsWith(`-`)?{kind:`del`,text:e.slice(1),gutter:`-`}:e.startsWith(` `)?{kind:`context`,text:e.slice(1),gutter:``}:{kind:`context`,text:e,gutter:``}:e.startsWith(`---`)||e.startsWith(`+++`)||e.startsWith(`diff `)||e.startsWith(`index `)||e.startsWith(`Index:`)||e.startsWith(`===`)?{kind:`meta`,text:e,gutter:``}:{kind:`context`,text:e,gutter:``}}function T(e){if(!e)return[];let t=e.endsWith(`
1
+ import{C as e,M as t,P as n,S as r,a as i,b as a,i as o,j as s,m as c,n as l,o as u,p as d,r as f,x as p}from"./ui-s5IMg6RF.js";import{E as m,g as h,h as g,j as _,s as v,y}from"./preload-helper-Bs7oCAsw.js";import"./lifecycleUi-C0DaC6NM.js";import{r as b}from"./actionUi-yYVvoOTn.js";import{t as x}from"./index-DM5pYU2E.js";import{t as S}from"./SignIn-Cf4HOpdF.js";var C=n(t(),1);function w(e,t){return e.startsWith(`@@`)?{kind:`hunk`,text:e,gutter:``}:t?e.startsWith(`+`)?{kind:`add`,text:e.slice(1),gutter:`+`}:e.startsWith(`-`)?{kind:`del`,text:e.slice(1),gutter:`-`}:e.startsWith(` `)?{kind:`context`,text:e.slice(1),gutter:``}:{kind:`context`,text:e,gutter:``}:e.startsWith(`---`)||e.startsWith(`+++`)||e.startsWith(`diff `)||e.startsWith(`index `)||e.startsWith(`Index:`)||e.startsWith(`===`)?{kind:`meta`,text:e,gutter:``}:{kind:`context`,text:e,gutter:``}}function T(e){if(!e)return[];let t=e.endsWith(`
2
2
  `)?e.slice(0,-1):e,n=!1;return t.split(`
3
- `).map(e=>{let t=w(e,n);return t.kind===`hunk`&&(n=!0),t})}function E(e){let t=0,n=0;for(let r of e)r.kind===`add`?t++:r.kind===`del`&&n++;return{added:t,removed:n}}var D=s(),O={added:`Added`,modified:`Changed`,removed:`Removed`},k={added:`text-success`,modified:`text-secondary`,removed:`text-accent`};function A(t){return t==null||t===0?``:`${t>0?`+`:`−`}${e(t)}`}var j={add:`bg-[color:var(--color-diff-add-bg)] text-primary`,del:`bg-[color:var(--color-diff-del-bg)] text-primary`,hunk:`bg-[color:var(--color-diff-hunk-bg)] text-disabled`,meta:`text-disabled`,context:`text-secondary`},M={add:`text-success`,del:`text-accent`,hunk:`text-disabled`,meta:`text-disabled`,context:`text-disabled`};function N({lines:e}){return(0,D.jsx)(`div`,{className:`min-w-0 max-h-[420px] overflow-auto border-t border-hairline bg-raised font-mono text-label leading-[1.55]`,children:(0,D.jsx)(`div`,{className:`min-w-max`,children:e.map((e,t)=>(0,D.jsxs)(`div`,{className:`flex ${j[e.kind]}`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`w-6 shrink-0 select-none pl-2.5 text-center ${M[e.kind]}`,children:e.gutter}),(0,D.jsx)(`span`,{className:`whitespace-pre pr-4`,children:e.text||`\xA0`})]},t))})})}function P({f:e,lines:t}){let n=A(e.sizeDelta),r=t?E(t):null;return(0,D.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2.5 gap-y-1 text-meta`,children:[(0,D.jsx)(`span`,{className:`shrink-0 text-caption font-medium ${k[e.status]}`,children:O[e.status]}),(0,D.jsx)(`span`,{className:`min-w-0 break-all font-mono text-primary`,children:e.path}),r&&(r.added>0||r.removed>0)&&(0,D.jsxs)(`span`,{className:`shrink-0 font-mono text-caption`,children:[r.added>0&&(0,D.jsxs)(`span`,{className:`text-success`,children:[`+`,r.added]}),r.added>0&&r.removed>0&&` `,r.removed>0&&(0,D.jsxs)(`span`,{className:`text-accent`,children:[`−`,r.removed]})]}),n&&(0,D.jsx)(`span`,{className:`shrink-0 font-mono text-caption text-disabled`,children:n}),e.binary&&(0,D.jsx)(`span`,{className:`shrink-0 text-caption text-secondary`,children:`Binary`}),e.tooLarge&&(0,D.jsx)(`span`,{className:`shrink-0 text-caption text-secondary`,children:`Too large to diff`})]})}var F=40;function I({files:e}){return(0,D.jsx)(`div`,{className:`space-y-1.5`,children:e.map(e=>{if(!e.diff)return(0,D.jsx)(`div`,{className:`rounded-control border border-hairline bg-surface px-3.5 py-2`,children:(0,D.jsx)(P,{f:e,lines:null})},e.path);let t=T(e.diff);return(0,D.jsxs)(`details`,{open:t.length<=F,className:`group min-w-0 overflow-hidden rounded-control border border-hairline bg-surface`,children:[(0,D.jsxs)(`summary`,{className:`flex cursor-pointer select-none items-center gap-2 px-3.5 py-2 marker:content-['']`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-micro text-disabled transition-transform group-open:rotate-90`,children:`▸`}),(0,D.jsx)(P,{f:e,lines:t})]}),(0,D.jsx)(N,{lines:t})]},e.path)})})}function L({label:e,count:t,children:n}){return(0,D.jsxs)(`section`,{className:`min-w-0 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,children:[(0,D.jsxs)(`div`,{className:`mb-3.5 border-b border-hairline pb-1.5 ${c}`,children:[e,t!=null&&(0,D.jsxs)(`span`,{className:`text-disabled`,children:[` (`,t,`)`]})]}),n]})}function R({k:e,children:t}){return(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`div`,{className:`mb-0.5 text-label font-medium text-secondary`,children:e}),(0,D.jsx)(`div`,{className:`min-w-0 text-body text-primary`,children:t})]})}function z(e){return!e||e.inputTokens===void 0&&e.outputTokens===void 0?null:(e.inputTokens??0)+(e.outputTokens??0)}function B({run:e}){let[t,n]=(0,C.useState)(null);return(0,C.useEffect)(()=>{if(e.phase===`pending`||e.phase===`running`)return;let t=!0;return h({data:{runId:e.id}}).then(e=>t&&n(e)).catch(()=>t&&n({hasSnapshot:!1,files:[]})),()=>{t=!1}},[e.id,e.phase]),e.phase===`pending`||e.phase===`running`?(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`File changes appear once the run finishes.`})}):t?t.hasSnapshot?(0,D.jsx)(L,{label:`Changes`,count:t.files.length,children:t.files.length===0?(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`No files changed since the previous run.`}):(0,D.jsx)(I,{files:t.files})}):(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`No file snapshot was recorded for this run.`})}):(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(l,{})})}function V({run:e}){let t=a(Math.max(0,Date.now()-Date.parse(e.ts)));return(0,D.jsx)(L,{label:`Activity`,children:(0,D.jsxs)(`div`,{className:`flex items-center gap-2.5 text-body text-secondary`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full`,style:d}),(0,D.jsxs)(`span`,{children:[`Run in progress`,t?` for ${t}`:``,`.`]})]})})}function H({id:e}){let[t,n]=(0,C.useState)(!1);return(0,D.jsxs)(`button`,{type:`button`,onClick:()=>{navigator.clipboard?.writeText(e),n(!0),setTimeout(()=>n(!1),1200)},title:`Copy session id`,className:`inline-flex max-w-full cursor-pointer items-center gap-1.5 border-none bg-transparent p-0 text-left font-mono text-label text-secondary transition-colors hover:text-display`,children:[(0,D.jsx)(`span`,{className:`truncate`,children:e}),(0,D.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-micro text-disabled`,children:t?`✓ copied`:`copy`})]})}var U=64;function W({loopId:e,runId:t}){let[n,s]=(0,C.useState)(null),[c,d]=(0,C.useState)(null),[h,v]=(0,C.useState)(!1),[b,x]=(0,C.useState)(null),w=(0,C.useCallback)(async()=>{try{s(await g({data:e})),x(null)}catch(e){x(String(e))}},[e]),T=(0,C.useCallback)(async()=>{try{s(await g({data:e}))}catch{}},[e]);(0,C.useEffect)(()=>{s(null),d(null),v(!1),x(null),w()},[e,t,w]);let E=n?.runs.find(e=>e.id===t)??c,O=z(E?.usage??null);(0,C.useEffect)(()=>{if(!n||E||h)return;let r=!0;return(async()=>{try{let i=n.runs.length?n.runs[n.runs.length-1].ts:new Date().toISOString();for(let n=0;n<U&&r;n++){let n=await y({data:{loopId:e,beforeTs:i,limit:100}});if(!n.length)break;let a=n.find(e=>e.id===t);if(a){r&&d(a);return}i=n[0].ts}}finally{r&&v(!0)}})(),()=>{r=!1}},[n,E,h,e,t]);let k=!!E&&(E.phase===`pending`||E.phase===`running`||!!E.reconciliation);(0,C.useEffect)(()=>{if(!k)return;let e=setInterval(()=>void T(),3e3);return()=>clearInterval(e)},[k,T]);async function A(){if(!E||!confirm(`Stop this run? If it is running, Pievo will ask the daemon to terminate it.`))return;let e=await m({data:E.id});if(e?.error){alert(`Stop failed: ${e.error}`);return}await w()}if(b)return(0,D.jsx)(S,{title:`Couldn't load this run.`,detail:b,onRetry:()=>void w()});if(!n||!E&&!h)return(0,D.jsx)(l,{});if(!E)return(0,D.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface px-6 py-10 text-center shadow-card`,children:[(0,D.jsx)(`div`,{className:`text-[14px] text-secondary`,children:`This run is no longer available.`}),(0,D.jsx)(_,{to:`/loops/$loopId`,params:{loopId:e},className:`mt-3 inline-block text-label font-medium text-interactive underline underline-offset-2 hover:text-display`,children:`← Back to the loop`})]});let j=n.summary.name;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`header`,{className:`rounded-card border border-hairline bg-surface px-6 pb-5 pt-[22px] shadow-card`,children:[(0,D.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-4`,children:(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,D.jsxs)(`h1`,{className:`text-[26px] font-medium leading-tight tracking-tight text-display`,children:[`Run · `,j]}),(0,D.jsx)(o,{run:E,colorText:!0})]}),(0,D.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-x-2.5 gap-y-1.5 text-meta text-secondary`,children:[(0,D.jsx)(`span`,{className:`text-primary`,children:p(E.ts)}),(0,D.jsx)(`span`,{className:`text-wire`,children:`·`}),E.durationMs!=null&&(0,D.jsx)(f,{tone:`ink`,children:a(E.durationMs)}),(0,D.jsx)(`code`,{className:`font-mono text-disabled`,children:E.id})]})]})}),(0,D.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2.5 border-t border-hairline pt-4`,children:[(0,D.jsx)(_,{to:`/loops/$loopId`,params:{loopId:e},className:i,children:`View the whole loop →`}),(E.phase===`pending`||E.phase===`running`)&&(0,D.jsx)(`button`,{type:`button`,onClick:A,className:u,disabled:E.phase===`running`&&n.machine.daemonProtocol!==4,title:E.phase===`running`&&n.machine.daemonProtocol!==4?"Daemon upgrade required to stop a running process. Run `npm install -g @kky42/pievo@latest`, then `pievo daemon restart`.":void 0,children:`Stop run`})]})]}),(0,D.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(300px,360px)]`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[E.phase===`pending`?(0,D.jsx)(L,{label:`Activity`,children:(0,D.jsx)(`div`,{className:`text-body text-secondary`,children:`Queued; it starts when this loop is free and the machine polls.`})}):E.phase===`running`?(0,D.jsx)(V,{run:E}):E.reconciliation?(0,D.jsx)(L,{label:`Recovery`,children:(0,D.jsx)(`div`,{className:`text-body text-secondary`,children:E.reconciliation===`blocking`?n.machine.presence===`online`?`The machine is online and checking an interrupted run. Queued work starts automatically after recovery.`:`Waiting for the machine to reconnect and check an interrupted run. Queued work starts automatically; no action is required.`:`This interrupted run no longer blocks queued work. Pievo will still accept its saved report if it arrives.`})}):null,E.reportIncident&&(0,D.jsx)(L,{label:`Terminal report rejected`,children:(0,D.jsxs)(`div`,{className:`space-y-3 text-body text-primary`,children:[(0,D.jsx)(`div`,{className:`font-medium`,children:E.reportIncident.code}),(0,D.jsx)(`div`,{className:`break-words text-secondary`,children:E.reportIncident.reason}),(0,D.jsxs)(`dl`,{className:`grid min-w-0 grid-cols-[max-content_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-label`,children:[(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Fault domain`}),(0,D.jsx)(`dd`,{children:E.reportIncident.faultDomain}),(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Recommended action`}),(0,D.jsx)(`dd`,{className:`break-words`,children:E.reportIncident.recommendedAction}),(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Report ID`}),(0,D.jsx)(`dd`,{className:`break-all font-mono`,children:E.reportIncident.reportId})]})]})}),E.message&&(0,D.jsx)(L,{label:`Report`,children:(0,D.jsx)(`div`,{className:`whitespace-pre-wrap break-words rounded-control border border-hairline bg-raised px-4 py-3.5 text-body leading-relaxed text-primary`,children:E.message})}),(0,D.jsx)(B,{run:E}),E.finalText&&(0,D.jsx)(L,{label:`Final output`,children:(0,D.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body text-primary`,children:E.finalText})})]}),(0,D.jsx)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:(0,D.jsx)(L,{label:`Details`,children:(0,D.jsxs)(`div`,{className:`space-y-3.5`,children:[E.status&&(0,D.jsx)(R,{k:`Status`,children:E.status}),E.durationMs!=null&&(0,D.jsx)(R,{k:`Duration`,children:a(E.durationMs)}),E.exitCode!=null&&(0,D.jsx)(R,{k:`Exit code`,children:E.exitCode}),O!=null&&(0,D.jsx)(R,{k:`Token usage`,children:(0,D.jsxs)(`span`,{className:`text-disabled`,children:[r(O),` tokens`]})}),E.error&&(0,D.jsx)(R,{k:`Error`,children:(0,D.jsx)(`span`,{className:`break-words`,style:{color:`var(--color-run-error)`},children:E.error})}),E.sessionId&&(0,D.jsx)(R,{k:`Session`,children:(0,D.jsx)(H,{id:E.sessionId})})]})})})]})]})}function G(){let{loopId:e,runId:t}=b.useParams(),{auth:n}=b.useLoaderData()??{auth:{enabled:!1}},{data:r,isPending:i}=v();return(0,D.jsxs)(`main`,{className:`mx-auto max-w-[1360px] px-8 pb-24 pt-10`,children:[(0,D.jsx)(`div`,{className:`mb-5`,children:(0,D.jsxs)(_,{to:`/loops/$loopId`,params:{loopId:e},className:`inline-flex items-center gap-1.5 text-label font-medium text-secondary transition-colors hover:text-display`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Back to loop`]})}),n?.enabled&&!i&&!r?(0,D.jsx)(x,{callbackURL:`/loops/${e}/runs/${t}`}):(0,D.jsx)(W,{loopId:e,runId:t})]})}export{G as component};
3
+ `).map(e=>{let t=w(e,n);return t.kind===`hunk`&&(n=!0),t})}function E(e){let t=0,n=0;for(let r of e)r.kind===`add`?t++:r.kind===`del`&&n++;return{added:t,removed:n}}var D=s(),O={added:`Added`,modified:`Changed`,removed:`Removed`},k={added:`text-success`,modified:`text-secondary`,removed:`text-accent`};function A(t){return t==null||t===0?``:`${t>0?`+`:`−`}${e(t)}`}var j={add:`bg-[color:var(--color-diff-add-bg)] text-primary`,del:`bg-[color:var(--color-diff-del-bg)] text-primary`,hunk:`bg-[color:var(--color-diff-hunk-bg)] text-disabled`,meta:`text-disabled`,context:`text-secondary`},M={add:`text-success`,del:`text-accent`,hunk:`text-disabled`,meta:`text-disabled`,context:`text-disabled`};function N({lines:e}){return(0,D.jsx)(`div`,{className:`min-w-0 max-h-[420px] overflow-auto border-t border-hairline bg-raised font-mono text-label leading-[1.55]`,children:(0,D.jsx)(`div`,{className:`min-w-max`,children:e.map((e,t)=>(0,D.jsxs)(`div`,{className:`flex ${j[e.kind]}`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`w-6 shrink-0 select-none pl-2.5 text-center ${M[e.kind]}`,children:e.gutter}),(0,D.jsx)(`span`,{className:`whitespace-pre pr-4`,children:e.text||`\xA0`})]},t))})})}function P({f:e,lines:t}){let n=A(e.sizeDelta),r=t?E(t):null;return(0,D.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2.5 gap-y-1 text-meta`,children:[(0,D.jsx)(`span`,{className:`shrink-0 text-caption font-medium ${k[e.status]}`,children:O[e.status]}),(0,D.jsx)(`span`,{className:`min-w-0 break-all font-mono text-primary`,children:e.path}),r&&(r.added>0||r.removed>0)&&(0,D.jsxs)(`span`,{className:`shrink-0 font-mono text-caption`,children:[r.added>0&&(0,D.jsxs)(`span`,{className:`text-success`,children:[`+`,r.added]}),r.added>0&&r.removed>0&&` `,r.removed>0&&(0,D.jsxs)(`span`,{className:`text-accent`,children:[`−`,r.removed]})]}),n&&(0,D.jsx)(`span`,{className:`shrink-0 font-mono text-caption text-disabled`,children:n}),e.binary&&(0,D.jsx)(`span`,{className:`shrink-0 text-caption text-secondary`,children:`Binary`}),e.tooLarge&&(0,D.jsx)(`span`,{className:`shrink-0 text-caption text-secondary`,children:`Too large to diff`})]})}var F=40;function I({files:e}){return(0,D.jsx)(`div`,{className:`space-y-1.5`,children:e.map(e=>{if(!e.diff)return(0,D.jsx)(`div`,{className:`rounded-control border border-hairline bg-surface px-3.5 py-2`,children:(0,D.jsx)(P,{f:e,lines:null})},e.path);let t=T(e.diff);return(0,D.jsxs)(`details`,{open:t.length<=F,className:`group min-w-0 overflow-hidden rounded-control border border-hairline bg-surface`,children:[(0,D.jsxs)(`summary`,{className:`flex cursor-pointer select-none items-center gap-2 px-3.5 py-2 marker:content-['']`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-micro text-disabled transition-transform group-open:rotate-90`,children:`▸`}),(0,D.jsx)(P,{f:e,lines:t})]}),(0,D.jsx)(N,{lines:t})]},e.path)})})}function L({label:e,count:t,children:n}){return(0,D.jsxs)(`section`,{className:`min-w-0 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,children:[(0,D.jsxs)(`div`,{className:`mb-3.5 border-b border-hairline pb-1.5 ${c}`,children:[e,t!=null&&(0,D.jsxs)(`span`,{className:`text-disabled`,children:[` (`,t,`)`]})]}),n]})}function R({k:e,children:t}){return(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`div`,{className:`mb-0.5 text-label font-medium text-secondary`,children:e}),(0,D.jsx)(`div`,{className:`min-w-0 text-body text-primary`,children:t})]})}function z(e){return!e||e.inputTokens===void 0&&e.outputTokens===void 0?null:(e.inputTokens??0)+(e.outputTokens??0)}function B({run:e}){let[t,n]=(0,C.useState)(null);return(0,C.useEffect)(()=>{if(e.phase===`pending`||e.phase===`running`)return;let t=!0;return h({data:{runId:e.id}}).then(e=>t&&n(e)).catch(()=>t&&n({hasSnapshot:!1,files:[]})),()=>{t=!1}},[e.id,e.phase]),e.phase===`pending`||e.phase===`running`?(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`File changes appear once the run finishes.`})}):t?t.hasSnapshot?(0,D.jsx)(L,{label:`Changes`,count:t.files.length,children:t.files.length===0?(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`No files changed since the previous run.`}):(0,D.jsx)(I,{files:t.files})}):(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`No file snapshot was recorded for this run.`})}):(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(l,{})})}function V({run:e}){let t=a(Math.max(0,Date.now()-Date.parse(e.ts)));return(0,D.jsx)(L,{label:`Activity`,children:(0,D.jsxs)(`div`,{className:`flex items-center gap-2.5 text-body text-secondary`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full`,style:d}),(0,D.jsxs)(`span`,{children:[`Run in progress`,t?` for ${t}`:``,`.`]})]})})}function H({id:e}){let[t,n]=(0,C.useState)(!1);return(0,D.jsxs)(`button`,{type:`button`,onClick:()=>{navigator.clipboard?.writeText(e),n(!0),setTimeout(()=>n(!1),1200)},title:`Copy session id`,className:`inline-flex max-w-full cursor-pointer items-center gap-1.5 border-none bg-transparent p-0 text-left font-mono text-label text-secondary transition-colors hover:text-display`,children:[(0,D.jsx)(`span`,{className:`truncate`,children:e}),(0,D.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-micro text-disabled`,children:t?`✓ copied`:`copy`})]})}var U=64;function W({loopId:e,runId:t}){let[n,s]=(0,C.useState)(null),[c,d]=(0,C.useState)(null),[h,v]=(0,C.useState)(!1),[x,S]=(0,C.useState)(null),w=(0,C.useCallback)(async()=>{try{s(await g({data:e})),S(null)}catch(e){S(String(e))}},[e]),T=(0,C.useCallback)(async()=>{try{s(await g({data:e}))}catch{}},[e]);(0,C.useEffect)(()=>{s(null),d(null),v(!1),S(null),w()},[e,t,w]);let E=n?.runs.find(e=>e.id===t)??c,O=z(E?.usage??null);(0,C.useEffect)(()=>{if(!n||E||h)return;let r=!0;return(async()=>{try{let i=n.runs.length?n.runs[n.runs.length-1].ts:new Date().toISOString();for(let n=0;n<U&&r;n++){let n=await y({data:{loopId:e,beforeTs:i,limit:100}});if(!n.length)break;let a=n.find(e=>e.id===t);if(a){r&&d(a);return}i=n[0].ts}}finally{r&&v(!0)}})(),()=>{r=!1}},[n,E,h,e,t]);let k=!!E&&(E.phase===`pending`||E.phase===`running`||!!E.reconciliation);(0,C.useEffect)(()=>{if(!k)return;let e=setInterval(()=>void T(),3e3);return()=>clearInterval(e)},[k,T]);async function A(){if(!E||!confirm(`Stop this run? If it is running, Pievo will ask the daemon to terminate it.`))return;let e=await m({data:E.id});if(e?.error){alert(`Stop failed: ${e.error}`);return}await w()}if(x)return(0,D.jsx)(b,{title:`Couldn't load this run.`,detail:x,onRetry:()=>void w()});if(!n||!E&&!h)return(0,D.jsx)(l,{});if(!E)return(0,D.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface px-6 py-10 text-center shadow-card`,children:[(0,D.jsx)(`div`,{className:`text-[14px] text-secondary`,children:`This run is no longer available.`}),(0,D.jsx)(_,{to:`/loops/$loopId`,params:{loopId:e},className:`mt-3 inline-block text-label font-medium text-interactive underline underline-offset-2 hover:text-display`,children:`← Back to the loop`})]});let j=n.summary.name;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`header`,{className:`rounded-card border border-hairline bg-surface px-6 pb-5 pt-[22px] shadow-card`,children:[(0,D.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-4`,children:(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,D.jsxs)(`h1`,{className:`text-[26px] font-medium leading-tight tracking-tight text-display`,children:[`Run · `,j]}),(0,D.jsx)(o,{run:E,colorText:!0})]}),(0,D.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-x-2.5 gap-y-1.5 text-meta text-secondary`,children:[(0,D.jsx)(`span`,{className:`text-primary`,children:p(E.ts)}),(0,D.jsx)(`span`,{className:`text-wire`,children:`·`}),E.durationMs!=null&&(0,D.jsx)(f,{tone:`ink`,children:a(E.durationMs)}),(0,D.jsx)(`code`,{className:`font-mono text-disabled`,children:E.id})]})]})}),(0,D.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2.5 border-t border-hairline pt-4`,children:[(0,D.jsx)(_,{to:`/loops/$loopId`,params:{loopId:e},className:i,children:`View the whole loop →`}),(E.phase===`pending`||E.phase===`running`)&&(0,D.jsx)(`button`,{type:`button`,onClick:A,className:u,disabled:E.phase===`running`&&n.machine.daemonProtocol!==4,title:E.phase===`running`&&n.machine.daemonProtocol!==4?"Daemon upgrade required to stop a running process. Run `npm install -g @kky42/pievo@latest`, then `pievo daemon restart`.":void 0,children:`Stop run`})]})]}),(0,D.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(300px,360px)]`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[E.phase===`pending`?(0,D.jsx)(L,{label:`Activity`,children:(0,D.jsx)(`div`,{className:`text-body text-secondary`,children:`Queued; it starts when this loop is free and the machine polls.`})}):E.phase===`running`?(0,D.jsx)(V,{run:E}):E.reconciliation?(0,D.jsx)(L,{label:`Recovery`,children:(0,D.jsx)(`div`,{className:`text-body text-secondary`,children:E.reconciliation===`blocking`?n.machine.presence===`online`?`The machine is online and checking an interrupted run. Queued work starts automatically after recovery.`:`Waiting for the machine to reconnect and check an interrupted run. Queued work starts automatically; no action is required.`:`This interrupted run no longer blocks queued work. Pievo will still accept its saved report if it arrives.`})}):null,E.reportIncident&&(0,D.jsx)(L,{label:`Terminal report rejected`,children:(0,D.jsxs)(`div`,{className:`space-y-3 text-body text-primary`,children:[(0,D.jsx)(`div`,{className:`font-medium`,children:E.reportIncident.code}),(0,D.jsx)(`div`,{className:`break-words text-secondary`,children:E.reportIncident.reason}),(0,D.jsxs)(`dl`,{className:`grid min-w-0 grid-cols-[max-content_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-label`,children:[(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Fault domain`}),(0,D.jsx)(`dd`,{children:E.reportIncident.faultDomain}),(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Recommended action`}),(0,D.jsx)(`dd`,{className:`break-words`,children:E.reportIncident.recommendedAction}),(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Report ID`}),(0,D.jsx)(`dd`,{className:`break-all font-mono`,children:E.reportIncident.reportId})]})]})}),E.message&&(0,D.jsx)(L,{label:`Report`,children:(0,D.jsx)(`div`,{className:`whitespace-pre-wrap break-words rounded-control border border-hairline bg-raised px-4 py-3.5 text-body leading-relaxed text-primary`,children:E.message})}),(0,D.jsx)(B,{run:E}),E.finalText&&(0,D.jsx)(L,{label:`Final output`,children:(0,D.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body text-primary`,children:E.finalText})})]}),(0,D.jsx)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:(0,D.jsx)(L,{label:`Details`,children:(0,D.jsxs)(`div`,{className:`space-y-3.5`,children:[E.status&&(0,D.jsx)(R,{k:`Status`,children:E.status}),E.durationMs!=null&&(0,D.jsx)(R,{k:`Duration`,children:a(E.durationMs)}),E.exitCode!=null&&(0,D.jsx)(R,{k:`Exit code`,children:E.exitCode}),O!=null&&(0,D.jsx)(R,{k:`Token usage`,children:(0,D.jsxs)(`span`,{className:`text-disabled`,children:[r(O),` tokens`]})}),E.error&&(0,D.jsx)(R,{k:`Error`,children:(0,D.jsx)(`span`,{className:`break-words`,style:{color:`var(--color-run-error)`},children:E.error})}),E.sessionId&&(0,D.jsx)(R,{k:`Session`,children:(0,D.jsx)(H,{id:E.sessionId})})]})})})]})]})}function G(){let{loopId:e,runId:t}=x.useParams(),{auth:n}=x.useLoaderData()??{auth:{enabled:!1}},{data:r,isPending:i}=v();return(0,D.jsxs)(`main`,{className:`mx-auto max-w-[1360px] px-8 pb-24 pt-10`,children:[(0,D.jsx)(`div`,{className:`mb-5`,children:(0,D.jsxs)(_,{to:`/loops/$loopId`,params:{loopId:e},className:`inline-flex items-center gap-1.5 text-label font-medium text-secondary transition-colors hover:text-display`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Back to loop`]})}),n?.enabled&&!i&&!r?(0,D.jsx)(S,{callbackURL:`/loops/${e}/runs/${t}`}):(0,D.jsx)(W,{loopId:e,runId:t})]})}export{G as component};
@@ -1 +1 @@
1
- import{j as e}from"./ui-s5IMg6RF.js";import{s as t}from"./preload-helper-Bs7oCAsw.js";import{a as n,o as r}from"./index-BqiDqbyu.js";import{t as i}from"./SignIn-Cf4HOpdF.js";var a=e();function o(){let e=n.useLoaderData(),{data:o,isPending:s}=t();return e?.auth?.enabled&&!s&&!o||e?.mode===`signin`?(0,a.jsx)(i,{}):(0,a.jsx)(r,{initial:e.initial})}export{o as component};
1
+ import{j as e}from"./ui-s5IMg6RF.js";import{s as t}from"./preload-helper-Bs7oCAsw.js";import{a as n,o as r}from"./index-DM5pYU2E.js";import{t as i}from"./SignIn-Cf4HOpdF.js";var a=e();function o(){let e=n.useLoaderData(),{data:o,isPending:s}=t();return e?.auth?.enabled&&!s&&!o||e?.mode===`signin`?(0,a.jsx)(i,{}):(0,a.jsx)(r,{initial:e.initial})}export{o as component};
@@ -1 +1 @@
1
- import{j as e}from"./ui-s5IMg6RF.js";import{s as t}from"./preload-helper-Bs7oCAsw.js";import{i as n,o as r}from"./index-BqiDqbyu.js";import{t as i}from"./SignIn-Cf4HOpdF.js";var a=e();function o(){let e=n.useLoaderData(),{data:o,isPending:s}=t();return e?.auth?.enabled&&!s&&!o||e?.mode===`signin`?(0,a.jsx)(i,{}):(0,a.jsx)(r,{teamId:e.teamId,initial:e.initial},e.teamId)}export{o as component};
1
+ import{j as e}from"./ui-s5IMg6RF.js";import{s as t}from"./preload-helper-Bs7oCAsw.js";import{i as n,o as r}from"./index-DM5pYU2E.js";import{t as i}from"./SignIn-Cf4HOpdF.js";var a=e();function o(){let e=n.useLoaderData(),{data:o,isPending:s}=t();return e?.auth?.enabled&&!s&&!o||e?.mode===`signin`?(0,a.jsx)(i,{}):(0,a.jsx)(r,{teamId:e.teamId,initial:e.initial},e.teamId)}export{o as component};
@@ -1344,6 +1344,7 @@ function isNotFound(obj) {
1344
1344
  }
1345
1345
  //#endregion
1346
1346
  //#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.13/node_modules/@tanstack/router-core/dist/esm/qss.js
1347
+ var import_jsx_runtime = require_jsx_runtime();
1347
1348
  /**
1348
1349
  * Program is a reimplementation of the `qss` package:
1349
1350
  * Copyright (c) Luke Edwards luke.edwards05@gmail.com, MIT License
@@ -3592,7 +3593,6 @@ var BaseRootRoute = class extends BaseRoute {
3592
3593
  };
3593
3594
  //#endregion
3594
3595
  //#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.16_react-dom@19.2.7_react@19.2.7/node_modules/@tanstack/react-router/dist/esm/CatchBoundary.js
3595
- var import_jsx_runtime = require_jsx_runtime();
3596
3596
  function CatchBoundary(props) {
3597
3597
  const errorComponent = props.errorComponent ?? ErrorComponent;
3598
3598
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CatchBoundaryImpl, {
@@ -1,12 +1,12 @@
1
1
  import { o as __toESM } from "../_runtime.mjs";
2
2
  import { g as require_react, h as require_jsx_runtime, s as TooltipProvider } from "../_libs/@base-ui/react+[...].mjs";
3
- import { d as useNavigate } from "../_libs/@tanstack/react-router+[...].mjs";
4
- import { _ as loadOlderRuns, d as getConfig, g as listMyTeams, h as listLoops, n as GitHubIcon, r as PievoLogo, t as GITHUB_URL, v as mintClaim } from "./SocialLinks-y7JuqJqp.mjs";
5
3
  import { T as selectCls, _ as inputCls, a as btn, l as btnSm, o as btnDanger, r as Pill, s as btnPrimary, t as ErrorBanner, v as labelCls } from "./ui-BEPYdOmJ.mjs";
4
+ import { d as useNavigate } from "../_libs/@tanstack/react-router+[...].mjs";
5
+ import { _ as loadOlderRuns, d as getConfig, g as listMyTeams, h as listLoops, n as GitHubIcon, r as PievoLogo, t as GITHUB_URL, v as mintClaim } from "./SocialLinks-dPCmZWvC.mjs";
6
6
  import { t as setActiveTeamCookie } from "./teamCookie-B7hLOIie.mjs";
7
- import { a as getTeamDetail, d as revokeTeamInvite, f as setTeamMemberRole, i as deleteTeam, l as removeTeamMember, n as createTeam, o as leaveTeam, r as createTeamInvite, s as listManagedTeams, t as addTeamMember, u as renameTeam } from "./teamFns-BEvVeIHP.mjs";
8
- import { a as ModalSection, c as listMachines, i as ModalHead, l as mergeRuns, n as MachinesModal, r as Modal, s as daemonConnectCommand, t as LoopOverview } from "./MachinesModal-BkHx2efW.mjs";
9
- //#region node_modules/.nitro/vite/services/ssr/assets/DashboardView-CDGLNgi_.js
7
+ import { a as getTeamDetail, d as revokeTeamInvite, f as setTeamMemberRole, i as deleteTeam, l as removeTeamMember, n as createTeam, o as leaveTeam, r as createTeamInvite, s as listManagedTeams, t as addTeamMember, u as renameTeam } from "./teamFns-BMR5TRJw.mjs";
8
+ import { a as ModalSection, c as listMachines, i as ModalHead, l as mergeRuns, n as MachinesModal, r as Modal, s as daemonConnectCommand, t as LoopOverview } from "./MachinesModal-D54Uza6A.mjs";
9
+ //#region node_modules/.nitro/vite/services/ssr/assets/DashboardView-DTfEhixr.js
10
10
  var import_react = /* @__PURE__ */ __toESM(require_react());
11
11
  var import_jsx_runtime = require_jsx_runtime();
12
12
  function LoopCard({ loop, onOpen, onPickRun }) {
@@ -607,7 +607,7 @@ function ComposeModal({ open, onClose, teamId }) {
607
607
  title: "Install and connect the daemon",
608
608
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
609
609
  className: "mt-1.5 text-body leading-snug text-secondary",
610
- children: "Paste this command into the foreground coding-agent session where the loop should run."
610
+ children: "Run this command in your terminal. It connects the daemon and installs the Pievo skill."
611
611
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
612
612
  className: "mt-3 flex min-w-0 items-start gap-2",
613
613
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
@@ -622,10 +622,10 @@ function ComposeModal({ open, onClose, teamId }) {
622
622
  })]
623
623
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Step, {
624
624
  number: "2",
625
- title: "Create the loop",
625
+ title: "Start a new agent session",
626
626
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
627
627
  className: "mt-1.5 text-body leading-snug text-secondary",
628
- children: "Then, in the same session, say:"
628
+ children: "After the command finishes, start a new Claude Code or Codex session in the project where the loop should run, then say:"
629
629
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
630
630
  className: "mt-3 rounded-control border border-hairline bg-raised p-4 text-body font-medium text-display",
631
631
  children: "Create a Pievo loop."
@@ -1,11 +1,12 @@
1
1
  import { o as __toESM } from "../_runtime.mjs";
2
- import { St as machinePresence, tt as isOutdated } from "./boot-D_THchbC.mjs";
2
+ import { tt as isOutdated, xt as machinePresence } from "./boot-CEPRQU5M.mjs";
3
3
  import { a as DialogClose, c as TooltipPopup, d as TooltipTrigger, f as TooltipRoot, g as require_react, h as require_jsx_runtime, i as DialogPopup, l as TooltipPositioner, n as DialogRoot, o as DialogBackdrop, r as DialogPortal, t as DialogTitle, u as TooltipPortal } from "../_libs/@base-ui/react+[...].mjs";
4
- import { n as createServerFn } from "./ssr.mjs";
5
- import { d as getConfig, o as createSsrRpc } from "./SocialLinks-y7JuqJqp.mjs";
6
4
  import { C as scheduleText, D as until, O as useHydrated, _ as inputCls, a as btn, b as rel, d as dotLabel, f as dotOpacity, h as fnum, m as fmt, o as btnDanger, p as dur, r as Pill, s as btnPrimary, t as ErrorBanner, u as dotColor, v as labelCls, w as sectionHeadCls, x as runPulseAnim, y as lastRunOf } from "./ui-BEPYdOmJ.mjs";
5
+ import { t as ConfirmBar } from "./actionUi-DCNmrAjw.mjs";
6
+ import { n as createServerFn } from "./ssr.mjs";
7
+ import { d as getConfig, o as createSsrRpc } from "./SocialLinks-dPCmZWvC.mjs";
7
8
  import { i as lifecyclePresentation, n as daemonStopSupport } from "./lifecycleUi-DOr6Af13.mjs";
8
- //#region node_modules/.nitro/vite/services/ssr/assets/MachinesModal-BkHx2efW.js
9
+ //#region node_modules/.nitro/vite/services/ssr/assets/MachinesModal-D54Uza6A.js
9
10
  var import_react = /* @__PURE__ */ __toESM(require_react());
10
11
  var import_jsx_runtime = require_jsx_runtime();
11
12
  /**
@@ -52,10 +53,13 @@ var machineStatus = createServerFn({ method: "GET" }).validator((id) => id).hand
52
53
  /** Act 2 — name the connected machine (it then appears in the list). */
53
54
  var finalizeMachine = createServerFn({ method: "POST" }).validator((d) => d).handler(createSsrRpc("27d7eba0b6a2257949392fdd56057275a5c5366484ae01faf3b5897a225ecd83"));
54
55
  /**
55
- * Cancel a pending connect (or delete an existing machine). A machine that still
56
- * owns loops can't be deleted — the loops execute on it, so they must be removed
57
- * first (we block rather than cascade, to never silently nuke a loop's history).
58
- * Pending/unnamed machines have no loops, so the connect-cancel path passes through.
56
+ * Cancel a pending connect or delete a machine and all of its server-owned data.
57
+ * Each loop goes through forceDeleteLoop so execution authority is retired and
58
+ * history/artifact metadata is removed. Nothing reaches into the machine's cwd.
59
+ *
60
+ * A teammate may still remove an empty machine as before. Cascading loops is
61
+ * stronger: under the auth gate the caller must own every affected loop team,
62
+ * matching the authority required to force-retire those teams' run leases.
59
63
  */
60
64
  var deleteMachine = createServerFn({ method: "POST" }).validator((id) => id).handler(createSsrRpc("a6384dc7154d9930422d29396f5de64b3ac69c62ad3824bc4a22d745fc07b293"));
61
65
  /** Merge two chronological (oldest-first) run lists, dedup by id (the first
@@ -378,7 +382,7 @@ function ModalSection({ children, action }) {
378
382
  /** User-facing daemon commands. Public UX installs globally; PIEVO_CLI dev
379
383
  * overrides are invoked verbatim and never trigger a global npm install. */
380
384
  function daemonConnectCommand(origin, token, cli, customCli) {
381
- const start = `${cli} daemon start --server-url ${origin} --connect-key ${token}`;
385
+ const start = `${cli} daemon connect --server-url ${origin} --connect-key ${token}`;
382
386
  return customCli ? start : `npm install -g @kky42/pievo@latest && ${start}`;
383
387
  }
384
388
  function daemonUpgradeCommand(cli, customCli) {
@@ -406,6 +410,8 @@ function MachinesModal({ open, onClose, teamId }) {
406
410
  const [status, setStatus] = (0, import_react.useState)(null);
407
411
  const [name, setName] = (0, import_react.useState)("");
408
412
  const [busy, setBusy] = (0, import_react.useState)(false);
413
+ const [confirmDelete, setConfirmDelete] = (0, import_react.useState)(null);
414
+ const [deleting, setDeleting] = (0, import_react.useState)(false);
409
415
  const [delErr, setDelErr] = (0, import_react.useState)(null);
410
416
  const [cliConfig, setCliConfig] = (0, import_react.useState)(null);
411
417
  const [configErr, setConfigErr] = (0, import_react.useState)(false);
@@ -491,14 +497,20 @@ function MachinesModal({ open, onClose, teamId }) {
491
497
  await load();
492
498
  }
493
499
  async function remove(id) {
500
+ setDeleting(true);
494
501
  setDelErr(null);
495
- const r = await deleteMachine({ data: id });
496
- if (!r.ok) {
497
- setDelErr(r.error ?? "Could not delete this machine.");
502
+ try {
503
+ const r = await deleteMachine({ data: id });
504
+ if (!r.ok) {
505
+ setDelErr(r.error ?? "Could not delete this machine.");
506
+ await load();
507
+ return;
508
+ }
509
+ setConfirmDelete(null);
498
510
  await load();
499
- return;
511
+ } finally {
512
+ setDeleting(false);
500
513
  }
501
- await load();
502
514
  }
503
515
  const connected = !!status?.online;
504
516
  if (pending) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Modal, {
@@ -521,6 +533,10 @@ function MachinesModal({ open, onClose, teamId }) {
521
533
  className: "mt-2 text-body text-secondary",
522
534
  children: configErr ? "Could not load the connection command. Close and try again." : "Loading connection command…"
523
535
  }),
536
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
537
+ className: "mt-3 text-label text-secondary",
538
+ children: "Connecting makes this server active on that computer. Loops on other servers are not copied or deleted, and return when the computer reconnects there."
539
+ }),
524
540
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
525
541
  className: "mt-4 flex items-center gap-2.5 rounded-control border border-hairline bg-warn-soft px-4 py-3",
526
542
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "inline-block h-2.5 w-2.5 animate-pulse rounded-full bg-rubik-orange" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
@@ -624,16 +640,28 @@ function MachinesModal({ open, onClose, teamId }) {
624
640
  ]
625
641
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
626
642
  className: btnDanger,
627
- disabled: m.loopCount > 0,
628
- title: m.loopCount > 0 ? "Delete its loops first" : void 0,
629
- onClick: () => void remove(m.id),
643
+ disabled: deleting,
644
+ onClick: () => setConfirmDelete(m.id),
630
645
  children: "Delete"
631
646
  })]
632
647
  }),
648
+ confirmDelete === m.id && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfirmBar, {
649
+ prompt: `Delete ${m.name} and ${m.loopCount} loop${m.loopCount === 1 ? "" : "s"}?`,
650
+ note: `This permanently deletes the machine, ${m.loopCount} loop${m.loopCount === 1 ? "" : "s"}, and their server history and artifact metadata. Local project files are not deleted, but an unreachable local agent may continue running.`,
651
+ cta: "Delete machine",
652
+ danger: true,
653
+ busy: deleting,
654
+ onConfirm: () => void remove(m.id),
655
+ onCancel: () => setConfirmDelete(null)
656
+ }),
633
657
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
634
658
  className: "text-label text-secondary",
635
659
  children: daemonStopSupport(m.daemonProtocol).label
636
660
  }),
661
+ presence === "offline" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
662
+ className: "text-label text-secondary",
663
+ children: "It may be stopped or connected elsewhere. Its data remains on this server."
664
+ }),
637
665
  !daemonStopSupport(m.daemonProtocol).supported && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
638
666
  className: "text-label text-accent",
639
667
  children: "Daemon upgrade required to stop a running process"
@@ -1,7 +1,7 @@
1
1
  import { h as require_jsx_runtime } from "../_libs/@base-ui/react+[...].mjs";
2
- import { S as signIn, n as GitHubIcon, r as PievoLogo, t as GITHUB_URL } from "./SocialLinks-y7JuqJqp.mjs";
3
2
  import { s as btnPrimary } from "./ui-BEPYdOmJ.mjs";
4
- //#region node_modules/.nitro/vite/services/ssr/assets/SignIn-DwHmFBg2.js
3
+ import { S as signIn, n as GitHubIcon, r as PievoLogo, t as GITHUB_URL } from "./SocialLinks-dPCmZWvC.mjs";
4
+ //#region node_modules/.nitro/vite/services/ssr/assets/SignIn-C2JkrSfV.js
5
5
  var import_jsx_runtime = require_jsx_runtime();
6
6
  /**
7
7
  * Sign-in CTA — shown by the auth gate when a GitHub OAuth app is configured and
@@ -1,8 +1,8 @@
1
1
  import { o as __toESM } from "../_runtime.mjs";
2
- import { D as defu, Kt as toKebabCase, L as getBaseURL, at as isSafeUrlScheme, g as capitalizeFirstLetter, x as createFetch } from "./boot-D_THchbC.mjs";
2
+ import { D as defu, Gt as toKebabCase, L as getBaseURL, at as isSafeUrlScheme, g as capitalizeFirstLetter, x as createFetch } from "./boot-CEPRQU5M.mjs";
3
3
  import { g as require_react, h as require_jsx_runtime } from "../_libs/@base-ui/react+[...].mjs";
4
4
  import { n as createServerFn, r as getServerFnById, t as TSS_SERVER_FUNCTION } from "./ssr.mjs";
5
- //#region node_modules/.nitro/vite/services/ssr/assets/SocialLinks-y7JuqJqp.js
5
+ //#region node_modules/.nitro/vite/services/ssr/assets/SocialLinks-dPCmZWvC.js
6
6
  var import_react = /* @__PURE__ */ __toESM(require_react());
7
7
  var import_jsx_runtime = require_jsx_runtime();
8
8
  var createSsrRpc = (functionId) => {
@@ -1,6 +1,6 @@
1
- import { F as getArtifactFile, I as getArtifactSync, Rt as safeRelPath, lt as listArtifacts } from "./boot-D_THchbC.mjs";
2
- import { n as toArtifactSummary } from "./loopProjection-B30cdu8n.mjs";
3
- //#region node_modules/.nitro/vite/services/ssr/assets/artifactFiles-1f04rZwG.js
1
+ import { F as getArtifactFile, I as getArtifactSync, Lt as safeRelPath, lt as listArtifacts } from "./boot-CEPRQU5M.mjs";
2
+ import { n as toArtifactSummary } from "./loopProjection-CeH1HELf.mjs";
3
+ //#region node_modules/.nitro/vite/services/ssr/assets/artifactFiles-DBu2yk9a.js
4
4
  /**
5
5
  * Server-side reads over a loop's current exact artifacts. Pure helpers
6
6
  * (no request/session context) so they're shared by the lazy server fns
@@ -1,7 +1,7 @@
1
1
  import { c as createFileRoute, s as lazyRouteComponent } from "../_libs/@tanstack/react-router+[...].mjs";
2
- import { i as authClient, u as getAuthState } from "./SocialLinks-y7JuqJqp.mjs";
3
- //#region node_modules/.nitro/vite/services/ssr/assets/artifactKind-DCMrrjl8.js
4
- var $$splitComponentImporter = () => import("./loops._loopId-Dx0u0aw-.mjs");
2
+ import { i as authClient, u as getAuthState } from "./SocialLinks-dPCmZWvC.mjs";
3
+ //#region node_modules/.nitro/vite/services/ssr/assets/artifactKind-CJMjNtSC.js
4
+ var $$splitComponentImporter = () => import("./loops._loopId-BTAKWGvT.mjs");
5
5
  /**
6
6
  * Loop detail page — `/loops/$loopId`: a loop header and action toolbar, the
7
7
  * exact artifact Files panel, and the runs timeline. The view owns its own
@@ -0,0 +1,2 @@
1
+ import { f as SYNC_BODY_CAP, i as BLOB_CAP, wt as parseArtifactSyncBody } from "./boot-CEPRQU5M.mjs";
2
+ export { BLOB_CAP, SYNC_BODY_CAP, parseArtifactSyncBody };