@mx-space/cli 0.15.0 → 0.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +1 -1
  2. package/dist/{Lexical.dev-Cck4n26y.mjs → Lexical.dev-Df5TNMgP.mjs} +129 -96
  3. package/dist/{Lexical.node-D6wf2D5M.mjs → Lexical.node-B064E4Hy.mjs} +1 -1
  4. package/dist/{Lexical.prod-DCwS1oTq.mjs → Lexical.prod-DRFSwoE7.mjs} +6 -4
  5. package/dist/{LexicalClipboard.dev-CMkPHV7O.mjs → LexicalClipboard.dev-ClOWeg5v.mjs} +18 -14
  6. package/dist/{LexicalClipboard.node-m4nZ7IYw.mjs → LexicalClipboard.node-BJBLWpEi.mjs} +1 -1
  7. package/dist/{LexicalClipboard.prod-B_rN1vE1.mjs → LexicalClipboard.prod-Ytt65eQo.mjs} +10 -10
  8. package/dist/{LexicalCodeCore.dev-DyJw3i8V.mjs → LexicalCodeCore.dev-CzEPINOT.mjs} +43 -25
  9. package/dist/{LexicalCodeCore.prod-DPXLHQLF.mjs → LexicalCodeCore.prod-DOVk7lL_.mjs} +6 -6
  10. package/dist/{LexicalDragon.dev-ZkNfMwrE.mjs → LexicalDragon.dev-DxePN9fP.mjs} +2 -2
  11. package/dist/{LexicalDragon.node-Ds9oLUFh.mjs → LexicalDragon.node-DBwaqStp.mjs} +1 -1
  12. package/dist/{LexicalDragon.prod-B58ic2av.mjs → LexicalDragon.prod-Bji84-Hq.mjs} +2 -2
  13. package/dist/{LexicalExtension.dev-DvwHs1Xv.mjs → LexicalExtension.dev-DtSRyjbf.mjs} +25 -13
  14. package/dist/{LexicalExtension.node-5OymZQfy.mjs → LexicalExtension.node-3nsS5NjU.mjs} +1 -1
  15. package/dist/{LexicalExtension.prod-Ce0T5smQ.mjs → LexicalExtension.prod-Ddk0ja_6.mjs} +16 -13
  16. package/dist/{LexicalHeadless.dev-DA0WldSR.mjs → LexicalHeadless.dev-DdWJsPoH.mjs} +1 -1
  17. package/dist/{LexicalHeadless.prod-1kQgKB6c.mjs → LexicalHeadless.prod-CH74ZDMt.mjs} +1 -1
  18. package/dist/{LexicalHtml.dev-BDB7CUrx.mjs → LexicalHtml.dev-DN7QIb_7.mjs} +20 -14
  19. package/dist/{LexicalHtml.node-DpVNt7It.mjs → LexicalHtml.node-DAwuaPeI.mjs} +1 -1
  20. package/dist/{LexicalHtml.prod-HkxM5scw.mjs → LexicalHtml.prod-X4eTHEfI.mjs} +4 -4
  21. package/dist/{LexicalLink.dev-C5zNJlrm.mjs → LexicalLink.dev-owitIl6I.mjs} +28 -21
  22. package/dist/{LexicalLink.prod-Bkt9hQAt.mjs → LexicalLink.prod-BZ7ZZkVD.mjs} +6 -5
  23. package/dist/{LexicalList.dev-B7VgME-m.mjs → LexicalList.dev-CUbi09Yo.mjs} +4 -4
  24. package/dist/{LexicalList.prod-B8c7TDjH.mjs → LexicalList.prod-pUsUZa0r.mjs} +4 -4
  25. package/dist/{LexicalMarkdown.dev-B5z9kLbV.mjs → LexicalMarkdown.dev-S2yWckH9.mjs} +40 -29
  26. package/dist/{LexicalMarkdown.prod-wKzw7FFH.mjs → LexicalMarkdown.prod-TRkMWfmC.mjs} +10 -7
  27. package/dist/{LexicalRichText.dev-CUd6Li5F.mjs → LexicalRichText.dev-Y3ybFF2S.mjs} +15 -11
  28. package/dist/{LexicalRichText.node-BKfaQ-CH.mjs → LexicalRichText.node-wNAi2Z4i.mjs} +4 -4
  29. package/dist/{LexicalRichText.prod-SBewjJHx.mjs → LexicalRichText.prod-HLxqZ6hQ.mjs} +17 -11
  30. package/dist/{LexicalSelection.dev-D27JOCqj.mjs → LexicalSelection.dev-CyhKOKbs.mjs} +28 -24
  31. package/dist/{LexicalSelection.node-DBEwPjBu.mjs → LexicalSelection.node-BCuHMbzl.mjs} +1 -1
  32. package/dist/{LexicalSelection.prod-OaYhXHOL.mjs → LexicalSelection.prod-RebDJliC.mjs} +2 -2
  33. package/dist/{LexicalTable.dev-6IFFOAE0.mjs → LexicalTable.dev-DN3ezVey.mjs} +33 -28
  34. package/dist/{LexicalTable.prod-2CaLZ7fH.mjs → LexicalTable.prod-B0MioVyq.mjs} +10 -9
  35. package/dist/{LexicalUtils.dev-DJA7J_7v.mjs → LexicalUtils.dev-Bw6LFRlt.mjs} +8 -5
  36. package/dist/{LexicalUtils.node-Df9oPTlA.mjs → LexicalUtils.node-BPKMFN80.mjs} +1 -1
  37. package/dist/{LexicalUtils.prod-Bb7V4Ewg.mjs → LexicalUtils.prod-CJYQVQJO.mjs} +7 -6
  38. package/dist/bin/mxs.mjs +1 -1
  39. package/dist/{esm-DLzrv7gD.mjs → esm-7vSMGlFz.mjs} +428 -505
  40. package/dist/esm-ZrfYH2y2.mjs +2 -0
  41. package/dist/index.mjs +1 -1
  42. package/dist/{mxs-BIRW5Axj.mjs → mxs-DKv-4ZTg.mjs} +1091 -806
  43. package/dist/{rolldown-runtime-JspESFgx.mjs → rolldown-runtime-B4iAMlE-.mjs} +1 -1
  44. package/dist/vendor/litexml/cli.mjs +113 -42
  45. package/dist/vendor/litexml/litexml-html-preview-client.css +575 -997
  46. package/dist/vendor/litexml/litexml-html-preview-client.js +8177 -7143
  47. package/dist/vendor/litexml/style.css +9 -5
  48. package/package.json +28 -25
  49. package/skills/safety.md +1 -1
  50. package/LICENSE +0 -33
  51. package/dist/esm-CDcJmHkG.mjs +0 -2
@@ -1,8 +1,8 @@
1
- import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./rolldown-runtime-JspESFgx.mjs";
2
- import { $ as fiberIdWith, $a as findFirst, $i as combine$3, $n as isDieType, $o as NodeInspectSymbol, $r as catchAll, $t as sync$2, A as all$6, Aa as toArray, Ai as onInterrupt, An as scoped$3, Ao as fromNullable, Ar as bindTo, At as orDie, B as catchSome, Ba as merge$3, Bi as withFiberRuntime, Bn as addFinalizer, Bo as orElse$3, Br as allLevels, Bt as retry, C as decodeSync, Ca as map$12, Ci as fiberRefUnsafeMake, Cn as TaggedError$1, Co as splitAt, Cr as mapBoth, Ct as match$5, D as acquireRelease, Da as reverse, Di as interruptFiber, Dn as mergeAll$2, Do as empty$17, Dr as zip$2, Dt as negate, E as _void, Ea as reduce$1, Ei as interruptAsFiber, En as fromEffect$5, Eo as unsafeGet$1, Er as void_$3, Et as matchEffect, F as cached$1, Fa as Reference, Fi as tap$1, Fn as updateContext$1, Fo as isOption, Fr as set$3, Ft as provideService, G as die$2, Ga as append$5, Gi as of$3, Gn as make$36, Go as isEither, Gr as CommitPrototype, Gt as scopeWith, H as catchTags, Ha as isConfigError, Hi as DeferredTypeId$1, Hn as close, Ho as boolean$3, Hr as updateAs, Ht as runSync, I as catchAll$1, Ia as Tag$3, Ii as uninterruptible, In as forkIn$1, Io as isSome, Ir as update$9, It as race, J as ensuring$4, Ja as drop$1, Ji as get$23, Jn as fail$6, Jo as merge$2, Jr as consoleTag, Jt as serviceFunctions, K as dieMessage, Ka as appendAll$1, Ki as empty$16, Kn as NoSuchElementException, Ko as left, Kr as currentServices, Kt as scoped$4, L as catchAllCause$1, La as add$1, Li as uninterruptibleMask$1, Ln as makeSynchronized, Lo as map$14, Lr as updateAndGet, Lt as raceWith, M as as, Ma as unsafeGet, Mi as succeed$5, Mn as updateEffect$1, Mo as getOrThrow, Mr as get$22, Mt as orElseFail, N as asVoid$1, Na as unsafeHead, Ni as suspend$5, Nn as unsafeFork, No as getOrUndefined, Nr as make$35, O as acquireUseRelease$2, Oa as take$2, Oi as interruptible$1, On as provide$1, Oo as filter$5, Or as zipRight$2, Ot as onError, P as async, Pa as GenericTag, Pi as sync$1, Pn as unsafeRunPromiseExit, Po as isNone, Pr as modify$1, Pt as provide$2, Q as failSync, Qa as filterMap, Qi as set$4, Qn as interruptors, Qo as Class$1, Qr as asyncInterrupt, Qt as suspend$6, R as catchAllDefect, Ra as get$20, Ri as void_$2, Rn as unsafeMakeSemaphore, Ro as match$4, Rr as get$24, Rt as repeat, S as redactedRegistry, Sa as isEmpty$7, Si as fiberRefLocally, Sn as Error$1, So as span, Sr as map$10, Ss as pipe, St as mapInputContext, T as is$2, Ta as prepend$2, Ti as interrupt$2, Tn as taggedEnum, To as take$3, Tr as succeed$6, Tt as matchCauseEffect, U as context, Ua as isMissingDataOnly, Ui as cons$1, Un as extend, Uo as mapInput, Ur as sequential, Ut as runtime, V as catchTag, Va as omit, Vi as zipRight$1, Vn as addFinalizerExit, Vo as some, Vr as getOrDefault, Vt as runFork$1, W as contextWithEffect, Wa as allocate, Wi as isNil, Wn as fork, Wo as string$1, Wr as Class, Wt as scope, X as fail$8, Xa as every, Xi as isEmpty$8, Xn as flipCauseOption, Xo as pipeArguments, Xr as as$1, Xt as sleep$2, Y as exit, Ya as empty$15, Yi as has$1, Yn as failureOrCause, Yo as right, Yr as round, Yt as serviceOption, Z as failCause$4, Za as filter$4, Zi as make$39, Zn as interrupt$3, Zo as BaseProto, Zr as asVoid, Zt as succeed$7, _ as optional$9, _a as drop, _i as exitVoid, _n as zipLeft, _o as prepend$3, _r as all$5, _s as constTrue, _t as logWarning, a as Literal, aa as make$34, ai as deferredFailCause, an as tryPromise, ao as head$2, ar as currentLoggers$1, as as equals, at as forEach$2, b as isConfig, ba as fromIterable$2, bi as fiberRefGet, bn as spaced$1, bo as some$1, br as failCause$3, bs as dual, bt as mapBoth$1, ca as fromIterable$4, ci as deferredIsDone, cn as uninterruptibleMask, co as isEmptyReadonlyArray, cr as ensuring$5, cs as combine$2, ct as forkScoped, d as TaggedError, da as size$15, di as deferredUnsafeDone, dn as unsafeMakeSemaphore$1, do as make$38, dr as scopeTag, ds as symbol$1, dt as interrupt$4, ea as combineAll, ei as currentContext$1, en as tap, eo as findFirstIndex, er as isInterrupted, es as format$3, et as filter$3, f as Union, fa as decode, fi as deferredUnsafeMake, fn as useSpan, fo as map$13, fr as prettyLoggerDefault$1, fs as hasProperty, ft as interruptible, g as int, ga as appendAll, gi as exitSucceed, gn as zip$1, go as of$2, gr as join$3, gs as constFalse, gt as logError, h as decodeUnknown, ha as append$4, hi as exitFailCause, hn as withParentSpan, ho as matchRight, hr as interruptAllAs$1, hs as globalValue, ht as locally, i as Int, ia as get$21, ii as deferredFail, in as tryMap, io as getSomes, ir as squash, is as toStringUnknown, it as fnUntraced, j as annotateLogs, ja as unsafeFromArray, ji as scopeClose, jn as succeed$4, jo as getOrElse, jr as sleep$1, jt as orElse$4, k as addFinalizer$1, ka as takeRight, ki as map$8, kn as provideMerge$1, ko as flatMap$6, kr as bind, kt as onInterrupt$1, la as has$2, li as deferredMake, ln as unlessEffect, lo as isNonEmptyReadonlyArray, lr as forEachConcurrentDiscard, ls as hash, lt as gen, ma as seconds, mi as exitFail, mn as withFiberRuntime$1, mo as matchLeft, mr as inheritAll$1, ms as isTagged, mt as isEffect, n as Date$, na as make$40, ni as deferredAwait, nn as tapErrorCause, no as flatMap$7, nr as map$11, ns as symbolRedactable, nt as flatMap$5, o as Number$, oa as set$2, oi as deferredInterrupt, on as try_, oo as headNonEmpty, or as currentMinimumLogLevel, os as symbol$2, ot as forkDaemon, p as compose, pa as isFinite$1, pi as exitAs, pn as when$2, po as match$6, pr as _await$2, ps as isObject, pt as intoDeferred, q as either$1, qa as contains, qi as fromIterable$3, qn as die$1, qo as match$2, qr as spanTag, qt as scopedWith$1, r as Defect, ra as none$4, ri as deferredComplete, rn as timeout, ro as fromIterable$1, rr as reduceWithContext, rs as toJSON, rt as flatten$5, s as NumberFromString, sa as add$2, si as deferredInterruptWith, sn as uninterruptible$1, so as isArray$1, sr as defaultLogger$1, ss as cached, st as forkIn, t as Cause, ta as ids$1, ti as currentTracerEnabled$1, tn as tapError, to as findLast, tr as isInterruptedOnly, ts as redact$1, tt as filterOrDieMessage, u as String$, ua as remove$5, ui as deferredSucceed, un as unsafeMakeLatch, uo as join$4, ur as scopeMake, us as string, ut as ignore, va as empty$14, vi as exitZipRight, vn as zipRight$3, vo as reduce$2, vr as die, vs as constUndefined, vt as makeSemaphore, w as encodeSync, wa as of$1, wi as flatMap$4, wn as tagged, wo as tailNonEmpty, wr as match$3, wt as matchCause, x as proto$19, xa as isChunk, xi as fiberRefGetWith, xo as sort$2, xr as isFailure, xs as identity, xt as mapError$3, y as make$37, ya as filter$2, yi as fiberId, yn as zipWith, yo as reduceRight, yr as fail$7, ys as constVoid, yt as map$9, z as catchIf, za as getOption, zi as whenEffect, zn as Scope, zo as none$3, zr as TypeId$22, zt as repeatN } from "./esm-DLzrv7gD.mjs";
3
- import { _ as LinkNode, a as HeadingNode, b as CodeHighlightNode, d as ListItemNode, f as ListNode, g as AutoLinkNode, o as QuoteNode, x as CodeNode } from "./LexicalRichText.node-BKfaQ-CH.mjs";
4
- import { a as HorizontalRuleNode } from "./LexicalExtension.node-5OymZQfy.mjs";
5
- import { hn as ElementNode, mn as DecoratorNode } from "./Lexical.node-D6wf2D5M.mjs";
1
+ import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./rolldown-runtime-B4iAMlE-.mjs";
2
+ import { $ as fiberIdWith, $a as findFirst, $i as combine$3, $n as isDieType, $o as NodeInspectSymbol, $r as catchAll, $t as sync$2, A as all$6, Aa as toArray, Ai as onInterrupt, An as scoped$3, Ao as fromNullable, Ar as bindTo, At as orDie, B as catchSome, Ba as merge$3, Bi as withFiberRuntime, Bn as addFinalizer, Bo as orElse$3, Br as allLevels, Bt as retry, C as decodeSync, Ca as map$12, Ci as fiberRefUnsafeMake, Cn as TaggedError$1, Co as splitAt, Cr as mapBoth, Ct as match$5, D as acquireRelease, Da as reverse, Di as interruptFiber, Dn as mergeAll$2, Do as empty$17, Dr as zip$2, Dt as negate, E as _void, Ea as reduce$1, Ei as interruptAsFiber, En as fromEffect$5, Eo as unsafeGet$1, Er as void_$3, Et as matchEffect, F as cached$1, Fa as Reference, Fi as tap$1, Fn as updateContext$1, Fo as isOption, Fr as set$3, Ft as provideService, G as die$2, Ga as append$5, Gi as of$3, Gn as make$36, Go as isEither, Gr as CommitPrototype, Gt as scopeWith, H as catchTags, Ha as isConfigError, Hi as DeferredTypeId$1, Hn as close, Ho as boolean$3, Hr as updateAs, Ht as runSync, I as catchAll$1, Ia as Tag$3, Ii as uninterruptible, In as forkIn$1, Io as isSome, Ir as update$9, It as race, J as ensuring$4, Ja as drop$1, Ji as get$23, Jn as fail$6, Jo as merge$2, Jr as consoleTag, Jt as serviceFunctions, K as dieMessage, Ka as appendAll$1, Ki as empty$16, Kn as NoSuchElementException, Ko as left, Kr as currentServices, Kt as scoped$4, L as catchAllCause$1, La as add$1, Li as uninterruptibleMask$1, Ln as makeSynchronized, Lo as map$14, Lr as updateAndGet, Lt as raceWith, M as as, Ma as unsafeGet, Mi as succeed$5, Mn as updateEffect$1, Mo as getOrThrow, Mr as get$22, Mt as orElseFail, N as asVoid$1, Na as unsafeHead, Ni as suspend$5, Nn as unsafeFork, No as getOrUndefined, Nr as make$35, O as acquireUseRelease$2, Oa as take$2, Oi as interruptible$1, On as provide$1, Oo as filter$5, Or as zipRight$2, Ot as onError, P as async, Pa as GenericTag, Pi as sync$1, Pn as unsafeRunPromiseExit, Po as isNone, Pr as modify$1, Pt as provide$2, Q as failSync, Qa as filterMap, Qi as set$4, Qn as interruptors, Qo as Class$1, Qr as asyncInterrupt, Qt as suspend$6, R as catchAllDefect, Ra as get$20, Ri as void_$2, Rn as unsafeMakeSemaphore, Ro as match$4, Rr as get$24, Rt as repeat, S as redactedRegistry, Sa as isEmpty$7, Si as fiberRefLocally, Sn as Error$1, So as span, Sr as map$10, Ss as pipe, St as mapInputContext, T as is$2, Ta as prepend$2, Ti as interrupt$2, Tn as taggedEnum, To as take$3, Tr as succeed$6, Tt as matchCauseEffect, U as context, Ua as isMissingDataOnly, Ui as cons$1, Un as extend, Uo as mapInput, Ur as sequential, Ut as runtime, V as catchTag, Va as omit, Vi as zipRight$1, Vn as addFinalizerExit, Vo as some, Vr as getOrDefault, Vt as runFork$1, W as contextWithEffect, Wa as allocate, Wi as isNil, Wn as fork, Wo as string$1, Wr as Class, Wt as scope, X as fail$8, Xa as every, Xi as isEmpty$8, Xn as flipCauseOption, Xo as pipeArguments, Xr as as$1, Xt as sleep$2, Y as exit, Ya as empty$15, Yi as has$1, Yn as failureOrCause, Yo as right, Yr as round, Yt as serviceOption, Z as failCause$4, Za as filter$4, Zi as make$39, Zn as interrupt$3, Zo as BaseProto, Zr as asVoid, Zt as succeed$7, _ as optional$9, _a as drop, _i as exitVoid, _n as zipLeft, _o as prepend$3, _r as all$5, _s as constTrue, _t as logWarning, a as Literal, aa as make$34, ai as deferredFailCause, an as tryPromise, ao as head$2, ar as currentLoggers$1, as as equals, at as forEach$2, b as isConfig, ba as fromIterable$2, bi as fiberRefGet, bn as spaced$1, bo as some$1, br as failCause$3, bs as dual, bt as mapBoth$1, ca as fromIterable$4, ci as deferredIsDone, cn as uninterruptibleMask, co as isEmptyReadonlyArray, cr as ensuring$5, cs as combine$2, ct as forkScoped, d as TaggedError, da as size$15, di as deferredUnsafeDone, dn as unsafeMakeSemaphore$1, do as make$38, dr as scopeTag, ds as symbol$1, dt as interrupt$4, ea as combineAll, ei as currentContext$1, en as tap, eo as findFirstIndex, er as isInterrupted, es as format$3, et as filter$3, f as Union, fa as decode, fi as deferredUnsafeMake, fn as useSpan, fo as map$13, fr as prettyLoggerDefault$1, fs as hasProperty, ft as interruptible, g as int, ga as appendAll, gi as exitSucceed, gn as zip$1, go as of$2, gr as join$3, gs as constFalse, gt as logError, h as decodeUnknown, ha as append$4, hi as exitFailCause, hn as withParentSpan, ho as matchRight, hr as interruptAllAs$1, hs as globalValue, ht as locally, i as Int, ia as get$21, ii as deferredFail, in as tryMap, io as getSomes, ir as squash, is as toStringUnknown, it as fnUntraced, j as annotateLogs, ja as unsafeFromArray, ji as scopeClose, jn as succeed$4, jo as getOrElse, jr as sleep$1, jt as orElse$4, k as addFinalizer$1, ka as takeRight, ki as map$8, kn as provideMerge$1, ko as flatMap$6, kr as bind, kt as onInterrupt$1, la as has$2, li as deferredMake, ln as unlessEffect, lo as isNonEmptyReadonlyArray, lr as forEachConcurrentDiscard, ls as hash, lt as gen, ma as seconds, mi as exitFail, mn as withFiberRuntime$1, mo as matchLeft, mr as inheritAll$1, ms as isTagged, mt as isEffect, n as Date$, na as make$40, ni as deferredAwait, nn as tapErrorCause, no as flatMap$7, nr as map$11, ns as symbolRedactable, nt as flatMap$5, o as Number$, oa as set$2, oi as deferredInterrupt, on as try_, oo as headNonEmpty, or as currentMinimumLogLevel, os as symbol$2, ot as forkDaemon, p as compose, pa as isFinite$1, pi as exitAs, pn as when$2, po as match$6, pr as _await$2, ps as isObject, pt as intoDeferred, q as either$1, qa as contains, qi as fromIterable$3, qn as die$1, qo as match$2, qr as spanTag, qt as scopedWith$1, r as Defect, ra as none$4, ri as deferredComplete, rn as timeout, ro as fromIterable$1, rr as reduceWithContext, rs as toJSON, rt as flatten$5, s as NumberFromString, sa as add$2, si as deferredInterruptWith, sn as uninterruptible$1, so as isArray$1, sr as defaultLogger$1, ss as cached, st as forkIn, t as Cause, ta as ids$1, ti as currentTracerEnabled$1, tn as tapError, to as findLast, tr as isInterruptedOnly, ts as redact$1, tt as filterOrDieMessage, u as String$, ua as remove$5, ui as deferredSucceed, un as unsafeMakeLatch, uo as join$4, ur as scopeMake, us as string, ut as ignore, va as empty$14, vi as exitZipRight, vn as zipRight$3, vo as reduce$2, vr as die, vs as constUndefined, vt as makeSemaphore, w as encodeSync, wa as of$1, wi as flatMap$4, wn as tagged, wo as tailNonEmpty, wr as match$3, wt as matchCause, x as proto$19, xa as isChunk, xi as fiberRefGetWith, xo as sort$2, xr as isFailure, xs as identity, xt as mapError$3, y as make$37, ya as filter$2, yi as fiberId, yn as zipWith, yo as reduceRight, yr as fail$7, ys as constVoid, yt as map$9, z as catchIf, za as getOption, zi as whenEffect, zn as Scope, zo as none$3, zr as TypeId$22, zt as repeatN } from "./esm-7vSMGlFz.mjs";
3
+ import { _ as LinkNode, a as HeadingNode, b as CodeHighlightNode, d as ListItemNode, f as ListNode, g as AutoLinkNode, o as QuoteNode, x as CodeNode } from "./LexicalRichText.node-wNAi2Z4i.mjs";
4
+ import { a as HorizontalRuleNode } from "./LexicalExtension.node-3nsS5NjU.mjs";
5
+ import { hn as ElementNode, mn as DecoratorNode } from "./Lexical.node-B064E4Hy.mjs";
6
6
  import { createRequire } from "node:module";
7
7
  import * as Path from "node:path";
8
8
  import path, { basename, dirname, join } from "node:path";
@@ -1471,9 +1471,9 @@ var PullFromUpstream = class PullFromUpstream {
1471
1471
  this.onPull = onPull;
1472
1472
  this.onEmit = onEmit;
1473
1473
  }
1474
- close(exit$5) {
1475
- const fin1 = this.upstreamExecutor.close(exit$5);
1476
- const result = [...this.activeChildExecutors.map((child) => child !== void 0 ? child.childExecutor.close(exit$5) : void 0), fin1].reduce((acc, next) => {
1474
+ close(exit$3) {
1475
+ const fin1 = this.upstreamExecutor.close(exit$3);
1476
+ const result = [...this.activeChildExecutors.map((child) => child !== void 0 ? child.childExecutor.close(exit$3) : void 0), fin1].reduce((acc, next) => {
1477
1477
  if (acc !== void 0 && next !== void 0) return zipWith(acc, exit(next), (exit1, exit2) => zipRight$2(exit1, exit2));
1478
1478
  else if (acc !== void 0) return acc;
1479
1479
  else if (next !== void 0) return exit(next);
@@ -1509,9 +1509,9 @@ var DrainChildExecutors = class DrainChildExecutors {
1509
1509
  this.combineWithChildResult = combineWithChildResult;
1510
1510
  this.onPull = onPull;
1511
1511
  }
1512
- close(exit$3) {
1513
- const fin1 = this.upstreamExecutor.close(exit$3);
1514
- const result = [...this.activeChildExecutors.map((child) => child !== void 0 ? child.childExecutor.close(exit$3) : void 0), fin1].reduce((acc, next) => {
1512
+ close(exit$5) {
1513
+ const fin1 = this.upstreamExecutor.close(exit$5);
1514
+ const result = [...this.activeChildExecutors.map((child) => child !== void 0 ? child.childExecutor.close(exit$5) : void 0), fin1].reduce((acc, next) => {
1515
1515
  if (acc !== void 0 && next !== void 0) return zipWith(acc, exit(next), (exit1, exit2) => zipRight$2(exit1, exit2));
1516
1516
  else if (acc !== void 0) return acc;
1517
1517
  else if (next !== void 0) return exit(next);
@@ -1711,9 +1711,7 @@ var ChannelExecutor = class ChannelExecutor {
1711
1711
  case OP_SUCCEED_NOW:
1712
1712
  result = this.doneSucceed(this._currentChannel.terminal);
1713
1713
  break;
1714
- case OP_SUSPEND:
1715
- this._currentChannel = this._currentChannel.channel();
1716
- break;
1714
+ case OP_SUSPEND: this._currentChannel = this._currentChannel.channel();
1717
1715
  }
1718
1716
  }
1719
1717
  } catch (error) {
@@ -1940,7 +1938,6 @@ var ChannelExecutor = class ChannelExecutor {
1940
1938
  this.replaceSubexecutor(modifiedParent);
1941
1939
  break;
1942
1940
  }
1943
- default: break;
1944
1941
  }
1945
1942
  }
1946
1943
  handleSubexecutorFailure(childExecutor, parentSubexecutor, cause) {
@@ -2465,7 +2462,9 @@ const mergeWith = /*#__PURE__*/ dual(2, (self, options) => {
2465
2462
  state.transferChildren(parent.scope());
2466
2463
  return _void;
2467
2464
  });
2468
- return zipWith(interruptible(pullL).pipe(ensuring$4(inherit), forkIn(scope)), interruptible(pullR).pipe(ensuring$4(inherit), forkIn(scope)), (left, right) => BothRunning(left, right));
2465
+ const leftFiber = interruptible(pullL).pipe(ensuring$4(inherit), forkIn(scope));
2466
+ const rightFiber = interruptible(pullR).pipe(ensuring$4(inherit), forkIn(scope));
2467
+ return zipWith(leftFiber, rightFiber, (left, right) => BothRunning(left, right));
2469
2468
  })).pipe(flatMap$3(go), embedInput$1(input));
2470
2469
  });
2471
2470
  }
@@ -3004,7 +3003,8 @@ var MailboxImpl = class extends Class {
3004
3003
  this.capacity = 1;
3005
3004
  this.releaseCapacity();
3006
3005
  this.capacity = 0;
3007
- return succeed$5([of$1(this.messages.pop()), this.releaseCapacity()]);
3006
+ const messages = of$1(this.messages.pop());
3007
+ return succeed$5([messages, this.releaseCapacity()]);
3008
3008
  }
3009
3009
  n = Math.min(n, this.capacity || 1);
3010
3010
  let messages;
@@ -3759,12 +3759,12 @@ const Module = /*#__PURE__*/ Literal("Clipboard", "Command", "FileSystem", "KeyV
3759
3759
  * @since 1.0.0
3760
3760
  * @category Models
3761
3761
  */
3762
- var BadArgument = class extends TaggedError("@effect/platform/Error/BadArgument")("BadArgument", {
3762
+ var BadArgument = class extends (/*#__PURE__*/ TaggedError("@effect/platform/Error/BadArgument")("BadArgument", {
3763
3763
  module: Module,
3764
3764
  method: String$,
3765
3765
  description: /*#__PURE__*/ optional$9(String$),
3766
3766
  cause: /*#__PURE__*/ optional$9(Defect)
3767
- }) {
3767
+ })) {
3768
3768
  /**
3769
3769
  * @since 1.0.0
3770
3770
  */
@@ -3785,7 +3785,7 @@ const SystemErrorReason = /*#__PURE__*/ Literal("AlreadyExists", "BadResource",
3785
3785
  * @since 1.0.0
3786
3786
  * @category models
3787
3787
  */
3788
- var SystemError = class extends TaggedError("@effect/platform/Error/SystemError")("SystemError", {
3788
+ var SystemError = class extends (/*#__PURE__*/ TaggedError("@effect/platform/Error/SystemError")("SystemError", {
3789
3789
  reason: SystemErrorReason,
3790
3790
  module: Module,
3791
3791
  method: String$,
@@ -3793,7 +3793,7 @@ var SystemError = class extends TaggedError("@effect/platform/Error/SystemError"
3793
3793
  syscall: /*#__PURE__*/ optional$9(String$),
3794
3794
  pathOrDescriptor: /*#__PURE__*/ optional$9(/*#__PURE__*/ Union(String$, Number$)),
3795
3795
  cause: /*#__PURE__*/ optional$9(Defect)
3796
- }) {
3796
+ })) {
3797
3797
  /**
3798
3798
  * @since 1.0.0
3799
3799
  */
@@ -3844,7 +3844,7 @@ const make$24 = (impl) => {
3844
3844
  });
3845
3845
  };
3846
3846
  /** @internal */
3847
- const stream = (file, { bufferSize = 16, bytesToRead: bytesToRead_, chunkSize: chunkSize_ = Size$1(64 * 1024) } = {}) => {
3847
+ const stream = (file, { bufferSize = 16, bytesToRead: bytesToRead_, chunkSize: chunkSize_ = Size$1(65536) } = {}) => {
3848
3848
  const bytesToRead = bytesToRead_ !== void 0 ? Size$1(bytesToRead_) : void 0;
3849
3849
  const chunkSize = Size$1(chunkSize_);
3850
3850
  function loop(totalBytesRead) {
@@ -3906,7 +3906,7 @@ const WatchEventRemove = /*#__PURE__*/ tagged("Remove");
3906
3906
  * @since 1.0.0
3907
3907
  * @category file watcher
3908
3908
  */
3909
- var WatchBackend = class extends Tag$3("@effect/platform/FileSystem/WatchBackend")() {};
3909
+ var WatchBackend = class extends (/*#__PURE__*/ Tag$3("@effect/platform/FileSystem/WatchBackend")()) {};
3910
3910
  //#endregion
3911
3911
  //#region ../../node_modules/.pnpm/@effect+typeclass@0.41.0_effect@3.22.1/node_modules/@effect/typeclass/dist/esm/internal/Iterable.js
3912
3912
  /** @internal */
@@ -4944,9 +4944,7 @@ const fitsPretty = (self, width) => {
4944
4944
  case "PushAnnotationStream":
4945
4945
  stream = stream.stream;
4946
4946
  break;
4947
- case "PopAnnotationStream":
4948
- stream = stream.stream;
4949
- break;
4947
+ case "PopAnnotationStream": stream = stream.stream;
4950
4948
  }
4951
4949
  return false;
4952
4950
  };
@@ -4989,9 +4987,7 @@ const fitsSmartLoop = (self, comparator, pageWidth, currentColumn, availableWidt
4989
4987
  case "PushAnnotationStream":
4990
4988
  stream = stream.stream;
4991
4989
  break;
4992
- case "PopAnnotationStream":
4993
- stream = stream.stream;
4994
- break;
4990
+ case "PopAnnotationStream": stream = stream.stream;
4995
4991
  }
4996
4992
  return false;
4997
4993
  };
@@ -5020,9 +5016,7 @@ const failsOnFirstLine = (self) => {
5020
5016
  case "PushAnnotationStream":
5021
5017
  stream = stream.stream;
5022
5018
  break;
5023
- case "PopAnnotationStream":
5024
- stream = stream.stream;
5025
- break;
5019
+ case "PopAnnotationStream": stream = stream.stream;
5026
5020
  }
5027
5021
  throw new Error("bug");
5028
5022
  };
@@ -6102,7 +6096,7 @@ const tag$1 = /*#__PURE__*/ GenericTag("@effect/platform/Terminal");
6102
6096
  * @since 1.0.0
6103
6097
  * @category model
6104
6098
  */
6105
- var QuitException = class extends TaggedError$1("QuitException") {};
6099
+ var QuitException = class extends (/*#__PURE__*/ TaggedError$1("QuitException")) {};
6106
6100
  /**
6107
6101
  * @since 1.0.0
6108
6102
  * @category refinements
@@ -6561,7 +6555,8 @@ function processDown(state) {
6561
6555
  } });
6562
6556
  }
6563
6557
  function processCursorLeft$1(state) {
6564
- return match$4(state.dateParts[state.cursor].previousPart(), {
6558
+ const previousPart = state.dateParts[state.cursor].previousPart();
6559
+ return match$4(previousPart, {
6565
6560
  onNone: () => Action.Beep(),
6566
6561
  onSome: (previous) => Action.NextFrame({ state: {
6567
6562
  ...state,
@@ -6571,7 +6566,8 @@ function processCursorLeft$1(state) {
6571
6566
  });
6572
6567
  }
6573
6568
  function processCursorRight$1(state) {
6574
- return match$4(state.dateParts[state.cursor].nextPart(), {
6569
+ const nextPart = state.dateParts[state.cursor].nextPart();
6570
+ return match$4(nextPart, {
6575
6571
  onNone: () => Action.Beep(),
6576
6572
  onSome: (next) => Action.NextFrame({ state: {
6577
6573
  ...state,
@@ -6581,7 +6577,8 @@ function processCursorRight$1(state) {
6581
6577
  });
6582
6578
  }
6583
6579
  function processNext$1(state) {
6584
- const cursor = match$4(state.dateParts[state.cursor].nextPart(), {
6580
+ const nextPart = state.dateParts[state.cursor].nextPart();
6581
+ const cursor = match$4(nextPart, {
6585
6582
  onNone: () => state.dateParts.findIndex((part) => !part.isToken()),
6586
6583
  onSome: (next) => state.dateParts.indexOf(next)
6587
6584
  });
@@ -6676,7 +6673,10 @@ function handleProcess$4(options) {
6676
6673
  } }),
6677
6674
  onSuccess: (value) => Action.Submit({ value })
6678
6675
  });
6679
- default: return succeed$7(defaultProcessor$1(getOrElse(input.input, () => ""), state));
6676
+ default: {
6677
+ const value = getOrElse(input.input, () => "");
6678
+ return succeed$7(defaultProcessor$1(value, state));
6679
+ }
6680
6680
  }
6681
6681
  };
6682
6682
  }
@@ -6975,7 +6975,9 @@ function getFileList(directory, options) {
6975
6975
  const files = yield* orDie(fs.readDirectory(directory)).pipe(map$9((files) => ["..", ...files]));
6976
6976
  return yield* filter$3(files, (file) => {
6977
6977
  const result = options.filter(file);
6978
- return zipWith(isEffect(result) ? result : succeed$7(result), options.type === "directory" ? map$9(orDie(fs.stat(path.join(directory, file))), (info) => info.type === "Directory") : succeed$7(true), (a, b) => a && b);
6978
+ const userDefinedFilter = isEffect(result) ? result : succeed$7(result);
6979
+ const directoryFilter = options.type === "directory" ? map$9(orDie(fs.stat(path.join(directory, file))), (info) => info.type === "Directory") : succeed$7(true);
6980
+ return zipWith(userDefinedFilter, directoryFilter, (a, b) => a && b);
6979
6981
  }, { concurrency: files.length });
6980
6982
  });
6981
6983
  }
@@ -7643,9 +7645,9 @@ function renderOutput$1(nextState, leadingSymbol, trailingSymbol, options, submi
7643
7645
  function renderNextFrame$1(state, options) {
7644
7646
  return gen(function* () {
7645
7647
  const columns = yield* (yield* Terminal).columns;
7646
- const figures$3 = yield* figures;
7647
- const promptMsg = renderOutput$1(state, annotate(text$11("?"), cyanBright), annotate(figures$3.pointerSmall, blackBright), options);
7648
- const errorMsg = renderError(state, figures$3.pointerSmall);
7648
+ const figures$4 = yield* figures;
7649
+ const promptMsg = renderOutput$1(state, annotate(text$11("?"), cyanBright), annotate(figures$4.pointerSmall, blackBright), options);
7650
+ const errorMsg = renderError(state, figures$4.pointerSmall);
7649
7651
  const offset = state.cursor - state.value.length;
7650
7652
  return promptMsg.pipe(cat(errorMsg), cat(cursorMove(offset)), optimize(Deep), render$3({
7651
7653
  style: "pretty",
@@ -7656,8 +7658,8 @@ function renderNextFrame$1(state, options) {
7656
7658
  function renderSubmission$1(state, options) {
7657
7659
  return gen(function* () {
7658
7660
  const columns = yield* (yield* Terminal).columns;
7659
- const figures$4 = yield* figures;
7660
- return renderOutput$1(state, annotate(figures$4.tick, green), annotate(figures$4.ellipsis, blackBright), options, true).pipe(cat(hardLine), optimize(Deep), render$3({
7661
+ const figures$3 = yield* figures;
7662
+ return renderOutput$1(state, annotate(figures$3.tick, green), annotate(figures$3.ellipsis, blackBright), options, true).pipe(cat(hardLine), optimize(Deep), render$3({
7661
7663
  style: "pretty",
7662
7664
  options: { lineWidth: columns }
7663
7665
  }));
@@ -7815,10 +7817,10 @@ function renderOutput(toggle, leadingSymbol, trailingSymbol, options) {
7815
7817
  function renderNextFrame(state, options) {
7816
7818
  return gen(function* () {
7817
7819
  const terminal = yield* Terminal;
7818
- const figures$2 = yield* figures;
7820
+ const figures$1 = yield* figures;
7819
7821
  const columns = yield* terminal.columns;
7820
7822
  const leadingSymbol = annotate(text$11("?"), cyanBright);
7821
- const trailingSymbol = annotate(figures$2.pointerSmall, blackBright);
7823
+ const trailingSymbol = annotate(figures$1.pointerSmall, blackBright);
7822
7824
  const promptMsg = renderOutput(renderToggle(state, options), leadingSymbol, trailingSymbol, options);
7823
7825
  return cursorHide.pipe(cat(promptMsg), optimize(Deep), render$3({
7824
7826
  style: "pretty",
@@ -7829,10 +7831,10 @@ function renderNextFrame(state, options) {
7829
7831
  function renderSubmission(value, options) {
7830
7832
  return gen(function* () {
7831
7833
  const terminal = yield* Terminal;
7832
- const figures$1 = yield* figures;
7834
+ const figures$2 = yield* figures;
7833
7835
  const columns = yield* terminal.columns;
7834
- const leadingSymbol = annotate(figures$1.tick, green);
7835
- const trailingSymbol = annotate(figures$1.ellipsis, blackBright);
7836
+ const leadingSymbol = annotate(figures$2.tick, green);
7837
+ const trailingSymbol = annotate(figures$2.ellipsis, blackBright);
7836
7838
  return renderOutput(renderToggle(value, options, true), leadingSymbol, trailingSymbol, options).pipe(cat(hardLine), optimize(Deep), render$3({
7837
7839
  style: "pretty",
7838
7840
  options: { lineWidth: columns }
@@ -7939,7 +7941,10 @@ const wizard$3 = /*#__PURE__*/ dual(2, (self, help) => wizardInternal$3(self, he
7939
7941
  const getChoicesInternal = (self) => {
7940
7942
  switch (self._tag) {
7941
7943
  case "Bool": return some("true | false");
7942
- case "Choice": return some(pipe(map$13(self.alternatives, ([choice]) => choice), join$4(" | ")));
7944
+ case "Choice": {
7945
+ const choices = pipe(map$13(self.alternatives, ([choice]) => choice), join$4(" | "));
7946
+ return some(choices);
7947
+ }
7943
7948
  case "DateTime": return some("date");
7944
7949
  case "Float":
7945
7950
  case "Integer":
@@ -8133,7 +8138,10 @@ const getFishCompletions$3 = (self) => {
8133
8138
  case "directory": return self.pathExists === "yes" || self.pathExists === "either" ? make$38("-r", "-f", "-a", `"(__fish_complete_directories (commandline -ct))"`) : make$38("-r");
8134
8139
  case "either": return self.pathExists === "yes" || self.pathExists === "either" ? make$38("-r", "-F") : make$38("-r");
8135
8140
  }
8136
- case "Choice": return make$38("-r", "-f", "-a", `"{${pipe(map$13(self.alternatives, ([choice]) => `${choice}''`), join$4(","))}}"`);
8141
+ case "Choice": {
8142
+ const choices = pipe(map$13(self.alternatives, ([choice]) => `${choice}''`), join$4(","));
8143
+ return make$38("-r", "-f", "-a", `"{${choices}}"`);
8144
+ }
8137
8145
  }
8138
8146
  };
8139
8147
  /** @internal */
@@ -8192,7 +8200,8 @@ const getHelp$3 = (self) => {
8192
8200
  const spans = enumerate(self, defaultConfig);
8193
8201
  if (isNonEmptyReadonlyArray(spans)) {
8194
8202
  const head = headNonEmpty(spans);
8195
- if (isNonEmptyReadonlyArray(tailNonEmpty(spans))) return pipe(map$13(spans, (span) => p$1(span)), reduceRight(empty$6, (left, right) => sequence(left, right)));
8203
+ const tail = tailNonEmpty(spans);
8204
+ if (isNonEmptyReadonlyArray(tail)) return pipe(map$13(spans, (span) => p$1(span)), reduceRight(empty$6, (left, right) => sequence(left, right)));
8196
8205
  return p$1(head);
8197
8206
  }
8198
8207
  return empty$6;
@@ -8364,18 +8373,20 @@ const isArgs = (u) => typeof u === "object" && u != null && ArgsTypeId in u;
8364
8373
  const isEmpty$1 = (self) => self._tag === "Empty";
8365
8374
  /** @internal */
8366
8375
  const all$4 = function() {
8367
- if (arguments.length === 1) if (isArgs(arguments[0])) return map$2(arguments[0], (x) => [x]);
8368
- else if (isArray$1(arguments[0])) return allTupled$1(arguments[0]);
8369
- else {
8370
- const entries = Object.entries(arguments[0]);
8371
- let result = map$2(entries[0][1], (value) => ({ [entries[0][0]]: value }));
8372
- if (entries.length === 1) return result;
8373
- const rest = entries.slice(1);
8374
- for (const [key, options] of rest) result = map$2(makeBoth$1(result, options), ([record, value]) => ({
8375
- ...record,
8376
- [key]: value
8377
- }));
8378
- return result;
8376
+ if (arguments.length === 1) {
8377
+ if (isArgs(arguments[0])) return map$2(arguments[0], (x) => [x]);
8378
+ else if (isArray$1(arguments[0])) return allTupled$1(arguments[0]);
8379
+ else {
8380
+ const entries = Object.entries(arguments[0]);
8381
+ let result = map$2(entries[0][1], (value) => ({ [entries[0][0]]: value }));
8382
+ if (entries.length === 1) return result;
8383
+ const rest = entries.slice(1);
8384
+ for (const [key, options] of rest) result = map$2(makeBoth$1(result, options), ([record, value]) => ({
8385
+ ...record,
8386
+ [key]: value
8387
+ }));
8388
+ return result;
8389
+ }
8379
8390
  }
8380
8391
  return allTupled$1(arguments[0]);
8381
8392
  };
@@ -8433,7 +8444,8 @@ const getHelpInternal$2 = (self) => {
8433
8444
  const optionalDescription = isOption(self.fallback) ? match$4(self.fallback, {
8434
8445
  onNone: () => p$1("This setting is optional."),
8435
8446
  onSome: (fallbackValue) => {
8436
- const displayValue = toStringUnknown(isObject(fallbackValue) ? fallbackValue : String(fallbackValue), 0);
8447
+ const inspectableValue = isObject(fallbackValue) ? fallbackValue : String(fallbackValue);
8448
+ const displayValue = toStringUnknown(inspectableValue, 0);
8437
8449
  return p$1(`This setting is optional. Defaults to: ${displayValue}`);
8438
8450
  }
8439
8451
  }) : p$1("This setting is optional.");
@@ -8558,7 +8570,8 @@ const validateInternal = (self, args, config) => {
8558
8570
  case "WithFallbackConfig": return validateInternal(self.args, args, config).pipe(catchTag("MissingValue", (e) => map$9(catchAll$1(self.config, (e2) => {
8559
8571
  if (isMissingDataOnly(e2)) {
8560
8572
  const help = p$1(String(e2));
8561
- return fail$8(invalidValue(help));
8573
+ const error = invalidValue(help);
8574
+ return fail$8(error);
8562
8575
  }
8563
8576
  return fail$8(e);
8564
8577
  }), (value) => [args, value])));
@@ -8656,7 +8669,11 @@ const getZshCompletions$2 = (self, state = {
8656
8669
  return possibleValues.length === 0 ? empty$15() : of$2(`${multiple}${optional}${self.name}${description}${possibleValues}`);
8657
8670
  }
8658
8671
  case "Map": return getZshCompletions$2(self.args, state);
8659
- case "Both": return appendAll$1(getZshCompletions$2(self.left, state), getZshCompletions$2(self.right, state));
8672
+ case "Both": {
8673
+ const left = getZshCompletions$2(self.left, state);
8674
+ const right = getZshCompletions$2(self.right, state);
8675
+ return appendAll$1(left, right);
8676
+ }
8660
8677
  case "Variadic": return isSome(self.max) && self.max.value > 1 ? getZshCompletions$2(self.args, {
8661
8678
  ...state,
8662
8679
  multiple: true
@@ -8732,18 +8749,20 @@ const isEmpty = (self) => self._tag === "Empty";
8732
8749
  const isSingle = (self) => self._tag === "Single";
8733
8750
  /** @internal */
8734
8751
  const all$3 = function() {
8735
- if (arguments.length === 1) if (isOptions(arguments[0])) return map$1(arguments[0], (x) => [x]);
8736
- else if (isArray$1(arguments[0])) return allTupled(arguments[0]);
8737
- else {
8738
- const entries = Object.entries(arguments[0]);
8739
- let result = map$1(entries[0][1], (value) => ({ [entries[0][0]]: value }));
8740
- if (entries.length === 1) return result;
8741
- const rest = entries.slice(1);
8742
- for (const [key, options] of rest) result = map$1(makeBoth(result, options), ([record, value]) => ({
8743
- ...record,
8744
- [key]: value
8745
- }));
8746
- return result;
8752
+ if (arguments.length === 1) {
8753
+ if (isOptions(arguments[0])) return map$1(arguments[0], (x) => [x]);
8754
+ else if (isArray$1(arguments[0])) return allTupled(arguments[0]);
8755
+ else {
8756
+ const entries = Object.entries(arguments[0]);
8757
+ let result = map$1(entries[0][1], (value) => ({ [entries[0][0]]: value }));
8758
+ if (entries.length === 1) return result;
8759
+ const rest = entries.slice(1);
8760
+ for (const [key, options] of rest) result = map$1(makeBoth(result, options), ([record, value]) => ({
8761
+ ...record,
8762
+ [key]: value
8763
+ }));
8764
+ return result;
8765
+ }
8747
8766
  }
8748
8767
  return allTupled(arguments[0]);
8749
8768
  };
@@ -8862,7 +8881,8 @@ const getHelpInternal$1 = (self) => {
8862
8881
  const optionalDescription = isOption(self.fallback) ? match$4(self.fallback, {
8863
8882
  onNone: () => p$1("This setting is optional."),
8864
8883
  onSome: (fallbackValue) => {
8865
- const displayValue = toStringUnknown(isObject(fallbackValue) ? fallbackValue : String(fallbackValue), 0);
8884
+ const inspectableValue = isObject(fallbackValue) ? fallbackValue : String(fallbackValue);
8885
+ const displayValue = toStringUnknown(inspectableValue, 0);
8866
8886
  return p$1(`This setting is optional. Defaults to: ${displayValue}`);
8867
8887
  }
8868
8888
  }) : p$1("This setting is optional.");
@@ -8879,10 +8899,13 @@ const getIdentifierInternal = (self) => {
8879
8899
  case "Empty": return none$3();
8880
8900
  case "Single": return some(self.fullName);
8881
8901
  case "Both":
8882
- case "OrElse": return match$6(getSomes([getIdentifierInternal(self.left), getIdentifierInternal(self.right)]), {
8883
- onEmpty: () => none$3(),
8884
- onNonEmpty: (ids) => some(join$4(ids, ", "))
8885
- });
8902
+ case "OrElse": {
8903
+ const ids = getSomes([getIdentifierInternal(self.left), getIdentifierInternal(self.right)]);
8904
+ return match$6(ids, {
8905
+ onEmpty: () => none$3(),
8906
+ onNonEmpty: (ids) => some(join$4(ids, ", "))
8907
+ });
8908
+ }
8886
8909
  case "KeyValueMap":
8887
8910
  case "Variadic": return getIdentifierInternal(self.argumentOption);
8888
8911
  case "Map":
@@ -9040,7 +9063,11 @@ const getNames$1 = (self) => {
9040
9063
  case "WithDefault":
9041
9064
  case "WithFallback": return loop(self.options);
9042
9065
  case "Both":
9043
- case "OrElse": return appendAll$1(loop(self.left), loop(self.right));
9066
+ case "OrElse": {
9067
+ const left = loop(self.left);
9068
+ const right = loop(self.right);
9069
+ return appendAll$1(left, right);
9070
+ }
9044
9071
  }
9045
9072
  };
9046
9073
  const order = mapInput(boolean$3, (tuple) => !tuple[0]);
@@ -9068,7 +9095,8 @@ const parseInternal$1 = (self, args, config) => {
9068
9095
  const singleNames = filterMap(getNames$1(self), (name) => get$23(args, name));
9069
9096
  if (isNonEmptyReadonlyArray(singleNames)) {
9070
9097
  const head = headNonEmpty(singleNames);
9071
- if (isEmptyReadonlyArray(tailNonEmpty(singleNames))) {
9098
+ const tail = tailNonEmpty(singleNames);
9099
+ if (isEmptyReadonlyArray(tail)) {
9072
9100
  if (isEmptyReadonlyArray(head)) return validate$3(self.primitiveType, none$3(), config).pipe(mapError$3((e) => invalidValue(p$1(e))));
9073
9101
  if (isNonEmptyReadonlyArray(head) && isEmptyReadonlyArray(tailNonEmpty(head))) {
9074
9102
  const value = headNonEmpty(head);
@@ -9147,7 +9175,8 @@ const parseInternal$1 = (self, args, config) => {
9147
9175
  if (isTagged(e2, "QuitException")) return die$2(e2);
9148
9176
  if (isConfigError(e2) && !isMissingDataOnly(e2)) {
9149
9177
  const help = p$1(String(e2));
9150
- return fail$8(invalidValue(help));
9178
+ const error = invalidValue(help);
9179
+ return fail$8(error);
9151
9180
  }
9152
9181
  return fail$8(e);
9153
9182
  }))));
@@ -9347,34 +9376,42 @@ const parseCommandLine = (self, args, config) => {
9347
9376
  if (contains(normalizedNames, normalizedHead)) {
9348
9377
  if (isBool(self.primitiveType)) return matchLeft(tail, {
9349
9378
  onEmpty: () => {
9379
+ const parsed = some({
9380
+ name: head,
9381
+ values: empty$15()
9382
+ });
9350
9383
  return succeed$7({
9351
- parsed: some({
9352
- name: head,
9353
- values: empty$15()
9354
- }),
9384
+ parsed,
9355
9385
  leftover: tail
9356
9386
  });
9357
9387
  },
9358
9388
  onNonEmpty: (value, leftover) => {
9359
- if (isTrueValue(value)) return succeed$7({
9360
- parsed: some({
9389
+ if (isTrueValue(value)) {
9390
+ const parsed = some({
9361
9391
  name: head,
9362
9392
  values: of$2("true")
9363
- }),
9364
- leftover
9365
- });
9366
- if (isFalseValue(value)) return succeed$7({
9367
- parsed: some({
9393
+ });
9394
+ return succeed$7({
9395
+ parsed,
9396
+ leftover
9397
+ });
9398
+ }
9399
+ if (isFalseValue(value)) {
9400
+ const parsed = some({
9368
9401
  name: head,
9369
9402
  values: of$2("false")
9370
- }),
9371
- leftover
9403
+ });
9404
+ return succeed$7({
9405
+ parsed,
9406
+ leftover
9407
+ });
9408
+ }
9409
+ const parsed = some({
9410
+ name: head,
9411
+ values: empty$15()
9372
9412
  });
9373
9413
  return succeed$7({
9374
- parsed: some({
9375
- name: head,
9376
- values: empty$15()
9377
- }),
9414
+ parsed,
9378
9415
  leftover: tail
9379
9416
  });
9380
9417
  }
@@ -9385,11 +9422,12 @@ const parseCommandLine = (self, args, config) => {
9385
9422
  return fail$8(missingValue(error));
9386
9423
  },
9387
9424
  onNonEmpty: (value, leftover) => {
9425
+ const parsed = some({
9426
+ name: head,
9427
+ values: of$2(value)
9428
+ });
9388
9429
  return succeed$7({
9389
- parsed: some({
9390
- name: head,
9391
- values: of$2(value)
9392
- }),
9430
+ parsed,
9393
9431
  leftover
9394
9432
  });
9395
9433
  }
@@ -9407,13 +9445,15 @@ const parseCommandLine = (self, args, config) => {
9407
9445
  let equalsValue = void 0;
9408
9446
  for (let i = 0; i < tail.length; i++) {
9409
9447
  const arg = tail[i];
9410
- if (contains(normalizedNames, normalize(arg))) {
9448
+ const normalizedArg = normalize(arg);
9449
+ if (contains(normalizedNames, normalizedArg)) {
9411
9450
  optionIndex = i;
9412
9451
  break;
9413
9452
  }
9414
9453
  const flagMatch = FLAG_REGEX.exec(arg);
9415
9454
  if (flagMatch !== null) {
9416
- if (contains(normalizedNames, normalize(flagMatch[1]))) {
9455
+ const normalizedFlag = normalize(flagMatch[1]);
9456
+ if (contains(normalizedNames, normalizedFlag)) {
9417
9457
  optionIndex = i;
9418
9458
  equalsValue = flagMatch[2];
9419
9459
  break;
@@ -9430,64 +9470,88 @@ const parseCommandLine = (self, args, config) => {
9430
9470
  const afterOption = tail.slice(optionIndex + 1);
9431
9471
  if (isBool(self.primitiveType)) {
9432
9472
  if (equalsValue !== void 0) {
9433
- if (isTrueValue(equalsValue)) return succeed$7({
9434
- parsed: some({
9473
+ if (isTrueValue(equalsValue)) {
9474
+ const parsed = some({
9435
9475
  name: optionName,
9436
9476
  values: of$2("true")
9437
- }),
9438
- leftover: appendAll$1(beforeOption, afterOption)
9439
- });
9440
- if (isFalseValue(equalsValue)) return succeed$7({
9441
- parsed: some({
9477
+ });
9478
+ const leftover = appendAll$1(beforeOption, afterOption);
9479
+ return succeed$7({
9480
+ parsed,
9481
+ leftover
9482
+ });
9483
+ }
9484
+ if (isFalseValue(equalsValue)) {
9485
+ const parsed = some({
9442
9486
  name: optionName,
9443
9487
  values: of$2("false")
9444
- }),
9445
- leftover: appendAll$1(beforeOption, afterOption)
9446
- });
9488
+ });
9489
+ const leftover = appendAll$1(beforeOption, afterOption);
9490
+ return succeed$7({
9491
+ parsed,
9492
+ leftover
9493
+ });
9494
+ }
9447
9495
  }
9448
9496
  if (afterOption.length > 0) {
9449
9497
  const nextValue = afterOption[0];
9450
- if (isTrueValue(nextValue)) return succeed$7({
9451
- parsed: some({
9498
+ if (isTrueValue(nextValue)) {
9499
+ const parsed = some({
9452
9500
  name: optionName,
9453
9501
  values: of$2("true")
9454
- }),
9455
- leftover: appendAll$1(beforeOption, afterOption.slice(1))
9456
- });
9457
- if (isFalseValue(nextValue)) return succeed$7({
9458
- parsed: some({
9502
+ });
9503
+ const leftover = appendAll$1(beforeOption, afterOption.slice(1));
9504
+ return succeed$7({
9505
+ parsed,
9506
+ leftover
9507
+ });
9508
+ }
9509
+ if (isFalseValue(nextValue)) {
9510
+ const parsed = some({
9459
9511
  name: optionName,
9460
9512
  values: of$2("false")
9461
- }),
9462
- leftover: appendAll$1(beforeOption, afterOption.slice(1))
9463
- });
9513
+ });
9514
+ const leftover = appendAll$1(beforeOption, afterOption.slice(1));
9515
+ return succeed$7({
9516
+ parsed,
9517
+ leftover
9518
+ });
9519
+ }
9464
9520
  }
9521
+ const parsed = some({
9522
+ name: optionName,
9523
+ values: empty$15()
9524
+ });
9525
+ const leftover = appendAll$1(beforeOption, afterOption);
9465
9526
  return succeed$7({
9466
- parsed: some({
9467
- name: optionName,
9468
- values: empty$15()
9469
- }),
9470
- leftover: appendAll$1(beforeOption, afterOption)
9527
+ parsed,
9528
+ leftover
9471
9529
  });
9472
9530
  }
9473
- if (equalsValue !== void 0) return succeed$7({
9474
- parsed: some({
9531
+ if (equalsValue !== void 0) {
9532
+ const parsed = some({
9475
9533
  name: optionName,
9476
9534
  values: of$2(equalsValue)
9477
- }),
9478
- leftover: appendAll$1(beforeOption, afterOption)
9479
- });
9535
+ });
9536
+ const leftover = appendAll$1(beforeOption, afterOption);
9537
+ return succeed$7({
9538
+ parsed,
9539
+ leftover
9540
+ });
9541
+ }
9480
9542
  if (afterOption.length === 0) {
9481
9543
  const error = p$1(`Expected a value following option: '${self.fullName}'`);
9482
9544
  return fail$8(missingValue(error));
9483
9545
  }
9484
9546
  const optionValue = afterOption[0];
9547
+ const parsed = some({
9548
+ name: optionName,
9549
+ values: of$2(optionValue)
9550
+ });
9551
+ const leftover = appendAll$1(beforeOption, afterOption.slice(1));
9485
9552
  return succeed$7({
9486
- parsed: some({
9487
- name: optionName,
9488
- values: of$2(optionValue)
9489
- }),
9490
- leftover: appendAll$1(beforeOption, afterOption.slice(1))
9553
+ parsed,
9554
+ leftover
9491
9555
  });
9492
9556
  }
9493
9557
  })));
@@ -9576,7 +9640,8 @@ const parseCommandLine = (self, args, config) => {
9576
9640
  let leftover = empty$15();
9577
9641
  while (isNonEmptyReadonlyArray(unparsed)) {
9578
9642
  const name = headNonEmpty(unparsed);
9579
- if (contains(normalizedNames, normalizeCase(config, name))) {
9643
+ const normalizedName = normalizeCase(config, name);
9644
+ if (contains(normalizedNames, normalizedName)) {
9580
9645
  if (optionName === void 0) optionName = name;
9581
9646
  const value = unparsed[1];
9582
9647
  if (value !== void 0 && value.length > 0) values = append$5(values, value.trim());
@@ -9586,11 +9651,12 @@ const parseCommandLine = (self, args, config) => {
9586
9651
  unparsed = unparsed.slice(1);
9587
9652
  }
9588
9653
  }
9654
+ const parsed = fromNullable(optionName).pipe(orElse$3(() => some(self.argumentOption.fullName)), map$14((name) => ({
9655
+ name,
9656
+ values
9657
+ })));
9589
9658
  return succeed$7({
9590
- parsed: fromNullable(optionName).pipe(orElse$3(() => some(self.argumentOption.fullName)), map$14((name) => ({
9591
- name,
9592
- values
9593
- }))),
9659
+ parsed,
9594
9660
  leftover
9595
9661
  });
9596
9662
  }
@@ -9649,7 +9715,8 @@ const getBashCompletions$1 = (self) => {
9649
9715
  switch (self._tag) {
9650
9716
  case "Empty": return empty$15();
9651
9717
  case "Single": {
9652
- const cases = join$4(getNames$1(self), "|");
9718
+ const names = getNames$1(self);
9719
+ const cases = join$4(names, "|");
9653
9720
  const compgen = getBashCompletions$2(self.primitiveType);
9654
9721
  return make$38(`${cases})`, ` COMPREPLY=( ${compgen} )`, ` return 0`, ` ;;`);
9655
9722
  }
@@ -9659,7 +9726,11 @@ const getBashCompletions$1 = (self) => {
9659
9726
  case "WithDefault":
9660
9727
  case "WithFallback": return getBashCompletions$1(self.options);
9661
9728
  case "Both":
9662
- case "OrElse": return appendAll$1(getBashCompletions$1(self.left), getBashCompletions$1(self.right));
9729
+ case "OrElse": {
9730
+ const left = getBashCompletions$1(self.left);
9731
+ const right = getBashCompletions$1(self.right);
9732
+ return appendAll$1(left, right);
9733
+ }
9663
9734
  }
9664
9735
  };
9665
9736
  /** @internal */
@@ -9702,17 +9773,23 @@ const getZshCompletions$1 = (self, state = {
9702
9773
  case "Map":
9703
9774
  case "WithDefault":
9704
9775
  case "WithFallback": return getZshCompletions$1(self.options, state);
9705
- case "Both": return appendAll$1(getZshCompletions$1(self.left, state), getZshCompletions$1(self.right, state));
9776
+ case "Both": {
9777
+ const left = getZshCompletions$1(self.left, state);
9778
+ const right = getZshCompletions$1(self.right, state);
9779
+ return appendAll$1(left, right);
9780
+ }
9706
9781
  case "OrElse": {
9707
9782
  const leftNames = getNames$1(self.left);
9708
9783
  const rightNames = getNames$1(self.right);
9709
- return appendAll$1(getZshCompletions$1(self.left, {
9784
+ const left = getZshCompletions$1(self.left, {
9710
9785
  ...state,
9711
9786
  conflicts: appendAll$1(state.conflicts, rightNames)
9712
- }), getZshCompletions$1(self.right, {
9787
+ });
9788
+ const right = getZshCompletions$1(self.right, {
9713
9789
  ...state,
9714
9790
  conflicts: appendAll$1(state.conflicts, leftNames)
9715
- }));
9791
+ });
9792
+ return appendAll$1(left, right);
9716
9793
  }
9717
9794
  case "Variadic": return isSome(self.max) && self.max.value > 1 ? getZshCompletions$1(self.argumentOption, {
9718
9795
  ...state,
@@ -10005,11 +10082,17 @@ const getHelpInternal = (self, config) => {
10005
10082
  const getUsage = (command, preceding) => {
10006
10083
  switch (command._tag) {
10007
10084
  case "Standard":
10008
- case "GetUserInput": return of$2([reduce$2(append$5(preceding, getSpan(getHelp$3(getUsageInternal(command)))), empty$7, (acc, next) => isText$2(acc) && acc.value === "" ? next : isText$2(next) && next.value === "" ? acc : spans([
10009
- acc,
10010
- space,
10011
- next
10012
- ])), getSpan(command.description)]);
10085
+ case "GetUserInput": {
10086
+ const usage = getSpan(getHelp$3(getUsageInternal(command)));
10087
+ const usages = append$5(preceding, usage);
10088
+ const finalUsage = reduce$2(usages, empty$7, (acc, next) => isText$2(acc) && acc.value === "" ? next : isText$2(next) && next.value === "" ? acc : spans([
10089
+ acc,
10090
+ space,
10091
+ next
10092
+ ]));
10093
+ const description = getSpan(command.description);
10094
+ return of$2([finalUsage, description]);
10095
+ }
10013
10096
  case "Map": return getUsage(command.command, preceding);
10014
10097
  case "Subcommands": {
10015
10098
  const parentUsage = getUsage(command.parent, preceding);
@@ -10156,7 +10239,8 @@ const parseInternal = (self, args, config) => {
10156
10239
  const helpDirectiveForChild = parseChildren.pipe(flatMap$5((directive) => {
10157
10240
  if (isBuiltIn(directive) && isShowHelp(directive.option)) {
10158
10241
  const parentName = getOrElse(head$2(names), () => "");
10159
- return succeed$7(builtIn(showHelp(concat(named(of$2(parentName), none$3()), directive.option.usage), directive.option.helpDoc)));
10242
+ const newDirective = builtIn(showHelp(concat(named(of$2(parentName), none$3()), directive.option.usage), directive.option.helpDoc));
10243
+ return succeed$7(newDirective);
10160
10244
  }
10161
10245
  return fail$8(invalidArgument(empty$6));
10162
10246
  }));
@@ -10266,13 +10350,15 @@ const wizardInternal = (self, prefix, config) => {
10266
10350
  if (!isEmpty(self.options)) {
10267
10351
  const message = p$1(concat$1(optionsWizardHeader, commandName));
10268
10352
  yield* log(toAnsiText(message));
10269
- yield* updateAndGet(commandLineRef, appendAll$1(yield* wizard$1(self.options, config)));
10353
+ const options = yield* wizard$1(self.options, config);
10354
+ yield* updateAndGet(commandLineRef, appendAll$1(options));
10270
10355
  yield* logCurrentCommand;
10271
10356
  }
10272
10357
  if (!isEmpty$1(self.args)) {
10273
10358
  const message = p$1(concat$1(argsWizardHeader, commandName));
10274
10359
  yield* log(toAnsiText(message));
10275
- yield* updateAndGet(commandLineRef, appendAll$1(yield* wizard$2(self.args, config)));
10360
+ const options = yield* wizard$2(self.args, config);
10361
+ yield* updateAndGet(commandLineRef, appendAll$1(options));
10276
10362
  yield* logCurrentCommand;
10277
10363
  }
10278
10364
  }
@@ -10348,15 +10434,17 @@ const getBashCompletionsInternal = (self, executable) => traverseCommand(self, e
10348
10434
  const options = isStandard(info.command) ? all$2([info.command.options, builtIns]) : builtIns;
10349
10435
  const optionNames = getNames$1(options);
10350
10436
  const optionCases = isStandard(info.command) ? getBashCompletions$1(info.command.options) : empty$15();
10351
- const wordList = appendAll$1(optionNames, pipe(info.subcommands, map$13(([name]) => name), sort$2(string$1)));
10437
+ const subcommandNames = pipe(info.subcommands, map$13(([name]) => name), sort$2(string$1));
10438
+ const wordList = appendAll$1(optionNames, subcommandNames);
10352
10439
  const preformatted = isEmptyReadonlyArray(info.parentCommands) ? of$2(info.command.name) : pipe(info.parentCommands, append$5(info.command.name), map$13((command) => command.replaceAll("-", "__")));
10353
10440
  const caseName = join$4(preformatted, ",");
10354
10441
  const funcName = join$4(preformatted, "__");
10355
- return succeed$7(append$5(state, [isEmptyReadonlyArray(info.parentCommands) ? empty$15() : [
10442
+ const funcLines = isEmptyReadonlyArray(info.parentCommands) ? empty$15() : [
10356
10443
  `${caseName})`,
10357
10444
  ` cmd="${funcName}"`,
10358
10445
  " ;;"
10359
- ], [
10446
+ ];
10447
+ const cmdLines = [
10360
10448
  `${funcName})`,
10361
10449
  ` opts="${join$4(wordList, " ")}"`,
10362
10450
  ` if [[ \${cur} == -* || \${COMP_CWORD} -eq ${info.level + 1} ]] ; then`,
@@ -10372,7 +10460,9 @@ const getBashCompletionsInternal = (self, executable) => traverseCommand(self, e
10372
10460
  " COMPREPLY=( $(compgen -W \"${opts}\" -- \"${cur}\") )",
10373
10461
  " return 0",
10374
10462
  " ;;"
10375
- ]]));
10463
+ ];
10464
+ const lines = append$5(state, [funcLines, cmdLines]);
10465
+ return succeed$7(lines);
10376
10466
  }).pipe(map$9((lines) => {
10377
10467
  const rootCommand = unsafeGet$1(getNamesInternal(self), 0);
10378
10468
  const scriptName = `_${rootCommand}_bash_completions`;
@@ -10417,7 +10507,10 @@ const getFishCompletionsInternal = (self, executable) => traverseCommand(self, e
10417
10507
  const conditionals = make$38("-n", "\"__fish_use_subcommand\"");
10418
10508
  return succeed$7(pipe(state, appendAll$1(rootCompletions(conditionals)), appendAll$1(subcommandCompletions(conditionals))));
10419
10509
  }
10420
- const conditionals = make$38("-n", `"${pipe(appendAll$1(pipe(info.parentCommands, drop$1(1), append$5(info.command.name), map$13((command) => `__fish_seen_subcommand_from ${command}`)), map$13(info.subcommands, ([name]) => `not __fish_seen_subcommand_from ${name}`)), join$4("; and "))}"`);
10510
+ const parentConditionals = pipe(info.parentCommands, drop$1(1), append$5(info.command.name), map$13((command) => `__fish_seen_subcommand_from ${command}`));
10511
+ const subcommandConditionals = map$13(info.subcommands, ([name]) => `not __fish_seen_subcommand_from ${name}`);
10512
+ const baseConditionals = pipe(appendAll$1(parentConditionals, subcommandConditionals), join$4("; and "));
10513
+ const conditionals = make$38("-n", `"${baseConditionals}"`);
10421
10514
  return succeed$7(pipe(state, appendAll$1(rootCompletions(conditionals)), appendAll$1(subcommandCompletions(conditionals))));
10422
10515
  });
10423
10516
  const getZshCompletionsInternal = (self, executable) => traverseCommand(self, empty$15(), (state, info) => {
@@ -10428,13 +10521,14 @@ const getZshCompletionsInternal = (self, executable) => traverseCommand(self, em
10428
10521
  return `'${name}:${getShortDescription(subcommand)}' \\`;
10429
10522
  }));
10430
10523
  const commands = isEmptyReadonlyArray(subcommands) ? `commands=()` : `commands=(\n${join$4(indentAll(subcommands, 8), "\n")}\n )`;
10431
- return succeed$7(appendAll$1(state, [
10524
+ const handlerLines = [
10432
10525
  `(( $+functions[_${underscoreName}_commands] )) ||`,
10433
10526
  `_${underscoreName}_commands() {`,
10434
10527
  ` local commands; ${commands}`,
10435
10528
  ` _describe -t commands '${spaceName} commands' commands "$@"`,
10436
10529
  "}"
10437
- ]));
10530
+ ];
10531
+ return succeed$7(appendAll$1(state, handlerLines));
10438
10532
  }).pipe(map$9((handlers) => {
10439
10533
  const rootCommand = unsafeGet$1(getNamesInternal(self), 0);
10440
10534
  const cases = getZshSubcommandCases(self, empty$15(), empty$15());
@@ -10509,7 +10603,7 @@ const getZshSubcommandCases = (self, parentCommands, subcommands) => {
10509
10603
  const parentLines = getZshSubcommandCases(self.parent, parentCommands, appendAll$1(subcommands, nextSubcommands));
10510
10604
  const childCases = pipe(self.children, flatMap$7((child) => getZshSubcommandCases(child, appendAll$1(parentCommands, parentNames), subcommands)));
10511
10605
  const hyphenName = pipe(appendAll$1(parentCommands, parentNames), join$4("-"));
10512
- return appendAll$1(parentLines, pipe(parentNames, flatMap$7((parentName) => [
10606
+ const childLines = pipe(parentNames, flatMap$7((parentName) => [
10513
10607
  "case $state in",
10514
10608
  ` (${parentName})`,
10515
10609
  ` words=($line[1] "\${words[@]}")`,
@@ -10520,7 +10614,8 @@ const getZshSubcommandCases = (self, parentCommands, subcommands) => {
10520
10614
  " esac",
10521
10615
  " ;;",
10522
10616
  "esac"
10523
- ]), appendAll$1(isEmptyReadonlyArray(parentCommands) ? empty$15() : of$2(";;"))));
10617
+ ]), appendAll$1(isEmptyReadonlyArray(parentCommands) ? empty$15() : of$2(";;")));
10618
+ return appendAll$1(parentLines, childLines);
10524
10619
  }
10525
10620
  }
10526
10621
  };
@@ -10639,7 +10734,9 @@ const handleBuiltInOption = (self, executable, args, builtIn, execute, config, o
10639
10734
  active: "yes",
10640
10735
  inactive: "no"
10641
10736
  }).pipe(flatMap$5((shouldRunCommand) => {
10642
- const finalArgs = appendAll$1(take$3(originalArgs, 2), drop$1(args, 1));
10737
+ const baseArgs = take$3(originalArgs, 2);
10738
+ const wizardArgs = drop$1(args, 1);
10739
+ const finalArgs = appendAll$1(baseArgs, wizardArgs);
10643
10740
  return shouldRunCommand ? log().pipe(zipRight$3(run$5(self, finalArgs, execute))) : _void;
10644
10741
  }))), catchAll$1((e) => {
10645
10742
  if (isQuitException(e)) {
@@ -10670,9 +10767,7 @@ const prefixCommand = (self) => {
10670
10767
  case "Map":
10671
10768
  command = command.command;
10672
10769
  break;
10673
- case "Subcommands":
10674
- command = command.parent;
10675
- break;
10770
+ case "Subcommands": command = command.parent;
10676
10771
  }
10677
10772
  return prefix;
10678
10773
  };
@@ -10809,7 +10904,8 @@ const withSubcommands$1 = /*#__PURE__*/ dual(2, (self, subcommands) => {
10809
10904
  if (args.subcommand._tag === "Some") {
10810
10905
  const [tag, value] = args.subcommand.value;
10811
10906
  const subcommand = subcommandMap.get(tag);
10812
- return provideService(subcommand.transform(subcommand.handler(value), value), self.tag, args);
10907
+ const subcommandEffect = subcommand.transform(subcommand.handler(value), value);
10908
+ return provideService(subcommandEffect, self.tag, args);
10813
10909
  }
10814
10910
  return self.handler(args);
10815
10911
  }
@@ -10865,7 +10961,6 @@ const TypeId$11 = /*#__PURE__*/ Symbol.for("@effect/platform/Cookies");
10865
10961
  * @category type ids
10866
10962
  */
10867
10963
  const CookieTypeId = /*#__PURE__*/ Symbol.for("@effect/platform/Cookies/Cookie");
10868
- TypeIdError(/* @__PURE__ */ Symbol.for("@effect/platform/Cookies/CookieError"), "CookieError");
10869
10964
  const Proto$4 = {
10870
10965
  [TypeId$11]: TypeId$11,
10871
10966
  ...BaseProto,
@@ -10968,9 +11063,7 @@ function parseSetCookie(header) {
10968
11063
  case "medium":
10969
11064
  options.priority = "medium";
10970
11065
  break;
10971
- case "high":
10972
- options.priority = "high";
10973
- break;
11066
+ case "high": options.priority = "high";
10974
11067
  }
10975
11068
  break;
10976
11069
  case "httponly":
@@ -10991,11 +11084,8 @@ function parseSetCookie(header) {
10991
11084
  case "strict":
10992
11085
  options.sameSite = "strict";
10993
11086
  break;
10994
- case "none":
10995
- options.sameSite = "none";
10996
- break;
11087
+ case "none": options.sameSite = "none";
10997
11088
  }
10998
- break;
10999
11089
  }
11000
11090
  }
11001
11091
  return some(Object.assign(Object.create(CookieProto), {
@@ -11145,7 +11235,7 @@ const TypeId$9 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpClientError");
11145
11235
  * @since 1.0.0
11146
11236
  * @category error
11147
11237
  */
11148
- var RequestError = class extends TypeIdError(TypeId$9, "RequestError") {
11238
+ var RequestError = class extends (/*#__PURE__*/ TypeIdError(TypeId$9, "RequestError")) {
11149
11239
  get methodAndUrl() {
11150
11240
  return `${this.request.method} ${this.request.url}`;
11151
11241
  }
@@ -11157,7 +11247,7 @@ var RequestError = class extends TypeIdError(TypeId$9, "RequestError") {
11157
11247
  * @since 1.0.0
11158
11248
  * @category error
11159
11249
  */
11160
- var ResponseError = class extends TypeIdError(TypeId$9, "ResponseError") {
11250
+ var ResponseError = class extends (/*#__PURE__*/ TypeIdError(TypeId$9, "ResponseError")) {
11161
11251
  get methodAndUrl() {
11162
11252
  return `${this.request.method} ${this.request.url}`;
11163
11253
  }
@@ -11248,7 +11338,7 @@ const TypeId$8 = /*#__PURE__*/ Symbol.for("@effect/platform/HttpIncomingMessage"
11248
11338
  * @since 1.0.0
11249
11339
  * @category fiber refs
11250
11340
  */
11251
- var MaxBodySize = class extends Reference()("@effect/platform/HttpIncomingMessage/MaxBodySize", { defaultValue: none$3 }) {};
11341
+ var MaxBodySize = class extends (/*#__PURE__*/ Reference()("@effect/platform/HttpIncomingMessage/MaxBodySize", { defaultValue: none$3 })) {};
11252
11342
  /**
11253
11343
  * @since 1.0.0
11254
11344
  */
@@ -11595,7 +11685,8 @@ const make$13 = (f) => makeWith((effect) => flatMap$5(effect, (request) => withF
11595
11685
  }
11596
11686
  }));
11597
11687
  }
11598
- return useSpan(get$20(fiber.currentContext, SpanNameGenerator)(request), {
11688
+ const nameGenerator = get$20(fiber.currentContext, SpanNameGenerator);
11689
+ return useSpan(nameGenerator(request), {
11599
11690
  kind: "client",
11600
11691
  captureStackTrace: false
11601
11692
  }, (span) => {
@@ -11925,7 +12016,7 @@ const join$1 = (self) => _await(self.deferred);
11925
12016
  * @since 1.0.0
11926
12017
  * @category tags
11927
12018
  */
11928
- var Collector = class extends Tag$3("@effect/platform/Transferable/Collector")() {};
12019
+ var Collector = class extends (/*#__PURE__*/ Tag$3("@effect/platform/Transferable/Collector")()) {};
11929
12020
  /**
11930
12021
  * @since 1.0.0
11931
12022
  * @category constructors
@@ -11961,10 +12052,10 @@ const WorkerErrorTypeId = /* @__PURE__ */ Symbol.for("@effect/platform/WorkerErr
11961
12052
  * @since 1.0.0
11962
12053
  * @category errors
11963
12054
  */
11964
- var WorkerError = class extends TaggedError()("WorkerError", {
12055
+ var WorkerError = class extends (/*#__PURE__*/ TaggedError()("WorkerError", {
11965
12056
  reason: /*#__PURE__*/ Literal("spawn", "decode", "send", "unknown", "encode"),
11966
12057
  cause: Defect
11967
- }) {
12058
+ })) {
11968
12059
  /**
11969
12060
  * @since 1.0.0
11970
12061
  */
@@ -12049,7 +12140,8 @@ const layerManager$3 = /*#__PURE__*/ effect$1(WorkerManager, /* @__PURE__ */ gen
12049
12140
  }
12050
12141
  });
12051
12142
  const executeAcquire = (request, makeMailbox) => withFiberRuntime$1((fiber) => {
12052
- const span = getOption(fiber.getFiberRef(currentContext), ParentSpan).pipe(filter$5((span) => span._tag === "Span"));
12143
+ const context = fiber.getFiberRef(currentContext);
12144
+ const span = getOption(context, ParentSpan).pipe(filter$5((span) => span._tag === "Span"));
12053
12145
  const id = requestIdCounter++;
12054
12146
  return makeMailbox.pipe(tap((mailbox) => {
12055
12147
  requestMap.set(id, mailbox);
@@ -12183,7 +12275,7 @@ const effectify$1 = (fn, onError, onSyncError) => (...args) => async((resume) =>
12183
12275
  */
12184
12276
  const effectify = effectify$1;
12185
12277
  //#endregion
12186
- //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_f1a2a05590df254f139eccc610e5dde2/node_modules/@effect/platform-node-shared/dist/esm/internal/error.js
12278
+ //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_19708ecbd4cbdb49671d93a4e6081e70/node_modules/@effect/platform-node-shared/dist/esm/internal/error.js
12187
12279
  /** @internal */
12188
12280
  const handleErrnoException = (module, method) => (err, [path]) => {
12189
12281
  let reason = "Unknown";
@@ -12206,9 +12298,7 @@ const handleErrnoException = (module, method) => (err, [path]) => {
12206
12298
  case "EBUSY":
12207
12299
  reason = "Busy";
12208
12300
  break;
12209
- case "ELOOP":
12210
- reason = "BadResource";
12211
- break;
12301
+ case "ELOOP": reason = "BadResource";
12212
12302
  }
12213
12303
  return new SystemError({
12214
12304
  reason,
@@ -12221,7 +12311,7 @@ const handleErrnoException = (module, method) => (err, [path]) => {
12221
12311
  });
12222
12312
  };
12223
12313
  //#endregion
12224
- //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_f1a2a05590df254f139eccc610e5dde2/node_modules/@effect/platform-node-shared/dist/esm/internal/fileSystem.js
12314
+ //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_19708ecbd4cbdb49671d93a4e6081e70/node_modules/@effect/platform-node-shared/dist/esm/internal/fileSystem.js
12225
12315
  const handleBadArgument = (method) => (cause) => new BadArgument({
12226
12316
  module: "FileSystem",
12227
12317
  method,
@@ -12503,7 +12593,7 @@ const writeFile = (path, data, options) => async((resume, signal) => {
12503
12593
  }
12504
12594
  });
12505
12595
  //#endregion
12506
- //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_f1a2a05590df254f139eccc610e5dde2/node_modules/@effect/platform-node-shared/dist/esm/NodeFileSystem.js
12596
+ //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_19708ecbd4cbdb49671d93a4e6081e70/node_modules/@effect/platform-node-shared/dist/esm/NodeFileSystem.js
12507
12597
  /**
12508
12598
  * @since 1.0.0
12509
12599
  */
@@ -12540,7 +12630,7 @@ const layer$9 = /* @__PURE__ */ effect$1(FileSystem, /* @__PURE__ */ map$9(/*#__
12540
12630
  writeFile
12541
12631
  })));
12542
12632
  //#endregion
12543
- //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_f1a2a05590df254f139eccc610e5dde2/node_modules/@effect/platform-node-shared/dist/esm/internal/stream.js
12633
+ //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_19708ecbd4cbdb49671d93a4e6081e70/node_modules/@effect/platform-node-shared/dist/esm/internal/stream.js
12544
12634
  /** @internal */
12545
12635
  const fromReadable$1 = (evaluate, onError, options) => fromChannel(fromReadableChannel(evaluate, onError, options));
12546
12636
  /** @internal */
@@ -12662,7 +12752,7 @@ const unsafeReadableRead = (readable, onError, exit, options) => {
12662
12752
  }));
12663
12753
  };
12664
12754
  //#endregion
12665
- //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_f1a2a05590df254f139eccc610e5dde2/node_modules/@effect/platform-node-shared/dist/esm/internal/sink.js
12755
+ //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_19708ecbd4cbdb49671d93a4e6081e70/node_modules/@effect/platform-node-shared/dist/esm/internal/sink.js
12666
12756
  /** @internal */
12667
12757
  const fromWritable$1 = (evaluate, onError, options) => fromChannel$1(fromWritableChannel(evaluate, onError, options));
12668
12758
  /** @internal */
@@ -12677,14 +12767,14 @@ const writableOutput = (writable, deferred, onError) => suspend$6(() => {
12677
12767
  }));
12678
12768
  });
12679
12769
  //#endregion
12680
- //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_f1a2a05590df254f139eccc610e5dde2/node_modules/@effect/platform-node-shared/dist/esm/NodeSink.js
12770
+ //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_19708ecbd4cbdb49671d93a4e6081e70/node_modules/@effect/platform-node-shared/dist/esm/NodeSink.js
12681
12771
  /**
12682
12772
  * @category constructor
12683
12773
  * @since 1.0.0
12684
12774
  */
12685
12775
  const fromWritable = fromWritable$1;
12686
12776
  //#endregion
12687
- //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_f1a2a05590df254f139eccc610e5dde2/node_modules/@effect/platform-node-shared/dist/esm/NodeStream.js
12777
+ //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_19708ecbd4cbdb49671d93a4e6081e70/node_modules/@effect/platform-node-shared/dist/esm/NodeStream.js
12688
12778
  /**
12689
12779
  * @category constructors
12690
12780
  * @since 1.0.0
@@ -12701,7 +12791,7 @@ const toString$1 = toString$2;
12701
12791
  */
12702
12792
  const toUint8Array = toUint8Array$1;
12703
12793
  //#endregion
12704
- //#region ../../node_modules/.pnpm/@effect+platform-node@0.108.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effect@3.2_a9695d724252837ea1ecf5a96b4a8abe/node_modules/@effect/platform-node/dist/esm/internal/httpIncomingMessage.js
12794
+ //#region ../../node_modules/.pnpm/@effect+platform-node@0.108.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effect@3.2_cbaf2d87b25498626ad7aed57ec0563d/node_modules/@effect/platform-node/dist/esm/internal/httpIncomingMessage.js
12705
12795
  /** @internal */
12706
12796
  var HttpIncomingMessageImpl = class extends Class$1 {
12707
12797
  source;
@@ -12759,7 +12849,7 @@ var HttpIncomingMessageImpl = class extends Class$1 {
12759
12849
  }
12760
12850
  };
12761
12851
  //#endregion
12762
- //#region ../../node_modules/.pnpm/@effect+platform-node@0.108.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effect@3.2_a9695d724252837ea1ecf5a96b4a8abe/node_modules/@effect/platform-node/dist/esm/internal/httpClient.js
12852
+ //#region ../../node_modules/.pnpm/@effect+platform-node@0.108.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effect@3.2_cbaf2d87b25498626ad7aed57ec0563d/node_modules/@effect/platform-node/dist/esm/internal/httpClient.js
12763
12853
  /** @internal */
12764
12854
  const HttpAgentTypeId = /*#__PURE__*/ Symbol.for("@effect/platform-node/Http/NodeClient/HttpAgent");
12765
12855
  /** @internal */
@@ -12786,7 +12876,7 @@ const fromAgent = (agent) => make$12((request, url, signal) => {
12786
12876
  headers: request.headers,
12787
12877
  signal
12788
12878
  });
12789
- return pipe(zipRight$3(sendBody(nodeRequest, request, request.body), waitForResponse(nodeRequest, request), { concurrent: true }), map$9((_) => new ClientResponseImpl$1(request, _)));
12879
+ return pipe(zipRight$3(sendBody(nodeRequest, request, request.body), waitForResponse(nodeRequest, request), { concurrent: true }), map$9((_) => new ClientResponseImpl(request, _)));
12790
12880
  });
12791
12881
  const sendBody = (nodeRequest, request, body) => suspend$6(() => {
12792
12882
  switch (body._tag) {
@@ -12862,7 +12952,7 @@ const waitForFinish = (nodeRequest, request) => async((resume) => {
12862
12952
  nodeRequest.off("finish", onFinish);
12863
12953
  });
12864
12954
  });
12865
- var ClientResponseImpl$1 = class extends HttpIncomingMessageImpl {
12955
+ var ClientResponseImpl = class extends HttpIncomingMessageImpl {
12866
12956
  request;
12867
12957
  [TypeId$1];
12868
12958
  constructor(request, source) {
@@ -12904,20 +12994,13 @@ var ClientResponseImpl$1 = class extends HttpIncomingMessageImpl {
12904
12994
  });
12905
12995
  }
12906
12996
  };
12907
- /** @internal */
12908
- const layer$8 = /*#__PURE__*/ provide(/* @__PURE__ */ layerMergedContext(/* @__PURE__ */ map$9(HttpAgent, fromAgent)), agentLayer);
12909
12997
  //#endregion
12910
- //#region ../../node_modules/.pnpm/@effect+platform-node@0.108.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effect@3.2_a9695d724252837ea1ecf5a96b4a8abe/node_modules/@effect/platform-node/dist/esm/internal/httpClientUndici.js
12911
- /** @internal */
12912
- const undiciOptionsTagKey = "@effect/platform-node/NodeHttpClient/undiciOptions";
12913
- //#endregion
12914
- //#region ../../node_modules/.pnpm/@effect+platform-node@0.108.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effect@3.2_a9695d724252837ea1ecf5a96b4a8abe/node_modules/@effect/platform-node/dist/esm/NodeHttpClient.js
12998
+ //#region ../../node_modules/.pnpm/@effect+platform-node@0.108.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effect@3.2_cbaf2d87b25498626ad7aed57ec0563d/node_modules/@effect/platform-node/dist/esm/NodeHttpClient.js
12915
12999
  /**
12916
13000
  * @since 1.0.0
12917
13001
  * @category layers
12918
13002
  */
12919
- const layer$7 = layer$8;
12920
- Tag$3(undiciOptionsTagKey)();
13003
+ const layer$7 = /* @__PURE__ */ provide(/* @__PURE__ */ layerMergedContext(/* @__PURE__ */ map$9(HttpAgent, fromAgent)), agentLayer);
12921
13004
  //#endregion
12922
13005
  //#region ../../node_modules/.pnpm/@effect+platform@0.97.1_effect@3.22.1/node_modules/@effect/platform/dist/esm/internal/commandExecutor.js
12923
13006
  /** @internal */
@@ -13071,7 +13154,7 @@ const ProcessId = ProcessId$1;
13071
13154
  */
13072
13155
  const makeExecutor = makeExecutor$1;
13073
13156
  //#endregion
13074
- //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_f1a2a05590df254f139eccc610e5dde2/node_modules/@effect/platform-node-shared/dist/esm/internal/commandExecutor.js
13157
+ //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_19708ecbd4cbdb49671d93a4e6081e70/node_modules/@effect/platform-node-shared/dist/esm/internal/commandExecutor.js
13075
13158
  const inputToStdioOption = (stdin) => typeof stdin === "string" ? stdin : "pipe";
13076
13159
  const outputToStdioOption = (output) => typeof output === "string" ? output : "pipe";
13077
13160
  const toError = (err) => err instanceof globalThis.Error ? err : new globalThis.Error(String(err));
@@ -13179,14 +13262,14 @@ const runCommand = (fileSystem) => (command) => {
13179
13262
  }
13180
13263
  };
13181
13264
  //#endregion
13182
- //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_f1a2a05590df254f139eccc610e5dde2/node_modules/@effect/platform-node-shared/dist/esm/NodeCommandExecutor.js
13265
+ //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_19708ecbd4cbdb49671d93a4e6081e70/node_modules/@effect/platform-node-shared/dist/esm/NodeCommandExecutor.js
13183
13266
  /**
13184
13267
  * @since 1.0.0
13185
13268
  * @category layer
13186
13269
  */
13187
13270
  const layer$5 = /* @__PURE__ */ effect$1(CommandExecutor, /*#__PURE__*/ pipe(FileSystem, /*#__PURE__*/ map$9((fileSystem) => makeExecutor(runCommand(fileSystem)))));
13188
13271
  //#endregion
13189
- //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_f1a2a05590df254f139eccc610e5dde2/node_modules/@effect/platform-node-shared/dist/esm/internal/path.js
13272
+ //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_19708ecbd4cbdb49671d93a4e6081e70/node_modules/@effect/platform-node-shared/dist/esm/internal/path.js
13190
13273
  const fromFileUrl = (url) => try_({
13191
13274
  try: () => NodeUrl.fileURLToPath(url),
13192
13275
  catch: (error) => new BadArgument({
@@ -13208,7 +13291,7 @@ const toFileUrl = (path) => try_({
13208
13291
  ({ ...Path.posix });
13209
13292
  ({ ...Path.win32 });
13210
13293
  //#endregion
13211
- //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_f1a2a05590df254f139eccc610e5dde2/node_modules/@effect/platform-node-shared/dist/esm/NodePath.js
13294
+ //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_19708ecbd4cbdb49671d93a4e6081e70/node_modules/@effect/platform-node-shared/dist/esm/NodePath.js
13212
13295
  /**
13213
13296
  * @since 1.0.0
13214
13297
  */
@@ -13223,10 +13306,10 @@ const layer$3 = /* @__PURE__ */ succeed$2(Path$1, /*#__PURE__*/ Path$1.of({
13223
13306
  toFileUrl
13224
13307
  }));
13225
13308
  //#endregion
13226
- //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_f1a2a05590df254f139eccc610e5dde2/node_modules/@effect/platform-node-shared/dist/esm/internal/terminal.js
13309
+ //#region ../../node_modules/.pnpm/@effect+platform-node-shared@0.61.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effe_19708ecbd4cbdb49671d93a4e6081e70/node_modules/@effect/platform-node-shared/dist/esm/internal/terminal.js
13227
13310
  const defaultShouldQuit = (input) => input.key.ctrl && (input.key.name === "c" || input.key.name === "d");
13228
13311
  //#endregion
13229
- //#region ../../node_modules/.pnpm/@effect+platform-node@0.108.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effect@3.2_a9695d724252837ea1ecf5a96b4a8abe/node_modules/@effect/platform-node/dist/esm/NodeContext.js
13312
+ //#region ../../node_modules/.pnpm/@effect+platform-node@0.108.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effect@3.2_cbaf2d87b25498626ad7aed57ec0563d/node_modules/@effect/platform-node/dist/esm/NodeContext.js
13230
13313
  /**
13231
13314
  * @since 1.0.0
13232
13315
  */
@@ -13378,7 +13461,7 @@ const makeRunMain = (f) => dual((args) => isEffect(args[0]), (effect, options) =
13378
13461
  });
13379
13462
  });
13380
13463
  //#endregion
13381
- //#region ../../node_modules/.pnpm/@effect+platform-node@0.108.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effect@3.2_a9695d724252837ea1ecf5a96b4a8abe/node_modules/@effect/platform-node/dist/esm/NodeRuntime.js
13464
+ //#region ../../node_modules/.pnpm/@effect+platform-node@0.108.1_@effect+cluster@0.60.2_@effect+platform@0.97.1_effect@3.2_cbaf2d87b25498626ad7aed57ec0563d/node_modules/@effect/platform-node/dist/esm/NodeRuntime.js
13382
13465
  /**
13383
13466
  * @since 1.0.0
13384
13467
  */
@@ -14046,9 +14129,10 @@ function makeAuthService(http, config) {
14046
14129
  }
14047
14130
  }
14048
14131
  if (lastTransport && lastTransport._tag !== "Generic") return yield* fail$8(lastTransport);
14132
+ const tried = attempted.length > 0 ? attempted.map((a) => `${a.url} → ${a.status}`).join(", ") : "no responses";
14049
14133
  return yield* fail$8(new AuthProbe({
14050
14134
  message: "cannot detect auth endpoint",
14051
- hint: `tried: ${attempted.length > 0 ? attempted.map((a) => `${a.url} → ${a.status}`).join(", ") : "no responses"}. supply the site root (e.g. https://blog.example.com), not the API path. verify the server is reachable and runs a supported API version (${SUPPORTED_API_VERSIONS.join(", ")}).`
14135
+ hint: `tried: ${tried}. supply the site root (e.g. https://blog.example.com), not the API path. verify the server is reachable and runs a supported API version (${SUPPORTED_API_VERSIONS.join(", ")}).`
14052
14136
  }));
14053
14137
  });
14054
14138
  const requestDeviceCode = (authBase, clientId, scope = "openid profile email") => gen(function* () {
@@ -14355,13 +14439,14 @@ function makeApiService(http, config, auth, opts) {
14355
14439
  const resolved = yield* resolvedEffect;
14356
14440
  yield* maybeEmitBanner(resolved);
14357
14441
  const method = options.method ?? "GET";
14358
- const decision = decideWriteGate({
14442
+ const gateInput = {
14359
14443
  apiUrl: resolved.apiUrl,
14360
14444
  profileName: resolved.profileName,
14361
14445
  isProduction: resolved.isProduction,
14362
14446
  profileExplicit: resolved.profileExplicit,
14363
14447
  urlOverridden: resolved.urlOverridden
14364
- }, method);
14448
+ };
14449
+ const decision = decideWriteGate(gateInput, method);
14365
14450
  if (!decision.allow) return yield* fail$8(new WriteRequiresExplicit({
14366
14451
  message: decision.message,
14367
14452
  hint: decision.hint,
@@ -14474,7 +14559,7 @@ function parseBody(res) {
14474
14559
  function decodeWithSchema(schema, body) {
14475
14560
  return tryPromise({
14476
14561
  try: async () => {
14477
- const { Schema: SchemaMod } = await import("./esm-CDcJmHkG.mjs");
14562
+ const { Schema: SchemaMod } = await import("./esm-ZrfYH2y2.mjs");
14478
14563
  return SchemaMod.decodeUnknownPromise(schema)(body);
14479
14564
  },
14480
14565
  catch: (err) => new ServerError({
@@ -16113,7 +16198,7 @@ function customRandom(alphabet, defaultSize, getRandom) {
16113
16198
  }
16114
16199
  };
16115
16200
  }
16116
- let step = Math.ceil(1.6 * 256 * defaultSize / safeByteCutoff);
16201
+ let step = Math.ceil(409.6 * defaultSize / safeByteCutoff);
16117
16202
  return (size = defaultSize) => {
16118
16203
  if (!size) return "";
16119
16204
  let id = "";
@@ -16173,7 +16258,7 @@ function customAlphabet(alphabet, defaultSize = 21) {
16173
16258
  }
16174
16259
  customAlphabet(urlAlphabet);
16175
16260
  //#endregion
16176
- //#region ../../node_modules/.pnpm/@haklex+rich-litexml@0.34.0_typescript@6.0.3/node_modules/@haklex/rich-litexml/dist/src-BeDSuguH.js
16261
+ //#region ../../node_modules/.pnpm/@haklex+rich-litexml@0.39.1_typescript@6.0.3/node_modules/@haklex/rich-litexml/dist/src-h5Q0X5zw.js
16177
16262
  var impl = null;
16178
16263
  function registerParseHTML(fn) {
16179
16264
  impl = fn;
@@ -16338,6 +16423,19 @@ function imageDisplayWidthAttr(el) {
16338
16423
  const v = numAttr(el, "display-width");
16339
16424
  return v !== void 0 && Number.isFinite(v) && v >= 10 && v <= 100 ? v : void 0;
16340
16425
  }
16426
+ function imageFixedPxAttr(el, name) {
16427
+ const v = numAttr(el, name);
16428
+ return v !== void 0 && Number.isFinite(v) && v > 0 ? Math.round(v) : void 0;
16429
+ }
16430
+ function exclusiveImageDisplayAttrs(el) {
16431
+ const displayWidth = imageDisplayWidthAttr(el);
16432
+ if (displayWidth !== void 0) return { displayWidth };
16433
+ const fixedWidth = imageFixedPxAttr(el, "fixed-width");
16434
+ if (fixedWidth !== void 0) return { fixedWidth };
16435
+ const fixedHeight = imageFixedPxAttr(el, "fixed-height");
16436
+ if (fixedHeight !== void 0) return { fixedHeight };
16437
+ return {};
16438
+ }
16341
16439
  function imageLayoutAttr(el) {
16342
16440
  const v = el.getAttribute("layout");
16343
16441
  return v !== null && IMAGE_LAYOUTS.has(v) ? v : void 0;
@@ -16390,7 +16488,7 @@ function registerCustomReaders(registry) {
16390
16488
  caption: el.getAttribute("caption") ?? void 0,
16391
16489
  thumbhash: el.getAttribute("thumbhash") ?? void 0,
16392
16490
  accent: el.getAttribute("accent") ?? void 0,
16393
- displayWidth: imageDisplayWidthAttr(el),
16491
+ ...exclusiveImageDisplayAttrs(el),
16394
16492
  layout: imageLayoutAttr(el),
16395
16493
  version: 1
16396
16494
  };
@@ -16404,6 +16502,17 @@ function registerCustomReaders(registry) {
16404
16502
  height: numAttr(el, "height"),
16405
16503
  version: 1
16406
16504
  }));
16505
+ registry.registerReader("attachment", (el) => ({
16506
+ type: "file",
16507
+ ...extractBlockId(el),
16508
+ src: el.getAttribute("src") ?? "",
16509
+ name: el.getAttribute("name") ?? "",
16510
+ size: numAttr(el, "size"),
16511
+ mimeType: el.getAttribute("mime-type") ?? void 0,
16512
+ ext: el.getAttribute("ext") ?? void 0,
16513
+ display: el.getAttribute("display") === "inline" ? "inline" : "block",
16514
+ version: 1
16515
+ }));
16407
16516
  registry.registerReader("link-card", (el) => ({
16408
16517
  type: "link-card",
16409
16518
  ...extractBlockId(el),
@@ -16865,6 +16974,8 @@ function registerCustomWriters(registry) {
16865
16974
  "thumbhash": n.thumbhash,
16866
16975
  "accent": n.accent,
16867
16976
  "display-width": n.displayWidth != null ? String(n.displayWidth) : void 0,
16977
+ "fixed-width": n.fixedWidth != null ? String(n.fixedWidth) : void 0,
16978
+ "fixed-height": n.fixedHeight != null ? String(n.fixedHeight) : void 0,
16868
16979
  "layout": n.layout
16869
16980
  }),
16870
16981
  selfClosing: true
@@ -16882,6 +16993,22 @@ function registerCustomWriters(registry) {
16882
16993
  selfClosing: true
16883
16994
  };
16884
16995
  });
16996
+ registry.registerWriter("file", (node) => {
16997
+ const n = node;
16998
+ return {
16999
+ tag: "attachment",
17000
+ attrs: optAttr({
17001
+ ...blockId(n),
17002
+ "src": n.src,
17003
+ "name": n.name,
17004
+ "size": n.size != null ? String(n.size) : void 0,
17005
+ "mime-type": n.mimeType,
17006
+ "ext": n.ext,
17007
+ "display": n.display === "inline" ? "inline" : void 0
17008
+ }),
17009
+ selfClosing: true
17010
+ };
17011
+ });
16885
17012
  registry.registerWriter("link-card", (node) => {
16886
17013
  const n = node;
16887
17014
  return {
@@ -17383,8 +17510,10 @@ function createReaderContext(registry) {
17383
17510
  else if (child.nodeType === 1) {
17384
17511
  flushText();
17385
17512
  const parsed = parseElement(child, registry, ctx, 0);
17386
- if (parsed) if (Array.isArray(parsed)) nodes.push(...parsed);
17387
- else nodes.push(parsed);
17513
+ if (parsed) {
17514
+ if (Array.isArray(parsed)) nodes.push(...parsed);
17515
+ else nodes.push(parsed);
17516
+ }
17388
17517
  }
17389
17518
  flushText();
17390
17519
  return nodes;
@@ -17422,8 +17551,10 @@ function parseInlineChildren(element, registry, ctx, format) {
17422
17551
  else if (child.nodeType === 1) {
17423
17552
  flushText();
17424
17553
  const parsed = parseElement(child, registry, ctx, format);
17425
- if (parsed) if (Array.isArray(parsed)) nodes.push(...parsed);
17426
- else nodes.push(parsed);
17554
+ if (parsed) {
17555
+ if (Array.isArray(parsed)) nodes.push(...parsed);
17556
+ else nodes.push(parsed);
17557
+ }
17427
17558
  }
17428
17559
  flushText();
17429
17560
  return nodes;
@@ -18688,9 +18819,7 @@ var Tokenizer = class {
18688
18819
  case State.InProcessingInstruction:
18689
18820
  this.stateInProcessingInstruction(c);
18690
18821
  break;
18691
- case State.InEntity:
18692
- this.stateInEntity();
18693
- break;
18822
+ case State.InEntity: this.stateInEntity();
18694
18823
  }
18695
18824
  this.index++;
18696
18825
  }
@@ -18708,9 +18837,10 @@ var Tokenizer = class {
18708
18837
  handleTrailingData() {
18709
18838
  const endIndex = this.buffer.length + this.offset;
18710
18839
  if (this.sectionStart >= endIndex) return;
18711
- if (this.state === State.InCommentLike) if (this.currentSequence === Sequences.CdataEnd) this.cbs.oncdata(this.sectionStart, endIndex, 0);
18712
- else this.cbs.oncomment(this.sectionStart, endIndex, 0);
18713
- else if (this.state === State.InTagName || this.state === State.BeforeAttributeName || this.state === State.BeforeAttributeValue || this.state === State.AfterAttributeName || this.state === State.InAttributeName || this.state === State.InAttributeValueSq || this.state === State.InAttributeValueDq || this.state === State.InAttributeValueNq || this.state === State.InClosingTagName) {} else this.cbs.ontext(this.sectionStart, endIndex);
18840
+ if (this.state === State.InCommentLike) {
18841
+ if (this.currentSequence === Sequences.CdataEnd) this.cbs.oncdata(this.sectionStart, endIndex, 0);
18842
+ else this.cbs.oncomment(this.sectionStart, endIndex, 0);
18843
+ } else if (this.state === State.InTagName || this.state === State.BeforeAttributeName || this.state === State.BeforeAttributeValue || this.state === State.AfterAttributeName || this.state === State.InAttributeName || this.state === State.InAttributeValueSq || this.state === State.InAttributeValueDq || this.state === State.InAttributeValueNq || this.state === State.InClosingTagName) {} else this.cbs.ontext(this.sectionStart, endIndex);
18714
18844
  }
18715
18845
  emitCodePoint(cp, consumed) {
18716
18846
  if (this.baseState !== State.Text && this.baseState !== State.InSpecialTag) {
@@ -21266,9 +21396,7 @@ const loopSegment = ({ [NEXT]: next, [END]: end }, json) => {
21266
21396
  elementAsJSON(next, json);
21267
21397
  next = getEnd(next);
21268
21398
  break;
21269
- case 10:
21270
- documentTypeAsJSON(next, json);
21271
- break;
21399
+ case 10: documentTypeAsJSON(next, json);
21272
21400
  }
21273
21401
  next = next[NEXT];
21274
21402
  }
@@ -21344,7 +21472,7 @@ const moCallback = (element, parentNode) => {
21344
21472
  const { active, observers } = ownerDocument[MUTATION_OBSERVER];
21345
21473
  if (active) {
21346
21474
  for (const observer of observers) for (const [target, { subtree, childList, characterData }] of observer.nodes) if (childList) {
21347
- if (parentNode && (target === parentNode || subtree && target.contains(parentNode)) || !parentNode && (subtree && (target === ownerDocument || target.contains(element)) || !subtree && target[characterData ? "childNodes" : "children"].includes(element))) {
21475
+ if (parentNode && (target === parentNode || subtree && target.contains(parentNode)) || !parentNode && (subtree && (target === ownerDocument || /* c8 ignore next */ target.contains(element)) || !subtree && target[characterData ? "childNodes" : "children"].includes(element))) {
21348
21476
  const { callback, records, scheduled } = observer;
21349
21477
  records.push(createRecord("childList", target, element, parentNode ? [] : [element], parentNode ? [element] : []));
21350
21478
  if (!scheduled) {
@@ -22233,7 +22361,6 @@ function parseSelector(subselects, selector, selectorIndex) {
22233
22361
  case CharCode.RightParenthesis:
22234
22362
  counter -= 1;
22235
22363
  if (counter === 0) return unescapeCSS(selector.slice(start, selectorIndex++));
22236
- break;
22237
22364
  }
22238
22365
  throw new Error("Parenthesis not matched");
22239
22366
  }
@@ -22359,7 +22486,6 @@ function parseSelector(subselects, selector, selectorIndex) {
22359
22486
  case CharCode.LowerS:
22360
22487
  ignoreCase = false;
22361
22488
  stripWhitespace(1);
22362
- break;
22363
22489
  }
22364
22490
  }
22365
22491
  if (selector.charCodeAt(selectorIndex) !== CharCode.RightSquareBracket) throw new Error("Attribute selector didn't terminate");
@@ -22394,19 +22520,21 @@ function parseSelector(subselects, selector, selectorIndex) {
22394
22520
  break;
22395
22521
  }
22396
22522
  let data = null;
22397
- if (selector.charCodeAt(selectorIndex) === CharCode.LeftParenthesis) if (unpackPseudos.has(name)) {
22398
- if (isQuote(selector.charCodeAt(selectorIndex + 1))) throw new Error(`Pseudo-selector ${name} cannot be quoted`);
22399
- data = [];
22400
- selectorIndex = parseSelector(data, selector, selectorIndex + 1);
22401
- if (selector.charCodeAt(selectorIndex) !== CharCode.RightParenthesis) throw new Error(`Missing closing parenthesis in :${name} (${selector})`);
22402
- selectorIndex += 1;
22403
- } else {
22404
- data = readValueWithParenthesis();
22405
- if (stripQuotesFromPseudos.has(name)) {
22406
- const quot = data.charCodeAt(0);
22407
- if (quot === data.charCodeAt(data.length - 1) && isQuote(quot)) data = data.slice(1, -1);
22523
+ if (selector.charCodeAt(selectorIndex) === CharCode.LeftParenthesis) {
22524
+ if (unpackPseudos.has(name)) {
22525
+ if (isQuote(selector.charCodeAt(selectorIndex + 1))) throw new Error(`Pseudo-selector ${name} cannot be quoted`);
22526
+ data = [];
22527
+ selectorIndex = parseSelector(data, selector, selectorIndex + 1);
22528
+ if (selector.charCodeAt(selectorIndex) !== CharCode.RightParenthesis) throw new Error(`Missing closing parenthesis in :${name} (${selector})`);
22529
+ selectorIndex += 1;
22530
+ } else {
22531
+ data = readValueWithParenthesis();
22532
+ if (stripQuotesFromPseudos.has(name)) {
22533
+ const quot = data.charCodeAt(0);
22534
+ if (quot === data.charCodeAt(data.length - 1) && isQuote(quot)) data = data.slice(1, -1);
22535
+ }
22536
+ data = unescapeCSS(data);
22408
22537
  }
22409
- data = unescapeCSS(data);
22410
22538
  }
22411
22539
  tokens.push({
22412
22540
  type: SelectorType.Pseudo,
@@ -23939,9 +24067,7 @@ function parse$2(formula) {
23939
24067
  case "-":
23940
24068
  index++;
23941
24069
  return -1;
23942
- case "+":
23943
- index++;
23944
- break;
24070
+ case "+": index++;
23945
24071
  }
23946
24072
  return 1;
23947
24073
  }
@@ -24855,7 +24981,6 @@ var ParentNode = class extends Node$1 {
24855
24981
  node.parentNode = this;
24856
24982
  knownSiblings(next[PREV], node, next);
24857
24983
  moCallback(node, null);
24858
- break;
24859
24984
  }
24860
24985
  return node;
24861
24986
  }
@@ -24981,9 +25106,7 @@ function setOwnerDocument(node) {
24981
25106
  node.ownerDocument = this;
24982
25107
  switch (node.nodeType) {
24983
25108
  case 1:
24984
- case 11:
24985
- node.childNodes.forEach(setOwnerDocument, this);
24986
- break;
25109
+ case 11: node.childNodes.forEach(setOwnerDocument, this);
24987
25110
  }
24988
25111
  return node;
24989
25112
  }
@@ -25672,9 +25795,7 @@ var Element$1 = class extends ParentNode {
25672
25795
  }
25673
25796
  case 3:
25674
25797
  case 8:
25675
- case 4:
25676
- addNext(next.cloneNode(deep));
25677
- break;
25798
+ case 4: addNext(next.cloneNode(deep));
25678
25799
  }
25679
25800
  next = next[NEXT];
25680
25801
  }
@@ -25725,7 +25846,6 @@ var Element$1 = class extends ParentNode {
25725
25846
  case 4:
25726
25847
  out.push((isOpened ? ">" : "") + next);
25727
25848
  isOpened = false;
25728
- break;
25729
25849
  }
25730
25850
  } while (next !== end);
25731
25851
  return out.join("");
@@ -26724,9 +26844,7 @@ var require_CSSStyleRule = /* @__PURE__ */ __commonJSMin(((exports) => {
26724
26844
  case "\r":
26725
26845
  case "\n":
26726
26846
  case "\f": break;
26727
- default:
26728
- buffer += " ";
26729
- break;
26847
+ default: buffer += " ";
26730
26848
  }
26731
26849
  break;
26732
26850
  case "\"":
@@ -26788,9 +26906,7 @@ var require_CSSStyleRule = /* @__PURE__ */ __commonJSMin(((exports) => {
26788
26906
  else buffer += character;
26789
26907
  state = "selector";
26790
26908
  break;
26791
- default:
26792
- buffer += character;
26793
- break;
26909
+ default: buffer += character;
26794
26910
  }
26795
26911
  return styleRule;
26796
26912
  };
@@ -27004,9 +27120,7 @@ var require_CSSImportRule = /* @__PURE__ */ __commonJSMin(((exports) => {
27004
27120
  if (buffer) this.media.mediaText = buffer.trim();
27005
27121
  }
27006
27122
  break;
27007
- default:
27008
- if (state === "media") buffer += character;
27009
- break;
27123
+ default: if (state === "media") buffer += character;
27010
27124
  }
27011
27125
  }
27012
27126
  });
@@ -27327,9 +27441,10 @@ var require_CSSValueExpression = /* @__PURE__ */ __commonJSMin(((exports) => {
27327
27441
  expression += character;
27328
27442
  break;
27329
27443
  case "/":
27330
- if (info = this._parseJSComment(token, idx)) if (info.error) error = "css expression error: unfinished comment in expression!";
27331
- else idx = info.idx;
27332
- else if (info = this._parseJSRexExp(token, idx)) {
27444
+ if (info = this._parseJSComment(token, idx)) {
27445
+ if (info.error) error = "css expression error: unfinished comment in expression!";
27446
+ else idx = info.idx;
27447
+ } else if (info = this._parseJSRexExp(token, idx)) {
27333
27448
  idx = info.idx;
27334
27449
  expression += info.text;
27335
27450
  } else expression += character;
@@ -27342,9 +27457,7 @@ var require_CSSValueExpression = /* @__PURE__ */ __commonJSMin(((exports) => {
27342
27457
  expression += info.text;
27343
27458
  } else expression += character;
27344
27459
  break;
27345
- default:
27346
- expression += character;
27347
- break;
27460
+ default: expression += character;
27348
27461
  }
27349
27462
  if (error) break;
27350
27463
  if (paren.length === 0) break;
@@ -27617,9 +27730,7 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
27617
27730
  case "before-value":
27618
27731
  state = "value";
27619
27732
  break;
27620
- case "importRule-begin":
27621
- state = "importRule";
27622
- break;
27733
+ case "importRule-begin": state = "importRule";
27623
27734
  }
27624
27735
  break;
27625
27736
  case "'":
@@ -27634,9 +27745,7 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
27634
27745
  case "before-value":
27635
27746
  state = "value";
27636
27747
  break;
27637
- case "importRule-begin":
27638
- state = "importRule";
27639
- break;
27748
+ case "importRule-begin": state = "importRule";
27640
27749
  }
27641
27750
  break;
27642
27751
  case "/":
@@ -27775,19 +27884,20 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
27775
27884
  } else buffer += character;
27776
27885
  break;
27777
27886
  case "(":
27778
- if (state === "value") if (buffer.trim() === "expression") {
27779
- var info = new CSSOM.CSSValueExpression(token, i).parse();
27780
- if (info.error) parseError(info.error);
27781
- else {
27782
- buffer += info.expression;
27783
- i = info.idx;
27887
+ if (state === "value") {
27888
+ if (buffer.trim() === "expression") {
27889
+ var info = new CSSOM.CSSValueExpression(token, i).parse();
27890
+ if (info.error) parseError(info.error);
27891
+ else {
27892
+ buffer += info.expression;
27893
+ i = info.idx;
27894
+ }
27895
+ } else {
27896
+ state = "value-parenthesis";
27897
+ valueParenthesisDepth = 1;
27898
+ buffer += character;
27784
27899
  }
27785
- } else {
27786
- state = "value-parenthesis";
27787
- valueParenthesisDepth = 1;
27788
- buffer += character;
27789
- }
27790
- else if (state === "value-parenthesis") {
27900
+ } else if (state === "value-parenthesis") {
27791
27901
  valueParenthesisDepth++;
27792
27902
  buffer += character;
27793
27903
  } else buffer += character;
@@ -27825,9 +27935,7 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
27825
27935
  buffer = "";
27826
27936
  state = "before-selector";
27827
27937
  break;
27828
- default:
27829
- buffer += character;
27830
- break;
27938
+ default: buffer += character;
27831
27939
  }
27832
27940
  break;
27833
27941
  case "}":
@@ -27868,7 +27976,6 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
27868
27976
  }
27869
27977
  buffer = "";
27870
27978
  state = "before-selector";
27871
- break;
27872
27979
  }
27873
27980
  break;
27874
27981
  default:
@@ -27884,12 +27991,9 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
27884
27991
  case "before-value":
27885
27992
  state = "value";
27886
27993
  break;
27887
- case "importRule-begin":
27888
- state = "importRule";
27889
- break;
27994
+ case "importRule-begin": state = "importRule";
27890
27995
  }
27891
27996
  buffer += character;
27892
- break;
27893
27997
  }
27894
27998
  return styleSheet;
27895
27999
  };
@@ -27997,8 +28101,8 @@ var require_CSSStyleDeclaration = /* @__PURE__ */ __commonJSMin(((exports) => {
27997
28101
  return properties.join(" ");
27998
28102
  },
27999
28103
  set cssText(text) {
28000
- var i, name;
28001
- for (i = this.length; i--;) {
28104
+ var i = this.length, name;
28105
+ for (; i--;) {
28002
28106
  name = this[i];
28003
28107
  this[name] = "";
28004
28108
  }
@@ -29260,7 +29364,6 @@ const ImageClass = (ownerDocument) => class Image extends HTMLImageElement {
29260
29364
  case 2:
29261
29365
  this.height = height;
29262
29366
  this.width = width;
29263
- break;
29264
29367
  }
29265
29368
  }
29266
29369
  };
@@ -29448,9 +29551,7 @@ var Document$1 = class extends NonElementParentNode {
29448
29551
  case "dispatchEvent":
29449
29552
  this[EVENT_TARGET][name] = value;
29450
29553
  break;
29451
- default:
29452
- target[name] = value;
29453
- break;
29554
+ default: target[name] = value;
29454
29555
  }
29455
29556
  return true;
29456
29557
  },
@@ -29646,9 +29747,7 @@ var HTMLDocument = class extends Document$1 {
29646
29747
  let { [NEXT]: next, [END]: end } = this;
29647
29748
  while (next !== end) {
29648
29749
  switch (next.nodeType) {
29649
- case 1:
29650
- nodeList.push(next);
29651
- break;
29750
+ case 1: nodeList.push(next);
29652
29751
  }
29653
29752
  next = next[NEXT];
29654
29753
  }
@@ -29761,7 +29860,7 @@ function Document() {
29761
29860
  }
29762
29861
  setPrototypeOf(Document, Document$1).prototype = Document$1.prototype;
29763
29862
  //#endregion
29764
- //#region ../../node_modules/.pnpm/@haklex+rich-litexml@0.34.0_typescript@6.0.3/node_modules/@haklex/rich-litexml/dist/node.mjs
29863
+ //#region ../../node_modules/.pnpm/@haklex+rich-litexml@0.39.1_typescript@6.0.3/node_modules/@haklex/rich-litexml/dist/node.mjs
29765
29864
  registerParseHTML((html) => parseHTML(html).document);
29766
29865
  //#endregion
29767
29866
  //#region ../editor/src/core/litexml.ts
@@ -29805,7 +29904,7 @@ function stripMxLitexmlDocWrapper(xml) {
29805
29904
  * LICENSE file in the root directory of this source tree.
29806
29905
  *
29807
29906
  */
29808
- const mod$2 = await (process.env.NODE_ENV !== "production" ? import("./LexicalTable.dev-6IFFOAE0.mjs") : import("./LexicalTable.prod-2CaLZ7fH.mjs"));
29907
+ const mod$2 = await (process.env.NODE_ENV !== "production" ? import("./LexicalTable.dev-DN3ezVey.mjs") : import("./LexicalTable.prod-B0MioVyq.mjs"));
29809
29908
  mod$2.$computeTableCellRectBoundary;
29810
29909
  mod$2.$computeTableMap;
29811
29910
  mod$2.$computeTableMapSkipCellCheck;
@@ -29882,7 +29981,7 @@ mod$2.setScrollableTablesActive;
29882
29981
  * LICENSE file in the root directory of this source tree.
29883
29982
  *
29884
29983
  */
29885
- const mod$1 = await (process.env.NODE_ENV !== "production" ? import("./LexicalMarkdown.dev-B5z9kLbV.mjs") : import("./LexicalMarkdown.prod-wKzw7FFH.mjs"));
29984
+ const mod$1 = await (process.env.NODE_ENV !== "production" ? import("./LexicalMarkdown.dev-S2yWckH9.mjs") : import("./LexicalMarkdown.prod-TRkMWfmC.mjs"));
29886
29985
  mod$1.$convertFromMarkdownString;
29887
29986
  mod$1.$convertSelectionToMarkdownString;
29888
29987
  const $convertToMarkdownString = mod$1.$convertToMarkdownString;
@@ -29911,7 +30010,7 @@ mod$1.UNORDERED_LIST;
29911
30010
  mod$1.isTableRowDivider;
29912
30011
  mod$1.registerMarkdownShortcuts;
29913
30012
  //#endregion
29914
- //#region ../../node_modules/.pnpm/@haklex+rich-headless@0.34.0_lexical@0.49.0_typescript@6.0.3__typescript@6.0.3/node_modules/@haklex/rich-headless/dist/transformers.mjs
30013
+ //#region ../../node_modules/.pnpm/@haklex+rich-headless@0.39.1_lexical@0.49.0_typescript@6.0.3__typescript@6.0.3/node_modules/@haklex/rich-headless/dist/transformers.mjs
29915
30014
  /**
29916
30015
  * Headless Markdown transformers — export-only (Lexical → Markdown).
29917
30016
  * Import stubs are no-ops; used only for $convertToMarkdownString.
@@ -30338,7 +30437,7 @@ function $toMarkdown() {
30338
30437
  return $convertToMarkdownString(allHeadlessTransformers);
30339
30438
  }
30340
30439
  //#endregion
30341
- //#region ../../node_modules/.pnpm/@haklex+rich-headless@0.34.0_lexical@0.49.0_typescript@6.0.3__typescript@6.0.3/node_modules/@haklex/rich-headless/dist/index.mjs
30440
+ //#region ../../node_modules/.pnpm/@haklex+rich-headless@0.39.1_lexical@0.49.0_typescript@6.0.3__typescript@6.0.3/node_modules/@haklex/rich-headless/dist/index.mjs
30342
30441
  var INTRINSIC_TYPES = [
30343
30442
  "root",
30344
30443
  "paragraph",
@@ -30657,6 +30756,21 @@ var VideoNode = headlessDecorator("video", [
30657
30756
  width: void 0,
30658
30757
  height: void 0
30659
30758
  });
30759
+ var FileNode = headlessDecorator("file", [
30760
+ "src",
30761
+ "name",
30762
+ "size",
30763
+ "mimeType",
30764
+ "ext",
30765
+ "display"
30766
+ ], {
30767
+ src: "",
30768
+ name: "",
30769
+ size: void 0,
30770
+ mimeType: void 0,
30771
+ ext: void 0,
30772
+ display: "block"
30773
+ });
30660
30774
  var LinkCardNode = headlessDecorator("link-card", [
30661
30775
  "url",
30662
30776
  "source",
@@ -30753,6 +30867,7 @@ var customHeadlessNodes = [
30753
30867
  RichQuoteNode,
30754
30868
  ImageNode,
30755
30869
  VideoNode,
30870
+ FileNode,
30756
30871
  LinkCardNode,
30757
30872
  KaTeXInlineNode,
30758
30873
  KaTeXBlockNode,
@@ -30957,7 +31072,7 @@ var customHeadlessNodes = [
30957
31072
  ChatNode
30958
31073
  ];
30959
31074
  var allHeadlessNodes = [...builtinNodes, ...customHeadlessNodes];
30960
- const createHeadlessEditor = (await (process.env.NODE_ENV !== "production" ? import("./LexicalHeadless.dev-DA0WldSR.mjs") : import("./LexicalHeadless.prod-1kQgKB6c.mjs"))).createHeadlessEditor;
31075
+ const createHeadlessEditor = (await (process.env.NODE_ENV !== "production" ? import("./LexicalHeadless.dev-DdWJsPoH.mjs") : import("./LexicalHeadless.prod-CH74ZDMt.mjs"))).createHeadlessEditor;
30961
31076
  //#endregion
30962
31077
  //#region ../editor/src/core/nodes/litexml.ts
30963
31078
  const XML_ESCAPE_MAP = {
@@ -31075,7 +31190,8 @@ function mxLexicalToMarkdown(state) {
31075
31190
  const output = [];
31076
31191
  const pendingHeadlessChildren = [];
31077
31192
  for (const child of children) {
31078
- const projection = mxBlockRegistry[typeof child?.type === "string" ? child.type : ""];
31193
+ const type = typeof child?.type === "string" ? child.type : "";
31194
+ const projection = mxBlockRegistry[type];
31079
31195
  if (projection) {
31080
31196
  flushSegment(output, pendingHeadlessChildren);
31081
31197
  const markdown = projection.toMarkdown(child);
@@ -31364,7 +31480,8 @@ const ALERT_LABEL_COLOR = {
31364
31480
  };
31365
31481
  const renderBox = (defaultType) => (node, ctx, inner) => {
31366
31482
  const type = (node.attrs.type ?? defaultType).toLowerCase();
31367
- const labelLine = wrap(ALERT_LABEL_COLOR[type] ?? ANSI.cyan, type.toUpperCase(), ctx.color);
31483
+ const colorCode = ALERT_LABEL_COLOR[type] ?? ANSI.cyan;
31484
+ const labelLine = wrap(colorCode, type.toUpperCase(), ctx.color);
31368
31485
  const rule = wrap(ANSI.dim, "─".repeat(64), ctx.color);
31369
31486
  const body = inner.walkBlockChildren(node.children, ctx);
31370
31487
  const prefix = wrap(ANSI.dim, "│ ", ctx.color);
@@ -31412,7 +31529,8 @@ const collectText = (children) => {
31412
31529
  };
31413
31530
  const codeblockRenderer = (node, ctx) => {
31414
31531
  const lang = node.attrs.lang ?? "";
31415
- const body = highlightCode(collectText(node.children).replace(/\n+$/, ""), lang, ctx.color);
31532
+ const code = collectText(node.children).replace(/\n+$/, "");
31533
+ const body = highlightCode(code, lang, ctx.color);
31416
31534
  if (lang) return `${wrap(ANSI.dim, lang, ctx.color)}\n${body}`;
31417
31535
  return body;
31418
31536
  };
@@ -31519,8 +31637,6 @@ const inlineRendererEntries = [
31519
31637
  ["footnote", footnoteRenderer],
31520
31638
  ["ruby", rubyRenderer]
31521
31639
  ];
31522
- //#endregion
31523
- //#region ../../node_modules/.pnpm/fast-xml-parser@5.10.1/node_modules/fast-xml-parser/src/util.js
31524
31640
  const regexName = /* @__PURE__ */ new RegExp("^[:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");
31525
31641
  function getAllMatches(string, regex) {
31526
31642
  const matches = [];
@@ -31560,7 +31676,7 @@ const criticalProperties = [
31560
31676
  "prototype"
31561
31677
  ];
31562
31678
  //#endregion
31563
- //#region ../../node_modules/.pnpm/fast-xml-parser@5.10.1/node_modules/fast-xml-parser/src/validator.js
31679
+ //#region ../../node_modules/.pnpm/fast-xml-parser@5.11.1/node_modules/fast-xml-parser/src/validator.js
31564
31680
  const defaultOptions$2 = {
31565
31681
  allowBooleanAttributes: false,
31566
31682
  unpairedTags: []
@@ -31610,18 +31726,19 @@ function validate(xmlData, options) {
31610
31726
  const isValid = validateAttributeString(attrStr, options);
31611
31727
  if (isValid === true) tagFound = true;
31612
31728
  else return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line));
31613
- } else if (closingTag) if (!result.tagClosed) return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' doesn't have proper closing.", getLineNumberForPosition(xmlData, i));
31614
- else if (attrStr.trim().length > 0) return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos));
31615
- else if (tags.length === 0) return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' has not been opened.", getLineNumberForPosition(xmlData, tagStartPos));
31616
- else {
31617
- const otg = tags.pop();
31618
- if (tagName !== otg.tagName) {
31619
- let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos);
31620
- return getErrorObject("InvalidTag", "Expected closing tag '" + otg.tagName + "' (opened in line " + openPos.line + ", col " + openPos.col + ") instead of closing tag '" + tagName + "'.", getLineNumberForPosition(xmlData, tagStartPos));
31729
+ } else if (closingTag) {
31730
+ if (!result.tagClosed) return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' doesn't have proper closing.", getLineNumberForPosition(xmlData, i));
31731
+ else if (attrStr.trim().length > 0) return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos));
31732
+ else if (tags.length === 0) return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' has not been opened.", getLineNumberForPosition(xmlData, tagStartPos));
31733
+ else {
31734
+ const otg = tags.pop();
31735
+ if (tagName !== otg.tagName) {
31736
+ let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos);
31737
+ return getErrorObject("InvalidTag", "Expected closing tag '" + otg.tagName + "' (opened in line " + openPos.line + ", col " + openPos.col + ") instead of closing tag '" + tagName + "'.", getLineNumberForPosition(xmlData, tagStartPos));
31738
+ }
31739
+ if (tags.length == 0) reachedRoot = true;
31621
31740
  }
31622
- if (tags.length == 0) reachedRoot = true;
31623
- }
31624
- else {
31741
+ } else {
31625
31742
  const isValid = validateAttributeString(attrStr, options);
31626
31743
  if (isValid !== true) return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line));
31627
31744
  if (reachedRoot === true) return getErrorObject("InvalidXml", "Multiple possible root nodes found.", getLineNumberForPosition(xmlData, i));
@@ -31631,15 +31748,16 @@ function validate(xmlData, options) {
31631
31748
  });
31632
31749
  tagFound = true;
31633
31750
  }
31634
- for (i++; i < xmlData.length; i++) if (xmlData[i] === "<") if (xmlData[i + 1] === "!") {
31635
- i++;
31636
- i = readCommentAndCDATA(xmlData, i);
31637
- continue;
31638
- } else if (xmlData[i + 1] === "?") {
31639
- i = readPI(xmlData, ++i);
31640
- if (i.err) return i;
31641
- } else break;
31642
- else if (xmlData[i] === "&") {
31751
+ for (i++; i < xmlData.length; i++) if (xmlData[i] === "<") {
31752
+ if (xmlData[i + 1] === "!") {
31753
+ i++;
31754
+ i = readCommentAndCDATA(xmlData, i);
31755
+ continue;
31756
+ } else if (xmlData[i + 1] === "?") {
31757
+ i = readPI(xmlData, ++i);
31758
+ if (i.err) return i;
31759
+ } else break;
31760
+ } else if (xmlData[i] === "&") {
31643
31761
  const afterAmp = validateAmpersand(xmlData, i);
31644
31762
  if (afterAmp == -1) return getErrorObject("InvalidChar", "char '&' is not expected.", getLineNumberForPosition(xmlData, i));
31645
31763
  i = afterAmp;
@@ -31711,9 +31829,10 @@ function readAttributeStr(xmlData, i) {
31711
31829
  let startChar = "";
31712
31830
  let tagClosed = false;
31713
31831
  for (; i < xmlData.length; i++) {
31714
- if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) if (startChar === "") startChar = xmlData[i];
31715
- else if (startChar !== xmlData[i]) {} else startChar = "";
31716
- else if (xmlData[i] === ">") {
31832
+ if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) {
31833
+ if (startChar === "") startChar = xmlData[i];
31834
+ else if (startChar !== xmlData[i]) {} else startChar = "";
31835
+ } else if (xmlData[i] === ">") {
31717
31836
  if (startChar === "") {
31718
31837
  tagClosed = true;
31719
31838
  break;
@@ -31729,11 +31848,86 @@ function readAttributeStr(xmlData, i) {
31729
31848
  };
31730
31849
  }
31731
31850
  /**
31732
- * Select all the attributes whether valid or invalid.
31851
+ * Walk `attrStr` once, left to right, splitting it into attribute tokens.
31852
+ *
31853
+ * This replaces a regex that used to do the same job
31854
+ * (`(\s*)([^\s=]+)(\s*=)?(\s*(['"])(([\s\S])*?)\5)?`). That regex led with an
31855
+ * optional whitespace group followed by a required "non-whitespace" group.
31856
+ * On a long run of whitespace that never resolves into an attribute name
31857
+ * (e.g. a tag with thousands of trailing spaces before `>`), the engine
31858
+ * backtracks the whitespace group one character at a time before giving up
31859
+ * and moving to the next starting position — one full backtrack per
31860
+ * position, which is quadratic in the length of the run.
31861
+ *
31862
+ * A single forward-only scan can never backtrack, so it can't be made slow
31863
+ * this way no matter how much whitespace the input contains — it's always
31864
+ * proportional to the length of the string, once.
31865
+ *
31866
+ * Each returned token mirrors the shape the old regex match array had, so
31867
+ * the validation logic below (which reads token[1]..token[6]) didn't need
31868
+ * to change:
31869
+ * token.startIndex - where this token begins in attrStr
31870
+ * token[1] - leading whitespace before the name
31871
+ * token[2] - the attribute name
31872
+ * token[3] - whitespace + '=' if present, else undefined
31873
+ * token[4] - marker (any defined value) if a quoted value was found
31874
+ * token[5] - the quote character used ('"' or "'")
31875
+ * token[6] - the value's text, without the surrounding quotes
31876
+ *
31877
+ * A malformed leading character (e.g. a stray '=' with no name before it)
31878
+ * is simply skipped over, one character at a time — the same outcome the
31879
+ * old regex produced by failing to match at that position and retrying at
31880
+ * the next one.
31733
31881
  */
31734
- const validAttrStrRegxp = /* @__PURE__ */ new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?", "g");
31882
+ function scanAttributeTokens(attrStr) {
31883
+ const tokens = [];
31884
+ const len = attrStr.length;
31885
+ let i = 0;
31886
+ while (i < len) {
31887
+ const tokenStart = i;
31888
+ while (i < len && isWhiteSpace(attrStr[i])) i++;
31889
+ if (i >= len) break;
31890
+ if (attrStr[i] === "=") {
31891
+ i = tokenStart + 1;
31892
+ continue;
31893
+ }
31894
+ const leadingWs = attrStr.slice(tokenStart, i);
31895
+ const nameStart = i;
31896
+ while (i < len && !isWhiteSpace(attrStr[i]) && attrStr[i] !== "=") i++;
31897
+ const name = attrStr.slice(nameStart, i);
31898
+ let equalsGroup;
31899
+ let j = i;
31900
+ while (j < len && isWhiteSpace(attrStr[j])) j++;
31901
+ if (j < len && attrStr[j] === "=") {
31902
+ equalsGroup = attrStr.slice(i, j + 1);
31903
+ i = j + 1;
31904
+ }
31905
+ let quoteChar;
31906
+ let value;
31907
+ let k = i;
31908
+ while (k < len && isWhiteSpace(attrStr[k])) k++;
31909
+ if (k < len && (attrStr[k] === "\"" || attrStr[k] === "'")) {
31910
+ const valueStart = k + 1;
31911
+ const closeIdx = attrStr.indexOf(attrStr[k], valueStart);
31912
+ if (closeIdx !== -1) {
31913
+ quoteChar = attrStr[k];
31914
+ value = attrStr.slice(valueStart, closeIdx);
31915
+ i = closeIdx + 1;
31916
+ }
31917
+ }
31918
+ const token = { startIndex: tokenStart };
31919
+ token[1] = leadingWs;
31920
+ token[2] = name;
31921
+ token[3] = equalsGroup;
31922
+ token[4] = quoteChar !== void 0 ? true : void 0;
31923
+ token[5] = quoteChar;
31924
+ token[6] = value;
31925
+ tokens.push(token);
31926
+ }
31927
+ return tokens;
31928
+ }
31735
31929
  function validateAttributeString(attrStr, options) {
31736
- const matches = getAllMatches(attrStr, validAttrStrRegxp);
31930
+ const matches = scanAttributeTokens(attrStr);
31737
31931
  const attrNames = {};
31738
31932
  for (let i = 0; i < matches.length; i++) {
31739
31933
  if (matches[i][1].length === 0) return getErrorObject("InvalidAttr", "Attribute '" + matches[i][2] + "' has no space in starting.", getPositionFromMatch(matches[i]));
@@ -32315,7 +32509,7 @@ var EntityDecoder = class {
32315
32509
  }
32316
32510
  };
32317
32511
  //#endregion
32318
- //#region ../../node_modules/.pnpm/fast-xml-parser@5.10.1/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
32512
+ //#region ../../node_modules/.pnpm/fast-xml-parser@5.11.1/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
32319
32513
  const defaultOnDangerousProperty = (name) => {
32320
32514
  if (DANGEROUS_PROPERTY_NAMES.includes(name)) return "__" + name;
32321
32515
  return name;
@@ -32442,7 +32636,7 @@ const buildOptions = function(options) {
32442
32636
  return built;
32443
32637
  };
32444
32638
  //#endregion
32445
- //#region ../../node_modules/.pnpm/fast-xml-parser@5.10.1/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
32639
+ //#region ../../node_modules/.pnpm/fast-xml-parser@5.11.1/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
32446
32640
  let METADATA_SYMBOL$1;
32447
32641
  if (typeof Symbol !== "function") METADATA_SYMBOL$1 = "@@xmlMetadata";
32448
32642
  else METADATA_SYMBOL$1 = Symbol("XML Node Metadata");
@@ -32463,8 +32657,15 @@ var XmlNode = class {
32463
32657
  [":@"]: node[":@"]
32464
32658
  });
32465
32659
  else this.child.push({ [node.tagname]: node.child });
32660
+ this.addStartIndex(startIndex);
32661
+ }
32662
+ addStartIndex(startIndex) {
32466
32663
  if (startIndex !== void 0) this.child[this.child.length - 1][METADATA_SYMBOL$1] = { startIndex };
32467
32664
  }
32665
+ addEndIndex(endIndex) {
32666
+ const lastChild = this.child[this.child.length - 1];
32667
+ if (lastChild !== void 0 && lastChild[METADATA_SYMBOL$1] !== void 0 && lastChild[METADATA_SYMBOL$1].endIndex === void 0) lastChild[METADATA_SYMBOL$1].endIndex = endIndex;
32668
+ }
32468
32669
  /** symbol used for metadata */
32469
32670
  static getMetaDataSymbol() {
32470
32671
  return METADATA_SYMBOL$1;
@@ -32482,9 +32683,9 @@ var XmlNode = class {
32482
32683
  * XML NS spec: https://www.w3.org/TR/xml-names/#NT-NCName
32483
32684
  */
32484
32685
  const nameStartChar10 = ":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�";
32485
- const nameChar10 = ":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\\-\\.\\d·̀-ͯ‿-⁀";
32686
+ const nameChar10 = nameStartChar10 + "\\-\\.\\d" + "·" + "̀-ͯ" + "‿-⁀";
32486
32687
  const nameStartChar11 = ":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿";
32487
- const nameChar11 = ":A-Za-z_À-˿Ͱ-ͽͿ-҆҈-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿\\-\\.\\d·̀-ͯ҇‿-⁀";
32688
+ const nameChar11 = nameStartChar11 + "\\-\\.\\d" + "·" + "̀-ͯ" + "҇" + "‿-⁀";
32488
32689
  const buildRegexes = (startChar, char, flags = "") => {
32489
32690
  const ncNamePat = `[${startChar.replace(":", "")}][${char.replace(":", "")}]*`;
32490
32691
  return {
@@ -32512,7 +32713,7 @@ const getRegexes = (xmlVersion = "1.0", asciiOnly = false) => {
32512
32713
  */
32513
32714
  const qName = (str, { xmlVersion = "1.0", asciiOnly = false } = {}) => getRegexes(xmlVersion, asciiOnly).qName.test(str);
32514
32715
  //#endregion
32515
- //#region ../../node_modules/.pnpm/fast-xml-parser@5.10.1/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
32716
+ //#region ../../node_modules/.pnpm/fast-xml-parser@5.11.1/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
32516
32717
  var DocTypeReader = class {
32517
32718
  constructor(options, xmlVersion) {
32518
32719
  this.suppressValidationErr = !options;
@@ -32529,41 +32730,54 @@ var DocTypeReader = class {
32529
32730
  i = i + 9;
32530
32731
  let angleBracketsCount = 1;
32531
32732
  let hasBody = false, comment = false;
32733
+ let quoteChar = null;
32532
32734
  let exp = "";
32533
- for (; i < xmlData.length; i++) if (xmlData[i] === "<" && !comment) {
32534
- if (hasBody && hasSeq(xmlData, "!ENTITY", i)) {
32535
- i += 7;
32536
- let entityName, val;
32537
- [entityName, val, i] = this.readEntityExp(xmlData, i + 1, this.suppressValidationErr);
32538
- if (val.indexOf("&") === -1) {
32539
- if (this.options.enabled !== false && this.options.maxEntityCount != null && entityCount >= this.options.maxEntityCount) throw new Error(`Entity count (${entityCount + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`);
32540
- entities[entityName] = val;
32541
- entityCount++;
32542
- }
32543
- } else if (hasBody && hasSeq(xmlData, "!ELEMENT", i)) {
32544
- i += 8;
32545
- const { index } = this.readElementExp(xmlData, i + 1);
32546
- i = index;
32547
- } else if (hasBody && hasSeq(xmlData, "!ATTLIST", i)) i += 8;
32548
- else if (hasBody && hasSeq(xmlData, "!NOTATION", i)) {
32549
- i += 9;
32550
- const { index } = this.readNotationExp(xmlData, i + 1, this.suppressValidationErr);
32551
- i = index;
32552
- } else if (hasSeq(xmlData, "!--", i)) comment = true;
32553
- else throw new Error(`Invalid DOCTYPE`);
32554
- angleBracketsCount++;
32555
- exp = "";
32556
- } else if (xmlData[i] === ">") {
32557
- if (comment) {
32558
- if (xmlData[i - 1] === "-" && xmlData[i - 2] === "-") {
32559
- comment = false;
32560
- angleBracketsCount--;
32561
- }
32562
- } else angleBracketsCount--;
32563
- if (angleBracketsCount === 0) break;
32564
- } else if (xmlData[i] === "[") hasBody = true;
32565
- else exp += xmlData[i];
32566
- if (angleBracketsCount !== 0) throw new Error(`Unclosed DOCTYPE`);
32735
+ for (; i < xmlData.length; i++) {
32736
+ if (quoteChar !== null) {
32737
+ if (xmlData[i] === quoteChar) quoteChar = null;
32738
+ exp += xmlData[i];
32739
+ continue;
32740
+ }
32741
+ if (!hasBody && !comment && (xmlData[i] === "\"" || xmlData[i] === "'")) {
32742
+ quoteChar = xmlData[i];
32743
+ exp += xmlData[i];
32744
+ continue;
32745
+ }
32746
+ if (xmlData[i] === "<" && !comment) {
32747
+ if (hasBody && hasSeq(xmlData, "!ENTITY", i)) {
32748
+ i += 7;
32749
+ let entityName, val;
32750
+ [entityName, val, i] = this.readEntityExp(xmlData, i + 1, this.suppressValidationErr);
32751
+ if (val.indexOf("&") === -1) {
32752
+ if (this.options.enabled !== false && this.options.maxEntityCount != null && entityCount >= this.options.maxEntityCount) throw new Error(`Entity count (${entityCount + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`);
32753
+ entities[entityName] = val;
32754
+ entityCount++;
32755
+ }
32756
+ } else if (hasBody && hasSeq(xmlData, "!ELEMENT", i)) {
32757
+ i += 8;
32758
+ const { index } = this.readElementExp(xmlData, i + 1);
32759
+ i = index;
32760
+ } else if (hasBody && hasSeq(xmlData, "!ATTLIST", i)) i += 8;
32761
+ else if (hasBody && hasSeq(xmlData, "!NOTATION", i)) {
32762
+ i += 9;
32763
+ const { index } = this.readNotationExp(xmlData, i + 1, this.suppressValidationErr);
32764
+ i = index;
32765
+ } else if (hasSeq(xmlData, "!--", i)) comment = true;
32766
+ else throw new Error(`Invalid DOCTYPE`);
32767
+ angleBracketsCount++;
32768
+ exp = "";
32769
+ } else if (xmlData[i] === ">") {
32770
+ if (comment) {
32771
+ if (xmlData[i - 1] === "-" && xmlData[i - 2] === "-") {
32772
+ comment = false;
32773
+ angleBracketsCount--;
32774
+ }
32775
+ } else angleBracketsCount--;
32776
+ if (angleBracketsCount === 0) break;
32777
+ } else if (xmlData[i] === "[") hasBody = true;
32778
+ else exp += xmlData[i];
32779
+ }
32780
+ if (quoteChar !== null || angleBracketsCount !== 0) throw new Error(`Unclosed DOCTYPE`);
32567
32781
  } else throw new Error(`Invalid Tag instead of DOCTYPE`);
32568
32782
  return {
32569
32783
  entities,
@@ -32917,7 +33131,7 @@ function anynum(str) {
32917
33131
  return chars.join("");
32918
33132
  }
32919
33133
  //#endregion
32920
- //#region ../../node_modules/.pnpm/strnum@2.4.1/node_modules/strnum/strnum.js
33134
+ //#region ../../node_modules/.pnpm/strnum@2.4.2/node_modules/strnum/strnum.js
32921
33135
  const hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
32922
33136
  const binRegex = /^0b[01]+$/;
32923
33137
  const octRegex = /^0o[0-7]+$/;
@@ -32960,12 +33174,15 @@ function toNumber(str, options = {}) {
32960
33174
  const num = Number(trimmedStr);
32961
33175
  const parsedStr = String(num);
32962
33176
  if (num === 0) return num;
32963
- if (parsedStr.search(/[eE]/) !== -1) if (options.eNotation) return num;
32964
- else return str;
32965
- else if (trimmedStr.indexOf(".") !== -1) if (parsedStr === "0") return num;
32966
- else if (parsedStr === numTrimmedByZeros) return num;
32967
- else if (parsedStr === `${sign}${numTrimmedByZeros}`) return num;
32968
- else return str;
33177
+ if (parsedStr.search(/[eE]/) !== -1) {
33178
+ if (options.eNotation) return num;
33179
+ else return str;
33180
+ } else if (trimmedStr.indexOf(".") !== -1) {
33181
+ if (parsedStr === "0") return num;
33182
+ else if (parsedStr === numTrimmedByZeros) return num;
33183
+ else if (parsedStr === `${sign}${numTrimmedByZeros}`) return num;
33184
+ else return str;
33185
+ }
32969
33186
  let n = leadingZeros ? numTrimmedByZeros : trimmedStr;
32970
33187
  if (leadingZeros) return n === parsedStr || sign + n === parsedStr ? num : str;
32971
33188
  else return n === parsedStr || n === sign + parsedStr ? num : str;
@@ -32984,11 +33201,12 @@ function resolveEnotation(str, trimmedStr, options) {
32984
33201
  const eAdjacentToLeadingZeros = sign ? str[leadingZeros.length + 1] === eChar : str[leadingZeros.length] === eChar;
32985
33202
  if (leadingZeros.length > 1 && eAdjacentToLeadingZeros) return str;
32986
33203
  else if (leadingZeros.length === 1 && (notation[3].startsWith(`.${eChar}`) || notation[3][0] === eChar)) return Number(trimmedStr);
32987
- else if (leadingZeros.length > 0) if (options.leadingZeros && !eAdjacentToLeadingZeros) {
32988
- trimmedStr = (notation[1] || "") + notation[3];
32989
- return Number(trimmedStr);
32990
- } else return str;
32991
- else return Number(trimmedStr);
33204
+ else if (leadingZeros.length > 0) {
33205
+ if (options.leadingZeros && !eAdjacentToLeadingZeros) {
33206
+ trimmedStr = (notation[1] || "") + notation[3];
33207
+ return Number(trimmedStr);
33208
+ } else return str;
33209
+ } else return Number(trimmedStr);
32992
33210
  } else return str;
32993
33211
  }
32994
33212
  /**
@@ -32998,7 +33216,9 @@ function resolveEnotation(str, trimmedStr, options) {
32998
33216
  */
32999
33217
  function trimZeros(numStr) {
33000
33218
  if (numStr && numStr.indexOf(".") !== -1) {
33001
- numStr = numStr.replace(/0+$/, "");
33219
+ let end = numStr.length;
33220
+ while (end > 0 && numStr.charCodeAt(end - 1) === 48) end--;
33221
+ numStr = numStr.slice(0, end);
33002
33222
  if (numStr === ".") numStr = "0";
33003
33223
  else if (numStr[0] === ".") numStr = "0" + numStr;
33004
33224
  else if (numStr[numStr.length - 1] === ".") numStr = numStr.substring(0, numStr.length - 1);
@@ -33031,7 +33251,7 @@ function handleInfinity(str, num, options) {
33031
33251
  }
33032
33252
  }
33033
33253
  //#endregion
33034
- //#region ../../node_modules/.pnpm/fast-xml-parser@5.10.1/node_modules/fast-xml-parser/src/ignoreAttributes.js
33254
+ //#region ../../node_modules/.pnpm/fast-xml-parser@5.11.1/node_modules/fast-xml-parser/src/ignoreAttributes.js
33035
33255
  function getIgnoreAttributesFn(ignoreAttributes) {
33036
33256
  if (typeof ignoreAttributes === "function") return ignoreAttributes;
33037
33257
  if (Array.isArray(ignoreAttributes)) return (attrName) => {
@@ -33080,19 +33300,20 @@ var Expression = class {
33080
33300
  const segments = [];
33081
33301
  let i = 0;
33082
33302
  let currentPart = "";
33083
- while (i < pattern.length) if (pattern[i] === this.separator) if (i + 1 < pattern.length && pattern[i + 1] === this.separator) {
33084
- if (currentPart.trim()) {
33085
- segments.push(this._parseSegment(currentPart.trim()));
33303
+ while (i < pattern.length) if (pattern[i] === this.separator) {
33304
+ if (i + 1 < pattern.length && pattern[i + 1] === this.separator) {
33305
+ if (currentPart.trim()) {
33306
+ segments.push(this._parseSegment(currentPart.trim()));
33307
+ currentPart = "";
33308
+ }
33309
+ segments.push({ type: "deep-wildcard" });
33310
+ i += 2;
33311
+ } else {
33312
+ if (currentPart.trim()) segments.push(this._parseSegment(currentPart.trim()));
33086
33313
  currentPart = "";
33314
+ i++;
33087
33315
  }
33088
- segments.push({ type: "deep-wildcard" });
33089
- i += 2;
33090
33316
  } else {
33091
- if (currentPart.trim()) segments.push(this._parseSegment(currentPart.trim()));
33092
- currentPart = "";
33093
- i++;
33094
- }
33095
- else {
33096
33317
  currentPart += pattern[i];
33097
33318
  i++;
33098
33319
  }
@@ -33144,11 +33365,13 @@ var Expression = class {
33144
33365
  if (!tag) throw new Error(`Invalid segment pattern: ${part}`);
33145
33366
  segment.tag = tag;
33146
33367
  if (namespace) segment.namespace = namespace;
33147
- if (bracketContent) if (bracketContent.includes("=")) {
33148
- const eqIndex = bracketContent.indexOf("=");
33149
- segment.attrName = bracketContent.substring(0, eqIndex).trim();
33150
- segment.attrValue = bracketContent.substring(eqIndex + 1).trim();
33151
- } else segment.attrName = bracketContent.trim();
33368
+ if (bracketContent) {
33369
+ if (bracketContent.includes("=")) {
33370
+ const eqIndex = bracketContent.indexOf("=");
33371
+ segment.attrName = bracketContent.substring(0, eqIndex).trim();
33372
+ segment.attrValue = bracketContent.substring(eqIndex + 1).trim();
33373
+ } else segment.attrName = bracketContent.trim();
33374
+ }
33152
33375
  if (positionMatch) {
33153
33376
  const nthMatch = positionMatch.match(/^nth\((\d+)\)$/);
33154
33377
  if (nthMatch) {
@@ -34713,7 +34936,7 @@ function isUnsafe(value, context) {
34713
34936
  return false;
34714
34937
  }
34715
34938
  //#endregion
34716
- //#region ../../node_modules/.pnpm/fast-xml-parser@5.10.1/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
34939
+ //#region ../../node_modules/.pnpm/fast-xml-parser@5.11.1/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
34717
34940
  /**
34718
34941
  * Extract raw attributes (without prefix) from prefixed attribute map
34719
34942
  * @param {object} prefixedAttrs - Attributes with prefix from buildAttributesMap
@@ -34919,7 +35142,8 @@ const parseXml = function(xmlData) {
34919
35142
  }
34920
35143
  this.matcher.pop();
34921
35144
  this.isCurrentNodeStopNode = false;
34922
- currentNode = this.tagsNodeStack.pop();
35145
+ currentNode = this.tagsNodeStack.pop() || xmlObj;
35146
+ if (options.captureMetaData && currentNode) currentNode.addEndIndex(closeIndex + 1);
34923
35147
  textData = "";
34924
35148
  i = closeIndex;
34925
35149
  } else if (c1 === 63) {
@@ -34937,6 +35161,7 @@ const parseXml = function(xmlData) {
34937
35161
  childNode.add(options.textNodeName, "");
34938
35162
  if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent && options.ignoreAttributes !== true) childNode[":@"] = attsMap;
34939
35163
  this.addChild(currentNode, childNode, this.readonlyMatcher, i);
35164
+ if (options.captureMetaData) currentNode.addEndIndex(tagData.closeIndex + 2);
34940
35165
  }
34941
35166
  i = tagData.closeIndex + 1;
34942
35167
  } else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 45 && xmlData.charCodeAt(i + 3) === 45) {
@@ -35018,18 +35243,21 @@ const parseXml = function(xmlData) {
35018
35243
  this.matcher.pop();
35019
35244
  this.isCurrentNodeStopNode = false;
35020
35245
  this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
35246
+ if (options.captureMetaData) currentNode.addEndIndex(i + 1);
35021
35247
  } else {
35022
35248
  if (isSelfClosing) {
35023
35249
  ({tagName, tagExp} = transformTagName(options.transformTagName, tagName, tagExp, options));
35024
35250
  const childNode = new XmlNode(tagName);
35025
35251
  if (prefixedAttrs) childNode[":@"] = prefixedAttrs;
35026
35252
  this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
35253
+ if (options.captureMetaData) currentNode.addEndIndex(closeIndex + 1);
35027
35254
  this.matcher.pop();
35028
35255
  this.isCurrentNodeStopNode = false;
35029
35256
  } else if (options.unpairedTagsSet.has(tagName)) {
35030
35257
  const childNode = new XmlNode(tagName);
35031
35258
  if (prefixedAttrs) childNode[":@"] = prefixedAttrs;
35032
35259
  this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
35260
+ if (options.captureMetaData) currentNode.addEndIndex(result.closeIndex + 1);
35033
35261
  this.matcher.pop();
35034
35262
  this.isCurrentNodeStopNode = false;
35035
35263
  i = result.closeIndex;
@@ -35111,22 +35339,23 @@ function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
35111
35339
  if (attrBoundary) {
35112
35340
  if (code === attrBoundary) attrBoundary = 0;
35113
35341
  } else if (code === 34 || code === 39) attrBoundary = code;
35114
- else if (code === closeCode0) if (closeCode1 !== -1) {
35115
- if (xmlData.charCodeAt(index + 1) === closeCode1) {
35342
+ else if (code === closeCode0) {
35343
+ if (closeCode1 !== -1) {
35344
+ if (xmlData.charCodeAt(index + 1) === closeCode1) {
35345
+ result += xmlData.substring(segmentStart, index);
35346
+ return {
35347
+ data: result,
35348
+ index
35349
+ };
35350
+ }
35351
+ } else {
35116
35352
  result += xmlData.substring(segmentStart, index);
35117
35353
  return {
35118
35354
  data: result,
35119
35355
  index
35120
35356
  };
35121
35357
  }
35122
- } else {
35123
- result += xmlData.substring(segmentStart, index);
35124
- return {
35125
- data: result,
35126
- index
35127
- };
35128
- }
35129
- else if (code === 9 && !attrBoundary) {
35358
+ } else if (code === 9 && !attrBoundary) {
35130
35359
  result += xmlData.substring(segmentStart, index) + " ";
35131
35360
  segmentStart = index + 1;
35132
35361
  }
@@ -35231,7 +35460,7 @@ function sanitizeName(name, options) {
35231
35460
  return name;
35232
35461
  }
35233
35462
  //#endregion
35234
- //#region ../../node_modules/.pnpm/fast-xml-parser@5.10.1/node_modules/fast-xml-parser/src/xmlparser/node2json.js
35463
+ //#region ../../node_modules/.pnpm/fast-xml-parser@5.11.1/node_modules/fast-xml-parser/src/xmlparser/node2json.js
35235
35464
  const METADATA_SYMBOL = XmlNode.getMetaDataSymbol();
35236
35465
  /**
35237
35466
  * Helper function to strip attribute prefix from attribute map
@@ -35275,17 +35504,20 @@ function compress(arr, options, matcher, readonlyMatcher) {
35275
35504
  const rawAttrs = stripAttributePrefix(tagObj[":@"] || {}, options.attributeNamePrefix);
35276
35505
  matcher.push(property, rawAttrs);
35277
35506
  }
35278
- if (property === options.textNodeName) if (text === void 0) text = tagObj[property];
35279
- else text += "" + tagObj[property];
35280
- else if (property === void 0) continue;
35507
+ if (property === options.textNodeName) {
35508
+ if (text === void 0) text = tagObj[property];
35509
+ else text += "" + tagObj[property];
35510
+ } else if (property === void 0) continue;
35281
35511
  else if (tagObj[property]) {
35282
35512
  let val = compress(tagObj[property], options, matcher, readonlyMatcher);
35283
35513
  const isLeaf = isLeafTag(val, options);
35284
35514
  if (Object.keys(val).length === 0 && options.alwaysCreateTextNode) val[options.textNodeName] = "";
35285
35515
  if (tagObj[":@"]) assignAttributes(val, tagObj[":@"], readonlyMatcher, options);
35286
35516
  else if (Object.keys(val).length === 1 && val[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) val = val[options.textNodeName];
35287
- else if (Object.keys(val).length === 0) if (options.alwaysCreateTextNode) val[options.textNodeName] = "";
35288
- else val = "";
35517
+ else if (Object.keys(val).length === 0) {
35518
+ if (options.alwaysCreateTextNode) val[options.textNodeName] = "";
35519
+ else val = "";
35520
+ }
35289
35521
  if (tagObj[METADATA_SYMBOL] !== void 0 && typeof val === "object" && val !== null) val[METADATA_SYMBOL] = tagObj[METADATA_SYMBOL];
35290
35522
  if (compressedObj[property] !== void 0 && Object.prototype.hasOwnProperty.call(compressedObj, property)) {
35291
35523
  if (!Array.isArray(compressedObj[property])) compressedObj[property] = [compressedObj[property]];
@@ -35331,7 +35563,7 @@ function isLeafTag(obj, options) {
35331
35563
  return false;
35332
35564
  }
35333
35565
  //#endregion
35334
- //#region ../../node_modules/.pnpm/fast-xml-parser@5.10.1/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
35566
+ //#region ../../node_modules/.pnpm/fast-xml-parser@5.11.1/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
35335
35567
  var XMLParser = class {
35336
35568
  constructor(options) {
35337
35569
  this.externalEntities = {};
@@ -35997,7 +36229,8 @@ const byArticle$4 = make$16("by-article", {
35997
36229
  }, ({ id, lang, onlyDb }) => gen(function* () {
35998
36230
  const ai = yield* Ai;
35999
36231
  const renderer = yield* Renderer;
36000
- const refId = yield* resolveArticleId(yield* Resolver, id);
36232
+ const resolver = yield* Resolver;
36233
+ const refId = yield* resolveArticleId(resolver, id);
36001
36234
  const res = yield* ai.getInsightsByArticle(refId, {
36002
36235
  lang: unwrap$18(lang),
36003
36236
  onlyDb
@@ -36976,12 +37209,14 @@ const refresh = make$16("refresh", {
36976
37209
  }, ({ id, to, force, noWait }) => gen(function* () {
36977
37210
  const ai = yield* Ai;
36978
37211
  const renderer = yield* Renderer;
36979
- const refId = yield* resolveArticleId(yield* Resolver, id);
36980
- const final = yield* followTask(ai, renderer, yield* ai.refreshInsights({
37212
+ const resolver = yield* Resolver;
37213
+ const refId = yield* resolveArticleId(resolver, id);
37214
+ const created = yield* ai.refreshInsights({
36981
37215
  refId,
36982
37216
  targetLanguages: to.length ? to : void 0,
36983
37217
  force
36984
- }), noWait);
37218
+ });
37219
+ const final = yield* followTask(ai, renderer, created, noWait);
36985
37220
  yield* renderer.emit(aiTaskView, final);
36986
37221
  })).pipe(withDescription("refresh AI insights for an article"));
36987
37222
  const translate$1 = make$16("translate", {
@@ -36992,12 +37227,14 @@ const translate$1 = make$16("translate", {
36992
37227
  }, ({ id, to, force, noWait }) => gen(function* () {
36993
37228
  const ai = yield* Ai;
36994
37229
  const renderer = yield* Renderer;
36995
- const refId = yield* resolveArticleId(yield* Resolver, id);
36996
- const final = yield* followTask(ai, renderer, yield* ai.translateInsights({
37230
+ const resolver = yield* Resolver;
37231
+ const refId = yield* resolveArticleId(resolver, id);
37232
+ const created = yield* ai.translateInsights({
36997
37233
  refId,
36998
37234
  targetLang: to,
36999
37235
  force
37000
- }), noWait);
37236
+ });
37237
+ const final = yield* followTask(ai, renderer, created, noWait);
37001
37238
  yield* renderer.emit(aiTaskView, final);
37002
37239
  })).pipe(withDescription("translate the existing AI insights into another language"));
37003
37240
  //#endregion
@@ -37014,7 +37251,8 @@ const insightsCmd = make$16("insights").pipe(withDescription("manage AI insights
37014
37251
  const byArticle$3 = make$16("by-article", { id: text$6({ name: "idOrSlug" }) }, ({ id }) => gen(function* () {
37015
37252
  const ai = yield* Ai;
37016
37253
  const renderer = yield* Renderer;
37017
- const refId = yield* resolveArticleId(yield* Resolver, id);
37254
+ const resolver = yield* Resolver;
37255
+ const refId = yield* resolveArticleId(resolver, id);
37018
37256
  const res = yield* ai.getOverviewByArticle(refId);
37019
37257
  yield* renderer.emitSuccess(res);
37020
37258
  })).pipe(withDescription("show the AI artifact overview for one article"));
@@ -37061,7 +37299,8 @@ const byArticle$2 = make$16("by-article", {
37061
37299
  }, ({ id, lang, onlyDb }) => gen(function* () {
37062
37300
  const ai = yield* Ai;
37063
37301
  const renderer = yield* Renderer;
37064
- const refId = yield* resolveArticleId(yield* Resolver, id);
37302
+ const resolver = yield* Resolver;
37303
+ const refId = yield* resolveArticleId(resolver, id);
37065
37304
  const res = yield* ai.getSummariesByArticle(refId, {
37066
37305
  lang: unwrap$15(lang),
37067
37306
  onlyDb
@@ -37156,12 +37395,14 @@ const regen = make$16("regen", {
37156
37395
  }, ({ id, to, force, noWait }) => gen(function* () {
37157
37396
  const ai = yield* Ai;
37158
37397
  const renderer = yield* Renderer;
37159
- const refId = yield* resolveArticleId(yield* Resolver, id);
37160
- const final = yield* followTask(ai, renderer, yield* ai.regenSummary({
37398
+ const resolver = yield* Resolver;
37399
+ const refId = yield* resolveArticleId(resolver, id);
37400
+ const created = yield* ai.regenSummary({
37161
37401
  refId,
37162
37402
  targetLanguages: to.length ? to : void 0,
37163
37403
  force
37164
- }), noWait);
37404
+ });
37405
+ const final = yield* followTask(ai, renderer, created, noWait);
37165
37406
  yield* renderer.emit(aiTaskView, final);
37166
37407
  })).pipe(withDescription("regenerate the AI summary for an article"));
37167
37408
  const translate = make$16("translate", {
@@ -37172,12 +37413,14 @@ const translate = make$16("translate", {
37172
37413
  }, ({ id, to, force, noWait }) => gen(function* () {
37173
37414
  const ai = yield* Ai;
37174
37415
  const renderer = yield* Renderer;
37175
- const refId = yield* resolveArticleId(yield* Resolver, id);
37176
- const final = yield* followTask(ai, renderer, yield* ai.translateSummary({
37416
+ const resolver = yield* Resolver;
37417
+ const refId = yield* resolveArticleId(resolver, id);
37418
+ const created = yield* ai.translateSummary({
37177
37419
  refId,
37178
37420
  targetLang: to,
37179
37421
  force
37180
- }), noWait);
37422
+ });
37423
+ const final = yield* followTask(ai, renderer, created, noWait);
37181
37424
  yield* renderer.emit(aiTaskView, final);
37182
37425
  })).pipe(withDescription("translate the existing AI summary into another language"));
37183
37426
  //#endregion
@@ -37202,7 +37445,8 @@ const byArticle$1 = make$16("by-article", {
37202
37445
  }, ({ id, lang }) => gen(function* () {
37203
37446
  const ai = yield* Ai;
37204
37447
  const renderer = yield* Renderer;
37205
- const refId = yield* resolveArticleId(yield* Resolver, id);
37448
+ const resolver = yield* Resolver;
37449
+ const refId = yield* resolveArticleId(resolver, id);
37206
37450
  const res = yield* ai.getTranslationsByArticle(refId, { lang: unwrap$13(lang) });
37207
37451
  yield* renderer.emitSuccess(res);
37208
37452
  })).pipe(withDescription("show an article's translations"));
@@ -37413,7 +37657,8 @@ const get$11 = make$16("get", { recordId: text$6({ name: "recordId" }) }, ({ rec
37413
37657
  const languages = make$16("languages", { id: text$6({ name: "idOrSlug" }) }, ({ id }) => gen(function* () {
37414
37658
  const ai = yield* Ai;
37415
37659
  const renderer = yield* Renderer;
37416
- const refId = yield* resolveArticleId(yield* Resolver, id);
37660
+ const resolver = yield* Resolver;
37661
+ const refId = yield* resolveArticleId(resolver, id);
37417
37662
  const res = yield* ai.getTranslationLanguages(refId);
37418
37663
  yield* renderer.emitSuccess(res);
37419
37664
  })).pipe(withDescription("list languages an article has been translated into"));
@@ -37447,12 +37692,14 @@ const run$2 = make$16("run", {
37447
37692
  if (!to.length) return yield* fail$8(new ValidationFailed({ message: "at least one --to <lang> is required" }));
37448
37693
  const ai = yield* Ai;
37449
37694
  const renderer = yield* Renderer;
37450
- const refId = yield* resolveArticleId(yield* Resolver, id);
37451
- const final = yield* followTask(ai, renderer, yield* ai.translate({
37695
+ const resolver = yield* Resolver;
37696
+ const refId = yield* resolveArticleId(resolver, id);
37697
+ const created = yield* ai.translate({
37452
37698
  refId,
37453
37699
  targetLanguages: to,
37454
37700
  force
37455
- }), noWait);
37701
+ });
37702
+ const final = yield* followTask(ai, renderer, created, noWait);
37456
37703
  yield* renderer.emit(aiTaskView, final);
37457
37704
  })).pipe(withDescription("translate an article into one or more languages"));
37458
37705
  //#endregion
@@ -37470,7 +37717,8 @@ const translateCmd = make$16("translate").pipe(withDescription("manage AI transl
37470
37717
  const byArticle = make$16("by-article", { id: text$6({ name: "idOrSlug" }) }, ({ id }) => gen(function* () {
37471
37718
  const ai = yield* Ai;
37472
37719
  const renderer = yield* Renderer;
37473
- const refId = yield* resolveArticleId(yield* Resolver, id);
37720
+ const resolver = yield* Resolver;
37721
+ const refId = yield* resolveArticleId(resolver, id);
37474
37722
  const res = yield* ai.getTtsByArticle(refId);
37475
37723
  yield* renderer.emitSuccess(res);
37476
37724
  })).pipe(withDescription("show an article's AI narrations (all rows)"));
@@ -37515,12 +37763,14 @@ const run$1 = make$16("run", {
37515
37763
  }, ({ id, to, force, noWait }) => gen(function* () {
37516
37764
  const ai = yield* Ai;
37517
37765
  const renderer = yield* Renderer;
37518
- const refId = yield* resolveArticleId(yield* Resolver, id);
37519
- const final = yield* followTask(ai, renderer, yield* ai.runTts({
37766
+ const resolver = yield* Resolver;
37767
+ const refId = yield* resolveArticleId(resolver, id);
37768
+ const created = yield* ai.runTts({
37520
37769
  refId,
37521
37770
  targetLanguages: to.length ? to : void 0,
37522
37771
  force
37523
- }), noWait);
37772
+ });
37773
+ const final = yield* followTask(ai, renderer, created, noWait);
37524
37774
  yield* renderer.emit(aiTaskView, final);
37525
37775
  })).pipe(withDescription("generate AI narration for an article"));
37526
37776
  const voices = make$16("voices", {
@@ -37639,27 +37889,27 @@ const isWsl = () => {
37639
37889
  var is_wsl_default = process$1.env.__IS_WSL_TEST__ ? isWsl : isWsl();
37640
37890
  //#endregion
37641
37891
  //#region ../../node_modules/.pnpm/powershell-utils@0.1.0/node_modules/powershell-utils/index.js
37642
- const execFile$2 = promisify(childProcess.execFile);
37643
- const powerShellPath$1 = () => `${process$1.env.SYSTEMROOT || process$1.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
37644
- const executePowerShell = async (command, options = {}) => {
37892
+ const execFile$3 = promisify(childProcess.execFile);
37893
+ const powerShellPath$2 = () => `${process$1.env.SYSTEMROOT || process$1.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
37894
+ const executePowerShell$1 = async (command, options = {}) => {
37645
37895
  const { powerShellPath: psPath, ...execFileOptions } = options;
37646
- const encodedCommand = executePowerShell.encodeCommand(command);
37647
- return execFile$2(psPath ?? powerShellPath$1(), [...executePowerShell.argumentsPrefix, encodedCommand], {
37896
+ const encodedCommand = executePowerShell$1.encodeCommand(command);
37897
+ return execFile$3(psPath ?? powerShellPath$2(), [...executePowerShell$1.argumentsPrefix, encodedCommand], {
37648
37898
  encoding: "utf8",
37649
37899
  ...execFileOptions
37650
37900
  });
37651
37901
  };
37652
- executePowerShell.argumentsPrefix = [
37902
+ executePowerShell$1.argumentsPrefix = [
37653
37903
  "-NoProfile",
37654
37904
  "-NonInteractive",
37655
37905
  "-ExecutionPolicy",
37656
37906
  "Bypass",
37657
37907
  "-EncodedCommand"
37658
37908
  ];
37659
- executePowerShell.encodeCommand = (command) => Buffer$1.from(command, "utf16le").toString("base64");
37660
- executePowerShell.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
37909
+ executePowerShell$1.encodeCommand = (command) => Buffer$1.from(command, "utf16le").toString("base64");
37910
+ executePowerShell$1.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
37661
37911
  //#endregion
37662
- //#region ../../node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/utilities.js
37912
+ //#region ../../node_modules/.pnpm/wsl-utils@1.0.0/node_modules/wsl-utils/utilities.js
37663
37913
  function parseMountPointFromConfig(content) {
37664
37914
  for (const line of content.split("\n")) {
37665
37915
  if (/^\s*#/.test(line)) continue;
@@ -37669,8 +37919,8 @@ function parseMountPointFromConfig(content) {
37669
37919
  }
37670
37920
  }
37671
37921
  //#endregion
37672
- //#region ../../node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/index.js
37673
- const execFile$1 = promisify(childProcess.execFile);
37922
+ //#region ../../node_modules/.pnpm/wsl-utils@1.0.0/node_modules/wsl-utils/index.js
37923
+ const execFile$2 = promisify(childProcess.execFile);
37674
37924
  const wslDrivesMountPoint = (() => {
37675
37925
  const defaultMountPoint = "/mnt/";
37676
37926
  let mountPoint;
@@ -37693,12 +37943,12 @@ const wslDrivesMountPoint = (() => {
37693
37943
  const powerShellPathFromWsl = async () => {
37694
37944
  return `${await wslDrivesMountPoint()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
37695
37945
  };
37696
- const powerShellPath = is_wsl_default ? powerShellPathFromWsl : powerShellPath$1;
37946
+ const powerShellPath$1 = is_wsl_default ? powerShellPathFromWsl : powerShellPath$2;
37697
37947
  let canAccessPowerShellPromise;
37698
37948
  const canAccessPowerShell = async () => {
37699
37949
  canAccessPowerShellPromise ??= (async () => {
37700
37950
  try {
37701
- const psPath = await powerShellPath();
37951
+ const psPath = await powerShellPath$1();
37702
37952
  await fs$1.access(psPath, constants.X_OK);
37703
37953
  return true;
37704
37954
  } catch {
@@ -37708,20 +37958,60 @@ const canAccessPowerShell = async () => {
37708
37958
  return canAccessPowerShellPromise;
37709
37959
  };
37710
37960
  const wslDefaultBrowser = async () => {
37711
- const psPath = await powerShellPath();
37712
- const { stdout } = await executePowerShell(String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`, { powerShellPath: psPath });
37961
+ const psPath = await powerShellPath$1();
37962
+ const command = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
37963
+ const { stdout } = await executePowerShell$1(command, {
37964
+ powerShellPath: psPath,
37965
+ cwd: path.dirname(psPath)
37966
+ });
37713
37967
  return stdout.trim();
37714
37968
  };
37715
- const convertWslPathToWindows = async (path) => {
37716
- if (/^[a-z]+:\/\//i.test(path)) return path;
37717
- try {
37718
- const { stdout } = await execFile$1("wslpath", ["-aw", path], { encoding: "utf8" });
37719
- return stdout.trim();
37720
- } catch {
37721
- return path;
37722
- }
37969
+ const isUrl = (path) => /^[a-z]+:\/\//i.test(path);
37970
+ const convertWslPathToWindows = async (paths) => {
37971
+ const isBatch = Array.isArray(paths);
37972
+ const pathArray = isBatch ? paths : [paths];
37973
+ const indicesToConvert = [];
37974
+ const pathsToConvert = [];
37975
+ for (const [index, path] of pathArray.entries()) if (!isUrl(path)) {
37976
+ indicesToConvert.push(index);
37977
+ pathsToConvert.push(path);
37978
+ }
37979
+ const results = [...pathArray];
37980
+ if (pathsToConvert.length > 0) try {
37981
+ const { stdout } = await execFile$2("wslpath", ["-aw", ...pathsToConvert], { encoding: "utf8" });
37982
+ const convertedPaths = stdout.split(/\r?\n/).filter(Boolean);
37983
+ for (const [index, originalIndex] of indicesToConvert.entries()) results[originalIndex] = convertedPaths[index] ?? pathArray[originalIndex];
37984
+ } catch {}
37985
+ return isBatch ? results : results[0];
37723
37986
  };
37724
37987
  //#endregion
37988
+ //#region ../../node_modules/.pnpm/powershell-utils@0.2.1/node_modules/powershell-utils/index.js
37989
+ const execFile$1 = promisify(childProcess.execFile);
37990
+ const powerShellPath = () => `${process$1.env.SYSTEMROOT || process$1.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
37991
+ const argumentsPrefix = [
37992
+ "-NoProfile",
37993
+ "-NonInteractive",
37994
+ "-ExecutionPolicy",
37995
+ "Bypass",
37996
+ "-EncodedCommand"
37997
+ ];
37998
+ const encodeCommand = (command) => Buffer$1.from(command, "utf16le").toString("base64");
37999
+ const escapeArgument = (value) => `'${String(value).replaceAll(/['‘’‚‛]/g, (match) => match + match)}'`;
38000
+ const createArguments = (command) => [...argumentsPrefix, encodeCommand(command)];
38001
+ const createExecFileOptions = (options) => ({
38002
+ encoding: "utf8",
38003
+ ...options,
38004
+ shell: false
38005
+ });
38006
+ const executePowerShell = async (command, options = {}) => {
38007
+ const { powerShellPath: psPath, ...execFileOptions } = options;
38008
+ return execFile$1(psPath ?? powerShellPath(), createArguments(command), createExecFileOptions(execFileOptions));
38009
+ };
38010
+ executePowerShell.argumentsPrefix = argumentsPrefix;
38011
+ executePowerShell.encodeCommand = encodeCommand;
38012
+ executePowerShell.escapeArgument = escapeArgument;
38013
+ executePowerShell.createArguments = createArguments;
38014
+ //#endregion
37725
38015
  //#region ../../node_modules/.pnpm/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js
37726
38016
  function defineLazyProperty(object, propertyName, valueGetter) {
37727
38017
  const define = (value) => Object.defineProperty(object, propertyName, {
@@ -37778,7 +38068,7 @@ async function bundleName(bundleId) {
37778
38068
  return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
37779
38069
  }
37780
38070
  //#endregion
37781
- //#region ../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/windows.js
38071
+ //#region ../../node_modules/.pnpm/default-browser@5.5.1/node_modules/default-browser/windows.js
37782
38072
  const execFileAsync$1 = promisify(execFile);
37783
38073
  const windowsBrowserProgIds = {
37784
38074
  MSEdgeHTM: {
@@ -37849,7 +38139,7 @@ const windowsBrowserProgIds = {
37849
38139
  const _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
37850
38140
  var UnknownBrowserError = class extends Error {};
37851
38141
  async function defaultBrowser$1(_execFileAsync = execFileAsync$1) {
37852
- const { stdout } = await _execFileAsync("reg", [
38142
+ const { stdout } = await _execFileAsync(`${process$1.env.SYSTEMROOT ?? process$1.env.windir ?? "C:\\Windows"}\\System32\\reg.exe`, [
37853
38143
  "QUERY",
37854
38144
  " HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
37855
38145
  "/v",
@@ -37868,7 +38158,7 @@ async function defaultBrowser$1(_execFileAsync = execFileAsync$1) {
37868
38158
  };
37869
38159
  }
37870
38160
  //#endregion
37871
- //#region ../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/index.js
38161
+ //#region ../../node_modules/.pnpm/default-browser@5.5.1/node_modules/default-browser/index.js
37872
38162
  const execFileAsync = promisify(execFile);
37873
38163
  const titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
37874
38164
  async function defaultBrowser() {
@@ -37898,7 +38188,7 @@ async function defaultBrowser() {
37898
38188
  //#region ../../node_modules/.pnpm/is-in-ssh@1.0.0/node_modules/is-in-ssh/index.js
37899
38189
  const isInSsh = Boolean(process$1.env.SSH_CONNECTION || process$1.env.SSH_CLIENT || process$1.env.SSH_TTY);
37900
38190
  //#endregion
37901
- //#region ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
38191
+ //#region ../../node_modules/.pnpm/open@11.0.2/node_modules/open/index.js
37902
38192
  const fallbackAttemptSymbol = Symbol("fallbackAttempt");
37903
38193
  const __dirname = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
37904
38194
  const localXdgOpenPath = path.join(__dirname, "xdg-open");
@@ -37962,8 +38252,9 @@ const baseOpen = async (options) => {
37962
38252
  const progId = await wslDefaultBrowser();
37963
38253
  browser = _windowsBrowserProgIdMap.get(progId) ?? {};
37964
38254
  } else browser = await defaultBrowser();
37965
- if (browser.id in ids) {
38255
+ if (Object.hasOwn(ids, browser.id)) {
37966
38256
  const browserName = ids[browser.id.toLowerCase()];
38257
+ if (browserName === void 0) throw new Error(`${browser.name} is not supported as a default browser`);
37967
38258
  if (app === "browserPrivate") {
37968
38259
  if (browserName === "safari") throw new Error("Safari doesn't support opening in private mode via command line");
37969
38260
  appArguments.push(flags[browserName]);
@@ -37990,7 +38281,7 @@ const baseOpen = async (options) => {
37990
38281
  if (options.newInstance) cliArguments.push("--new");
37991
38282
  if (app) cliArguments.push("-a", app);
37992
38283
  } else if (platform$1 === "win32" || shouldUseWindowsInWsl) {
37993
- command = await powerShellPath();
38284
+ command = await powerShellPath$1();
37994
38285
  cliArguments.push(...executePowerShell.argumentsPrefix);
37995
38286
  if (!is_wsl_default) childProcessOptions.windowsVerbatimArguments = true;
37996
38287
  if (is_wsl_default && options.target) options.target = await convertWslPathToWindows(options.target);
@@ -38006,6 +38297,7 @@ const baseOpen = async (options) => {
38006
38297
  }
38007
38298
  options.target = executePowerShell.encodeCommand(encodedArguments.join(" "));
38008
38299
  if (!options.wait) childProcessOptions.stdio = "ignore";
38300
+ if (is_wsl_default) childProcessOptions.cwd = path.dirname(command);
38009
38301
  } else {
38010
38302
  if (app) command = app;
38011
38303
  else {
@@ -38463,13 +38755,14 @@ const login = make$16("login", { production: production$1 }, ({ production }) =>
38463
38755
  else if (!opts.quiet && code.verification_uri_complete) yield* sync$2(() => {
38464
38756
  open(code.verification_uri_complete).catch(() => void 0);
38465
38757
  });
38466
- const cred = toCredentials(yield* auth.pollDeviceToken(probeResult.authBase, DEFAULT_CLIENT_ID, code.device_code, {
38758
+ const token = yield* auth.pollDeviceToken(probeResult.authBase, DEFAULT_CLIENT_ID, code.device_code, {
38467
38759
  intervalSec: code.interval,
38468
38760
  expiresInSec: code.expires_in,
38469
38761
  onTick: (state) => {
38470
38762
  if (state === "slow_down" && !opts.quiet && !opts.json) process.stderr.write("slow_down — increasing interval\n");
38471
38763
  }
38472
- }));
38764
+ });
38765
+ const cred = toCredentials(token);
38473
38766
  const target = targetProfile?.trim() || DEFAULT_PROFILE;
38474
38767
  const existing = yield* config.readProfileConfig(target).pipe(catchAll$1(() => succeed$7({})));
38475
38768
  const productionFlag = getOrElse(production, () => void 0);
@@ -38497,7 +38790,8 @@ const login = make$16("login", { production: production$1 }, ({ production }) =>
38497
38790
  const name = user.name ?? user.email ?? "";
38498
38791
  const email = user.name && user.email ? ` (${user.email})` : "";
38499
38792
  const role = user.role;
38500
- return `${head}\n ${dim(role ? `${name}${email} · ${role}` : `${name}${email}`, color)}`;
38793
+ const meta = role ? `${name}${email} · ${role}` : `${name}${email}`;
38794
+ return `${head}\n ${dim(meta, color)}`;
38501
38795
  });
38502
38796
  }));
38503
38797
  //#endregion
@@ -38966,7 +39260,8 @@ const authorOf = (doc) => {
38966
39260
  };
38967
39261
  const refLabel = (doc) => {
38968
39262
  const refType = firstString(doc, "ref_type", "refType");
38969
- const title = firstString(asRecord(first(doc, "ref")), "title", "slug", "id");
39263
+ const ref = asRecord(first(doc, "ref"));
39264
+ const title = firstString(ref, "title", "slug", "id");
38970
39265
  if (refType && title) return `${refType}:${title}`;
38971
39266
  if (refType) return refType;
38972
39267
  return "";
@@ -38988,8 +39283,9 @@ const collectDetailFields = (doc) => {
38988
39283
  };
38989
39284
  const renderCommentReadable = (data, color) => {
38990
39285
  const doc = normalize$4(data);
39286
+ const title = `comment from ${authorOf(doc)}`;
38991
39287
  return renderMetadataBlock({
38992
- title: `comment from ${authorOf(doc)}`,
39288
+ title,
38993
39289
  kind: "comment",
38994
39290
  fields: collectDetailFields(doc),
38995
39291
  body: firstString(doc, "text") || void 0,
@@ -39012,7 +39308,8 @@ const commentView = {
39012
39308
  llm: (data) => renderCommentLlm(data)
39013
39309
  };
39014
39310
  const renderListHeader = (payload, rowCount, color) => {
39015
- const pagination = asRecord(first(asRecord(first(payload, "meta")), "pagination"));
39311
+ const envelopeMeta = asRecord(first(payload, "meta"));
39312
+ const pagination = asRecord(first(envelopeMeta, "pagination"));
39016
39313
  const page = first(pagination, "page", "currentPage");
39017
39314
  const size = first(pagination, "size", "pageSize");
39018
39315
  const total = first(pagination, "total", "totalCount", "total_count");
@@ -40044,12 +40341,12 @@ const extractId$1 = (res) => {
40044
40341
  };
40045
40342
  //#endregion
40046
40343
  //#region src/cli/draft/_shared.ts
40047
- /** Draft-native fields; everything else rides along in `typeSpecificData`. */
40048
- const DRAFT_CORE_KEYS$1 = /* @__PURE__ */ new Set([
40344
+ const DRAFT_CORE_KEYS = /* @__PURE__ */ new Set([
40049
40345
  "title",
40050
40346
  "text",
40051
40347
  "content",
40052
40348
  "contentFormat",
40349
+ "images",
40053
40350
  "meta"
40054
40351
  ]);
40055
40352
  const REF_TYPE_TO_RESOURCE = {
@@ -40060,50 +40357,17 @@ const REF_TYPE_TO_RESOURCE = {
40060
40357
  const splitDraftBody = (payload) => {
40061
40358
  const draftBody = {};
40062
40359
  const typeSpecificData = {};
40063
- for (const [key, value] of Object.entries(payload)) if (DRAFT_CORE_KEYS$1.has(key)) draftBody[key] = value;
40360
+ for (const [key, value] of Object.entries(payload)) if (DRAFT_CORE_KEYS.has(key)) draftBody[key] = value;
40064
40361
  else typeSpecificData[key] = value;
40065
40362
  if (Object.keys(typeSpecificData).length > 0) draftBody.typeSpecificData = typeSpecificData;
40066
40363
  return draftBody;
40067
40364
  };
40068
- const parseTypeSpecificData$1 = (raw) => {
40069
- if (!raw) return {};
40070
- if (typeof raw === "object") return raw;
40071
- try {
40072
- const parsed = JSON.parse(raw);
40073
- return typeof parsed === "object" && parsed !== null ? parsed : {};
40074
- } catch {
40075
- return {};
40076
- }
40077
- };
40078
- /**
40079
- * The response interceptor snake_cases keys at every depth, but the request
40080
- * pipe only camelizes the body's top level — nested subtrees (like `meta`)
40081
- * must be restored before being sent back, or `skillIds` round-trips into a
40082
- * stored `skill_ids`. Best-effort inverse: keys that legitimately contained
40083
- * underscores were already mangled by the response side.
40084
- */
40365
+ /** The server serializes response keys to snake_case; normalize back. */
40085
40366
  const camelizeDeep = (value) => {
40086
40367
  if (Array.isArray(value)) return value.map(camelizeDeep);
40087
40368
  if (value && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([k, v]) => [k.replaceAll(/_([\da-z])/g, (_, c) => c.toUpperCase()), camelizeDeep(v)]));
40088
40369
  return value;
40089
40370
  };
40090
- /** The server serializes response keys to snake_case; normalize back. */
40091
- const normalizeDraftRow = (row) => {
40092
- if (!row || typeof row !== "object") return {};
40093
- const r = row;
40094
- const pick = (camel, snake) => r[camel] ?? r[snake];
40095
- return {
40096
- id: pick("id", "id"),
40097
- refType: pick("refType", "ref_type"),
40098
- refId: pick("refId", "ref_id"),
40099
- title: pick("title", "title"),
40100
- text: pick("text", "text"),
40101
- content: pick("content", "content"),
40102
- contentFormat: pick("contentFormat", "content_format"),
40103
- meta: pick("meta", "meta"),
40104
- typeSpecificData: pick("typeSpecificData", "type_specific_data")
40105
- };
40106
- };
40107
40371
  /** Single-object responses may arrive wrapped in an outer `data` envelope. */
40108
40372
  const unwrapData = (res) => {
40109
40373
  if (res && typeof res === "object" && "data" in res) {
@@ -40112,10 +40376,69 @@ const unwrapData = (res) => {
40112
40376
  }
40113
40377
  return res;
40114
40378
  };
40379
+ const normalizeData = (value) => camelizeDeep(unwrapData(value));
40380
+ const normalizeDraftRow = (row) => {
40381
+ const normalized = normalizeData(row);
40382
+ if (!normalized || typeof normalized !== "object") return null;
40383
+ const branch = normalized;
40384
+ return branch.id && branch.document && branch.headRevision ? branch : null;
40385
+ };
40386
+ const normalizeVersionContext = (value) => normalizeData(value);
40387
+ const mergeRevisionPatch = (base, patch) => ({
40388
+ ...base,
40389
+ ...patch,
40390
+ typeSpecificData: {
40391
+ ...base.typeSpecificData,
40392
+ ...patch.typeSpecificData
40393
+ }
40394
+ });
40395
+ const saveDraftPayload = (api, refType, payload, refId) => gen(function* () {
40396
+ const patch = splitDraftBody(payload);
40397
+ if (!refId) {
40398
+ const response = yield* api.request("/drafts", {
40399
+ method: "POST",
40400
+ body: {
40401
+ data: patch,
40402
+ refType
40403
+ }
40404
+ });
40405
+ return {
40406
+ draft: normalizeDraftRow(response),
40407
+ response
40408
+ };
40409
+ }
40410
+ const context = normalizeVersionContext(yield* api.request(`/drafts/context/${refType}/${encodeURIComponent(refId)}`));
40411
+ if (!context.publishedRevision) return yield* fail$8(new Generic({ message: `published revision not found for ${refType} ${refId}` }));
40412
+ const response = yield* api.request("/drafts", {
40413
+ method: "POST",
40414
+ body: {
40415
+ baseRevisionId: context.publishedRevision.id,
40416
+ data: mergeRevisionPatch(context.publishedRevision, patch),
40417
+ refId,
40418
+ refType
40419
+ }
40420
+ });
40421
+ return {
40422
+ draft: normalizeDraftRow(response),
40423
+ response
40424
+ };
40425
+ });
40426
+ const publishSavedDraft = (api, draft) => api.request("/publish-jobs", {
40427
+ method: "POST",
40428
+ body: {
40429
+ aiResources: [],
40430
+ branchId: draft.id,
40431
+ confirmDiverged: draft.relationToPublished === "descendant" || draft.relationToPublished === "diverged",
40432
+ expectedPublishedRevisionId: draft.document.publishedRevisionId,
40433
+ revisionId: draft.headRevisionId
40434
+ }
40435
+ });
40115
40436
  //#endregion
40116
40437
  //#region src/cli/draft/create.ts
40117
40438
  const create$6 = make$16("create", postWriteOptions, (opts) => gen(function* () {
40118
- const payload = yield* resolveCategoryRefs({ ...(yield* buildPostPayload(toPostFlagInputs(opts))).payload });
40439
+ const flags = toPostFlagInputs(opts);
40440
+ const built = yield* buildPostPayload(flags);
40441
+ const payload = yield* resolveCategoryRefs({ ...built.payload });
40119
40442
  delete payload.isPublished;
40120
40443
  if (Object.keys(payload).filter((k) => k !== "contentFormat").length === 0) return yield* fail$8(new ValidationFailed({ message: "nothing to save: provide --file or content/meta flags" }));
40121
40444
  const body = splitDraftBody(payload);
@@ -40124,8 +40447,8 @@ const create$6 = make$16("create", postWriteOptions, (opts) => gen(function* ()
40124
40447
  const res = yield* api.request("/drafts", {
40125
40448
  method: "POST",
40126
40449
  body: {
40127
- refType: "post",
40128
- ...body
40450
+ data: body,
40451
+ refType: "post"
40129
40452
  }
40130
40453
  });
40131
40454
  const id = extractId$1(res);
@@ -40187,57 +40510,47 @@ const publish$2 = make$16("publish", {
40187
40510
  }, ({ id, open, silent }) => gen(function* () {
40188
40511
  const api = yield* Api;
40189
40512
  const renderer = yield* Renderer;
40190
- const draft = normalizeDraftRow(unwrapData(yield* api.request(`/drafts/${encodeURIComponent(id)}`)));
40191
- if (!draft?.id || !draft.refType) return yield* fail$8(new Generic({ message: `draft not found: ${id}` }));
40192
- const resource = REF_TYPE_TO_RESOURCE[draft.refType];
40193
- if (!resource) return yield* fail$8(new Generic({ message: `unsupported draft refType: ${draft.refType}` }));
40194
- const body = { ...parseTypeSpecificData$1(draft.typeSpecificData) };
40195
- if (draft.title !== void 0) body.title = draft.title;
40196
- if (draft.text !== void 0) body.text = draft.text;
40197
- if (draft.content !== void 0 && draft.content !== null) body.content = draft.content;
40198
- if (draft.contentFormat !== void 0) body.contentFormat = draft.contentFormat;
40199
- if (draft.meta !== void 0 && draft.meta !== null) body.meta = camelizeDeep(draft.meta);
40200
- body.draftId = draft.id;
40201
- let res;
40202
- if (draft.refId) {
40203
- if (draft.refType !== "page") body.isPublished = true;
40204
- res = yield* api.request(`/${resource}/${draft.refId}`, {
40205
- method: "PATCH",
40206
- body
40207
- });
40208
- } else {
40209
- if (draft.refType !== "page") body.isPublished = true;
40210
- res = yield* api.request(`/${resource}`, {
40211
- method: "POST",
40212
- body
40213
- });
40214
- }
40215
- const publishedId = extractId$1(res) ?? draft.refId;
40216
- yield* renderer.emitSuccess(silent ? {
40217
- ok: true,
40218
- id: publishedId
40219
- } : res);
40220
- if (open && publishedId && draft.refType !== "page") yield* openAdminEdit(resource, publishedId);
40221
- })).pipe(withDescription("publish a draft: creates the post/note/page (or applies to the linked one) and marks it live"));
40513
+ const draft = normalizeDraftRow(yield* api.request(`/drafts/${encodeURIComponent(id)}`));
40514
+ if (!draft) return yield* fail$8(new Generic({ message: `draft not found: ${id}` }));
40515
+ const resource = REF_TYPE_TO_RESOURCE[draft.document.refType];
40516
+ if (!resource) return yield* fail$8(new Generic({ message: `unsupported draft refType: ${draft.document.refType}` }));
40517
+ const res = yield* publishSavedDraft(api, draft);
40518
+ yield* renderer.emitSuccess(silent ? { ok: true } : res);
40519
+ if (open) yield* openAdminDraftEdit(resource, draft.id, draft.document.refId ?? void 0);
40520
+ })).pipe(withDescription("publish the current head revision of one draft branch"));
40222
40521
  const update$6 = make$16("update", {
40223
40522
  id: text$6({ name: "id" }),
40224
40523
  ...postWriteOptions
40225
40524
  }, ({ id, ...rest }) => gen(function* () {
40226
- const payload = yield* resolveCategoryRefs({ ...(yield* buildPostPayload(toPostFlagInputs(rest))).payload });
40525
+ const flags = toPostFlagInputs(rest);
40526
+ const built = yield* buildPostPayload(flags);
40527
+ const payload = yield* resolveCategoryRefs({ ...built.payload });
40227
40528
  delete payload.isPublished;
40228
40529
  if (Object.keys(payload).filter((k) => k !== "contentFormat").length === 0) return yield* fail$8(new ValidationFailed({ message: "nothing to update: provide --file or content/meta flags" }));
40229
40530
  const body = splitDraftBody(payload);
40230
40531
  const api = yield* Api;
40231
40532
  const renderer = yield* Renderer;
40533
+ const current = normalizeDraftRow(yield* api.request(`/drafts/${encodeURIComponent(id)}`));
40534
+ if (!current) return yield* fail$8(new ValidationFailed({ message: `draft not found: ${id}` }));
40232
40535
  const res = yield* api.request(`/drafts/${encodeURIComponent(id)}`, {
40233
40536
  method: "PUT",
40234
- body
40537
+ body: {
40538
+ data: {
40539
+ ...current.headRevision,
40540
+ ...body,
40541
+ typeSpecificData: {
40542
+ ...current.headRevision.typeSpecificData,
40543
+ ...body.typeSpecificData
40544
+ }
40545
+ },
40546
+ expectedHeadRevisionId: current.headRevisionId
40547
+ }
40235
40548
  });
40236
40549
  yield* renderer.emitSuccess(rest.silent ? {
40237
40550
  ok: true,
40238
40551
  id
40239
40552
  } : res);
40240
- })).pipe(withDescription("update a draft (bumps its version and records history on content change)"));
40553
+ })).pipe(withDescription("append a revision to one draft branch"));
40241
40554
  //#endregion
40242
40555
  //#region src/cli/draft/index.ts
40243
40556
  const help$9 = registerCommandHelp({
@@ -40486,19 +40799,18 @@ const resolveTopicRefs = (payload) => gen(function* () {
40486
40799
  //#endregion
40487
40800
  //#region src/cli/note/create.ts
40488
40801
  const create$5 = make$16("create", noteWriteOptions, (opts) => gen(function* () {
40489
- const payload = yield* resolveTopicRefs((yield* buildNotePayload(toNoteFlagInputs(opts))).payload);
40802
+ const flags = toNoteFlagInputs(opts);
40803
+ const built = yield* buildNotePayload(flags);
40804
+ const payload = yield* resolveTopicRefs({ ...built.payload });
40805
+ const shouldPublish = payload.isPublished === true;
40806
+ delete payload.isPublished;
40490
40807
  const api = yield* Api;
40491
40808
  const renderer = yield* Renderer;
40492
- const res = yield* api.request("/notes", {
40493
- method: "POST",
40494
- body: payload
40495
- });
40496
- yield* renderer.emitSuccess(opts.silent ? { ok: true } : res);
40497
- if (opts.open) {
40498
- const id = extractId$1(res);
40499
- if (id) yield* openAdminEdit("notes", id);
40500
- }
40501
- })).pipe(withDescription("create a note"));
40809
+ const saved = yield* saveDraftPayload(api, "note", payload);
40810
+ const response = shouldPublish ? yield* publishSavedDraft(api, saved.draft) : saved.response;
40811
+ yield* renderer.emitSuccess(opts.silent ? { ok: true } : response);
40812
+ if (opts.open && saved.draft.id) yield* openAdminDraftEdit("notes", saved.draft.id);
40813
+ })).pipe(withDescription("create a note draft; pass --state publish to start first publication"));
40502
40814
  const del$5 = make$16("delete", {
40503
40815
  slugOrId: text$6({ name: "slugOrId" }),
40504
40816
  force: boolean("force").pipe(withDescription$3("skip confirmation"))
@@ -40520,7 +40832,7 @@ const materializeForEditor$2 = (slugOrId) => gen(function* () {
40520
40832
  const resolver = yield* Resolver;
40521
40833
  const lexical = yield* Lexical;
40522
40834
  const id = yield* resolver.resolveNoteId(slugOrId);
40523
- const note = yield* api.request(`/notes/${id}`, { query: { prefer: "lexical" } });
40835
+ const note = normalizeData(yield* api.request(`/notes/${id}`, { query: { prefer: "lexical" } }));
40524
40836
  let inner;
40525
40837
  if (note.contentFormat === "lexical" && note.content) {
40526
40838
  const state = JSON.parse(note.content);
@@ -40563,7 +40875,8 @@ const edit$4 = make$16("edit", {
40563
40875
  const api = yield* Api;
40564
40876
  const editor = yield* Editor;
40565
40877
  const renderer = yield* Renderer;
40566
- const resolver = yield* Resolver;
40878
+ const id = yield* (yield* Resolver).resolveNoteId(slugOrId);
40879
+ const current = normalizeData(yield* api.request(`/notes/${id}`));
40567
40880
  if (!flags.file && flags.content === void 0) {
40568
40881
  const xml = yield* materializeForEditor$2(slugOrId);
40569
40882
  const next = yield* editor.openEditor({
@@ -40586,22 +40899,24 @@ const edit$4 = make$16("edit", {
40586
40899
  content: parsed.contentXml,
40587
40900
  format: flags.format ?? "lexical"
40588
40901
  });
40589
- const resolved = yield* resolveTopicRefs(applyNoteEnvelopeMeta(built.payload, parsed.meta));
40590
- const id = yield* resolver.resolveNoteId(slugOrId);
40591
- const res = yield* api.request(`/notes/${id}`, {
40592
- method: "PUT",
40593
- body: resolved
40594
- });
40595
- yield* renderer.emitSuccess(res);
40902
+ const payload = applyNoteEnvelopeMeta(built.payload, parsed.meta);
40903
+ const resolved = yield* resolveTopicRefs(payload);
40904
+ const shouldPublish = typeof resolved.isPublished === "boolean" ? resolved.isPublished : current.isPublished !== false;
40905
+ delete resolved.isPublished;
40906
+ const saved = yield* saveDraftPayload(api, "note", resolved, id);
40907
+ const response = shouldPublish ? yield* publishSavedDraft(api, saved.draft) : saved.response;
40908
+ yield* renderer.emitSuccess(response);
40909
+ if (rest.open && saved.draft.id) yield* openAdminDraftEdit("notes", saved.draft.id, id);
40596
40910
  return;
40597
40911
  }
40598
- const resolved = yield* resolveTopicRefs((yield* buildNotePayload(flags)).payload);
40599
- const id = yield* resolver.resolveNoteId(slugOrId);
40600
- const res = yield* api.request(`/notes/${id}`, {
40601
- method: "PUT",
40602
- body: resolved
40603
- });
40604
- yield* renderer.emitSuccess(res);
40912
+ const built = yield* buildNotePayload(flags);
40913
+ const resolved = yield* resolveTopicRefs(built.payload);
40914
+ const shouldPublish = typeof resolved.isPublished === "boolean" ? resolved.isPublished : current.isPublished !== false;
40915
+ delete resolved.isPublished;
40916
+ const saved = yield* saveDraftPayload(api, "note", resolved, id);
40917
+ const response = shouldPublish ? yield* publishSavedDraft(api, saved.draft) : saved.response;
40918
+ yield* renderer.emitSuccess(response);
40919
+ if (rest.open && saved.draft.id) yield* openAdminDraftEdit("notes", saved.draft.id, id);
40605
40920
  })).pipe(withDescription("edit a note via $EDITOR or flags"));
40606
40921
  //#endregion
40607
40922
  //#region src/cli/note/view.ts
@@ -40652,8 +40967,9 @@ const noteView = {
40652
40967
  const doc = normalize$3(data);
40653
40968
  const articleMeta = pickArticleTranslationMeta(data, first(doc, "id"));
40654
40969
  const content = renderContent(doc);
40970
+ const title = firstString(doc, "title");
40655
40971
  return renderMetadataBlock({
40656
- title: firstString(doc, "title") || void 0,
40972
+ title: title || void 0,
40657
40973
  kind: "note",
40658
40974
  fields: collectFields$3(doc, articleMeta),
40659
40975
  summary: pickSummary$2(doc),
@@ -40665,8 +40981,9 @@ const noteView = {
40665
40981
  const doc = normalize$3(data);
40666
40982
  const articleMeta = pickArticleTranslationMeta(data, first(doc, "id"));
40667
40983
  const content = renderContent(doc, true);
40984
+ const title = firstString(doc, "title");
40668
40985
  const fm = frontmatter({
40669
- title: firstString(doc, "title") || void 0,
40986
+ title: title || void 0,
40670
40987
  fields: collectFields$3(doc, articleMeta),
40671
40988
  summary: pickSummary$2(doc)
40672
40989
  });
@@ -40705,7 +41022,8 @@ const collectListItemFields$2 = (doc, articleMeta) => {
40705
41022
  const renderNoteListReadable = (data) => {
40706
41023
  const payload = asRecord(data);
40707
41024
  const rows = Array.isArray(payload.data) ? payload.data : Array.isArray(data) ? data : [];
40708
- const pagination = asRecord(first(asRecord(first(payload, "meta")), "pagination"));
41025
+ const meta = asRecord(first(payload, "meta"));
41026
+ const pagination = asRecord(first(meta, "pagination"));
40709
41027
  const lines = ["notes"];
40710
41028
  if (rows.length > 0) lines.push(`count: ${rows.length}`);
40711
41029
  else lines.push("count: 0");
@@ -40807,18 +41125,17 @@ const update$5 = make$16("update", {
40807
41125
  delete payload.text;
40808
41126
  delete payload.contentFormat;
40809
41127
  }
40810
- if (flags.state === void 0) delete payload.isPublished;
41128
+ delete payload.isPublished;
40811
41129
  const resolved = yield* resolveTopicRefs(payload);
40812
41130
  const id = yield* (yield* Resolver).resolveNoteId(slugOrId);
40813
41131
  const api = yield* Api;
40814
41132
  const renderer = yield* Renderer;
40815
- const res = yield* api.request(`/notes/${id}`, {
40816
- method: "PATCH",
40817
- body: resolved
40818
- });
40819
- yield* renderer.emitSuccess(rest.silent ? { ok: true } : res);
40820
- if (rest.open) yield* openAdminEdit("notes", id);
40821
- })).pipe(withDescription("partially update a note"));
41133
+ const current = flags.state === void 0 ? normalizeData(yield* api.request(`/notes/${id}`)) : null;
41134
+ const saved = yield* saveDraftPayload(api, "note", resolved, id);
41135
+ const response = flags.state === "publish" || current?.isPublished ? yield* publishSavedDraft(api, saved.draft) : saved.response;
41136
+ yield* renderer.emitSuccess(rest.silent ? { ok: true } : response);
41137
+ if (rest.open && saved.draft.id) yield* openAdminDraftEdit("notes", saved.draft.id, id);
41138
+ })).pipe(withDescription("save changes through the note draft; published notes create an online update job"));
40822
41139
  //#endregion
40823
41140
  //#region src/cli/note/index.ts
40824
41141
  const help$7 = registerCommandHelp({
@@ -40919,19 +41236,14 @@ const toPageFlagInputs = (opts) => ({
40919
41236
  file: unwrap$5(opts.file)
40920
41237
  });
40921
41238
  const create$4 = make$16("create", pageWriteOptions, (opts) => gen(function* () {
40922
- const built = yield* buildPagePayload(toPageFlagInputs(opts));
41239
+ const flags = toPageFlagInputs(opts);
41240
+ const built = yield* buildPagePayload(flags);
40923
41241
  const api = yield* Api;
40924
41242
  const renderer = yield* Renderer;
40925
- const res = yield* api.request("/pages", {
40926
- method: "POST",
40927
- body: built.payload
40928
- });
40929
- yield* renderer.emitSuccess(opts.silent ? { ok: true } : res);
40930
- if (opts.open) {
40931
- const id = extractId$1(res);
40932
- if (id) yield* openAdminEdit("pages", id);
40933
- }
40934
- }));
41243
+ const saved = yield* saveDraftPayload(api, "page", built.payload);
41244
+ yield* renderer.emitSuccess(opts.silent ? { ok: true } : saved.response);
41245
+ if (opts.open && saved.draft.id) yield* openAdminDraftEdit("pages", saved.draft.id);
41246
+ })).pipe(withDescription("create a page draft"));
40935
41247
  //#endregion
40936
41248
  //#region src/cli/page/delete.ts
40937
41249
  const slugOrId$14 = text$6({ name: "slugOrId" });
@@ -40977,7 +41289,7 @@ const materializeForEditor$1 = (ref) => gen(function* () {
40977
41289
  const api = yield* Api;
40978
41290
  const lexical = yield* Lexical;
40979
41291
  const path = isSnowflakeId(ref) ? `/pages/${ref}` : `/pages/slug/${encodeURIComponent(ref)}`;
40980
- const page = yield* api.request(path, { query: { prefer: "lexical" } });
41292
+ const page = normalizeData(yield* api.request(path, { query: { prefer: "lexical" } }));
40981
41293
  const isLexical = page.contentFormat === "lexical";
40982
41294
  let innerXml;
40983
41295
  if (isLexical && page.content) {
@@ -41012,6 +41324,7 @@ const edit$3 = make$16("edit", {
41012
41324
  const api = yield* Api;
41013
41325
  const editor = yield* Editor;
41014
41326
  const renderer = yield* Renderer;
41327
+ const id = yield* resolvePageId$1(api, slugOrId);
41015
41328
  if (!flags.file && flags.content === void 0) {
41016
41329
  const xml = yield* materializeForEditor$1(slugOrId);
41017
41330
  const next = yield* editor.openEditor({
@@ -41035,21 +41348,17 @@ const edit$3 = make$16("edit", {
41035
41348
  format: flags.format ?? "lexical"
41036
41349
  });
41037
41350
  const payload = overlayPageMeta(built.payload, parsed.meta);
41038
- const id = yield* resolvePageId$1(api, slugOrId);
41039
- const res = yield* api.request(`/pages/${id}`, {
41040
- method: "PUT",
41041
- body: payload
41042
- });
41043
- yield* renderer.emitSuccess(res);
41351
+ const saved = yield* saveDraftPayload(api, "page", payload, id);
41352
+ const response = yield* publishSavedDraft(api, saved.draft);
41353
+ yield* renderer.emitSuccess(response);
41354
+ if (rest.open && saved.draft.id) yield* openAdminDraftEdit("pages", saved.draft.id, id);
41044
41355
  return;
41045
41356
  }
41046
41357
  const built = yield* buildPagePayload(flags);
41047
- const id = yield* resolvePageId$1(api, slugOrId);
41048
- const res = yield* api.request(`/pages/${id}`, {
41049
- method: "PUT",
41050
- body: built.payload
41051
- });
41052
- yield* renderer.emitSuccess(res);
41358
+ const saved = yield* saveDraftPayload(api, "page", built.payload, id);
41359
+ const response = yield* publishSavedDraft(api, saved.draft);
41360
+ yield* renderer.emitSuccess(response);
41361
+ if (rest.open && saved.draft.id) yield* openAdminDraftEdit("pages", saved.draft.id, id);
41053
41362
  }));
41054
41363
  //#endregion
41055
41364
  //#region src/cli/page/view.ts
@@ -41090,8 +41399,9 @@ const pageView = {
41090
41399
  const doc = normalize$2(data);
41091
41400
  const articleMeta = pickArticleTranslationMeta(data, first(doc, "id"));
41092
41401
  const content = renderContent(doc);
41402
+ const title = firstString(doc, "title");
41093
41403
  return renderMetadataBlock({
41094
- title: firstString(doc, "title") || void 0,
41404
+ title: title || void 0,
41095
41405
  kind: "page",
41096
41406
  fields: collectFields$2(doc, articleMeta),
41097
41407
  summary: pickSummary$1(doc),
@@ -41103,8 +41413,9 @@ const pageView = {
41103
41413
  const doc = normalize$2(data);
41104
41414
  const articleMeta = pickArticleTranslationMeta(data, first(doc, "id"));
41105
41415
  const content = renderContent(doc, true);
41416
+ const title = firstString(doc, "title");
41106
41417
  const fm = frontmatter({
41107
- title: firstString(doc, "title") || void 0,
41418
+ title: title || void 0,
41108
41419
  fields: collectFields$2(doc, articleMeta),
41109
41420
  summary: pickSummary$1(doc)
41110
41421
  });
@@ -41163,13 +41474,11 @@ const update$4 = make$16("update", {
41163
41474
  const api = yield* Api;
41164
41475
  const renderer = yield* Renderer;
41165
41476
  const id = yield* resolvePageId(api, slugOrId);
41166
- const res = yield* api.request(`/pages/${id}`, {
41167
- method: "PATCH",
41168
- body
41169
- });
41170
- yield* renderer.emitSuccess(rest.silent ? { ok: true } : res);
41171
- if (rest.open) yield* openAdminEdit("pages", id);
41172
- }));
41477
+ const saved = yield* saveDraftPayload(api, "page", body, id);
41478
+ const response = yield* publishSavedDraft(api, saved.draft);
41479
+ yield* renderer.emitSuccess(rest.silent ? { ok: true } : response);
41480
+ if (rest.open && saved.draft.id) yield* openAdminDraftEdit("pages", saved.draft.id, id);
41481
+ })).pipe(withDescription("save changes through the page draft and create an online update job"));
41173
41482
  //#endregion
41174
41483
  //#region src/cli/page/index.ts
41175
41484
  const help$6 = registerCommandHelp({
@@ -41228,65 +41537,38 @@ const pageCmd = make$16("page").pipe(withDescription(help$6.description), withSu
41228
41537
  update$4,
41229
41538
  del$4
41230
41539
  ]));
41231
- //#endregion
41232
- //#region src/cli/post/apply.ts
41233
- const slugOrId$10 = text$6({ name: "slugOrId" });
41234
- const parseTypeSpecificData = (raw) => {
41235
- if (!raw) return {};
41236
- if (typeof raw === "object" && !Array.isArray(raw)) return raw;
41237
- if (typeof raw !== "string") return {};
41238
- try {
41239
- const parsed = JSON.parse(raw);
41240
- return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : {};
41241
- } catch {
41242
- return {};
41243
- }
41244
- };
41245
- const apply = make$16("apply", { slugOrId: slugOrId$10 }, ({ slugOrId }) => gen(function* () {
41540
+ const apply = make$16("apply", { slugOrId: text$6({ name: "slugOrId" }) }, ({ slugOrId }) => gen(function* () {
41246
41541
  const resolver = yield* Resolver;
41247
41542
  const api = yield* Api;
41248
41543
  const renderer = yield* Renderer;
41249
41544
  const id = yield* resolver.resolvePostId(slugOrId);
41250
- const draft = asRecord(unwrapDocument(yield* api.request(`/drafts/by-ref/post/${id}`)));
41251
- const draftId = first(draft, "id");
41252
- if (typeof draftId !== "string" || !draftId) return yield* fail$8(new Generic({
41545
+ const branches = normalizeVersionContext(yield* api.request(`/drafts/context/post/${id}`)).branches.filter((branch) => branch.status === "active" && branch.relationToPublished !== "same");
41546
+ if (branches.length === 0) return yield* fail$8(new Generic({
41253
41547
  message: `no staged changes for post ${slugOrId}`,
41254
41548
  hint: "stage changes first with `mxs post stage <slugOrId> --file <article.xml>`"
41255
41549
  }));
41256
- const body = { ...parseTypeSpecificData(first(draft, "type_specific_data", "typeSpecificData")) };
41257
- const title = first(draft, "title");
41258
- const text = first(draft, "text");
41259
- const content = first(draft, "content");
41260
- const contentFormat = first(draft, "content_format", "contentFormat");
41261
- const meta = first(draft, "meta");
41262
- if (title !== void 0) body.title = title;
41263
- if (text !== void 0) body.text = text;
41264
- if (content !== void 0) body.content = content;
41265
- if (contentFormat !== void 0) body.contentFormat = contentFormat;
41266
- if (meta !== void 0) body.meta = camelizeDeep(meta);
41267
- body.draftId = draftId;
41268
- const res = yield* api.request(`/posts/${id}`, {
41269
- method: "PATCH",
41270
- body
41271
- });
41550
+ if (branches.length > 1) return yield* fail$8(new Generic({
41551
+ message: `post ${slugOrId} has ${branches.length} draft branches`,
41552
+ hint: "publish the intended branch explicitly with `mxs draft publish <branchId>`"
41553
+ }));
41554
+ const res = yield* publishSavedDraft(api, branches[0]);
41272
41555
  yield* renderer.emitSuccess(res);
41273
- })).pipe(withDescription("apply the staged draft of a post to the live post (the confirm step after `post stage`)"));
41556
+ })).pipe(withDescription("publish the exact staged post draft through the server publish job"));
41274
41557
  //#endregion
41275
41558
  //#region src/cli/post/create.ts
41276
41559
  const create$3 = make$16("create", postWriteOptions, (opts) => gen(function* () {
41277
- const payload = yield* resolveCategoryRefs((yield* buildPostPayload(toPostFlagInputs(opts))).payload);
41560
+ const flags = toPostFlagInputs(opts);
41561
+ const built = yield* buildPostPayload(flags);
41562
+ const payload = yield* resolveCategoryRefs({ ...built.payload });
41563
+ const shouldPublish = payload.isPublished === true;
41564
+ delete payload.isPublished;
41278
41565
  const api = yield* Api;
41279
41566
  const renderer = yield* Renderer;
41280
- const res = yield* api.request("/posts", {
41281
- method: "POST",
41282
- body: payload
41283
- });
41284
- yield* renderer.emitSuccess(opts.silent ? { ok: true } : res);
41285
- if (opts.open) {
41286
- const id = extractId$1(res);
41287
- if (id) yield* openAdminEdit("posts", id);
41288
- }
41289
- })).pipe(withDescription("create a post"));
41567
+ const saved = yield* saveDraftPayload(api, "post", payload);
41568
+ const response = shouldPublish ? yield* publishSavedDraft(api, saved.draft) : saved.response;
41569
+ yield* renderer.emitSuccess(opts.silent ? { ok: true } : response);
41570
+ if (opts.open && saved.draft.id) yield* openAdminDraftEdit("posts", saved.draft.id);
41571
+ })).pipe(withDescription("create a post draft; pass --state publish to start first publication"));
41290
41572
  const del$3 = make$16("delete", {
41291
41573
  slugOrId: text$6({ name: "slugOrId" }),
41292
41574
  force: boolean("force").pipe(withDescription$3("skip confirmation"))
@@ -41308,7 +41590,7 @@ const materializeForEditor = (slugOrId) => gen(function* () {
41308
41590
  const resolver = yield* Resolver;
41309
41591
  const lexical = yield* Lexical;
41310
41592
  const path = yield* resolver.resolvePostReadPath(slugOrId);
41311
- const post = yield* api.request(path, { query: { prefer: "lexical" } });
41593
+ const post = normalizeData(yield* api.request(path, { query: { prefer: "lexical" } }));
41312
41594
  const isLexical = post.contentFormat === "lexical";
41313
41595
  let innerXml;
41314
41596
  if (isLexical && post.content) {
@@ -41340,6 +41622,16 @@ const metaFromEnvelope = (meta) => {
41340
41622
  if (m.tags !== void 0) overlay.tags = m.tags;
41341
41623
  return overlay;
41342
41624
  };
41625
+ const submitPostPayload = (api, id, payload, publishedFallback) => gen(function* () {
41626
+ const shouldPublish = typeof payload.isPublished === "boolean" ? payload.isPublished : publishedFallback;
41627
+ const draftPayload = { ...payload };
41628
+ delete draftPayload.isPublished;
41629
+ const saved = yield* saveDraftPayload(api, "post", draftPayload, id);
41630
+ return {
41631
+ ...saved,
41632
+ response: shouldPublish ? yield* publishSavedDraft(api, saved.draft) : saved.response
41633
+ };
41634
+ });
41343
41635
  const edit$2 = make$16("edit", {
41344
41636
  slugOrId: slugOrId$8,
41345
41637
  ...postWriteOptions
@@ -41348,7 +41640,8 @@ const edit$2 = make$16("edit", {
41348
41640
  const api = yield* Api;
41349
41641
  const editor = yield* Editor;
41350
41642
  const renderer = yield* Renderer;
41351
- const resolver = yield* Resolver;
41643
+ const id = yield* (yield* Resolver).resolvePostId(slugOrId);
41644
+ const current = normalizeData(yield* api.request(`/posts/${id}`));
41352
41645
  if (!flags.file && flags.content === void 0) {
41353
41646
  const xml = yield* materializeForEditor(slugOrId);
41354
41647
  const next = yield* editor.openEditor({
@@ -41366,31 +41659,25 @@ const edit$2 = make$16("edit", {
41366
41659
  cause: err
41367
41660
  })
41368
41661
  });
41369
- const resolved = yield* resolveCategoryRefs({
41662
+ const payload = {
41370
41663
  ...(yield* buildPostPayload({
41371
41664
  ...flags,
41372
41665
  content: parsed.contentXml,
41373
41666
  format: flags.format ?? "lexical"
41374
41667
  })).payload,
41375
41668
  ...metaFromEnvelope(parsed.meta)
41376
- });
41377
- const id = yield* resolver.resolvePostId(slugOrId);
41378
- const res = yield* api.request(`/posts/${id}`, {
41379
- method: "PUT",
41380
- body: resolved
41381
- });
41382
- yield* renderer.emitSuccess(rest.silent ? { ok: true } : res);
41383
- if (rest.open) yield* openAdminEdit("posts", id);
41669
+ };
41670
+ const resolved = yield* resolveCategoryRefs(payload);
41671
+ const saved = yield* submitPostPayload(api, id, resolved, current.isPublished !== false);
41672
+ yield* renderer.emitSuccess(rest.silent ? { ok: true } : saved.response);
41673
+ if (rest.open && saved.draft.id) yield* openAdminDraftEdit("posts", saved.draft.id, id);
41384
41674
  return;
41385
41675
  }
41386
- const resolved = yield* resolveCategoryRefs((yield* buildPostPayload(flags)).payload);
41387
- const id = yield* resolver.resolvePostId(slugOrId);
41388
- const res = yield* api.request(`/posts/${id}`, {
41389
- method: "PUT",
41390
- body: resolved
41391
- });
41392
- yield* renderer.emitSuccess(rest.silent ? { ok: true } : res);
41393
- if (rest.open) yield* openAdminEdit("posts", id);
41676
+ const built = yield* buildPostPayload(flags);
41677
+ const resolved = yield* resolveCategoryRefs(built.payload);
41678
+ const saved = yield* submitPostPayload(api, id, resolved, current.isPublished !== false);
41679
+ yield* renderer.emitSuccess(rest.silent ? { ok: true } : saved.response);
41680
+ if (rest.open && saved.draft.id) yield* openAdminDraftEdit("posts", saved.draft.id, id);
41394
41681
  })).pipe(withDescription("edit a post via $EDITOR or flags"));
41395
41682
  //#endregion
41396
41683
  //#region src/cli/post/view.ts
@@ -41435,8 +41722,9 @@ const postView = {
41435
41722
  const doc = normalize$1(data);
41436
41723
  const articleMeta = pickArticleTranslationMeta(data, first(doc, "id"));
41437
41724
  const content = renderContent(doc);
41725
+ const title = firstString(doc, "title");
41438
41726
  return renderMetadataBlock({
41439
- title: firstString(doc, "title") || void 0,
41727
+ title: title || void 0,
41440
41728
  kind: "post",
41441
41729
  fields: collectFields$1(doc, articleMeta),
41442
41730
  summary: pickSummary(doc),
@@ -41448,8 +41736,9 @@ const postView = {
41448
41736
  const doc = normalize$1(data);
41449
41737
  const articleMeta = pickArticleTranslationMeta(data, first(doc, "id"));
41450
41738
  const content = renderContent(doc, true);
41739
+ const title = firstString(doc, "title");
41451
41740
  const fm = frontmatter({
41452
- title: firstString(doc, "title") || void 0,
41741
+ title: title || void 0,
41453
41742
  fields: collectFields$1(doc, articleMeta),
41454
41743
  summary: pickSummary(doc)
41455
41744
  });
@@ -41484,7 +41773,8 @@ const collectListItemFields$1 = (doc, articleMeta) => {
41484
41773
  const renderPostListReadable = (data) => {
41485
41774
  const payload = asRecord(data);
41486
41775
  const rows = Array.isArray(payload.data) ? payload.data : Array.isArray(data) ? data : [];
41487
- const pagination = asRecord(first(asRecord(first(payload, "meta")), "pagination"));
41776
+ const meta = asRecord(first(payload, "meta"));
41777
+ const pagination = asRecord(first(meta, "pagination"));
41488
41778
  const lines = ["posts"];
41489
41779
  if (rows.length > 0) lines.push(`count: ${rows.length}`);
41490
41780
  else lines.push("count: 0");
@@ -41547,54 +41837,33 @@ const publish = make$16("publish", { slugOrId: text$6({ name: "slugOrId" }) }, (
41547
41837
  const api = yield* Api;
41548
41838
  const renderer = yield* Renderer;
41549
41839
  const id = yield* resolver.resolvePostId(slugOrId);
41550
- const res = yield* api.request(`/posts/${id}`, {
41840
+ const res = yield* api.request(`/posts/${id}/publish`, {
41551
41841
  method: "PATCH",
41552
41842
  body: { isPublished: true }
41553
41843
  });
41554
41844
  yield* renderer.emitSuccess(res);
41555
41845
  })).pipe(withDescription("publish a post"));
41556
- //#endregion
41557
- //#region src/cli/post/stage.ts
41558
- const slugOrId$5 = text$6({ name: "slugOrId" });
41559
- /** Draft-native fields; everything else rides along in `typeSpecificData`. */
41560
- const DRAFT_CORE_KEYS = /* @__PURE__ */ new Set([
41561
- "title",
41562
- "text",
41563
- "content",
41564
- "contentFormat",
41565
- "meta"
41566
- ]);
41567
41846
  const stage = make$16("stage", {
41568
- slugOrId: slugOrId$5,
41847
+ slugOrId: text$6({ name: "slugOrId" }),
41569
41848
  ...postWriteOptions
41570
41849
  }, ({ slugOrId, ...rest }) => gen(function* () {
41571
- const payload = yield* resolveCategoryRefs({ ...(yield* buildPostPayload(toPostFlagInputs(rest))).payload });
41850
+ const flags = toPostFlagInputs(rest);
41851
+ const built = yield* buildPostPayload(flags);
41852
+ const payload = yield* resolveCategoryRefs({ ...built.payload });
41572
41853
  delete payload.isPublished;
41573
41854
  if (Object.keys(payload).filter((k) => k !== "contentFormat").length === 0) return yield* fail$8(new ValidationFailed({ message: "nothing to stage: provide --file or content/meta flags" }));
41574
- const draftBody = {};
41575
- const typeSpecificData = {};
41576
- for (const [key, value] of Object.entries(payload)) if (DRAFT_CORE_KEYS.has(key)) draftBody[key] = value;
41577
- else typeSpecificData[key] = value;
41578
- if (Object.keys(typeSpecificData).length > 0) draftBody.typeSpecificData = typeSpecificData;
41579
41855
  const id = yield* (yield* Resolver).resolvePostId(slugOrId);
41580
41856
  const api = yield* Api;
41581
41857
  const renderer = yield* Renderer;
41582
- const res = yield* api.request(`/drafts`, {
41583
- method: "POST",
41584
- body: {
41585
- refType: "post",
41586
- refId: id,
41587
- ...draftBody
41588
- }
41589
- });
41590
- yield* renderer.emitSuccess(rest.silent ? { ok: true } : res);
41858
+ const { response } = yield* saveDraftPayload(api, "post", payload, id);
41859
+ yield* renderer.emitSuccess(rest.silent ? { ok: true } : response);
41591
41860
  })).pipe(withDescription("stage changes as a draft attached to a published post (the live post is untouched until `post apply`)"));
41592
41861
  const unpublish = make$16("unpublish", { slugOrId: text$6({ name: "slugOrId" }) }, ({ slugOrId }) => gen(function* () {
41593
41862
  const resolver = yield* Resolver;
41594
41863
  const api = yield* Api;
41595
41864
  const renderer = yield* Renderer;
41596
41865
  const id = yield* resolver.resolvePostId(slugOrId);
41597
- const res = yield* api.request(`/posts/${id}`, {
41866
+ const res = yield* api.request(`/posts/${id}/publish`, {
41598
41867
  method: "PATCH",
41599
41868
  body: { isPublished: false }
41600
41869
  });
@@ -41611,18 +41880,17 @@ const update$3 = make$16("update", {
41611
41880
  delete payload.text;
41612
41881
  delete payload.contentFormat;
41613
41882
  }
41614
- if (flags.state === void 0) delete payload.isPublished;
41883
+ delete payload.isPublished;
41615
41884
  const resolved = yield* resolveCategoryRefs(payload);
41616
41885
  const id = yield* (yield* Resolver).resolvePostId(slugOrId);
41617
41886
  const api = yield* Api;
41618
41887
  const renderer = yield* Renderer;
41619
- const res = yield* api.request(`/posts/${id}`, {
41620
- method: "PATCH",
41621
- body: resolved
41622
- });
41623
- yield* renderer.emitSuccess(rest.silent ? { ok: true } : res);
41624
- if (rest.open) yield* openAdminEdit("posts", id);
41625
- })).pipe(withDescription("partially update a post"));
41888
+ const current = flags.state === void 0 ? normalizeData(yield* api.request(`/posts/${id}`)) : null;
41889
+ const saved = yield* saveDraftPayload(api, "post", resolved, id);
41890
+ const response = flags.state === "publish" || current?.isPublished ? yield* publishSavedDraft(api, saved.draft) : saved.response;
41891
+ yield* renderer.emitSuccess(rest.silent ? { ok: true } : response);
41892
+ if (rest.open && saved.draft.id) yield* openAdminDraftEdit("posts", saved.draft.id, id);
41893
+ })).pipe(withDescription("save changes through the post draft; published posts create an online update job"));
41626
41894
  //#endregion
41627
41895
  //#region src/cli/post/index.ts
41628
41896
  const help$5 = registerCommandHelp({
@@ -42163,7 +42431,8 @@ const editableFieldsOf = (raw) => {
42163
42431
  //#endregion
42164
42432
  //#region src/cli/project/create.ts
42165
42433
  const create$2 = make$16("create", projectWriteOptions, (opts) => gen(function* () {
42166
- const payload = yield* buildProjectPayload(toProjectFlagInputs(opts));
42434
+ const flags = toProjectFlagInputs(opts);
42435
+ const payload = yield* buildProjectPayload(flags);
42167
42436
  const api = yield* Api;
42168
42437
  const renderer = yield* Renderer;
42169
42438
  const resolver = yield* Resolver;
@@ -42283,8 +42552,9 @@ const projectView = {
42283
42552
  readable: (data, ctx) => {
42284
42553
  const doc = normalize(data);
42285
42554
  const body = pickText(doc);
42555
+ const name = firstString(doc, "name");
42286
42556
  return renderMetadataBlock({
42287
- title: firstString(doc, "name") || void 0,
42557
+ title: name || void 0,
42288
42558
  kind: "project",
42289
42559
  fields: collectFields(doc),
42290
42560
  summary: pickDescription(doc),
@@ -42295,8 +42565,9 @@ const projectView = {
42295
42565
  llm: (data) => {
42296
42566
  const doc = normalize(data);
42297
42567
  const body = pickText(doc);
42568
+ const name = firstString(doc, "name");
42298
42569
  const fm = frontmatter({
42299
- title: firstString(doc, "name") || void 0,
42570
+ title: name || void 0,
42300
42571
  fields: collectFields(doc),
42301
42572
  summary: pickDescription(doc)
42302
42573
  });
@@ -42312,7 +42583,8 @@ const collectListItemFields = (doc) => [
42312
42583
  const renderProjectListReadable = (data) => {
42313
42584
  const payload = asRecord(data);
42314
42585
  const rows = Array.isArray(payload.data) ? payload.data : Array.isArray(data) ? data : [];
42315
- const pagination = asRecord(first(asRecord(first(payload, "meta")), "pagination"));
42586
+ const meta = asRecord(first(payload, "meta"));
42587
+ const pagination = asRecord(first(meta, "pagination"));
42316
42588
  const lines = ["projects", `count: ${rows.length}`];
42317
42589
  const page = first(pagination, "page", "currentPage");
42318
42590
  const size = first(pagination, "size", "pageSize");
@@ -42357,7 +42629,8 @@ const update$2 = make$16("update", {
42357
42629
  nameOrId: text$6({ name: "nameOrId" }),
42358
42630
  ...projectWriteOptions
42359
42631
  }, ({ nameOrId, ...rest }) => gen(function* () {
42360
- const payload = yield* buildProjectPayload(toProjectFlagInputs(rest));
42632
+ const flags = toProjectFlagInputs(rest);
42633
+ const payload = yield* buildProjectPayload(flags);
42361
42634
  const resolver = yield* Resolver;
42362
42635
  const id = yield* resolver.resolveProjectId(nameOrId);
42363
42636
  const api = yield* Api;
@@ -44022,9 +44295,10 @@ var MiniSearch = class MiniSearch {
44022
44295
  const indexData = this._index.fetch(term, createMap);
44023
44296
  const fieldIndex = indexData.get(fieldId);
44024
44297
  if (fieldIndex == null || fieldIndex.get(documentId) == null) this.warnDocumentChanged(documentId, fieldId, term);
44025
- else if (fieldIndex.get(documentId) <= 1) if (fieldIndex.size <= 1) indexData.delete(fieldId);
44026
- else fieldIndex.delete(documentId);
44027
- else fieldIndex.set(documentId, fieldIndex.get(documentId) - 1);
44298
+ else if (fieldIndex.get(documentId) <= 1) {
44299
+ if (fieldIndex.size <= 1) indexData.delete(fieldId);
44300
+ else fieldIndex.delete(documentId);
44301
+ } else fieldIndex.set(documentId, fieldIndex.get(documentId) - 1);
44028
44302
  if (this._index.get(term).size === 0) this._index.delete(term);
44029
44303
  }
44030
44304
  /**
@@ -44509,7 +44783,7 @@ const make$2 = gen(function* () {
44509
44783
  return yield* fail$8(new ChapterNotFound({
44510
44784
  slug,
44511
44785
  message: `no skill chapter with slug '${slug}'`,
44512
- hint: isLitexml ? "upgrade @haklex/rich-litexml to >=0.16.0 to ship liteXML chapters" : "run `mxs skill` to list available chapters"
44786
+ hint: isLitexml ? "upgrade @haklex/rich-litexml to >=0.36.1 to ship liteXML chapters" : "run `mxs skill` to list available chapters"
44513
44787
  }));
44514
44788
  }
44515
44789
  return found;
@@ -44580,7 +44854,8 @@ const skillListView = {
44580
44854
  }
44581
44855
  };
44582
44856
  const renderChapterReadable = (chapter, color) => {
44583
- return renderMarkdownToAnsi(`# ${chapter.title}\n\n_${chapter.description}_\n\n` + chapter.body, { color }).trimEnd();
44857
+ const header = `# ${chapter.title}\n\n_${chapter.description}_\n\n`;
44858
+ return renderMarkdownToAnsi(header + chapter.body, { color }).trimEnd();
44584
44859
  };
44585
44860
  const skillChapterView = {
44586
44861
  kind: "skill-chapter",
@@ -45262,14 +45537,12 @@ const topicCmd = make$16("topic").pipe(withDescription(help.description), withSu
45262
45537
  //#endregion
45263
45538
  //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js
45264
45539
  var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
45265
- const SEMVER_SPEC_VERSION = "2.0.0";
45266
- const MAX_LENGTH = 256;
45267
- const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
45268
45540
  module.exports = {
45269
- MAX_LENGTH,
45541
+ MAX_LENGTH: 256,
45270
45542
  MAX_SAFE_COMPONENT_LENGTH: 16,
45271
- MAX_SAFE_BUILD_LENGTH: MAX_LENGTH - 6,
45272
- MAX_SAFE_INTEGER,
45543
+ MAX_SAFE_BUILD_LENGTH: 250,
45544
+ MAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER ||
45545
+ /* istanbul ignore next */ 9007199254740991,
45273
45546
  RELEASE_TYPES: [
45274
45547
  "major",
45275
45548
  "premajor",
@@ -45279,7 +45552,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
45279
45552
  "prepatch",
45280
45553
  "prerelease"
45281
45554
  ],
45282
- SEMVER_SPEC_VERSION,
45555
+ SEMVER_SPEC_VERSION: "2.0.0",
45283
45556
  FLAG_INCLUDE_PRERELEASE: 1,
45284
45557
  FLAG_LOOSE: 2
45285
45558
  };
@@ -45417,9 +45690,10 @@ var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
45417
45690
  module.exports = class SemVer {
45418
45691
  constructor(version, options) {
45419
45692
  options = parseOptions(options);
45420
- if (version instanceof SemVer) if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
45421
- else version = version.version;
45422
- else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
45693
+ if (version instanceof SemVer) {
45694
+ if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
45695
+ else version = version.version;
45696
+ } else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
45423
45697
  if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
45424
45698
  debug("SemVer", version, options);
45425
45699
  this.options = options;
@@ -45872,9 +46146,7 @@ var require_truncate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
45872
46146
  version.minor = 0;
45873
46147
  version.patch = 0;
45874
46148
  break;
45875
- case "minor":
45876
- version.patch = 0;
45877
- break;
46149
+ case "minor": version.patch = 0;
45878
46150
  }
45879
46151
  return version.format();
45880
46152
  };
@@ -45923,8 +46195,10 @@ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
45923
46195
  module.exports = class Range {
45924
46196
  constructor(range, options) {
45925
46197
  options = parseOptions(options);
45926
- if (range instanceof Range) if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
45927
- else return new Range(range.raw, options);
46198
+ if (range instanceof Range) {
46199
+ if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
46200
+ else return new Range(range.raw, options);
46201
+ }
45928
46202
  if (range instanceof Comparator) {
45929
46203
  this.raw = range.value;
45930
46204
  this.set = [[range]];
@@ -46094,18 +46368,21 @@ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
46094
46368
  let ret;
46095
46369
  if (isX(M)) ret = "";
46096
46370
  else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
46097
- else if (isX(p)) if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
46098
- else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
46099
- else if (pr) {
46371
+ else if (isX(p)) {
46372
+ if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
46373
+ else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
46374
+ } else if (pr) {
46100
46375
  debug("replaceCaret pr", pr);
46101
- if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
46102
- else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
46103
- else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
46376
+ if (M === "0") {
46377
+ if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
46378
+ else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
46379
+ } else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
46104
46380
  } else {
46105
46381
  debug("no pr");
46106
- if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
46107
- else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
46108
- else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
46382
+ if (M === "0") {
46383
+ if (m === "0") ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
46384
+ else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
46385
+ } else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
46109
46386
  }
46110
46387
  debug("caret return", ret);
46111
46388
  return ret;
@@ -46127,9 +46404,10 @@ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
46127
46404
  const anyX = xp;
46128
46405
  if (gtlt === "=" && anyX) gtlt = "";
46129
46406
  pr = options.includePrerelease ? "-0" : "";
46130
- if (xM) if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
46131
- else ret = "*";
46132
- else if (gtlt && anyX) {
46407
+ if (xM) {
46408
+ if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
46409
+ else ret = "*";
46410
+ } else if (gtlt && anyX) {
46133
46411
  if (xm) m = 0;
46134
46412
  p = 0;
46135
46413
  if (gtlt === ">") {
@@ -46203,8 +46481,10 @@ var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
46203
46481
  }
46204
46482
  constructor(comp, options) {
46205
46483
  options = parseOptions(options);
46206
- if (comp instanceof Comparator) if (comp.loose === !!options.loose) return comp;
46207
- else comp = comp.value;
46484
+ if (comp instanceof Comparator) {
46485
+ if (comp.loose === !!options.loose) return comp;
46486
+ else comp = comp.value;
46487
+ }
46208
46488
  comp = comp.trim().split(/\s+/).join(" ");
46209
46489
  debug("comparator", comp, options);
46210
46490
  this.options = options;
@@ -46524,11 +46804,15 @@ var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
46524
46804
  const minimumVersion = [new Comparator(">=0.0.0")];
46525
46805
  const simpleSubset = (sub, dom, options) => {
46526
46806
  if (sub === dom) return true;
46527
- if (sub.length === 1 && sub[0].semver === ANY) if (dom.length === 1 && dom[0].semver === ANY) return true;
46528
- else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
46529
- else sub = minimumVersion;
46530
- if (dom.length === 1 && dom[0].semver === ANY) if (options.includePrerelease) return true;
46531
- else dom = minimumVersion;
46807
+ if (sub.length === 1 && sub[0].semver === ANY) {
46808
+ if (dom.length === 1 && dom[0].semver === ANY) return true;
46809
+ else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
46810
+ else sub = minimumVersion;
46811
+ }
46812
+ if (dom.length === 1 && dom[0].semver === ANY) {
46813
+ if (options.includePrerelease) return true;
46814
+ else dom = minimumVersion;
46815
+ }
46532
46816
  const eqSet = /* @__PURE__ */ new Set();
46533
46817
  let gt, lt;
46534
46818
  for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
@@ -46650,7 +46934,7 @@ var import_semver = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
46650
46934
  })))();
46651
46935
  const PACKAGE_NAME = "@mx-space/cli";
46652
46936
  const CACHE_FILE = "update-check.json";
46653
- const THROTTLE_MS = 1440 * 60 * 1e3;
46937
+ const THROTTLE_MS = 864e5;
46654
46938
  const FETCH_TIMEOUT_MS = 3e3;
46655
46939
  const PM_FRAGMENTS = [
46656
46940
  {
@@ -47069,9 +47353,7 @@ const make$1 = (deps = {}) => {
47069
47353
  hint: "pass --pm <npm|pnpm|yarn|bun> to override detection",
47070
47354
  details: { realPath: detection.realPath }
47071
47355
  }));
47072
- case "global":
47073
- pm = detection.pm;
47074
- break;
47356
+ case "global": pm = detection.pm;
47075
47357
  }
47076
47358
  const hit = yield* tryPromise({
47077
47359
  try: async () => {
@@ -47435,7 +47717,8 @@ const emitHelp = (data) => {
47435
47717
  const color = isColorEnabled(process.stdout);
47436
47718
  const tagline = data.description.split(" — ")[0] || data.description;
47437
47719
  const banner = renderBanner(`${data.programName} ${data.version}`, tagline, { color });
47438
- const ansi = renderMarkdownToAnsi(renderRootHelp(data), { color });
47720
+ const md = renderRootHelp(data);
47721
+ const ansi = renderMarkdownToAnsi(md, { color });
47439
47722
  process.stdout.write(banner + ansi + "\n");
47440
47723
  };
47441
47724
  const renderVerbSignature = (verb) => {
@@ -47498,7 +47781,8 @@ const renderGroupHelp = (data) => {
47498
47781
  const emitGroupHelp = (data) => {
47499
47782
  const color = isColorEnabled(process.stdout);
47500
47783
  const banner = renderBanner(`${data.programName} ${data.groupName}`, data.description, { color });
47501
- const ansi = renderMarkdownToAnsi(renderGroupHelp(data), { color });
47784
+ const md = renderGroupHelp(data);
47785
+ const ansi = renderMarkdownToAnsi(md, { color });
47502
47786
  process.stdout.write(banner + ansi + "\n");
47503
47787
  };
47504
47788
  //#endregion
@@ -47914,10 +48198,11 @@ const run = (argv) => {
47914
48198
  name: "mxs",
47915
48199
  version: CLI_VERSION
47916
48200
  });
47917
- const finalized = locally(locally(locally(preflight(flags).pipe(zipRight$3(cli(parsed.rest)), tapError((err) => isCliError(err) ? flatMap$5(Renderer, (r) => r.emitError(err)) : sync$2(() => void 0)), catchAll$1((err) => sync$2(() => {
48201
+ const core = preflight(flags).pipe(zipRight$3(cli(parsed.rest)), tapError((err) => isCliError(err) ? flatMap$5(Renderer, (r) => r.emitError(err)) : sync$2(() => void 0)), catchAll$1((err) => sync$2(() => {
47918
48202
  const tag = isCliError(err) ? err._tag : "Generic";
47919
48203
  process.exit(exitCodeForTag(tag));
47920
- }))), currentOutputOptions, {
48204
+ })));
48205
+ const finalized = locally(locally(locally(core, currentOutputOptions, {
47921
48206
  json: flags.json,
47922
48207
  output: flags.output,
47923
48208
  quiet: flags.quiet,