@kky42/pievo-server 3.0.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/assets/MarkdownView-C9-AzIkl.js +66 -0
- package/.output/public/assets/{actionUi-BZrLpgHT.js → actionUi-D47jwMfh.js} +1 -1
- package/.output/public/assets/app-C5xfpeJe.css +2 -0
- package/.output/public/assets/index-BgNjFXWE.js +10 -0
- package/.output/public/assets/loops._loopId-Bo63FXPQ.js +2 -0
- package/.output/public/assets/loops._loopId_.runs._runId-DW2HPjtj.js +3 -0
- package/.output/public/assets/{preload-helper-hRTYB_ju.js → preload-helper-CbYqBpY9.js} +2 -2
- package/.output/public/assets/routes-C88oSApK.js +1 -0
- package/.output/public/assets/routes-CTCh8xYm.js +1 -0
- package/.output/server/_ssr/{MachinesModal-CmVMec6B.mjs → MachinesModal-DwHy2cis.mjs} +44 -25
- package/.output/server/_ssr/MarkdownView-BOe75tli.mjs +67 -0
- package/.output/server/_ssr/{actionUi-DE-Pb2tv.mjs → actionUi-CszQXDSN.mjs} +20 -2
- package/.output/server/_ssr/artifactFiles-DJiK99sF.mjs +67 -0
- package/.output/server/_ssr/{artifactKind-DqpmtxDU.mjs → artifactKind-DYMU0q3N.mjs} +2 -7
- package/.output/server/_ssr/{boot-CYRi-wez.mjs → boot-CecCDRoH.mjs} +950 -968
- package/.output/server/_ssr/{lifecycleUi-BsbUsi5K.mjs → lifecycleUi-Bd7_sthp.mjs} +12 -19
- package/.output/server/_ssr/{loopApi-Bez1rHV0.mjs → loopApi-uEiBQ5YX.mjs} +17 -23
- package/.output/server/_ssr/{loopProjection-esCjyZJg.mjs → loopProjection-Bo54jjGd.mjs} +5 -3
- package/.output/server/_ssr/{loops._loopId-KUezNY69.mjs → loops._loopId-c1oRP7cr.mjs} +37 -117
- package/.output/server/_ssr/{loops._loopId_.runs._runId-DOkUEesG.mjs → loops._loopId_.runs._runId-Dl0SwOlC.mjs} +43 -23
- package/.output/server/_ssr/loops._loopId_.runs._runId-czMVvNsk.mjs +11 -0
- package/.output/server/_ssr/{machineFns-CniGcY8s.mjs → machineFns-aw9xe5oz.mjs} +6 -20
- package/.output/server/_ssr/{router-BFIH2UAE.mjs → router-3OQ849sN.mjs} +96 -112
- package/.output/server/_ssr/{routes-BSVBANI3.mjs → routes-CL4y6AEv.mjs} +2 -2
- package/.output/server/_ssr/{routes-DnE7XDe_.mjs → routes-CT5IdoiP.mjs} +6 -6
- package/.output/server/_ssr/{routes-ngpX7h8D.mjs → routes-nU2PDK3W.mjs} +2 -2
- package/.output/server/_ssr/ssr.mjs +22 -22
- package/.output/server/{_tanstack-start-manifest_v-DnwAupbZ.mjs → _tanstack-start-manifest_v-_nMS2ozp.mjs} +9 -10
- package/.output/server/drizzle/0001_loop_files.sql +9 -0
- package/.output/server/drizzle/0002_run_attention.sql +1 -0
- package/.output/server/drizzle/meta/_journal.json +15 -1
- package/.output/server/index.mjs +52 -45
- package/drizzle/0001_loop_files.sql +9 -0
- package/drizzle/0002_run_attention.sql +1 -0
- package/drizzle/meta/_journal.json +15 -1
- package/package.json +1 -1
- package/.output/public/assets/app-DXLuQNb9.css +0 -2
- package/.output/public/assets/index-Di_wpAtL.js +0 -10
- package/.output/public/assets/loops._loopId-X3ClNPMY.js +0 -67
- package/.output/public/assets/loops._loopId_.runs._runId-ByU2BSyF.js +0 -3
- package/.output/public/assets/routes-BIOJZsig.js +0 -1
- package/.output/public/assets/routes-K8D5uBiV.js +0 -1
- package/.output/server/_ssr/artifactFiles-Di1xDKvX.mjs +0 -57
- package/.output/server/_ssr/loops._loopId_.runs._runId-BFP9oMrp.mjs +0 -16
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import{A as e,C as t,E as n,I as r,L as i,M as a,O as o,S as s,T as c,a as l,b as u,d,f,g as p,h as m,i as h,l as g,m as ee,n as te,o as _,r as v,t as y,u as ne,v as b,y as re,z as ie}from"./actionUi-BZrLpgHT.js";import{E as ae,T as oe,_ as se,c as ce,g as le,h as ue,i as de,n as fe,o as pe,p as me,r as x,s as he,u as ge,v as _e,y as ve}from"./preload-helper-hRTYB_ju.js";import{a as ye,c as be,n as xe,o as Se,s as Ce}from"./index-Di_wpAtL.js";var S=ie(i(),1),we={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 C(e){return(e.match(/\.([a-z0-9]+)$/i)?.[1]??``).toLowerCase()}function Te(e){return we[C(e)]??null}var w=e=>Te(e)!==null,Ee=e=>C(e)===`html`||C(e)===`htm`,De=e=>C(e)===`md`||C(e)===`markdown`;function T(e){return w(e)?`image`:Ee(e)?`html`:De(e)?`markdown`:`text`}function Oe(e,t){let n=t.split(`/`).map(encodeURIComponent).join(`/`);return`/api/artifact/${encodeURIComponent(e)}/${n}`}function ke(e,t){return`${Oe(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 D(e){if(Array.isArray(e))return e}function O(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 k(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ae(e,t){return D(e)||O(e,t)||je(e,t)||k()}function je(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 Me=Object.entries,Ne=Object.setPrototypeOf,Pe=Object.isFrozen,Fe=Object.getPrototypeOf,Ie=Object.getOwnPropertyDescriptor,A=Object.freeze,j=Object.seal,Le=Object.create,Re=typeof Reflect<`u`&&Reflect,ze=Re.apply,Be=Re.construct;A||=function(e){return e},j||=function(e){return e},ze||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},Be||=function(e){return new e(...[...arguments].slice(1))};var Ve=F(Array.prototype.forEach),He=F(Array.prototype.lastIndexOf),Ue=F(Array.prototype.pop),We=F(Array.prototype.push),Ge=F(Array.prototype.splice),Ke=Array.isArray,qe=F(String.prototype.toLowerCase),Je=F(String.prototype.toString),Ye=F(String.prototype.match),Xe=F(String.prototype.replace),Ze=F(String.prototype.indexOf),Qe=F(String.prototype.trim),$e=F(Number.prototype.toString),et=F(Boolean.prototype.toString),tt=typeof BigInt>`u`?null:F(BigInt.prototype.toString),nt=typeof Symbol>`u`?null:F(Symbol.prototype.toString),M=F(Object.prototype.hasOwnProperty),N=F(Object.prototype.toString),P=F(RegExp.prototype.test),rt=it(TypeError);function F(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return ze(e,t,n)}}function it(e){return function(){return Be(e,[...arguments])}}function I(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:qe;if(Ne&&Ne(e,null),!Ke(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Pe(t)||(t[r]=e),i=e)}e[i]=!0}return e}function at(e){for(let t=0;t<e.length;t++)M(e,t)||(e[t]=null);return e}function L(e){let t=Le(null);for(let r of Me(e)){var n=Ae(r,2);let i=n[0],a=n[1];M(e,i)&&(Ke(a)?t[i]=at(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=L(a):t[i]=a)}return t}function ot(e){switch(typeof e){case`string`:return e;case`number`:return $e(e);case`boolean`:return et(e);case`bigint`:return tt?tt(e):`0`;case`symbol`:return nt?nt(e):`Symbol()`;case`undefined`:return N(e);case`function`:case`object`:{if(e===null)return N(e);let t=e,n=R(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:N(e)}return N(e)}default:return N(e)}}function R(e,t){for(;e!==null;){let n=Ie(e,t);if(n){if(n.get)return F(n.get);if(typeof n.value==`function`)return F(n.value)}e=Fe(e)}function n(){return null}return n}function st(e){try{return P(e,``),!0}catch{return!1}}var ct=A(`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(`.`)),lt=A(`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(`.`)),ut=A([`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`]),dt=A([`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`]),ft=A(`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(`.`)),pt=A([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),mt=A([`#text`]),ht=A(`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(`.`)),gt=A(`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(`.`)),_t=A(`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(`.`)),vt=A([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),yt=j(/{{[\w\W]*|^[\w\W]*}}/g),bt=j(/<%[\w\W]*|^[\w\W]*%>/g),xt=j(/\${[\w\W]*/g),St=j(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ct=j(/^aria-[\-\w]+$/),wt=j(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Tt=j(/^(?:\w+script|data):/i),Et=j(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Dt=j(/^html$/i),Ot=j(/^[a-z][.\w]*(-[.\w]+)+$/i),kt=j(/<[/\w!]/g),At=j(/<[/\w]/g),jt=j(/<\/no(script|embed|frames)/i),Mt=j(/\/>/i),z={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Nt=function(){return typeof window>`u`?null:window},Pt=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}},Ft=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},It=function(e,t,n,r){return M(e,t)&&Ke(e[t])?I(r.base?L(r.base):{},e[t],r.transform):n};function Lt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Nt(),t=e=>Lt(e);if(t.version=`3.4.11`,t.removed=[],!e||!e.document||e.document.nodeType!==z.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=R(d,`cloneNode`),p=R(d,`remove`),m=R(d,`nextSibling`),h=R(d,`childNodes`),g=R(d,`parentNode`),ee=R(d,`shadowRoot`),te=R(d,`attributes`),_=o&&o.prototype?R(o.prototype,`nodeType`):null,v=o&&o.prototype?R(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let y,ne=``,b,re=!1,ie=0,ae=function(){if(ie>0)throw rt(`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.`)},oe=function(e){ae(),ie++;try{return y.createHTML(e)}finally{ie--}},se=function(e){ae(),ie++;try{return y.createScriptURL(e)}finally{ie--}},ce=function(){return re||=(b=Pt(u,i),!0),b},le=n,ue=le.implementation,de=le.createNodeIterator,fe=le.createDocumentFragment,pe=le.getElementsByTagName,me=r.importNode,x=Ft();t.isSupported=typeof Me==`function`&&typeof g==`function`&&ue&&ue.createHTMLDocument!==void 0;let he=yt,ge=bt,_e=xt,ve=St,ye=Ct,be=Tt,xe=Et,Se=Ot,Ce=wt,S=null,we=I({},[...ct,...lt,...ut,...ft,...mt]),C=null,Te=I({},[...ht,...gt,..._t,...vt]),w=Object.seal(Le(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}})),Ee=null,De=null,T=Object.seal(Le(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Oe=!0,ke=!0,E=!1,D=!0,O=!1,k=!0,Ae=!1,je=!1,Ne=null,Pe=null,Fe=!1,Ie=!1,Re=!1,ze=!1,Be=!0,$e=!1,et=`user-content-`,tt=!0,nt=!1,N={},F=null,it=I({},`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(`.`)),at=null,Rt=I({},[`audio`,`video`,`img`,`source`,`image`,`track`]),zt=null,B=I({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Bt=`http://www.w3.org/1998/Math/MathML`,V=`http://www.w3.org/2000/svg`,H=`http://www.w3.org/1999/xhtml`,U=H,Vt=!1,W=null,Ht=I({},[Bt,V,H],Je),Ut=A([`mi`,`mo`,`mn`,`ms`,`mtext`]),Wt=I({},Ut),Gt=A([`annotation-xml`]),Kt=I({},Gt),qt=I({},[`title`,`style`,`font`,`a`,`script`]),Jt=null,Yt=[`application/xhtml+xml`,`text/html`],G=null,K=null,Xt=n.createElement(`form`),Zt=function(e){return e instanceof RegExp||e instanceof Function},Qt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(K&&K===e)return;(!e||typeof e!=`object`)&&(e={}),e=L(e),Jt=Yt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,G=Jt===`application/xhtml+xml`?Je:qe,S=It(e,`ALLOWED_TAGS`,we,{transform:G}),C=It(e,`ALLOWED_ATTR`,Te,{transform:G}),W=It(e,`ALLOWED_NAMESPACES`,Ht,{transform:Je}),zt=It(e,`ADD_URI_SAFE_ATTR`,B,{transform:G,base:B}),at=It(e,`ADD_DATA_URI_TAGS`,Rt,{transform:G,base:Rt}),F=It(e,`FORBID_CONTENTS`,it,{transform:G}),Ee=It(e,`FORBID_TAGS`,L({}),{transform:G}),De=It(e,`FORBID_ATTR`,L({}),{transform:G}),N=M(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?L(e.USE_PROFILES):e.USE_PROFILES:!1,Oe=e.ALLOW_ARIA_ATTR!==!1,ke=e.ALLOW_DATA_ATTR!==!1,E=e.ALLOW_UNKNOWN_PROTOCOLS||!1,D=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,O=e.SAFE_FOR_TEMPLATES||!1,k=e.SAFE_FOR_XML!==!1,Ae=e.WHOLE_DOCUMENT||!1,Ie=e.RETURN_DOM||!1,Re=e.RETURN_DOM_FRAGMENT||!1,ze=e.RETURN_TRUSTED_TYPE||!1,Fe=e.FORCE_BODY||!1,Be=e.SANITIZE_DOM!==!1,$e=e.SANITIZE_NAMED_PROPS||!1,tt=e.KEEP_CONTENT!==!1,nt=e.IN_PLACE||!1,Ce=st(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:wt,U=typeof e.NAMESPACE==`string`?e.NAMESPACE:H,Wt=M(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?L(e.MATHML_TEXT_INTEGRATION_POINTS):I({},Ut),Kt=M(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?L(e.HTML_INTEGRATION_POINTS):I({},Gt);let t=M(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?L(e.CUSTOM_ELEMENT_HANDLING):Le(null);if(w=Le(null),M(t,`tagNameCheck`)&&Zt(t.tagNameCheck)&&(w.tagNameCheck=t.tagNameCheck),M(t,`attributeNameCheck`)&&Zt(t.attributeNameCheck)&&(w.attributeNameCheck=t.attributeNameCheck),M(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(w.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),j(w),O&&(ke=!1),Re&&(Ie=!0),N&&(S=I({},mt),C=Le(null),N.html===!0&&(I(S,ct),I(C,ht)),N.svg===!0&&(I(S,lt),I(C,gt),I(C,vt)),N.svgFilters===!0&&(I(S,ut),I(C,gt),I(C,vt)),N.mathMl===!0&&(I(S,ft),I(C,_t),I(C,vt))),T.tagCheck=null,T.attributeCheck=null,M(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?T.tagCheck=e.ADD_TAGS:Ke(e.ADD_TAGS)&&(S===we&&(S=L(S)),I(S,e.ADD_TAGS,G))),M(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?T.attributeCheck=e.ADD_ATTR:Ke(e.ADD_ATTR)&&(C===Te&&(C=L(C)),I(C,e.ADD_ATTR,G))),M(e,`ADD_URI_SAFE_ATTR`)&&Ke(e.ADD_URI_SAFE_ATTR)&&I(zt,e.ADD_URI_SAFE_ATTR,G),M(e,`FORBID_CONTENTS`)&&Ke(e.FORBID_CONTENTS)&&(F===it&&(F=L(F)),I(F,e.FORBID_CONTENTS,G)),M(e,`ADD_FORBID_CONTENTS`)&&Ke(e.ADD_FORBID_CONTENTS)&&(F===it&&(F=L(F)),I(F,e.ADD_FORBID_CONTENTS,G)),tt&&(S[`#text`]=!0),Ae&&I(S,[`html`,`head`,`body`]),S.table&&(I(S,[`tbody`]),delete Ee.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw rt(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw rt(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=y;y=e.TRUSTED_TYPES_POLICY;try{ne=oe(``)}catch(e){throw y=t,e}}else e.TRUSTED_TYPES_POLICY===null?(y=void 0,ne=``):(y===void 0&&(y=ce()),y&&typeof ne==`string`&&(ne=oe(``)));A&&A(e),K=e},$t=I({},[...lt,...ut,...dt]),en=I({},[...ft,...pt]),tn=function(e,t,n){return t.namespaceURI===H?e===`svg`:t.namespaceURI===Bt?e===`svg`&&(n===`annotation-xml`||Wt[n]):!!$t[e]},nn=function(e,t,n){return t.namespaceURI===H?e===`math`:t.namespaceURI===V?e===`math`&&Kt[n]:!!en[e]},rn=function(e,t,n){return t.namespaceURI===V&&!Kt[n]||t.namespaceURI===Bt&&!Wt[n]?!1:!en[e]&&(qt[e]||!$t[e])},an=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:U,tagName:`template`});let n=qe(e.tagName),r=qe(t.tagName);return W[e.namespaceURI]?e.namespaceURI===V?tn(n,t,r):e.namespaceURI===Bt?nn(n,t,r):e.namespaceURI===H?rn(n,t,r):!!(Jt===`application/xhtml+xml`&&W[e.namespaceURI]):!1},on=function(e){We(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw rt(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},sn=function(e){let t=h(e);if(t){let e=[];Ve(t,t=>{We(e,t)}),Ve(e,e=>{try{p(e)}catch{}})}let n=te(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{}}},cn=function(e,n){try{We(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{We(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(Ie||Re)try{on(n)}catch{}else try{n.setAttribute(e,``)}catch{}},ln=function(e){let t=te(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||C[G(i)]))try{e.removeAttribute(i)}catch{}}},un=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(_?_(e):e.nodeType)===z.element&&ln(e);let n=h(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(Fe)e=`<remove></remove>`+e;else{let t=Ye(e,/^[\r\n\t ]+/);r=t&&t[0]}Jt===`application/xhtml+xml`&&U===H&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=y?oe(e):e;if(U===H)try{t=new l().parseFromString(i,Jt)}catch{}if(!t||!t.documentElement){t=ue.createDocument(U,`template`,null);try{t.documentElement.innerHTML=Vt?ne:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),U===H?pe.call(t,Ae?`html`:`body`)[0]:Ae?t.documentElement:a},fn=function(e){return de.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},q=function(e){return e=Xe(e,he,` `),e=Xe(e,ge,` `),e=Xe(e,_e,` `),e},pn=function(e){e.normalize();let t=de.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=q(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&Ve(r,e=>{hn(e.content)&&pn(e.content)})},mn=function(e){let t=v?v(e):null;return typeof t!=`string`||G(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==te(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==_(e)||e.childNodes!==h(e)},hn=function(e){if(!_||typeof e!=`object`||!e)return!1;try{return _(e)===z.documentFragment}catch{return!1}},gn=function(e){if(!_||typeof e!=`object`||!e)return!1;try{return typeof _(e)==`number`}catch{return!1}};function J(e,n,r){e.length!==0&&Ve(e,e=>{e.call(t,n,r,K)})}let _n=function(e,t){return!!(k&&e.hasChildNodes()&&!gn(e.firstElementChild)&&P(kt,e.textContent)&&P(kt,e.innerHTML)||k&&e.namespaceURI===H&&t===`style`&&gn(e.firstElementChild)||e.nodeType===z.processingInstruction||k&&e.nodeType===z.comment&&P(At,e.data))},vn=function(e,t){if(!Ee[t]&&Sn(t)&&(w.tagNameCheck instanceof RegExp&&P(w.tagNameCheck,t)||w.tagNameCheck instanceof Function&&w.tagNameCheck(t)))return!1;if(tt&&!F[t]){let t=g(e),n=h(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=nt?n[i]:f(n[i],!0);t.insertBefore(r,m(e))}}}return on(e),!0},yn=function(e){if(J(x.beforeSanitizeElements,e,null),mn(e))return on(e),!0;let n=G(v?v(e):e.nodeName);if(J(x.uponSanitizeElement,e,{tagName:n,allowedTags:S}),_n(e,n))return on(e),!0;if(Ee[n]||!(T.tagCheck instanceof Function&&T.tagCheck(n))&&!S[n])return vn(e,n);if((_?_(e):e.nodeType)===z.element&&!an(e)||(n===`noscript`||n===`noembed`||n===`noframes`)&&P(jt,e.innerHTML))return on(e),!0;if(O&&e.nodeType===z.text){let n=q(e.textContent);e.textContent!==n&&(We(t.removed,{element:e.cloneNode()}),e.textContent=n)}return J(x.afterSanitizeElements,e,null),!1},bn=function(e,t,r){if(De[t]||Be&&(t===`id`||t===`name`)&&(r in n||r in Xt))return!1;let i=C[t]||T.attributeCheck instanceof Function&&T.attributeCheck(t,e);if(!(ke&&P(ve,t))&&!(Oe&&P(ye,t))){if(!i){if(!(Sn(e)&&(w.tagNameCheck instanceof RegExp&&P(w.tagNameCheck,e)||w.tagNameCheck instanceof Function&&w.tagNameCheck(e))&&(w.attributeNameCheck instanceof RegExp&&P(w.attributeNameCheck,t)||w.attributeNameCheck instanceof Function&&w.attributeNameCheck(t,e))||t===`is`&&w.allowCustomizedBuiltInElements&&(w.tagNameCheck instanceof RegExp&&P(w.tagNameCheck,r)||w.tagNameCheck instanceof Function&&w.tagNameCheck(r))))return!1}else if(!zt[t]&&!P(Ce,Xe(r,xe,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Ze(r,`data:`)===0&&at[e])&&!(E&&!P(be,Xe(r,xe,``)))&&r)return!1}return!0},xn=I({},[`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[qe(e)]&&P(Se,e)},Cn=function(e,t,n,r){if(y&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return oe(r);case`TrustedScriptURL`:return se(r)}return r},wn=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),mn(e)?on(e):Ue(t.removed)}catch{cn(n,e)}},Tn=function(e){J(x.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||mn(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:C,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:Qe(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,J(x.uponSanitizeAttribute,e,n),d=n.attrValue,$e&&(l===`id`||l===`name`)&&Ze(d,et)!==0&&(cn(o,e),d=et+d),k&&P(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){cn(o,e);continue}if(l===`attributename`&&Ye(d,`href`)){cn(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){cn(o,e);continue}if(!D&&P(Mt,d)){cn(o,e);continue}if(O&&(d=q(d)),!bn(i,l,d)){cn(o,e);continue}d=Cn(i,l,s,d),d!==u&&wn(e,o,s,d)}}J(x.afterSanitizeAttributes,e,null)},En=function(e){let t=null,n=fn(e);for(J(x.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(J(x.uponSanitizeShadowNode,t,null),yn(t),Tn(t),hn(t.content)&&En(t.content),(_?_(t):t.nodeType)===z.element){let e=ee(t);hn(e)&&(Dn(e),En(e))}J(x.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=(_?_(n):n.nodeType)===z.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=v?v(n):null;if(typeof e==`string`&&G(e)===`template`){let e=n.content;hn(e)&&t.push({node:e,shadow:null})}}if(r){let e=ee(n);hn(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(Vt=!e,Vt&&(e=`<!-->`),typeof e!=`string`&&!gn(e)&&(e=ot(e),typeof e!=`string`))throw rt(`dirty is not a string, aborting`);if(!t.isSupported)return e;je?(S=Ne,C=Pe):Qt(n),(x.uponSanitizeElement.length>0||x.uponSanitizeAttribute.length>0)&&(S=L(S)),x.uponSanitizeAttribute.length>0&&(C=L(C)),t.removed=[];let c=nt&&typeof e!=`string`&&gn(e);if(c){let t=v?v(e):e.nodeName;if(typeof t==`string`){let e=G(t);if(!S[e]||Ee[e])throw rt(`root node is forbidden and cannot be sanitized in-place`)}if(mn(e))throw rt(`root node is clobbered and cannot be sanitized in-place`);try{Dn(e)}catch(t){throw sn(e),t}}else if(gn(e))i=dn(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===z.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Dn(a);else{if(!Ie&&!O&&!Ae&&e.indexOf(`<`)===-1)return y&&ze?oe(e):e;if(i=dn(e),!i)return Ie?null:ze?ne:``}i&&Fe&&on(i.firstChild);let l=fn(c?e:i);try{for(;o=l.nextNode();)yn(o),Tn(o),hn(o.content)&&En(o.content)}catch(t){throw c&&sn(e),t}if(c)return Ve(t.removed,e=>{e.element&&un(e.element)}),O&&pn(e),e;if(Ie){if(O&&pn(i),Re)for(s=fe.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(C.shadowroot||C.shadowrootmode)&&(s=me.call(r,s,!0)),s}let u=Ae?i.outerHTML:i.innerHTML;return Ae&&S[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&P(Dt,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
3
|
-
`+u),O&&(u=q(u)),y&&ze?oe(u):u},t.setConfig=function(){Qt(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),je=!0,Ne=S,Pe=C},t.clearConfig=function(){K=null,je=!1,Ne=null,Pe=null,y=b,ne=``},t.isValidAttribute=function(e,t,n){return K||Qt({}),bn(G(e),G(t),n)},t.addHook=function(e,t){typeof t==`function`&&M(x,e)&&We(x[e],t)},t.removeHook=function(e,t){if(M(x,e)){if(t!==void 0){let n=He(x[e],t);return n===-1?void 0:Ge(x[e],n,1)[0]}return Ue(x[e])}},t.removeHooks=function(e){M(x,e)&&(x[e]=[])},t.removeAllHooks=function(){x=Ft()},t}var Rt=Lt();function zt(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var B=zt();function Bt(e){B=e}var V={exec:()=>null};function H(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 U(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(W.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Vt=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),W={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:H(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:H(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:H(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:H(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:H(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:H(e=>RegExp(`^ {0,${e}}>`))},Ht=/^(?:[ \t]*(?:\n|$))+/,Ut=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Wt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Gt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Kt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,qt=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Jt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Yt=U(Jt).replace(/bull/g,qt).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(),G=U(Jt).replace(/bull/g,qt).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(),K=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Xt=/^[^\n]+/,Zt=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Qt=U(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Zt).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),$t=U(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,qt).getRegex(),en=`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`,tn=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,nn=U(`^ {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`,tn).replace(`tag`,en).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),rn=U(K).replace(`hr`,Gt).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`,en).getRegex(),an={blockquote:U(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,rn).getRegex(),code:Ut,def:Qt,fences:Wt,heading:Kt,hr:Gt,html:nn,lheading:Yt,list:$t,newline:Ht,paragraph:rn,table:V,text:Xt},on=U(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Gt).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`,en).getRegex(),sn={...an,lheading:G,table:on,paragraph:U(K).replace(`hr`,Gt).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,on).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`,en).getRegex()},cn={...an,html:U(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,tn).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:V,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:U(K).replace(`hr`,Gt).replace(`heading`,` *#{1,6} *[^
|
|
4
|
-
]`).replace(`lheading`,Yt).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},ln=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,un=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,dn=/^( {2,}|\\)\n(?!\s*$)/,fn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,q=/[\p{P}\p{S}]/u,pn=/[\s\p{P}\p{S}]/u,mn=/[^\s\p{P}\p{S}]/u,hn=U(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,pn).getRegex(),gn=/(?!~)[\p{P}\p{S}]/u,J=/(?!~)[\s\p{P}\p{S}]/u,_n=/(?:[^\s\p{P}\p{S}]|~)/u,vn=U(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Vt?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),yn=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,bn=U(yn,`u`).replace(/punct/g,q).getRegex(),xn=U(yn,`u`).replace(/punct/g,gn).getRegex(),Sn=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Cn=U(Sn,`gu`).replace(/notPunctSpace/g,mn).replace(/punctSpace/g,pn).replace(/punct/g,q).getRegex(),wn=U(Sn,`gu`).replace(/notPunctSpace/g,_n).replace(/punctSpace/g,J).replace(/punct/g,gn).getRegex(),Tn=U(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,mn).replace(/punctSpace/g,pn).replace(/punct/g,q).getRegex(),En=U(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,q).getRegex(),Dn=U(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,mn).replace(/punctSpace/g,pn).replace(/punct/g,q).getRegex(),On=U(/\\(punct)/,`gu`).replace(/punct/g,q).getRegex(),kn=U(/^<(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(),An=U(tn).replace(`(?:-->|$)`,`-->`).getRegex(),jn=U(`^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`,An).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Mn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Nn=U(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Mn).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Pn=U(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Mn).replace(`ref`,Zt).getRegex(),Fn=U(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Zt).getRegex(),In=U(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Pn).replace(`nolink`,Fn).getRegex(),Ln=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Rn={_backpedal:V,anyPunctuation:On,autolink:kn,blockSkip:vn,br:dn,code:un,del:V,delLDelim:V,delRDelim:V,emStrongLDelim:bn,emStrongRDelimAst:Cn,emStrongRDelimUnd:Tn,escape:ln,link:Nn,nolink:Fn,punctuation:hn,reflink:Pn,reflinkSearch:In,tag:jn,text:fn,url:V},zn={...Rn,link:U(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Mn).getRegex(),reflink:U(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Mn).getRegex()},Bn={...Rn,emStrongRDelimAst:wn,emStrongLDelim:xn,delLDelim:En,delRDelim:Dn,url:U(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Ln).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:U(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Ln).getRegex()},Vn={...Bn,br:U(dn).replace(`{2,}`,`*`).getRegex(),text:U(Bn.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Hn={normal:an,gfm:sn,pedantic:cn},Un={normal:Rn,gfm:Bn,breaks:Vn,pedantic:zn},Wn={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Gn=e=>Wn[e];function Y(e,t){if(t){if(W.escapeTest.test(e))return e.replace(W.escapeReplace,Gn)}else if(W.escapeTestNoEncode.test(e))return e.replace(W.escapeReplaceNoEncode,Gn);return e}function Kn(e){try{e=encodeURI(e).replace(W.percentDecode,`%`)}catch{return null}return e}function qn(e,t){let n=e.replace(W.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(W.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(W.slashPipe,`|`);return n}function Jn(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 Yn(e){let t=e.split(`
|
|
5
|
-
`),n=t.length-1;for(;n>=0&&W.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
6
|
-
`)}function Xn(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Zn(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Qn(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function $n(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
7
|
-
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
8
|
-
`)}var er=class{options;rules;lexer;constructor(e){this.options=e||B}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:Yn(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=$n(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=Jn(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Jn(t[0],`
|
|
9
|
-
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:Jn(t[0],`
|
|
10
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Jn(t[0],`
|
|
11
|
-
`).split(`
|
|
12
|
-
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
13
|
-
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
14
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
15
|
-
${s}`:s,r=r?`${r}
|
|
16
|
-
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
17
|
-
`+e.join(`
|
|
18
|
-
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
|
|
19
|
-
`+e.join(`
|
|
20
|
-
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
21
|
-
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=Zn(t[2].split(`
|
|
22
|
-
`,1)[0],t[1].length),l=e.split(`
|
|
23
|
-
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
24
|
-
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
|
|
25
|
-
`,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
26
|
-
`+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
27
|
-
`+l}u=!l.trim(),r+=p+`
|
|
28
|
-
`,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]);let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1;if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=Yn(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:Jn(t[0],`
|
|
29
|
-
`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=qn(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
30
|
-
`):[],a={type:`table`,raw:Jn(t[0],`
|
|
31
|
-
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(qn(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:Jn(t[0],`
|
|
32
|
-
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
33
|
-
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Jn(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Xn(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),Qn(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Qn(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},X=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||B,this.options.tokenizer=this.options.tokenizer||new er,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:W,block:Hn.normal,inline:Un.normal};this.options.pedantic?(t.block=Hn.pedantic,t.inline=Un.pedantic):this.options.gfm&&(t.block=Hn.gfm,this.options.breaks?t.inline=Un.breaks:t.inline=Un.gfm),this.tokenizer.rules=t}static get rules(){return{block:Hn,inline:Un}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(W.carriageReturn,`
|
|
34
|
-
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(W.tabCharGlobal,` `).replace(W.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
|
|
35
|
-
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
36
|
-
`)?``:`
|
|
37
|
-
`)+i.raw,n.text+=`
|
|
38
|
-
`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
39
|
-
`)?``:`
|
|
40
|
-
`)+i.raw,n.text+=`
|
|
41
|
-
`+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
|
|
42
|
-
`)?``:`
|
|
43
|
-
`)+i.raw,r.text+=`
|
|
44
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
45
|
-
`)?``:`
|
|
46
|
-
`)+i.raw,n.text+=`
|
|
47
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``,s=1/0;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},tr=class{options;parser;constructor(e){this.options=e||B}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(W.notSpaceStart)?.[0],i=e.replace(W.endingNewline,``)+`
|
|
48
|
-
`;return r?`<pre><code class="language-`+Y(r)+`">`+(n?i:Y(i,!0))+`</code></pre>
|
|
49
|
-
`:`<pre><code>`+(n?i:Y(i,!0))+`</code></pre>
|
|
50
|
-
`}blockquote({tokens:e}){return`<blockquote>
|
|
51
|
-
${this.parser.parse(e)}</blockquote>
|
|
52
|
-
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
53
|
-
`}hr(e){return`<hr>
|
|
54
|
-
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
55
|
-
`+r+`</`+i+`>
|
|
56
|
-
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
57
|
-
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
58
|
-
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
59
|
-
<thead>
|
|
60
|
-
`+t+`</thead>
|
|
61
|
-
`+r+`</table>
|
|
62
|
-
`}tablerow({text:e}){return`<tr>
|
|
63
|
-
${e}</tr>
|
|
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
|
-
`}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=Kn(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=Kn(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)}},nr=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||B,this.options.renderer=this.options.renderer||new tr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new nr}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}},rr=class{options;block;constructor(e){this.options=e||B}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}},ir=new class{defaults=zt();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Z;Renderer=tr;TextRenderer=nr;Lexer=X;Tokenizer=er;Hooks=rr;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 tr(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 er(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 rr;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];rr.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&rr.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
|
-
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 ir.parse(e,t)}Q.options=Q.setOptions=function(e){return ir.setOptions(e),Q.defaults=ir.defaults,Bt(Q.defaults),Q},Q.getDefaults=zt,Q.defaults=B,Q.use=function(...e){return ir.use(...e),Q.defaults=ir.defaults,Bt(Q.defaults),Q},Q.walkTokens=function(e,t){return ir.walkTokens(e,t)},Q.parseInline=ir.parseInline,Q.Parser=Z,Q.parser=Z.parse,Q.Renderer=tr,Q.TextRenderer=nr,Q.Lexer=X,Q.lexer=X.lex,Q.Tokenizer=er,Q.Hooks=rr,Q.parse=Q,Q.options,Q.setOptions,Q.use,Q.walkTokens,Q.parseInline,Z.parse,X.lex;var ar={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 or(e){return Rt.sanitize(Q.parse(e,{async:!1,gfm:!0}),ar)}var $=r();function sr({content:e}){return(0,$.jsx)(`div`,{className:`artifact-markdown px-5 py-4`,dangerouslySetInnerHTML:{__html:(0,S.useMemo)(()=>or(e),[e])}})}function cr({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 lr({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:Oe(e,t),download:!0,className:`text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Download`})]})})}function ur({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:Oe(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 dr({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 fr({loopId:e,file:t}){let[n,r]=(0,S.useState)(!1);return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(ur,{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:Oe(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:ke(e,t.path),alt:t.path,onError:()=>r(!0),className:`max-w-full rounded-control border border-hairline bg-white object-contain`})})]})}function pr({loopId:e,file:t,kind:n}){let[r,i]=(0,S.useState)({loading:!0}),[a,o]=(0,S.useState)(`preview`);if((0,S.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)(lr,{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)(ur,{loopId:e,path:t.path,mode:a,onMode:o,showToggle:c}),n===`html`&&!l?(0,$.jsx)(dr,{html:r.text||``}):n===`markdown`&&!l?(0,$.jsx)(sr,{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 mr({loopId:e,file:t}){let n=T(t.path);return t.oversize?(0,$.jsx)(lr,{loopId:e,path:t.path,oversize:!0}):n===`image`?(0,$.jsx)(fr,{loopId:e,file:t},`${t.path}:${t.updatedAt??``}`):t.binary?(0,$.jsx)(lr,{loopId:e,path:t.path,oversize:!1}):(0,$.jsx)(pr,{loopId:e,file:t,kind:n},t.path)}var hr=e=>e.split(`/`).pop()||e;function gr({loopId:e,configuredPaths:t,running:r}){let[i,a]=(0,S.useState)(null),[s,c]=(0,S.useState)(null),l=(0,S.useRef)(0),u=(0,S.useCallback)(async()=>{let t=++l.current;try{let n=await ce({data:{loopId:e}});t===l.current&&a(n)}catch{t===l.current&&a(e=>e??[])}},[e]);(0,S.useEffect)(()=>{a(null),c(null),u()},[e,u]),(0,S.useEffect)(()=>{let e=setInterval(()=>void u(),r?4e3:12e3);return()=>clearInterval(e)},[r,u]);let d=i??[],f=s&&d.some(e=>e.path===s)?s:d[0]?.path??null,p=d.find(e=>e.path===f)??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?` (${d.length})`:``]}),(0,$.jsxs)(`span`,{className:`text-caption font-medium text-disabled`,children:[`Configured exact paths: `,t.length]})]}),d.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…`:t.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:d.map(e=>{let t=e.path===f;return(0,$.jsx)(`li`,{children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>c(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:hr(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:p&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(cr,{path:p.path,meta:[p.size==null?``:o(p.size),`collected ${n(p.updatedAt)}`].filter(Boolean).join(` · `)}),(0,$.jsx)(mr,{loopId:e,file:p})]})})]})]})}var _r=[`claude-code`,`codex`,`pi`],vr=new Set([`all loops`,`active`,`paused`,`blocked`]);function yr(e){return e.normalize(`NFKC`).trim().replace(/\s+/gu,` `).toLocaleLowerCase(`en-US`)}function br(e){if(e===void 0)return{ok:!0,value:[]};if(!Array.isArray(e))return{ok:!1,detail:`tags must be an array of strings`};if(e.length>4)return{ok:!1,detail:`tags must contain at most 4 values`};let t=[],n=new Set;for(let r of e){if(typeof r!=`string`)return{ok:!1,detail:`tags must contain only strings`};if(/\p{Cc}|\p{Cf}|\p{Default_Ignorable_Code_Point}/u.test(r))return{ok:!1,detail:`tags must not contain control or invisible characters`};let e=yr(r);if(!e)return{ok:!1,detail:`tags must not contain empty values`};if([...e].length>64)return{ok:!1,detail:`each tag must contain at most 64 characters`};if(vr.has(e))return{ok:!1,detail:`reserved tag: ${e}`};if(n.has(e))return{ok:!1,detail:`duplicate tag: ${e}`};n.add(e),t.push(e)}return{ok:!0,value:[...t].sort()}}var xr={"claude-code":`Claude Code`,codex:`Codex`,pi:`Pi`},Sr=`mt-1 text-caption leading-snug text-disabled`;function Cr(e){let t=e?.schedule;return{name:e?.name??``,tags:e?.tags??[],tagDraft:``,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:re,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,S.useId)();return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{htmlFor:o,className:p,children:e}),(0,$.jsx)(`input`,{id:o,className:`${m} ${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,S.useId)();return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{htmlFor:o,className:p,children:e}),(0,$.jsx)(`textarea`,{id:o,rows:r,className:`${m} 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,S.forwardRef)(function({initial:e},t){let[n,r]=(0,S.useState)(()=>Cr(e)),[i,a]=(0,S.useState)(null),[o,s]=(0,S.useState)(null),c=(0,S.useId)(),l=(0,S.useId)(),d=(0,S.useId)(),f=(0,S.useRef)(null),m=(0,S.useRef)(null),h=(e,t)=>r(n=>({...n,[e]:t})),g=()=>{let e=n.tagDraft.trim()?[n.tagDraft]:[];if(!e.length){h(`tagDraft`,``);return}let t=br([...n.tags,...e]);if(!t.ok){s(t.detail);return}r(e=>({...e,tags:t.value,tagDraft:``})),s(null),t.value.length===4&&requestAnimationFrame(()=>{document.activeElement===document.body&&f.current?.focus()})};return(0,S.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=br([...n.tags,...n.tagDraft.trim()?[n.tagDraft]:[]]);if(!t.ok)return s(t.detail),a(null),null;let r=Number(n.delayMinutes);if(n.mode===`continuous`&&(!Number.isInteger(r)||r<1))return a(`Continuous delay must be an integer of at least 1 minute.`),null;let i=n.mode===`cron`?{mode:`cron`,cron:n.cron.trim(),timezone:n.timezone.trim(),overlap:n.overlap}:{mode:`continuous`,delayMinutes:r};return a(null),s(null),{name:n.name.trim(),tags:t.value,schedule:i,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=>h(`name`,e)}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{id:c,className:p,children:`Tags`}),(0,$.jsxs)(`div`,{ref:f,role:`group`,tabIndex:-1,"aria-labelledby":c,"aria-describedby":`${l}${o?` ${d}`:``}`,"aria-invalid":o?`true`:void 0,className:`flex min-h-10 flex-wrap items-center gap-1.5 rounded-control border border-wire bg-surface px-2.5 py-1.5 outline-none transition-shadow focus-within:border-transparent focus-within:shadow-focus`,children:[n.tags.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex h-6 max-w-full items-center gap-1 rounded-full bg-raised px-2.5 text-caption font-medium text-secondary`,children:[(0,$.jsx)(`span`,{className:`max-w-52 truncate`,title:e,children:e}),(0,$.jsx)(`button`,{type:`button`,"aria-label":`Remove tag ${e}`,onClick:()=>{h(`tags`,n.tags.filter(t=>t!==e)),s(null),requestAnimationFrame(()=>(m.current??f.current)?.focus())},className:`-mr-1 inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full text-disabled transition-colors hover:bg-surface hover:text-primary ${ee}`,children:(0,$.jsx)(`span`,{"aria-hidden":!0,children:`×`})})]},e)),n.tags.length<4&&(0,$.jsx)(`input`,{ref:m,"aria-label":`Add tag`,value:n.tagDraft,placeholder:n.tags.length?`Add another…`:`Add a tag…`,onChange:e=>{h(`tagDraft`,e.target.value),s(null)},onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Enter`?(e.preventDefault(),g()):e.key===`Backspace`&&!n.tagDraft&&n.tags.length&&h(`tags`,n.tags.slice(0,-1)))},onBlur:g,className:`h-6 min-w-28 flex-1 bg-transparent px-1 text-sm text-primary outline-none placeholder:text-disabled`})]}),(0,$.jsxs)(`div`,{id:l,className:Sr,children:[`Up to `,4,`. Press Enter to add.`]}),o&&(0,$.jsx)(`div`,{id:d,role:`alert`,className:`mt-1 text-caption text-accent`,children:o})]}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{className:p,children:`Schedule`}),(0,$.jsxs)(`select`,{"aria-label":`Schedule`,className:u,value:n.mode,onChange:e=>h(`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=>h(`cron`,e),mono:!0}),(0,$.jsx)(Tr,{label:`Timezone`,value:n.timezone,onChange:e=>h(`timezone`,e),mono:!0,hint:`IANA timezone, for example America/Los_Angeles.`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{className:p,children:`Cron overlap`}),(0,$.jsxs)(`select`,{"aria-label":`Cron overlap`,className:u,value:n.overlap,onChange:e=>h(`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=>h(`delayMinutes`,e),mono:!0}),(0,$.jsx)(wr,{title:`Execution`}),(0,$.jsx)(Tr,{label:`Working directory`,value:n.workdir,onChange:e=>h(`workdir`,e),mono:!0,placeholder:`/Users/you/project`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`label`,{className:p,children:`Coding agent`}),(0,$.jsx)(`select`,{"aria-label":`Coding agent`,className:u,value:n.agent,onChange:e=>h(`agent`,e.target.value),children:_r.map(e=>(0,$.jsx)(`option`,{value:e,children:xr[e]??e},e))})]}),(0,$.jsx)(Tr,{label:`Model`,value:n.model,onChange:e=>h(`model`,e),placeholder:`default`,hint:`Optional. Empty uses the agent default.`}),(0,$.jsx)(Tr,{label:`Reasoning effort`,value:n.reasoningEffort,onChange:e=>h(`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=>h(`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=>h(`keep`,e),rows:2}),(0,$.jsx)(Er,{label:`no-change`,value:n.noChange,onChange:e=>h(`noChange`,e),rows:2}),(0,$.jsx)(Er,{label:`block`,value:n.block,onChange:e=>h(`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=>h(`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`,pi:`Pi`};function kr({id:t}){let n=ae(),[r,i]=(0,S.useState)(null),[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(null),[u,f]=(0,S.useState)(!1),[p,m]=(0,S.useState)(!1),[ee,b]=(0,S.useState)(null),[ie,ce]=(0,S.useState)(!1),[he,xe]=h(),[Ce,we]=(0,S.useState)([]),C=(0,S.useRef)(null),Te=(0,S.useRef)(!1),w=(0,S.useCallback)(async(e=!1)=>{try{let e=await ge({data:t});i(e),Te.current=e.summary.deleteRequestedAt!=null,o(null)}catch(t){Te.current?n({to:`/`}):e||o(String(t))}},[t]);(0,S.useEffect)(()=>{i(null),f(!1),ce(!1),we([]),w()},[t,w]);let Ee=!!r?.summary.running;(0,S.useEffect)(()=>{if(u)return;let e=setInterval(()=>void w(!0),Ee||Te.current?3e3:8e3);return()=>clearInterval(e)},[u,Ee,w]);async function De(){c(null),b(`run`);try{let e=await se({data:t});if(e.error)return c(`Run failed: ${e.error}`);xe({label:e.coalesced?`Already queued`:`Queued`,hold:4e3}),await w()}finally{b(null)}}async function T(e){c(null),b(`lifecycle`);try{let r=e===`pause`?await le({data:t}):e===`start`?await _e({data:t}):e===`stop`?await ve({data:t}):await pe({data:t});if(r.error)return c(`${e[0].toUpperCase()+e.slice(1)} failed: ${r.error}`);if(ce(!1),r.deleted)return n({to:`/`});e===`delete`&&(Te.current=!0),await w(),xe({label:e===`start`?`Started`:e===`pause`?`Paused`:e===`stop`?`Stop requested`:`Deleting`})}finally{b(null)}}async function Oe(){let e=C.current?.read();if(e){c(null),b(`save`);try{let n=await ue({data:{id:t,patch:e}});if(n.error)return c(`Save failed: ${n.error}`);f(!1),await w(),xe({label:`Saved`})}finally{b(null)}}}let ke=(0,$.jsxs)(oe,{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)(Nr,{back:ke,children:(0,$.jsx)(v,{title:`Couldn't load this loop.`,detail:a,onRetry:()=>void w()})});if(!r)return(0,$.jsx)(Nr,{back:ke,children:(0,$.jsx)(_,{})});let{loop:E,summary:D,runs:O}=r,k=de(D)===`deleting`,Ae=D.enabled&&!k,je=!D.enabled&&!k,Me=ee!=null,Ne=x(r.machine.daemonProtocol),Pe=!k&&!!D.running&&Ne.supported,Fe=r.machine.online,Ie=r.machine.presence===`asleep`;if(u)return(0,$.jsxs)(Nr,{back:ke,children:[(0,$.jsx)(Mr,{name:D.name,onBack:()=>f(!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:C,initial:E}),(0,$.jsxs)(`div`,{className:`mt-7 border-t border-hairline pt-4`,children:[s&&(0,$.jsx)(l,{message:s,onDismiss:()=>c(null),className:`mb-3`}),(0,$.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,$.jsx)(`button`,{className:d,disabled:ee===`save`,onClick:()=>void Oe(),children:ee===`save`?`Saving…`:`Save`}),(0,$.jsx)(`button`,{className:g,disabled:ee===`save`,onClick:()=>f(!1),children:`Cancel`})]})]})]})]});let A=E.schedule.mode===`cron`?`${E.schedule.cron} · ${E.schedule.timezone} · overlap ${E.schedule.overlap}`:`continuous · ${E.schedule.delayMinutes}m after terminal`,j=E.model||`default`,Le=E.reasoningEffort||`default`,Re=Ce.length?be(D.runs,Ce):D.runs,ze=async()=>{let e=Re[0];if(!e)return 0;let n=await me({data:{loopId:t,beforeTs:e.ts,limit:16}});return n.length&&we(e=>be(e,n)),n.length};return(0,$.jsxs)(Nr,{back:ke,children:[(0,$.jsxs)(`header`,{className:`rounded-card border border-hairline bg-surface px-[26px] pb-5 pt-[22px] shadow-card`,children:[(0,$.jsx)(Se,{loop:D,runs:Re,onLoadMore:ze,onPickRun:e=>n({to:`/loops/$loopId/runs/$runId`,params:{loopId:t,runId:e.id}})}),(0,$.jsxs)(`div`,{className:`mt-5 border-t border-hairline pt-4`,children:[r.machine.needsUpdate&&(0,$.jsx)(jr,{tone:`warn`,text:`Daemon update required · server requires v${r.machine.requiredDaemonVersion}; machine reports ${r.machine.daemonVersion?`v${r.machine.daemonVersion}`:`an unknown version`}.`,action:`Update daemon`,onAction:()=>m(!0)}),!Fe&&(0,$.jsx)(jr,{text:`Machine ${Ie?`seems asleep or offline`:`is offline`}; queued work starts when it reconnects.${r.machine.lastSeen?` Last seen ${e(r.machine.lastSeen)}.`:``}`,action:`Reconnect`,onAction:()=>m(!0)}),s&&(0,$.jsx)(l,{message:s,onDismiss:()=>c(null),className:`mb-2.5`}),he&&(0,$.jsx)(`div`,{className:`mb-2.5`,children:(0,$.jsx)(te,{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:d,disabled:Me||k,onClick:()=>void De(),children:ee===`run`?`Queuing…`:`Run once`}),(0,$.jsx)(`button`,{className:g,disabled:Me||k,onClick:()=>f(!0),children:`Settings`}),(0,$.jsx)(`button`,{className:g,disabled:Me||!je,onClick:()=>void T(`start`),children:`Start`}),(0,$.jsx)(`button`,{className:g,disabled:Me||!Ae,onClick:()=>void T(`pause`),children:`Pause`}),(0,$.jsx)(`button`,{className:ne,disabled:Me||!Pe,title:D.running&&!Ne.supported?fe:D.running?void 0:`No run is currently running`,onClick:()=>void T(`stop`),children:`Stop`}),(0,$.jsx)(`button`,{className:ne,disabled:Me||k,onClick:()=>ce(!0),children:k?`Deleting…`:`Delete`})]}),ie&&!k&&(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(y,{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:Me,onConfirm:()=>void T(`delete`),onCancel:()=>ce(!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)(gr,{loopId:t,configuredPaths:E.artifacts,running:Ee}),(0,$.jsx)(Pr,{loopId:t,summary:D,runs:O,older:Ce,onPickRun:e=>n({to:`/loops/$loopId/runs/$runId`,params:{loopId:t,runId:e.id}}),onMore:ze})]}),(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 ${re}`,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:A})}),(0,$.jsx)(Ar,{label:`Tags`,children:E.tags.length?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:E.tags.map(e=>(0,$.jsx)(`span`,{className:`inline-flex h-[22px] max-w-52 items-center truncate rounded-full bg-raised px-2.5 text-caption font-medium text-secondary`,title:e,children:e},e))}):(0,$.jsx)(`span`,{className:`text-disabled`,children:`None`})}),(0,$.jsx)(Ar,{label:`Working directory`,children:(0,$.jsx)(`code`,{className:`break-all font-mono`,children:E.workdir})}),(0,$.jsx)(Ar,{label:`Agent`,children:Or[E.agent]}),(0,$.jsxs)(Ar,{label:`Model / effort`,children:[j,` / `,Le]}),(0,$.jsx)(Ar,{label:`Prompt`,children:(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-sans`,children:E.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:`}),` `,E.statusDefinitions.keep]}),(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`b`,{children:`no-change:`}),` `,E.statusDefinitions.noChange]}),(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`b`,{children:`block:`}),` `,E.statusDefinitions.block]})]})}),(0,$.jsx)(Ar,{label:`Artifact paths`,children:E.artifacts.length?(0,$.jsx)(`ul`,{className:`space-y-1`,children:E.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)(ye,{open:p,onClose:()=>m(!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({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 Mr({name:e,onBack:t}){return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:t,className:f,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 tags, schedule, execution settings, prompt, status definitions, and exact artifact paths.`})]})}function Nr({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 Pr({loopId:e,summary:n,runs:r,older:i,onMore:o,onPickRun:l}){let u=(0,S.useMemo)(()=>i.length?be(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:re,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)(Ce,{loop:n,runs:u,total:n.runCount,onLoadMore:o,onPickRun:l}),(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)(oe,{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:s(n)},title:t(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:a(n.ts)}),(0,$.jsx)(`span`,{className:`font-mono text-caption text-disabled`,children:c(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:b}),`Running`]}):n.error||n.message||t(n)})]})]})},n.id))})]})]})}function Fr(){let{loopId:e}=xe.useParams();return(0,$.jsx)(kr,{id:e})}export{Fr as component};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{D as e,E as t,I as n,L as r,O as i,T as a,c as o,l as s,o as c,r as l,s as u,u as d,v as f,y as p,z as m}from"./actionUi-BZrLpgHT.js";import{T as h,b as g,d as _,p as v,u as y}from"./preload-helper-hRTYB_ju.js";import{t as b}from"./index-Di_wpAtL.js";var x=m(r(),1);function S(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 C(e){if(!e)return[];let t=e.endsWith(`
|
|
2
|
-
`)?e.slice(0,-1):e,n=!1;return t.split(`
|
|
3
|
-
`).map(e=>{let t=S(e,n);return t.kind===`hunk`&&(n=!0),t})}function w(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 T=n(),E={added:`Added`,modified:`Changed`,removed:`Removed`},D={added:`text-success`,modified:`text-secondary`,removed:`text-accent`};function O(e){return e==null||e===0?``:`${e>0?`+`:`−`}${i(e)}`}var k={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`},A={add:`text-success`,del:`text-accent`,hunk:`text-disabled`,meta:`text-disabled`,context:`text-disabled`};function j({lines:e}){return(0,T.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,T.jsx)(`div`,{className:`min-w-max`,children:e.map((e,t)=>(0,T.jsxs)(`div`,{className:`flex ${k[e.kind]}`,children:[(0,T.jsx)(`span`,{"aria-hidden":!0,className:`w-6 shrink-0 select-none pl-2.5 text-center ${A[e.kind]}`,children:e.gutter}),(0,T.jsx)(`span`,{className:`whitespace-pre pr-4`,children:e.text||`\xA0`})]},t))})})}function M({f:e,lines:t}){let n=O(e.sizeDelta),r=t?w(t):null;return(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2.5 gap-y-1 text-meta`,children:[(0,T.jsx)(`span`,{className:`shrink-0 text-caption font-medium ${D[e.status]}`,children:E[e.status]}),(0,T.jsx)(`span`,{className:`min-w-0 break-all font-mono text-primary`,children:e.path}),r&&(r.added>0||r.removed>0)&&(0,T.jsxs)(`span`,{className:`shrink-0 font-mono text-caption`,children:[r.added>0&&(0,T.jsxs)(`span`,{className:`text-success`,children:[`+`,r.added]}),r.added>0&&r.removed>0&&` `,r.removed>0&&(0,T.jsxs)(`span`,{className:`text-accent`,children:[`−`,r.removed]})]}),n&&(0,T.jsx)(`span`,{className:`shrink-0 font-mono text-caption text-disabled`,children:n}),e.binary&&(0,T.jsx)(`span`,{className:`shrink-0 text-caption text-secondary`,children:`Binary`}),e.tooLarge&&(0,T.jsx)(`span`,{className:`shrink-0 text-caption text-secondary`,children:`Too large to diff`})]})}var N=40;function P({files:e}){return(0,T.jsx)(`div`,{className:`space-y-1.5`,children:e.map(e=>{if(!e.diff)return(0,T.jsx)(`div`,{className:`rounded-control border border-hairline bg-surface px-3.5 py-2`,children:(0,T.jsx)(M,{f:e,lines:null})},e.path);let t=C(e.diff);return(0,T.jsxs)(`details`,{open:t.length<=N,className:`group min-w-0 overflow-hidden rounded-control border border-hairline bg-surface`,children:[(0,T.jsxs)(`summary`,{className:`flex cursor-pointer select-none items-center gap-2 px-3.5 py-2 marker:content-['']`,children:[(0,T.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-micro text-disabled transition-transform group-open:rotate-90`,children:`▸`}),(0,T.jsx)(M,{f:e,lines:t})]}),(0,T.jsx)(j,{lines:t})]},e.path)})})}function F({label:e,count:t,children:n}){return(0,T.jsxs)(`section`,{className:`min-w-0 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,children:[(0,T.jsxs)(`div`,{className:`mb-3.5 border-b border-hairline pb-1.5 ${p}`,children:[e,t!=null&&(0,T.jsxs)(`span`,{className:`text-disabled`,children:[` (`,t,`)`]})]}),n]})}function I({k:e,children:t}){return(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`div`,{className:`mb-0.5 text-label font-medium text-secondary`,children:e}),(0,T.jsx)(`div`,{className:`min-w-0 text-body text-primary`,children:t})]})}function L(e){return!e||e.inputTokens===void 0&&e.outputTokens===void 0?null:(e.inputTokens??0)+(e.outputTokens??0)}function R({run:e}){let[t,n]=(0,x.useState)(null);return(0,x.useEffect)(()=>{if(e.phase===`pending`||e.phase===`running`)return;let t=!0;return _({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,T.jsx)(F,{label:`Changes`,children:(0,T.jsx)(`div`,{className:`text-body text-disabled`,children:`File changes appear once the run finishes.`})}):t?t.hasSnapshot?(0,T.jsx)(F,{label:`Changes`,count:t.files.length,children:t.files.length===0?(0,T.jsx)(`div`,{className:`text-body text-disabled`,children:`No files changed since the previous run.`}):(0,T.jsx)(P,{files:t.files})}):(0,T.jsx)(F,{label:`Changes`,children:(0,T.jsx)(`div`,{className:`text-body text-disabled`,children:`No file snapshot was recorded for this run.`})}):(0,T.jsx)(F,{label:`Changes`,children:(0,T.jsx)(c,{})})}function z({run:e}){let t=a(Math.max(0,Date.now()-Date.parse(e.ts)));return(0,T.jsx)(F,{label:`Activity`,children:(0,T.jsxs)(`div`,{className:`flex items-center gap-2.5 text-body text-secondary`,children:[(0,T.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full`,style:f}),(0,T.jsxs)(`span`,{children:[`Run in progress`,t?` for ${t}`:``,`.`]})]})})}function B({id:e}){let[t,n]=(0,x.useState)(!1);return(0,T.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,T.jsx)(`span`,{className:`truncate`,children:e}),(0,T.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-micro text-disabled`,children:t?`✓ copied`:`copy`})]})}var V=64;function H({loopId:n,runId:r}){let[i,f]=(0,x.useState)(null),[p,m]=(0,x.useState)(null),[_,b]=(0,x.useState)(!1),[S,C]=(0,x.useState)(null),w=(0,x.useCallback)(async()=>{try{f(await y({data:n})),C(null)}catch(e){C(String(e))}},[n]),E=(0,x.useCallback)(async()=>{try{f(await y({data:n}))}catch{}},[n]);(0,x.useEffect)(()=>{f(null),m(null),b(!1),C(null),w()},[n,r,w]);let D=i?.runs.find(e=>e.id===r)??p,O=L(D?.usage??null);(0,x.useEffect)(()=>{if(!i||D||_)return;let e=!0;return(async()=>{try{let t=i.runs.length?i.runs[i.runs.length-1].ts:new Date().toISOString();for(let i=0;i<V&&e;i++){let i=await v({data:{loopId:n,beforeTs:t,limit:100}});if(!i.length)break;let a=i.find(e=>e.id===r);if(a){e&&m(a);return}t=i[0].ts}}finally{e&&b(!0)}})(),()=>{e=!1}},[i,D,_,n,r]);let k=!!D&&(D.phase===`pending`||D.phase===`running`||!!D.reconciliation);(0,x.useEffect)(()=>{if(!k)return;let e=setInterval(()=>void E(),3e3);return()=>clearInterval(e)},[k,E]);async function A(){if(!D||!confirm(`Stop this run? If it is running, Pievo will ask the daemon to terminate it.`))return;let e=await g({data:D.id});if(e?.error){alert(`Stop failed: ${e.error}`);return}await w()}if(S)return(0,T.jsx)(l,{title:`Couldn't load this run.`,detail:S,onRetry:()=>void w()});if(!i||!D&&!_)return(0,T.jsx)(c,{});if(!D)return(0,T.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface px-6 py-10 text-center shadow-card`,children:[(0,T.jsx)(`div`,{className:`text-[14px] text-secondary`,children:`This run is no longer available.`}),(0,T.jsx)(h,{to:`/loops/$loopId`,params:{loopId:n},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=i.summary.name;return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`header`,{className:`rounded-card border border-hairline bg-surface px-6 pb-5 pt-[22px] shadow-card`,children:[(0,T.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-4`,children:(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,T.jsxs)(`h1`,{className:`text-[26px] font-medium leading-tight tracking-tight text-display`,children:[`Run · `,j]}),(0,T.jsx)(o,{run:D,colorText:!0})]}),(0,T.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,T.jsx)(`span`,{className:`text-primary`,children:t(D.ts)}),(0,T.jsx)(`span`,{className:`text-wire`,children:`·`}),D.durationMs!=null&&(0,T.jsx)(u,{tone:`ink`,children:a(D.durationMs)}),(0,T.jsx)(`code`,{className:`font-mono text-disabled`,children:D.id})]})]})}),(0,T.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2.5 border-t border-hairline pt-4`,children:[(0,T.jsx)(h,{to:`/loops/$loopId`,params:{loopId:n},className:s,children:`View the whole loop →`}),(D.phase===`pending`||D.phase===`running`)&&(0,T.jsx)(`button`,{type:`button`,onClick:A,className:d,disabled:D.phase===`running`&&i.machine.daemonProtocol!==4,title:D.phase===`running`&&i.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,T.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(300px,360px)]`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[D.phase===`pending`?(0,T.jsx)(F,{label:`Activity`,children:(0,T.jsx)(`div`,{className:`text-body text-secondary`,children:`Queued; it starts when this loop is free and the machine polls.`})}):D.phase===`running`?(0,T.jsx)(z,{run:D}):D.reconciliation?(0,T.jsx)(F,{label:`Recovery`,children:(0,T.jsx)(`div`,{className:`text-body text-secondary`,children:D.reconciliation===`blocking`?i.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,D.reportIncident&&(0,T.jsx)(F,{label:`Terminal report rejected`,children:(0,T.jsxs)(`div`,{className:`space-y-3 text-body text-primary`,children:[(0,T.jsx)(`div`,{className:`font-medium`,children:D.reportIncident.code}),(0,T.jsx)(`div`,{className:`break-words text-secondary`,children:D.reportIncident.reason}),(0,T.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,T.jsx)(`dt`,{className:`text-secondary`,children:`Fault domain`}),(0,T.jsx)(`dd`,{children:D.reportIncident.faultDomain}),(0,T.jsx)(`dt`,{className:`text-secondary`,children:`Recommended action`}),(0,T.jsx)(`dd`,{className:`break-words`,children:D.reportIncident.recommendedAction}),(0,T.jsx)(`dt`,{className:`text-secondary`,children:`Report ID`}),(0,T.jsx)(`dd`,{className:`break-all font-mono`,children:D.reportIncident.reportId})]})]})}),D.message&&(0,T.jsx)(F,{label:`Report`,children:(0,T.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:D.message})}),(0,T.jsx)(R,{run:D}),D.finalText&&(0,T.jsx)(F,{label:`Final output`,children:(0,T.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body text-primary`,children:D.finalText})})]}),(0,T.jsx)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:(0,T.jsx)(F,{label:`Details`,children:(0,T.jsxs)(`div`,{className:`space-y-3.5`,children:[D.status&&(0,T.jsx)(I,{k:`Status`,children:D.status}),D.durationMs!=null&&(0,T.jsx)(I,{k:`Duration`,children:a(D.durationMs)}),D.exitCode!=null&&(0,T.jsx)(I,{k:`Exit code`,children:D.exitCode}),O!=null&&(0,T.jsx)(I,{k:`Token usage`,children:(0,T.jsxs)(`span`,{className:`text-disabled`,children:[e(O),` tokens`]})}),D.error&&(0,T.jsx)(I,{k:`Error`,children:(0,T.jsx)(`span`,{className:`break-words`,style:{color:`var(--color-run-error)`},children:D.error})}),D.sessionId&&(0,T.jsx)(I,{k:`Session`,children:(0,T.jsx)(B,{id:D.sessionId})})]})})})]})]})}function U(){let{loopId:e,runId:t}=b.useParams();return(0,T.jsxs)(`main`,{className:`mx-auto max-w-[1360px] px-8 pb-24 pt-6`,children:[(0,T.jsx)(`div`,{className:`mb-5`,children:(0,T.jsxs)(h,{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,T.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Back to loop`]})}),(0,T.jsx)(H,{loopId:e,runId:t})]})}export{U as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as e,P as t,r as n}from"./actionUi-BZrLpgHT.js";var r=e();function i({error:e}){let i=t();return(0,r.jsx)(`main`,{className:`mx-auto max-w-[1180px] px-8 pt-12`,children:(0,r.jsx)(n,{title:`Couldn't load the dashboard.`,detail:String(e),onRetry:()=>void i.invalidate()})})}export{i as errorComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as e}from"./actionUi-BZrLpgHT.js";import{i as t,r as n}from"./index-Di_wpAtL.js";var r=e();function i(){return(0,r.jsx)(t,{initial:n.useLoaderData()})}export{i as component};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { O as listArtifacts, U as safeRelPath, l as getArtifactSync, x as getArtifactFile } from "./boot-CYRi-wez.mjs";
|
|
2
|
-
import { n as toArtifactSummary } from "./loopProjection-esCjyZJg.mjs";
|
|
3
|
-
//#region node_modules/.nitro/vite/services/ssr/assets/artifactFiles-Di1xDKvX.js
|
|
4
|
-
/**
|
|
5
|
-
* Server-side reads over a loop's current exact artifacts. Pure helpers
|
|
6
|
-
* (no request/session context) so they're shared by the lazy server fns
|
|
7
|
-
* (`getArtifacts` / `getArtifact` in loopApi) AND the download route, and are
|
|
8
|
-
* directly unit-testable against an injected blob store.
|
|
9
|
-
*
|
|
10
|
-
* The bytes live in the gateway's local BlobStore; here we only read them — never write — so the feature is strictly read-only and
|
|
11
|
-
* the server's zero-exec invariant holds (it decodes text, never interprets it).
|
|
12
|
-
*/
|
|
13
|
-
async function listLoopArtifacts(loopId) {
|
|
14
|
-
return (await listArtifacts(loopId)).map(toArtifactSummary);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* One file's content for inline display: decoded text for a text file, or a
|
|
18
|
-
* binary/oversize marker (the UI then offers the download route). Returns an
|
|
19
|
-
* error marker for an unknown/tombstoned path or a blob whose bytes aren't
|
|
20
|
-
* stored yet (a pending upload) — never throws.
|
|
21
|
-
*/
|
|
22
|
-
async function readLoopArtifact(loopId, rawPath) {
|
|
23
|
-
const rel = safeRelPath(rawPath);
|
|
24
|
-
if (!rel) return { error: "invalid path" };
|
|
25
|
-
const row = await getArtifactFile(loopId, rel);
|
|
26
|
-
if (!row || row.deleted) return { error: "file not found" };
|
|
27
|
-
if (row.binary || row.oversize) return {
|
|
28
|
-
binary: true,
|
|
29
|
-
size: row.size ?? null,
|
|
30
|
-
oversize: row.oversize
|
|
31
|
-
};
|
|
32
|
-
if (!row.hash) return { error: "file not synced yet" };
|
|
33
|
-
const bytes = await (await getArtifactSync()).readBlob(row.hash);
|
|
34
|
-
if (!bytes) return { error: "file not found" };
|
|
35
|
-
return { text: bytes.toString("utf8") };
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Resolve a loop-relative path to its stored bytes for the download route.
|
|
39
|
-
* Path-safe (rejects absolute/`..`/escaping → 400). Oversize/tombstoned/absent
|
|
40
|
-
* → 404 (no bytes to serve). The bytes stream straight from the BlobStore.
|
|
41
|
-
*/
|
|
42
|
-
async function readLoopArtifactBytes(loopId, rawPath) {
|
|
43
|
-
const rel = safeRelPath(rawPath);
|
|
44
|
-
if (!rel) return { status: 400 };
|
|
45
|
-
const row = await getArtifactFile(loopId, rel);
|
|
46
|
-
if (!row || row.deleted || !row.hash) return { status: 404 };
|
|
47
|
-
const bytes = await (await getArtifactSync()).readBlob(row.hash);
|
|
48
|
-
if (!bytes) return { status: 404 };
|
|
49
|
-
return {
|
|
50
|
-
status: 200,
|
|
51
|
-
bytes,
|
|
52
|
-
binary: row.binary,
|
|
53
|
-
filename: rel.split("/").pop() || "file"
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
//#endregion
|
|
57
|
-
export { listLoopArtifacts, readLoopArtifact, readLoopArtifactBytes };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { c as createFileRoute, s as lazyRouteComponent } from "../_libs/@tanstack/react-router+[...].mjs";
|
|
2
|
-
//#region node_modules/.nitro/vite/services/ssr/assets/loops._loopId_.runs._runId-BFP9oMrp.js
|
|
3
|
-
var $$splitComponentImporter = () => import("./loops._loopId_.runs._runId-DOkUEesG.mjs");
|
|
4
|
-
/**
|
|
5
|
-
* Run detail PAGE — `/loops/$loopId/runs/$runId`. A standalone page (the trailing
|
|
6
|
-
* `_` on the `$loopId` segment opts it out of the loop page's component so the run
|
|
7
|
-
* gets its own full surface, deep-linkable + browser-back friendly) rather than a
|
|
8
|
-
* modal or an inline panel. It resolves the run from the loop's detail payload
|
|
9
|
-
* (reusing getLoopDetail) and the existing artifact diff.
|
|
10
|
-
*/
|
|
11
|
-
var Route = createFileRoute("/loops/$loopId_/runs/$runId")({
|
|
12
|
-
ssr: false,
|
|
13
|
-
component: lazyRouteComponent($$splitComponentImporter, "component")
|
|
14
|
-
});
|
|
15
|
-
//#endregion
|
|
16
|
-
export { Route as t };
|