sootsim 0.1.184 → 0.1.186

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 (157) hide show
  1. package/dist-cli/bin.js +3 -3
  2. package/dist-cli/chunks/{agent-KSX5D27X.js → agent-HOCS7BA7.js} +2 -2
  3. package/dist-cli/chunks/{agent-wrapper-MS6TJF5Y.js → agent-wrapper-OFIKO65K.js} +2 -2
  4. package/dist-cli/chunks/{app-fonts-HHN6X2VJ.js → app-fonts-PXVMBZZ7.js} +2 -2
  5. package/dist-cli/chunks/{assert-XHVSQZOE.js → assert-OZS6AXZE.js} +2 -2
  6. package/dist-cli/chunks/beta-LUMNYREE.js +2 -0
  7. package/dist-cli/chunks/{camera-7L7D4XUO.js → camera-QJ2PKIJB.js} +2 -2
  8. package/dist-cli/chunks/{chunk-C3WRMMUM.js → chunk-2B2D2EBR.js} +2 -2
  9. package/dist-cli/chunks/{chunk-NBF2SXAH.js → chunk-353E6UCU.js} +2 -2
  10. package/dist-cli/chunks/chunk-3ISH4ZRW.js +1 -0
  11. package/dist-cli/chunks/{chunk-6MPD3QXA.js → chunk-4HVMPXJZ.js} +1 -1
  12. package/dist-cli/chunks/chunk-5TTEOJ4A.js +1 -0
  13. package/dist-cli/chunks/chunk-5XIRXMOS.js +971 -0
  14. package/dist-cli/chunks/chunk-6MJVRIUP.js +118 -0
  15. package/dist-cli/chunks/{chunk-S5XWFD5C.js → chunk-6OQVIQY7.js} +2 -2
  16. package/dist-cli/chunks/chunk-BU5CRHHR.js +24 -0
  17. package/dist-cli/chunks/{chunk-T4XAQ7VQ.js → chunk-DPXVA7ZF.js} +2 -2
  18. package/dist-cli/chunks/{chunk-WAZCQ5UO.js → chunk-FN64EREO.js} +2 -2
  19. package/dist-cli/chunks/{chunk-53KKDNCU.js → chunk-FUHNIWFL.js} +4 -4
  20. package/dist-cli/chunks/{chunk-QQ4JDVR6.js → chunk-GNGEYMS3.js} +2 -2
  21. package/dist-cli/chunks/{chunk-FAB5CDE7.js → chunk-I65LTDPY.js} +3 -3
  22. package/dist-cli/chunks/{chunk-JFCJIRX6.js → chunk-INIASYOZ.js} +1 -1
  23. package/dist-cli/chunks/{chunk-OGLOOKK6.js → chunk-KNICGV7H.js} +1 -1
  24. package/dist-cli/chunks/{chunk-V36X7TNR.js → chunk-LV7DFIBL.js} +1 -1
  25. package/dist-cli/chunks/{chunk-QZW44BMW.js → chunk-MAGDSBXT.js} +1 -1
  26. package/dist-cli/chunks/chunk-MP4CRGWM.js +2 -0
  27. package/dist-cli/chunks/{chunk-Q6EHTP4Q.js → chunk-MPUCQL3Q.js} +1 -1
  28. package/dist-cli/chunks/{chunk-7DHLNDOA.js → chunk-N3PLEUYD.js} +39 -15
  29. package/dist-cli/chunks/{chunk-U636Z2JZ.js → chunk-NYYP5QQK.js} +2 -2
  30. package/dist-cli/chunks/{chunk-IG7F7DTQ.js → chunk-O2SQQXUO.js} +1 -1
  31. package/dist-cli/chunks/{chunk-YYS2ITHH.js → chunk-OMFESSKA.js} +1 -1
  32. package/dist-cli/chunks/{chunk-XSWATK6S.js → chunk-P5UT637B.js} +2 -2
  33. package/dist-cli/chunks/{chunk-YQNX7JK6.js → chunk-POOE26UD.js} +2 -2
  34. package/dist-cli/chunks/{chunk-IZMNFZXZ.js → chunk-PTUTIFWJ.js} +1 -1
  35. package/dist-cli/chunks/{chunk-ID25RWPE.js → chunk-QBLTH2F6.js} +1 -1
  36. package/dist-cli/chunks/{chunk-N5LA5G7V.js → chunk-RAY2ZSNI.js} +2 -2
  37. package/dist-cli/chunks/{chunk-3KK3YZQ3.js → chunk-RDM3LVH2.js} +2 -2
  38. package/dist-cli/chunks/chunk-RP5CVR6O.js +382 -0
  39. package/dist-cli/chunks/{chunk-6GC57KRY.js → chunk-TYV3FMBE.js} +2 -2
  40. package/dist-cli/chunks/{chunk-AKQWG57K.js → chunk-U3BTJLRM.js} +29 -5
  41. package/dist-cli/chunks/{chunk-MXXD5U6B.js → chunk-UATE6GSA.js} +2 -2
  42. package/dist-cli/chunks/chunk-V434ATFM.js +13 -0
  43. package/dist-cli/chunks/{chunk-IHH3JCV5.js → chunk-VGAD3CMW.js} +1 -1
  44. package/dist-cli/chunks/{chunk-3S5BOWO5.js → chunk-VPUJQTEO.js} +1 -1
  45. package/dist-cli/chunks/chunk-WBPTJ3WC.js +5 -0
  46. package/dist-cli/chunks/{chunk-WSN7MF4E.js → chunk-WFSLSEGX.js} +2 -2
  47. package/dist-cli/chunks/{chunk-M6RZYHFK.js → chunk-XFQOFRYY.js} +1 -1
  48. package/dist-cli/chunks/{chunk-WMLFWLD7.js → chunk-XQ6PPMM6.js} +1 -1
  49. package/dist-cli/chunks/{chunk-7DKGX746.js → chunk-YYZGAZQI.js} +2 -2
  50. package/dist-cli/chunks/{chunk-WNUF6LJX.js → chunk-ZE2O7AA5.js} +2 -2
  51. package/dist-cli/chunks/{chunk-NWNFGZSI.js → chunk-ZJ64K2PL.js} +2 -2
  52. package/dist-cli/chunks/cli-version-474OBNTF.js +2 -0
  53. package/dist-cli/chunks/{compat-EGXOXW5F.js → compat-BNXJOVMU.js} +3 -3
  54. package/dist-cli/chunks/control-6LPRGKTF.js +2 -0
  55. package/dist-cli/chunks/{cpu-profile-7LF5VVWE.js → cpu-profile-3KXOGOJP.js} +2 -2
  56. package/dist-cli/chunks/daemon-OMT3RVU4.js +2 -0
  57. package/dist-cli/chunks/{debug-3J74TASS.js → debug-B3MN6772.js} +11 -10
  58. package/dist-cli/chunks/{detox-PHLGST7G.js → detox-YKSX4DUO.js} +2 -2
  59. package/dist-cli/chunks/{device-CBGLBSS6.js → device-NZX6AKQI.js} +2 -2
  60. package/dist-cli/chunks/{diagnose-BXUHKEVI.js → diagnose-26HE6KS5.js} +2 -2
  61. package/dist-cli/chunks/drivers-2PZC4QA3.js +2 -0
  62. package/dist-cli/chunks/{electron-UYJPUPAG.js → electron-XEUWIM47.js} +3 -3
  63. package/dist-cli/chunks/flow-P22NDT6V.js +2 -0
  64. package/dist-cli/chunks/help-ECGL4JSP.js +2 -0
  65. package/dist-cli/chunks/{hints-7A4UIZZL.js → hints-C56M4PMW.js} +2 -2
  66. package/dist-cli/chunks/{home-paths-THYEF54Y.js → home-paths-EYH3RBPS.js} +2 -2
  67. package/dist-cli/chunks/inspect-LJYG4WC6.js +2 -0
  68. package/dist-cli/chunks/{install-desktop-X7G7VTBV.js → install-desktop-UWHLWFKB.js} +3 -3
  69. package/dist-cli/chunks/{keys-JLP4YC4T.js → keys-Q37NM52E.js} +2 -2
  70. package/dist-cli/chunks/{login-VB4HG5WR.js → login-6E6ZEJRF.js} +4 -4
  71. package/dist-cli/chunks/{logout-TIVYUTTD.js → logout-A7QHH6DQ.js} +2 -2
  72. package/dist-cli/chunks/{maestro-C2WVLDFM.js → maestro-YJRGFGDQ.js} +8 -6
  73. package/dist-cli/chunks/optional-demo-registry-OVWOHGTW.js +2 -0
  74. package/dist-cli/chunks/{preview-YBV54B2S.js → preview-3OYFVL4A.js} +2 -2
  75. package/dist-cli/chunks/{profile-67C256LQ.js → profile-5Z2YGBCJ.js} +2 -2
  76. package/dist-cli/chunks/{react-HJ3WPDNO.js → react-ZNFFE3VQ.js} +2 -2
  77. package/dist-cli/chunks/{record-FD4QYCBW.js → record-V4CBW3GG.js} +2 -2
  78. package/dist-cli/chunks/runtime-OC6S2C22.js +2 -0
  79. package/dist-cli/chunks/{screenshot-UTVYF7F4.js → screenshot-QWMRWTIQ.js} +2 -2
  80. package/dist-cli/chunks/{screenshot-mode-WPSK6REL.js → screenshot-mode-36EUFBF5.js} +2 -2
  81. package/dist-cli/chunks/{screenshots-OXRAQXWN.js → screenshots-LOS6WHZN.js} +2 -2
  82. package/dist-cli/chunks/{screenshots-capture-KDNNRKDL.js → screenshots-capture-6D6TBI6A.js} +8 -8
  83. package/dist-cli/chunks/{serve-ZKEXM2U5.js → serve-YWGZ2JSI.js} +16 -16
  84. package/dist-cli/chunks/{setup-A5RLMR3I.js → setup-JS35KZ6P.js} +3 -3
  85. package/dist-cli/chunks/{skills-FSJFEKNP.js → skills-2TRDAXNC.js} +2 -2
  86. package/dist-cli/chunks/{slides-UU3DFZDY.js → slides-AO5MBP5Q.js} +2 -2
  87. package/dist-cli/chunks/store-HQKPCA6W.js +2 -0
  88. package/dist-cli/chunks/telemetry-I2H25VVF.js +2 -0
  89. package/dist-cli/chunks/{telemetry-TOTJDY6O.js → telemetry-MBWJUKBU.js} +2 -2
  90. package/dist-cli/chunks/{test-D6T7Z4XS.js → test-TRP2O6AP.js} +3 -3
  91. package/dist-cli/chunks/{three-mode-CAKEPRJQ.js → three-mode-VVNOGAZT.js} +2 -2
  92. package/dist-cli/chunks/{timeline-D6NKNKNS.js → timeline-4WDFXUXB.js} +2 -2
  93. package/dist-cli/chunks/{upgrade-DBT6E6DD.js → upgrade-NHQRFD4J.js} +2 -2
  94. package/dist-cli/chunks/upload-6C2EC56N.js +2 -0
  95. package/dist-cli/chunks/{version-4PLJ73Q3.js → version-T7O46MZL.js} +2 -2
  96. package/dist-cli/chunks/{web-O6QWIX3V.js → web-7YW2ISLF.js} +2 -2
  97. package/dist-cli/chunks/{what-happened-67DBMM4S.js → what-happened-IDOUXSFI.js} +2 -2
  98. package/dist-cli/chunks/{whoami-PSQRCMUL.js → whoami-DQBR3UTO.js} +2 -2
  99. package/dist-lib/agent-daemon-client.cjs +1 -1
  100. package/dist-lib/agent-events.cjs +1 -1
  101. package/dist-lib/agent-sessions.cjs +1 -1
  102. package/dist-lib/attached-projects.cjs +1 -1
  103. package/dist-lib/auth/shared-session.cjs +1 -1
  104. package/dist-lib/backend-origin.cjs +1 -1
  105. package/dist-lib/beta.cjs +1 -1
  106. package/dist-lib/beta.mjs +1 -1
  107. package/dist-lib/bridge-constants.cjs +1 -1
  108. package/dist-lib/cli-constants.cjs +1 -1
  109. package/dist-lib/config.cjs +1 -1
  110. package/dist-lib/detox/index.cjs +1 -1
  111. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  112. package/dist-lib/home-paths.cjs +2 -2
  113. package/dist-lib/host/bridge-host.cjs +77 -44
  114. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  115. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  116. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  117. package/dist-lib/host/websocket-proxy.cjs +1 -1
  118. package/dist-lib/index.cjs +28 -1
  119. package/dist-lib/jump-to-source-babel.cjs +1 -1
  120. package/dist-lib/menu.cjs +1 -1
  121. package/dist-lib/menu.mjs +1 -1
  122. package/dist-lib/metro.cjs +28 -1
  123. package/dist-lib/profiles.cjs +1 -1
  124. package/dist-lib/render-mode.cjs +1 -1
  125. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  126. package/dist-lib/sdk.cjs +38 -10
  127. package/dist-lib/sdk.mjs +38 -10
  128. package/dist-lib/skills.cjs +500 -300
  129. package/dist-lib/vite.cjs +28 -1
  130. package/package.json +1 -1
  131. package/src/home-paths.ts +8 -1
  132. package/src/host/bridge-host.ts +15 -1
  133. package/src/runtime-assets.ts +70 -0
  134. package/src/vite-plugin.ts +9 -0
  135. package/dist-cli/chunks/beta-JS4JTDFC.js +0 -2
  136. package/dist-cli/chunks/chunk-7C6RC3BU.js +0 -23
  137. package/dist-cli/chunks/chunk-BB432MX4.js +0 -1
  138. package/dist-cli/chunks/chunk-FD4BKULK.js +0 -5
  139. package/dist-cli/chunks/chunk-MFL73VJG.js +0 -2
  140. package/dist-cli/chunks/chunk-Q2S6VBXK.js +0 -2
  141. package/dist-cli/chunks/chunk-T5YWTSGG.js +0 -264
  142. package/dist-cli/chunks/chunk-VGTPGXKM.js +0 -1
  143. package/dist-cli/chunks/chunk-VVACMCCE.js +0 -118
  144. package/dist-cli/chunks/chunk-WDMIABUY.js +0 -463
  145. package/dist-cli/chunks/chunk-WLDAMCQK.js +0 -13
  146. package/dist-cli/chunks/cli-version-L6NDSEVW.js +0 -2
  147. package/dist-cli/chunks/control-LUH3EQQG.js +0 -2
  148. package/dist-cli/chunks/daemon-NGDXMG6R.js +0 -2
  149. package/dist-cli/chunks/drivers-QX77DPCG.js +0 -2
  150. package/dist-cli/chunks/flow-KDVDRUEN.js +0 -2
  151. package/dist-cli/chunks/help-4L6UVSAZ.js +0 -2
  152. package/dist-cli/chunks/inspect-QULPTQ5V.js +0 -987
  153. package/dist-cli/chunks/optional-demo-registry-WV2BZJ5T.js +0 -2
  154. package/dist-cli/chunks/runtime-BY3EB4G7.js +0 -2
  155. package/dist-cli/chunks/store-TZH6LKFH.js +0 -2
  156. package/dist-cli/chunks/telemetry-AHIQ3SS5.js +0 -2
  157. package/dist-cli/chunks/upload-JR2B3YT7.js +0 -2
@@ -0,0 +1,971 @@
1
+ /*! sootsim v0.1.186 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
+ import{a as ko,b as xo}from"./chunk-MPUCQL3Q.js";import{b as wo,c as So,k as $o}from"./chunk-V434ATFM.js";import{a as ke,b as Y,c as H,d as Xt,e as Re,f as fe,g as ot,h as Nt,i as go,j as yo,k as Zt,l as bo}from"./chunk-YYZGAZQI.js";import{A as io,B as ro,E as ao,G as lo,I as nt,J as co,P as Qs,a as Gt,b as Un,c as Wn,d as Vn,e as Yn,f as Hn,g as Gn,h as zn,i as Qn,j as Xn,k as Ys,l as Hs,q as Gs,r as Zn,s as eo,t as vt,u as to,v as zt,w as zs,x as so,y as no,z as oo}from"./chunk-N3PLEUYD.js";import{e as uo,g as fo,i as po,j as mo,k as ho,l as Qt}from"./chunk-BU5CRHHR.js";import{a as qn}from"./chunk-XFQOFRYY.js";import{a as Ws,c as Vs}from"./chunk-6MJVRIUP.js";import{a as pe}from"./chunk-FN64EREO.js";import{c as Kn}from"./chunk-MP4CRGWM.js";import{b as Jn}from"./chunk-LV7DFIBL.js";import{b as jn}from"./chunk-VGAD3CMW.js";function Xs(s){return`(async () => {
3
+ const bridge = globalThis.SootSim && globalThis.SootSim.bridges && globalThis.SootSim.bridges.hotRemount
4
+ if (!bridge || typeof bridge.reloadExternalApp !== 'function') return false
5
+ await bridge.reloadExternalApp({ resetStorage: ${s?"true":"false"} })
6
+ return true
7
+ })()`}import{existsSync as Gr,mkdirSync as ki,readFileSync as zr,rmSync as An,writeFileSync as xi}from"fs";import{tmpdir as Qr}from"os";import{dirname as vi,join as Xr,resolve as Ni}from"path";var Tn={};jn(Tn,{Alias:()=>Pe,CST:()=>vn,Composer:()=>et,Document:()=>Fe,Lexer:()=>wt,LineCounter:()=>St,Pair:()=>X,Parser:()=>tt,Scalar:()=>P,Schema:()=>mt,YAMLError:()=>gt,YAMLMap:()=>Z,YAMLParseError:()=>he,YAMLSeq:()=>oe,YAMLWarning:()=>yt,isAlias:()=>ye,isCollection:()=>W,isDocument:()=>be,isMap:()=>we,isNode:()=>U,isPair:()=>J,isScalar:()=>j,isSeq:()=>Se,parse:()=>wi,parseAllDocuments:()=>bi,parseDocument:()=>In,stringify:()=>Si,visit:()=>ve,visitAsync:()=>It});var es=Symbol.for("yaml.alias"),ts=Symbol.for("yaml.document"),xe=Symbol.for("yaml.map"),Zs=Symbol.for("yaml.pair"),me=Symbol.for("yaml.scalar"),Be=Symbol.for("yaml.seq"),ce=Symbol.for("yaml.node.type"),ye=s=>!!s&&typeof s=="object"&&s[ce]===es,be=s=>!!s&&typeof s=="object"&&s[ce]===ts,we=s=>!!s&&typeof s=="object"&&s[ce]===xe,J=s=>!!s&&typeof s=="object"&&s[ce]===Zs,j=s=>!!s&&typeof s=="object"&&s[ce]===me,Se=s=>!!s&&typeof s=="object"&&s[ce]===Be;function W(s){if(s&&typeof s=="object")switch(s[ce]){case xe:case Be:return!0}return!1}function U(s){if(s&&typeof s=="object")switch(s[ce]){case es:case xe:case me:case Be:return!0}return!1}var ss=s=>(j(s)||W(s))&&!!s.anchor;var de=Symbol("break visit"),vo=Symbol("skip children"),Me=Symbol("remove node");function ve(s,e){let t=No(e);be(s)?it(null,s.contents,t,Object.freeze([s]))===Me&&(s.contents=null):it(null,s,t,Object.freeze([]))}ve.BREAK=de;ve.SKIP=vo;ve.REMOVE=Me;function it(s,e,t,n){let o=Io(s,e,t,n);if(U(o)||J(o))return To(s,n,o),it(s,o,t,n);if(typeof o!="symbol"){if(W(e)){n=Object.freeze(n.concat(e));for(let i=0;i<e.items.length;++i){let r=it(i,e.items[i],t,n);if(typeof r=="number")i=r-1;else{if(r===de)return de;r===Me&&(e.items.splice(i,1),i-=1)}}}else if(J(e)){n=Object.freeze(n.concat(e));let i=it("key",e.key,t,n);if(i===de)return de;i===Me&&(e.key=null);let r=it("value",e.value,t,n);if(r===de)return de;r===Me&&(e.value=null)}}return o}async function It(s,e){let t=No(e);be(s)?await rt(null,s.contents,t,Object.freeze([s]))===Me&&(s.contents=null):await rt(null,s,t,Object.freeze([]))}It.BREAK=de;It.SKIP=vo;It.REMOVE=Me;async function rt(s,e,t,n){let o=await Io(s,e,t,n);if(U(o)||J(o))return To(s,n,o),rt(s,o,t,n);if(typeof o!="symbol"){if(W(e)){n=Object.freeze(n.concat(e));for(let i=0;i<e.items.length;++i){let r=await rt(i,e.items[i],t,n);if(typeof r=="number")i=r-1;else{if(r===de)return de;r===Me&&(e.items.splice(i,1),i-=1)}}}else if(J(e)){n=Object.freeze(n.concat(e));let i=await rt("key",e.key,t,n);if(i===de)return de;i===Me&&(e.key=null);let r=await rt("value",e.value,t,n);if(r===de)return de;r===Me&&(e.value=null)}}return o}function No(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function Io(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(we(e))return t.Map?.(s,e,n);if(Se(e))return t.Seq?.(s,e,n);if(J(e))return t.Pair?.(s,e,n);if(j(e))return t.Scalar?.(s,e,n);if(ye(e))return t.Alias?.(s,e,n)}function To(s,e,t){let n=e[e.length-1];if(W(n))n.items[s]=t;else if(J(n))s==="key"?n.key=t:n.value=t;else if(be(n))n.contents=t;else{let o=ye(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${o} parent`)}}var hr={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},gr=s=>s.replace(/[!,[\]{}]/g,e=>hr[e]),_e=class s{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,t)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),o=n.shift();switch(o){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[i,r]=n;return this.tags[i]=r,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[i]=n;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{let r=/^\d+\.\d+$/.test(i);return t(6,`Unsupported YAML version ${i}`,r),!1}}default:return t(0,`Unknown directive ${o}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let r=e.slice(2,-1);return r==="!"||r==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),r)}let[,n,o]=e.match(/^(.*!)([^!]*)$/s);o||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(o)}catch(r){return t(String(r)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+gr(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),o;if(e&&n.length>0&&U(e.contents)){let i={};ve(e.contents,(r,a)=>{U(a)&&a.tag&&(i[a.tag]=!0)}),o=Object.keys(i)}else o=[];for(let[i,r]of n)i==="!!"&&r==="tag:yaml.org,2002:"||(!e||o.some(a=>a.startsWith(r)))&&t.push(`%TAG ${i} ${r}`);return t.join(`
8
+ `)}};_e.defaultYaml={explicit:!1,version:"1.2"};_e.defaultTags={"!!":"tag:yaml.org,2002:"};function ns(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function en(s){let e=new Set;return ve(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function tn(s,e){for(let t=1;;++t){let n=`${s}${t}`;if(!e.has(n))return n}}function Oo(s,e){let t=[],n=new Map,o=null;return{onAnchor:i=>{t.push(i),o??(o=en(s));let r=tn(e,o);return o.add(r),r},setAnchors:()=>{for(let i of t){let r=n.get(i);if(typeof r=="object"&&r.anchor&&(j(r.node)||W(r.node)))r.node.anchor=r.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=i,a}}},sourceObjects:n}}function Ue(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let o=0,i=n.length;o<i;++o){let r=n[o],a=Ue(s,n,String(o),r);a===void 0?delete n[o]:a!==r&&(n[o]=a)}else if(n instanceof Map)for(let o of Array.from(n.keys())){let i=n.get(o),r=Ue(s,n,o,i);r===void 0?n.delete(o):r!==i&&n.set(o,r)}else if(n instanceof Set)for(let o of Array.from(n)){let i=Ue(s,n,o,o);i===void 0?n.delete(o):i!==o&&(n.delete(o),n.add(i))}else for(let[o,i]of Object.entries(n)){let r=Ue(s,n,o,i);r===void 0?delete n[o]:r!==i&&(n[o]=r)}return s.call(e,t,n)}function se(s,e,t){if(Array.isArray(s))return s.map((n,o)=>se(n,String(o),t));if(s&&typeof s.toJSON=="function"){if(!t||!ss(s))return s.toJSON(e,t);let n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=i=>{n.res=i,delete t.onCreate};let o=s.toJSON(e,t);return t.onCreate&&t.onCreate(o),o}return typeof s=="bigint"&&!t?.keep?Number(s):s}var We=class{constructor(e){Object.defineProperty(this,ce,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:o,reviver:i}={}){if(!be(e))throw new TypeError("A document argument is required");let r={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=se(this,"",r);if(typeof o=="function")for(let{count:l,res:u}of r.anchors.values())o(u,l);return typeof i=="function"?Ue(i,{"":a},"",a):a}};var Pe=class extends We{constructor(e){super(es),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){if(t?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],ve(e,{Node:(i,r)=>{(ye(r)||ss(r))&&n.push(r)}}),t&&(t.aliasResolveCache=n));let o;for(let i of n){if(i===this)break;i.anchor===this.source&&(o=i)}return o}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:o,maxAliasCount:i}=t,r=this.resolve(o,t);if(!r){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=n.get(r);if(a||(se(r,null,t),a=n.get(r)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=os(o,r,n)),a.count*a.aliasCount>i)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,n){let o=`*${this.source}`;if(e){if(ns(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(i)}if(e.implicitKey)return`${o} `}return o}};function os(s,e,t){if(ye(e)){let n=e.resolve(s),o=t&&n&&t.get(n);return o?o.count*o.aliasCount:0}else if(W(e)){let n=0;for(let o of e.items){let i=os(s,o,t);i>n&&(n=i)}return n}else if(J(e)){let n=os(s,e.key,t),o=os(s,e.value,t);return Math.max(n,o)}return 1}var is=s=>!s||typeof s!="function"&&typeof s!="object",P=class extends We{constructor(e){super(me),this.value=e}toJSON(e,t){return t?.keep?this.value:se(this.value,e,t)}toString(){return String(this.value)}};P.BLOCK_FOLDED="BLOCK_FOLDED";P.BLOCK_LITERAL="BLOCK_LITERAL";P.PLAIN="PLAIN";P.QUOTE_DOUBLE="QUOTE_DOUBLE";P.QUOTE_SINGLE="QUOTE_SINGLE";var yr="tag:yaml.org,2002:";function br(s,e,t){if(e){let n=t.filter(i=>i.tag===e),o=n.find(i=>!i.format)??n[0];if(!o)throw new Error(`Tag ${e} not found`);return o}return t.find(n=>n.identify?.(s)&&!n.format)}function je(s,e,t){if(be(s)&&(s=s.contents),U(s))return s;if(J(s)){let h=t.schema[xe].createNode?.(t.schema,null,t);return h.items.push(s),h}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:n,onAnchor:o,onTagObj:i,schema:r,sourceObjects:a}=t,l;if(n&&s&&typeof s=="object"){if(l=a.get(s),l)return l.anchor??(l.anchor=o(s)),new Pe(l.anchor);l={anchor:null,node:null},a.set(s,l)}e?.startsWith("!!")&&(e=yr+e.slice(2));let u=br(s,e,r.tags);if(!u){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let h=new P(s);return l&&(l.node=h),h}u=s instanceof Map?r[xe]:Symbol.iterator in Object(s)?r[Be]:r[xe]}i&&(i(u),delete t.onTagObj);let g=u?.createNode?u.createNode(t.schema,s,t):typeof u?.nodeClass?.from=="function"?u.nodeClass.from(t.schema,s,t):new P(s);return e?g.tag=e:u.default||(g.tag=u.tag),l&&(l.node=g),g}function Tt(s,e,t){let n=t;for(let o=e.length-1;o>=0;--o){let i=e[o];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){let r=[];r[i]=n,n=r}else n=new Map([[i,n]])}return je(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var lt=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,at=class extends We{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>U(n)||J(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(lt(e))this.add(t);else{let[n,...o]=e,i=this.get(n,!0);if(W(i))i.addIn(o,t);else if(i===void 0&&this.schema)this.set(n,Tt(this.schema,o,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${o}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let o=this.get(t,!0);if(W(o))return o.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...o]=e,i=this.get(n,!0);return o.length===0?!t&&j(i)?i.value:i:W(i)?i.getIn(o,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!J(t))return!1;let n=t.value;return n==null||e&&j(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let o=this.get(t,!0);return W(o)?o.hasIn(n):!1}setIn(e,t){let[n,...o]=e;if(o.length===0)this.set(n,t);else{let i=this.get(n,!0);if(W(i))i.setIn(o,t);else if(i===void 0&&this.schema)this.set(n,Tt(this.schema,o,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${o}`)}}};var Ao=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function $e(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var Ce=(s,e,t)=>s.endsWith(`
9
+ `)?$e(t,e):t.includes(`
10
+ `)?`
11
+ `+$e(t,e):(s.endsWith(" ")?"":" ")+t;var sn="flow",rs="block",Ot="quoted";function At(s,e,t="flow",{indentAtStart:n,lineWidth:o=80,minContentWidth:i=20,onFold:r,onOverflow:a}={}){if(!o||o<0)return s;o<i&&(i=0);let l=Math.max(1+i,1+o-e.length);if(s.length<=l)return s;let u=[],g={},h=o-e.length;typeof n=="number"&&(n>o-Math.max(2,i)?u.push(0):h=o-n);let y,w,N=!1,b=-1,f=-1,T=-1;t===rs&&(b=Eo(s,b,e.length),b!==-1&&(h=b+l));for(let O;O=s[b+=1];){if(t===Ot&&O==="\\"){switch(f=b,s[b+1]){case"x":b+=3;break;case"u":b+=5;break;case"U":b+=9;break;default:b+=1}T=b}if(O===`
12
+ `)t===rs&&(b=Eo(s,b,e.length)),h=b+e.length+l,y=void 0;else{if(O===" "&&w&&w!==" "&&w!==`
13
+ `&&w!==" "){let C=s[b+1];C&&C!==" "&&C!==`
14
+ `&&C!==" "&&(y=b)}if(b>=h)if(y)u.push(y),h=y+l,y=void 0;else if(t===Ot){for(;w===" "||w===" ";)w=O,O=s[b+=1],N=!0;let C=b>T+1?b-2:f-1;if(g[C])return s;u.push(C),g[C]=!0,h=C+l,y=void 0}else N=!0}w=O}if(N&&a&&a(),u.length===0)return s;r&&r();let I=s.slice(0,u[0]);for(let O=0;O<u.length;++O){let C=u[O],L=u[O+1]||s.length;C===0?I=`
15
+ ${e}${s.slice(0,L)}`:(t===Ot&&g[C]&&(I+=`${s[C]}\\`),I+=`
16
+ ${e}${s.slice(C+1,L)}`)}return I}function Eo(s,e,t){let n=e,o=e+1,i=s[o];for(;i===" "||i===" ";)if(e<o+t)i=s[++e];else{do i=s[++e];while(i&&i!==`
17
+ `);n=e,o=e+1,i=s[o]}return n}var ls=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),cs=s=>/^(%|---|\.\.\.)/m.test(s);function wr(s,e,t){if(!e||e<0)return!1;let n=e-t,o=s.length;if(o<=n)return!1;for(let i=0,r=0;i<o;++i)if(s[i]===`
18
+ `){if(i-r>n)return!0;if(r=i+1,o-r<=n)return!1}return!0}function Et(s,e){let t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:n}=e,o=e.options.doubleQuotedMinMultiLineLength,i=e.indent||(cs(s)?" ":""),r="",a=0;for(let l=0,u=t[l];u;u=t[++l])if(u===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(r+=t.slice(a,l)+"\\ ",l+=1,a=l,u="\\"),u==="\\")switch(t[l+1]){case"u":{r+=t.slice(a,l);let g=t.substr(l+2,4);switch(g){case"0000":r+="\\0";break;case"0007":r+="\\a";break;case"000b":r+="\\v";break;case"001b":r+="\\e";break;case"0085":r+="\\N";break;case"00a0":r+="\\_";break;case"2028":r+="\\L";break;case"2029":r+="\\P";break;default:g.substr(0,2)==="00"?r+="\\x"+g.substr(2):r+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(n||t[l+2]==='"'||t.length<o)l+=1;else{for(r+=t.slice(a,l)+`
19
+
20
+ `;t[l+2]==="\\"&&t[l+3]==="n"&&t[l+4]!=='"';)r+=`
21
+ `,l+=2;r+=i,t[l+2]===" "&&(r+="\\"),l+=1,a=l+1}break;default:l+=1}return r=a?r+t.slice(a):t,n?r:At(r,i,Ot,ls(e,!1))}function nn(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`
22
+ `)||/[ \t]\n|\n[ \t]/.test(s))return Et(s,e);let t=e.indent||(cs(s)?" ":""),n="'"+s.replace(/'/g,"''").replace(/\n+/g,`$&
23
+ ${t}`)+"'";return e.implicitKey?n:At(n,t,sn,ls(e,!1))}function ct(s,e){let{singleQuote:t}=e.options,n;if(t===!1)n=Et;else{let o=s.includes('"'),i=s.includes("'");o&&!i?n=nn:i&&!o?n=Et:n=t?nn:Et}return n(s,e)}var on;try{on=new RegExp(`(^|(?<!
24
+ ))
25
+ +(?!
26
+ |$)`,"g")}catch{on=/\n+(?!\n|$)/g}function as({comment:s,type:e,value:t},n,o,i){let{blockQuote:r,commentString:a,lineWidth:l}=n.options;if(!r||/\n[\t ]+$/.test(t))return ct(t,n);let u=n.indent||(n.forceBlockIndent||cs(t)?" ":""),g=r==="literal"?!0:r==="folded"||e===P.BLOCK_FOLDED?!1:e===P.BLOCK_LITERAL?!0:!wr(t,l,u.length);if(!t)return g?`|
27
+ `:`>
28
+ `;let h,y;for(y=t.length;y>0;--y){let L=t[y-1];if(L!==`
29
+ `&&L!==" "&&L!==" ")break}let w=t.substring(y),N=w.indexOf(`
30
+ `);N===-1?h="-":t===w||N!==w.length-1?(h="+",i&&i()):h="",w&&(t=t.slice(0,-w.length),w[w.length-1]===`
31
+ `&&(w=w.slice(0,-1)),w=w.replace(on,`$&${u}`));let b=!1,f,T=-1;for(f=0;f<t.length;++f){let L=t[f];if(L===" ")b=!0;else if(L===`
32
+ `)T=f;else break}let I=t.substring(0,T<f?T+1:f);I&&(t=t.substring(I.length),I=I.replace(/\n+/g,`$&${u}`));let C=(b?u?"2":"1":"")+h;if(s&&(C+=" "+a(s.replace(/ ?[\r\n]+/g," ")),o&&o()),!g){let L=t.replace(/\n+/g,`
33
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`),k=!1,E=ls(n,!0);r!=="folded"&&e!==P.BLOCK_FOLDED&&(E.onOverflow=()=>{k=!0});let A=At(`${I}${L}${w}`,u,rs,E);if(!k)return`>${C}
34
+ ${u}${A}`}return t=t.replace(/\n+/g,`$&${u}`),`|${C}
35
+ ${u}${I}${t}${w}`}function Sr(s,e,t,n){let{type:o,value:i}=s,{actualString:r,implicitKey:a,indent:l,indentStep:u,inFlow:g}=e;if(a&&i.includes(`
36
+ `)||g&&/[[\]{},]/.test(i))return ct(i,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return a||g||!i.includes(`
37
+ `)?ct(i,e):as(s,e,t,n);if(!a&&!g&&o!==P.PLAIN&&i.includes(`
38
+ `))return as(s,e,t,n);if(cs(i)){if(l==="")return e.forceBlockIndent=!0,as(s,e,t,n);if(a&&l===u)return ct(i,e)}let h=i.replace(/\n+/g,`$&
39
+ ${l}`);if(r){let y=b=>b.default&&b.tag!=="tag:yaml.org,2002:str"&&b.test?.test(h),{compat:w,tags:N}=e.doc.schema;if(N.some(y)||w?.some(y))return ct(i,e)}return a?h:At(h,l,sn,ls(e,!1))}function qe(s,e,t,n){let{implicitKey:o,inFlow:i}=e,r=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)}),{type:a}=s;a!==P.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(r.value)&&(a=P.QUOTE_DOUBLE);let l=g=>{switch(g){case P.BLOCK_FOLDED:case P.BLOCK_LITERAL:return o||i?ct(r.value,e):as(r,e,t,n);case P.QUOTE_DOUBLE:return Et(r.value,e);case P.QUOTE_SINGLE:return nn(r.value,e);case P.PLAIN:return Sr(r,e,t,n);default:return null}},u=l(a);if(u===null){let{defaultKeyType:g,defaultStringType:h}=e.options,y=o&&g||h;if(u=l(y),u===null)throw new Error(`Unsupported default string type ${y}`)}return u}function us(s,e){let t=Object.assign({blockQuote:!0,commentString:Ao,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},s.schema.toStringOptions,e),n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:n,options:t}}function $r(s,e){if(e.tag){let o=s.filter(i=>i.tag===e.tag);if(o.length>0)return o.find(i=>i.format===e.format)??o[0]}let t,n;if(j(e)){n=e.value;let o=s.filter(i=>i.identify?.(n));if(o.length>1){let i=o.filter(r=>r.test);i.length>0&&(o=i)}t=o.find(i=>i.format===e.format)??o.find(i=>!i.format)}else n=e,t=s.find(o=>o.nodeClass&&n instanceof o.nodeClass);if(!t){let o=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${o} value`)}return t}function kr(s,e,{anchors:t,doc:n}){if(!n.directives)return"";let o=[],i=(j(s)||W(s))&&s.anchor;i&&ns(i)&&(t.add(i),o.push(`&${i}`));let r=s.tag??(e.default?null:e.tag);return r&&o.push(n.directives.tagString(r)),o.join(" ")}function Ke(s,e,t,n){if(J(s))return s.toString(e,t,n);if(ye(s)){if(e.doc.directives)return s.toString(e);if(e.resolvedAliases?.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let o,i=U(s)?s:e.doc.createNode(s,{onTagObj:l=>o=l});o??(o=$r(e.doc.schema.tags,i));let r=kr(i,o,e);r.length>0&&(e.indentAtStart=(e.indentAtStart??0)+r.length+1);let a=typeof o.stringify=="function"?o.stringify(i,e,t,n):j(i)?qe(i,e,t,n):i.toString(e,t,n);return r?j(i)||a[0]==="{"||a[0]==="["?`${r} ${a}`:`${r}
40
+ ${e.indent}${a}`:a}function Mo({key:s,value:e},t,n,o){let{allNullValues:i,doc:r,indent:a,indentStep:l,options:{commentString:u,indentSeq:g,simpleKeys:h}}=t,y=U(s)&&s.comment||null;if(h){if(y)throw new Error("With simple keys, key nodes cannot have comments");if(W(s)||!U(s)&&typeof s=="object"){let E="With simple keys, collection cannot be used as a key value";throw new Error(E)}}let w=!h&&(!s||y&&e==null&&!t.inFlow||W(s)||(j(s)?s.type===P.BLOCK_FOLDED||s.type===P.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!w&&(h||!i),indent:a+l});let N=!1,b=!1,f=Ke(s,t,()=>N=!0,()=>b=!0);if(!w&&!t.inFlow&&f.length>1024){if(h)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");w=!0}if(t.inFlow){if(i||e==null)return N&&n&&n(),f===""?"?":w?`? ${f}`:f}else if(i&&!h||e==null&&w)return f=`? ${f}`,y&&!N?f+=Ce(f,t.indent,u(y)):b&&o&&o(),f;N&&(y=null),w?(y&&(f+=Ce(f,t.indent,u(y))),f=`? ${f}
41
+ ${a}:`):(f=`${f}:`,y&&(f+=Ce(f,t.indent,u(y))));let T,I,O;U(e)?(T=!!e.spaceBefore,I=e.commentBefore,O=e.comment):(T=!1,I=null,O=null,e&&typeof e=="object"&&(e=r.createNode(e))),t.implicitKey=!1,!w&&!y&&j(e)&&(t.indentAtStart=f.length+1),b=!1,!g&&l.length>=2&&!t.inFlow&&!w&&Se(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let C=!1,L=Ke(e,t,()=>C=!0,()=>b=!0),k=" ";if(y||T||I){if(k=T?`
42
+ `:"",I){let E=u(I);k+=`
43
+ ${$e(E,t.indent)}`}L===""&&!t.inFlow?k===`
44
+ `&&O&&(k=`
45
+
46
+ `):k+=`
47
+ ${t.indent}`}else if(!w&&W(e)){let E=L[0],A=L.indexOf(`
48
+ `),q=A!==-1,ee=t.inFlow??e.flow??e.items.length===0;if(q||!ee){let ne=!1;if(q&&(E==="&"||E==="!")){let V=L.indexOf(" ");E==="&"&&V!==-1&&V<A&&L[V+1]==="!"&&(V=L.indexOf(" ",V+1)),(V===-1||A<V)&&(ne=!0)}ne||(k=`
49
+ ${t.indent}`)}}else(L===""||L[0]===`
50
+ `)&&(k="");return f+=k+L,t.inFlow?C&&n&&n():O&&!C?f+=Ce(f,t.indent,u(O)):b&&o&&o(),f}function fs(s,e){(s==="debug"||s==="warn")&&console.warn(e)}var ds="<<",Ne={identify:s=>s===ds||typeof s=="symbol"&&s.description===ds,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new P(Symbol(ds)),{addToJSMap:an}),stringify:()=>ds},_o=(s,e)=>(Ne.identify(e)||j(e)&&(!e.type||e.type===P.PLAIN)&&Ne.identify(e.value))&&s?.doc.schema.tags.some(t=>t.tag===Ne.tag&&t.default);function an(s,e,t){let n=Po(s,t);if(Se(n))for(let o of n.items)rn(s,e,o);else if(Array.isArray(n))for(let o of n)rn(s,e,o);else rn(s,e,n)}function rn(s,e,t){let n=Po(s,t);if(!we(n))throw new Error("Merge sources must be maps or map aliases");let o=n.toJSON(null,s,Map);for(let[i,r]of o)e instanceof Map?e.has(i)||e.set(i,r):e instanceof Set?e.add(i):Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{value:r,writable:!0,enumerable:!0,configurable:!0});return e}function Po(s,e){return s&&ye(e)?e.resolve(s.doc,s):e}function ps(s,e,{key:t,value:n}){if(U(t)&&t.addToJSMap)t.addToJSMap(s,e,n);else if(_o(s,t))an(s,e,n);else{let o=se(t,"",s);if(e instanceof Map)e.set(o,se(n,o,s));else if(e instanceof Set)e.add(o);else{let i=xr(t,o,s),r=se(n,i,s);i in e?Object.defineProperty(e,i,{value:r,writable:!0,enumerable:!0,configurable:!0}):e[i]=r}}return e}function xr(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(U(s)&&t?.doc){let n=us(t.doc,{});n.anchors=new Set;for(let i of t.anchors.keys())n.anchors.add(i.anchor);n.inFlow=!0,n.inStringifyKey=!0;let o=s.toString(n);if(!t.mapKeyWarned){let i=JSON.stringify(o);i.length>40&&(i=i.substring(0,36)+'..."'),fs(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return o}return JSON.stringify(e)}function ut(s,e,t){let n=je(s,void 0,t),o=je(e,void 0,t);return new X(n,o)}var X=class s{constructor(e,t=null){Object.defineProperty(this,ce,{value:Zs}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return U(t)&&(t=t.clone(e)),U(n)&&(n=n.clone(e)),new s(t,n)}toJSON(e,t){let n=t?.mapAsMap?new Map:{};return ps(t,n,this)}toString(e,t,n){return e?.doc?Mo(this,e,t,n):JSON.stringify(this)}};function hs(s,e,t){return(e.inFlow??s.flow?Nr:vr)(s,e,t)}function vr({comment:s,items:e},t,{blockItemPrefix:n,flowChars:o,itemIndent:i,onChompKeep:r,onComment:a}){let{indent:l,options:{commentString:u}}=t,g=Object.assign({},t,{indent:i,type:null}),h=!1,y=[];for(let N=0;N<e.length;++N){let b=e[N],f=null;if(U(b))!h&&b.spaceBefore&&y.push(""),ms(t,y,b.commentBefore,h),b.comment&&(f=b.comment);else if(J(b)){let I=U(b.key)?b.key:null;I&&(!h&&I.spaceBefore&&y.push(""),ms(t,y,I.commentBefore,h))}h=!1;let T=Ke(b,g,()=>f=null,()=>h=!0);f&&(T+=Ce(T,i,u(f))),h&&f&&(h=!1),y.push(n+T)}let w;if(y.length===0)w=o.start+o.end;else{w=y[0];for(let N=1;N<y.length;++N){let b=y[N];w+=b?`
51
+ ${l}${b}`:`
52
+ `}}return s?(w+=`
53
+ `+$e(u(s),l),a&&a()):h&&r&&r(),w}function Nr({items:s},e,{flowChars:t,itemIndent:n}){let{indent:o,indentStep:i,flowCollectionPadding:r,options:{commentString:a}}=e;n+=i;let l=Object.assign({},e,{indent:n,inFlow:!0,type:null}),u=!1,g=0,h=[];for(let N=0;N<s.length;++N){let b=s[N],f=null;if(U(b))b.spaceBefore&&h.push(""),ms(e,h,b.commentBefore,!1),b.comment&&(f=b.comment);else if(J(b)){let I=U(b.key)?b.key:null;I&&(I.spaceBefore&&h.push(""),ms(e,h,I.commentBefore,!1),I.comment&&(u=!0));let O=U(b.value)?b.value:null;O?(O.comment&&(f=O.comment),O.commentBefore&&(u=!0)):b.value==null&&I?.comment&&(f=I.comment)}f&&(u=!0);let T=Ke(b,l,()=>f=null);u||(u=h.length>g||T.includes(`
54
+ `)),N<s.length-1?T+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(u||(u=h.reduce((I,O)=>I+O.length+2,2)+(T.length+2)>e.options.lineWidth)),u&&(T+=",")),f&&(T+=Ce(T,n,a(f))),h.push(T),g=h.length}let{start:y,end:w}=t;if(h.length===0)return y+w;if(!u){let N=h.reduce((b,f)=>b+f.length+2,2);u=e.options.lineWidth>0&&N>e.options.lineWidth}if(u){let N=y;for(let b of h)N+=b?`
55
+ ${i}${o}${b}`:`
56
+ `;return`${N}
57
+ ${o}${w}`}else return`${y}${r}${h.join(" ")}${r}${w}`}function ms({indent:s,options:{commentString:e}},t,n,o){if(n&&o&&(n=n.replace(/^\n+/,"")),n){let i=$e(e(n),s);t.push(i.trimStart())}}function Ve(s,e){let t=j(e)?e.value:e;for(let n of s)if(J(n)&&(n.key===e||n.key===t||j(n.key)&&n.key.value===t))return n}var Z=class extends at{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(xe,e),this.items=[]}static from(e,t,n){let{keepUndefined:o,replacer:i}=n,r=new this(e),a=(l,u)=>{if(typeof i=="function")u=i.call(t,l,u);else if(Array.isArray(i)&&!i.includes(l))return;(u!==void 0||o)&&r.items.push(ut(l,u,n))};if(t instanceof Map)for(let[l,u]of t)a(l,u);else if(t&&typeof t=="object")for(let l of Object.keys(t))a(l,t[l]);return typeof e.sortMapEntries=="function"&&r.items.sort(e.sortMapEntries),r}add(e,t){let n;J(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new X(e,e?.value):n=new X(e.key,e.value);let o=Ve(this.items,n.key),i=this.schema?.sortMapEntries;if(o){if(!t)throw new Error(`Key ${n.key} already set`);j(o.value)&&is(n.value)?o.value.value=n.value:o.value=n.value}else if(i){let r=this.items.findIndex(a=>i(n,a)<0);r===-1?this.items.push(n):this.items.splice(r,0,n)}else this.items.push(n)}delete(e){let t=Ve(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let o=Ve(this.items,e)?.value;return(!t&&j(o)?o.value:o)??void 0}has(e){return!!Ve(this.items,e)}set(e,t){this.add(new X(e,t),!0)}toJSON(e,t,n){let o=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(o);for(let i of this.items)ps(t,o,i);return o}toString(e,t,n){if(!e)return JSON.stringify(this);for(let o of this.items)if(!J(o))throw new Error(`Map items must all be pairs; found ${JSON.stringify(o)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),hs(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}};var Ie={collection:"map",default:!0,nodeClass:Z,tag:"tag:yaml.org,2002:map",resolve(s,e){return we(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,t)=>Z.from(s,e,t)};var oe=class extends at{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Be,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=gs(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let n=gs(e);if(typeof n!="number")return;let o=this.items[n];return!t&&j(o)?o.value:o}has(e){let t=gs(e);return typeof t=="number"&&t<this.items.length}set(e,t){let n=gs(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let o=this.items[n];j(o)&&is(t)?o.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let o=0;for(let i of this.items)n.push(se(i,String(o++),t));return n}toString(e,t,n){return e?hs(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:o}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let r=0;for(let a of t){if(typeof o=="function"){let l=t instanceof Set?a:String(r++);a=o.call(t,l,a)}i.items.push(je(a,void 0,n))}}return i}};function gs(s){let e=j(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}var Te={collection:"seq",default:!0,nodeClass:oe,tag:"tag:yaml.org,2002:seq",resolve(s,e){return Se(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,t)=>oe.from(s,e,t)};var Ye={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),qe(s,e,t,n)}};var Ze={identify:s=>s==null,createNode:()=>new P(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new P(null),stringify:({source:s},e)=>typeof s=="string"&&Ze.test.test(s)?s:e.options.nullStr};var Mt={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new P(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&Mt.test.test(s)){let n=s[0]==="t"||s[0]==="T";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};function ae({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);let o=typeof n=="number"?n:Number(n);if(!isFinite(o))return isNaN(o)?".nan":o<0?"-.inf":".inf";let i=Object.is(n,-0)?"-0":JSON.stringify(n);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^-?\d/.test(i)&&!i.includes("e")){let r=i.indexOf(".");r<0&&(r=i.length,i+=".");let a=e-(i.length-r-1);for(;a-- >0;)i+="0"}return i}var ys={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ae},bs={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():ae(s)}},ws={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){let e=new P(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:ae};var Ss=s=>typeof s=="bigint"||Number.isInteger(s),ln=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function Co(s,e,t){let{value:n}=s;return Ss(n)&&n>=0?t+n.toString(e):ae(s)}var $s={identify:s=>Ss(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>ln(s,2,8,t),stringify:s=>Co(s,8,"0o")},ks={identify:Ss,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>ln(s,0,10,t),stringify:ae},xs={identify:s=>Ss(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>ln(s,2,16,t),stringify:s=>Co(s,16,"0x")};var Fo=[Ie,Te,Ye,Ze,Mt,$s,ks,xs,ys,bs,ws];function Lo(s){return typeof s=="bigint"||Number.isInteger(s)}var vs=({value:s})=>JSON.stringify(s),Ir=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:vs},{identify:s=>s==null,createNode:()=>new P(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:vs},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:s=>s==="true",stringify:vs},{identify:Lo,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>Lo(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:vs}],Tr={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},Do=[Ie,Te].concat(Ir,Tr);var _t={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof atob=="function"){let t=atob(s.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let o=0;o<t.length;++o)n[o]=t.charCodeAt(o);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:e,value:t},n,o,i){if(!t)return"";let r=t,a;if(typeof btoa=="function"){let l="";for(let u=0;u<r.length;++u)l+=String.fromCharCode(r[u]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=P.BLOCK_LITERAL),e!==P.QUOTE_DOUBLE){let l=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),u=Math.ceil(a.length/l),g=new Array(u);for(let h=0,y=0;h<u;++h,y+=l)g[h]=a.substr(y,l);a=g.join(e===P.BLOCK_LITERAL?`
58
+ `:" ")}return qe({comment:s,type:e,value:a},n,o,i)}};function cn(s,e){if(Se(s))for(let t=0;t<s.items.length;++t){let n=s.items[t];if(!J(n)){if(we(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let o=n.items[0]||new X(new P(null));if(n.commentBefore&&(o.key.commentBefore=o.key.commentBefore?`${n.commentBefore}
59
+ ${o.key.commentBefore}`:n.commentBefore),n.comment){let i=o.value??o.key;i.comment=i.comment?`${n.comment}
60
+ ${i.comment}`:n.comment}n=o}s.items[t]=J(n)?n:new X(n)}}else e("Expected a sequence for this tag");return s}function un(s,e,t){let{replacer:n}=t,o=new oe(s);o.tag="tag:yaml.org,2002:pairs";let i=0;if(e&&Symbol.iterator in Object(e))for(let r of e){typeof n=="function"&&(r=n.call(e,String(i++),r));let a,l;if(Array.isArray(r))if(r.length===2)a=r[0],l=r[1];else throw new TypeError(`Expected [key, value] tuple: ${r}`);else if(r&&r instanceof Object){let u=Object.keys(r);if(u.length===1)a=u[0],l=r[a];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else a=r;o.items.push(ut(a,l,t))}return o}var Pt={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:cn,createNode:un};var ft=class s extends oe{constructor(){super(),this.add=Z.prototype.add.bind(this),this.delete=Z.prototype.delete.bind(this),this.get=Z.prototype.get.bind(this),this.has=Z.prototype.has.bind(this),this.set=Z.prototype.set.bind(this),this.tag=s.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let o of this.items){let i,r;if(J(o)?(i=se(o.key,"",t),r=se(o.value,i,t)):i=se(o,"",t),n.has(i))throw new Error("Ordered maps must not include duplicate keys");n.set(i,r)}return n}static from(e,t,n){let o=un(e,t,n),i=new this;return i.items=o.items,i}};ft.tag="tag:yaml.org,2002:omap";var Ct={collection:"seq",identify:s=>s instanceof Map,nodeClass:ft,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){let t=cn(s,e),n=[];for(let{key:o}of t.items)j(o)&&(n.includes(o.value)?e(`Ordered maps must not include duplicate keys: ${o.value}`):n.push(o.value));return Object.assign(new ft,t)},createNode:(s,e,t)=>ft.from(s,e,t)};function Ro({value:s,source:e},t){return e&&(s?fn:dn).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}var fn={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new P(!0),stringify:Ro},dn={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new P(!1),stringify:Ro};var Bo={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ae},jo={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():ae(s)}},qo={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){let e=new P(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){let n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:ae};var Ft=s=>typeof s=="bigint"||Number.isInteger(s);function Ns(s,e,t,{intAsBigInt:n}){let o=s[0];if((o==="-"||o==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}let r=BigInt(s);return o==="-"?BigInt(-1)*r:r}let i=parseInt(s,t);return o==="-"?-1*i:i}function pn(s,e,t){let{value:n}=s;if(Ft(n)){let o=n.toString(e);return n<0?"-"+t+o.substr(1):t+o}return ae(s)}var Ko={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>Ns(s,2,2,t),stringify:s=>pn(s,2,"0b")},Jo={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>Ns(s,1,8,t),stringify:s=>pn(s,8,"0")},Uo={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>Ns(s,0,10,t),stringify:ae},Wo={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>Ns(s,2,16,t),stringify:s=>pn(s,16,"0x")};var dt=class s extends Z{constructor(e){super(e),this.tag=s.tag}add(e){let t;J(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new X(e.key,null):t=new X(e,null),Ve(this.items,t.key)||this.items.push(t)}get(e,t){let n=Ve(this.items,e);return!t&&J(n)?j(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=Ve(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new X(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}static from(e,t,n){let{replacer:o}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let r of t)typeof o=="function"&&(r=o.call(t,r,r)),i.items.push(ut(r,null,n));return i}};dt.tag="tag:yaml.org,2002:set";var Lt={collection:"map",identify:s=>s instanceof Set,nodeClass:dt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(s,e,t)=>dt.from(s,e,t),resolve(s,e){if(we(s)){if(s.hasAllNullValues(!0))return Object.assign(new dt,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s}};function mn(s,e){let t=s[0],n=t==="-"||t==="+"?s.substring(1):s,o=r=>e?BigInt(r):Number(r),i=n.replace(/_/g,"").split(":").reduce((r,a)=>r*o(60)+o(a),o(0));return t==="-"?o(-1)*i:i}function Vo(s){let{value:e}=s,t=r=>r;if(typeof e=="bigint")t=r=>BigInt(r);else if(isNaN(e)||!isFinite(e))return ae(s);let n="";e<0&&(n="-",e*=t(-1));let o=t(60),i=[e%o];return e<60?i.unshift(0):(e=(e-i[0])/o,i.unshift(e%o),e>=60&&(e=(e-i[0])/o,i.unshift(e))),n+i.map(r=>String(r).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Is={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>mn(s,t),stringify:Vo},Ts={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:s=>mn(s,!1),stringify:Vo},pt={identify:s=>s instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(s){let e=s.match(pt.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,n,o,i,r,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,u=Date.UTC(t,n-1,o,i||0,r||0,a||0,l),g=e[8];if(g&&g!=="Z"){let h=mn(g,!1);Math.abs(h)<30&&(h*=60),u-=6e4*h}return new Date(u)},stringify:({value:s})=>s?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};var hn=[Ie,Te,Ye,Ze,fn,dn,Ko,Jo,Uo,Wo,Bo,jo,qo,_t,Ne,Ct,Pt,Lt,Is,Ts,pt];var Yo=new Map([["core",Fo],["failsafe",[Ie,Te,Ye]],["json",Do],["yaml11",hn],["yaml-1.1",hn]]),Ho={binary:_t,bool:Mt,float:ws,floatExp:bs,floatNaN:ys,floatTime:Ts,int:ks,intHex:xs,intOct:$s,intTime:Is,map:Ie,merge:Ne,null:Ze,omap:Ct,pairs:Pt,seq:Te,set:Lt,timestamp:pt},Go={"tag:yaml.org,2002:binary":_t,"tag:yaml.org,2002:merge":Ne,"tag:yaml.org,2002:omap":Ct,"tag:yaml.org,2002:pairs":Pt,"tag:yaml.org,2002:set":Lt,"tag:yaml.org,2002:timestamp":pt};function Os(s,e,t){let n=Yo.get(e);if(n&&!s)return t&&!n.includes(Ne)?n.concat(Ne):n.slice();let o=n;if(!o)if(Array.isArray(s))o=[];else{let i=Array.from(Yo.keys()).filter(r=>r!=="yaml11").map(r=>JSON.stringify(r)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${i} or define customTags array`)}if(Array.isArray(s))for(let i of s)o=o.concat(i);else typeof s=="function"&&(o=s(o.slice()));return t&&(o=o.concat(Ne)),o.reduce((i,r)=>{let a=typeof r=="string"?Ho[r]:r;if(!a){let l=JSON.stringify(r),u=Object.keys(Ho).map(g=>JSON.stringify(g)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${u}`)}return i.includes(a)||i.push(a),i},[])}var Or=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0,mt=class s{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:o,schema:i,sortMapEntries:r,toStringDefaults:a}){this.compat=Array.isArray(e)?Os(e,"compat"):e?Os(null,e):null,this.name=typeof i=="string"&&i||"core",this.knownTags=o?Go:{},this.tags=Os(t,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,xe,{value:Ie}),Object.defineProperty(this,me,{value:Ye}),Object.defineProperty(this,Be,{value:Te}),this.sortMapEntries=typeof r=="function"?r:r===!0?Or:null}clone(){let e=Object.create(s.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};function zo(s,e){let t=[],n=e.directives===!0;if(e.directives!==!1&&s.directives){let l=s.directives.toString(s);l?(t.push(l),n=!0):s.directives.docStart&&(n=!0)}n&&t.push("---");let o=us(s,e),{commentString:i}=o.options;if(s.commentBefore){t.length!==1&&t.unshift("");let l=i(s.commentBefore);t.unshift($e(l,""))}let r=!1,a=null;if(s.contents){if(U(s.contents)){if(s.contents.spaceBefore&&n&&t.push(""),s.contents.commentBefore){let g=i(s.contents.commentBefore);t.push($e(g,""))}o.forceBlockIndent=!!s.comment,a=s.contents.comment}let l=a?void 0:()=>r=!0,u=Ke(s.contents,o,()=>a=null,l);a&&(u+=Ce(u,"",i(a))),(u[0]==="|"||u[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${u}`:t.push(u)}else t.push(Ke(s.contents,o));if(s.directives?.docEnd)if(s.comment){let l=i(s.comment);l.includes(`
61
+ `)?(t.push("..."),t.push($e(l,""))):t.push(`... ${l}`)}else t.push("...");else{let l=s.comment;l&&r&&(l=l.replace(/^\n+/,"")),l&&((!r||a)&&t[t.length-1]!==""&&t.push(""),t.push($e(i(l),"")))}return t.join(`
62
+ `)+`
63
+ `}var Fe=class s{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ce,{value:ts});let o=null;typeof t=="function"||Array.isArray(t)?o=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=i;let{version:r}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(r=this.directives.yaml.version)):this.directives=new _e({version:r}),this.setSchema(r,n),this.contents=e===void 0?null:this.createNode(e,o,n)}clone(){let e=Object.create(s.prototype,{[ce]:{value:ts}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=U(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ht(this.contents)&&this.contents.add(e)}addIn(e,t){ht(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=en(this);e.anchor=!t||n.has(t)?tn(t||"a",n):t}return new Pe(e.anchor)}createNode(e,t,n){let o;if(typeof t=="function")e=t.call({"":e},"",e),o=t;else if(Array.isArray(t)){let f=I=>typeof I=="number"||I instanceof String||I instanceof Number,T=t.filter(f).map(String);T.length>0&&(t=t.concat(T)),o=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:r,flow:a,keepUndefined:l,onTagObj:u,tag:g}=n??{},{onAnchor:h,setAnchors:y,sourceObjects:w}=Oo(this,r||"a"),N={aliasDuplicateObjects:i??!0,keepUndefined:l??!1,onAnchor:h,onTagObj:u,replacer:o,schema:this.schema,sourceObjects:w},b=je(e,g,N);return a&&W(b)&&(b.flow=!0),y(),b}createPair(e,t,n={}){let o=this.createNode(e,null,n),i=this.createNode(t,null,n);return new X(o,i)}delete(e){return ht(this.contents)?this.contents.delete(e):!1}deleteIn(e){return lt(e)?this.contents==null?!1:(this.contents=null,!0):ht(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return W(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return lt(e)?!t&&j(this.contents)?this.contents.value:this.contents:W(this.contents)?this.contents.getIn(e,t):void 0}has(e){return W(this.contents)?this.contents.has(e):!1}hasIn(e){return lt(e)?this.contents!==void 0:W(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Tt(this.schema,[e],t):ht(this.contents)&&this.contents.set(e,t)}setIn(e,t){lt(e)?this.contents=t:this.contents==null?this.contents=Tt(this.schema,Array.from(e),t):ht(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new _e({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new _e({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let o=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${o}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new mt(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:o,onAnchor:i,reviver:r}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof o=="number"?o:100},l=se(this.contents,t??"",a);if(typeof i=="function")for(let{count:u,res:g}of a.anchors.values())i(g,u);return typeof r=="function"?Ue(r,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return zo(this,e)}};function ht(s){if(W(s))return!0;throw new Error("Expected a YAML collection as document contents")}var gt=class extends Error{constructor(e,t,n,o){super(),this.name=e,this.code=n,this.message=o,this.pos=t}},he=class extends gt{constructor(e,t,n){super("YAMLParseError",e,t,n)}},yt=class extends gt{constructor(e,t,n){super("YAMLWarning",e,t,n)}},Dt=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));let{line:n,col:o}=t.linePos[0];t.message+=` at line ${n}, column ${o}`;let i=o-1,r=s.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(i>=60&&r.length>80){let a=Math.min(i-39,r.length-79);r="\u2026"+r.substring(a),i-=a-1}if(r.length>80&&(r=r.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(r.substring(0,i))){let a=s.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
64
+ `),r=a+r}if(/[^ ]/.test(r)){let a=1,l=t.linePos[1];l?.line===n&&l.col>o&&(a=Math.max(1,Math.min(l.col-o,80-i)));let u=" ".repeat(i)+"^".repeat(a);t.message+=`:
65
+
66
+ ${r}
67
+ ${u}
68
+ `}};function Le(s,{flow:e,indicator:t,next:n,offset:o,onError:i,parentIndent:r,startOnNewline:a}){let l=!1,u=a,g=a,h="",y="",w=!1,N=!1,b=null,f=null,T=null,I=null,O=null,C=null,L=null;for(let A of s)switch(N&&(A.type!=="space"&&A.type!=="newline"&&A.type!=="comma"&&i(A.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),N=!1),b&&(u&&A.type!=="comment"&&A.type!=="newline"&&i(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),b=null),A.type){case"space":!e&&(t!=="doc-start"||n?.type!=="flow-collection")&&A.source.includes(" ")&&(b=A),g=!0;break;case"comment":{g||i(A,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let q=A.source.substring(1)||" ";h?h+=y+q:h=q,y="",u=!1;break}case"newline":u?h?h+=A.source:(!C||t!=="seq-item-ind")&&(l=!0):y+=A.source,u=!0,w=!0,(f||T)&&(I=A),g=!0;break;case"anchor":f&&i(A,"MULTIPLE_ANCHORS","A node can have at most one anchor"),A.source.endsWith(":")&&i(A.offset+A.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),f=A,L??(L=A.offset),u=!1,g=!1,N=!0;break;case"tag":{T&&i(A,"MULTIPLE_TAGS","A node can have at most one tag"),T=A,L??(L=A.offset),u=!1,g=!1,N=!0;break}case t:(f||T)&&i(A,"BAD_PROP_ORDER",`Anchors and tags must be after the ${A.source} indicator`),C&&i(A,"UNEXPECTED_TOKEN",`Unexpected ${A.source} in ${e??"collection"}`),C=A,u=t==="seq-item-ind"||t==="explicit-key-ind",g=!1;break;case"comma":if(e){O&&i(A,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),O=A,u=!1,g=!1;break}default:i(A,"UNEXPECTED_TOKEN",`Unexpected ${A.type} token`),u=!1,g=!1}let k=s[s.length-1],E=k?k.offset+k.source.length:o;return N&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&i(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b&&(u&&b.indent<=r||n?.type==="block-map"||n?.type==="block-seq")&&i(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:O,found:C,spaceBefore:l,comment:h,hasNewline:w,anchor:f,tag:T,newlineAfterProp:I,end:E,start:L??E}}function He(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(`
69
+ `))return!0;if(s.end){for(let e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of s.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(He(e.key)||He(e.value))return!0}return!1;default:return!0}}function Rt(s,e,t){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&He(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function As(s,e,t){let{uniqueKeys:n}=s.options;if(n===!1)return!1;let o=typeof n=="function"?n:(i,r)=>i===r||j(i)&&j(r)&&i.value===r.value;return e.some(i=>o(i.key,t))}var Qo="All mapping items must start at the same column";function Xo({composeNode:s,composeEmptyNode:e},t,n,o,i){let r=i?.nodeClass??Z,a=new r(t.schema);t.atRoot&&(t.atRoot=!1);let l=n.offset,u=null;for(let g of n.items){let{start:h,key:y,sep:w,value:N}=g,b=Le(h,{indicator:"explicit-key-ind",next:y??w?.[0],offset:l,onError:o,parentIndent:n.indent,startOnNewline:!0}),f=!b.found;if(f){if(y&&(y.type==="block-seq"?o(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in y&&y.indent!==n.indent&&o(l,"BAD_INDENT",Qo)),!b.anchor&&!b.tag&&!w){u=b.end,b.comment&&(a.comment?a.comment+=`
70
+ `+b.comment:a.comment=b.comment);continue}(b.newlineAfterProp||He(y))&&o(y??h[h.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else b.found?.indent!==n.indent&&o(l,"BAD_INDENT",Qo);t.atKey=!0;let T=b.end,I=y?s(t,y,b,o):e(t,T,h,null,b,o);t.schema.compat&&Rt(n.indent,y,o),t.atKey=!1,As(t,a.items,I)&&o(T,"DUPLICATE_KEY","Map keys must be unique");let O=Le(w??[],{indicator:"map-value-ind",next:N,offset:I.range[2],onError:o,parentIndent:n.indent,startOnNewline:!y||y.type==="block-scalar"});if(l=O.end,O.found){f&&(N?.type==="block-map"&&!O.hasNewline&&o(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&b.start<O.found.offset-1024&&o(I.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let C=N?s(t,N,O,o):e(t,l,w,null,O,o);t.schema.compat&&Rt(n.indent,N,o),l=C.range[2];let L=new X(I,C);t.options.keepSourceTokens&&(L.srcToken=g),a.items.push(L)}else{f&&o(I.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),O.comment&&(I.comment?I.comment+=`
71
+ `+O.comment:I.comment=O.comment);let C=new X(I);t.options.keepSourceTokens&&(C.srcToken=g),a.items.push(C)}}return u&&u<l&&o(u,"IMPOSSIBLE","Map comment with trailing content"),a.range=[n.offset,l,u??l],a}function Zo({composeNode:s,composeEmptyNode:e},t,n,o,i){let r=i?.nodeClass??oe,a=new r(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let l=n.offset,u=null;for(let{start:g,value:h}of n.items){let y=Le(g,{indicator:"seq-item-ind",next:h,offset:l,onError:o,parentIndent:n.indent,startOnNewline:!0});if(!y.found)if(y.anchor||y.tag||h)h?.type==="block-seq"?o(y.end,"BAD_INDENT","All sequence items must start at the same column"):o(l,"MISSING_CHAR","Sequence item without - indicator");else{u=y.end,y.comment&&(a.comment=y.comment);continue}let w=h?s(t,h,y,o):e(t,y.end,g,null,y,o);t.schema.compat&&Rt(n.indent,h,o),l=w.range[2],a.items.push(w)}return a.range=[n.offset,l,u??l],a}function De(s,e,t,n){let o="";if(s){let i=!1,r="";for(let a of s){let{source:l,type:u}=a;switch(u){case"space":i=!0;break;case"comment":{t&&!i&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let g=l.substring(1)||" ";o?o+=r+g:o=g,r="";break}case"newline":o&&(r+=l),i=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${u} at node end`)}e+=l.length}}return{comment:o,offset:e}}var gn="Block collections are not allowed within flow collections",yn=s=>s&&(s.type==="block-map"||s.type==="block-seq");function ei({composeNode:s,composeEmptyNode:e},t,n,o,i){let r=n.start.source==="{",a=r?"flow map":"flow sequence",l=i?.nodeClass??(r?Z:oe),u=new l(t.schema);u.flow=!0;let g=t.atRoot;g&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let h=n.offset+n.start.source.length;for(let f=0;f<n.items.length;++f){let T=n.items[f],{start:I,key:O,sep:C,value:L}=T,k=Le(I,{flow:a,indicator:"explicit-key-ind",next:O??C?.[0],offset:h,onError:o,parentIndent:n.indent,startOnNewline:!1});if(!k.found){if(!k.anchor&&!k.tag&&!C&&!L){f===0&&k.comma?o(k.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):f<n.items.length-1&&o(k.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),k.comment&&(u.comment?u.comment+=`
72
+ `+k.comment:u.comment=k.comment),h=k.end;continue}!r&&t.options.strict&&He(O)&&o(O,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(f===0)k.comma&&o(k.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(k.comma||o(k.start,"MISSING_CHAR",`Missing , between ${a} items`),k.comment){let E="";e:for(let A of I)switch(A.type){case"comma":case"space":break;case"comment":E=A.source.substring(1);break e;default:break e}if(E){let A=u.items[u.items.length-1];J(A)&&(A=A.value??A.key),A.comment?A.comment+=`
73
+ `+E:A.comment=E,k.comment=k.comment.substring(E.length+1)}}if(!r&&!C&&!k.found){let E=L?s(t,L,k,o):e(t,k.end,C,null,k,o);u.items.push(E),h=E.range[2],yn(L)&&o(E.range,"BLOCK_IN_FLOW",gn)}else{t.atKey=!0;let E=k.end,A=O?s(t,O,k,o):e(t,E,I,null,k,o);yn(O)&&o(A.range,"BLOCK_IN_FLOW",gn),t.atKey=!1;let q=Le(C??[],{flow:a,indicator:"map-value-ind",next:L,offset:A.range[2],onError:o,parentIndent:n.indent,startOnNewline:!1});if(q.found){if(!r&&!k.found&&t.options.strict){if(C)for(let V of C){if(V===q.found)break;if(V.type==="newline"){o(V,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}k.start<q.found.offset-1024&&o(q.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else L&&("source"in L&&L.source?.[0]===":"?o(L,"MISSING_CHAR",`Missing space after : in ${a}`):o(q.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let ee=L?s(t,L,q,o):q.found?e(t,q.end,C,null,q,o):null;ee?yn(L)&&o(ee.range,"BLOCK_IN_FLOW",gn):q.comment&&(A.comment?A.comment+=`
74
+ `+q.comment:A.comment=q.comment);let ne=new X(A,ee);if(t.options.keepSourceTokens&&(ne.srcToken=T),r){let V=u;As(t,V.items,A)&&o(E,"DUPLICATE_KEY","Map keys must be unique"),V.items.push(ne)}else{let V=new Z(t.schema);V.flow=!0,V.items.push(ne);let Qe=(ee??A).range;V.range=[A.range[0],Qe[1],Qe[2]],u.items.push(V)}h=ee?ee.range[2]:q.end}}let y=r?"}":"]",[w,...N]=n.end,b=h;if(w?.source===y)b=w.offset+w.source.length;else{let f=a[0].toUpperCase()+a.substring(1),T=g?`${f} must end with a ${y}`:`${f} in block collection must be sufficiently indented and end with a ${y}`;o(h,g?"MISSING_CHAR":"BAD_INDENT",T),w&&w.source.length!==1&&N.unshift(w)}if(N.length>0){let f=De(N,b,t.options.strict,o);f.comment&&(u.comment?u.comment+=`
75
+ `+f.comment:u.comment=f.comment),u.range=[n.offset,b,f.offset]}else u.range=[n.offset,b,b];return u}function bn(s,e,t,n,o,i){let r=t.type==="block-map"?Xo(s,e,t,n,i):t.type==="block-seq"?Zo(s,e,t,n,i):ei(s,e,t,n,i),a=r.constructor;return o==="!"||o===a.tagName?(r.tag=a.tagName,r):(o&&(r.tag=o),r)}function ti(s,e,t,n,o){let i=n.tag,r=i?e.directives.tagName(i.source,y=>o(i,"TAG_RESOLVE_FAILED",y)):null;if(t.type==="block-seq"){let{anchor:y,newlineAfterProp:w}=n,N=y&&i?y.offset>i.offset?y:i:y??i;N&&(!w||w.offset<N.offset)&&o(N,"MISSING_CHAR","Missing newline after block sequence props")}let a=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!i||!r||r==="!"||r===Z.tagName&&a==="map"||r===oe.tagName&&a==="seq")return bn(s,e,t,o,r);let l=e.schema.tags.find(y=>y.tag===r&&y.collection===a);if(!l){let y=e.schema.knownTags[r];if(y?.collection===a)e.schema.tags.push(Object.assign({},y,{default:!1})),l=y;else return y?o(i,"BAD_COLLECTION_TYPE",`${y.tag} used for ${a} collection, but expects ${y.collection??"scalar"}`,!0):o(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,!0),bn(s,e,t,o,r)}let u=bn(s,e,t,o,r,l),g=l.resolve?.(u,y=>o(i,"TAG_RESOLVE_FAILED",y),e.options)??u,h=U(g)?g:new P(g);return h.range=u.range,h.tag=r,l?.format&&(h.format=l.format),h}function Es(s,e,t){let n=e.offset,o=Ar(e,s.options.strict,t);if(!o)return{value:"",type:null,comment:"",range:[n,n,n]};let i=o.mode===">"?P.BLOCK_FOLDED:P.BLOCK_LITERAL,r=e.source?Er(e.source):[],a=r.length;for(let b=r.length-1;b>=0;--b){let f=r[b][1];if(f===""||f==="\r")a=b;else break}if(a===0){let b=o.chomp==="+"&&r.length>0?`
76
+ `.repeat(Math.max(1,r.length-1)):"",f=n+o.length;return e.source&&(f+=e.source.length),{value:b,type:i,comment:o.comment,range:[n,f,f]}}let l=e.indent+o.indent,u=e.offset+o.length,g=0;for(let b=0;b<a;++b){let[f,T]=r[b];if(T===""||T==="\r")o.indent===0&&f.length>l&&(l=f.length);else{f.length<l&&t(u+f.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),o.indent===0&&(l=f.length),g=b,l===0&&!s.atRoot&&t(u,"BAD_INDENT","Block scalar values in collections must be indented");break}u+=f.length+T.length+1}for(let b=r.length-1;b>=a;--b)r[b][0].length>l&&(a=b+1);let h="",y="",w=!1;for(let b=0;b<g;++b)h+=r[b][0].slice(l)+`
77
+ `;for(let b=g;b<a;++b){let[f,T]=r[b];u+=f.length+T.length+1;let I=T[T.length-1]==="\r";if(I&&(T=T.slice(0,-1)),T&&f.length<l){let C=`Block scalar lines must not be less indented than their ${o.indent?"explicit indentation indicator":"first line"}`;t(u-T.length-(I?2:1),"BAD_INDENT",C),f=""}i===P.BLOCK_LITERAL?(h+=y+f.slice(l)+T,y=`
78
+ `):f.length>l||T[0]===" "?(y===" "?y=`
79
+ `:!w&&y===`
80
+ `&&(y=`
81
+
82
+ `),h+=y+f.slice(l)+T,y=`
83
+ `,w=!0):T===""?y===`
84
+ `?h+=`
85
+ `:y=`
86
+ `:(h+=y+T,y=" ",w=!1)}switch(o.chomp){case"-":break;case"+":for(let b=a;b<r.length;++b)h+=`
87
+ `+r[b][0].slice(l);h[h.length-1]!==`
88
+ `&&(h+=`
89
+ `);break;default:h+=`
90
+ `}let N=n+o.length+e.source.length;return{value:h,type:i,comment:o.comment,range:[n,N,N]}}function Ar({offset:s,props:e},t,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:o}=e[0],i=o[0],r=0,a="",l=-1;for(let y=1;y<o.length;++y){let w=o[y];if(!a&&(w==="-"||w==="+"))a=w;else{let N=Number(w);!r&&N?r=N:l===-1&&(l=s+y)}}l!==-1&&n(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${o}`);let u=!1,g="",h=o.length;for(let y=1;y<e.length;++y){let w=e[y];switch(w.type){case"space":u=!0;case"newline":h+=w.source.length;break;case"comment":t&&!u&&n(w,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),h+=w.source.length,g=w.source.substring(1);break;case"error":n(w,"UNEXPECTED_TOKEN",w.message),h+=w.source.length;break;default:{let N=`Unexpected token in block scalar header: ${w.type}`;n(w,"UNEXPECTED_TOKEN",N);let b=w.source;b&&typeof b=="string"&&(h+=b.length)}}}return{mode:i,indent:r,chomp:a,comment:g,length:h}}function Er(s){let e=s.split(/\n( *)/),t=e[0],n=t.match(/^( *)/),i=[n?.[1]?[n[1],t.slice(n[1].length)]:["",t]];for(let r=1;r<e.length;r+=2)i.push([e[r],e[r+1]]);return i}function Ms(s,e,t){let{offset:n,type:o,source:i,end:r}=s,a,l,u=(y,w,N)=>t(n+y,w,N);switch(o){case"scalar":a=P.PLAIN,l=Mr(i,u);break;case"single-quoted-scalar":a=P.QUOTE_SINGLE,l=_r(i,u);break;case"double-quoted-scalar":a=P.QUOTE_DOUBLE,l=Pr(i,u);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${o}`),{value:"",type:null,comment:"",range:[n,n+i.length,n+i.length]}}let g=n+i.length,h=De(r,g,e,t);return{value:l,type:a,comment:h.comment,range:[n,g,h.offset]}}function Mr(s,e){let t="";switch(s[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),si(s)}function _r(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),si(s.slice(1,-1)).replace(/''/g,"'")}function si(s){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
91
+ `,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
92
+ `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(s);if(!n)return s;let o=n[1],i=" ",r=e.lastIndex;for(t.lastIndex=r;n=t.exec(s);)n[1]===""?i===`
93
+ `?o+=i:i=`
94
+ `:(o+=i+n[1],i=" "),r=t.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=r,n=a.exec(s),o+i+(n?.[1]??"")}function Pr(s,e){let t="";for(let n=1;n<s.length-1;++n){let o=s[n];if(!(o==="\r"&&s[n+1]===`
95
+ `))if(o===`
96
+ `){let{fold:i,offset:r}=Cr(s,n);t+=i,n=r}else if(o==="\\"){let i=s[++n],r=Fr[i];if(r)t+=r;else if(i===`
97
+ `)for(i=s[n+1];i===" "||i===" ";)i=s[++n+1];else if(i==="\r"&&s[n+1]===`
98
+ `)for(i=s[++n+1];i===" "||i===" ";)i=s[++n+1];else if(i==="x"||i==="u"||i==="U"){let a=i==="x"?2:i==="u"?4:8;t+=Lr(s,n+1,a,e),n+=a}else{let a=s.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(o===" "||o===" "){let i=n,r=s[n+1];for(;r===" "||r===" ";)r=s[++n+1];r!==`
99
+ `&&!(r==="\r"&&s[n+2]===`
100
+ `)&&(t+=n>i?s.slice(i,n+1):o)}else t+=o}return(s[s.length-1]!=='"'||s.length===1)&&e(s.length,"MISSING_CHAR",'Missing closing "quote'),t}function Cr(s,e){let t="",n=s[e+1];for(;(n===" "||n===" "||n===`
101
+ `||n==="\r")&&!(n==="\r"&&s[e+2]!==`
102
+ `);)n===`
103
+ `&&(t+=`
104
+ `),e+=1,n=s[e+1];return t||(t=" "),{fold:t,offset:e}}var Fr={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
105
+ `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Lr(s,e,t,n){let o=s.substr(e,t),r=o.length===t&&/^[0-9a-fA-F]+$/.test(o)?parseInt(o,16):NaN;try{return String.fromCodePoint(r)}catch{let a=s.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}function wn(s,e,t,n){let{value:o,type:i,comment:r,range:a}=e.type==="block-scalar"?Es(s,e,n):Ms(e,s.options.strict,n),l=t?s.directives.tagName(t.source,h=>n(t,"TAG_RESOLVE_FAILED",h)):null,u;s.options.stringKeys&&s.atKey?u=s.schema[me]:l?u=Dr(s.schema,o,l,t,n):e.type==="scalar"?u=Rr(s,o,e,n):u=s.schema[me];let g;try{let h=u.resolve(o,y=>n(t??e,"TAG_RESOLVE_FAILED",y),s.options);g=j(h)?h:new P(h)}catch(h){let y=h instanceof Error?h.message:String(h);n(t??e,"TAG_RESOLVE_FAILED",y),g=new P(o)}return g.range=a,g.source=o,i&&(g.type=i),l&&(g.tag=l),u.format&&(g.format=u.format),r&&(g.comment=r),g}function Dr(s,e,t,n,o){if(t==="!")return s[me];let i=[];for(let a of s.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)i.push(a);else return a;for(let a of i)if(a.test?.test(e))return a;let r=s.knownTags[t];return r&&!r.collection?(s.tags.push(Object.assign({},r,{default:!1,test:void 0})),r):(o(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[me])}function Rr({atKey:s,directives:e,schema:t},n,o,i){let r=t.tags.find(a=>(a.default===!0||s&&a.default==="key")&&a.test?.test(n))||t[me];if(t.compat){let a=t.compat.find(l=>l.default&&l.test?.test(n))??t[me];if(r.tag!==a.tag){let l=e.tagString(r.tag),u=e.tagString(a.tag),g=`Value may be parsed as either ${l} or ${u}`;i(o,"TAG_RESOLVE_FAILED",g,!0)}}return r}function ni(s,e,t){if(e){t??(t=e.length);for(let n=t-1;n>=0;--n){let o=e[n];switch(o.type){case"space":case"comment":case"newline":s-=o.source.length;continue}for(o=e[++n];o?.type==="space";)s+=o.source.length,o=e[++n];break}}return s}var Br={composeNode:Sn,composeEmptyNode:_s};function Sn(s,e,t,n){let o=s.atKey,{spaceBefore:i,comment:r,anchor:a,tag:l}=t,u,g=!0;switch(e.type){case"alias":u=jr(s,e,n),(a||l)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=wn(s,e,l,n),a&&(u.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=ti(Br,s,e,t,n),a&&(u.anchor=a.source.substring(1))}catch(h){let y=h instanceof Error?h.message:String(h);n(e,"RESOURCE_EXHAUSTION",y)}break;default:{let h=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",h),g=!1}}return u??(u=_s(s,e.offset,void 0,null,t,n)),a&&u.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),o&&s.options.stringKeys&&(!j(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&n(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(u.spaceBefore=!0),r&&(e.type==="scalar"&&e.source===""?u.comment=r:u.commentBefore=r),s.options.keepSourceTokens&&g&&(u.srcToken=e),u}function _s(s,e,t,n,{spaceBefore:o,comment:i,anchor:r,tag:a,end:l},u){let g={type:"scalar",offset:ni(e,t,n),indent:-1,source:""},h=wn(s,g,a,u);return r&&(h.anchor=r.source.substring(1),h.anchor===""&&u(r,"BAD_ALIAS","Anchor cannot be an empty string")),o&&(h.spaceBefore=!0),i&&(h.comment=i,h.range[2]=l),h}function jr({options:s},{offset:e,source:t,end:n},o){let i=new Pe(t.substring(1));i.source===""&&o(e,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&o(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let r=e+t.length,a=De(n,r,s.strict,o);return i.range=[e,r,a.offset],a.comment&&(i.comment=a.comment),i}function oi(s,e,{offset:t,start:n,value:o,end:i},r){let a=Object.assign({_directives:e},s),l=new Fe(void 0,a),u={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},g=Le(n,{indicator:"doc-start",next:o??i?.[0],offset:t,onError:r,parentIndent:0,startOnNewline:!0});g.found&&(l.directives.docStart=!0,o&&(o.type==="block-map"||o.type==="block-seq")&&!g.hasNewline&&r(g.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=o?Sn(u,o,g,r):_s(u,g.end,n,null,g,r);let h=l.contents.range[2],y=De(i,h,!1,r);return y.comment&&(l.comment=y.comment),l.range=[t,h,y.offset],l}function Bt(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];let{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function ii(s){let e="",t=!1,n=!1;for(let o=0;o<s.length;++o){let i=s[o];switch(i[0]){case"#":e+=(e===""?"":n?`
106
+
107
+ `:`
108
+ `)+(i.substring(1)||" "),t=!0,n=!1;break;case"%":s[o+1]?.[0]!=="#"&&(o+=1),t=!1;break;default:t||(n=!0),t=!1}}return{comment:e,afterEmptyLine:n}}var et=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,o,i)=>{let r=Bt(t);i?this.warnings.push(new yt(r,n,o)):this.errors.push(new he(r,n,o))},this.directives=new _e({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:o}=ii(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}
109
+ ${n}`:n;else if(o||e.directives.docStart||!i)e.commentBefore=n;else if(W(i)&&!i.flow&&i.items.length>0){let r=i.items[0];J(r)&&(r=r.key);let a=r.commentBefore;r.commentBefore=a?`${n}
110
+ ${a}`:n}else{let r=i.commentBefore;i.commentBefore=r?`${n}
111
+ ${r}`:n}}if(t){for(let i=0;i<this.errors.length;++i)e.errors.push(this.errors[i]);for(let i=0;i<this.warnings.length;++i)e.warnings.push(this.warnings[i])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:ii(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let o of e)yield*this.next(o);yield*this.end(t,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,n,o)=>{let i=Bt(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",n,o)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=oi(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new he(Bt(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new he(Bt(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let t=De(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
112
+ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new he(Bt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),o=new Fe(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),o.range=[0,t,t],this.decorate(o,!1),yield o}}};var vn={};jn(vn,{BOM:()=>jt,DOCUMENT:()=>qt,FLOW_END:()=>Kt,SCALAR:()=>bt,createScalarToken:()=>ai,isCollection:()=>Jr,isScalar:()=>Ur,prettyToken:()=>Wr,resolveAsScalar:()=>ri,setScalarValue:()=>li,stringify:()=>ui,tokenType:()=>xn,visit:()=>Ge});function ri(s,e=!0,t){if(s){let n=(o,i,r)=>{let a=typeof o=="number"?o:Array.isArray(o)?o[0]:o.offset;if(t)t(a,i,r);else throw new he([a,a+1],i,r)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Ms(s,e,n);case"block-scalar":return Es({options:{strict:e}},s,n)}}return null}function ai(s,e){let{implicitKey:t=!1,indent:n,inFlow:o=!1,offset:i=-1,type:r="PLAIN"}=e,a=qe({type:r,value:s},{implicitKey:t,indent:n>0?" ".repeat(n):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:n,source:`
113
+ `}];switch(a[0]){case"|":case">":{let u=a.indexOf(`
114
+ `),g=a.substring(0,u),h=a.substring(u+1)+`
115
+ `,y=[{type:"block-scalar-header",offset:i,indent:n,source:g}];return ci(y,l)||y.push({type:"newline",offset:-1,indent:n,source:`
116
+ `}),{type:"block-scalar",offset:i,indent:n,props:y,source:h}}case'"':return{type:"double-quoted-scalar",offset:i,indent:n,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:i,indent:n,source:a,end:l};default:return{type:"scalar",offset:i,indent:n,source:a,end:l}}}function li(s,e,t={}){let{afterKey:n=!1,implicitKey:o=!1,inFlow:i=!1,type:r}=t,a="indent"in s?s.indent:null;if(n&&typeof a=="number"&&(a+=2),!r)switch(s.type){case"single-quoted-scalar":r="QUOTE_SINGLE";break;case"double-quoted-scalar":r="QUOTE_DOUBLE";break;case"block-scalar":{let u=s.props[0];if(u.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r=u.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:r="PLAIN"}let l=qe({type:r,value:e},{implicitKey:o||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":qr(s,l);break;case'"':$n(s,l,"double-quoted-scalar");break;case"'":$n(s,l,"single-quoted-scalar");break;default:$n(s,l,"scalar")}}function qr(s,e){let t=e.indexOf(`
117
+ `),n=e.substring(0,t),o=e.substring(t+1)+`
118
+ `;if(s.type==="block-scalar"){let i=s.props[0];if(i.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i.source=n,s.source=o}else{let{offset:i}=s,r="indent"in s?s.indent:-1,a=[{type:"block-scalar-header",offset:i,indent:r,source:n}];ci(a,"end"in s?s.end:void 0)||a.push({type:"newline",offset:-1,indent:r,source:`
119
+ `});for(let l of Object.keys(s))l!=="type"&&l!=="offset"&&delete s[l];Object.assign(s,{type:"block-scalar",indent:r,props:a,source:o})}}function ci(s,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":s.push(t);break;case"newline":return s.push(t),!0}return!1}function $n(s,e,t){switch(s.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":s.type=t,s.source=e;break;case"block-scalar":{let n=s.props.slice(1),o=e.length;s.props[0].type==="block-scalar-header"&&(o-=s.props[0].source.length);for(let i of n)i.offset+=o;delete s.props,Object.assign(s,{type:t,source:e,end:n});break}case"block-map":case"block-seq":{let o={type:"newline",offset:s.offset+e.length,indent:s.indent,source:`
120
+ `};delete s.items,Object.assign(s,{type:t,source:e,end:[o]});break}default:{let n="indent"in s?s.indent:-1,o="end"in s&&Array.isArray(s.end)?s.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(let i of Object.keys(s))i!=="type"&&i!=="offset"&&delete s[i];Object.assign(s,{type:t,indent:n,source:e,end:o})}}}var ui=s=>"type"in s?Cs(s):Ps(s);function Cs(s){switch(s.type){case"block-scalar":{let e="";for(let t of s.props)e+=Cs(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(let t of s.items)e+=Ps(t);return e}case"flow-collection":{let e=s.start.source;for(let t of s.items)e+=Ps(t);for(let t of s.end)e+=t.source;return e}case"document":{let e=Ps(s);if(s.end)for(let t of s.end)e+=t.source;return e}default:{let e=s.source;if("end"in s&&s.end)for(let t of s.end)e+=t.source;return e}}}function Ps({start:s,key:e,sep:t,value:n}){let o="";for(let i of s)o+=i.source;if(e&&(o+=Cs(e)),t)for(let i of t)o+=i.source;return n&&(o+=Cs(n)),o}var kn=Symbol("break visit"),Kr=Symbol("skip children"),fi=Symbol("remove item");function Ge(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),di(Object.freeze([]),s,e)}Ge.BREAK=kn;Ge.SKIP=Kr;Ge.REMOVE=fi;Ge.itemAtPath=(s,e)=>{let t=s;for(let[n,o]of e){let i=t?.[n];if(i&&"items"in i)t=i.items[o];else return}return t};Ge.parentCollection=(s,e)=>{let t=Ge.itemAtPath(s,e.slice(0,-1)),n=e[e.length-1][0],o=t?.[n];if(o&&"items"in o)return o;throw new Error("Parent collection not found")};function di(s,e,t){let n=t(e,s);if(typeof n=="symbol")return n;for(let o of["key","value"]){let i=e[o];if(i&&"items"in i){for(let r=0;r<i.items.length;++r){let a=di(Object.freeze(s.concat([[o,r]])),i.items[r],t);if(typeof a=="number")r=a-1;else{if(a===kn)return kn;a===fi&&(i.items.splice(r,1),r-=1)}}typeof n=="function"&&o==="key"&&(n=n(e,s))}}return typeof n=="function"?n(e,s):n}var jt="\uFEFF",qt="",Kt="",bt="",Jr=s=>!!s&&"items"in s,Ur=s=>!!s&&(s.type==="scalar"||s.type==="single-quoted-scalar"||s.type==="double-quoted-scalar"||s.type==="block-scalar");function Wr(s){switch(s){case jt:return"<BOM>";case qt:return"<DOC>";case Kt:return"<FLOW_END>";case bt:return"<SCALAR>";default:return JSON.stringify(s)}}function xn(s){switch(s){case jt:return"byte-order-mark";case qt:return"doc-mode";case Kt:return"flow-error-end";case bt:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
121
+ `:case`\r
122
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(s[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function Oe(s){switch(s){case void 0:case" ":case`
123
+ `:case"\r":case" ":return!0;default:return!1}}var pi=new Set("0123456789ABCDEFabcdef"),Vr=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Fs=new Set(",[]{}"),Yr=new Set(` ,[]{}
124
+ \r `),Nn=s=>!s||Yr.has(s),wt=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
125
+ `?!0:t==="\r"?this.buffer[e+1]===`
126
+ `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\r"){let o=this.buffer[n+e+1];if(o===`
127
+ `||!o&&!this.atEnd)return e+n+1}return t===`
128
+ `||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Oe(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
129
+ `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===jt&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,n=e.indexOf("#");for(;n!==-1;){let i=e[n-1];if(i===" "||i===" "){t=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let i=e[t-1];if(i===" "||i===" ")t-=1;else break}let o=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-o),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield qt,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if((t==="---"||t==="...")&&Oe(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Oe(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Oe(t)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Nn),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let o=this.getLine();if(o===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&o[0]!=="#"||n===0&&(o.startsWith("---")||o.startsWith("..."))&&Oe(o[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(o[0]==="]"||o[0]==="}")))return this.flowLevel=0,yield Kt,yield*this.parseLineStart();let i=0;for(;o[i]===",";)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),o[i]){case void 0:return"flow";case"#":return yield*this.pushCount(o.length-i),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Nn),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let r=this.charAt(1);if(this.flowKey||Oe(r)||r===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let i=0;for(;this.buffer[t-1-i]==="\\";)i+=1;if(i%2===0)break;t=this.buffer.indexOf('"',t+1)}let n=this.buffer.substring(0,t),o=n.indexOf(`
130
+ `,this.pos);if(o!==-1){for(;o!==-1;){let i=this.continueScalar(o+1);if(i===-1)break;o=n.indexOf(`
131
+ `,i)}o!==-1&&(t=o-(n[o-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>Oe(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let i=this.pos;n=this.buffer[i];++i)switch(n){case" ":t+=1;break;case`
132
+ `:e=i,t=0;break;case"\r":{let r=this.buffer[i+1];if(!r&&!this.atEnd)return this.setNext("block-scalar");if(r===`
133
+ `)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let i=this.continueScalar(e+1);if(i===-1)break;e=this.buffer.indexOf(`
134
+ `,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let o=e+1;for(n=this.buffer[o];n===" ";)n=this.buffer[++o];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
135
+ `;)n=this.buffer[++o];e=o-1}else if(!this.blockScalarKeep)do{let i=e-1,r=this.buffer[i];r==="\r"&&(r=this.buffer[--i]);let a=i;for(;r===" ";)r=this.buffer[--i];if(r===`
136
+ `&&i>=this.pos&&i+1+t>a)e=i;else break}while(!0);return yield bt,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,o;for(;o=this.buffer[++n];)if(o===":"){let i=this.buffer[n+1];if(Oe(i)||e&&Fs.has(i))break;t=n}else if(Oe(o)){let i=this.buffer[n+1];if(o==="\r"&&(i===`
137
+ `?(n+=1,o=`
138
+ `,i=this.buffer[n+1]):t=n),i==="#"||e&&Fs.has(i))break;if(o===`
139
+ `){let r=this.continueScalar(n+1);if(r===-1)break;n=Math.max(n,r-2)}}else{if(e&&Fs.has(o))break;t=n}return!o&&!this.atEnd?this.setNext("plain-scalar"):(yield bt,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Nn),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let t=this.flowLevel>0,n=this.charAt(1);if(Oe(n)||t&&Fs.has(n)){t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!Oe(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Vr.has(t))t=this.buffer[++e];else if(t==="%"&&pi.has(this.buffer[e+1])&&pi.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
140
+ `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
141
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");let o=t-this.pos;return o>0&&(yield this.buffer.substr(this.pos,o),this.pos=t),o}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};var St=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let i=t+n>>1;this.lineStarts[i]<e?t=i+1:n=i}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let o=this.lineStarts[t-1];return{line:t,col:e-o+1}}}};function ze(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function mi(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function gi(s){switch(s?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Ls(s){switch(s.type){case"document":return s.start;case"block-map":{let e=s.items[s.items.length-1];return e.sep??e.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function $t(s){if(s.length===0)return[];let e=s.length;e:for(;--e>=0;)switch(s[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;s[++e]?.type==="space";);return s.splice(e,s.length)}function Ds(s,e){if(e.length<1e5)Array.prototype.push.apply(s,e);else for(let t=0;t<e.length;++t)s.push(e[t])}function hi(s){if(s.start.type==="flow-seq-start")for(let e of s.items)e.sep&&!e.value&&!ze(e.start,"explicit-key-ind")&&!ze(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,gi(e.value)?e.value.end?Ds(e.value.end,e.sep):e.value.end=e.sep:Ds(e.start,e.sep),delete e.sep)}var tt=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new wt,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=xn(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&hi(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{let o=n.items[n.items.length-1];if(o.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(o.sep)o.value=t;else{Object.assign(o,{key:t,sep:[]}),this.onKeyLine=!o.explicitKey;return}break}case"block-seq":{let o=n.items[n.items.length-1];o.value?n.items.push({start:[],value:t}):o.value=t;break}case"flow-collection":{let o=n.items[n.items.length-1];!o||o.value?n.items.push({start:[],key:t,sep:[]}):o.sep?o.value=t:Object.assign(o,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let o=t.items[t.items.length-1];o&&!o.sep&&!o.value&&o.start.length>0&&mi(o.start)===-1&&(t.indent===0||o.start.every(i=>i.type!=="comment"||i.indent<t.indent))&&(n.type==="document"?n.end=o.start:n.items.push({start:o.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{mi(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=Ls(this.peek(2)),n=$t(t),o;e.end?(o=e.end,o.push(this.sourceToken),delete e.end):o=[this.sourceToken];let i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
142
+ `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
143
+ `,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let o=e.items[e.items.length-2]?.value?.end;if(Array.isArray(o)){Ds(o,t.start),o.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,o=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",i=[];if(o&&t.sep&&!t.value){let r=[];for(let a=0;a<t.sep.length;++a){let l=t.sep[a];switch(l.type){case"newline":r.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(r.length=0);break;default:r.length=0}}r.length>=2&&(i=t.sep.splice(r[1]))}switch(this.type){case"anchor":case"tag":o||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):o||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ze(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(gi(t.key)&&!ze(t.sep,"newline")){let r=$t(t.start),a=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:a,sep:l}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else if(ze(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let r=$t(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||o?e.items.push({start:i,key:null,sep:[this.sourceToken]}):ze(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);o||t.value?(e.items.push({start:i,key:r,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(r):(Object.assign(t,{key:r,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type==="block-seq"){if(!t.explicitKey&&t.sep&&!ze(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let o=e.items[e.items.length-2]?.value?.end;if(Array.isArray(o)){Ds(o,t.start),o.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||ze(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:o,sep:[]}):t.sep?this.stack.push(o):Object.assign(t,{key:o,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let o=Ls(n),i=$t(o);hi(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
144
+ `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
145
+ `,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=Ls(e),n=$t(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Ls(e),n=$t(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function yi(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new St||null,prettyErrors:e}}function bi(s,e={}){let{lineCounter:t,prettyErrors:n}=yi(e),o=new tt(t?.addNewLine),i=new et(e),r=Array.from(i.compose(o.parse(s)));if(n&&t)for(let a of r)a.errors.forEach(Dt(s,t)),a.warnings.forEach(Dt(s,t));return r.length>0?r:Object.assign([],{empty:!0},i.streamInfo())}function In(s,e={}){let{lineCounter:t,prettyErrors:n}=yi(e),o=new tt(t?.addNewLine),i=new et(e),r=null;for(let a of i.compose(o.parse(s),!0,s.length))if(!r)r=a;else if(r.options.logLevel!=="silent"){r.errors.push(new he(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(r.errors.forEach(Dt(s,t)),r.warnings.forEach(Dt(s,t))),r}function wi(s,e,t){let n;typeof e=="function"?n=e:t===void 0&&e&&typeof e=="object"&&(t=e);let o=In(s,t);if(!o)return null;if(o.warnings.forEach(i=>fs(o.options.logLevel,i)),o.errors.length>0){if(o.options.logLevel!=="silent")throw o.errors[0];o.errors=[]}return o.toJS(Object.assign({reviver:n},t))}function Si(s,e,t){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let o=Math.round(t);t=o<1?void 0:o>8?{indent:8}:{indent:o}}if(s===void 0){let{keepUndefined:o}=t??e??{};if(!o)return}return be(s)&&!n?s.toString(t):new Fe(s,n,t).toString(t)}var st=Tn;import*as Rs from"fs";function Hr(s){let e={},t=s,n=r=>Array.isArray(r)?r:[],o=s.match(/^---\n([\s\S]*?)\n---\n?/);if(o){try{e=st.parse(o[1])??{}}catch(a){console.warn(` warn: could not parse frontmatter: ${a.message}`)}t=s.slice(o[0].length);let r=st.parse(t);return{frontmatter:e,steps:n(r)}}if(/\n---\s*\n/.test(s))try{let r=st.parseAllDocuments(s);if(r.length>=2){let a=r[0].toJS(),l=r[r.length-1].toJS();return{frontmatter:a&&typeof a=="object"?a:{},steps:n(l)}}}catch(r){console.warn(` warn: could not parse multi-doc flow: ${r.message}`)}let i=st.parse(t);return{frontmatter:e,steps:n(i)}}var $i=new Set(["tapOn","inputText","pressKey","dispatchKey","hideKeyboard","swipe","pinch","scroll","scrollUntilVisible"]);function On(s){let e=[];if(!Array.isArray(s)||s.length===0)return e.push("flow body must be a non-empty YAML array of steps"),e;let t=0;for(let n of s)n&&typeof n=="object"?Object.keys(n).some(i=>$i.has(i))&&(t+=1):typeof n=="string"&&$i.has(n)&&(t+=1);return t===0&&e.push("no interaction steps found (expected at least one tapOn / inputText / pressKey / swipe / scroll)"),e}function wp(s){if(!Rs.existsSync(s))return[`file not found: ${s}`];let e;try{e=Rs.readFileSync(s,"utf8")}catch(t){return[`cannot read file: ${t.message}`]}if(e.trim().length===0)return["file is empty"];try{let t=Hr(e);return On(t.steps)}catch(t){return[`yaml parse error: ${t.message}`]}}var En=1;function Bs(){return Ni(process.env.SOOTSIM_FLOW_SESSION_PATH||Xr(Qr(),"sootsim-flow-session.json"))}function Mn(s){let e=Bs();ki(vi(e),{recursive:!0}),xi(e,JSON.stringify(s,null,2)+`
146
+ `)}function _n(){let s=Bs();if(!Gr(s))return null;try{let e=JSON.parse(zr(s,"utf8"));return e.version!==En||!Array.isArray(e.steps)||typeof e.startedAt!="string"||typeof e.updatedAt!="string"?(An(s,{force:!0}),null):{version:En,startedAt:e.startedAt,updatedAt:e.updatedAt,steps:e.steps,candidate:e.candidate??null}}catch{return An(s,{force:!0}),null}}function Ip(){let s=new Date().toISOString(),e={version:En,startedAt:s,updatedAt:s,steps:[],candidate:null};return Mn(e),{path:Bs(),state:e}}function Zr(){An(Bs(),{force:!0})}function Tp(){Zr()}function js(s){let e=_n();if(!e)return{active:!1};let t=e.candidate,n={...e,updatedAt:new Date().toISOString(),candidate:{step:s.step,summary:s.summary,source:s.source,recordedAt:new Date().toISOString()}};return Mn(n),{active:!0,candidate:n.candidate,replaced:t}}function Op(){let s=_n();if(!s)return{active:!1,kept:!1,reason:"no-session"};if(!s.candidate)return{active:!0,kept:!1,reason:"no-candidate"};let e=s.candidate,t={...s,updatedAt:new Date().toISOString(),steps:[...s.steps,e.step],candidate:null};return Mn(t),{active:!0,kept:!0,candidate:e,stepCount:t.steps.length}}function ea(s){return st.stringify(s).trimEnd()+`
147
+ `}function Ap(s){let e=_n();if(!e)return{active:!1};let t=ea(e.steps),n=On(e.steps);if(n.length>0)return{active:!0,valid:!1,issues:n,yaml:t,stepCount:e.steps.length,outputPath:null};let o=null;return s&&(o=Ni(s),ki(vi(o),{recursive:!0}),xi(o,t)),{active:!0,valid:!0,issues:[],yaml:t,stepCount:e.steps.length,outputPath:o}}import{existsSync as ta,mkdirSync as sa,readFileSync as na,rmSync as Ii,writeFileSync as oa}from"fs";import{tmpdir as ia}from"os";import{dirname as ra,join as aa,resolve as la}from"path";var Jt=1,ca="SOOTSIM_INSPECT_NOTICE_PATH",ua=300*1e3,fa=15e3;function Ti(){return la(process.env[ca]||aa(ia(),"sootsim-inspect-notice-state.json"))}function da(s,e){return Object.fromEntries(Object.entries(s).filter(([,t])=>typeof t?.signature=="string"&&Number.isFinite(t?.updatedAt)&&e-t.updatedAt<=ua))}function pa(s){let e=Ti();if(!ta(e))return{version:Jt,entries:{}};try{let t=JSON.parse(na(e,"utf8"));return t.version!==Jt||!t.entries||typeof t.entries!="object"?(Ii(e,{force:!0}),{version:Jt,entries:{}}):{version:Jt,entries:da(t.entries,s)}}catch{return Ii(e,{force:!0}),{version:Jt,entries:{}}}}function ma(s){let e=Ti();sa(ra(e),{recursive:!0}),oa(e,JSON.stringify(s,null,2)+`
148
+ `)}function ha(s,e){let t=e.trim()||"default";return`${s}:${t}`}function Pn(s,e,t,n={}){let o=n.nowMs??Date.now(),i=n.cooldownMs??fa,r=pa(o),a=ha(s,e),l=r.entries[a];return l&&l.signature===t&&o-l.updatedAt<i?!1:(r.entries[a]={signature:t,updatedAt:o},ma(r),!0)}async function Ae({bridge:s,simId:e,maxMs:t,pollMs:n=50,stablePolls:o=3,strict:i=!1}){let r=await s.send({type:"evaluate",simId:e,code:`(async () => {
149
+ const start = Date.now()
150
+ const deadline = start + ${Math.max(0,Math.round(t))}
151
+ const pollMs = ${Math.max(1,Math.round(n))}
152
+ const requiredStablePolls = ${Math.max(1,Math.round(o))}
153
+ const strict = ${i?"true":"false"}
154
+ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
155
+
156
+ // route-aware settle: a tap that pushes/pops a screen is async \u2014 the
157
+ // old screen still renders for a moment, then the new one mounts and
158
+ // its content loads. a pure layout-hash check reports "idle" on the
159
+ // outgoing screen or on the incoming skeleton, so a driver re-taps
160
+ // and stacks duplicate navigations. drain any in-flight screen
161
+ // transition FIRST, bounded by the overall budget. when no
162
+ // transition is happening this returns in ~80ms (startWindowMs), so
163
+ // a plain button tap barely pays for it.
164
+ try {
165
+ const wfst = window.__sootsimTest?.waitForScreenTransitions
166
+ if (typeof wfst === 'function') {
167
+ const remaining = deadline - Date.now()
168
+ if (remaining > 120) {
169
+ await wfst({
170
+ timeoutMs: Math.min(remaining - 80, 4000),
171
+ settleMs: 64,
172
+ startWindowMs: 80,
173
+ })
174
+ }
175
+ }
176
+ } catch {}
177
+
178
+ const readSnapshot = async () => {
179
+ let animating = false
180
+ let pendingFetches = 0
181
+ let requestTotal = 0
182
+ let requestInFlight = 0
183
+ try {
184
+ const stats = await window.__sootsimRenderHost?.queryStats?.()
185
+ if (stats) {
186
+ animating =
187
+ stats.hasActiveAnims === true ||
188
+ stats.hasActiveNativeAnimations === true ||
189
+ stats.hasPendingAnimationFrames === true
190
+ // a freshly-pushed screen showing a skeleton is layout-stable
191
+ // but not actually settled \u2014 its data/images are still in
192
+ // flight. treat bounded image-loader fetches as not-idle so
193
+ // settle waits for real content, capped by the budget.
194
+ const pf = stats.memory && stats.memory.imageLoader
195
+ ? stats.memory.imageLoader.pendingFetches
196
+ : 0
197
+ pendingFetches = typeof pf === 'number' ? pf : 0
198
+ }
199
+ } catch {}
200
+ try {
201
+ const counts = await window.__sootsimTest?.getRequestCounts?.()
202
+ requestTotal = typeof counts?.total === 'number' ? counts.total : 0
203
+ requestInFlight = typeof counts?.inFlight === 'number' ? counts.inFlight : 0
204
+ } catch {}
205
+ const root = window.__sootsimRoot
206
+ const nodes = []
207
+ if (root) {
208
+ const walk = (n) => {
209
+ if (n.layout && n.layout.width > 0) {
210
+ nodes.push(Math.round(n.layout.x) + ',' + Math.round(n.layout.y) + ',' + Math.round(n.layout.width))
211
+ }
212
+ for (const c of n.children || []) walk(c)
213
+ }
214
+ walk(root)
215
+ }
216
+ return { layout: nodes.join(';'), animating, pendingFetches, requestTotal, requestInFlight }
217
+ }
218
+
219
+ // how long generic background network is allowed to keep us waiting AFTER
220
+ // the screen is otherwise visually settled. apps with continuous traffic
221
+ // (polling, realtime sockets, a tap that fires 20-50 fetches) never reach
222
+ // requestInFlight===0 / a stable requestTotal, so requiring full network
223
+ // quiet burns the ENTIRE budget on every command \u2014 the leading idle that
224
+ // failed PR-preview recordings for network-heavy apps (3pc fight-pulse).
225
+ // layout-stability + the image-loader already prove visible content
226
+ // loaded (a data load changes layout; an image load shows in the loader),
227
+ // so the generic request counters are a courtesy, not a gate: honor them
228
+ // only within this grace once the screen is visually still.
229
+ const networkQuietGraceMs = 1200
230
+ let lastLayout = ''
231
+ let lastRequestTotal = -1
232
+ let stable = 0
233
+ let visuallyStillSince = 0
234
+ while (Date.now() < deadline) {
235
+ const snapshot = await readSnapshot()
236
+ const strictOk = !strict || !snapshot.animating
237
+ // visually settled: no animations, no image content loading, layout
238
+ // unchanged since the last poll.
239
+ const visuallyStill =
240
+ strictOk && snapshot.pendingFetches === 0 && snapshot.layout === lastLayout
241
+ // generic network quiet: nothing in flight and no new requests issued.
242
+ const networkQuiet =
243
+ snapshot.requestInFlight === 0 && snapshot.requestTotal === lastRequestTotal
244
+ if (visuallyStill) {
245
+ stable++
246
+ if (visuallyStillSince === 0) visuallyStillSince = Date.now()
247
+ // settle once the screen has held still long enough AND either the
248
+ // network is genuinely quiet OR it has refused to quiet within the
249
+ // grace (continuous background traffic must not block forever).
250
+ if (
251
+ stable >= requiredStablePolls &&
252
+ (networkQuiet || Date.now() - visuallyStillSince >= networkQuietGraceMs)
253
+ ) {
254
+ return { settled: true, elapsed: Date.now() - start }
255
+ }
256
+ } else {
257
+ stable = 0
258
+ visuallyStillSince = 0
259
+ }
260
+ lastLayout = snapshot.layout
261
+ lastRequestTotal = snapshot.requestTotal
262
+ await sleep(pollMs)
263
+ }
264
+ return { settled: false, elapsed: Date.now() - start }
265
+ })()`},{timeoutMs:t+1e3}),{elapsed:a,settled:l}=r??{};return{elapsed:typeof a=="number"?a:t,settled:l===!0}}var ga={initialWaitMs:3e3,deadlineMs:5e3,retryWaitMs:700},ya={initialWaitMs:1200,deadlineMs:2500,retryWaitMs:700};function ba(s,e={}){return{...s?ga:ya,...e}}function kt(s){return!(!s||s.hit===!1||s.ok===!1||s.pointerTapHandled===!1&&!s.keyboardOpened&&!s.isTextInput)}function wa(s,e){return{id:s.target?.id??s.match?.id??s.node?.id??null,testID:s.target?.testID??s.match?.testID??s.node?.testID??null,text:s.target?.text??s.target?.accessibilityLabel??s.match?.text??s.match?.accessibilityLabel??s.node?.text??e??null,type:s.target?.type??s.match?.type??s.node?.type??null}}async function Ut(s,e){let t=ba(!!e.agent,e.timing),n=0,o=null,i=null;try{await Ae({bridge:s,maxMs:t.initialWaitMs,pollMs:32,stablePolls:2})}catch{}let r=Date.now()+t.deadlineMs;for(;Date.now()<=r||n===0;){n++;let a=await e.resolve();if(o=a,a?.error==="bridge-not-ready"||a?.ambiguous||a?.nthOutOfRange)return{payload:a,result:null,attempts:n,failure:"special"};if(a&&typeof a.cx=="number"&&typeof a.cy=="number"){let u=await s.send({type:"tap",x:a.cx,y:a.cy,target:wa(a,e.textFallback)});if(i=u,kt(u))return{payload:a,result:u,attempts:n}}let l=r-Date.now();if(l<=0)break;try{await Ae({bridge:s,maxMs:Math.min(l,t.retryWaitMs),pollMs:32,stablePolls:2})}catch{await new Promise(u=>setTimeout(u,Math.min(120,l)))}}return{payload:o,result:i,attempts:n,failure:o&&typeof o.cx=="number"?"missed":"not-found"}}async function Oi(s,e,t,n){return s.send({type:"tap",x:e,y:t,...n?{target:n}:{}})}async function Ai(s,e,t={}){let n=JSON.stringify(e);return Ut(s,{agent:t.agent,timing:t.timing,resolve:()=>s.send({type:"evaluate",code:`(async () => {
266
+ const t = window.__sootsimTest
267
+ if (!t) return null
268
+ const n = (await t.findByTestId(${n})) || (await t.findById(${n}))
269
+ if (!n || !n.absolutePosition || !n.layout) return { cx: null }
270
+ const resolved =
271
+ typeof n.nodeId === 'number' && typeof t.resolveTapTarget === 'function'
272
+ ? await t.resolveTapTarget(n.nodeId)
273
+ : null
274
+ const target = (resolved && resolved.target) || n
275
+ const cx =
276
+ resolved && typeof resolved.cx === 'number'
277
+ ? resolved.cx
278
+ : n.absolutePosition.x + (n.layout.width || 0) / 2
279
+ const cy =
280
+ resolved && typeof resolved.cy === 'number'
281
+ ? resolved.cy
282
+ : n.absolutePosition.y + (n.layout.height || 0) / 2
283
+ return {
284
+ cx,
285
+ cy,
286
+ match: {
287
+ nodeId: n.nodeId ?? null,
288
+ id: n.id,
289
+ testID: n.testID,
290
+ text: n.text ?? n.accessibilityLabel ?? null,
291
+ type: n.type,
292
+ },
293
+ target: {
294
+ nodeId: target.nodeId ?? null,
295
+ id: target.id,
296
+ testID: target.testID,
297
+ text:
298
+ target.text ??
299
+ target.accessibilityLabel ??
300
+ n.text ??
301
+ n.accessibilityLabel ??
302
+ null,
303
+ type: target.type,
304
+ },
305
+ strategy: (resolved && resolved.strategy) || 'matched-node',
306
+ }
307
+ })()`})})}async function Ei(s,e,t={},n={}){let o=JSON.stringify({query:e,exact:!!t.exact,role:t.role??null,within:t.within??null,minX:t.minX??null,maxX:t.maxX??null,minY:t.minY??null,maxY:t.maxY??null,near:t.near??null,nth:t.nth??null,first:!!t.first});return Ut(s,{agent:n.agent,timing:n.timing,textFallback:e,resolve:()=>s.send({type:"evaluate",code:`(async () => {
308
+ const t = window.__sootsimTest
309
+ if (!t) return { error: 'bridge-not-ready' }
310
+ const F = ${o}
311
+
312
+ const res = await t.queryTextCandidates({
313
+ query: F.query,
314
+ exact: !!F.exact,
315
+ ...(F.role ? { role: F.role } : {}),
316
+ })
317
+
318
+ let candidates = res.candidates || []
319
+
320
+ candidates = candidates.filter((c) => {
321
+ const ax = c.info.absolutePosition && c.info.absolutePosition.x
322
+ const ay = c.info.absolutePosition && c.info.absolutePosition.y
323
+ if (F.minX !== null && !(ax >= F.minX)) return false
324
+ if (F.maxX !== null && !(ax <= F.maxX)) return false
325
+ if (F.minY !== null && !(ay >= F.minY)) return false
326
+ if (F.maxY !== null && !(ay <= F.maxY)) return false
327
+ if (F.within && !c.ancestorTestIDs.includes(F.within)) return false
328
+ return true
329
+ })
330
+
331
+ if (F.near) {
332
+ candidates.sort((a, b) => {
333
+ const ax = (a.info.absolutePosition && a.info.absolutePosition.x) || 0
334
+ const ay = (a.info.absolutePosition && a.info.absolutePosition.y) || 0
335
+ const bx = (b.info.absolutePosition && b.info.absolutePosition.x) || 0
336
+ const by = (b.info.absolutePosition && b.info.absolutePosition.y) || 0
337
+ return (
338
+ Math.hypot(ax - F.near.x, ay - F.near.y) -
339
+ Math.hypot(bx - F.near.x, by - F.near.y)
340
+ )
341
+ })
342
+ } else {
343
+ candidates.sort((a, b) => {
344
+ const ay = (a.info.absolutePosition && a.info.absolutePosition.y) || 0
345
+ const by = (b.info.absolutePosition && b.info.absolutePosition.y) || 0
346
+ if (Math.abs(ay - by) > 2) return ay - by
347
+ const ax = (a.info.absolutePosition && a.info.absolutePosition.x) || 0
348
+ const bx = (b.info.absolutePosition && b.info.absolutePosition.x) || 0
349
+ return ax - bx
350
+ })
351
+ }
352
+
353
+ const total = candidates.length
354
+ if (total === 0) return { matched: 0, total: 0 }
355
+
356
+ let idx = 0
357
+ if (F.nth !== null) {
358
+ idx = F.nth < 0 ? total + F.nth : F.nth
359
+ if (idx < 0 || idx >= total) {
360
+ return { matched: 0, total, nthOutOfRange: true, nth: F.nth }
361
+ }
362
+ } else if (total > 1 && !F.first && !F.near) {
363
+ return {
364
+ ambiguous: true,
365
+ total,
366
+ candidates: candidates.slice(0, 10).map((c, i) => ({
367
+ idx: i,
368
+ nodeId: c.info.nodeId,
369
+ type: c.info.type,
370
+ testID: c.info.testID,
371
+ text: (c.info.text || '').slice(0, 60),
372
+ abs: c.info.absolutePosition,
373
+ layout: c.info.layout
374
+ ? {
375
+ width: Math.round(c.info.layout.width || 0),
376
+ height: Math.round(c.info.layout.height || 0),
377
+ }
378
+ : null,
379
+ ancestorTestIDs: (c.ancestorTestIDs || []).slice(0, 5),
380
+ })),
381
+ }
382
+ }
383
+
384
+ const picked = candidates[idx]
385
+ const n = picked.info
386
+ if (!n.absolutePosition || !n.layout) return { matched: 0, total }
387
+
388
+ const resolved =
389
+ typeof n.nodeId === 'number' &&
390
+ typeof t.resolveTapTarget === 'function'
391
+ ? await t.resolveTapTarget(n.nodeId)
392
+ : null
393
+ const target = (resolved && resolved.target) || n
394
+ const cx =
395
+ resolved && typeof resolved.cx === 'number'
396
+ ? resolved.cx
397
+ : n.absolutePosition.x + (n.layout.width || 0) / 2
398
+ const cy =
399
+ resolved && typeof resolved.cy === 'number'
400
+ ? resolved.cy
401
+ : n.absolutePosition.y + (n.layout.height || 0) / 2
402
+ return {
403
+ cx,
404
+ cy,
405
+ match: {
406
+ nodeId: n.nodeId ?? null,
407
+ id: n.id,
408
+ testID: n.testID,
409
+ type: n.type,
410
+ },
411
+ target: {
412
+ nodeId: target.nodeId ?? null,
413
+ id: target.id,
414
+ testID: target.testID,
415
+ text:
416
+ target.text ??
417
+ target.accessibilityLabel ??
418
+ n.text ??
419
+ n.accessibilityLabel ??
420
+ null,
421
+ type: target.type,
422
+ },
423
+ strategy: (resolved && resolved.strategy) || 'matched-node',
424
+ total,
425
+ idx,
426
+ }
427
+ })()`})})}async function Mi(s,e,t={}){let n=JSON.stringify(e);return Ut(s,{agent:t.agent,timing:t.timing,textFallback:e,resolve:async()=>{let o=await s.send({type:"evaluate",code:`(async () => {
428
+ const t = window.__sootsimTest
429
+ if (!t) return { error: 'bridge-not-ready' }
430
+ const byTestId =
431
+ (await t.findByTestId(${n})) || (await t.findById(${n}))
432
+ if (byTestId && byTestId.absolutePosition && byTestId.layout) {
433
+ return {
434
+ strategy: 'testid',
435
+ node: {
436
+ nodeId: byTestId.nodeId ?? null,
437
+ id: byTestId.id,
438
+ testID: byTestId.testID,
439
+ type: byTestId.type,
440
+ text: byTestId.text,
441
+ absolutePosition: byTestId.absolutePosition,
442
+ layout: byTestId.layout,
443
+ },
444
+ }
445
+ }
446
+ const byText = await t.findByText(${n})
447
+ if (byText && byText.absolutePosition && byText.layout) {
448
+ return {
449
+ strategy: 'text',
450
+ node: {
451
+ nodeId: byText.nodeId ?? null,
452
+ id: byText.id,
453
+ testID: byText.testID,
454
+ type: byText.type,
455
+ text: byText.text,
456
+ absolutePosition: byText.absolutePosition,
457
+ layout: byText.layout,
458
+ },
459
+ }
460
+ }
461
+ return { strategy: 'none' }
462
+ })()`});if(!o||!("node"in o))return o;let i=o.node,r=i.absolutePosition.x+i.layout.width/2,a=i.absolutePosition.y+i.layout.height/2;return{...o,cx:r,cy:a,target:{id:i.id,testID:i.testID,text:o.strategy==="text"?e:i.text,type:i.type}}}})}async function _i(s,e={args:[]}){let t=await Wn(s);if(Y(e.args)){H(t);return}console.log(` nodes: ${t.nodes}`)}function Cn(s,e){let t=s.indexOf(e);return t>=0&&t+1<s.length?s[t+1]:null}async function Pi(s){let{bridge:e,args:t,positional:n}=s,o=t.includes("--verbose")||t.includes("-v"),i=Y(t),r=o&&!i,a=t.includes("--watch")||t.includes("-w"),l=1e3,u=t.includes("--compact"),g=t.includes("--no-xy"),h=t.includes("--no-clipped"),y=t.includes("--include-occluded"),w=Cn(t,"--testid-like"),N=Cn(t,"--only"),b=Cn(t,"--subtree"),f=n[1]&&!n[1].startsWith("-")?n[1]:void 0,T=f?/[*?]/.test(f):!1,I=!T&&!N?f:void 0,O=N??(T?f:void 0),C=async()=>{await ot(e,{verbose:r});let k=await Hn(e,{describe:!0,verbose:o,filter:I||"",testIdLike:w||void 0,onlyGlob:O||void 0,subtreeRoot:b||void 0,compact:u,hideXy:g,includeOccluded:y}),E=k?.tree,A=k?.shell,q=k?.keyboard;if(i){H({shell:A,tree:E??"",keyboard:q});return}if(A&&typeof A=="object"){let z=[A.state?`state=${A.state}`:null,A.activeApp?`app=${A.activeApp}`:null,A.showSwitcher?"switcher":null,A.switcherPhase&&A.switcherPhase!=="idle"?`phase=${A.switcherPhase}`:null].filter(Boolean);z.length>0&&console.log(` shell: ${z.join(" ")}`)}if(typeof E=="string"&&E.startsWith("__SUBTREE_NOT_FOUND__:")){let z=E.slice(22);console.log(` subtree root not found: ${z}`),pe("subtree-root-not-found",z);return}if(!E){let z=k?.nodeCount??0;console.log(" no matching nodes found"),!(I||w||O||b)&&z<10&&pe("app-still-loading",z);return}let ee=E,ne=0;if(h&&typeof ee=="string"){let z=ee.split(`
463
+ `),Xe=[];for(let Yt of z){if(Yt.includes("(clipped:")){ne+=1;continue}Xe.push(Yt)}ee=Xe.join(`
464
+ `)}console.log(ee),ne>0&&console.log(` ${ne} clipped row(s) hidden (omit --no-clipped to see)`);let V=I||w||O||b;if((I||w||O)&&!a&&pe("describe-filter-context"),!V&&!a&&E.split(`
465
+ `).length>=80&&pe("describe-use-filters"),q&&q.visible){let z=q.spec,Xe=[z?.keyboardType?`type=${z.keyboardType}`:null,z?.returnKeyType&&z.returnKeyType!=="default"?`return=${z.returnKeyType}`:null,q.mode!=="letters"?`mode=${q.mode}`:null,q.shifted?"shift":null,q.capsLock?"caps":null,z?.autoCapitalize&&z.autoCapitalize!=="sentences"?`autoCap=${z.autoCapitalize}`:null,q.accessoryBarId?`accessory=${q.accessoryBarId}`:null].filter(Boolean);console.log(`
466
+ keyboard: ${Xe.join(" ")||"visible"}`)}};if(a)for(console.log(` watching... (Ctrl+C to stop)
467
+ `);;)console.clear(),await C(),await ke(l);else await C()}var Sa=["SOOTSIM_AGENT","AGENTBUS_SESSION","CLAUDECODE","CLAUDE_CODE_ENTRYPOINT","CLAUDE_CODE_SESSION_ID","CODEX_THREAD_ID","CURSOR_TRACE_ID","AIDER_MODEL"];function xt(){if(process.env.SOOTSIM_AGENT==="0")return!1;for(let s of Sa){let e=process.env[s];if(e&&e.trim()&&e!=="0")return!0}return!1}async function Ci(s){let{bridge:e,args:t,effectiveArgs:n,positional:o,inspectUsage:i}=s,r=k=>{let E=n.indexOf(k);return E>=0&&E+1<n.length?n[E+1]:null},a=k=>n.includes(k),l=r("--testid")||r("--test-id"),u=r("--role"),g=r("--type"),h=r("--text"),y=a("--pressable"),w=a("--visible"),N=a("--interactive-targets")||a("--actions"),b=!l&&!u&&!g&&!h&&!y&&!w&&!N?o[1]:null,f=h??b,T=await Xn(e,{testId:l,role:u,type:g,text:f,pressable:y,visible:w,interactive:N});T||(console.error(i("find","<text> | --text <t> | --testid <id> | --role <r> | --type <t> | --pressable | --visible | --interactive-targets")),process.exit(1));let{mode:I,result:O}=T,C=Y(t),L=t.includes("--verbose")||t.includes("--dump");if(C)I==="interactive-targets"&&Array.isArray(O)?H(Ys(O).map(k=>({...k,tap:Hs(k)}))):H(O??null);else if(Array.isArray(O))if(O.length===0){console.log(` no ${I} nodes found`);let k=await e.send({type:"evaluate",code:"(async () => (await window.__sootsimTest?.getNodeCount?.()) || 0)()"});typeof k=="number"&&k<10&&pe("app-still-loading",k)}else if(I==="interactive-targets"){let k=Ys(O);console.log(` found ${k.length} interactive target${k.length===1?"":"s"} (sorted by score):`);for(let E of k.slice(0,20)){let A=E.absolutePosition?`@(${Math.round(E.absolutePosition.x)},${Math.round(E.absolutePosition.y)})`:"",q=E.layout?`${Math.round(E.layout.width)}x${Math.round(E.layout.height)}`:"?x?",ee=E.text?` "${E.text.slice(0,30)}"`:"",ne=E.testID?` #${E.testID}`:"",V=E.accessibilityLabel?` \u24D8"${String(E.accessibilityLabel).slice(0,24)}"`:"",Qe=E.accessibilityRole?`[${E.accessibilityRole}]`:E.type,z=Hs(E);console.log(` ${Qe}${ee}${V}${ne} ${q} ${A}`),console.log(` \u2192 ${z}`),L&&console.log(Fn(JSON.stringify(E,null,2)," "))}k.length>20&&console.log(` ... and ${k.length-20} more`)}else{console.log(` found ${O.length} node${O.length===1?"":"s"} (${I}):`);for(let k of O.slice(0,20)){let E=k.absolutePosition?`@(${Math.round(k.absolutePosition.x)},${Math.round(k.absolutePosition.y)})`:"",A=k.layout?`${Math.round(k.layout.width)}x${Math.round(k.layout.height)}`:"?x?",q=k.text?` "${k.text.slice(0,30)}"`:"",ee=k.testID?` #${k.testID}`:"",ne=k.pressable?" (tap)":"",V=k.accessibilityRole?`[${k.accessibilityRole}]`:k.type;console.log(` ${V}${q}${ee} ${A} ${E}${ne}`),L&&console.log(Fn(JSON.stringify(k,null,2)," "))}O.length>20&&console.log(` ... and ${O.length-20} more`)}else if(O==null)console.log(` not found: ${f||l||u||g||""||I}`),l&&pe("wait-selector-for-missing-testid",l);else{let k=O;if(k.type&&k.absolutePosition){let E=`@(${Math.round(k.absolutePosition.x)},${Math.round(k.absolutePosition.y)})`,A=k.layout?`${Math.round(k.layout.width)}x${Math.round(k.layout.height)}`:"?x?",q=k.text?` "${k.text.slice(0,40)}"`:"",ee=k.testID?` #${k.testID}`:"",ne=k.pressable?" (tap)":"",V=k.accessibilityRole?`[${k.accessibilityRole}]`:k.type;console.log(` ${V}${q}${ee} ${A} ${E}${ne}`),L&&console.log(Fn(JSON.stringify(k,null,2)," "))}else console.log(JSON.stringify(O,null,2))}}function Fn(s,e){return s.split(`
468
+ `).map(t=>e+t).join(`
469
+ `)}async function Fi(s){let{bridge:e,args:t}=s,n=Y(t);await ot(e,{verbose:!n});let o=t.includes("--styling"),i=await Gn(e,{styling:o});if(n){H({count:i.length,elements:i});return}console.log(` layout (${i.length} element${i.length===1?"":"s"}):
470
+ `),console.log(zn(i,{styling:o}))}async function Li(s,e={}){let t=await lo(s);if("error"in t&&(console.error(t.error),process.exit(1)),e.json){console.log(JSON.stringify(t,null,2));return}let{visible:n,spec:o,mode:i,shifted:r,capsLock:a,accessoryBarId:l}=t,u=[];u.push(`keyboard: ${n?"visible":"hidden"}`),o?(u.push(` type: ${o.keyboardType}`),u.push(` returnKey: ${o.returnKeyType}`),u.push(` autoCap: ${o.autoCapitalize}`),u.push(` autoCorrect: ${o.autoCorrect?"on":"off"}`),u.push(` appearance: ${o.keyboardAppearance}`),o.secureTextEntry&&u.push(" secureTextEntry: true"),o.enablesReturnKeyAutomatically&&u.push(` return: ${o.currentTextIsEmpty?"disabled (empty)":"enabled"}`)):u.push(" spec: <none> (shown via dev-tools with no TextInput)"),u.push(` mode: ${i}${r?" (shifted)":""}${a?" (caps)":""}`),l&&u.push(` accessoryBar: ${l}`),console.log(u.join(`
471
+ `))}async function Di(s){let e=await s.bridge.listSims(),t=s.args.includes("--all"),n=s.args.find((a,l)=>s.args[l-1]==="--bundle"),o=s.args.find((a,l)=>s.args[l-1]==="--app-port"),i=s.args.includes("--primary"),r=e.filter(a=>!(i&&!a.isPrimary||n&&!(a.url??"").includes(n)||o&&!(a.url??"").includes(`/rn/${o}`)||!t&&!n&&!o&&!i&&!(a.url&&(a.url.includes("bundle=")||a.url.includes("/index.bundle")))&&a.id!==s.simId));if(Y(s.args)){H(r.map(a=>({...a,active:a.id===s.simId})));return}$o(r,s.simId),r.length<e.length&&!Y(s.args)&&console.log(` (${e.length-r.length} more hidden \u2014 pass --all to show)`)}function Je(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/1024/1024).toFixed(1)}MB`}function $a(s,e){return e<=0?"?":`${(s/e*100).toFixed(0)}%`}function ka(s){let e={},t=(n,o)=>{o&&(o.nodesRegistered!=null&&(e[`${n}.nodes`]=o.nodesRegistered),o.nodesDetached!=null&&(e[`${n}.detached`]=o.nodesDetached),o.objects&&(e[`${n}.paragraphs`]=o.objects.paragraphs,e[`${n}.yogaNodes`]=o.objects.yogaNodes,e[`${n}.pictures`]=o.objects.pictures,e[`${n}.rasterImages`]=o.objects.rasterImages),o.imageLoader&&(e[`${n}.imageCacheEntries`]=o.imageLoader.cacheEntries,e[`${n}.imagePixelBytes`]=o.imageLoader.cachePixelBytes),o.workerHeap&&(e[`${n}.heapBytes`]=o.workerHeap.usedJSHeapSize))};return t("tenant",s.tenant),t("shell",s.shell),s.hostHeap&&(e["host.heapBytes"]=s.hostHeap.usedJSHeapSize),e}function Ri(s,e){return s.endsWith("Bytes")?Je(e):String(e)}function Bi(s,e){if(!e){console.log(` ${s}: not available`);return}let t=e.objects;if(console.log(` ${s}`),e.nodesRegistered!=null&&console.log(` nodes registered: ${e.nodesRegistered}`),e.nodesDetached!=null){let n=Object.entries(e.detachedTypes??{}).map(([o,i])=>`${o}:${i}`).join(" ");console.log(` nodes detached: ${e.nodesDetached}${n?` (${n})`:""}`)}if(t&&(console.log(` paragraphs: ${t.paragraphs}`),console.log(` yoga nodes: ${t.yogaNodes}`),console.log(` pictures: ${t.pictures}`),console.log(` raster images: ${t.rasterImages}`)),e.activeNativeAnimations!=null&&console.log(` native anims: ${e.activeNativeAnimations}`),e.imageLoader){let n=e.imageLoader;console.log(` image cache: ${n.cacheEntries}/${n.cacheMaxEntries} entries, ${Je(n.cachePixelBytes)}/${Je(n.cachePixelBudget)} (${$a(n.cachePixelBytes,n.cachePixelBudget)})`)}e.workerHeap&&console.log(` js heap: ${Je(e.workerHeap.usedJSHeapSize)} used / ${Je(e.workerHeap.totalJSHeapSize)} total`)}function xa(s){console.log(" memory:"),Bi("tenant worker",s.tenant),Bi("shell worker",s.shell),s.hostHeap?(console.log(" host"),console.log(` js heap: ${Je(s.hostHeap.usedJSHeapSize)} used / ${Je(s.hostHeap.totalJSHeapSize)} total`)):console.log(" host js heap: not available (chrome only)")}function va(s,e,t){let n=s.indexOf(e);if(n===-1)return t;let o=Number(s[n+1]);return Number.isFinite(o)&&o>0?o:t}async function ji(s,e={args:[]}){let t=Y(e.args),n=e.args.indexOf("--watch");if(n===-1){let b=await Qs(s);if(t){H(b);return}xa(b);return}let o=Number(e.args[n+1]),i=Number.isFinite(o)&&o>0?o:60,r=va(e.args,"--interval",5),a=[],l=Date.now(),u=null;for(t||console.log(` sampling every ${r}s for ${i}s \u2014 deltas per tick:`);;){let b=await Qs(s),f=(Date.now()-l)/1e3,T=ka(b);if(a.push({tSec:f,counters:T}),!t){let I=[];for(let[O,C]of Object.entries(T)){let L=u&&O in u?C-u[O]:null;if(L===null||L===0)continue;let k=L>0?"+":"-",E=O.endsWith("Bytes")?`${k}${Je(Math.abs(L))}`:`${k}${Math.abs(L)}`;I.push(`${O} ${Ri(O,C)} (${E})`)}console.log(` t+${f.toFixed(0)}s ${I.length?I.join(" "):u?"no change":Object.entries(T).map(([O,C])=>`${O} ${Ri(O,C)}`).join(" ")}`)}if(u=T,f>=i)break;await new Promise(I=>setTimeout(I,r*1e3))}let g=a[0],h=a[a.length-1],y=Math.max(h.tSec-g.tSec,.001),w={};for(let b of Object.keys(h.counters))b in g.counters&&(w[b]=(h.counters[b]-g.counters[b])/y);if(t){H({samples:a,perSecond:w,elapsedSec:y});return}console.log(`
472
+ slope over ${y.toFixed(0)}s:`);let N=Object.entries(w).filter(([,b])=>b!==0).sort((b,f)=>Math.abs(f[1])-Math.abs(b[1]));if(N.length===0){console.log(" all counters flat");return}for(let[b,f]of N){let T=b.endsWith("Bytes")?`${Je(Math.abs(f))}/s${f<0?" (shrinking)":""}`:`${f>0?"+":""}${f.toFixed(2)}/s`;console.log(` ${b.padEnd(28)}${T}`)}}var ge="<redacted secure text>";function Wt(s){let e=s?.layout?.spec??s?.spec??null;return!!e?.secureTextEntry&&e.keyboardType!=="visible-password"}function Ln(s,e){return Wt(e)?ge:s}function Dn(s){if(!s||!Wt(s))return s;let e=s.focusedInput;return!e||typeof e!="object"?s:{...s,focusedInput:{...e,secureTextEntry:!0,text:typeof e.text=="string"?ge:e.text}}}function Vt(s){let e=s.indexOf("--testid");if(e>=0&&s[e+1])return{mode:"testid",value:s[e+1]};let t=s.indexOf("--test-id");if(t>=0&&s[t+1])return{mode:"testid",value:s[t+1]};let n=s.indexOf("--text");return n>=0&&s[n+1]?{mode:"text",value:s[n+1]}:null}async function qs(s,e){let t=JSON.stringify(e.value),n=e.mode==="testid"?`(await t.findByTestId(${t})) || (await t.findById(${t}))`:`await t.findByText(${t})`;return await s.send({type:"evaluate",code:`(async () => {
473
+ const t = window.__sootsimTest
474
+ if (!t) return null
475
+ const n = ${n}
476
+ if (!n || !n.absolutePosition || !n.layout) return null
477
+ const resolved =
478
+ typeof n.nodeId === 'number' && typeof t.resolveTapTarget === 'function'
479
+ ? await t.resolveTapTarget(n.nodeId)
480
+ : null
481
+ const cx =
482
+ typeof resolved?.cx === 'number'
483
+ ? resolved.cx
484
+ : n.absolutePosition.x + (n.layout.width || 0) / 2
485
+ const cy =
486
+ typeof resolved?.cy === 'number'
487
+ ? resolved.cy
488
+ : n.absolutePosition.y + (n.layout.height || 0) / 2
489
+ return {
490
+ x: cx,
491
+ y: cy,
492
+ id: n.id ?? null,
493
+ testID: n.testID ?? null,
494
+ text: ${JSON.stringify(e.mode==="text")} ? ${t} : (n.text ?? n.accessibilityLabel ?? null),
495
+ type: n.type ?? null,
496
+ }
497
+ })()`})??null}async function qi(s,e={}){let{nav:t,keyboard:n,shell:o}=await co(s);if(e.json){console.log(JSON.stringify({shell:o??null,nav:t,keyboard:n},null,2));return}let i=[];if(o){let r=o.activeApp??o.state??"<none>",a=o.showSwitcher?" (app switcher open)":"",l=typeof o.launchProgress=="number"&&o.launchProgress<.98?` launching (${Math.round(o.launchProgress*100)}%)`:"";i.push(`shell: ${r}${a}${l}`)}else i.push("shell: <unavailable>");if(t){let r=t.transitionPhase!=="idle"?` (${t.transitionPhase}, ${t.activeTransitionCount} active)`:"";if(i.push(`nav: phase=${t.transitionPhase}${r}`),t.screens.length===0)i.push(" <no registered screens \u2014 app may not use react-native-screens>");else for(let a of t.screens){let l=a.isActive?"\u25B6":" ",u=a.routeName?` ${a.routeName}`:"",g=a.headerHeight>0?` header=${a.headerHeight}`:"",h=a.largeTitleState&&a.largeTitleState!=="expanded"?` large-title=${a.largeTitleState}`:"";i.push(` ${l} #${a.id}${u}${g}${h}`)}}else i.push("nav: <runtime not available>");if(n&&n.visible){let r=n.spec?.keyboardType??"default",a=n.spec?.returnKeyType??"default";i.push(`keyboard: visible (${r}, return=${a}, mode=${n.mode??"?"})`)}else i.push("keyboard: hidden");console.log(i.join(`
498
+ `))}async function Ki(s){let{bridge:e,args:t,positional:n}=s,o=n[1]?Number(n[1])*1e3:3e3,i=t.includes("--strict"),{elapsed:r,settled:a}=await Ae({bridge:e,maxMs:o,strict:i});console.log(a?` settled in ${r}ms`:` timed out after ${r}ms (may still be animating)`)}async function Ji(s){let e=s.positional[1]?Number(s.positional[1]):.5;(!Number.isFinite(e)||e<0)&&(console.error(s.inspectUsage("sleep","[seconds]")),process.exit(1)),await ke(e*1e3),console.log(` slept ${e}s`)}async function Ui(s){let{bridge:e,args:t,positional:n}=s,o=n[1]?Number(n[1]):5,{tree:i}=await Vn(e,o);if(Y(t)){H({depth:o,tree:i??null});return}console.log(typeof i=="string"?i:JSON.stringify(i,null,2))}async function Wi(s,e={args:[]}){let t=await Yn(s);if(Y(e.args)){H(t);return}console.log(t.url)}async function Vi(s){let{wsPort:e,commandTimeoutMs:t,simId:n,simIdSource:o,positional:i}=s,r=i[1]?Number(i[1]):30,a=Math.max(1e3,(Number.isFinite(r)?r:30)*1e3),l=Math.max(1,Math.ceil(a/500));console.log(" waiting for sim reconnect...");let u=await go(e,t,n,{attempts:l,simIdSource:o});u||(console.error(" timed out waiting for sim reconnect"),process.exit(1)),u.bridge.close(),js({source:"inspect wait",step:{wait:a},summary:`wait ${Math.round(a/1e3)}s`}),console.log(` ready: ${u.count} nodes`)}var Yi=new Set(["app-launch","toast","keyboard","screen","route","alert","actionsheet","picker","notification","fetch","console","shell","scroll","gesture","text-input","react-commit","animation","reanimated"]);function Ks(s,e){let t=s.indexOf(e);if(t>=0&&t+1<s.length)return s[t+1]}function Na(s,e){if(!e.filter&&!e.equals)return!0;let t=s.data,n=[];if(t&&typeof t=="object")for(let i of["url","displayUrl","message","name","activeName","path","pathname","title","phase","event","type","kind"]){let r=t[i];typeof r=="string"&&r.length>0&&n.push(r)}let o=n.join(" ");return e.equals?n.some(i=>i===e.equals):e.filter?o.toLowerCase().includes(e.filter.toLowerCase()):!0}async function Hi(s){let{bridge:e,args:t,positional:n,inspectUsage:o}=s,i=n[1];i||(console.error(o("wait event","<kind> [--max-ms 5000] [--filter <substring>] [--equals <exact>] [--since now|cursor]")),process.exit(1)),Yi.has(i)||console.error(` warning: '${i}' is not a known timeline kind \u2014 waiting anyway. known: ${[...Yi].sort().join(", ")}`);let r=Ks(t,"--max-ms"),a=r&&Number.isFinite(Number(r))?Math.max(100,Number(r)):5e3,l=Ks(t,"--filter"),u=Ks(t,"--equals"),g=Ks(t,"--since")??"now",h=t.includes("--json"),y=Date.now(),w=y+a,N=200,b=y;for(;Date.now()<w;){let T={kinds:[i],since:g==="cursor"?void 0:b,limit:50},I=await e.send({type:"evaluate",code:`(async () => {
499
+ const t = window.SootSim?.bridges?.timeline
500
+ if (!t) return { ok: false, error: 'timeline bridge missing' }
501
+ return { ok: true, result: await t.recent(${JSON.stringify(T)}) }
502
+ })()`});(!I||!I.ok)&&(console.error(` could not query timeline: ${I&&"error"in I?I.error:"unknown"}`),process.exit(1));let O=I.result.events??[];for(let C of O)if(Na(C,{filter:l,equals:u})){let L=Date.now()-y;console.log(h?JSON.stringify({found:!0,elapsedMs:L,event:C}):` ${i} event after ${L}ms${l?` (filter: ${l})`:""}${u?` (equals: ${u})`:""}`);return}I.result.watermark&&I.result.watermark>b&&(b=I.result.watermark),await new Promise(C=>setTimeout(C,N))}let f=Date.now()-y;h?console.log(JSON.stringify({found:!1,elapsedMs:f,kind:i,filter:l,equals:u})):console.error(` \u26A0 wait event ${i} timed out after ${f}ms${l?` (filter: ${l})`:""}${u?` (equals: ${u})`:""}`),process.exit(1)}async function Gi(s){let{bridge:e,args:t}=s,n=t.includes("--strict"),o=Gt(t,3e3),{elapsed:i,settled:r}=await Ae({bridge:e,maxMs:o,strict:n});r?console.log(` idle in ${i}ms`):(console.error(` \u26A0 wait idle timed out after ${i}ms (may still be animating)`),process.exit(1))}async function zi(s){let{bridge:e,args:t}=s,n=Gt(t,2e4),{ready:o,elapsedMs:i,nodes:r,targets:a,flag:l,loadingText:u,externalReady:g,externalError:h,suppressedEntryError:y,errors:w}=await Zn(e,n,{onProgress(b){console.error(` still waiting after ${b.elapsedMs}ms \u2014 ${Gs(b)} (nodes: ${b.nodes}, targets: ${b.targets}, errors: ${b.errors})`)}});if(o){let b=n-i,f=Math.max(100,Math.min(1e4,b)),T=await Ae({bridge:e,maxMs:f,pollMs:32,stablePolls:2});T.settled||(console.error(` \u26A0 wait ready timed out after ${i+T.elapsed}ms \u2014 app mounted but did not settle (nodes: ${r}, targets: ${a})`),process.exit(1)),console.log(` ready in ${i+T.elapsed}ms: ${r} nodes, ${a} targets`);return}let N=Gs({externalError:h,loadingText:u,externalReady:g,flag:l,targets:a,suppressedEntryError:y});console.error(` \u26A0 wait ready timed out after ${i}ms \u2014 ${N} (nodes: ${r}, targets: ${a}, errors: ${w})`),process.exit(1)}async function Qi(s){let{bridge:e,args:t,positional:n,inspectUsage:o}=s,i=n[1];i||(console.error(o("wait selector","<testid> [--max-ms 5000] [--gone]")),process.exit(1));let r=t.indexOf("--max-ms"),a=r>=0&&t[r+1]?Math.max(100,Number(t[r+1])):5e3,l=t.includes("--gone"),{found:u,node:g,elapsed:h}=await eo(e,i,a,{gone:l});if(l){u?console.log(` #${i} gone after ${h}ms`):(console.error(` \u26A0 wait selector #${i} --gone timed out after ${h??a}ms (still present)`),process.exit(1));return}if(u&&g){let y=g.absolutePosition?`@(${Math.round(g.absolutePosition.x)},${Math.round(g.absolutePosition.y)})`:"",w=g.layout?`${Math.round(g.layout.width)}x${Math.round(g.layout.height)}`:"?x?";console.log(` found #${i} in ${h}ms ${w} ${y}`)}else console.error(` \u26A0 wait selector #${i} timed out after ${h??a}ms`),process.exit(1)}function ar(s){return s==null?"\u2014":s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}K`:`${(s/1024/1024).toFixed(1)}M`}function lr(s){return s==null?" \u2026":s<1e3?`${s}ms`.padStart(5):`${(s/1e3).toFixed(2)}s`.padStart(5)}function Xi(){process.stderr.write(` the sim is not responding. recover it with:
503
+ sootsim close --sim <id> # force-close the wedged sim
504
+ sootsim list # confirm it's gone
505
+ `)}async function Ta(s){try{return await s.send({type:"evaluate",code:"1"},{timeoutMs:3e3}),!0}catch{return!1}}async function Oa(s,e){try{let t=await s.send({type:"evaluate",code:`(async () => {
506
+ const t = window.__sootsimTest
507
+ if (!t || typeof t.queryAll !== 'function') return []
508
+ try {
509
+ // queryAll is async in render-worker mode (the canonical mode now)
510
+ // because the call has to round-trip the worker \u2014 must await it.
511
+ // a sync result is still handled fine since await on a non-Promise
512
+ // is a no-op.
513
+ const nodes = await t.queryAll({})
514
+ if (!Array.isArray(nodes)) return []
515
+ const out = new Set()
516
+ for (const n of nodes) {
517
+ const id = n && (n.testID || n.id)
518
+ if (typeof id === 'string' && id) out.add(id)
519
+ }
520
+ return Array.from(out)
521
+ } catch {
522
+ return []
523
+ }
524
+ })()`});if(!Array.isArray(t)||t.length===0)return;let n=e.toLowerCase(),o=t.map(i=>({id:i,score:Aa(n,i.toLowerCase())})).filter(i=>i.score<n.length+4).sort((i,r)=>i.score-r.score).slice(0,5);if(o.length===0)return;console.error(" similar testIDs:");for(let i of o)console.error(` ${i.id}`)}catch{}}function Aa(s,e){if(e===s)return 0;if(e.includes(s))return 1;if(s.includes(e))return 2;let t=0;for(;t<s.length&&t<e.length&&s[t]===e[t];)t+=1;return Ea(s,e)-t}function Ea(s,e){if(s===e)return 0;if(!s.length)return e.length;if(!e.length)return s.length;let t=new Array(e.length+1),n=new Array(e.length+1);for(let o=0;o<=e.length;o++)t[o]=o;for(let o=1;o<=s.length;o++){n[0]=o;for(let r=1;r<=e.length;r++)n[r]=Math.min(t[r]+1,n[r-1]+1,t[r-1]+(s[o-1]===e[r-1]?0:1));let i=t;t=n,n=i}return t[e.length]}function Ma(s){return s.error?"err":s.status==null?" \u2026 ":String(s.status)}function Zi(s){return s.externalError?`guest app errored: ${s.externalError}`:s.loadingText?`still showing "${s.loadingText}"`:s.externalReady===!1?"guest app is still loading":s.flag!==!0?"guest app has not emitted sootsim:externalAppReady":s.targets<=0?"ready flag emitted but no visible app content is inspectable yet":"node tree is still changing"}function er(s){let e=Re(s.startTs),t=Ma(s).padEnd(3),n=s.method.padEnd(5),o=ar(s.size).padStart(6),i=lr(s.durationMs);console.log(` [${e}] ${t} ${n} ${o} ${i} ${s.displayUrl}`),s.error&&console.log(` error: ${s.error}`)}function _a(s){let e=[["id",s.id],["source",s.source],["kind",s.kind],["method",s.method],["status",s.error?`error: ${s.error}`:`${s.status??"\u2014"} ${s.statusText??""}`.trim()],["url",s.url],["started",Re(s.startTs)],["duration",lr(s.durationMs).trim()],["size",ar(s.size)],["content-type",s.type??"\u2014"]];for(let[t,n]of e)console.log(` ${t.padEnd(13)} ${n}`)}var Pa={error:"\x1B[31m",warn:"\x1B[33m",info:"\x1B[36m",debug:"\x1B[35m",log:"\x1B[37m"},tr="\x1B[0m",Ca="\x1B[2m";function sr(s,e){let t=Re(s.ts),n=s.level.toUpperCase().padEnd(5),o=s.args.join(" ");if(e){let i=Pa[s.level];console.log(` ${Ca}[${t}]${tr} ${i}${n}${tr} ${o}`)}else console.log(` [${t}] ${n} ${o}`);if(s.stack&&s.level==="error"){let i=s.stack.split(`
525
+ `).slice(0,5);for(let r of i)console.log(` ${r.trim()}`)}}var Fa=120;async function nr(s,e){let t=s.find((y,w)=>s[w-1]==="--id"),n=s.find((y,w)=>s[w-1]==="--text");if(t||n){let y=await e.send({type:"evaluate",code:ko({id:t,text:n})});if(!y)throw new Error(t?`no node with id "${t}"`:`no node matching text "${n}"`);let{x:w,y:N,w:b,h:f}=y;return{x:w,y:N,w:b,h:f}}let o=s.find((y,w)=>s[w-1]==="--area");if(o){let y=o.split(",").map(T=>Number(T.trim()));if(y.length!==4||y.some(T=>!Number.isFinite(T)))throw new Error(`--area expects x,y,w,h (got "${o}")`);let[w,N,b,f]=y;return{x:w,y:N,w:b,h:f}}let i=y=>{let w=s.find((b,f)=>s[f-1]===y);if(w==null)return null;let N=Number(w);return Number.isFinite(N)?N:null},r=i("--x"),a=i("--y"),l=i("--w"),u=i("--h");if(r!=null||a!=null||l!=null||u!=null)return{x:r??0,y:a??0,w:l??1,h:u??1};let h=s.filter((y,w)=>w>0&&!y.startsWith("-")&&s[w-1]!=="--output"&&s[w-1]!=="--area"&&s[w-1]!=="--id"&&s[w-1]!=="--text"&&s[w-1]!=="--x"&&s[w-1]!=="--y"&&s[w-1]!=="--w"&&s[w-1]!=="--h").map(Number).filter(y=>Number.isFinite(y));if(h.length>=2){let[y,w,N=1,b=1]=h;return{x:y,y:w,w:N,h:b}}return null}function or(s){let e=s.avgMs>0?(1e3/s.avgMs).toFixed(1):"?";console.log(` shell frame profile:
526
+ `),console.log(` painted frames: ${s.frames}${s.skippedFrames?` (+${s.skippedFrames} skipped idle ticks)`:""}`),console.log(` avg: ${s.avgMs}ms (${e} fps) \xB7 max ${s.maxMs}ms`),console.log(` p50/p95/p99: ${s.p50} / ${s.p95} / ${s.p99} ms`),console.log(` jank: ${s.jankFrames} frames (${s.jankPct}%) >16.67ms`),console.log(` avg per frame: overlay ${s.avgOverlayMs}ms \xB7 aux ${s.avgAuxMs}ms \xB7 layout ${s.avgLayoutMs}ms`);let t=Array.isArray(s.auxSurfaces)?s.auxSurfaces:[];if(t.length>0){console.log(""),console.log(" surfaces (last 100 frames):");for(let i of t)console.log(` ${String(i.surfaceId).padEnd(10)} ${String(i.frames).padStart(4)} paints avg ${i.avgMs}ms (layout ${i.avgLayoutMs}, render ${i.avgRenderMs}, flush ${i.avgFlushMs}) max ${i.maxMs}ms`)}let n=s.renderProfile;n&&typeof n=="object"&&(console.log(""),console.log(" render profile (per frame):"),console.log(` node visits: ${n.nodeVisitsPerFrame}`),console.log(` boundaries: ${n.recordsPerFrame} records (${n.avgBoundaryRecordMs}ms) / ${n.replaysPerFrame} replays`),console.log(` raster tier: ${n.rasterPromotionsPerFrame} promotions / ${n.rasterBlitsPerFrame} blits`),console.log(` blur: ${n.avgBlurMs}ms`),console.log(` draw calls: text ${n.textDrawsPerFrame} \xB7 image ${n.imageDrawsPerFrame} \xB7 path ${n.pathDrawsPerFrame} \xB7 saveLayer ${n.saveLayersPerFrame}`));let o=Array.isArray(s.worstFrames)?s.worstFrames:[];if(o.length>0){console.log(""),console.log(" worst frames (of last 100):");for(let i of o){let r=(i.auxSurfaces??[]).map(a=>`${a.surfaceId} ${a.totalMs}ms (layout ${a.layoutMs}, render ${a.renderMs})`).join(" \xB7 ");console.log(` ${String(i.totalMs).padStart(7)}ms overlay ${i.overlayMs} \xB7 aux ${i.auxMs} \xB7 layout ${i.layoutMs}${r?` [${r}]`:""}`)}}}async function Js(s,e,t){let n=Date.now()+e,o=await nt(s,e);for(;;){if(t(o))return{settled:!0,state:o};if(Date.now()>=n)return{settled:!1,state:o};await ke(16),o=await nt(s)}}async function Bn(s){return s.send({type:"evaluate",code:`(async () => {
527
+ const kb = window.__sootsimKeyboard
528
+ const test = window.__sootsimTest
529
+ if (!kb) return { error: 'keyboard bridge not available' }
530
+ const layout = typeof kb.getLayout === 'function' ? kb.getLayout() : null
531
+ const secureTextEntry =
532
+ !!layout?.spec?.secureTextEntry && layout?.spec?.keyboardType !== 'visible-password'
533
+ const visible = kb.isVisible()
534
+ const mode = kb.getMode()
535
+ let focused = null
536
+ if (test && typeof test.getFocusedNode === 'function') {
537
+ try {
538
+ focused = await test.getFocusedNode()
539
+ } catch {}
540
+ }
541
+ let runtimeSnapshot = null
542
+ if (test && typeof test.getFocusKeyboardSnapshot === 'function') {
543
+ try {
544
+ runtimeSnapshot = await test.getFocusKeyboardSnapshot()
545
+ } catch {}
546
+ }
547
+ return {
548
+ visible,
549
+ mode,
550
+ layout,
551
+ focusedInput: focused ? {
552
+ nodeId: focused.nodeId ?? null,
553
+ testID: focused.testID || null,
554
+ id: focused.id || null,
555
+ placeholder: focused.placeholder || null,
556
+ secureTextEntry,
557
+ text: secureTextEntry ? ${JSON.stringify(ge)} : (focused.text || null),
558
+ } : null,
559
+ phase: runtimeSnapshot?.keyboard?.phase ?? null,
560
+ frame: runtimeSnapshot?.keyboard?.frame ?? null,
561
+ focusedRect: runtimeSnapshot?.focused?.rect ?? null,
562
+ }
563
+ })()`}).then(e=>Dn(e))}function La(s,e,t){if(!s.visible)return!1;let n=s.focusedInput;return!(e&&n&&!(n.testID===e||n.id===e)||t!==null&&Wt(s)!==t)}async function Da(s,e=600,t={}){let n=Date.now()+e;for(;Date.now()<=n;){let o=await Bn(s);if(La(o,t.targetId??null,t.secureTextEntry??null))return o;await ke(30)}return Bn(s)}async function Us(s,e){let t=await Bn(s);if(t.visible&&t.focusedInput)return t;t.visible&&(console.error(` ${e} requires a focused TextInput. the iOS keyboard is visible, but no input owns focus.`),process.exit(1)),console.error(` ${e} requires the iOS keyboard to be visible. focus an input first with sootsim do tap-id/tap-text or sootsim do type-into.`),process.exit(1)}async function ir(s,e,t){return e==="appearance"?s.send({type:"evaluate",code:`(async () => {
564
+ const requested = ${JSON.stringify(t??"toggle")}
565
+ // the engine owns toggle + auto resolution (settingsStore is the single
566
+ // source of truth). never infer the current scheme client-side \u2014 the old
567
+ // documentElement '#333333' sniff is never set in embedded / shell-chrome
568
+ // contexts, so 'toggle' read 'light' forever and stuck on the boot scheme.
569
+ window.postMessage({ type: 'soot-action', action: 'set-appearance', value: requested }, '*')
570
+ // let the engine's message handler apply + publish window.__sootsimColorScheme
571
+ await new Promise((r) => setTimeout(r, 60))
572
+ const applied = window.__sootsimColorScheme?.resolved
573
+ ?? (window.matchMedia?.('(prefers-color-scheme: dark)')?.matches ? 'dark' : 'light')
574
+ const setting = window.__sootsimColorScheme?.setting ?? requested
575
+ return { ok: true, requested, setting, applied }
576
+ })()`}):e==="lock"?s.send({type:"evaluate",code:`(async () => {
577
+ const toggleLock = window.SootSim?.bridges?.mainShell?.toggleLock
578
+ if (typeof toggleLock !== 'function') {
579
+ throw new Error('SootSim mainShell.toggleLock bridge unavailable')
580
+ }
581
+ await toggleLock()
582
+ return { ok: true, action: 'lock' }
583
+ })()`}):s.send({type:"evaluate",code:`(async () => {
584
+ window.dispatchEvent(new CustomEvent('sootsim:shake'))
585
+ return { ok: true, action: 'shake' }
586
+ })()`})}function Ra(s){let e={Enter:"return",NumpadEnter:"return",Backspace:"delete",Delete:"delete",Space:"space",ShiftLeft:"shift",ShiftRight:"shift"};if(e[s])return e[s];let t=s.match(/^Digit([0-9])$/);if(t)return t[1];let n=s.match(/^Key([A-Z])$/);return n?n[1].toLowerCase():null}function Ba(s){if(typeof s!="string")return null;let e=s.replace(/\s+/g," ").trim();return e?e.slice(0,80):null}function cr(...s){for(let e of s){if(typeof e!="string")continue;let t=e.trim();if(t)return t}return null}function ja(s){let e=s.indexOf("--node-id");if(e<0)return null;let t=s[e+1];if(!t)return null;let n=Number(t);return Number.isInteger(n)&&n>0?n:null}async function te(s,e,t){let n=js({source:s,step:e,summary:t});n.active&&(n.replaced?console.error(` draft: replaced unkept action "${n.replaced.summary}" \u2014 \`flow keep\` commits one action at a time`):console.error(" draft: action pending \u2014 `sootsim flow keep` to commit"))}function rr(s,e,t){if(!t||t.hit===!1)return null;let n=cr(t.responderTestID,t.testID);if(n)return{step:{tapOn:{id:n}},summary:`tap #${n}`};let o=Ba(t.text);return o?{step:{tapOn:o},summary:`tap "${o}"`}:{step:{tapAtCoords:{x:s,y:e}},summary:`tap @${Math.round(s)},${Math.round(e)}`}}function Rn(s,e,t){let n=cr(e?.testID,e?.id);return n?{step:{tapOn:{id:n}},summary:`tap #${n}`}:t==="id"?{step:{tapOn:{id:s}},summary:`tap #${s}`}:{step:{tapOn:s},summary:`tap "${s}"`}}async function $h(s,e){let t=s[0]==="get"||s[0]==="do"||s[0]==="debug"||s[0]==="wait"?s[0]:null,n=t?s.slice(1):s,o=fo(n,{port:e.port,commandTimeoutMs:e.timeoutMs,stripBooleanFlags:["--verbose","-v","--help","-h","--clear-state","--json","--all","--watch","-w","--strict","--no-wait","--dump","--failed","--slow","--tail","-f","--interactive-targets","--actions","--internal","--compact","--no-xy","--no-clipped","--include-occluded"],stripValueFlags:["--output","--nth","--index","--testid","--test-id","--text","--node-id","--max-ms","--filter","--limit","--level","--threshold","--equals","--since","--testid-like","--only","--subtree"]}),i=o.positional,r=i[0],a=t==="get"||t==="do"||t==="debug"||t==="wait"?t:"inspect",l=typeof n[0]=="string"&&qn.has(n[0]),u=l?n[0]:null,g=D=>l&&D===n[0]?`sootsim ${D}`:`sootsim ${a} ${D}`,h=(D,c)=>` usage: ${g(D)}${c?` ${c}`:""}`;if(!r||s.includes("--help")||s.includes("-h")){let D={bridgePort:7668,defaultShellUrl:Kn};if(a==="do"||a==="get"||a==="debug"||a==="wait"){let p=Ws(a,D);p&&(console.log(`${p}
587
+ `),process.exit(0))}if(u==="shell"){let p=Vs("shell",D);p&&(console.log(`${p}
588
+ `),process.exit(0))}let c=Vs("inspect",D),d=["do","get","debug","wait"].map(p=>Ws(p,D)).filter(p=>p!=null).join(`
589
+
590
+ `);console.log(`${c??""}
591
+
592
+ ${d}
593
+ `),process.exit(0)}let y=o.wsPort,w=o.simId,N=o.simIdSource,b=o.commandTimeoutMs;if(r==="list"&&n.some(D=>D==="--drivers"||D==="-D")){let{buildDriverListRows:D}=await import("./drivers-2PZC4QA3.js"),c=D();console.log(` available drivers (${c.length}):
594
+ `);let d=Math.max(...c.map(m=>m.id.length),6),p=Math.max(...c.map(m=>m.kind.length),4);for(let m of c){let S=m.available?"\u2713":"\u2717",$=m.id.padEnd(d),x=m.kind.padEnd(p);console.log(` ${S} ${$} ${x} ${m.description}`),m.available&&m.detail?console.log(` ${m.detail}`):!m.available&&m.reason&&console.log(` unavailable: ${m.reason}`)}return}let f=po(o),T=w||"default",I=new Set(["errors","warnings","requests","js","eval","reload","globals","perf","storage-clear","list","wait","sleep"]),O=200;function C(D){let c=D.replace(/\s+/g," ").trim();if(!c)return"";if(/^<(!doctype html|html|\?xml)|<body[\s>]/i.test(c)){let p=/<title[^>]*>([^<]+)<\/title>/i.exec(D)?.[1]?.trim(),m=/<body[^>]*>([\s\S]*?)<\//i.exec(D)?.[1]?.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().slice(0,80),S=p||m||"html error page";return`<html ${D.length}B> "${S}" (body elided \u2014 add --json for the full payload)`}return c.length<=O?c:`${c.slice(0,O)}\u2026 (+${c.length-O} more bytes)`}function L(D){let c=D.displayUrl||D.url;return D.status!=null?`${D.method} ${c} -> ${D.status}${D.statusText?` ${D.statusText}`:""}`:D.error?`${D.method} ${c} -> ${D.error}`:`${D.method} ${c}`}async function k(D){let c=xt()?5e3:1500;try{let{settled:d,elapsed:p}=await Ae({bridge:D,maxMs:c,pollMs:32,stablePolls:2});d||process.stderr.write(` \u26A0 auto-wait timed out after ${p??c}ms \u2014 next command may see mid-animation state. use \`sootsim do settle\` for a longer wait.
595
+ `)}catch{}}function E(D,c){console.error(` tap failed: ${D} stayed visible but did not receive a hittable press after ${c.attempts} attempt${c.attempts===1?"":"s"}`),c.result&&console.error(` last result: ${JSON.stringify(c.result)}`)}async function A(){try{return await f.send({type:"evaluate",code:`(() => ({
596
+ console: ${zt},
597
+ requests: window.__sootsimTest?.getRequestCounts?.() || null,
598
+ }))()`})||{console:null,requests:null}}catch{return{console:null,requests:null}}}async function q(D={}){let c=D.counts!==void 0?D.counts:await fe(f,"getRequestCounts");if(!c||typeof c!="object")return;let d=Math.max(0,Number(c.failed)||0);if(d===0||!D.includeTail&&!Pn("requests",T,String(d))||(console.log(`
599
+ network: ${d} failed request${d===1?"":"s"}`),console.log(` inspect: ${g("requests")} 5`),!D.includeTail))return;let p=await fe(f,"getFailedRequests",5);if(!(!Array.isArray(p)||p.length===0)){console.log(`
600
+ recent failed requests:
601
+ `);for(let m of p){let S=Re(m.timestamp);console.log(` [${S}] ${L(m)}`),m.responseBody?console.log(` ${C(m.responseBody)}`):m.error&&console.log(` ${m.error}`)}}}function ee(D){for(let c of D){let d=c.title?` (\u201C${c.title}\u201D)`:"";console.log(`
602
+ note: ${c.label} is open${d} \u2014 taps/drags hit it, not the app`)}}async function ne(D={}){let c=D.counts!==void 0?D.counts:await f.send({type:"evaluate",code:zt});if(!c||typeof c!="object")return;let d=c,p=Math.max(0,Number(d.errors)||0),m=Math.max(0,Number(d.warnings)||0);if(p===0&&m===0||!D.includeTail&&!Pn("console",T,`${p}:${m}`))return;let S=[];if(p>0&&S.push(`${p} console error${p===1?"":"s"}`),m>0&&S.push(`${m} console warning${m===1?"":"s"}`),console.log(`
603
+ console: ${S.join(", ")}`),console.log(` inspect: ${g("errors")} 5`),m>0&&console.log(` inspect: ${g("warnings")} 5`),!D.includeTail||p===0)return;let $=await vt(f,5);if(!(!Array.isArray($)||$.length===0)){console.log(`
604
+ recent console errors:
605
+ `);for(let x of $){let _=Re(x.timestamp),v=Array.isArray(x.args)?x.args.map(F=>typeof F=="object"?JSON.stringify(F):String(F)).join(" "):String(x);console.log(` [${_}] ${v}`)}}}let V=["console","fetch","toast","alert","notification","screen","app-launch","keyboard","route","actionsheet","picker","shell","scroll","gesture","text-input","animation","reanimated"];async function Qe(D){let c=Jn(),d=null;try{d=await ho(D,`(() => {
606
+ const tl = window.SootSim && window.SootSim.bridges && window.SootSim.bridges.timeline
607
+ if (!tl || typeof tl.summary !== 'function') return null
608
+ const cursorKey = ${JSON.stringify(c)}
609
+ const summary = tl.summary({ sinceCursor: cursorKey })
610
+ let consoleSplit = null
611
+ if (summary && summary.byKind && summary.byKind.console) {
612
+ const events = tl.recent({ sinceCursor: cursorKey, kinds: 'console', limit: 100000 }).events
613
+ consoleSplit = { error: 0, warn: 0 }
614
+ for (const ev of events) {
615
+ const lvl = ev && ev.data && ev.data.level
616
+ if (lvl === 'error') consoleSplit.error++
617
+ else if (lvl === 'warn') consoleSplit.warn++
618
+ }
619
+ }
620
+ return summary ? { summary, consoleSplit } : null
621
+ })()`)}catch{return}if(!d||!d.summary||!d.summary.total)return;let p=d.summary.byKind??{},m=[],S=new Set;for(let $ of V){let x=p[$];if(x)if(S.add($),$==="console"&&d.consoleSplit){let{error:_,warn:v}=d.consoleSplit;_>0&&m.push(`${_} error${_===1?"":"s"}`),v>0&&m.push(`${v} warning${v===1?"":"s"}`)}else m.push(`${x} ${$}${x===1?"":"s"}`)}for(let[$,x]of Object.entries(p))!S.has($)&&x&&m.push(`${x} ${$}${x===1?"":"s"}`);if(m.length!==0&&(console.log(`
622
+ since last: ${m.join(" \xB7 ")} \u2014 sootsim what-happened`),d.summary.lastAt))try{await Qt(D,"SootSim.bridges.timeline.cursorAdvance",c,d.summary.lastAt)}catch{}}let z=new Set(["tap","double-tap","tap-text","tap-id","type","type-into","key","key-sequence","keycode","drag","swipe","long-press","touch","gesture","pinch","scroll","shell","storage-clear"]),Xe=new Set(["a11y","capture","count","double-tap","drag","find","gesture","layout","long-press","node","pinch","sample-color","scroll","screenshot","swipe","tap","tap-id","tap-text","touch","tree","type-into"]),Yt=(s.includes("--verbose")||s.includes("-v"))&&!s.includes("--json");a==="do"&&r==="shell"&&(console.error(" `sootsim do shell` was removed. use `sootsim shell ...` instead."),process.exit(1)),z.has(r)&&await mo(f),Xe.has(r)&&await ot(f,{verbose:Yt});try{let D=z.has(r)&&!Y(n)?await ao(f):[];switch(r){case"list":{uo(o.wsPort),await Di({bridge:f,simId:w,args:n});break}case"tree":{await Ui({bridge:f,args:n,positional:i});break}case"a11y":{let c=await Qn(f);if(!Array.isArray(c)||c.length===0){console.log(" no accessible nodes found");break}if(s.includes("--json"))console.log(JSON.stringify(c,null,2));else{console.log(` accessibility tree (${c.length} nodes):
623
+ `);for(let d of c){let p=[];if(p.push(`[${d.role}]`),d.label){let m=d.label.length>50?d.label.slice(0,47)+"...":d.label;p.push(`"${m}"`)}if(d.hint&&p.push(`(hint: "${d.hint}")`),d.testID&&p.push(`#${d.testID}`),d.state){let m=[];d.state.disabled&&m.push("disabled"),d.state.selected&&m.push("selected"),d.state.checked===!0&&m.push("checked"),d.state.checked==="mixed"&&m.push("mixed"),d.state.busy&&m.push("busy"),d.state.expanded===!0&&m.push("expanded"),d.state.expanded===!1&&m.push("collapsed"),m.length&&p.push(`{${m.join(", ")}}`)}d.position&&p.push(`@(${d.position.x},${d.position.y})`),d.size&&p.push(`${d.size.w}x${d.size.h}`),console.log(" "+p.join(" "))}}break}case"find":{await Ci({bridge:f,args:s,effectiveArgs:n,positional:i,inspectUsage:h});break}case"count":{await _i(f,{args:n});break}case"keyboard":{await Li(f,{json:s.includes("--json")});break}case"screens":{await qi(f,{json:s.includes("--json")});break}case"memory":{await ji(f,{args:n});break}case"wait":{await Vi({wsPort:y,commandTimeoutMs:b,simId:w,simIdSource:N,positional:i});break}case"sleep":{await Ji({positional:i,inspectUsage:h});break}case"settle":{await Ki({bridge:f,args:s,positional:i});break}case"ready":{await zi({bridge:f,args:s});break}case"idle":{await Gi({bridge:f,args:s,positional:i});break}case"selector":{await Qi({bridge:f,args:s,positional:i,inspectUsage:h});break}case"event":{await Hi({bridge:f,args:s,positional:i,inspectUsage:h});break}case"layout":{let c=i[1];if(!c){await Fi({bridge:f,args:n});break}let d=await f.send({type:"evaluate",code:`(async () => await window.__sootsimTest.getLayout(${JSON.stringify(c)}))()`});console.log(JSON.stringify(d,null,2));break}case"capture":case"screenshot":{let d=s.find((_,v)=>s[v-1]==="--output")||"/tmp/sootsim-inspect.png",p=await nr(s,f),m={type:"screenshot"};p&&(m.crop=p);let $=(await f.send(m)).replace(/^data:image\/png;base64,/,"");p&&console.log(` area: x=${p.x} y=${p.y} w=${p.w} h=${p.h}`),(await import("fs")).writeFileSync(d,Buffer.from($,"base64")),console.log(` saved: ${d}`);break}case"sample-color":{let c=await nr(s,f);c||(console.error(h("sample-color","<x> <y> [w] [h] | --id <testID> | --text <text>")),console.error(" samples an averaged color from the canvas. coords are logical sootsim units."),process.exit(1));let d=await f.send({type:"evaluate",code:xo(c)});if(s.includes("--json"))console.log(JSON.stringify(d,null,2));else{let{r:p,g:m,b:S,a:$,hex:x,samples:_}=d,v=c.w===1&&c.h===1?`@(${c.x},${c.y})`:`@(${c.x},${c.y}) ${c.w}x${c.h}`;console.log(` ${x} rgba(${p}, ${m}, ${S}, ${$}) ${v} ${_} samples`)}break}case"node":{let c=i[1];c||(console.error(h("node","<matcher>")),console.error(" resolves testID, id, then text \u2014 dumps full node info as JSON"),process.exit(1));let d=await f.send({type:"evaluate",code:`(async () => {
624
+ const t = window.__sootsimTest
625
+ const q = ${JSON.stringify(c)}
626
+ let node = null
627
+ let via = null
628
+ if (t.findByTestId) { node = await t.findByTestId(q); if (node) via = 'testID' }
629
+ if (!node && t.findById) { node = await t.findById(q); if (node) via = 'id' }
630
+ if (!node && t.findByText) { node = await t.findByText(q); if (node) via = 'text' }
631
+ if (!node) return { matcher: q, found: false }
632
+
633
+ // read the resolved transform (if any) off the style \u2014 useful
634
+ // because canvas nodes often animate via transform and describe
635
+ // output strips that.
636
+ const transform =
637
+ node.style && Array.isArray(node.style.transform)
638
+ ? node.style.transform
639
+ : node.style && node.style.transform
640
+ ? node.style.transform
641
+ : null
642
+
643
+ // parent chain \u2014 walk up from the node so the JSON dump is
644
+ // self-describing.
645
+ const parentChain = []
646
+ const root = window.__sootsimRoot
647
+ if (root && node.id != null) {
648
+ const findPath = (n, targetId, path) => {
649
+ if (!n) return null
650
+ if (n.id === targetId) return path
651
+ if (n.children) {
652
+ for (const child of n.children) {
653
+ const nextPath = [
654
+ ...path,
655
+ {
656
+ type: n.type || 'view',
657
+ testID: n.props?.testID || null,
658
+ text: n.text || null,
659
+ },
660
+ ]
661
+ const found = findPath(child, targetId, nextPath)
662
+ if (found) return found
663
+ }
664
+ }
665
+ return null
666
+ }
667
+ const chain = findPath(root, node.id, [])
668
+ if (chain) parentChain.push(...chain)
669
+ }
670
+
671
+ return {
672
+ matcher: q,
673
+ found: true,
674
+ resolvedVia: via,
675
+ node,
676
+ transform,
677
+ parentChain,
678
+ }
679
+ })()`});console.log(JSON.stringify(d,null,2));break}case"tap":{let c=Number(i[1]),d=Number(i[2]),p=Vt(s);if(p){let $=await Ut(f,{agent:xt(),textFallback:p.mode==="text"?p.value:void 0,resolve:async()=>{let v=await qs(f,p);return v?{cx:v.x,cy:v.y,match:{id:p.mode==="testid"?p.value:v.id??null,testID:p.mode==="testid"?p.value:v.testID??null,text:p.mode==="text"?p.value:v.text??null,type:v.type??null},target:{id:v.id??null,testID:v.testID??null,text:v.text??null,type:v.type??null}}:null}}),x=$.payload;(!x||typeof x.cx!="number")&&(console.error(` not found: ${p.value}`),p.mode==="testid"&&pe("wait-selector-for-missing-testid",p.value),process.exit(1)),kt($.result)||(E(`${p.mode} "${p.value}"`,$),process.exit(1));let _=rr(x.cx,x.cy,$.result);_&&await te("inspect tap",_.step,_.summary),console.log(JSON.stringify({...$.attempts>1?{attempts:$.attempts}:{},...$.result},null,2));break}(!Number.isFinite(c)||!Number.isFinite(d))&&(console.error(h("tap","<x> <y> | --testid <id> | --text <t>")),process.exit(1));let m=await Oi(f,c,d),S=rr(c,d,m);S&&await te("inspect tap",S.step,S.summary),console.log(JSON.stringify(m,null,2));break}case"drag":case"swipe":{let c=Number(i[1]),d=Number(i[2]),p=Number(i[3]),m=Number(i[4]),S=r==="swipe"?10:12,$=r==="swipe"?8:16,x=i[5]?Number(i[5]):S,_=i[6]?Number(i[6]):$;(!Number.isFinite(c)||!Number.isFinite(d)||!Number.isFinite(p)||!Number.isFinite(m)||!Number.isFinite(x)||!Number.isFinite(_))&&(console.error(h(r,"<x1> <y1> <x2> <y2> [steps] [stepMs]")),process.exit(1));let v=await f.send({type:"evaluate",code:`(async () => {
680
+ const interact = window.__sootsimInteract
681
+ if (!interact?.drag) return { ok: false, reason: 'no interact.drag' }
682
+ const value = await interact.drag(${c}, ${d}, ${p}, ${m}, ${Math.max(1,Math.round(x))}, ${Math.max(0,Math.round(_))})
683
+ return { ok: !!value, value }
684
+ })()`});if(v?.ok){let F=Math.max(1,Math.round(Math.max(1,x)*Math.max(0,_)));await te(`inspect ${r}`,{swipe:{start:`${c}, ${d}`,end:`${p}, ${m}`,duration:F}},`${r} ${c},${d} -> ${p},${m}`)}console.log(JSON.stringify(v,null,2));break}case"pinch":{let c=Number(i[1]),d=Number(i[2]),p=Number(i[3]),m=Number(i[4]),S=Number(i[5]),$=Number(i[6]),x=Number(i[7]),_=Number(i[8]),v=i[9]?Number(i[9]):12,F=i[10]?Number(i[10]):16;(!Number.isFinite(c)||!Number.isFinite(d)||!Number.isFinite(p)||!Number.isFinite(m)||!Number.isFinite(S)||!Number.isFinite($)||!Number.isFinite(x)||!Number.isFinite(_)||!Number.isFinite(v)||!Number.isFinite(F))&&(console.error(h("pinch","<x1> <y1> <x2> <y2> <x1'> <y1'> <x2'> <y2'> [steps] [stepMs]")),process.exit(1));let Q=await f.send({type:"evaluate",code:`(async () => {
685
+ const interact = window.__sootsimInteract
686
+ if (!interact?.pinch) return { ok: false, reason: 'no interact.pinch' }
687
+ const value = await interact.pinch(${c}, ${d}, ${p}, ${m}, ${S}, ${$}, ${x}, ${_}, ${Math.max(1,Math.round(v))}, ${Math.max(0,Math.round(F))})
688
+ return { ok: !!value, value }
689
+ })()`});Q?.ok&&await te("inspect pinch",{pinch:{from:[c,d,p,m],to:[S,$,x,_],steps:Math.max(1,Math.round(v)),stepMs:Math.max(0,Math.round(F))}},`pinch (${c},${d}) (${p},${m}) -> (${S},${$}) (${x},${_})`),console.log(JSON.stringify(Q,null,2));break}case"tap-text":{let c=i[1];c||(console.error(h("tap-text","<text>")),process.exit(1));let d=le=>{let G=s.indexOf(le);return G>=0&&G+1<s.length?s[G+1]:null},p=le=>s.includes(le),m=d("--nth")??d("--index"),S=m!==null?Number(m):null;S!==null&&!Number.isFinite(S)&&(console.error(` --nth/--index requires an integer, got: ${m}`),process.exit(1));let $=d("--within"),x=d("--role"),_=p("--exact"),v=p("--first"),F=d("--min-y"),Q=d("--max-y"),ue=d("--min-x"),ie=d("--max-x");for(let[le,G]of[["--min-y",F],["--max-y",Q],["--min-x",ue],["--max-x",ie]])G!==null&&!Number.isFinite(Number(G))&&(console.error(` ${le} requires a number, got: ${G}`),process.exit(1));let re=s.indexOf("--near"),K=null;if(re>=0){let le=Number(s[re+1]),G=Number(s[re+2]);(!Number.isFinite(le)||!Number.isFinite(G))&&(console.error(" --near requires two numbers: --near <x> <y>"),process.exit(1)),K={x:le,y:G}}let M={exact:_,role:x,within:$,minX:ue!==null?Number(ue):null,maxX:ie!==null?Number(ie):null,minY:F!==null?Number(F):null,maxY:Q!==null?Number(Q):null,near:K,nth:S,first:v},R=await Ei(f,c,M,{agent:xt()}),B=R.payload;if(B?.error==="bridge-not-ready"&&(console.error(" sootsim test bridge not ready"),process.exit(1)),B?.ambiguous){let le=B.candidates;console.error(` ambiguous: ${B.total} matches for "${c}"`);for(let G of le){let Ht=G.abs?`@(${Math.round(G.abs.x)},${Math.round(G.abs.y)})`:"",ur=G.layout?` ${G.layout.width}x${G.layout.height}`:"",fr=G.testID?` #${G.testID}`:"",dr=G.text?` "${G.text}"`:"",pr=G.ancestorTestIDs.length>0?` within ${G.ancestorTestIDs.slice(0,3).map(mr=>`#${mr}`).join(" > ")}`:"";console.error(` [${G.idx}] <${G.type}>${dr}${fr} ${Ht}${ur}${pr}`)}B.total>le.length&&console.error(` ... and ${B.total-le.length} more`),console.error(" pick one:"),console.error(" --nth <index> pick the nth match (top-to-bottom, left-to-right; negatives from end)"),console.error(" --within <testID> narrow to descendants of a node"),console.error(" --min-y / --max-y geometric filter (pixels, absolute)"),console.error(" --min-x / --max-x geometric filter (pixels, absolute)"),console.error(" --near <x> <y> pick the closest match to a point"),console.error(" --exact exact text match (default is substring)"),console.error(" --role <role> narrow to accessibilityRole"),console.error(" --first keep the old pick-first-silently behavior"),process.exit(2)}B?.nthOutOfRange&&(console.error(` not found: nth ${B.nth} of ${B.total} match${B.total===1?"":"es"} for "${c}"`),process.exit(1)),(!B||typeof B.cx!="number")&&(console.error(` not found: ${c}`),process.exit(1)),kt(R.result)||(E(`text "${c}"`,R),process.exit(1));let Ee=Rn(c,{id:B.target?.id??null,testID:B.target?.testID??null,type:B.target?.type??null,cx:B.cx,cy:B.cy},"text");await te("inspect tap-text",Ee.step,Ee.summary),console.log(JSON.stringify({matched:B.match,tapped:{nodeId:B.target?.nodeId??null,id:B.target?.id??null,testID:B.target?.testID??null,type:B.target?.type??null,cx:B.cx,cy:B.cy},...B.strategy&&B.strategy!=="matched-node"?{strategy:B.strategy}:{},...B.total>1||S!==null?{nth:{index:B.idx,total:B.total}}:{},...R.attempts>1?{attempts:R.attempts}:{},result:R.result},null,2));break}case"tap-best":{let c=i[1];c||(console.error(h("tap-best","<query>")),process.exit(1));let d=await Mi(f,c,{agent:xt()}),p=d.payload;p||(console.error(` tap-best: no testID or visible text matched "${c}". try \`sootsim find --interactive-targets\` to list candidates.`),process.exit(1)),"error"in p&&(console.error(` ${p.error}`),process.exit(1)),p.strategy==="none"&&(console.error(` tap-best: no testID or visible text matched "${c}". try \`sootsim find --interactive-targets\` to list candidates.`),process.exit(1));let m=p.node;kt(d.result)||(E(`best "${c}"`,d),process.exit(1));let S=Rn(c,{id:m.id,testID:m.testID,type:m.type,cx:p.cx,cy:p.cy},p.strategy==="testid"?"id":"text");await te("inspect tap-best",S.step,S.summary),console.log(JSON.stringify({matched:{strategy:p.strategy,nodeId:m.nodeId,id:m.id,testID:m.testID,type:m.type,text:m.text},tapped:{cx:p.cx,cy:p.cy},...d.attempts>1?{attempts:d.attempts}:{},result:d.result},null,2));break}case"tap-id":{let c=i[1];c||(console.error(h("tap-id","<id>")),process.exit(1));let d=await Ai(f,c,{agent:xt()}),p=d.payload;(!p||typeof p.cx!="number")&&(console.error(` not found: ${c}`),await Oa(f,c),process.exit(1)),kt(d.result)||(E(`id "${c}"`,d),process.exit(1));let m=Rn(c,{id:p.target?.id??null,testID:p.target?.testID??null,type:p.target?.type??null,cx:p.cx,cy:p.cy},"id");await te("inspect tap-id",m.step,m.summary),console.log(JSON.stringify({matched:p.match,tapped:{nodeId:p.target?.nodeId??null,id:p.target?.id??null,testID:p.target?.testID??null,type:p.target?.type??null,cx:p.cx,cy:p.cy},...p.strategy&&p.strategy!=="matched-node"?{strategy:p.strategy}:{},...d.attempts>1?{attempts:d.attempts}:{},result:d.result},null,2));break}case"type-into":{let c=i[1],d=i.slice(2).join(" ");(!c||!d)&&(console.error(h("type-into","<id> <text>")),process.exit(1));let p=JSON.stringify(c),m=await f.send({type:"evaluate",code:`(async () => {
690
+ const t = window.__sootsimTest
691
+ if (!t) return null
692
+ const n = await (t.findByTestId(${p}) || t.findById(${p}))
693
+ if (!n || !n.absolutePosition || !n.layout) return null
694
+ return {
695
+ cx: n.absolutePosition.x + (n.layout.width || 0) / 2,
696
+ cy: n.absolutePosition.y + (n.layout.height || 0) / 2,
697
+ id: n.id,
698
+ testID: n.testID,
699
+ type: n.type,
700
+ isTextInput: !!n.isTextInput,
701
+ secureTextEntry: !!n.secureTextEntry,
702
+ placeholder: n.placeholder || null,
703
+ }
704
+ })()`});(!m||typeof m.cx!="number")&&(console.error(` not found: ${c}`),process.exit(1)),m.isTextInput||console.error(` warning: ${c} is not a text input (isTextInput: false)`);let S=await f.send({type:"tap",x:m.cx,y:m.cy,target:{id:m.id??c,testID:m.testID??c,text:null,type:m.type??null}}),$=m.secureTextEntry===!0,x=await Da(f,1e3,{targetId:c,secureTextEntry:$});x.visible||(console.error(` keyboard did not open after tapping ${c}`),process.exit(1));let _=x.focusedInput;_&&(_.testID===c||_.id===c||(console.error(` focus routing mismatch after tap: requested ${JSON.stringify(c)} but focus is on ${JSON.stringify(_.testID??_.id??null)}. did the tap land on an outer Pressable wrapper?`),process.exit(1))),await f.send({type:"keyboard",action:"type",text:d});let v=$||Wt(x),F=v?ge:Ln(d,x),Q=v&&x.focusedInput?{...x.focusedInput,secureTextEntry:!0,text:typeof x.focusedInput.text=="string"?ge:x.focusedInput.text}:x.focusedInput??null;await te("inspect type-into",{tapOn:{id:c},inputText:F},F===ge?`type-into #${c} ${ge}`:`type-into #${c} ${JSON.stringify(d)}`),console.log(JSON.stringify({target:c,isTextInput:m.isTextInput,secureTextEntry:v,keyboardOpened:x.visible??S?.keyboardOpened??!1,focusedInput:Q,typed:F},null,2));break}case"type":{let c=i.slice(1).join(" ");c||(console.error(h("type","<text>")),process.exit(1));let d=await Us(f,"type");await f.send({type:"keyboard",action:"type",text:c});let p=Ln(c,d);await te("inspect type",{inputText:p},p===ge?`type ${ge}`:`type ${JSON.stringify(c)}`),console.log(p===ge?` typed: ${ge}`:` typed: ${JSON.stringify(c)}`);break}case"key":{let c=i[1];c||(console.error(h("key","<name>")),process.exit(1)),await Us(f,"key"),await f.send({type:"keyboard",action:"press",text:c}),await te("inspect key",{pressKey:c},`key ${c}`),console.log(` pressed: ${c}`);break}case"key-sequence":{let c=i.slice(1);c.length===0&&(console.error(h("key-sequence","<key> [<key> ...]")),process.exit(1)),await Us(f,"key-sequence");for(let d of c)await f.send({type:"keyboard",action:"press",text:d});await te("inspect key-sequence",{pressKey:c.join(" ")},`key-sequence ${c.join(" ")}`),console.log(` pressed: ${c.join(", ")}`);break}case"keycode":{let c=i.slice(1);c.length===0&&(console.error(h("keycode","<code> [<code> ...]")),process.exit(1));let d=c.map(m=>({code:m,key:Ra(m)})),p=d.filter(m=>!m.key);p.length>0&&(console.error(` unsupported keycode(s): ${p.map(m=>m.code).join(", ")}`),process.exit(1)),await Us(f,"keycode");for(let m of d)await f.send({type:"keyboard",action:"press",text:m.key});await te("inspect keycode",{pressKey:d.map(m=>m.key).join(" ")},`keycode ${c.join(" ")}`),console.log(` pressed: ${c.join(", ")}`);break}case"dispatch":{let c=i[1];c||(console.error(h("dispatch","<char>")),process.exit(1)),await f.send({type:"keyboard",action:"dispatchKey",text:c}),await te("inspect dispatch",{dispatchKey:c},`dispatch ${JSON.stringify(c)}`),console.log(` dispatched: ${c}`);break}case"dismiss":{await f.send({type:"keyboard",action:"dismiss"}),await te("inspect dismiss",{hideKeyboard:!0},"dismiss keyboard"),console.log(" keyboard dismissed");break}case"double-tap":{let c=Number(i[1]),d=Number(i[2]),p=Vt(s);if(p){let x=await qs(f,p);x||(console.error(` not found: ${p.value}`),p.mode==="testid"&&pe("wait-selector-for-missing-testid",p.value),process.exit(1)),c=x.x,d=x.y}let m=i[3]?Number(i[3]):80;(!Number.isFinite(c)||!Number.isFinite(d)||!Number.isFinite(m))&&(console.error(h("double-tap","<x> <y> [gapMs] | --testid <id>")),process.exit(1));let S=Math.max(0,Math.round(m)),$=await f.send({type:"evaluate",code:`(async () => {
705
+ const interact = window.__sootsimInteract
706
+ if (interact?.doubleTap) {
707
+ return {
708
+ ok: !!(await interact.doubleTap(${c}, ${d}, ${S})),
709
+ gapMs: ${S},
710
+ }
711
+ }
712
+ if (!interact?.tap) {
713
+ return { ok: false, reason: 'no interact.tap', gapMs: ${S} }
714
+ }
715
+ const first = await interact.tap(${c}, ${d})
716
+ if (!first || first.hit === false) {
717
+ return { ok: false, reason: 'first tap missed', gapMs: ${S}, first }
718
+ }
719
+ await new Promise((resolve) => setTimeout(resolve, ${S}))
720
+ const second = await interact.tap(${c}, ${d})
721
+ return {
722
+ ok: !!second && second.hit !== false,
723
+ gapMs: ${S},
724
+ first,
725
+ second,
726
+ }
727
+ })()`});$?.ok&&await te("inspect double-tap",{doubleTapAtCoords:{x:c,y:d,gapMs:S}},`double-tap @${c},${d}`),console.log(JSON.stringify($,null,2));break}case"long-press":{let c=Number(i[1]),d=Number(i[2]),p=Vt(s),m=null;if(p){let v=await qs(f,p);v||(console.error(` not found: ${p.value}`),p.mode==="testid"&&pe("wait-selector-for-missing-testid",p.value),process.exit(1)),c=v.x,d=v.y,m={id:v.id??null,testID:v.testID??null,text:v.text??null,type:v.type??null}}let S=p?i[1]:i[3],$=S?Number(S):600;(!Number.isFinite(c)||!Number.isFinite(d)||!Number.isFinite($))&&(console.error(h("long-press","<x> <y> [durationMs] | --testid <id>")),process.exit(1));let x=Math.max(0,Math.round($)),_=await f.send({type:"longPress",x:c,y:d,durationMs:x,target:m});_?.ok&&await te("inspect long-press",{tapAtCoords:{x:c,y:d}},`long-press @${c},${d}`),console.log(JSON.stringify(_,null,2));break}case"touch":{let c=i[1],d=Number(i[2]),p=Number(i[3]),m=i[4]?Number(i[4]):999,S=c==="down"?"touchDown":c==="move"?"touchMove":c==="up"?"touchUp":c==="cancel"?"touchCancel":null;S||(console.error(h("touch","<down|move|up|cancel> <x> <y> [pointerId]")),process.exit(1)),c!=="cancel"&&(!Number.isFinite(d)||!Number.isFinite(p))&&(console.error(h("touch","<down|move|up|cancel> <x> <y> [pointerId]")),process.exit(1));let $=c==="down"?"tap":c==="move"?"move":null,x=$&&Number.isFinite(d)&&Number.isFinite(p)?`window.dispatchEvent(new CustomEvent('sootsim:agentAction', { detail: { type: '${$}', x: ${d}, y: ${p} } }));`:"",_=await f.send({type:"evaluate",code:`(async () => {
728
+ ${x}
729
+ const interact = window.__sootsimInteract
730
+ if (!interact?.${S}) return { ok: false, reason: 'no interact.${S}' }
731
+ const value = ${c==="cancel"?`await interact.${S}(${Math.max(1,Math.round(m))})`:`await interact.${S}(${d}, ${p}, ${Math.max(1,Math.round(m))})`}
732
+ return { ok: !!value, value }
733
+ })()`});_?.ok&&c!=="cancel"&&await te("inspect touch",{tapAtCoords:{x:d,y:p}},`touch ${c} @${d},${p}`),console.log(JSON.stringify(_,null,2));break}case"gesture":{let c=["scroll-up","scroll-down","scroll-left","scroll-right","swipe-from-left-edge","swipe-from-right-edge","swipe-from-top-edge","swipe-from-bottom-edge"],d=i[1],p=i[2]?Number(i[2]):220;(!d||!Number.isFinite(p))&&(console.error(h("gesture","<preset> [durationMs]")),console.error(` presets: ${c.join(", ")}`),process.exit(1)),c.includes(d)||(console.error(` unknown gesture preset: ${d}`),console.error(` presets: ${c.join(", ")}`),process.exit(1));let m=await f.send({type:"evaluate",code:`(async () => {
734
+ const spec = globalThis.__sootsimDeviceSpec || {}
735
+ return {
736
+ width: spec.width || window.innerWidth || 393,
737
+ height: spec.height || window.innerHeight || 852,
738
+ statusBarHeight: spec.statusBarHeight || 0,
739
+ homeIndicatorHeight: spec.homeIndicatorHeight || 0,
740
+ }
741
+ })()`}),S=Number(m?.width)||393,$=Number(m?.height)||852,x=Number(m?.statusBarHeight)||0,_=Number(m?.homeIndicatorHeight)||0,v=Math.round(S/2),F=Math.round($/2),Q=Math.max(24,x+18),ue=Math.max(24,_+18),ie=18,re=Math.min(220,Math.round($*.24)),K=Math.min(180,Math.round(S*.32)),M=v,R=F,B=v,Ee=F;switch(d){case"scroll-up":R=F+Math.round(re/2),Ee=F-Math.round(re/2);break;case"scroll-down":R=F-Math.round(re/2),Ee=F+Math.round(re/2);break;case"scroll-left":M=v+Math.round(K/2),B=v-Math.round(K/2);break;case"scroll-right":M=v-Math.round(K/2),B=v+Math.round(K/2);break;case"swipe-from-left-edge":M=ie,R=F,B=Math.min(S-ie,ie+K);break;case"swipe-from-right-edge":M=S-ie,R=F,B=Math.max(ie,S-ie-K);break;case"swipe-from-top-edge":M=v,R=Q,Ee=Math.min($-ue,Q+re);break;case"swipe-from-bottom-edge":M=v,R=$-ue,Ee=Math.max(Q,$-ue-re);break}let le=Math.max(8,Math.round(p/16)),G=Math.max(1,Math.round(p/le)),Ht=await f.send({type:"evaluate",code:`(async () => {
742
+ const interact = window.__sootsimInteract
743
+ if (!interact?.drag) return { ok: false, reason: 'no interact.drag' }
744
+ const value = await interact.drag(${M}, ${R}, ${B}, ${Ee}, ${le}, ${G})
745
+ return { ok: !!value, value }
746
+ })()`});Ht?.ok&&await te("inspect gesture",{swipe:{start:`${M}, ${R}`,end:`${B}, ${Ee}`,duration:Math.max(1,Math.round(p))}},`gesture ${d}`),console.log(JSON.stringify({preset:d,from:{x:M,y:R},to:{x:B,y:Ee},result:Ht},null,2));break}case"scroll":{let c=Vt(s),d=ja(s),p=c?.mode==="testid"?c.value:d==null?i[1]:null,m=c||d!=null?1:2,S=Number(i[m]),$=Number(i[m+1]);(!p&&d==null||!Number.isFinite(S)||!Number.isFinite($))&&(console.error(h("scroll","<id> <x> <y> | --testid <id> <x> <y> | --node-id <nodeId> <x> <y>")),process.exit(1));let x=await f.send({type:"evaluate",code:`(async () => {
747
+ const t = window.__sootsimTest
748
+ if (!t) return null
749
+ const n = ${d!=null?`await t.inspectByNodeId(${JSON.stringify(d)})`:`await t.findByTestId(${JSON.stringify(p)})
750
+ || await t.findById(${JSON.stringify(p)})`}
751
+ if (!n || !n.absolutePosition || !n.layout) return null
752
+ return {
753
+ cx: n.absolutePosition.x + (n.layout.width || 0) / 2,
754
+ cy: n.absolutePosition.y + (n.layout.height || 0) / 2,
755
+ }
756
+ })()`}),_=await fe(f,"scrollTo",d!=null?{nodeId:d}:p,S,$,!1);if(_?.ok){let v=d!=null?`node ${d}`:`#${p}`;await te("inspect scroll",{scrollTo:{...d!=null?{nodeId:d}:{id:p},x:S,y:$}},`scroll ${v} -> ${S},${$}`)}console.log(JSON.stringify({..._,...x?{at:{x:x.cx,y:x.cy}}:{}},null,2));break}case"state":{let c=i[1];if(t==="get"&&!c){let p=await fe(f,"getRuntimeState"),m=await f.send({type:"evaluate",code:zt});if(p&&typeof p=="object"&&p.diagnostics&&(p.diagnostics.errors=m?.errors??0,p.diagnostics.warnings=m?.warnings??0),p&&typeof p=="object"&&p.shell==null)try{let S=await nt(f);S&&(p.shell=S)}catch{}console.log(JSON.stringify(p,null,2));break}if(!c||c==="--help"||c==="-h"){console.log(`
757
+ ${g("state")} \u2014 dump raw runtime state
758
+
759
+ subcommands:
760
+ shell dump shell transition/layout state
761
+ worker dump render-worker host/animation state
762
+ keyboard dump keyboard visibility, mode, and focused input
763
+ ownership dump surface ownership + pointerOnSurface delivery stats
764
+ node <id> dump raw node info by id or testID
765
+ scroll <id> dump scroll metrics and runtime state
766
+ scroll-hit <x> <y> dump the nearest scroll ancestor at coordinates
767
+ hit <x> <y> dump the hit-test ancestry at coordinates
768
+ gesture <x> <y> dump gesture routing/debug info at coordinates
769
+ gesture-seam dump shell-hosted gesture recognizer state/events
770
+
771
+ examples:
772
+ ${g("state")} shell
773
+ ${g("state")} worker
774
+ ${g("state")} keyboard
775
+ ${g("state")} ownership
776
+ ${g("state")} node photos
777
+ ${g("state")} scroll feed
778
+ ${g("state")} scroll-hit 360 420
779
+ ${g("state")} hit 200 720
780
+ `);break}let d;switch(c){case"shell":d=await nt(f,500);break;case"worker":d=await Qt(f,"__sootsimRenderHost.queryStats");break;case"ownership":d=await f.send({type:"evaluate",code:`(() => {
781
+ const h = window.__sootsimRenderHost
782
+ if (!h || typeof h.getOwnershipSnapshot !== 'function') {
783
+ return { error: 'getOwnershipSnapshot not available' }
784
+ }
785
+ return h.getOwnershipSnapshot()
786
+ })()`});break;case"keyboard":d=await f.send({type:"evaluate",code:`(async () => {
787
+ const kb = window.__sootsimKeyboard
788
+ const test = window.__sootsimTest
789
+ if (!kb) return { error: 'keyboard bridge not available' }
790
+ const layout = typeof kb.getLayout === 'function' ? kb.getLayout() : null
791
+ const secureTextEntry =
792
+ !!layout?.spec?.secureTextEntry && layout?.spec?.keyboardType !== 'visible-password'
793
+ const visible = kb.isVisible()
794
+ const mode = kb.getMode()
795
+ let focused = null
796
+ if (test && typeof test.getFocusedNode === 'function') {
797
+ try {
798
+ focused = await test.getFocusedNode()
799
+ } catch {}
800
+ }
801
+ return {
802
+ visible,
803
+ mode,
804
+ layout,
805
+ focusedInput: focused ? {
806
+ nodeId: focused.nodeId ?? null,
807
+ testID: focused.testID || null,
808
+ id: focused.id || null,
809
+ placeholder: focused.placeholder || null,
810
+ secureTextEntry,
811
+ text: secureTextEntry ? ${JSON.stringify(ge)} : (focused.text || null),
812
+ } : null,
813
+ }
814
+ })()`}),d=Dn(d);break;case"node":{let p=i[2];p||(console.error(` usage: ${g("state")} node <id>`),process.exit(1)),d=await fe(f,"findByTestId",p)||await fe(f,"findById",p);break}case"scroll":{let p=i[2];p||(console.error(` usage: ${g("state")} scroll <id>`),process.exit(1)),d=await fe(f,"getScrollState",p);break}case"scroll-hit":{let p=Number(i[2]),m=Number(i[3]);(!Number.isFinite(p)||!Number.isFinite(m))&&(console.error(` usage: ${g("state")} scroll-hit <x> <y>`),process.exit(1)),d=await fe(f,"getScrollStateAt",p,m);break}case"hit":{let p=Number(i[2]),m=Number(i[3]);(!Number.isFinite(p)||!Number.isFinite(m))&&(console.error(` usage: ${g("state")} hit <x> <y>`),process.exit(1)),d=await fe(f,"debugHitAt",p,m);break}case"gesture":{let p=Number(i[2]),m=Number(i[3]);(!Number.isFinite(p)||!Number.isFinite(m))&&(console.error(` usage: ${g("state")} gesture <x> <y>`),process.exit(1)),d=await fe(f,"debugGestureAt",p,m);break}case"gesture-seam":d=await Qt(f,"SootSim.bridges.mainShell.callTestBridge","getShellGestureSeamDebug");break;default:console.error(` unknown state subcommand: ${c}`),process.exit(1)}console.log(JSON.stringify(d,null,2));break}case"shell":{let c=i[1];if(!c||c==="--help"||c==="-h"){console.log(`
815
+ ${g("shell")} \u2014 run built-in shell commands
816
+
817
+ subcommands:
818
+ launch <appId> [waitMs] [--clear-state]
819
+ launch app and wait for settled shell state
820
+ home [waitMs] go home and wait for settled shell state
821
+ switcher [waitMs] open switcher and wait for settled shell state
822
+ open-card <appId> [waitMs]
823
+ open a specific switcher card and wait for app settle
824
+ appearance <light|dark|auto|toggle>
825
+ update simulator appearance
826
+ lock toggle device lock state
827
+ shake trigger the simulator shake gesture
828
+
829
+ examples:
830
+ ${g("shell")} launch photos
831
+ ${g("shell")} launch rn --clear-state
832
+ ${g("shell")} launch photos 1500
833
+ ${g("shell")} home 500
834
+ ${g("shell")} switcher 800
835
+ ${g("shell")} open-card clock 800
836
+ ${g("shell")} appearance dark
837
+ ${g("shell")} lock
838
+ `);break}let d=c==="launch"||c==="open-card"||c==="home"||c==="switcher",p=c==="launch"||c==="open-card"?i[3]:i[2],m=p?Number(p):350;d&&(!Number.isFinite(m)||m<0)&&(console.error(h("shell",c==="launch"||c==="open-card"?"<launch|open-card> <appId> [settleMs]":"<home|switcher> [settleMs]")),process.exit(1));let S=!1,$=!1,x=null,_=s.includes("--clear-state");if(c==="launch"){let v=i[2];v||(console.error(h("shell","launch <appId> [settleMs] [--clear-state]")),process.exit(1)),_&&await f.send({type:"evaluate",code:Xs(!0)}),S=!!await Nt(f,"launchApp",m,v),{settled:$,state:x}=await Js(f,Math.round(m),F=>!!F&&F.state==="app"&&F.activeApp===v&&F.showSwitcher===!1&&F.switcherPhase==="idle"&&typeof F.launchProgress=="number"&&F.launchProgress>=.98),S&&await te("inspect shell launch",_?{launchApp:{clearState:!0}}:{launchApp:{}},_?"launch app (clear state)":"launch app")}else if(c==="home")S=!!await Nt(f,"goHome",m),{settled:$,state:x}=await Js(f,Math.round(m),v=>!!v&&v.state==="home"&&v.activeApp==null&&v.showSwitcher===!1&&v.switcherPhase==="idle"&&typeof v.launchProgress=="number"&&v.launchProgress>=.98);else if(c==="switcher")S=!!await Nt(f,"openSwitcher",m),{settled:$,state:x}=await Js(f,Math.round(m),v=>!!v&&v.state==="app"&&v.showSwitcher===!0&&v.switcherPhase==="idle"&&typeof v.zoomLevel=="number"&&Math.abs(v.zoomLevel)<=.02&&typeof v.horizontalZoom=="number"&&Math.abs(v.horizontalZoom)<=.02),$&&(await ke(Fa),x=await nt(f));else if(c==="open-card"){let v=i[2];v||(console.error(h("shell","open-card <appId> [settleMs]")),process.exit(1)),S=!!await Nt(f,"openSwitcherCard",m,v),{settled:$,state:x}=await Js(f,Math.round(m),F=>!!F&&F.state==="app"&&F.activeApp===v&&F.showSwitcher===!1&&F.switcherPhase==="idle"&&typeof F.zoomLevel=="number"&&F.zoomLevel>=.98&&typeof F.horizontalZoom=="number"&&F.horizontalZoom>=.98),S&&await te("inspect shell open-card",{openSwitcherCard:{appId:v}},`open switcher card ${v}`)}else if(c==="appearance"){let v=i[2];(!v||!["light","dark","auto","toggle"].includes(v))&&(console.error(h("shell","appearance <light|dark|auto|toggle>")),process.exit(1));let F=await ir(f,"appearance",v);if(S=!!F?.ok,x={appearance:F},S){let Q=F?.applied??v;console.log(` appearance: ${Q}`)}}else if(c==="lock"||c==="shake"){let v=await ir(f,c);S=!!v?.ok,x={[c]:v}}else console.error(` unknown shell subcommand: ${c}`),process.exit(1);console.log(JSON.stringify({ok:S,settled:$,state:x},null,2));break}case"url":{await Wi(f,{args:n});break}case"reload":{let p=!1,m=!1;try{await f.send({type:"evaluate",code:"window.__sootsimConsole?.clear()"});let x=await f.send({type:"evaluate",code:`;(() => {
839
+ const reloadExternalApp = window.SootSim?.bridges?.hotRemount?.reloadExternalApp
840
+ if (typeof reloadExternalApp === 'function') {
841
+ reloadExternalApp()
842
+ return { kind: 'external-app' }
843
+ }
844
+ window.location.reload()
845
+ return { kind: 'page' }
846
+ })()`});m=!!x&&x.kind==="external-app",p=!0}catch{}console.log(" reloading...");let S=f,$=null;if(m)$=await Zt(f,{timeoutMs:1e4,errorGraceMs:3e3});else{p&&await ke(300);let x=await yo(y,b,w,{timeoutMs:1e4,simIdSource:N});x?(S=x,$=await Zt(x,{timeoutMs:1e4,errorGraceMs:3e3})):(console.log(" \u26A0 reload: bridge never reconnected within 10000ms"),S=null)}if($)if($.ready){let x=$.source==="nodes-fallback"?" (no ready signal, node-count fallback)":"";console.log(` ready in ${$.elapsedMs}ms: ${$.nodes} nodes${x}`)}else if($.source==="error-bail")console.log(` \u26A0 reload bailed after ${$.elapsedMs}ms: ${$.errors} console error(s), ready signal never fired`);else{let x=Zi($);console.log(` \u26A0 reload timed out after ${$.elapsedMs}ms \u2014 ${x} (nodes: ${$.nodes}, targets: ${$.targets}, errors: ${$.errors})`)}if(S)try{let x=await vt(S,10);if(S!==f&&S.close(),Array.isArray(x)&&x.length>0){console.log(`
847
+ \u26A0 ${x.length} error(s) during mount:
848
+ `);for(let _ of x){let v=_.args.map(F=>typeof F=="object"?JSON.stringify(F):F).join(" ");if(console.log(` ${v}`),_.stack){let F=_.stack.split(`
849
+ `).slice(0,2);for(let Q of F)console.log(` ${Q.trim()}`)}}}}catch{}$&&!$.ready&&(process.exitCode=1);break}case"storage-clear":{if(await zs(f),await f.send({type:"evaluate",code:Xs(!0)})!==!0){Y(n)?H({cleared:!1,ready:!1,error:"external app reload bridge is unavailable"}):console.error(" storage clear failed: external app reload bridge is unavailable"),process.exitCode=1;break}let m=await Zt(f,{timeoutMs:1e4,errorGraceMs:3e3});if(Y(n)){H({cleared:!0,ready:m.ready,reload:m}),m.ready||(process.exitCode=1);break}if(m.ready){let S=m.source==="nodes-fallback"?" (no ready signal, node-count fallback)":"";console.log(` cleared tenant storage; ready in ${m.elapsedMs}ms: ${m.nodes} nodes${S}`)}else if(m.source==="error-bail")console.log(` \u26A0 storage clear reloaded but bailed after ${m.elapsedMs}ms: ${m.errors} console error(s), ready signal never fired`);else{let S=Zi(m);console.log(` \u26A0 storage clear reloaded but timed out after ${m.elapsedMs}ms \u2014 ${S} (nodes: ${m.nodes}, targets: ${m.targets}, errors: ${m.errors})`)}try{let S=await vt(f,10);if(Array.isArray(S)&&S.length>0){console.log(`
850
+ \u26A0 ${S.length} error(s) during mount:
851
+ `);for(let $ of S){let x=$.args.map(_=>typeof _=="object"?JSON.stringify(_):_).join(" ");if(console.log(` ${x}`),$.stack){let _=$.stack.split(`
852
+ `).slice(0,2);for(let v of _)console.log(` ${v.trim()}`)}}}}catch{}m.ready||(process.exitCode=1);break}case"eval":case"js":{let c=i.slice(1).join(" ");c||(console.error(h("js","<javascript>")),console.error(""),console.error(" runs the snippet in the engine realm. SootSim is the"),console.error(" canonical state surface \u2014 reach into it directly."),console.error(""),console.error(" examples:"),console.error(` ${g("js")} SootSim.bridges.test.findByText("Sign in")`),console.error(` ${g("js")} SootSim.bridges.debug.snapshot("before")`),console.error(` ${g("js")} SootSim.bridges.keyboard.type("hello")`),console.error(` ${g("js")} SootSim.state.root.children.length`),process.exit(1));let d=c;d.startsWith("(async")||(d=`(async () => ${d})()`);let p=await f.send({type:"evaluate",code:d});console.log(JSON.stringify(p,null,2));let m=c.toLowerCase(),S=[];(m.includes("sootsim:gohome")||m.includes("gohome"))&&S.push("sootsim shell home"),(m.includes("sootsim:appswitcher")||m.includes("appswitcher"))&&S.push("sootsim shell switcher"),(m.includes("keyboard.isvisible")||m.includes("keyboard.getmode"))&&S.push("sootsim debug state keyboard"),m.includes("interact.tap")&&S.push("sootsim do tap <x> <y>"),m.includes("keyboard.type")&&S.push("sootsim do type <text>"),(m.includes("keyboard.press")||m.includes("keyboard.dispatchkey"))&&S.push("sootsim do key <name>"),m.includes("keyboard.dismiss")&&S.push("sootsim do dismiss"),m.includes("dumptree")&&S.push("sootsim get tree"),m.includes("dumpaccessibilitytree")&&S.push("sootsim get a11y"),m.includes("getnodecount")&&S.push("sootsim get count"),m.includes("findbytext")&&S.push("sootsim find <text>"),(m.includes("findbytestid")||m.includes("findbyid"))&&S.push("sootsim find --testid <id>"),m.includes("document.hidden")&&S.push("sootsim debug state keyboard (includes tab health)"),S.length>0&&pe("prefer-cli-over-eval",S);break}case"globals":{let c=await f.send({type:"evaluate",code:`(async () => {
853
+ const globals = {}
854
+
855
+ // test bridge (proxy in worker mode)
856
+ const testMethods = [
857
+ 'findById', 'findByTestId', 'findByText', 'findByLabel', 'findByRole',
858
+ 'findAllByRole', 'findByA11yState', 'findAllByA11yState', 'findByHint',
859
+ 'findPressable', 'getStyle', 'getLayout', 'getAbsolutePosition', 'isVisible',
860
+ 'queryAll', 'dumpTree', 'dumpAccessibilityTree', 'getNodeCount', 'getShellState',
861
+ 'getScrollState', 'getScrollStateAt', 'scrollTo', 'waitForTree',
862
+ 'waitForScreenTransitions', 'debugByText', 'debugByTestId', 'debugHitAt',
863
+ 'debugGestureAt'
864
+ ]
865
+ globals['test (\u2192 __sootsimTest)'] = testMethods
866
+
867
+ // debug
868
+ if (window.__sootsimDebug) {
869
+ globals['debug (\u2192 __sootsimDebug)'] = Object.keys(window.__sootsimDebug)
870
+ }
871
+
872
+ // interact
873
+ if (window.__sootsimInteract) {
874
+ globals['interact (\u2192 __sootsimInteract)'] = Object.keys(window.__sootsimInteract)
875
+ }
876
+
877
+ // keyboard
878
+ if (window.__sootsimKeyboard) {
879
+ globals['keyboard (\u2192 __sootsimKeyboard)'] = Object.keys(window.__sootsimKeyboard)
880
+ }
881
+
882
+ // other globals
883
+ globals['other'] = [
884
+ 'root (\u2192 __sootsimRoot) - live node tree',
885
+ 'render() (\u2192 __sootsimForceRender) - force re-render'
886
+ ]
887
+
888
+ return globals
889
+ })()`});console.log(` sootsim JS API:
890
+ `);for(let[d,p]of Object.entries(c)){console.log(` ${d}:`);for(let m of p)console.log(` .${m}`);console.log("")}console.log(` use: ${g("js")} <expression>`),console.log(` example: ${g("js")} test.findByText("Sign in")`);break}case"describe":{await Pi({bridge:f,args:s,positional:i});break}case"perf":{let c=i[1];if(!c||c==="--help"||c==="-h"){console.log(`
891
+ ${g("perf")} \u2014 shell frame profiling (the worker that paints)
892
+
893
+ records per-painted-frame timing in the shell worker \u2014 the surface that
894
+ actually draws the app's pixels \u2014 merged with render-profile counters
895
+ (node visits, boundary records/replays, raster tier, blur ms, draw calls).
896
+
897
+ subcommands:
898
+ start begin recording (clears prior frames + counters)
899
+ stop stop recording and report results
900
+ transition <e> profile a shell transition (goHome, appSwitcher, lockScreen)
901
+
902
+ stop and transition accept --json for the full machine-readable payload.
903
+
904
+ examples:
905
+ ${g("perf")} start
906
+ # ... interact with the app ...
907
+ ${g("perf")} stop
908
+ ${g("perf")} stop --json
909
+ ${g("perf")} transition goHome
910
+ `);break}switch(c){case"start":{let d=await f.send({type:"evaluate",code:`(() => {
911
+ if (!window.__sootsimShellPerf) {
912
+ return { error: 'shell frame profile unavailable (__sootsimShellPerf missing on the page)' }
913
+ }
914
+ window.__sootsimShellPerf.start()
915
+ return { started: true }
916
+ })()`});d?.error&&(console.error(` error: ${d.error}`),process.exit(1)),console.log(` shell profiling started \u2014 interact with the app, then run '${g("perf")} stop'`);break}case"stop":{let d=await f.send({type:"evaluate",code:`(async () => {
917
+ if (!window.__sootsimShellPerf) {
918
+ return { error: 'shell frame profile unavailable (__sootsimShellPerf missing on the page)' }
919
+ }
920
+ return await window.__sootsimShellPerf.stop()
921
+ })()`});if(d?.error&&(console.error(` error: ${d.error}`),d.error==="timeout"&&console.error(" (shell worker did not answer within 5s \u2014 is a sim loaded?)"),process.exit(1)),Y(n)){H(d);break}or(d);break}case"transition":{let d=i[2];if(!d||!["goHome","appSwitcher","lockScreen"].includes(d)){console.log(`
922
+ ${g("perf")} transition <event> \u2014 profile a shell transition
923
+
924
+ events:
925
+ goHome swipe-to-home animation
926
+ appSwitcher app switcher card animation
927
+ lockScreen lock screen transition
928
+
929
+ note: uses 600ms capture window \u2014 may need --timeout 10000 flag
930
+
931
+ examples:
932
+ ${g("perf")} transition goHome --timeout 10000
933
+ ${g("perf")} transition appSwitcher
934
+ `);break}let m=`sootsim:${d}`;Xt(` profiling ${d} transition...`),Xt(" (use --timeout 10000 if this times out)");let S=await f.send({type:"evaluate",code:`(async () => {
935
+ if (!window.__sootsimShellPerf) {
936
+ return { error: 'shell frame profile unavailable (__sootsimShellPerf missing on the page)' }
937
+ }
938
+ window.__sootsimShellPerf.start()
939
+ // give a frame for profiling to engage before the event
940
+ await new Promise(r => requestAnimationFrame(() => r(undefined)))
941
+ window.dispatchEvent(new Event('${m}'))
942
+ // shell animations are ~300-500ms; fixed timing avoids complex
943
+ // animation-end detection
944
+ await new Promise(r => setTimeout(r, 600))
945
+ return await window.__sootsimShellPerf.stop()
946
+ })()`});if(S?.error&&(console.error(` error: ${S.error}`),process.exit(1)),Y(n)){H(S);break}Xt(` ${d} transition profiled:`),or(S);break}default:console.error(` unknown perf subcommand: ${c}`),console.error(" valid: start, stop, transition"),/^--?reset$/.test(c)&&console.error(" note: 'perf start' already clears prior frames \u2014 no reset needed"),(c==="stats"||c==="frames"||c==="worst")&&(console.error(" note: the tenant sampler (stats/frames/worst) was removed \u2014 it hardcoded"),console.error(" layout/render/copy to zero because the shell worker owns every real paint."),console.error(" use 'perf start' / 'perf stop' (worst frames are in the stop report).")),process.exit(1)}break}case"errors":{let c=i[1];if(c==="clear"){await zs(f),Y(n)?H({cleared:!0}):console.log(" error buffer cleared");break}let d=c?Number(c):20,p=await vt(f,d);if(Y(n)){H(p);break}if(p.length===0){console.log(" no errors captured");break}console.log(` ${p.length} error(s):
947
+ `);for(let m of p){let S=Re(m.timestamp),$=m.args.map(x=>typeof x=="object"?JSON.stringify(x):x).join(" ");if(console.log(` [${S}] ${$}`),m.stack){let x=m.stack.split(`
948
+ `).slice(0,3);for(let _ of x)console.log(` ${_.trim()}`)}}break}case"warnings":{let c=i[1]?Number(i[1]):20,d=await to(f,c);if(Y(n)){H(d);break}if(d.length===0){console.log(" no warnings captured");break}console.log(` ${d.length} warning(s):
949
+ `);for(let p of d){let m=Re(p.timestamp),S=p.args.map($=>typeof $=="object"?JSON.stringify($):$).join(" ");console.log(` [${m}] ${S}`)}break}case"animations":{let c=await fe(f,"listAnimations")??[];if(s.includes("--json")){console.log(JSON.stringify(c,null,2));break}if(c.length===0){console.log(" no active animations");break}console.log(` ${c.length} active animation(s):
950
+ `);for(let d of c){let p=String(d.kind).padEnd(6),m=`${Number(d.from).toFixed(2)}\u2192${Number(d.to).toFixed(2)}`,S=Number(d.current??0).toFixed(2),$=`${Math.round((d.progress??0)*100)}%`,x=`${Math.round(d.elapsedMs??0)}ms`,_=d.loop?" loop":"",v=d.layoutBound?" layout":"";console.log(` #${d.id} ${p} ${m.padEnd(14)} cur=${S.padEnd(7)} ${$.padStart(4)} ${x}${_}${v}`)}break}case"animation":{let c=i[1];(!c||c==="--help"||c==="-h")&&(console.error(` usage: ${g("animation")} <id>`),process.exit(1));let d=Number(c);Number.isFinite(d)||(console.error(` invalid id: ${c}`),process.exit(1));let p=await fe(f,"getAnimation",d);console.log(JSON.stringify(p,null,2));break}case"stop-animation":{let c=i[1];(!c||c==="--help"||c==="-h")&&(console.error(` usage: ${g("stop-animation")} <id|all>`),process.exit(1));let d=c==="all"?"all":Number(c);d!=="all"&&!Number.isFinite(d)&&(console.error(` invalid id: ${c}`),process.exit(1));let p=await fe(f,"stopAnimation",d);console.log(` stopped ${p??0} animation(s)`);break}case"requests":{let c=i[1];if(c==="clear"){await no(f),Y(n)?H({cleared:!0}):console.log(" request buffer cleared");break}let d=c==="all",p=d?i[2]:c,m=p?Number(p):20,S=await so(f,{failed:!d,limit:m});if(Y(n)){H(S);break}if(S.length===0){console.log(d?" no requests captured":" no failed requests captured");break}console.log(` ${S.length} ${d?"request(s)":"failed request(s)"}:
951
+ `);for(let $ of S){let x=Re($.timestamp);console.log(` [${x}] ${L($)}`),$.responseBody?console.log(` ${$.responseBody}`):$.error&&console.log(` ${$.error}`)}break}case"network":{let c=i[1],d=null,p=null,m=!1,S=!1,$=1e3,x=!1,_=!1;for(let K=0;K<n.length;K++){let M=n[K];if(M==="--filter")d=n[K+1]??null,K++;else if(M==="--limit"){let R=Number(n[K+1]);Number.isFinite(R)&&(p=R),K++}else if(M==="--threshold"){let R=Number(n[K+1]);Number.isFinite(R)&&R>0&&($=R),K++}else M==="--failed"?m=!0:M==="--slow"?S=!0:M==="--tail"||M==="-f"?x=!0:M==="--json"&&(_=!0)}if(c==="clear"){await f.send({type:"evaluate",code:'window.__sootsimObservability?.network.clear(); "cleared"'}),console.log(" network buffer cleared");break}if(c==="get"){let K=i[2];K||(console.error(" usage: sootsim network get <id>"),process.exit(1));let M=await f.send({type:"evaluate",code:`(() => {
952
+ const obs = window.__sootsimObservability;
953
+ if (!obs) return null;
954
+ return obs.network.getSnapshot().find(e => e.id === ${JSON.stringify(K)}) || null;
955
+ })()`});M||(console.error(` no entry with id ${K}`),process.exit(1)),_?console.log(JSON.stringify(M,null,2)):_a(M);break}let v=p??(x?200:c?Number(c):20);Number.isFinite(v)||(console.error(` invalid limit: ${c} \u2014 \`network\` takes a numeric count (e.g. ${g("network")} 100).
956
+ to target a specific sim, use \`--sim ${c}\` instead.`),process.exit(1));let F=async()=>{let K=await f.send({type:"evaluate",code:`(() => {
957
+ const obs = window.__sootsimObservability;
958
+ if (!obs) return { ok: false };
959
+ return { ok: true, entries: obs.network.getSnapshot() };
960
+ })()`});if(!K||!K.ok)throw new Error("observability bridge not installed \u2014 is the engine running?");return K.entries??[]},Q=K=>{let M=K;if(m&&(M=M.filter(R=>!!R.error||R.status!=null&&R.status>=400)),S&&(M=M.filter(R=>R.durationMs!=null&&R.durationMs>=$)),d){let R=d.toLowerCase();M=M.filter(B=>(B.displayUrl||B.url).toLowerCase().includes(R))}return S&&!x&&(M=[...M].sort((R,B)=>(B.durationMs??0)-(R.durationMs??0))),M};if(!x){let K=await F(),M=Q(K).slice(-v);if(_){console.log(JSON.stringify(M,null,2));break}if(M.length===0){K.length===0?console.log(" no network requests captured"):console.log(S?` no requests slower than ${$}ms (${K.length} total \u2014 try --threshold <ms>)`:" no matching requests");break}console.log(S?` ${M.length} request(s) slower than ${$}ms (sorted by duration desc):
961
+ `:` ${M.length} request(s):
962
+ `);for(let R of M)er(R);break}console.log(` tailing network (ctrl-c to stop)...
963
+ `);let ue=new Set,ie=!0,re=()=>{ie=!1};process.on("SIGINT",re);try{for(;ie;){let K=await F(),M=Q(K);for(let R of M)R.durationMs!=null&&(ue.has(R.id)||(ue.add(R.id),_?console.log(JSON.stringify(R)):er(R)));await ke(250)}}finally{process.off("SIGINT",re)}break}case"logs":{let c=i[1],d=null,p=null,m=null,S=!1,$=!1,x=!1;for(let M=0;M<n.length;M++){let R=n[M];if(R==="--filter")d=n[M+1]??null,M++;else if(R==="--limit"){let B=Number(n[M+1]);Number.isFinite(B)&&(p=B),M++}else R==="--level"?(m=n[M+1]??null,M++):R==="--tail"||R==="-f"?S=!0:R==="--json"?$=!0:(R==="--internal"||R==="--all")&&(x=!0)}let _=m?new Set(m.split(",").map(M=>M.trim()).filter(M=>M==="log"||M==="info"||M==="warn"||M==="error"||M==="debug")):null;if(c==="clear"){await io(f),console.log(" log buffer cleared");break}let v=!$&&process.stdout.isTTY===!0,F=p??(S?500:c?Number(c):50);Number.isFinite(F)||(console.error(` invalid limit: ${c} \u2014 \`logs\` takes a numeric count (e.g. ${g("logs")} 100).
964
+ to target a specific sim, use \`--sim ${c}\` instead.`),process.exit(1));let Q=()=>oo(f),ue=M=>ro(M,{level:_,filter:d,showInternal:x});if(!S){let M=await Q(),R=ue(M).slice(-F);if($){console.log(JSON.stringify(R,null,2));break}if(R.length===0){console.log(M.length===0?" no logs captured":" no matching logs");break}console.log(` ${R.length} log(s):
965
+ `);for(let B of R)sr(B,v);break}console.log(` tailing logs (ctrl-c to stop)...
966
+ `);let ie=new Set,re=!0,K=()=>{re=!1};process.on("SIGINT",K);try{for(;re;){let M=await Q(),R=ue(M);for(let B of R)ie.has(B.id)||(ie.add(B.id),$?console.log(JSON.stringify(B)):sr(B,v));await ke(250)}}finally{process.off("SIGINT",K)}break}default:console.error(` unknown subcommand: ${r}`),process.exit(1)}if(z.has(r)&&!s.includes("--no-wait")&&process.env.SOOTSIM_NO_AUTO_WAIT!=="1"&&!await Un(f,r)&&await k(f),D.length>0&&ee(D),!I.has(r)&&!Y(n))try{await Qe(f)}catch{}}catch(D){let c=D instanceof Error?D.message:String(D);console.error(` ${r??"inspect"} failed: ${c}`);let d=/^no sim connected with id (.+)$/.exec(c),p=/^command timed out after (\d+)s$/.exec(c),m=c.startsWith("sim disconnected:")||c.startsWith("bridge never reconnected")||c.startsWith("could not connect to ws://");if(d)await So(f,y,d[1]);else if(/^no sim connected$/.test(c))wo(y);else if(p)if(await Ta(f)){let $=r??"describe";process.stderr.write(` the sim is still responsive \u2014 '${$}' just exceeded the ${p[1]}s command budget.
967
+ the screen's node tree is large; narrow the query or raise the budget:
968
+ sootsim ${$} --testid <id> # scope to one subtree
969
+ sootsim find --testid <id> # targeted single-node lookup
970
+ sootsim ${$} --timeout 60000 # raise per-command budget (ms)
971
+ `)}else Xi();else if(m)Xi();else{try{await bo(f)}catch{}try{await ne({includeTail:!0})}catch{}try{await q({includeTail:!0})}catch{}}process.exit(1)}finally{f.close()}}export{Xs as a,st as b,Hr as c,wp as d,Ip as e,Tp as f,Op as g,Ap as h,Ae as i,or as j,$h as k};