vibe64 0.1.59 → 0.1.61

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 (204) hide show
  1. package/bin/run.js +1228 -1210
  2. package/bin/server.js +392 -376
  3. package/bin/upgrade-state.js +4457 -4430
  4. package/dist/assets/{GithubBrowserTabs-D_nMB5Y1.js → GithubBrowserTabs-DAgQxPXI.js} +1 -1
  5. package/dist/assets/{LocalDatabaseServer-BgO_aeUg.js → LocalDatabaseServer-m1G8ZS5i.js} +1 -1
  6. package/dist/assets/SelectField-DwWoHC2p.js +1 -0
  7. package/dist/assets/{ShellOutlet-Cr8SJs7s.js → ShellOutlet-CdjsJfg9.js} +1 -1
  8. package/dist/assets/Vibe64AuthSettingsButton-D3sB4BfM.js +5 -0
  9. package/dist/assets/{Vibe64AuthSettingsButton-DRTKdimW.css → Vibe64AuthSettingsButton-DFfFPrd7.css} +1 -1
  10. package/dist/assets/{Vibe64ConversationLog-DtOgxPNR.js → Vibe64ConversationLog-B-L5QsVr.js} +4 -4
  11. package/dist/assets/{Vibe64ConversationLog-NH61odld.css → Vibe64ConversationLog-ksf1U6PP.css} +1 -1
  12. package/dist/assets/{Vibe64DashboardShell-DhPE6H3P.js → Vibe64DashboardShell-CMzX3wRM.js} +1 -1
  13. package/dist/assets/{Vibe64DashboardShell-Bpnbjs4l.css → Vibe64DashboardShell-D0GNI4V8.css} +1 -1
  14. package/dist/assets/{Vibe64DatabaseWorkspace-cfn8TTxQ.css → Vibe64DatabaseWorkspace-De4sbXAN.css} +1 -1
  15. package/dist/assets/{Vibe64DatabaseWorkspace-CHV0cd3l.js → Vibe64DatabaseWorkspace-Dewhs6_T.js} +2 -2
  16. package/dist/assets/Vibe64DestinationButton-CdyyK9tj.js +1 -0
  17. package/dist/assets/Vibe64DestinationButton-ZxY1Lwie.css +1 -0
  18. package/dist/assets/Vibe64FileArea-DluZTu-c.js +1 -0
  19. package/dist/assets/{Vibe64FileArea-mydNQQl8.css → Vibe64FileArea-ZEzsvLt2.css} +1 -1
  20. package/dist/assets/Vibe64OutputControls-BfbdD25Y.js +8 -0
  21. package/dist/assets/{Vibe64RepositoryWorkspace-DUSMn4pR.js → Vibe64RepositoryWorkspace-CBsySPXN.js} +1 -1
  22. package/dist/assets/{Vibe64SessionFiles-BXt__PJL.js → Vibe64SessionFiles--wtVe_KC.js} +1 -1
  23. package/dist/assets/{Vibe64SessionSourceEditor-NyG6niQM.js → Vibe64SessionSourceEditor-BouH4fXC.js} +1 -1
  24. package/dist/assets/Vibe64UiStoryboardView--E04EEF8.js +8 -0
  25. package/dist/assets/{Vibe64UiStoryboardView-CtlJWiCY.css → Vibe64UiStoryboardView-DqLN6ofL.css} +1 -1
  26. package/dist/assets/{Vibe64UnavailableSessions-CCPWJo8e.js → Vibe64UnavailableSessions-94bFpxMK.js} +1 -1
  27. package/dist/assets/_pageId_-Ch4OpUkd.js +1 -0
  28. package/dist/assets/_sessionId_-7PyIUeUr.css +1 -0
  29. package/dist/assets/_sessionId_-DGT4d2La.js +1 -0
  30. package/dist/assets/{_sessionTool_-CKPNp5fF.js → _sessionTool_-CBf51mfK.js} +1 -1
  31. package/dist/assets/_sessionTool_-DiYoi-BF.css +1 -0
  32. package/dist/assets/_slug_-C8VNMRVH.js +14 -0
  33. package/dist/assets/_slug_-CZmGS16g.css +1 -0
  34. package/dist/assets/access-BAOx4iCS.js +1 -0
  35. package/dist/assets/access-BH1OsqPS.css +1 -0
  36. package/dist/assets/{app-D9FegZf0.js → app-Bs6-Hv23.js} +1 -1
  37. package/dist/assets/{assistantRouting-D4SnnxJn.js → assistantRouting-BS0ZW5Ki.js} +1 -1
  38. package/dist/assets/{changes-DtfJc780.js → changes-C6eMQ9YE.js} +1 -1
  39. package/dist/assets/{client-CUQfIUus.css → client-BBJzQIWS.css} +1 -1
  40. package/dist/assets/{client-BBqNv4HL.js → client-CIF5Y1Aj.js} +1 -1
  41. package/dist/assets/{client-B8u2_Svv.css → client-CM6TGZc9.css} +1 -1
  42. package/dist/assets/{client-DnjkdG6K.js → client-CVgL_ShV.js} +1 -1
  43. package/dist/assets/{client-DuDOzb5A.js → client-HWj_BNVZ.js} +2 -2
  44. package/dist/assets/{client-Dra4Vp3A.js → client-qAKnahkF.js} +2 -2
  45. package/dist/assets/{client-mU-LObHG.js → client-qpL_kR4u.js} +2 -2
  46. package/dist/assets/{conversation-QpMeXw70.js → conversation-DbF0OrZB.js} +3 -3
  47. package/dist/assets/{conversation-La-pkh5h.css → conversation-ZN3-8jbz.css} +1 -1
  48. package/dist/assets/{dashboard-B26QwE6y.js → dashboard-CzLsa0w0.js} +1 -1
  49. package/dist/assets/{english-definitions-I9tIXY2u.js → english-definitions-BA8v5wP1.js} +1 -1
  50. package/dist/assets/{env-BXsvM592.js → env-BqJ_GWbz.js} +1 -1
  51. package/dist/assets/{error-kdRkyK9x.js → error-BQ7r64JO.js} +1 -1
  52. package/dist/assets/{error-CX8_snYL.js → error-BqMxhgpB.js} +1 -1
  53. package/dist/assets/errorMessageHelpers-BjIt31kK.js +1 -0
  54. package/dist/assets/{errors-DErd0NON.js → errors-D17nJYne.js} +1 -1
  55. package/dist/assets/{health-C4WtefLm.js → health-CIqrHpVK.js} +1 -1
  56. package/dist/assets/history-BCjhpyP8.js +1 -0
  57. package/dist/assets/history-BSIuLgnI.css +1 -0
  58. package/dist/assets/{httpClient-BRO3GqjU.js → httpClient-Bwitq9Xf.js} +1 -1
  59. package/dist/assets/i18n-BkxO7BMl.js +1 -0
  60. package/dist/assets/{i18n-B5lc019_.js → i18n-Dm74yE_M.js} +1 -1
  61. package/dist/assets/index-Ctygjyf8.css +1 -0
  62. package/dist/assets/index-fXKdz8oR.js +134 -0
  63. package/dist/assets/{integrations-CrI893NK.css → integrations-CwgrZgmM.css} +1 -1
  64. package/dist/assets/{integrations-CQNJxkMu.js → integrations-cgbpgNNd.js} +12 -5
  65. package/dist/assets/issues-AhouA6nE.js +1 -0
  66. package/dist/assets/issues-D46llNv-.css +1 -0
  67. package/dist/assets/{learning-0cINHUSN.js → learning-DZXWgVEW.js} +1 -1
  68. package/dist/assets/{pages-DbF-yXqO.js → pages-5jaEclQo.js} +1 -1
  69. package/dist/assets/{pages-CIKw99GN.js → pages-BUUwIXBf.js} +1 -1
  70. package/dist/assets/{pathname-DOqQPPVa.js → pathname-JHQIKk21.js} +1 -1
  71. package/dist/assets/{placement-BAaZQhAh.js → placement-1lT0lW3-.js} +1 -1
  72. package/dist/assets/{placement-Lk1Lpy6s.js → placement-B2V88UDJ.js} +1 -1
  73. package/dist/assets/{project-files-CklWobqZ.js → project-files-BS2gdDSz.js} +1 -1
  74. package/dist/assets/publish-Bq_LPmX2.js +3 -0
  75. package/dist/assets/{publish-DOybV3Qz.css → publish-C9O0tDPB.css} +1 -1
  76. package/dist/assets/pull-requests-BvChbjCD.js +1 -0
  77. package/dist/assets/pull-requests-DtqrTix0.css +1 -0
  78. package/dist/assets/{repository-wJZei_NJ.js → repository-Dkow-18G.js} +1 -1
  79. package/dist/assets/settings-BKZcbISO.css +1 -0
  80. package/dist/assets/settings-r5RWQVzw.js +1 -0
  81. package/dist/assets/{shared-X5MxTHwl.js → shared-B6plZPQ_.js} +1 -1
  82. package/dist/assets/{studioGateApi-CHIdcQvD.js → studioGateApi-UqmdV50W.js} +1 -1
  83. package/dist/assets/{studioUrls-oIU1Eq_t.js → studioUrls-k_pQIuPs.js} +1 -1
  84. package/dist/assets/useArchivedVibe64Sessions-C0MVJuyX.js +1 -0
  85. package/dist/assets/useAssistantAttachments-BkYZckgz.js +2 -0
  86. package/dist/assets/useCommand-CNDe8gM-.js +1 -0
  87. package/dist/assets/{useEndpointResource-61E93qP-.js → useEndpointResource-CmMwteuX.js} +1 -1
  88. package/dist/assets/{usePaths-B-QGqa_I.js → usePaths-CvUbx5-V.js} +1 -1
  89. package/dist/assets/{useUiFeedback-CycH_fvY.js → useUiFeedback-CWb6o71Z.js} +1 -1
  90. package/dist/assets/useVibe64ConversationLog-CUWEZhnf.js +2 -0
  91. package/dist/assets/{useVibe64Learning-DZCyrfpy.js → useVibe64Learning-RE4HXHqo.js} +1 -1
  92. package/dist/assets/{useVibe64SessionData-rBvWMqyc.js → useVibe64SessionData-kGr7R7lG.js} +1 -1
  93. package/dist/assets/{useVibe64SessionSelection-C546mBu8.js → useVibe64SessionSelection-BZ7WnRv0.js} +1 -1
  94. package/dist/assets/validators-HqYRjxEO.js +1 -0
  95. package/dist/assets/{vibe64FileUpload-D0Lv2mMJ.js → vibe64FileUpload-BDkcaUyk.js} +1 -1
  96. package/dist/assets/vibe64GithubProject-CJneIo5O.js +1 -0
  97. package/dist/assets/vibe64RepositoryRealtime-R5QhcJ4H.js +1 -0
  98. package/dist/assets/vibe64SessionFocus-BCojr4E-.css +1 -0
  99. package/dist/assets/vibe64SessionFocus-CHKCMxcJ.js +1 -0
  100. package/dist/index.html +29 -27
  101. package/docs/colleague-usage/ai-tasks.md +15 -4
  102. package/docs/colleague-usage/back-navigation.md +16 -13
  103. package/docs/colleague-usage/coding-agent-goal-pause.md +15 -1
  104. package/docs/colleague-usage/coding-agent-goals.md +23 -3
  105. package/docs/colleague-usage/coding-agent-recovery.md +3 -1
  106. package/docs/colleague-usage/coding-agents.md +19 -1
  107. package/docs/colleague-usage/colleague-watches.md +1 -1
  108. package/docs/colleague-usage/connected-projects.md +1 -1
  109. package/docs/colleague-usage/connected-repositories.md +16 -4
  110. package/docs/colleague-usage/dashboard-navigation.md +14 -11
  111. package/docs/colleague-usage/database.md +1 -1
  112. package/docs/colleague-usage/development-env.md +21 -12
  113. package/docs/colleague-usage/files.md +2 -1
  114. package/docs/colleague-usage/github-work.md +51 -12
  115. package/docs/colleague-usage/health-checks.md +1 -1
  116. package/docs/colleague-usage/integrations.md +2 -2
  117. package/docs/colleague-usage/learning-teacher-guide.md +3 -2
  118. package/docs/colleague-usage/pages.md +1 -2
  119. package/docs/colleague-usage/preview-browser-checks.md +3 -0
  120. package/docs/colleague-usage/preview.md +29 -0
  121. package/docs/colleague-usage/project-messages.md +4 -3
  122. package/docs/colleague-usage/project-settings.md +3 -0
  123. package/docs/colleague-usage/session-archive.md +11 -0
  124. package/docs/colleague-usage/sessions.md +8 -7
  125. package/docs/colleague-usage/temporary-chats.md +4 -3
  126. package/docs/colleague-usage/ui-pass.md +1 -1
  127. package/docs/colleague-usage/usage-map.md +3 -2
  128. package/docs/colleague-usage/workspace-preparation.md +12 -0
  129. package/node_modules/@jskit-ai/agent/CHANGELOG.md +5 -0
  130. package/node_modules/@jskit-ai/agent/package.json +1 -1
  131. package/node_modules/@jskit-ai/assistant-core/CHANGELOG.md +8 -0
  132. package/node_modules/@jskit-ai/assistant-core/locales/en.json +4 -1
  133. package/node_modules/@jskit-ai/assistant-core/package.json +1 -1
  134. package/node_modules/@jskit-ai/assistant-runtime/CHANGELOG.md +4 -0
  135. package/node_modules/@jskit-ai/assistant-runtime/package.json +1 -1
  136. package/node_modules/@jskit-ai/assistant-voice/package.json +1 -1
  137. package/node_modules/@jskit-ai/connector-google-calendar/CHANGELOG.md +4 -0
  138. package/node_modules/@jskit-ai/connector-google-calendar/package.json +1 -1
  139. package/node_modules/@jskit-ai/connectors-catalog/CHANGELOG.md +1 -0
  140. package/node_modules/@jskit-ai/connectors-catalog/package.json +1 -1
  141. package/node_modules/@jskit-ai/connectors-core/CHANGELOG.md +2 -0
  142. package/node_modules/@jskit-ai/connectors-core/README.md +4 -0
  143. package/node_modules/@jskit-ai/connectors-core/package.json +1 -1
  144. package/node_modules/@jskit-ai/http-runtime/CHANGELOG.md +1 -0
  145. package/node_modules/@jskit-ai/http-runtime/package.json +1 -1
  146. package/node_modules/@jskit-ai/kernel/CHANGELOG.md +8 -0
  147. package/node_modules/@jskit-ai/kernel/package.json +3 -1
  148. package/node_modules/@jskit-ai/payments-core/CHANGELOG.md +1 -0
  149. package/node_modules/@jskit-ai/payments-core/locales/en.json +2 -1
  150. package/node_modules/@jskit-ai/payments-core/package.json +1 -1
  151. package/node_modules/@jskit-ai/realtime/CHANGELOG.md +1 -0
  152. package/node_modules/@jskit-ai/realtime/package.json +1 -1
  153. package/node_modules/@jskit-ai/resource-core/CHANGELOG.md +1 -0
  154. package/node_modules/@jskit-ai/resource-core/package.json +1 -1
  155. package/node_modules/@jskit-ai/uploads-runtime/package.json +1 -1
  156. package/node_modules/@local/vibe64-ai-tasks/package.json +2 -1
  157. package/node_modules/@local/vibe64-execution/src/host/execHelper.js +463 -442
  158. package/node_modules/@local/vibe64-genesis/bin/genesis +17 -11
  159. package/node_modules/@local/vibe64-genesis/bin/vibe64-genesis-host-context +827 -813
  160. package/node_modules/@local/vibe64-genesis/src/server/agentSpecs.js +93 -67
  161. package/node_modules/@local/vibe64-genesis/src/server/index.js +608 -584
  162. package/node_modules/@local/vibe64-genesis/src/server/promptContext.js +180 -175
  163. package/node_modules/@local/vibe64-runtime/src/server/codexAppServerProcess.js +490 -479
  164. package/node_modules/@local/vibe64-source-editor/src/server/searchIndexWorker.js +12 -11
  165. package/node_modules/@local/vibe64-system-graph/README.md +9 -5
  166. package/node_modules/@local/vibe64-terminals/src/server/opencodeSessionEnvironmentPlugin.js +262 -252
  167. package/node_modules/@local/vibe64-terminals/src/server/sessionWorkOperationCommand.js +1026 -981
  168. package/node_modules/json-rest-schema/README.md +3 -1
  169. package/node_modules/json-rest-schema/package.json +1 -1
  170. package/package.json +17 -17
  171. package/server.bundle.mjs +43244 -42953
  172. package/dist/assets/Vibe64AuthSettingsButton-Bx9patil.js +0 -5
  173. package/dist/assets/Vibe64FileArea-DIDyAUvD.js +0 -1
  174. package/dist/assets/Vibe64OutputControls-mNWUWLSm.js +0 -8
  175. package/dist/assets/Vibe64UiStoryboardView-BXH2MSWn.js +0 -8
  176. package/dist/assets/_pageId_-D54CqzqG.js +0 -1
  177. package/dist/assets/_sessionId_-B5V2Fs2n.css +0 -1
  178. package/dist/assets/_sessionId_-CW044RVi.js +0 -1
  179. package/dist/assets/_sessionTool_-Be88HWbv.css +0 -1
  180. package/dist/assets/_slug_-CRtFhc0A.js +0 -14
  181. package/dist/assets/_slug_-WWvJTLoc.css +0 -1
  182. package/dist/assets/access-ChMLRErk.js +0 -1
  183. package/dist/assets/access-Cm2lrMF6.css +0 -1
  184. package/dist/assets/errorMessageHelpers-L2GsOwCP.js +0 -1
  185. package/dist/assets/history-BhqQz5jH.css +0 -1
  186. package/dist/assets/history-HHPFoNi3.js +0 -1
  187. package/dist/assets/index-BBfSvf2i.css +0 -1
  188. package/dist/assets/index-Bvd00puv.js +0 -134
  189. package/dist/assets/issues-BHr_nI-9.js +0 -1
  190. package/dist/assets/issues-CpBRQTQ_.css +0 -1
  191. package/dist/assets/publish-Cot797YN.js +0 -3
  192. package/dist/assets/pull-requests-DnEm9m_1.css +0 -1
  193. package/dist/assets/pull-requests-ybnixBv0.js +0 -1
  194. package/dist/assets/settings-DJByC5Wb.js +0 -1
  195. package/dist/assets/settings-bEkDjn0Y.css +0 -1
  196. package/dist/assets/useArchivedVibe64Sessions-B-DtXrk-.js +0 -1
  197. package/dist/assets/useAssistantAttachments-CkseokGM.js +0 -2
  198. package/dist/assets/useCommand-D96utlVe.js +0 -1
  199. package/dist/assets/useVibe64ConversationLog-BVANhCHq.js +0 -2
  200. package/dist/assets/validators-B3YzM6px.js +0 -1
  201. package/dist/assets/vibe64GithubProject-DNl0aDcC.js +0 -1
  202. package/dist/assets/vibe64RepositoryRealtime-BPsE5l5E.js +0 -1
  203. package/dist/assets/vibe64SessionFocus-CxX2nK6F.js +0 -1
  204. package/dist/assets/vibe64SessionFocus-DW73PN_o.css +0 -1
@@ -1,252 +1,252 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __vibe64CreateRequire } from 'node:module';const require=__vibe64CreateRequire(import.meta.url);
3
- var Gi=Object.create;var Jn=Object.defineProperty;var Wi=Object.getOwnPropertyDescriptor;var Ki=Object.getOwnPropertyNames;var Ji=Object.getPrototypeOf,Xi=Object.prototype.hasOwnProperty;var N=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){
4
- if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var $=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}};var Yi=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ki(e))!Xi.call(t,o)&&o!==r&&Jn(t,o,{get:()=>e[o],
5
- enumerable:!(n=Wi(e,o))||n.enumerable});return t};var ce=(t,e,r)=>(r=t!=null?Gi(Ji(t)):{},Yi(e||!t||!t.__esModule?Jn(r,"default",{value:t,enumerable:!0}):r,t));var te=$((gm,ro)=>{"use strict";var eo=["nodebuffer","arraybuffer","fragments"],to=typeof Blob<"u";to&&eo.push("blob");ro.
6
- exports={BINARY_TYPES:eo,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:to,
3
+ var Xi=Object.create;var Zn=Object.defineProperty;var Yi=Object.getOwnPropertyDescriptor;var Zi=Object.getOwnPropertyNames;var Qi=Object.getPrototypeOf,ea=Object.prototype.hasOwnProperty;var M=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){
4
+ if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var $=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}};var ta=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Zi(e))!ea.call(t,o)&&o!==n&&Zn(t,o,{get:()=>e[o],
5
+ enumerable:!(r=Yi(e,o))||r.enumerable});return t};var ce=(t,e,n)=>(n=t!=null?Xi(Qi(t)):{},ta(e||!t||!t.__esModule?Zn(n,"default",{value:t,enumerable:!0}):n,t));var te=$((wm,so)=>{"use strict";var no=["nodebuffer","arraybuffer","fragments"],oo=typeof Blob<"u";oo&&no.push("blob");so.
6
+ exports={BINARY_TYPES:no,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:oo,
7
7
  kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol(
8
- "websocket"),NOOP:()=>{}}});var Ye=$((vm,Ct)=>{"use strict";var{EMPTY_BUFFER:pa}=te(),hr=Buffer[Symbol.species];function fa(t,e){if(t.length===0)return pa;
9
- if(t.length===1)return t[0];let r=Buffer.allocUnsafe(e),n=0;for(let o=0;o<t.length;o++){let s=t[o];r.set(s,n),n+=s.length}
10
- return n<e?new hr(r.buffer,r.byteOffset,n):r}function no(t,e,r,n,o){for(let s=0;s<o;s++)r[n+s]=t[s]^e[s&3]}function oo(t,e){
11
- for(let r=0;r<t.length;r++)t[r]^=e[r&3]}function ma(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,
12
- t.byteOffset+t.length)}function gr(t){if(gr.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?
13
- e=new hr(t):ArrayBuffer.isView(t)?e=new hr(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),gr.readOnly=!1),e}Ct.exports=
14
- {concat:fa,mask:no,toArrayBuffer:ma,toBuffer:gr,unmask:oo};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=N("bufferutil");Ct.
15
- exports.mask=function(e,r,n,o,s){s<48?no(e,r,n,o,s):t.mask(e,r,n,o,s)},Ct.exports.unmask=function(e,r){e.length<32?oo(e,
16
- r):t.unmask(e,r)}}catch{}});var ao=$((wm,io)=>{"use strict";var so=Symbol("kDone"),vr=Symbol("kRun"),wr=class{constructor(e){this[so]=()=>{this.pending--,
17
- this[vr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[vr]()}[vr](){if(this.pending!==
18
- this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[so])}}};io.exports=wr});var Oe=$((ym,po)=>{"use strict";var Ze=N("zlib"),co=Ye(),ha=ao(),{kStatusCode:uo}=te(),ga=Buffer[Symbol.species],va=Buffer.
19
- from([0,0,255,255]),Et=Symbol("permessage-deflate"),re=Symbol("total-length"),Ee=Symbol("callback"),ue=Symbol("buffers"),
20
- Ae=Symbol("error"),_t,yr=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this.
8
+ "websocket"),NOOP:()=>{}}});var Ye=$((ym,Ct)=>{"use strict";var{EMPTY_BUFFER:ga}=te(),gr=Buffer[Symbol.species];function va(t,e){if(t.length===0)return ga;
9
+ if(t.length===1)return t[0];let n=Buffer.allocUnsafe(e),r=0;for(let o=0;o<t.length;o++){let s=t[o];n.set(s,r),r+=s.length}
10
+ return r<e?new gr(n.buffer,n.byteOffset,r):n}function io(t,e,n,r,o){for(let s=0;s<o;s++)n[r+s]=t[s]^e[s&3]}function ao(t,e){
11
+ for(let n=0;n<t.length;n++)t[n]^=e[n&3]}function wa(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,
12
+ t.byteOffset+t.length)}function vr(t){if(vr.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?
13
+ e=new gr(t):ArrayBuffer.isView(t)?e=new gr(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),vr.readOnly=!1),e}Ct.exports=
14
+ {concat:va,mask:io,toArrayBuffer:wa,toBuffer:vr,unmask:ao};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=M("bufferutil");Ct.
15
+ exports.mask=function(e,n,r,o,s){s<48?io(e,n,r,o,s):t.mask(e,n,r,o,s)},Ct.exports.unmask=function(e,n){e.length<32?ao(e,
16
+ n):t.unmask(e,n)}}catch{}});var lo=$((Im,uo)=>{"use strict";var co=Symbol("kDone"),wr=Symbol("kRun"),yr=class{constructor(e){this[co]=()=>{this.pending--,
17
+ this[wr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[wr]()}[wr](){if(this.pending!==
18
+ this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[co])}}};uo.exports=yr});var Re=$((Sm,ho)=>{"use strict";var Ze=M("zlib"),po=Ye(),ya=lo(),{kStatusCode:fo}=te(),Ia=Buffer[Symbol.species],Sa=Buffer.
19
+ from([0,0,255,255]),Et=Symbol("permessage-deflate"),re=Symbol("total-length"),Ae=Symbol("callback"),ue=Symbol("buffers"),
20
+ Oe=Symbol("error"),_t,Ir=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this.
21
21
  _options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=
22
- null,this._inflate=null,this.params=null,!_t){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:
23
- 10;_t=new ha(r)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&
22
+ null,this._inflate=null,this.params=null,!_t){let n=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:
23
+ 10;_t=new ya(n)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&
24
24
  (e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.
25
25
  serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=
26
26
  this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=
27
27
  this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this.
28
- _inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[Ee];this._deflate.close(),this._deflate=
29
- null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let r=this._options,
30
- n=e.find(o=>!(r.serverNoContextTakeover===!1&&o.server_no_context_takeover||o.server_max_window_bits&&(r.serverMaxWindowBits===
31
- !1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>o.server_max_window_bits)||typeof r.clientMaxWindowBits==
32
- "number"&&(typeof o.client_max_window_bits=="number"?r.clientMaxWindowBits>o.client_max_window_bits:!o.client_max_window_bits)));
33
- if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=
34
- !0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=
35
- r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===
36
- !0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let r=e[0];if(this._options.clientNoContextTakeover===
37
- !1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)
38
- typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this.
39
- _options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.
40
- clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(e){
41
- return e.forEach(r=>{Object.keys(r).forEach(n=>{let o=r[n];if(o.length>1)throw new Error(`Parameter "${n}" must have onl\
42
- y a single value`);if(o=o[0],n==="client_max_window_bits"){if(o!==!0){let s=+o;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(
43
- `Invalid value for parameter "${n}": ${o}`);o=s}else if(!this._isServer)throw new TypeError(`Invalid value for parameter\
44
- "${n}": ${o}`)}else if(n==="server_max_window_bits"){let s=+o;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`I\
45
- nvalid value for parameter "${n}": ${o}`);o=s}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){
46
- if(o!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else throw new Error(`Unknown parameter "${n}"`);
47
- r[n]=o})}),e}decompress(e,r,n){_t.add(o=>{this._decompress(e,r,(s,i)=>{o(),n(s,i)})})}compress(e,r,n){_t.add(o=>{this._compress(
48
- e,r,(s,i)=>{o(),n(s,i)})})}_decompress(e,r,n){let o=this._isServer?"client":"server";if(!this._inflate){let s=`${o}_max_\
28
+ _inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[Ae];this._deflate.close(),this._deflate=
29
+ null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let n=this._options,
30
+ r=e.find(o=>!(n.serverNoContextTakeover===!1&&o.server_no_context_takeover||o.server_max_window_bits&&(n.serverMaxWindowBits===
31
+ !1||typeof n.serverMaxWindowBits=="number"&&n.serverMaxWindowBits>o.server_max_window_bits)||typeof n.clientMaxWindowBits==
32
+ "number"&&(typeof o.client_max_window_bits=="number"?n.clientMaxWindowBits>o.client_max_window_bits:!o.client_max_window_bits)));
33
+ if(!r)throw new Error("None of the extension offers can be accepted");return n.serverNoContextTakeover&&(r.server_no_context_takeover=
34
+ !0),n.clientNoContextTakeover&&(r.client_no_context_takeover=!0),typeof n.serverMaxWindowBits=="number"&&(r.server_max_window_bits=
35
+ n.serverMaxWindowBits),typeof n.clientMaxWindowBits=="number"?r.client_max_window_bits=n.clientMaxWindowBits:(r.client_max_window_bits===
36
+ !0||n.clientMaxWindowBits===!1)&&delete r.client_max_window_bits,r}acceptAsClient(e){let n=e[0];if(this._options.clientNoContextTakeover===
37
+ !1&&n.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!n.client_max_window_bits)
38
+ typeof this._options.clientMaxWindowBits=="number"&&(n.client_max_window_bits=this._options.clientMaxWindowBits);else if(this.
39
+ _options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&n.client_max_window_bits>this._options.
40
+ clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return n}normalizeParams(e){
41
+ return e.forEach(n=>{Object.keys(n).forEach(r=>{let o=n[r];if(o.length>1)throw new Error(`Parameter "${r}" must have onl\
42
+ y a single value`);if(o=o[0],r==="client_max_window_bits"){if(o!==!0){let s=+o;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(
43
+ `Invalid value for parameter "${r}": ${o}`);o=s}else if(!this._isServer)throw new TypeError(`Invalid value for parameter\
44
+ "${r}": ${o}`)}else if(r==="server_max_window_bits"){let s=+o;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`I\
45
+ nvalid value for parameter "${r}": ${o}`);o=s}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){
46
+ if(o!==!0)throw new TypeError(`Invalid value for parameter "${r}": ${o}`)}else throw new Error(`Unknown parameter "${r}"`);
47
+ n[r]=o})}),e}decompress(e,n,r){_t.add(o=>{this._decompress(e,n,(s,i)=>{o(),r(s,i)})})}compress(e,n,r){_t.add(o=>{this._compress(
48
+ e,n,(s,i)=>{o(),r(s,i)})})}_decompress(e,n,r){let o=this._isServer?"client":"server";if(!this._inflate){let s=`${o}_max_\
49
49
  window_bits`,i=typeof this.params[s]!="number"?Ze.Z_DEFAULT_WINDOWBITS:this.params[s];this._inflate=Ze.createInflateRaw(
50
50
  {...this._options.zlibInflateOptions,windowBits:i}),this._inflate[Et]=this,this._inflate[re]=0,this._inflate[ue]=[],this.
51
- _inflate.on("error",ya),this._inflate.on("data",lo)}this._inflate[Ee]=n,this._inflate.write(e),r&&this._inflate.write(va),
52
- this._inflate.flush(()=>{let s=this._inflate[Ae];if(s){this._inflate.close(),this._inflate=null,n(s);return}let i=co.concat(
51
+ _inflate.on("error",ba),this._inflate.on("data",mo)}this._inflate[Ae]=r,this._inflate.write(e),n&&this._inflate.write(Sa),
52
+ this._inflate.flush(()=>{let s=this._inflate[Oe];if(s){this._inflate.close(),this._inflate=null,r(s);return}let i=po.concat(
53
53
  this._inflate[ue],this._inflate[re]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):
54
- (this._inflate[re]=0,this._inflate[ue]=[],r&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),n(null,i)})}_compress(e,r,n){
54
+ (this._inflate[re]=0,this._inflate[ue]=[],n&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),r(null,i)})}_compress(e,n,r){
55
55
  let o=this._isServer?"server":"client";if(!this._deflate){let s=`${o}_max_window_bits`,i=typeof this.params[s]!="number"?
56
56
  Ze.Z_DEFAULT_WINDOWBITS:this.params[s];this._deflate=Ze.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:i}),
57
- this._deflate[re]=0,this._deflate[ue]=[],this._deflate.on("data",wa)}this._deflate[Ee]=n,this._deflate.write(e),this._deflate.
58
- flush(Ze.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=co.concat(this._deflate[ue],this._deflate[re]);r&&(s=new ga(s.
59
- buffer,s.byteOffset,s.length-4)),this._deflate[Ee]=null,this._deflate[re]=0,this._deflate[ue]=[],r&&this.params[`${o}_no\
60
- _context_takeover`]&&this._deflate.reset(),n(null,s)})}};po.exports=yr;function wa(t){this[ue].push(t),this[re]+=t.length}
61
- function lo(t){if(this[re]+=t.length,this[Et]._maxPayload<1||this[re]<=this[Et]._maxPayload){this[ue].push(t);return}this[Ae]=
62
- new RangeError("Max payload size exceeded"),this[Ae].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Ae][uo]=1009,this.removeListener(
63
- "data",lo),this.reset()}function ya(t){if(this[Et]._inflate=null,this[Ae]){this[Ee](this[Ae]);return}t[uo]=1007,this[Ee](
64
- t)}});var Re=$((Im,At)=>{"use strict";var{isUtf8:fo}=N("buffer"),{hasBlob:Ia}=te(),Sa=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
57
+ this._deflate[re]=0,this._deflate[ue]=[],this._deflate.on("data",xa)}this._deflate[Ae]=r,this._deflate.write(e),this._deflate.
58
+ flush(Ze.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=po.concat(this._deflate[ue],this._deflate[re]);n&&(s=new Ia(s.
59
+ buffer,s.byteOffset,s.length-4)),this._deflate[Ae]=null,this._deflate[re]=0,this._deflate[ue]=[],n&&this.params[`${o}_no\
60
+ _context_takeover`]&&this._deflate.reset(),r(null,s)})}};ho.exports=Ir;function xa(t){this[ue].push(t),this[re]+=t.length}
61
+ function mo(t){if(this[re]+=t.length,this[Et]._maxPayload<1||this[re]<=this[Et]._maxPayload){this[ue].push(t);return}this[Oe]=
62
+ new RangeError("Max payload size exceeded"),this[Oe].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Oe][fo]=1009,this.removeListener(
63
+ "data",mo),this.reset()}function ba(t){if(this[Et]._inflate=null,this[Oe]){this[Ae](this[Oe]);return}t[fo]=1007,this[Ae](
64
+ t)}});var Pe=$((xm,At)=>{"use strict";var{isUtf8:go}=M("buffer"),{hasBlob:Ta}=te(),Ca=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
65
65
  0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
66
- 1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function xa(t){return t>=
67
- 1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}function Ir(t){let e=t.length,r=0;for(;r<e;)if((t[r]&128)===
68
- 0)r++;else if((t[r]&224)===192){if(r+1===e||(t[r+1]&192)!==128||(t[r]&254)===192)return!1;r+=2}else if((t[r]&240)===224){
69
- if(r+2>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||t[r]===224&&(t[r+1]&224)===128||t[r]===237&&(t[r+1]&224)===160)return!1;
70
- r+=3}else if((t[r]&248)===240){if(r+3>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||(t[r+3]&192)!==128||t[r]===240&&(t[r+1]&
71
- 240)===128||t[r]===244&&t[r+1]>143||t[r]>244)return!1;r+=4}else return!1;return!0}function ba(t){return Ia&&typeof t=="o\
66
+ 1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function _a(t){return t>=
67
+ 1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}function Sr(t){let e=t.length,n=0;for(;n<e;)if((t[n]&128)===
68
+ 0)n++;else if((t[n]&224)===192){if(n+1===e||(t[n+1]&192)!==128||(t[n]&254)===192)return!1;n+=2}else if((t[n]&240)===224){
69
+ if(n+2>=e||(t[n+1]&192)!==128||(t[n+2]&192)!==128||t[n]===224&&(t[n+1]&224)===128||t[n]===237&&(t[n+1]&224)===160)return!1;
70
+ n+=3}else if((t[n]&248)===240){if(n+3>=e||(t[n+1]&192)!==128||(t[n+2]&192)!==128||(t[n+3]&192)!==128||t[n]===240&&(t[n+1]&
71
+ 240)===128||t[n]===244&&t[n+1]>143||t[n]>244)return!1;n+=4}else return!1;return!0}function Ea(t){return Ta&&typeof t=="o\
72
72
  bject"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&(t[Symbol.toStringTag]===
73
- "Blob"||t[Symbol.toStringTag]==="File")}At.exports={isBlob:ba,isValidStatusCode:xa,isValidUTF8:Ir,tokenChars:Sa};if(fo)At.
74
- exports.isValidUTF8=function(t){return t.length<24?Ir(t):fo(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=N("utf-8-validate");
75
- At.exports.isValidUTF8=function(e){return e.length<32?Ir(e):t(e)}}catch{}});var Cr=$((Sm,Io)=>{"use strict";var{Writable:Ta}=N("stream"),mo=Oe(),{BINARY_TYPES:Ca,EMPTY_BUFFER:ho,kStatusCode:_a,kWebSocket:Ea}=te(),
76
- {concat:Sr,toArrayBuffer:Aa,unmask:Oa}=Ye(),{isValidStatusCode:Ra,isValidUTF8:go}=Re(),Ot=Buffer[Symbol.species],G=0,vo=1,
77
- wo=2,yo=3,xr=4,br=5,Rt=6,Tr=class extends Ta{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==
78
- void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Ca[0],this._extensions=e.extensions||{},this._isServer=
73
+ "Blob"||t[Symbol.toStringTag]==="File")}At.exports={isBlob:Ea,isValidStatusCode:_a,isValidUTF8:Sr,tokenChars:Ca};if(go)At.
74
+ exports.isValidUTF8=function(t){return t.length<24?Sr(t):go(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=M("utf-8-validate");
75
+ At.exports.isValidUTF8=function(e){return e.length<32?Sr(e):t(e)}}catch{}});var _r=$((bm,bo)=>{"use strict";var{Writable:Aa}=M("stream"),vo=Re(),{BINARY_TYPES:Oa,EMPTY_BUFFER:wo,kStatusCode:Ra,kWebSocket:Pa}=te(),
76
+ {concat:xr,toArrayBuffer:ka,unmask:Ma}=Ye(),{isValidStatusCode:Na,isValidUTF8:yo}=Pe(),Ot=Buffer[Symbol.species],G=0,Io=1,
77
+ So=2,xo=3,br=4,Tr=5,Rt=6,Cr=class extends Aa{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==
78
+ void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Oa[0],this._extensions=e.extensions||{},this._isServer=
79
79
  !!e.isServer,this._maxBufferedChunks=e.maxBufferedChunks|0,this._maxFragments=e.maxFragments|0,this._maxPayload=e.maxPayload|
80
- 0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Ea]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=
80
+ 0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Pa]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=
81
81
  !1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=
82
- 0,this._messageLength=0,this._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=G}_write(e,r,n){
83
- if(this._opcode===8&&this._state==G)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){
84
- n(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=
85
- e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this.
86
- _buffers.shift();if(e<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new Ot(n.buffer,n.byteOffset+
87
- e,n.length-e),new Ot(n.buffer,n.byteOffset,e)}let r=Buffer.allocUnsafe(e);do{let n=this._buffers[0],o=r.length-e;e>=n.length?
88
- r.set(this._buffers.shift(),o):(r.set(new Uint8Array(n.buffer,n.byteOffset,e),o),this._buffers[0]=new Ot(n.buffer,n.byteOffset+
89
- e,n.length-e)),e-=n.length}while(e>0);return r}startLoop(e){this._loop=!0;do switch(this._state){case G:this.getInfo(e);
90
- break;case vo:this.getPayloadLength16(e);break;case wo:this.getPayloadLength64(e);break;case yo:this.getMask();break;case xr:
91
- this.getData(e);break;case br:case Rt:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<
92
- 2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let o=this.createError(RangeError,"RSV2 and RSV3 must be\
93
- clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(o);return}let n=(r[0]&64)===64;if(n&&!this._extensions[mo.extensionName]){
94
- let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(o);return}if(this._fin=(r[0]&
95
- 128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let o=this.createError(RangeError,"\
82
+ 0,this._messageLength=0,this._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=G}_write(e,n,r){
83
+ if(this._opcode===8&&this._state==G)return r();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){
84
+ r(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=
85
+ e.length,this._buffers.push(e),this.startLoop(r)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this.
86
+ _buffers.shift();if(e<this._buffers[0].length){let r=this._buffers[0];return this._buffers[0]=new Ot(r.buffer,r.byteOffset+
87
+ e,r.length-e),new Ot(r.buffer,r.byteOffset,e)}let n=Buffer.allocUnsafe(e);do{let r=this._buffers[0],o=n.length-e;e>=r.length?
88
+ n.set(this._buffers.shift(),o):(n.set(new Uint8Array(r.buffer,r.byteOffset,e),o),this._buffers[0]=new Ot(r.buffer,r.byteOffset+
89
+ e,r.length-e)),e-=r.length}while(e>0);return n}startLoop(e){this._loop=!0;do switch(this._state){case G:this.getInfo(e);
90
+ break;case Io:this.getPayloadLength16(e);break;case So:this.getPayloadLength64(e);break;case xo:this.getMask();break;case br:
91
+ this.getData(e);break;case Tr:case Rt:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<
92
+ 2){this._loop=!1;return}let n=this.consume(2);if((n[0]&48)!==0){let o=this.createError(RangeError,"RSV2 and RSV3 must be\
93
+ clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(o);return}let r=(n[0]&64)===64;if(r&&!this._extensions[vo.extensionName]){
94
+ let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(o);return}if(this._fin=(n[0]&
95
+ 128)===128,this._opcode=n[0]&15,this._payloadLength=n[1]&127,this._opcode===0){if(r){let o=this.createError(RangeError,"\
96
96
  RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(o);return}if(!this._fragmented){let o=this.createError(RangeError,
97
97
  "invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(o);return}this._opcode=this._fragmented}else if(this._opcode===1||
98
98
  this._opcode===2){if(this._fragmented){let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ER\
99
- R_INVALID_OPCODE");e(o);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let o=this.createError(
100
- RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(o);return}if(n){let o=this.createError(RangeError,"RSV1 mu\
99
+ R_INVALID_OPCODE");e(o);return}this._compressed=r}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let o=this.createError(
100
+ RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(o);return}if(r){let o=this.createError(RangeError,"RSV1 mu\
101
101
  st be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(o);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===
102
102
  1){let o=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAY\
103
103
  LOAD_LENGTH");e(o);return}}else{let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVAL\
104
- ID_OPCODE");e(o);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,
104
+ ID_OPCODE");e(o);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(n[1]&128)===128,
105
105
  this._isServer){if(!this._masked){let o=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(
106
106
  o);return}}else if(this._masked){let o=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");
107
- e(o);return}this._payloadLength===126?this._state=vo:this._payloadLength===127?this._state=wo:this.haveLength(e)}getPayloadLength16(e){
107
+ e(o);return}this._payloadLength===126?this._state=Io:this._payloadLength===127?this._state=So:this.haveLength(e)}getPayloadLength16(e){
108
108
  if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){
109
- if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let o=this.
109
+ if(this._bufferedBytes<8){this._loop=!1;return}let n=this.consume(8),r=n.readUInt32BE(0);if(r>Math.pow(2,21)-1){let o=this.
110
110
  createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD\
111
- _LENGTH");e(o);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&
111
+ _LENGTH");e(o);return}this._payloadLength=r*Math.pow(2,32)+n.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&
112
112
  this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>
113
- 0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(r);return}
114
- this._masked?this._state=yo:this._state=xr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(
115
- 4),this._state=xr}getData(e){let r=ho;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;
116
- return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&
117
- Oa(r,this._mask)}if(this._opcode>7){this.controlMessage(r,e);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){
118
- let n=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");e(n);return}if(this.
119
- _compressed){this._state=br,this.decompress(r,e);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.
120
- push(r)),this.dataMessage(e)}decompress(e,r){this._extensions[mo.extensionName].decompress(e,this._fin,(o,s)=>{if(o)return r(
113
+ 0)){let n=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(n);return}
114
+ this._masked?this._state=xo:this._state=br}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(
115
+ 4),this._state=br}getData(e){let n=wo;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;
116
+ return}n=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&
117
+ Ma(n,this._mask)}if(this._opcode>7){this.controlMessage(n,e);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){
118
+ let r=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");e(r);return}if(this.
119
+ _compressed){this._state=Tr,this.decompress(n,e);return}n.length&&(this._messageLength=this._totalPayloadLength,this._fragments.
120
+ push(n)),this.dataMessage(e)}decompress(e,n){this._extensions[vo.extensionName].decompress(e,this._fin,(o,s)=>{if(o)return n(
121
121
  o);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let i=this.createError(
122
- RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(i);return}this._fragments.push(s)}
123
- this.dataMessage(r),this._state===G&&this.startLoop(r)})}dataMessage(e){if(!this._fin){this._state=G;return}let r=this._messageLength,
124
- n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=
125
- [],this._opcode===2){let o;this._binaryType==="nodebuffer"?o=Sr(n,r):this._binaryType==="arraybuffer"?o=Aa(Sr(n,r)):this.
126
- _binaryType==="blob"?o=new Blob(n):o=n,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=G):(this._state=
127
- Rt,setImmediate(()=>{this.emit("message",o,!0),this._state=G,this.startLoop(e)}))}else{let o=Sr(n,r);if(!this._skipUTF8Validation&&
128
- !go(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(s);return}this._state===br||
122
+ RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");n(i);return}this._fragments.push(s)}
123
+ this.dataMessage(n),this._state===G&&this.startLoop(n)})}dataMessage(e){if(!this._fin){this._state=G;return}let n=this._messageLength,
124
+ r=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=
125
+ [],this._opcode===2){let o;this._binaryType==="nodebuffer"?o=xr(r,n):this._binaryType==="arraybuffer"?o=ka(xr(r,n)):this.
126
+ _binaryType==="blob"?o=new Blob(r):o=r,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=G):(this._state=
127
+ Rt,setImmediate(()=>{this.emit("message",o,!0),this._state=G,this.startLoop(e)}))}else{let o=xr(r,n);if(!this._skipUTF8Validation&&
128
+ !yo(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(s);return}this._state===Tr||
129
129
  this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=G):(this._state=Rt,setImmediate(()=>{this.emit("mess\
130
- age",o,!1),this._state=G,this.startLoop(e)}))}}controlMessage(e,r){if(this._opcode===8){if(e.length===0)this._loop=!1,this.
131
- emit("conclude",1005,ho),this.end();else{let n=e.readUInt16BE(0);if(!Ra(n)){let s=this.createError(RangeError,`invalid s\
132
- tatus code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(s);return}let o=new Ot(e.buffer,e.byteOffset+2,e.length-2);if(!this.
133
- _skipUTF8Validation&&!go(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(s);return}
134
- this._loop=!1,this.emit("conclude",n,o),this.end()}this._state=G;return}this._allowSynchronousEvents?(this.emit(this._opcode===
130
+ age",o,!1),this._state=G,this.startLoop(e)}))}}controlMessage(e,n){if(this._opcode===8){if(e.length===0)this._loop=!1,this.
131
+ emit("conclude",1005,wo),this.end();else{let r=e.readUInt16BE(0);if(!Na(r)){let s=this.createError(RangeError,`invalid s\
132
+ tatus code ${r}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");n(s);return}let o=new Ot(e.buffer,e.byteOffset+2,e.length-2);if(!this.
133
+ _skipUTF8Validation&&!yo(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");n(s);return}
134
+ this._loop=!1,this.emit("conclude",r,o),this.end()}this._state=G;return}this._allowSynchronousEvents?(this.emit(this._opcode===
135
135
  9?"ping":"pong",e),this._state=G):(this._state=Rt,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=
136
- G,this.startLoop(r)}))}createError(e,r,n,o,s){this._loop=!1,this._errored=!0;let i=new e(n?`Invalid WebSocket frame: ${r}`:
137
- r);return Error.captureStackTrace(i,this.createError),i.code=s,i[_a]=o,i}};Io.exports=Tr});var Ar=$((bm,bo)=>{"use strict";var{Duplex:xm}=N("stream"),{randomFillSync:Pa}=N("crypto"),{types:{isUint8Array:ka}}=N("util"),
138
- So=Oe(),{EMPTY_BUFFER:Na,kWebSocket:Ma,NOOP:ja}=te(),{isBlob:Pe,isValidStatusCode:Da}=Re(),{mask:xo,toBuffer:ve}=Ye(),W=Symbol(
139
- "kByteLength"),za=Buffer.alloc(4),Pt=8*1024,we,ke=Pt,Z=0,La=1,Ua=2,_r=class t{constructor(e,r,n){this._extensions=r||{},
140
- n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this.
141
- _bufferedBytes=0,this._queue=[],this._state=Z,this.onerror=ja,this[Ma]=void 0}static frame(e,r){let n,o=!1,s=2,i=!1;r.mask&&
142
- (n=r.maskBuffer||za,r.generateMask?r.generateMask(n):(ke===Pt&&(we===void 0&&(we=Buffer.alloc(Pt)),Pa(we,0,Pt),ke=0),n[0]=
143
- we[ke++],n[1]=we[ke++],n[2]=we[ke++],n[3]=we[ke++]),i=(n[0]|n[1]|n[2]|n[3])===0,s=6);let a;typeof e=="string"?(!r.mask||
144
- i)&&r[W]!==void 0?a=r[W]:(e=Buffer.from(e),a=e.length):(a=e.length,o=r.mask&&r.readOnly&&!i);let c=a;a>=65536?(s+=8,c=127):
145
- a>125&&(s+=2,c=126);let d=Buffer.allocUnsafe(o?a+s:s);return d[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(d[0]|=64),d[1]=c,
146
- c===126?d.writeUInt16BE(a,2):c===127&&(d[2]=d[3]=0,d.writeUIntBE(a,4,6)),r.mask?(d[1]|=128,d[s-4]=n[0],d[s-3]=n[1],d[s-2]=
147
- n[2],d[s-1]=n[3],i?[d,e]:o?(xo(e,n,d,s,a),[d]):(xo(e,n,e,0,a),[d,e])):[d,e]}close(e,r,n,o){let s;if(e===void 0)s=Na;else{
148
- if(typeof e!="number"||!Da(e))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.
149
- length)s=Buffer.allocUnsafe(2),s.writeUInt16BE(e,0);else{let a=Buffer.byteLength(r);if(a>123)throw new RangeError("The m\
150
- essage must not be greater than 123 bytes");if(s=Buffer.allocUnsafe(2+a),s.writeUInt16BE(e,0),typeof r=="string")s.write(
151
- r,2);else if(ka(r))s.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let i={[W]:s.
152
- length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==
153
- Z?this.enqueue([this.dispatch,s,!1,i,o]):this.sendFrame(t.frame(s,i),o)}ping(e,r,n){let o,s;if(typeof e=="string"?(o=Buffer.
154
- byteLength(e),s=!1):Pe(e)?(o=e.size,s=!1):(e=ve(e),o=e.length,s=ve.readOnly),o>125)throw new RangeError("The data size m\
155
- ust not be greater than 125 bytes");let i={[W]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,
156
- opcode:9,readOnly:s,rsv1:!1};Pe(e)?this._state!==Z?this.enqueue([this.getBlobData,e,!1,i,n]):this.getBlobData(e,!1,i,n):
157
- this._state!==Z?this.enqueue([this.dispatch,e,!1,i,n]):this.sendFrame(t.frame(e,i),n)}pong(e,r,n){let o,s;if(typeof e=="\
158
- string"?(o=Buffer.byteLength(e),s=!1):Pe(e)?(o=e.size,s=!1):(e=ve(e),o=e.length,s=ve.readOnly),o>125)throw new RangeError(
159
- "The data size must not be greater than 125 bytes");let i={[W]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this.
160
- _maskBuffer,opcode:10,readOnly:s,rsv1:!1};Pe(e)?this._state!==Z?this.enqueue([this.getBlobData,e,!1,i,n]):this.getBlobData(
161
- e,!1,i,n):this._state!==Z?this.enqueue([this.dispatch,e,!1,i,n]):this.sendFrame(t.frame(e,i),n)}send(e,r,n){let o=this._extensions[So.
162
- extensionName],s=r.binary?2:1,i=r.compress,a,c;typeof e=="string"?(a=Buffer.byteLength(e),c=!1):Pe(e)?(a=e.size,c=!1):(e=
136
+ G,this.startLoop(n)}))}createError(e,n,r,o,s){this._loop=!1,this._errored=!0;let i=new e(r?`Invalid WebSocket frame: ${n}`:
137
+ n);return Error.captureStackTrace(i,this.createError),i.code=s,i[Ra]=o,i}};bo.exports=Cr});var Or=$((Cm,_o)=>{"use strict";var{Duplex:Tm}=M("stream"),{randomFillSync:ja}=M("crypto"),{types:{isUint8Array:Da}}=M("util"),
138
+ To=Re(),{EMPTY_BUFFER:za,kWebSocket:La,NOOP:Ua}=te(),{isBlob:ke,isValidStatusCode:Fa}=Pe(),{mask:Co,toBuffer:ve}=Ye(),W=Symbol(
139
+ "kByteLength"),qa=Buffer.alloc(4),Pt=8*1024,we,Me=Pt,Z=0,$a=1,Ba=2,Er=class t{constructor(e,n,r){this._extensions=n||{},
140
+ r&&(this._generateMask=r,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this.
141
+ _bufferedBytes=0,this._queue=[],this._state=Z,this.onerror=Ua,this[La]=void 0}static frame(e,n){let r,o=!1,s=2,i=!1;n.mask&&
142
+ (r=n.maskBuffer||qa,n.generateMask?n.generateMask(r):(Me===Pt&&(we===void 0&&(we=Buffer.alloc(Pt)),ja(we,0,Pt),Me=0),r[0]=
143
+ we[Me++],r[1]=we[Me++],r[2]=we[Me++],r[3]=we[Me++]),i=(r[0]|r[1]|r[2]|r[3])===0,s=6);let a;typeof e=="string"?(!n.mask||
144
+ i)&&n[W]!==void 0?a=n[W]:(e=Buffer.from(e),a=e.length):(a=e.length,o=n.mask&&n.readOnly&&!i);let c=a;a>=65536?(s+=8,c=127):
145
+ a>125&&(s+=2,c=126);let d=Buffer.allocUnsafe(o?a+s:s);return d[0]=n.fin?n.opcode|128:n.opcode,n.rsv1&&(d[0]|=64),d[1]=c,
146
+ c===126?d.writeUInt16BE(a,2):c===127&&(d[2]=d[3]=0,d.writeUIntBE(a,4,6)),n.mask?(d[1]|=128,d[s-4]=r[0],d[s-3]=r[1],d[s-2]=
147
+ r[2],d[s-1]=r[3],i?[d,e]:o?(Co(e,r,d,s,a),[d]):(Co(e,r,e,0,a),[d,e])):[d,e]}close(e,n,r,o){let s;if(e===void 0)s=za;else{
148
+ if(typeof e!="number"||!Fa(e))throw new TypeError("First argument must be a valid error code number");if(n===void 0||!n.
149
+ length)s=Buffer.allocUnsafe(2),s.writeUInt16BE(e,0);else{let a=Buffer.byteLength(n);if(a>123)throw new RangeError("The m\
150
+ essage must not be greater than 123 bytes");if(s=Buffer.allocUnsafe(2+a),s.writeUInt16BE(e,0),typeof n=="string")s.write(
151
+ n,2);else if(Da(n))s.set(n,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let i={[W]:s.
152
+ length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==
153
+ Z?this.enqueue([this.dispatch,s,!1,i,o]):this.sendFrame(t.frame(s,i),o)}ping(e,n,r){let o,s;if(typeof e=="string"?(o=Buffer.
154
+ byteLength(e),s=!1):ke(e)?(o=e.size,s=!1):(e=ve(e),o=e.length,s=ve.readOnly),o>125)throw new RangeError("The data size m\
155
+ ust not be greater than 125 bytes");let i={[W]:o,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,
156
+ opcode:9,readOnly:s,rsv1:!1};ke(e)?this._state!==Z?this.enqueue([this.getBlobData,e,!1,i,r]):this.getBlobData(e,!1,i,r):
157
+ this._state!==Z?this.enqueue([this.dispatch,e,!1,i,r]):this.sendFrame(t.frame(e,i),r)}pong(e,n,r){let o,s;if(typeof e=="\
158
+ string"?(o=Buffer.byteLength(e),s=!1):ke(e)?(o=e.size,s=!1):(e=ve(e),o=e.length,s=ve.readOnly),o>125)throw new RangeError(
159
+ "The data size must not be greater than 125 bytes");let i={[W]:o,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this.
160
+ _maskBuffer,opcode:10,readOnly:s,rsv1:!1};ke(e)?this._state!==Z?this.enqueue([this.getBlobData,e,!1,i,r]):this.getBlobData(
161
+ e,!1,i,r):this._state!==Z?this.enqueue([this.dispatch,e,!1,i,r]):this.sendFrame(t.frame(e,i),r)}send(e,n,r){let o=this._extensions[To.
162
+ extensionName],s=n.binary?2:1,i=n.compress,a,c;typeof e=="string"?(a=Buffer.byteLength(e),c=!1):ke(e)?(a=e.size,c=!1):(e=
163
163
  ve(e),a=e.length,c=ve.readOnly),this._firstFragment?(this._firstFragment=!1,i&&o&&o.params[o._isServer?"server_no_contex\
164
- t_takeover":"client_no_context_takeover"]&&(i=a>=o._threshold),this._compress=i):(i=!1,s=0),r.fin&&(this._firstFragment=
165
- !0);let d={[W]:a,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:c,rsv1:i};
166
- Pe(e)?this._state!==Z?this.enqueue([this.getBlobData,e,this._compress,d,n]):this.getBlobData(e,this._compress,d,n):this.
167
- _state!==Z?this.enqueue([this.dispatch,e,this._compress,d,n]):this.dispatch(e,this._compress,d,n)}getBlobData(e,r,n,o){this.
168
- _bufferedBytes+=n[W],this._state=Ua,e.arrayBuffer().then(s=>{if(this._socket.destroyed){let a=new Error("The socket was \
169
- closed while the blob was being read");process.nextTick(Er,this,a,o);return}this._bufferedBytes-=n[W];let i=ve(s);r?this.
170
- dispatch(i,r,n,o):(this._state=Z,this.sendFrame(t.frame(i,n),o),this.dequeue())}).catch(s=>{process.nextTick(Fa,this,s,o)})}dispatch(e,r,n,o){
171
- if(!r){this.sendFrame(t.frame(e,n),o);return}let s=this._extensions[So.extensionName];this._bufferedBytes+=n[W],this._state=
172
- La,s.compress(e,n.fin,(i,a)=>{if(this._socket.destroyed){let c=new Error("The socket was closed while data was being com\
173
- pressed");Er(this,c,o);return}this._bufferedBytes-=n[W],this._state=Z,n.readOnly=!1,this.sendFrame(t.frame(a,n),o),this.
164
+ t_takeover":"client_no_context_takeover"]&&(i=a>=o._threshold),this._compress=i):(i=!1,s=0),n.fin&&(this._firstFragment=
165
+ !0);let d={[W]:a,fin:n.fin,generateMask:this._generateMask,mask:n.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:c,rsv1:i};
166
+ ke(e)?this._state!==Z?this.enqueue([this.getBlobData,e,this._compress,d,r]):this.getBlobData(e,this._compress,d,r):this.
167
+ _state!==Z?this.enqueue([this.dispatch,e,this._compress,d,r]):this.dispatch(e,this._compress,d,r)}getBlobData(e,n,r,o){this.
168
+ _bufferedBytes+=r[W],this._state=Ba,e.arrayBuffer().then(s=>{if(this._socket.destroyed){let a=new Error("The socket was \
169
+ closed while the blob was being read");process.nextTick(Ar,this,a,o);return}this._bufferedBytes-=r[W];let i=ve(s);n?this.
170
+ dispatch(i,n,r,o):(this._state=Z,this.sendFrame(t.frame(i,r),o),this.dequeue())}).catch(s=>{process.nextTick(Ha,this,s,o)})}dispatch(e,n,r,o){
171
+ if(!n){this.sendFrame(t.frame(e,r),o);return}let s=this._extensions[To.extensionName];this._bufferedBytes+=r[W],this._state=
172
+ $a,s.compress(e,r.fin,(i,a)=>{if(this._socket.destroyed){let c=new Error("The socket was closed while data was being com\
173
+ pressed");Ar(this,c,o);return}this._bufferedBytes-=r[W],this._state=Z,r.readOnly=!1,this.sendFrame(t.frame(a,r),o),this.
174
174
  dequeue()})}dequeue(){for(;this._state===Z&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][W],
175
- Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][W],this._queue.push(e)}sendFrame(e,r){e.length===
176
- 2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],r),this._socket.uncork()):this._socket.write(e[0],
177
- r)}};bo.exports=_r;function Er(t,e,r){typeof r=="function"&&r(e);for(let n=0;n<t._queue.length;n++){let o=t._queue[n],s=o[o.
178
- length-1];typeof s=="function"&&s(e)}}function Fa(t,e,r){Er(t,e,r),t.onerror(e)}});var ko=$((Tm,Po)=>{"use strict";var{kForOnEventAttribute:Qe,kListener:Or}=te(),To=Symbol("kCode"),Co=Symbol("kData"),_o=Symbol(
179
- "kError"),Eo=Symbol("kMessage"),Ao=Symbol("kReason"),Ne=Symbol("kTarget"),Oo=Symbol("kType"),Ro=Symbol("kWasClean"),ne=class{constructor(e){
180
- this[Ne]=null,this[Oo]=e}get target(){return this[Ne]}get type(){return this[Oo]}};Object.defineProperty(ne.prototype,"t\
181
- arget",{enumerable:!0});Object.defineProperty(ne.prototype,"type",{enumerable:!0});var ye=class extends ne{constructor(e,r={}){
182
- super(e),this[To]=r.code===void 0?0:r.code,this[Ao]=r.reason===void 0?"":r.reason,this[Ro]=r.wasClean===void 0?!1:r.wasClean}get code(){
183
- return this[To]}get reason(){return this[Ao]}get wasClean(){return this[Ro]}};Object.defineProperty(ye.prototype,"code",
175
+ Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][W],this._queue.push(e)}sendFrame(e,n){e.length===
176
+ 2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],n),this._socket.uncork()):this._socket.write(e[0],
177
+ n)}};_o.exports=Er;function Ar(t,e,n){typeof n=="function"&&n(e);for(let r=0;r<t._queue.length;r++){let o=t._queue[r],s=o[o.
178
+ length-1];typeof s=="function"&&s(e)}}function Ha(t,e,n){Ar(t,e,n),t.onerror(e)}});var jo=$((_m,No)=>{"use strict";var{kForOnEventAttribute:Qe,kListener:Rr}=te(),Eo=Symbol("kCode"),Ao=Symbol("kData"),Oo=Symbol(
179
+ "kError"),Ro=Symbol("kMessage"),Po=Symbol("kReason"),Ne=Symbol("kTarget"),ko=Symbol("kType"),Mo=Symbol("kWasClean"),ne=class{constructor(e){
180
+ this[Ne]=null,this[ko]=e}get target(){return this[Ne]}get type(){return this[ko]}};Object.defineProperty(ne.prototype,"t\
181
+ arget",{enumerable:!0});Object.defineProperty(ne.prototype,"type",{enumerable:!0});var ye=class extends ne{constructor(e,n={}){
182
+ super(e),this[Eo]=n.code===void 0?0:n.code,this[Po]=n.reason===void 0?"":n.reason,this[Mo]=n.wasClean===void 0?!1:n.wasClean}get code(){
183
+ return this[Eo]}get reason(){return this[Po]}get wasClean(){return this[Mo]}};Object.defineProperty(ye.prototype,"code",
184
184
  {enumerable:!0});Object.defineProperty(ye.prototype,"reason",{enumerable:!0});Object.defineProperty(ye.prototype,"wasCle\
185
- an",{enumerable:!0});var Me=class extends ne{constructor(e,r={}){super(e),this[_o]=r.error===void 0?null:r.error,this[Eo]=
186
- r.message===void 0?"":r.message}get error(){return this[_o]}get message(){return this[Eo]}};Object.defineProperty(Me.prototype,
187
- "error",{enumerable:!0});Object.defineProperty(Me.prototype,"message",{enumerable:!0});var et=class extends ne{constructor(e,r={}){
188
- super(e),this[Co]=r.data===void 0?null:r.data}get data(){return this[Co]}};Object.defineProperty(et.prototype,"data",{enumerable:!0});
189
- var qa={addEventListener(t,e,r={}){for(let o of this.listeners(t))if(!r[Qe]&&o[Or]===e&&!o[Qe])return;let n;if(t==="mess\
190
- age")n=function(s,i){let a=new et("message",{data:i?s:s.toString()});a[Ne]=this,kt(e,this,a)};else if(t==="close")n=function(s,i){
185
+ an",{enumerable:!0});var je=class extends ne{constructor(e,n={}){super(e),this[Oo]=n.error===void 0?null:n.error,this[Ro]=
186
+ n.message===void 0?"":n.message}get error(){return this[Oo]}get message(){return this[Ro]}};Object.defineProperty(je.prototype,
187
+ "error",{enumerable:!0});Object.defineProperty(je.prototype,"message",{enumerable:!0});var et=class extends ne{constructor(e,n={}){
188
+ super(e),this[Ao]=n.data===void 0?null:n.data}get data(){return this[Ao]}};Object.defineProperty(et.prototype,"data",{enumerable:!0});
189
+ var Va={addEventListener(t,e,n={}){for(let o of this.listeners(t))if(!n[Qe]&&o[Rr]===e&&!o[Qe])return;let r;if(t==="mess\
190
+ age")r=function(s,i){let a=new et("message",{data:i?s:s.toString()});a[Ne]=this,kt(e,this,a)};else if(t==="close")r=function(s,i){
191
191
  let a=new ye("close",{code:s,reason:i.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[Ne]=this,kt(
192
- e,this,a)};else if(t==="error")n=function(s){let i=new Me("error",{error:s,message:s.message});i[Ne]=this,kt(e,this,i)};else if(t===
193
- "open")n=function(){let s=new ne("open");s[Ne]=this,kt(e,this,s)};else return;n[Qe]=!!r[Qe],n[Or]=e,r.once?this.once(t,n):
194
- this.on(t,n)},removeEventListener(t,e){for(let r of this.listeners(t))if(r[Or]===e&&!r[Qe]){this.removeListener(t,r);break}}};
195
- Po.exports={CloseEvent:ye,ErrorEvent:Me,Event:ne,EventTarget:qa,MessageEvent:et};function kt(t,e,r){typeof t=="object"&&
196
- t.handleEvent?t.handleEvent.call(t,r):t.call(e,r)}});var Nt=$((Cm,No)=>{"use strict";var{tokenChars:tt}=Re();function ee(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}function $a(t){
197
- let e=Object.create(null),r=Object.create(null),n=!1,o=!1,s=!1,i,a,c=-1,d=-1,p=-1,m=0;for(;m<t.length;m++)if(d=t.charCodeAt(
192
+ e,this,a)};else if(t==="error")r=function(s){let i=new je("error",{error:s,message:s.message});i[Ne]=this,kt(e,this,i)};else if(t===
193
+ "open")r=function(){let s=new ne("open");s[Ne]=this,kt(e,this,s)};else return;r[Qe]=!!n[Qe],r[Rr]=e,n.once?this.once(t,r):
194
+ this.on(t,r)},removeEventListener(t,e){for(let n of this.listeners(t))if(n[Rr]===e&&!n[Qe]){this.removeListener(t,n);break}}};
195
+ No.exports={CloseEvent:ye,ErrorEvent:je,Event:ne,EventTarget:Va,MessageEvent:et};function kt(t,e,n){typeof t=="object"&&
196
+ t.handleEvent?t.handleEvent.call(t,n):t.call(e,n)}});var Mt=$((Em,Do)=>{"use strict";var{tokenChars:tt}=Pe();function ee(t,e,n){t[e]===void 0?t[e]=[n]:t[e].push(n)}function Ga(t){
197
+ let e=Object.create(null),n=Object.create(null),r=!1,o=!1,s=!1,i,a,c=-1,d=-1,p=-1,m=0;for(;m<t.length;m++)if(d=t.charCodeAt(
198
198
  m),i===void 0)if(p===-1&&tt[d]===1)c===-1&&(c=m);else if(m!==0&&(d===32||d===9))p===-1&&c!==-1&&(p=m);else if(d===59||d===
199
199
  44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${m}`);p===-1&&(p=m);let v=t.slice(c,p);d===44?(ee(e,
200
- v,r),r=Object.create(null)):i=v,c=p=-1}else throw new SyntaxError(`Unexpected character at index ${m}`);else if(a===void 0)
200
+ v,n),n=Object.create(null)):i=v,c=p=-1}else throw new SyntaxError(`Unexpected character at index ${m}`);else if(a===void 0)
201
201
  if(p===-1&&tt[d]===1)c===-1&&(c=m);else if(d===32||d===9)p===-1&&c!==-1&&(p=m);else if(d===59||d===44){if(c===-1)throw new SyntaxError(
202
- `Unexpected character at index ${m}`);p===-1&&(p=m),ee(r,t.slice(c,p),!0),d===44&&(ee(e,i,r),r=Object.create(null),i=void 0),
202
+ `Unexpected character at index ${m}`);p===-1&&(p=m),ee(n,t.slice(c,p),!0),d===44&&(ee(e,i,n),n=Object.create(null),i=void 0),
203
203
  c=p=-1}else if(d===61&&c!==-1&&p===-1)a=t.slice(c,m),c=p=-1;else throw new SyntaxError(`Unexpected character at index ${m}`);else if(o){
204
- if(tt[d]!==1)throw new SyntaxError(`Unexpected character at index ${m}`);c===-1?c=m:n||(n=!0),o=!1}else if(s)if(tt[d]===
204
+ if(tt[d]!==1)throw new SyntaxError(`Unexpected character at index ${m}`);c===-1?c=m:r||(r=!0),o=!1}else if(s)if(tt[d]===
205
205
  1)c===-1&&(c=m);else if(d===34&&c!==-1)s=!1,p=m;else if(d===92)o=!0;else throw new SyntaxError(`Unexpected character at \
206
206
  index ${m}`);else if(d===34&&t.charCodeAt(m-1)===61)s=!0;else if(p===-1&&tt[d]===1)c===-1&&(c=m);else if(c!==-1&&(d===32||
207
207
  d===9))p===-1&&(p=m);else if(d===59||d===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${m}`);p===-1&&
208
- (p=m);let v=t.slice(c,p);n&&(v=v.replace(/\\/g,""),n=!1),ee(r,a,v),d===44&&(ee(e,i,r),r=Object.create(null),i=void 0),a=
208
+ (p=m);let v=t.slice(c,p);r&&(v=v.replace(/\\/g,""),r=!1),ee(n,a,v),d===44&&(ee(e,i,n),n=Object.create(null),i=void 0),a=
209
209
  void 0,c=p=-1}else throw new SyntaxError(`Unexpected character at index ${m}`);if(c===-1||s||d===32||d===9)throw new SyntaxError(
210
- "Unexpected end of input");p===-1&&(p=m);let l=t.slice(c,p);return i===void 0?ee(e,l,r):(a===void 0?ee(r,l,!0):n?ee(r,a,
211
- l.replace(/\\/g,"")):ee(r,a,l),ee(e,i,r)),e}function Ba(t){return Object.keys(t).map(e=>{let r=t[e];return Array.isArray(
212
- r)||(r=[r]),r.map(n=>[e].concat(Object.keys(n).map(o=>{let s=n[o];return Array.isArray(s)||(s=[s]),s.map(i=>i===!0?o:`${o}\
213
- =${i}`).join("; ")})).join("; ")).join(", ")}).join(", ")}No.exports={format:Ba,parse:$a}});var zt=$((Am,Vo)=>{"use strict";var Ha=N("events"),Va=N("https"),Ga=N("http"),Do=N("net"),Wa=N("tls"),{randomBytes:Ka,createHash:Ja}=N("crypto"),
214
- {Duplex:_m,Readable:Em}=N("stream"),{URL:Rr}=N("url"),le=Oe(),Xa=Cr(),Ya=Ar(),{isBlob:Za}=Re(),{BINARY_TYPES:Mo,CLOSE_TIMEOUT:Qa,
215
- EMPTY_BUFFER:Mt,GUID:ec,kForOnEventAttribute:Pr,kListener:tc,kStatusCode:rc,kWebSocket:z,NOOP:zo}=te(),{EventTarget:{addEventListener:nc,
216
- removeEventListener:oc}}=ko(),{format:sc,parse:ic}=Nt(),{toBuffer:ac}=Ye(),Lo=Symbol("kAborted"),kr=[8,13],oe=["CONNECTI\
217
- NG","OPEN","CLOSING","CLOSED"],cc=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,k=class t extends Ha{constructor(e,r,n){super(),this.
218
- _binaryType=Mo[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Mt,this._closeTimer=
210
+ "Unexpected end of input");p===-1&&(p=m);let l=t.slice(c,p);return i===void 0?ee(e,l,n):(a===void 0?ee(n,l,!0):r?ee(n,a,
211
+ l.replace(/\\/g,"")):ee(n,a,l),ee(e,i,n)),e}function Wa(t){return Object.keys(t).map(e=>{let n=t[e];return Array.isArray(
212
+ n)||(n=[n]),n.map(r=>[e].concat(Object.keys(r).map(o=>{let s=r[o];return Array.isArray(s)||(s=[s]),s.map(i=>i===!0?o:`${o}\
213
+ =${i}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Do.exports={format:Wa,parse:Ga}});var zt=$((Rm,Ko)=>{"use strict";var Ka=M("events"),Ja=M("https"),Xa=M("http"),Uo=M("net"),Ya=M("tls"),{randomBytes:Za,createHash:Qa}=M("crypto"),
214
+ {Duplex:Am,Readable:Om}=M("stream"),{URL:Pr}=M("url"),le=Re(),ec=_r(),tc=Or(),{isBlob:rc}=Pe(),{BINARY_TYPES:zo,CLOSE_TIMEOUT:nc,
215
+ EMPTY_BUFFER:Nt,GUID:oc,kForOnEventAttribute:kr,kListener:sc,kStatusCode:ic,kWebSocket:L,NOOP:Fo}=te(),{EventTarget:{addEventListener:ac,
216
+ removeEventListener:cc}}=jo(),{format:dc,parse:uc}=Mt(),{toBuffer:lc}=Ye(),qo=Symbol("kAborted"),Mr=[8,13],oe=["CONNECTI\
217
+ NG","OPEN","CLOSING","CLOSED"],pc=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,k=class t extends Ka{constructor(e,n,r){super(),this.
218
+ _binaryType=zo[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Nt,this._closeTimer=
219
219
  null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=t.CONNECTING,this._receiver=
220
- null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?
221
- r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),Uo(this,e,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=
222
- n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Mo.includes(e)&&(this._binaryType=
220
+ null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?
221
+ n=[]:Array.isArray(n)||(typeof n=="object"&&n!==null?(r=n,n=[]):n=[n]),$o(this,e,n,r)):(this._autoPong=r.autoPong,this._closeTimeout=
222
+ r.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){zo.includes(e)&&(this._binaryType=
223
223
  e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+
224
224
  this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){
225
225
  return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){
226
- return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,r,n){let o=new Xa(
227
- {allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,
228
- maxBufferedChunks:n.maxBufferedChunks,maxFragments:n.maxFragments,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),
229
- s=new Ya(e,this._extensions,n.generateMask);this._receiver=o,this._sender=s,this._socket=e,o[z]=this,s[z]=this,e[z]=this,
230
- o.on("conclude",lc),o.on("drain",pc),o.on("error",fc),o.on("message",mc),o.on("ping",hc),o.on("pong",gc),s.onerror=vc,e.
231
- setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),r.length>0&&e.unshift(r),e.on("close",$o),e.on("data",Dt),e.on(
232
- "end",Bo),e.on("error",Ho),this._readyState=t.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=t.CLOSED,
226
+ return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,n,r){let o=new ec(
227
+ {allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,
228
+ maxBufferedChunks:r.maxBufferedChunks,maxFragments:r.maxFragments,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),
229
+ s=new tc(e,this._extensions,r.generateMask);this._receiver=o,this._sender=s,this._socket=e,o[L]=this,s[L]=this,e[L]=this,
230
+ o.on("conclude",hc),o.on("drain",gc),o.on("error",vc),o.on("message",wc),o.on("ping",yc),o.on("pong",Ic),s.onerror=Sc,e.
231
+ setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),n.length>0&&e.unshift(n),e.on("close",Vo),e.on("data",Dt),e.on(
232
+ "end",Go),e.on("error",Wo),this._readyState=t.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=t.CLOSED,
233
233
  this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[le.extensionName]&&this._extensions[le.extensionName].
234
- cleanup(),this._receiver.removeAllListeners(),this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,r){
234
+ cleanup(),this._receiver.removeAllListeners(),this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,n){
235
235
  if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){B(this,this._req,"WebSocket was closed before the conn\
236
236
  ection was established");return}if(this.readyState===t.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver.
237
- _writableState.errorEmitted)&&this._socket.end();return}this._readyState=t.CLOSING,this._sender.close(e,r,!this._isServer,
238
- n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),
239
- qo(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,r,n){
237
+ _writableState.errorEmitted)&&this._socket.end();return}this._readyState=t.CLOSING,this._sender.close(e,n,!this._isServer,
238
+ r=>{r||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),
239
+ Ho(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,n,r){
240
240
  if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="func\
241
- tion"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){
242
- Nr(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(e||Mt,r,n)}pong(e,r,n){if(this.readyState===t.CONNECTING)
243
- throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="\
244
- function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Nr(this,e,n);return}r===void 0&&
245
- (r=!this._isServer),this._sender.pong(e||Mt,r,n)}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this.
246
- _paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,r,n){if(this.readyState===t.CONNECTING)
247
- throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof e=="numbe\
248
- r"&&(e=e.toString()),this.readyState!==t.OPEN){Nr(this,e,n);return}let o={binary:typeof e!="string",mask:!this._isServer,
249
- compress:!0,fin:!0,...r};this._extensions[le.extensionName]||(o.compress=!1),this._sender.send(e||Mt,o,n)}terminate(){if(this.
241
+ tion"?(r=e,e=n=void 0):typeof n=="function"&&(r=n,n=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){
242
+ Nr(this,e,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(e||Nt,n,r)}pong(e,n,r){if(this.readyState===t.CONNECTING)
243
+ throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=n=void 0):typeof n=="\
244
+ function"&&(r=n,n=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Nr(this,e,r);return}n===void 0&&
245
+ (n=!this._isServer),this._sender.pong(e||Nt,n,r)}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this.
246
+ _paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,n,r){if(this.readyState===t.CONNECTING)
247
+ throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof n=="function"&&(r=n,n={}),typeof e=="numbe\
248
+ r"&&(e=e.toString()),this.readyState!==t.OPEN){Nr(this,e,r);return}let o={binary:typeof e!="string",mask:!this._isServer,
249
+ compress:!0,fin:!0,...n};this._extensions[le.extensionName]||(o.compress=!1),this._sender.send(e||Nt,o,r)}terminate(){if(this.
250
250
  readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){B(this,this._req,"WebSocket was closed before the connection w\
251
251
  as established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy())}}};Object.defineProperty(k,"CO\
252
252
  NNECTING",{enumerable:!0,value:oe.indexOf("CONNECTING")});Object.defineProperty(k.prototype,"CONNECTING",{enumerable:!0,
@@ -256,143 +256,143 @@ k.prototype,"OPEN",{enumerable:!0,value:oe.indexOf("OPEN")});Object.defineProper
256
256
  k,"CLOSED",{enumerable:!0,value:oe.indexOf("CLOSED")});Object.defineProperty(k.prototype,"CLOSED",{enumerable:!0,value:oe.
257
257
  indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.
258
258
  defineProperty(k.prototype,t,{enumerable:!0})});["open","error","close","message"].forEach(t=>{Object.defineProperty(k.prototype,
259
- `on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[Pr])return e[tc];return null},set(e){for(let r of this.
260
- listeners(t))if(r[Pr]){this.removeListener(t,r);break}typeof e=="function"&&this.addEventListener(t,e,{[Pr]:!0})}})});k.
261
- prototype.addEventListener=nc;k.prototype.removeEventListener=oc;Vo.exports=k;function Uo(t,e,r,n){let o={allowSynchronousEvents:!0,
262
- autoPong:!0,closeTimeout:Qa,protocolVersion:kr[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,
263
- perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,
264
- method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=o.autoPong,t._closeTimeout=o.closeTimeout,!kr.includes(
265
- o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${kr.join(
266
- ", ")})`);let s;if(e instanceof Rr)s=e;else try{s=new Rr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}s.protocol===
259
+ `on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[kr])return e[sc];return null},set(e){for(let n of this.
260
+ listeners(t))if(n[kr]){this.removeListener(t,n);break}typeof e=="function"&&this.addEventListener(t,e,{[kr]:!0})}})});k.
261
+ prototype.addEventListener=ac;k.prototype.removeEventListener=cc;Ko.exports=k;function $o(t,e,n,r){let o={allowSynchronousEvents:!0,
262
+ autoPong:!0,closeTimeout:nc,protocolVersion:Mr[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,
263
+ perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,
264
+ method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=o.autoPong,t._closeTimeout=o.closeTimeout,!Mr.includes(
265
+ o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${Mr.join(
266
+ ", ")})`);let s;if(e instanceof Pr)s=e;else try{s=new Pr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}s.protocol===
267
267
  "http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),t._url=s.href;let i=s.protocol==="wss:",a=s.protocol===
268
268
  "ws+unix:",c;if(s.protocol!=="ws:"&&!i&&!a?c=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws\
269
269
  +unix:"`:a&&!s.pathname?c="The URL's pathname is empty":s.hash&&(c="The URL contains a fragment identifier"),c){let b=new SyntaxError(
270
- c);if(t._redirects===0)throw b;jt(t,b);return}let d=i?443:80,p=Ka(16).toString("base64"),m=i?Va.request:Ga.request,l=new Set,
271
- v;if(o.createConnection=o.createConnection||(i?uc:dc),o.defaultPort=o.defaultPort||d,o.port=s.port||d,o.host=s.hostname.
270
+ c);if(t._redirects===0)throw b;jt(t,b);return}let d=i?443:80,p=Za(16).toString("base64"),m=i?Ja.request:Xa.request,l=new Set,
271
+ v;if(o.createConnection=o.createConnection||(i?mc:fc),o.defaultPort=o.defaultPort||d,o.port=s.port||d,o.host=s.hostname.
272
272
  startsWith("[")?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec\
273
273
  -WebSocket-Key":p,Connection:"Upgrade",Upgrade:"websocket"},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&
274
- (v=new le({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=sc({[le.extensionName]:v.
275
- offer()})),r.length){for(let b of r){if(typeof b!="string"||!cc.test(b)||l.has(b))throw new SyntaxError("An invalid or d\
276
- uplicated subprotocol was specified");l.add(b)}o.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(o.origin&&(o.protocolVersion<
274
+ (v=new le({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=dc({[le.extensionName]:v.
275
+ offer()})),n.length){for(let b of n){if(typeof b!="string"||!pc.test(b)||l.has(b))throw new SyntaxError("An invalid or d\
276
+ uplicated subprotocol was specified");l.add(b)}o.headers["Sec-WebSocket-Protocol"]=n.join(",")}if(o.origin&&(o.protocolVersion<
277
277
  13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(s.username||s.password)&&(o.auth=`${s.username}\
278
278
  :${s.password}`),a){let b=o.path.split(":");o.socketPath=b[0],o.path=b[1]}let x;if(o.followRedirects){if(t._redirects===
279
- 0){t._originalIpc=a,t._originalSecure=i,t._originalHostOrSocketPath=a?o.socketPath:s.host;let b=n&&n.headers;if(n={...n,
280
- headers:{}},b)for(let[O,P]of Object.entries(b))n.headers[O.toLowerCase()]=P}else if(t.listenerCount("redirect")===0){let b=a?
279
+ 0){t._originalIpc=a,t._originalSecure=i,t._originalHostOrSocketPath=a?o.socketPath:s.host;let b=r&&r.headers;if(r={...r,
280
+ headers:{}},b)for(let[O,P]of Object.entries(b))r.headers[O.toLowerCase()]=P}else if(t.listenerCount("redirect")===0){let b=a?
281
281
  t._originalIpc?o.socketPath===t._originalHostOrSocketPath:!1:t._originalIpc?!1:s.host===t._originalHostOrSocketPath;(!b||
282
282
  t._originalSecure&&!i)&&(delete o.headers.authorization,delete o.headers.cookie,b||delete o.headers.host,o.auth=void 0)}
283
- o.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),x=t._req=m(o),
283
+ o.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),x=t._req=m(o),
284
284
  t._redirects&&t.emit("redirect",t.url,x)}else x=t._req=m(o);o.timeout&&x.on("timeout",()=>{B(t,x,"Opening handshake has \
285
- timed out")}),x.on("error",b=>{x===null||x[Lo]||(x=t._req=null,jt(t,b))}),x.on("response",b=>{let O=b.headers.location,P=b.
285
+ timed out")}),x.on("error",b=>{x===null||x[qo]||(x=t._req=null,jt(t,b))}),x.on("response",b=>{let O=b.headers.location,P=b.
286
286
  statusCode;if(O&&o.followRedirects&&P>=300&&P<400){if(++t._redirects>o.maxRedirects){B(t,x,"Maximum redirects exceeded");
287
- return}x.abort();let j;try{j=new Rr(O,e)}catch{let L=new SyntaxError(`Invalid URL: ${O}`);jt(t,L);return}Uo(t,j,r,n)}else
287
+ return}x.abort();let j;try{j=new Pr(O,e)}catch{let U=new SyntaxError(`Invalid URL: ${O}`);jt(t,U);return}$o(t,j,n,r)}else
288
288
  t.emit("unexpected-response",x,b)||B(t,x,`Unexpected server response: ${b.statusCode}`)}),x.on("upgrade",(b,O,P)=>{if(t.
289
289
  emit("upgrade",b),t.readyState!==k.CONNECTING)return;x=t._req=null;let j=b.headers.upgrade;if(j===void 0||j.toLowerCase()!==
290
- "websocket"){B(t,O,"Invalid Upgrade header");return}let D=Ja("sha1").update(p+ec).digest("base64");if(b.headers["sec-web\
291
- socket-accept"]!==D){B(t,O,"Invalid Sec-WebSocket-Accept header");return}let L=b.headers["sec-websocket-protocol"],J;if(L!==
292
- void 0?l.size?l.has(L)||(J="Server sent an invalid subprotocol"):J="Server sent a subprotocol but none was requested":l.
293
- size&&(J="Server sent no subprotocol"),J){B(t,O,J);return}L&&(t._protocol=L);let H=b.headers["sec-websocket-extensions"];
290
+ "websocket"){B(t,O,"Invalid Upgrade header");return}let D=Qa("sha1").update(p+oc).digest("base64");if(b.headers["sec-web\
291
+ socket-accept"]!==D){B(t,O,"Invalid Sec-WebSocket-Accept header");return}let U=b.headers["sec-websocket-protocol"],J;if(U!==
292
+ void 0?l.size?l.has(U)||(J="Server sent an invalid subprotocol"):J="Server sent a subprotocol but none was requested":l.
293
+ size&&(J="Server sent no subprotocol"),J){B(t,O,J);return}U&&(t._protocol=U);let H=b.headers["sec-websocket-extensions"];
294
294
  if(H!==void 0){if(!v){B(t,O,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let q;
295
- try{q=ic(H)}catch{B(t,O,"Invalid Sec-WebSocket-Extensions header");return}let ae=Object.keys(q);if(ae.length!==1||ae[0]!==
295
+ try{q=uc(H)}catch{B(t,O,"Invalid Sec-WebSocket-Extensions header");return}let ae=Object.keys(q);if(ae.length!==1||ae[0]!==
296
296
  le.extensionName){B(t,O,"Server indicated an extension that was not requested");return}try{v.accept(q[le.extensionName])}catch{
297
297
  B(t,O,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[le.extensionName]=v}t.setSocket(O,P,{allowSynchronousEvents:o.
298
298
  allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.
299
299
  maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(x,t):x.end()}function jt(t,e){t._readyState=
300
- k.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}function dc(t){return t.path=t.socketPath,Do.connect(t)}function uc(t){
301
- return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=Do.isIP(t.host)?"":t.host),Wa.connect(t)}function B(t,e,r){
302
- t._readyState=k.CLOSING;let n=new Error(r);Error.captureStackTrace(n,B),e.setHeader?(e[Lo]=!0,e.abort(),e.socket&&!e.socket.
303
- destroyed&&e.socket.destroy(),process.nextTick(jt,t,n)):(e.destroy(n),e.once("error",t.emit.bind(t,"error")),e.once("clo\
304
- se",t.emitClose.bind(t)))}function Nr(t,e,r){if(e){let n=Za(e)?e.size:ac(e).length;t._socket?t._sender._bufferedBytes+=n:
305
- t._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${t.readyState} (${oe[t.readyState]})`);process.
306
- nextTick(r,n)}}function lc(t,e){let r=this[z];r._closeFrameReceived=!0,r._closeMessage=e,r._closeCode=t,r._socket[z]!==void 0&&
307
- (r._socket.removeListener("data",Dt),process.nextTick(Fo,r._socket),t===1005?r.close():r.close(t,e))}function pc(){let t=this[z];
308
- t.isPaused||t._socket.resume()}function fc(t){let e=this[z];e._socket[z]!==void 0&&(e._socket.removeListener("data",Dt),
309
- process.nextTick(Fo,e._socket),e.close(t[rc])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}function jo(){this[z].
310
- emitClose()}function mc(t,e){this[z].emit("message",t,e)}function hc(t){let e=this[z];e._autoPong&&e.pong(t,!this._isServer,
311
- zo),e.emit("ping",t)}function gc(t){this[z].emit("pong",t)}function Fo(t){t.resume()}function vc(t){let e=this[z];e.readyState!==
312
- k.CLOSED&&(e.readyState===k.OPEN&&(e._readyState=k.CLOSING,qo(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,
313
- e.emit("error",t)))}function qo(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),t._closeTimeout)}function $o(){
314
- let t=this[z];if(this.removeListener("close",$o),this.removeListener("data",Dt),this.removeListener("end",Bo),t._readyState=
300
+ k.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}function fc(t){return t.path=t.socketPath,Uo.connect(t)}function mc(t){
301
+ return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=Uo.isIP(t.host)?"":t.host),Ya.connect(t)}function B(t,e,n){
302
+ t._readyState=k.CLOSING;let r=new Error(n);Error.captureStackTrace(r,B),e.setHeader?(e[qo]=!0,e.abort(),e.socket&&!e.socket.
303
+ destroyed&&e.socket.destroy(),process.nextTick(jt,t,r)):(e.destroy(r),e.once("error",t.emit.bind(t,"error")),e.once("clo\
304
+ se",t.emitClose.bind(t)))}function Nr(t,e,n){if(e){let r=rc(e)?e.size:lc(e).length;t._socket?t._sender._bufferedBytes+=r:
305
+ t._bufferedAmount+=r}if(n){let r=new Error(`WebSocket is not open: readyState ${t.readyState} (${oe[t.readyState]})`);process.
306
+ nextTick(n,r)}}function hc(t,e){let n=this[L];n._closeFrameReceived=!0,n._closeMessage=e,n._closeCode=t,n._socket[L]!==void 0&&
307
+ (n._socket.removeListener("data",Dt),process.nextTick(Bo,n._socket),t===1005?n.close():n.close(t,e))}function gc(){let t=this[L];
308
+ t.isPaused||t._socket.resume()}function vc(t){let e=this[L];e._socket[L]!==void 0&&(e._socket.removeListener("data",Dt),
309
+ process.nextTick(Bo,e._socket),e.close(t[ic])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}function Lo(){this[L].
310
+ emitClose()}function wc(t,e){this[L].emit("message",t,e)}function yc(t){let e=this[L];e._autoPong&&e.pong(t,!this._isServer,
311
+ Fo),e.emit("ping",t)}function Ic(t){this[L].emit("pong",t)}function Bo(t){t.resume()}function Sc(t){let e=this[L];e.readyState!==
312
+ k.CLOSED&&(e.readyState===k.OPEN&&(e._readyState=k.CLOSING,Ho(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,
313
+ e.emit("error",t)))}function Ho(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),t._closeTimeout)}function Vo(){
314
+ let t=this[L];if(this.removeListener("close",Vo),this.removeListener("data",Dt),this.removeListener("end",Go),t._readyState=
315
315
  k.CLOSING,!this._readableState.endEmitted&&!t._closeFrameReceived&&!t._receiver._writableState.errorEmitted&&this._readableState.
316
- length!==0){let e=this.read(this._readableState.length);t._receiver.write(e)}t._receiver.end(),this[z]=void 0,clearTimeout(
316
+ length!==0){let e=this.read(this._readableState.length);t._receiver.write(e)}t._receiver.end(),this[L]=void 0,clearTimeout(
317
317
  t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on(
318
- "error",jo),t._receiver.on("finish",jo))}function Dt(t){this[z]._receiver.write(t)||this.pause()}function Bo(){let t=this[z];
319
- t._readyState=k.CLOSING,t._receiver.end(),this.end()}function Ho(){let t=this[z];this.removeListener("error",Ho),this.on(
320
- "error",zo),t&&(t._readyState=k.CLOSING,this.destroy())}});var Jo=$((Rm,Ko)=>{"use strict";var Om=zt(),{Duplex:wc}=N("stream");function Go(t){t.emit("close")}function yc(){!this.destroyed&&
321
- this._writableState.finished&&this.destroy()}function Wo(t){this.removeListener("error",Wo),this.destroy(),this.listenerCount(
322
- "error")===0&&this.emit("error",t)}function Ic(t,e){let r=!0,n=new wc({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});
323
- return t.on("message",function(s,i){let a=!i&&n._readableState.objectMode?s.toString():s;n.push(a)||t.pause()}),t.once("\
324
- error",function(s){n.destroyed||(r=!1,n.destroy(s))}),t.once("close",function(){n.destroyed||n.push(null)}),n._destroy=function(o,s){
325
- if(t.readyState===t.CLOSED){s(o),process.nextTick(Go,n);return}let i=!1;t.once("error",function(c){i=!0,s(c)}),t.once("c\
326
- lose",function(){i||s(o),process.nextTick(Go,n)}),r&&t.terminate()},n._final=function(o){if(t.readyState===t.CONNECTING){
327
- t.once("open",function(){n._final(o)});return}t._socket!==null&&(t._socket._writableState.finished?(o(),n._readableState.
328
- endEmitted&&n.destroy()):(t._socket.once("finish",function(){o()}),t.close()))},n._read=function(){t.isPaused&&t.resume()},
329
- n._write=function(o,s,i){if(t.readyState===t.CONNECTING){t.once("open",function(){n._write(o,s,i)});return}t.send(o,i)},
330
- n.on("end",yc),n.on("error",Wo),n}Ko.exports=Ic});var Mr=$((Pm,Xo)=>{"use strict";var{tokenChars:Sc}=Re();function xc(t){let e=new Set,r=-1,n=-1,o=0;for(o;o<t.length;o++){
331
- let i=t.charCodeAt(o);if(n===-1&&Sc[i]===1)r===-1&&(r=o);else if(o!==0&&(i===32||i===9))n===-1&&r!==-1&&(n=o);else if(i===
332
- 44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${o}`);n===-1&&(n=o);let a=t.slice(r,n);if(e.has(a))throw new SyntaxError(
333
- `The "${a}" subprotocol is duplicated`);e.add(a),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}
334
- if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let s=t.slice(r,o);if(e.has(s))throw new SyntaxError(
335
- `The "${s}" subprotocol is duplicated`);return e.add(s),e}Xo.exports={parse:xc}});var ns=$((Nm,rs)=>{"use strict";var bc=N("events"),Lt=N("http"),{Duplex:km}=N("stream"),{createHash:Tc}=N("crypto"),Yo=Nt(),
336
- Ie=Oe(),Cc=Mr(),_c=zt(),{CLOSE_TIMEOUT:Ec,GUID:Ac,kWebSocket:Oc}=te(),Rc=/^[+/0-9A-Za-z]{22}==$/,Zo=0,Qo=1,ts=2,jr=class extends bc{constructor(e,r){
318
+ "error",Lo),t._receiver.on("finish",Lo))}function Dt(t){this[L]._receiver.write(t)||this.pause()}function Go(){let t=this[L];
319
+ t._readyState=k.CLOSING,t._receiver.end(),this.end()}function Wo(){let t=this[L];this.removeListener("error",Wo),this.on(
320
+ "error",Fo),t&&(t._readyState=k.CLOSING,this.destroy())}});var Zo=$((km,Yo)=>{"use strict";var Pm=zt(),{Duplex:xc}=M("stream");function Jo(t){t.emit("close")}function bc(){!this.destroyed&&
321
+ this._writableState.finished&&this.destroy()}function Xo(t){this.removeListener("error",Xo),this.destroy(),this.listenerCount(
322
+ "error")===0&&this.emit("error",t)}function Tc(t,e){let n=!0,r=new xc({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});
323
+ return t.on("message",function(s,i){let a=!i&&r._readableState.objectMode?s.toString():s;r.push(a)||t.pause()}),t.once("\
324
+ error",function(s){r.destroyed||(n=!1,r.destroy(s))}),t.once("close",function(){r.destroyed||r.push(null)}),r._destroy=function(o,s){
325
+ if(t.readyState===t.CLOSED){s(o),process.nextTick(Jo,r);return}let i=!1;t.once("error",function(c){i=!0,s(c)}),t.once("c\
326
+ lose",function(){i||s(o),process.nextTick(Jo,r)}),n&&t.terminate()},r._final=function(o){if(t.readyState===t.CONNECTING){
327
+ t.once("open",function(){r._final(o)});return}t._socket!==null&&(t._socket._writableState.finished?(o(),r._readableState.
328
+ endEmitted&&r.destroy()):(t._socket.once("finish",function(){o()}),t.close()))},r._read=function(){t.isPaused&&t.resume()},
329
+ r._write=function(o,s,i){if(t.readyState===t.CONNECTING){t.once("open",function(){r._write(o,s,i)});return}t.send(o,i)},
330
+ r.on("end",bc),r.on("error",Xo),r}Yo.exports=Tc});var jr=$((Mm,Qo)=>{"use strict";var{tokenChars:Cc}=Pe();function _c(t){let e=new Set,n=-1,r=-1,o=0;for(o;o<t.length;o++){
331
+ let i=t.charCodeAt(o);if(r===-1&&Cc[i]===1)n===-1&&(n=o);else if(o!==0&&(i===32||i===9))r===-1&&n!==-1&&(r=o);else if(i===
332
+ 44){if(n===-1)throw new SyntaxError(`Unexpected character at index ${o}`);r===-1&&(r=o);let a=t.slice(n,r);if(e.has(a))throw new SyntaxError(
333
+ `The "${a}" subprotocol is duplicated`);e.add(a),n=r=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}
334
+ if(n===-1||r!==-1)throw new SyntaxError("Unexpected end of input");let s=t.slice(n,o);if(e.has(s))throw new SyntaxError(
335
+ `The "${s}" subprotocol is duplicated`);return e.add(s),e}Qo.exports={parse:_c}});var is=$((jm,ss)=>{"use strict";var Ec=M("events"),Lt=M("http"),{Duplex:Nm}=M("stream"),{createHash:Ac}=M("crypto"),es=Mt(),
336
+ Ie=Re(),Oc=jr(),Rc=zt(),{CLOSE_TIMEOUT:Pc,GUID:kc,kWebSocket:Mc}=te(),Nc=/^[+/0-9A-Za-z]{22}==$/,ts=0,rs=1,os=2,Dr=class extends Ec{constructor(e,n){
337
337
  if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:256*1024,maxFragments:16*1024,maxPayload:100*1024*
338
- 1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Ec,verifyClient:null,
339
- noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:_c,...e},e.port==null&&!e.server&&!e.noServer||
338
+ 1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Pc,verifyClient:null,
339
+ noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Rc,...e},e.port==null&&!e.server&&!e.noServer||
340
340
  e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server"\
341
- , or "noServer" options must be specified');if(e.port!=null?(this._server=Lt.createServer((n,o)=>{let s=Lt.STATUS_CODES[426];
341
+ , or "noServer" options must be specified');if(e.port!=null?(this._server=Lt.createServer((r,o)=>{let s=Lt.STATUS_CODES[426];
342
342
  o.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),o.end(s)}),this._server.listen(e.port,e.host,e.
343
- backlog,r)):e.server&&(this._server=e.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=
344
- Pc(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(o,s,i)=>{this.handleUpgrade(
345
- o,s,i,n)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=
346
- !1),this.options=e,this._state=Zo}address(){if(this.options.noServer)throw new Error('The server is operating in "noServ\
347
- er" mode');return this._server?this._server.address():null}close(e){if(this._state===ts){e&&this.once("close",()=>{e(new Error(
348
- "The server is not running"))}),process.nextTick(rt,this);return}if(e&&this.once("close",e),this._state!==Qo)if(this._state=
349
- Qo,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=
350
- null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(rt,this):process.nextTick(rt,this);else{let r=this.
351
- _server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{rt(this)})}}shouldHandle(e){if(this.
352
- options.path){let r=e.url.indexOf("?");if((r!==-1?e.url.slice(0,r):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,r,n,o){
353
- r.on("error",es);let s=e.headers["sec-websocket-key"],i=e.headers.upgrade,a=+e.headers["sec-websocket-version"];if(e.method!==
354
- "GET"){Se(this,e,r,405,"Invalid HTTP method");return}if(i===void 0||i.toLowerCase()!=="websocket"){Se(this,e,r,400,"Inva\
355
- lid Upgrade header");return}if(s===void 0||!Rc.test(s)){Se(this,e,r,400,"Missing or invalid Sec-WebSocket-Key header");return}
356
- if(a!==13&&a!==8){Se(this,e,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}
357
- if(!this.shouldHandle(e)){nt(r,400);return}let c=e.headers["sec-websocket-protocol"],d=new Set;if(c!==void 0)try{d=Cc.parse(
358
- c)}catch{Se(this,e,r,400,"Invalid Sec-WebSocket-Protocol header");return}let p=e.headers["sec-websocket-extensions"],m={};
343
+ backlog,n)):e.server&&(this._server=e.server),this._server){let r=this.emit.bind(this,"connection");this._removeListeners=
344
+ jc(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(o,s,i)=>{this.handleUpgrade(
345
+ o,s,i,r)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=
346
+ !1),this.options=e,this._state=ts}address(){if(this.options.noServer)throw new Error('The server is operating in "noServ\
347
+ er" mode');return this._server?this._server.address():null}close(e){if(this._state===os){e&&this.once("close",()=>{e(new Error(
348
+ "The server is not running"))}),process.nextTick(rt,this);return}if(e&&this.once("close",e),this._state!==rs)if(this._state=
349
+ rs,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=
350
+ null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(rt,this):process.nextTick(rt,this);else{let n=this.
351
+ _server;this._removeListeners(),this._removeListeners=this._server=null,n.close(()=>{rt(this)})}}shouldHandle(e){if(this.
352
+ options.path){let n=e.url.indexOf("?");if((n!==-1?e.url.slice(0,n):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,n,r,o){
353
+ n.on("error",ns);let s=e.headers["sec-websocket-key"],i=e.headers.upgrade,a=+e.headers["sec-websocket-version"];if(e.method!==
354
+ "GET"){Se(this,e,n,405,"Invalid HTTP method");return}if(i===void 0||i.toLowerCase()!=="websocket"){Se(this,e,n,400,"Inva\
355
+ lid Upgrade header");return}if(s===void 0||!Nc.test(s)){Se(this,e,n,400,"Missing or invalid Sec-WebSocket-Key header");return}
356
+ if(a!==13&&a!==8){Se(this,e,n,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}
357
+ if(!this.shouldHandle(e)){nt(n,400);return}let c=e.headers["sec-websocket-protocol"],d=new Set;if(c!==void 0)try{d=Oc.parse(
358
+ c)}catch{Se(this,e,n,400,"Invalid Sec-WebSocket-Protocol header");return}let p=e.headers["sec-websocket-extensions"],m={};
359
359
  if(this.options.perMessageDeflate&&p!==void 0){let l=new Ie({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.
360
- options.maxPayload});try{let v=Yo.parse(p);v[Ie.extensionName]&&(l.accept(v[Ie.extensionName]),m[Ie.extensionName]=l)}catch{
361
- Se(this,e,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let l={
360
+ options.maxPayload});try{let v=es.parse(p);v[Ie.extensionName]&&(l.accept(v[Ie.extensionName]),m[Ie.extensionName]=l)}catch{
361
+ Se(this,e,n,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let l={
362
362
  origin:e.headers[`${a===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.
363
- options.verifyClient.length===2){this.options.verifyClient(l,(v,x,b,O)=>{if(!v)return nt(r,x||401,b,O);this.completeUpgrade(
364
- m,s,d,e,r,n,o)});return}if(!this.options.verifyClient(l))return nt(r,401)}this.completeUpgrade(m,s,d,e,r,n,o)}completeUpgrade(e,r,n,o,s,i,a){
365
- if(!s.readable||!s.writable)return s.destroy();if(s[Oc])throw new Error("server.handleUpgrade() was called more than onc\
366
- e with the same socket, possibly due to a misconfiguration");if(this._state>Zo)return nt(s,503);let d=["HTTP/1.1 101 Swi\
367
- tching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Tc("sha1").update(r+Ac).digest("ba\
368
- se64")}`],p=new this.options.WebSocket(null,void 0,this.options);if(n.size){let m=this.options.handleProtocols?this.options.
369
- handleProtocols(n,o):n.values().next().value;m&&(d.push(`Sec-WebSocket-Protocol: ${m}`),p._protocol=m)}if(e[Ie.extensionName]){
370
- let m=e[Ie.extensionName].params,l=Yo.format({[Ie.extensionName]:[m]});d.push(`Sec-WebSocket-Extensions: ${l}`),p._extensions=
363
+ options.verifyClient.length===2){this.options.verifyClient(l,(v,x,b,O)=>{if(!v)return nt(n,x||401,b,O);this.completeUpgrade(
364
+ m,s,d,e,n,r,o)});return}if(!this.options.verifyClient(l))return nt(n,401)}this.completeUpgrade(m,s,d,e,n,r,o)}completeUpgrade(e,n,r,o,s,i,a){
365
+ if(!s.readable||!s.writable)return s.destroy();if(s[Mc])throw new Error("server.handleUpgrade() was called more than onc\
366
+ e with the same socket, possibly due to a misconfiguration");if(this._state>ts)return nt(s,503);let d=["HTTP/1.1 101 Swi\
367
+ tching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Ac("sha1").update(n+kc).digest("ba\
368
+ se64")}`],p=new this.options.WebSocket(null,void 0,this.options);if(r.size){let m=this.options.handleProtocols?this.options.
369
+ handleProtocols(r,o):r.values().next().value;m&&(d.push(`Sec-WebSocket-Protocol: ${m}`),p._protocol=m)}if(e[Ie.extensionName]){
370
+ let m=e[Ie.extensionName].params,l=es.format({[Ie.extensionName]:[m]});d.push(`Sec-WebSocket-Extensions: ${l}`),p._extensions=
371
371
  e}this.emit("headers",d,o),s.write(d.concat(`\r
372
372
  `).join(`\r
373
- `)),s.removeListener("error",es),p.setSocket(s,i,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.
373
+ `)),s.removeListener("error",ns),p.setSocket(s,i,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.
374
374
  options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.
375
375
  options.skipUTF8Validation}),this.clients&&(this.clients.add(p),p.on("close",()=>{this.clients.delete(p),this._shouldEmitClose&&
376
- !this.clients.size&&process.nextTick(rt,this)})),a(p,o)}};rs.exports=jr;function Pc(t,e){for(let r of Object.keys(e))t.on(
377
- r,e[r]);return function(){for(let n of Object.keys(e))t.removeListener(n,e[n])}}function rt(t){t._state=ts,t.emit("close")}
378
- function es(){this.destroy()}function nt(t,e,r,n){r=r||Lt.STATUS_CODES[e],n={Connection:"close","Content-Type":"text/htm\
379
- l","Content-Length":Buffer.byteLength(r),...n},t.once("finish",t.destroy),t.end(`HTTP/1.1 ${e} ${Lt.STATUS_CODES[e]}\r
380
- `+Object.keys(n).map(o=>`${o}: ${n[o]}`).join(`\r
376
+ !this.clients.size&&process.nextTick(rt,this)})),a(p,o)}};ss.exports=Dr;function jc(t,e){for(let n of Object.keys(e))t.on(
377
+ n,e[n]);return function(){for(let r of Object.keys(e))t.removeListener(r,e[r])}}function rt(t){t._state=os,t.emit("close")}
378
+ function ns(){this.destroy()}function nt(t,e,n,r){n=n||Lt.STATUS_CODES[e],r={Connection:"close","Content-Type":"text/htm\
379
+ l","Content-Length":Buffer.byteLength(n),...r},t.once("finish",t.destroy),t.end(`HTTP/1.1 ${e} ${Lt.STATUS_CODES[e]}\r
380
+ `+Object.keys(r).map(o=>`${o}: ${r[o]}`).join(`\r
381
381
  `)+`\r
382
382
  \r
383
- `+r)}function Se(t,e,r,n,o,s){if(t.listenerCount("wsClientError")){let i=new Error(o);Error.captureStackTrace(i,Se),t.emit(
384
- "wsClientError",i,r,e)}else nt(r,n,o,s)}});function I(t){return String(t??"").trim()}function yt(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||
385
- e===null}var qp=Object.freeze(["none","pending","committed","rolledBack","unknown"]);function _(t,{fallback:e=""}={}){return String(t||"").trim()||e}function E(t){return!!(t&&typeof t=="object"&&!Array.isArray(t))}function V(t,{fallback:e=0}={}){let r=Number(t);return!Number.isInteger(r)||r<1?e:r}var Bp=Object.freeze({interrupted:Object.freeze({text:"Stopped.",messageCode:"assistant.turn.stopped"}),failed:Object.freeze(
386
- {text:"Assistant stopped with an error.",messageCode:"assistant.turn.failed"})});function It(t){return E(t)?{...t}:{}}var M=class extends Error{constructor(e,r,n={}){super(r,n.cause===void 0?void 0:{cause:n.cause}),this.name="AppError",this.
387
- status=Number(e)||500,this.statusCode=this.status,this.code=n.code||"APP_ERROR",this.params=It(n.params),n.messageCode&&
388
- (this.messageCode=String(n.messageCode),this.messageParams=It(n.messageParams)),this.details=n.details,this.headers=n.headers||
389
- {}}};var yf=new Set(["contextcompaction",...["context","thread","conversation"].flatMap(t=>["compact","compacted","compaction",
390
- "truncate","truncated","truncation"].flatMap(e=>[`${t}_${e}`,`${e}_${t}`]))]);var U=Object.freeze({ACTIVE:"active",CANCELLED:"cancelled",COMPLETED:"completed",FAILED:"failed",FINALIZING:"finalizing",
391
- INTERRUPTED:"interrupted",STARTING:"starting",TIMED_OUT:"timed_out"}),_f=new Set(Object.values(U)),Ef=new Set([U.CANCELLED,
392
- U.COMPLETED,U.FAILED,U.INTERRUPTED,U.TIMED_OUT]),Af=new Set([U.ACTIVE,U.FINALIZING,U.STARTING]);import{execFile as Qi}from"node:child_process";import{readFile as pr,readdir as ea}from"node:fs/promises";import{setTimeout as Yn}from"node:timers/promises";import{promisify as ta}from"node:util";var ra=ta(Qi);async function na(t){
393
- let{stdout:e}=await ra("ps",t,{env:{...process.env,LC_ALL:"C",TZ:"UTC"},maxBuffer:67108864});return e}function bt({runtimeTokenEnvironmentName:t="\
394
- JSKIT_EXECUTION_RUNTIME_TOKEN",commandHashEnvironmentName:e="JSKIT_EXECUTION_COMMAND_HASH",label:r="Native",unavailableCode:n="\
395
- native_process_identity_unavailable",platform:o=process.platform,ps:s=na}={}){let a=o==="darwin"?100:25,c=1,d=Object.freeze(
383
+ `+n)}function Se(t,e,n,r,o,s){if(t.listenerCount("wsClientError")){let i=new Error(o);Error.captureStackTrace(i,Se),t.emit(
384
+ "wsClientError",i,n,e)}else nt(n,r,o,s)}});function I(t){return String(t??"").trim()}function yt(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||
385
+ e===null}var Bp=Object.freeze(["none","pending","committed","rolledBack","unknown"]);function _(t,{fallback:e=""}={}){return String(t||"").trim()||e}function E(t){return!!(t&&typeof t=="object"&&!Array.isArray(t))}function V(t,{fallback:e=0}={}){let n=Number(t);return!Number.isInteger(n)||n<1?e:n}var Vp=Object.freeze({interrupted:Object.freeze({text:"Stopped.",messageCode:"assistant.turn.stopped"}),failed:Object.freeze(
386
+ {text:"Assistant stopped with an error.",messageCode:"assistant.turn.failed"})});function It(t){return E(t)?{...t}:{}}var N=class extends Error{constructor(e,n,r={}){super(n,r.cause===void 0?void 0:{cause:r.cause}),this.name="AppError",this.
387
+ status=Number(e)||500,this.statusCode=this.status,this.code=r.code||"APP_ERROR",this.params=It(r.params),r.messageCode&&
388
+ (this.messageCode=String(r.messageCode),this.messageParams=It(r.messageParams)),this.details=r.details,this.headers=r.headers||
389
+ {}}};var Sf=new Set(["contextcompaction",...["context","thread","conversation"].flatMap(t=>["compact","compacted","compaction",
390
+ "truncate","truncated","truncation"].flatMap(e=>[`${t}_${e}`,`${e}_${t}`]))]);var F=Object.freeze({ACTIVE:"active",CANCELLED:"cancelled",COMPLETED:"completed",FAILED:"failed",FINALIZING:"finalizing",
391
+ INTERRUPTED:"interrupted",STARTING:"starting",TIMED_OUT:"timed_out"}),Af=new Set(Object.values(F)),Of=new Set([F.CANCELLED,
392
+ F.COMPLETED,F.FAILED,F.INTERRUPTED,F.TIMED_OUT]),Rf=new Set([F.ACTIVE,F.FINALIZING,F.STARTING]);import{execFile as na}from"node:child_process";import{readFile as fr,readdir as oa}from"node:fs/promises";import{setTimeout as eo}from"node:timers/promises";import{promisify as sa}from"node:util";var ia=sa(na);async function aa(t){
393
+ let{stdout:e}=await ia("ps",t,{env:{...process.env,LC_ALL:"C",TZ:"UTC"},maxBuffer:67108864});return e}function bt({runtimeTokenEnvironmentName:t="\
394
+ JSKIT_EXECUTION_RUNTIME_TOKEN",commandHashEnvironmentName:e="JSKIT_EXECUTION_COMMAND_HASH",label:n="Native",unavailableCode:r="\
395
+ native_process_identity_unavailable",platform:o=process.platform,ps:s=aa}={}){let a=o==="darwin"?100:25,c=1,d=Object.freeze(
396
396
  {linux:"linux-proc",darwin:"darwin"}),p=d[o]||"",m=Object.freeze({RUNNING:"running",STOPPED:"stopped"}),l=Object.freeze(
397
397
  {ABSENT:"absent",AMBIGUOUS:"ambiguous",EXACT:"exact",INVALID:"invalid",MISMATCH:"mismatch"});function v(w={}){return!!(Number.
398
398
  isSafeInteger(Number(w.pid))&&Number(w.pid)>0&&D(w.processIdentity)&&[m.RUNNING,m.STOPPED].includes(w.processState))}function x(w){
@@ -406,40 +406,40 @@ test(T)?null:{parentPid:y,processGroupId:S,startTimeTicks:T,state:g}}function j(
406
406
  u.commandHash),platform:I(u.platform),runtimeToken:I(u.runtimeToken),startTimeTicks:I(u.startTimeTicks),version:Number(u.
407
407
  version||0)}}function D(w={}){let u=j(w);return!!(u.version===c&&Object.values(d).includes(u.platform)&&/^[a-f0-9]{12}$/u.
408
408
  test(u.commandHash)&&/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu.test(u.runtimeToken)&&/^\d+$/u.
409
- test(u.startTimeTicks))}function L(w=[],u=""){let f=w.find(h=>h.startsWith(`${u}=`));return f?f.slice(u.length+1):""}async function J(){
410
- let w=[],u=await ea("/proc",{withFileTypes:!0}).catch(()=>[]);for(let f of u){if(!f.isDirectory()||!/^\d+$/u.test(f.name))
411
- continue;let h=Number(f.name),g=await pr(`/proc/${f.name}/stat`,"utf8").catch(()=>""),y=P(g);if(!y||y.state==="Z")continue;
412
- let S=null,T=!0;try{S=await pr(`/proc/${f.name}/environ`)}catch(A){if(String(A?.code||"")==="ENOENT")continue;T=!1}let R=T?
413
- S.toString("utf8").split("\0"):[];w.push({...y,commandHash:L(R,e),environmentReadable:T,pid:h,runtimeToken:L(R,t)})}return w}
409
+ test(u.startTimeTicks))}function U(w=[],u=""){let f=w.find(h=>h.startsWith(`${u}=`));return f?f.slice(u.length+1):""}async function J(){
410
+ let w=[],u=await oa("/proc",{withFileTypes:!0}).catch(()=>[]);for(let f of u){if(!f.isDirectory()||!/^\d+$/u.test(f.name))
411
+ continue;let h=Number(f.name),g=await fr(`/proc/${f.name}/stat`,"utf8").catch(()=>""),y=P(g);if(!y||y.state==="Z")continue;
412
+ let S=null,T=!0;try{S=await fr(`/proc/${f.name}/environ`)}catch(A){if(String(A?.code||"")==="ENOENT")continue;T=!1}let R=T?
413
+ S.toString("utf8").split("\0"):[];w.push({...y,commandHash:U(R,e),environmentReadable:T,pid:h,runtimeToken:U(R,t)})}return w}
414
414
  let H=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function q(w=""){let u=/^\w{3}\s+(\w{3})\s+(\d{1,2})\s+(\d{2}):(\d{2}):(\d{2})\s+(\d{4})$/u.
415
415
  exec(String(w).trim()),f=u?H.indexOf(u[1]):-1;if(f<0)return"";let[,,h,g,y,S,T]=u.map(Number);return String(Date.UTC(T,f,
416
416
  h,g,y,S)/1e3)}function ae(w=""){let u=new Map;for(let f of String(w).split(`
417
417
  `)){let h=/^\s*(\d+) (.*)$/u.exec(f);h&&u.set(Number(h[1]),h[2])}return u}function me(w,u){if(w===void 0||!u?.startsWith(
418
- w))return null;let f=u.slice(w.length).split(/\s+/u).filter(h=>/^[^=\s]+=/u.test(h));return f.length?f:null}async function Ge(){
418
+ w))return null;let f=u.slice(w.length).split(/\s+/u).filter(h=>/^[^=\s]+=/u.test(h));return f.length?f:null}async function We(){
419
419
  let w=process.getuid(),u=["-x","-U",String(w),"-ww","-o","pid=,command="],[f,h,g]=await Promise.all([s(["-ax","-o","pid=\
420
420
  ,pgid=,uid=,stat=,lstart="]),s(u),s(["-E",...u])]),y=ae(h),S=ae(g),T=[];for(let R of String(f).split(`
421
421
  `)){let A=/^\s*(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(\w{3}\s+\w{3}\s+\d{1,2}\s+[\d:]{8}\s+\d{4})\s*$/u.exec(R);if(!A||A[4].startsWith(
422
- "Z"))continue;let X=Number(A[1]),Y=Number(A[3])===w?me(y.get(X),S.get(X)):null;T.push({commandHash:L(Y||[],e),environmentReadable:!!Y,
423
- pid:X,processGroupId:Number(A[2]),runtimeToken:L(Y||[],t),startTimeTicks:q(A[5])})}return T}function ht(w){let u=Object.
422
+ "Z"))continue;let X=Number(A[1]),Y=Number(A[3])===w?me(y.get(X),S.get(X)):null;T.push({commandHash:U(Y||[],e),environmentReadable:!!Y,
423
+ pid:X,processGroupId:Number(A[2]),runtimeToken:U(Y||[],t),startTimeTicks:q(A[5])})}return T}function ht(w){let u=Object.
424
424
  values(l).includes(w?.status)?w.status:l.AMBIGUOUS;return{processGroupIds:[...new Set((Array.isArray(w?.processGroupIds)?
425
425
  w.processGroupIds:[]).map(Number).filter(f=>Number.isSafeInteger(f)&&f>0))],status:u}}async function gt(w={}){if(!v(w))return{
426
426
  processGroupIds:[],status:l.INVALID};if(w.processState===m.STOPPED)return{processGroupIds:[],status:l.ABSENT};let u=w.processIdentity,
427
- f=u.platform!==p?null:o==="darwin"?await Ge().catch(()=>null):await J();if(!f)return{processGroupIds:[],status:l.AMBIGUOUS};
427
+ f=u.platform!==p?null:o==="darwin"?await We().catch(()=>null):await J();if(!f)return{processGroupIds:[],status:l.AMBIGUOUS};
428
428
  let h=Number(w.pid),g=f.filter(({processGroupId:A})=>A===h),y=[],S=g.some(({environmentReadable:A})=>!A);for(let A of f)
429
429
  A.environmentReadable&&A.runtimeToken===u.runtimeToken&&A.commandHash===u.commandHash&&y.push(A);let T=y.find(({pid:A})=>A===
430
430
  h);if(T&&T.startTimeTicks!==u.startTimeTicks)return{processGroupIds:[],status:l.AMBIGUOUS};if(y.length===0)return S?{processGroupIds:[],
431
431
  status:l.AMBIGUOUS}:{processGroupIds:[],status:g.length>0||b(h)?l.MISMATCH:l.ABSENT};let R=[...new Set(y.map(({processGroupId:A})=>A))];
432
- for(let A of R)if(f.filter(Y=>Y.processGroupId===A).some(Y=>!Y.environmentReadable||!y.some(({pid:Vi})=>Vi===Y.pid)))return{
432
+ for(let A of R)if(f.filter(Y=>Y.processGroupId===A).some(Y=>!Y.environmentReadable||!y.some(({pid:Ji})=>Ji===Y.pid)))return{
433
433
  processGroupIds:[],status:l.AMBIGUOUS};return g.some(A=>!y.some(({pid:X})=>X===A.pid))?{processGroupIds:[],status:l.AMBIGUOUS}:
434
434
  {processGroupIds:R,status:l.EXACT}}async function he(w={},u={}){let f=u.processIdentityInspector??gt;return ht(await f(w))}
435
- async function vt(w={},u={},f=0){let h=Date.now()+f,g=await he(w,u);for(;Date.now()<h&&g.status===l.EXACT;)await Yn(100),
435
+ async function vt(w={},u={},f=0){let h=Date.now()+f,g=await he(w,u);for(;Date.now()<h&&g.status===l.EXACT;)await eo(100),
436
436
  g=await he(w,u);return g}async function _e(w={},u={}){let f=V(u.processIdentitySettleTimeoutMs,{fallback:1e3}),h=V(u.processIdentitySettlePollMs,
437
- {fallback:a}),g=Date.now()+f,y=await he(w,u);for(;y.status===l.AMBIGUOUS&&Date.now()<g;)await Yn(Math.min(h,Math.max(1,g-
437
+ {fallback:a}),g=Date.now()+f,y=await he(w,u);for(;y.status===l.AMBIGUOUS&&Date.now()<g;)await eo(Math.min(h,Math.max(1,g-
438
438
  Date.now()))),y=await he(w,u);return y}async function wt(w={},u="SIGTERM",f={}){let h=f.signalProcessGroup??O,g=await _e(
439
439
  w,f);if(g.status!==l.EXACT)return{inspection:g,signaledProcessGroups:[]};let y=Number(w.pid),S=[...g.processGroupIds.filter(
440
440
  R=>R!==y),...g.processGroupIds.filter(R=>R===y)],T=[];for(let R of S){let A=await _e(w,f);if(A.status===l.ABSENT||A.status===
441
441
  l.MISMATCH)return{inspection:A,signaledProcessGroups:T};if(A.status!==l.EXACT)return{inspection:A,signaledProcessGroups:T};
442
- A.processGroupIds.includes(R)&&(h(R,u),T.push(R))}return{inspection:await _e(w,f),signaledProcessGroups:T}}async function ir(w={},u={}){
442
+ A.processGroupIds.includes(R)&&(h(R,u),T.push(R))}return{inspection:await _e(w,f),signaledProcessGroups:T}}async function ar(w={},u={}){
443
443
  if(!v(w))return{identityStatus:l.INVALID,processExitVerified:!1,stopped:!1};if(w.processState===m.STOPPED&&w.processExitVerifiedAt)
444
444
  return{alreadyStopped:!0,identityStatus:l.ABSENT,processExitVerified:!0,stopped:!1};let f=await _e(w,u);if(f.status===l.
445
445
  ABSENT||f.status===l.MISMATCH)return{identityStatus:f.status,processExitVerified:!0,stopped:!1};if(f.status!==l.EXACT)return{
@@ -449,57 +449,57 @@ let g=await vt(w,u,V(u.termTimeoutMs,{fallback:3e3})),y=[...h.signaledProcessGro
449
449
  w,"SIGKILL",u);if(y=[...new Set([...y,...T.signaledProcessGroups])],T.inspection.status===l.AMBIGUOUS)return{identityStatus:T.
450
450
  inspection.status,processExitVerified:!1,signaledProcessGroups:y,stopped:!1};g=await vt(w,u,V(u.killTimeoutMs,{fallback:1e3}))}
451
451
  let S=[l.ABSENT,l.MISMATCH].includes(g.status);return{descendantProcessGroups:y.filter(T=>T!==Number(w.pid)),identityStatus:g.
452
- status,pid:Number(w.pid),processExitVerified:S,signaledProcessGroups:y,stopped:S&&y.length>0}}async function ar(w){if(o!==
453
- "darwin")return P(await pr(`/proc/${w}/stat`,"utf8").catch(()=>""));let u=String(await s(["-o","pgid=,lstart=","-p",String(
452
+ status,pid:Number(w.pid),processExitVerified:S,signaledProcessGroups:y,stopped:S&&y.length>0}}async function cr(w){if(o!==
453
+ "darwin")return P(await fr(`/proc/${w}/stat`,"utf8").catch(()=>""));let u=String(await s(["-o","pgid=,lstart=","-p",String(
454
454
  w)]).catch(()=>"")),f=/^\s*(\d+)\s+(.+?)\s*$/u.exec(u);return f?{processGroupId:Number(f[1]),startTimeTicks:q(f[2])}:null}
455
- async function cr({commandHash:w="",pid:u=null,reportedIdentity:f=null,runtimeToken:h=""}={}){let g=I(w),y=I(h),S=j(f);if(D(
456
- S)&&S.commandHash===g&&S.runtimeToken===y)return S;let T=Number(u),R=p&&Number.isSafeInteger(T)&&T>0?await ar(T):null;if(!R?.
457
- startTimeTicks||R.processGroupId!==T){let A=new Error(`${r} process identity could not be captured.`);throw A.code=n,A}return{
455
+ async function dr({commandHash:w="",pid:u=null,reportedIdentity:f=null,runtimeToken:h=""}={}){let g=I(w),y=I(h),S=j(f);if(D(
456
+ S)&&S.commandHash===g&&S.runtimeToken===y)return S;let T=Number(u),R=p&&Number.isSafeInteger(T)&&T>0?await cr(T):null;if(!R?.
457
+ startTimeTicks||R.processGroupId!==T){let A=new Error(`${n} process identity could not be captured.`);throw A.code=r,A}return{
458
458
  commandHash:g,platform:p,runtimeToken:y,startTimeTicks:R.startTimeTicks,version:c}}return Object.freeze({normalize:j,isValid:D,
459
- normalizeInspection:ht,capture:cr,inspect:he,stop:ir,isProcessAlive:x})}import{execFile as sa}from"node:child_process";import{promisify as ia}from"node:util";var Hf=Object.freeze(["plugins","apps","daemon_auto_start"]);var Vf=Object.freeze([[".tmp",/^(?:plugins(?:$|[.-])|git-|bundled-marketplaces$)/u],["cache",/^(?:remote_plugin_catalog|codex_apps_tools|codex_apps_server_info|codex_app_directory|bundled_plugin_exclusions)$/u]]);var Yf=ia(sa);function ge(t=""){return Array.from(String(t)).some(e=>{let r=e.codePointAt(0);return r<=31||r===127})}var Tt=(t,e,r,n={})=>Object.freeze({id:t,contextWindow:e,variants:Object.freeze(r),...n}),aa=Object.freeze([Object.freeze(
459
+ normalizeInspection:ht,capture:dr,inspect:he,stop:ar,isProcessAlive:x})}import{execFile as da}from"node:child_process";import{promisify as ua}from"node:util";var Gf=Object.freeze(["plugins","apps","daemon_auto_start"]);var Wf=Object.freeze([[".tmp",/^(?:plugins(?:$|[.-])|git-|bundled-marketplaces$)/u],["cache",/^(?:remote_plugin_catalog|codex_apps_tools|codex_apps_server_info|codex_app_directory|bundled_plugin_exclusions)$/u]]);var Qf=ua(da);function ge(t=""){return Array.from(String(t)).some(e=>{let n=e.codePointAt(0);return n<=31||n===127})}var Tt=(t,e,n,r={})=>Object.freeze({id:t,contextWindow:e,variants:Object.freeze(n),...r}),la=Object.freeze([Object.freeze(
460
460
  {id:"deepseek",baseUrl:"https://api.deepseek.com/",claudeBaseUrl:"https://api.deepseek.com/anthropic",claudeAutoCompactWindow:786432,
461
461
  webSearch:!1,models:Object.freeze([Tt("deepseek-flash",1048576,["low","high","max"],{images:!0,freeformPatch:!0,codexHistoryRouting:!0}),
462
462
  Tt("deepseek-v4-pro",1048576,["low","high","max"],{freeformPatch:!0,codexHistoryRouting:!0})])}),Object.freeze({id:"zai-\
463
463
  coding-plan",baseUrl:"https://api.z.ai/api/v1",claudeBaseUrl:"https://api.z.ai/api/anthropic",claudeAutoCompactWindow:1e6,
464
464
  webSearch:!1,models:Object.freeze([Tt("glm-5.3",1048576,["low","high","max"],{freeformPatch:!0,codexHistoryRouting:!0})])}),
465
465
  Object.freeze({id:"zai",baseUrl:"https://api.z.ai/api/v1",claudeBaseUrl:"https://api.z.ai/api/anthropic",claudeAutoCompactWindow:1e6,
466
- webSearch:!1,models:Object.freeze([Tt("glm-5.3",1048576,["low","high","max"],{freeformPatch:!0,codexHistoryRouting:!0})])})]);function Je(t){return aa.find(e=>e.id===t)||null}var nm=32*1024*1024,om=Object.freeze({chatgpt:"https://chatgpt.com/backend-api/codex",apiKey:"https://api.openai.com/v1",
467
- deepseek:Je("deepseek").baseUrl.replace(/\/$/u,""),"zai-coding-plan":Je("zai-coding-plan").baseUrl,zai:Je("zai").baseUrl});var fr=Object.freeze({HELPER:"helper",INTERACTIVE:"interactive"}),mm=bt();var mr=Object.freeze({UNIX:"unix"});var da=process.platform==="linux"?107:103,Zn=Object.freeze({MISSING:"missing",RESPONSIVE:"responsive",TIMEOUT:"timeout",
468
- UNREACHABLE:"unreachable"}),ua=Object.freeze({EXITED:"exited",INCOMPATIBLE:"incompatible",LIVE:"live",MISSING:"missing",
469
- SUSPECT:"suspect"}),Xe=Object.freeze({RUNNING:"running",STOPPED:"stopped"}),Qn=Object.freeze({ABSENT:"absent",AMBIGUOUS:"\
470
- ambiguous",EXACT:"exact",INVALID:"invalid",MISMATCH:"mismatch"});var la=Object.freeze({runtimeToken:"JSKIT_EXECUTION_RUNTIME_TOKEN",modelCatalogSource:"JSKIT_CODEX_MODEL_CATALOG_SOURCE",
471
- commandHash:"JSKIT_EXECUTION_COMMAND_HASH"});var kc=ce(Jo(),1),Nc=ce(Nt(),1),Mc=ce(Oe(),1),jc=ce(Cr(),1),Dc=ce(Ar(),1),zc=ce(Mr(),1),Lc=ce(zt(),1),Uc=ce(ns(),1);var Mg=32*1024,jg=2*1024*1024;var Gt=Object.freeze({ACTIVE:"active",CLEANUP_REQUIRED:"cleanup_required",READY:"ready",STARTING_TURN:"starting_turn"}),
472
- nv=new Set(Object.values(Gt)),ov=Object.freeze(["createdAt","executionProfile","identity","lifecycle","ownershipId","pro\
466
+ webSearch:!1,models:Object.freeze([Tt("glm-5.3",1048576,["low","high","max"],{freeformPatch:!0,codexHistoryRouting:!0})])})]);function Je(t){return la.find(e=>e.id===t)||null}var sm=32*1024*1024,im=Object.freeze({chatgpt:"https://chatgpt.com/backend-api/codex",apiKey:"https://api.openai.com/v1",
467
+ deepseek:Je("deepseek").baseUrl.replace(/\/$/u,""),"zai-coding-plan":Je("zai-coding-plan").baseUrl,zai:Je("zai").baseUrl});var mr=Object.freeze({HELPER:"helper",INTERACTIVE:"interactive"}),gm=bt();var hr=Object.freeze({UNIX:"unix"});var fa=process.platform==="linux"?107:103,to=Object.freeze({MISSING:"missing",RESPONSIVE:"responsive",TIMEOUT:"timeout",
468
+ UNREACHABLE:"unreachable"}),ma=Object.freeze({EXITED:"exited",INCOMPATIBLE:"incompatible",LIVE:"live",MISSING:"missing",
469
+ SUSPECT:"suspect"}),Xe=Object.freeze({RUNNING:"running",STOPPED:"stopped"}),ro=Object.freeze({ABSENT:"absent",AMBIGUOUS:"\
470
+ ambiguous",EXACT:"exact",INVALID:"invalid",MISMATCH:"mismatch"});var ha=Object.freeze({runtimeToken:"JSKIT_EXECUTION_RUNTIME_TOKEN",modelCatalogSource:"JSKIT_CODEX_MODEL_CATALOG_SOURCE",
471
+ commandHash:"JSKIT_EXECUTION_COMMAND_HASH"});var Dc=ce(Zo(),1),zc=ce(Mt(),1),Lc=ce(Re(),1),Uc=ce(_r(),1),Fc=ce(Or(),1),qc=ce(jr(),1),$c=ce(zt(),1),Bc=ce(is(),1);var Dg=32*1024,zg=2*1024*1024;var Gt=Object.freeze({ACTIVE:"active",CLEANUP_REQUIRED:"cleanup_required",READY:"ready",STARTING_TURN:"starting_turn"}),
472
+ sv=new Set(Object.values(Gt)),iv=Object.freeze(["createdAt","executionProfile","identity","lifecycle","ownershipId","pro\
473
473
  jectContextRoot","projectRuntimeRoot","revision","schemaVersion","sessionId","threadId","turnId","updatedAt","workdir"]),
474
- sv=Object.freeze(["providerId","providerKeyFingerprint","runtime","server","transportId"]),iv=Object.freeze(["accountIde\
474
+ av=Object.freeze(["providerId","providerKeyFingerprint","runtime","server","transportId"]),cv=Object.freeze(["accountIde\
475
475
  ntitySignature","authStateSignature","endpoint","executionMode","executionContextHash","provider","runtimeDir","runtimes\
476
- Hash","terminalEnvHash","toolHomeSource","transport"]),av=Object.freeze(["userAgent"]);import ud from"node:path";var ld=Object.freeze(["apps","artifact","browser_use","browser_use_external","browser_use_full_cdp_access","code_mode","\
476
+ Hash","terminalEnvHash","toolHomeSource","transport"]),dv=Object.freeze(["userAgent"]);import md from"node:path";var hd=Object.freeze(["apps","artifact","browser_use","browser_use_external","browser_use_full_cdp_access","code_mode","\
477
477
  code_mode_host","computer_use","default_mode_request_user_input","deferred_executor","goals","hooks","image_generation",
478
478
  "in_app_browser","memories","multi_agent","multi_agent_v2","plugins","psp","recommended_plugins","request_permissions_to\
479
479
  ol","shell_tool","skill_mcp_dependency_install","skill_search","tool_call_mcp_elicitation","tool_suggest","unified_exec",
480
- "unified_exec_zsh_fork","view_image"]);function xs(t){if(!t||typeof t!="object"||Object.isFrozen(t))return t;for(let e of Object.
481
- values(t))xs(e);return Object.freeze(t)}function pd(t="",e={}){let r=new Error(I(t)||"Codex cannot prove the helper exec\
482
- ution policy.");r.code="codex_policy_unenforceable",r.details=Object.freeze({...e});for(let[n,o]of Object.entries(r.details))
483
- ["code","details","message","name"].includes(n)||(r[n]=o);return r}function fd({clientName:t="jskit",minimumVersion:e="0\
484
- .151.0",disabledFeatures:r=ld,limits:{userAgentMaxLength:n=512,mcpServerMaxCount:o=128,mcpServerNameMaxLength:s=256,configResponseMaxBytes:i=256*
480
+ "unified_exec_zsh_fork","view_image"]);function Cs(t){if(!t||typeof t!="object"||Object.isFrozen(t))return t;for(let e of Object.
481
+ values(t))Cs(e);return Object.freeze(t)}function gd(t="",e={}){let n=new Error(I(t)||"Codex cannot prove the helper exec\
482
+ ution policy.");n.code="codex_policy_unenforceable",n.details=Object.freeze({...e});for(let[r,o]of Object.entries(n.details))
483
+ ["code","details","message","name"].includes(r)||(n[r]=o);return n}function vd({clientName:t="jskit",minimumVersion:e="0\
484
+ .151.0",disabledFeatures:n=hd,limits:{userAgentMaxLength:r=512,mcpServerMaxCount:o=128,mcpServerNameMaxLength:s=256,configResponseMaxBytes:i=256*
485
485
  1024,hookMaxCount:a=256,hookErrorMaxCount:c=256,hookFieldMaxLength:d=2048,hookFingerprintMaxLength:p=256*1024,hookResponseMaxBytes:m=512*
486
- 1024}={},createError:l=pd}={}){let v=new WeakSet;function x(u,f,h){let g=0;try{g=Buffer.byteLength(JSON.stringify(u),"ut\
486
+ 1024}={},createError:l=gd}={}){let v=new WeakSet;function x(u,f,h){let g=0;try{g=Buffer.byteLength(JSON.stringify(u),"ut\
487
487
  f8")}catch{throw l(`Codex helper execution received an invalid ${h}.`)}if(g>f)throw l(`Codex helper execution received a\
488
488
  n oversized ${h}.`)}function b(u){if(typeof u?.currentConnectionGeneration!="function")throw l("Codex helper execution c\
489
489
  annot verify the app-server connection generation.");let f=u.currentConnectionGeneration();if(!Number.isSafeInteger(f)||
490
490
  f<=0)throw l("Codex helper execution found no active app-server connection.");return f}async function O(u){if(typeof u?.
491
491
  currentHelperExecutionContext!="function")throw l("Codex helper execution requires its dedicated isolated provider.");let f=await u.
492
- currentHelperExecutionContext(),h=I(f?.cwd),g=I(f?.accountIdentitySignature);if(f?.executionMode!=="helper"||!h||!ud.isAbsolute(
492
+ currentHelperExecutionContext(),h=I(f?.cwd),g=I(f?.accountIdentitySignature);if(f?.executionMode!=="helper"||!h||!md.isAbsolute(
493
493
  h)||!/^sha256:[a-f0-9]{64}$/u.test(g))throw l("Codex helper runtime isolation could not be verified.");return Object.freeze(
494
494
  {accountIdentitySignature:g,cwd:h,executionMode:"helper"})}function P(u=""){let f=I(u).match(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/u);
495
495
  if(!f)return null;let h=f.slice(1).map(g=>Number.parseInt(g,10));return h.every(Number.isSafeInteger)?h:null}function j(u=""){
496
- let f=I(u);if(!f||f.length>n||ge(f))return null;let h=`${t}/`;if(!f.startsWith(h))return null;let g=f.slice(h.length).match(
496
+ let f=I(u);if(!f||f.length>r||ge(f))return null;let h=`${t}/`;if(!f.startsWith(h))return null;let g=f.slice(h.length).match(
497
497
  /^((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*))(?:$|[ \t].*$)/u);return g?P(g[1]):null}function D(u){if(typeof u?.currentServerInfo!=
498
498
  "function")throw l("Codex helper execution cannot verify the app-server version. Update Codex and retry.",{minimumVersion:e});
499
499
  let f=I(u.currentServerInfo()?.userAgent),h=j(f);if(!h)throw l("Codex helper execution received an unrecognised app-serv\
500
500
  er version. Update Codex and retry.",{minimumVersion:e});let g=h.join("."),y=P(e),S=h.findIndex((T,R)=>T!==y[R]);if(S!==
501
501
  -1&&h[S]<y[S])throw l(`Codex helper execution requires app-server ${e} or newer; current version is ${g}. Update Codex a\
502
- nd retry.`,{actualVersion:g,minimumVersion:e});return Object.freeze({minimumVersion:e,version:g})}function L(u=null){if(!yt(
502
+ nd retry.`,{actualVersion:g,minimumVersion:e});return Object.freeze({minimumVersion:e,version:g})}function U(u=null){if(!yt(
503
503
  u?.config))throw l("Codex helper execution could not read the effective app-server configuration.");let f=u.config.mcp_servers;
504
504
  if(f==null)return[];if(x(f,i,"MCP configuration"),!yt(f))throw l("Codex helper execution received an invalid MCP server \
505
505
  configuration.");let h=Object.keys(f);if(h.length>o||h.some(g=>!g||g.length>s||ge(g)))throw l("Codex helper execution re\
@@ -514,13 +514,13 @@ entory entry.");if(S?.isManaged===!0&&S?.enabled===!0)throw l("Codex helper exec
514
514
  currentHash:R,enabled:S?.enabled===!0,handlerType:A,isManaged:S?.isManaged===!0,key:T,sourcePath:X}}).sort((S,T)=>S.key.
515
515
  localeCompare(T.key)),y=JSON.stringify(g);if(y.length>p)throw l("Codex helper execution received an oversized hook inven\
516
516
  tory.");return{fingerprint:y,hookKeys:g.filter(S=>!S.isManaged).map(S=>S.key)}}function H({effort:u="",summary:f="",hookKeys:h=[],
517
- mcpServerNames:g=[]}={}){let y={features:Object.fromEntries(r.map(T=>[T,!1])),hooks:{state:Object.fromEntries(h.map(T=>[
517
+ mcpServerNames:g=[]}={}){let y={features:Object.fromEntries(n.map(T=>[T,!1])),hooks:{state:Object.fromEntries(h.map(T=>[
518
518
  T,{enabled:!1}]))},include_apps_instructions:!1,include_collaboration_mode_instructions:!1,include_environment_context:!1,
519
519
  include_permissions_instructions:!1,...u?{model_reasoning_effort:u}:{},...f?{model_reasoning_summary:f}:{},mcp_servers:Object.
520
520
  fromEntries(g.map(T=>[T,{enabled:!1}])),memories:{dedicated_tools:!1,generate_memories:!1,use_memories:!1},notify:[],orchestrator:{
521
521
  mcp:{enabled:!1},skills:{enabled:!1}},project_doc_max_bytes:0,shell_environment_policy:{inherit:"none",set:{}},skills:{include_instructions:!1},
522
- tools:{experimental_request_user_input:{enabled:!1},update_plan:{enabled:!1}},web_search:"disabled"},S=xs(y);return v.add(
523
- S),S}function q(u,f,h,{effort:g="",summary:y=""}={}){let S=L(u),T=J(f,h);return{mcpServerNames:S,hookState:T,config:H({effort:g,
522
+ tools:{experimental_request_user_input:{enabled:!1},update_plan:{enabled:!1}},web_search:"disabled"},S=Cs(y);return v.add(
523
+ S),S}function q(u,f,h,{effort:g="",summary:y=""}={}){let S=U(u),T=J(f,h);return{mcpServerNames:S,hookState:T,config:H({effort:g,
524
524
  summary:y,hookKeys:T.hookKeys,mcpServerNames:S})}}async function ae(u,{effort:f="",summary:h=""}={}){if(D(u),typeof u?.readConfig!=
525
525
  "function"||typeof u?.listHooks!="function")throw l("Codex helper execution cannot inventory configuration and hooks.");
526
526
  let g=await O(u),y=b(u),S=await u.readConfig({cwd:g.cwd,includeLayers:!1});if(b(u)!==y)throw l("Codex app-server reconne\
@@ -530,10 +530,10 @@ freeze({accountIdentitySignature:g.accountIdentitySignature,config:X,connectionG
530
530
  fingerprint,hookKeys:Object.freeze([...A.hookKeys]),mcpServerNames:Object.freeze([...R])})}function me(u=null,f=null){return u?.
531
531
  accountIdentitySignature===f?.accountIdentitySignature&&u?.connectionGeneration===f?.connectionGeneration&&u?.executionCwd===
532
532
  f?.executionCwd&&u?.hookFingerprint===f?.hookFingerprint&&JSON.stringify(u?.mcpServerNames||[])===JSON.stringify(f?.mcpServerNames||
533
- [])}function Ge(u,f,h=""){let g=I(h);if(!f)return u.codexAppServerHelperThreadId=g,u.codexAppServerHelperThreadRetired=!0,
533
+ [])}function We(u,f,h=""){let g=I(h);if(!f)return u.codexAppServerHelperThreadId=g,u.codexAppServerHelperThreadRetired=!0,
534
534
  u;let y=l("Codex could not retire a helper thread after policy verification failed.",{cleanupFailed:!0,threadId:g});return y.
535
535
  codexAppServerHelperThreadCleanupRequired=!0,y.codexAppServerHelperThreadId=g,y}async function ht({error:u=null,provider:f=null,
536
- threadId:h=""}={}){let g=null;try{await f.deleteThread(h)}catch(y){g=y}throw Ge(u,g,h)}async function gt(u,f,h,g,y){try{
536
+ threadId:h=""}={}){let g=null;try{await f.deleteThread(h)}catch(y){g=y}throw We(u,g,h)}async function gt(u,f,h,g,y){try{
537
537
  let S=await ae(u,{effort:f.config.model_reasoning_effort,summary:f.config.model_reasoning_summary});if(!me(f,S))throw l(
538
538
  `Codex execution surfaces changed while the helper thread was ${y}.`);return Object.freeze({enforcement:S,thread:h,threadId:g})}catch(S){
539
539
  await ht({error:S,provider:u,threadId:g})}}async function he(u,f){if(typeof u?.startThread!="function"||typeof u?.deleteThread!=
@@ -543,414 +543,425 @@ y,"starting")}async function vt(u,f,h){if(typeof u?.resumeThread!="function"||ty
543
543
  "Codex helper execution cannot safely resume and clean up its app-server thread.");let g=I(f);if(!g)throw l("Codex helpe\
544
544
  r resume requires a controller-owned thread id.");let y=await h(),S=y.enforcement,T=await u.resumeThread(g,y.settings);return gt(
545
545
  u,S,T,g,"resuming")}function _e(u){return v.has(u)}function wt({configResult:u,hookResult:f,workdir:h,effort:g="",summary:y=""}){
546
- return q(u,f,h,{effort:g,summary:y}).config}function ir({approvalPolicy:u,baseInstructions:f,config:h,cwd:g,effectiveSettings:y,
546
+ return q(u,f,h,{effort:g,summary:y}).config}function ar({approvalPolicy:u,baseInstructions:f,config:h,cwd:g,effectiveSettings:y,
547
547
  sandbox:S,systemPrompt:T}){return{allowProviderModelFallback:!1,approvalPolicy:u,baseInstructions:f,config:h,cwd:g,systemPrompt:T||
548
- null,dynamicTools:[],environments:[],model:y.model,runtimeWorkspaceRoots:[],sandbox:S,selectedCapabilityRoots:[]}}function ar(u,f){
549
- return{...u,sessionStartSource:"startup",threadSource:f}}function cr(u){return{approvalPolicy:u.approvalPolicy,baseInstructions:u.
548
+ null,dynamicTools:[],environments:[],model:y.model,runtimeWorkspaceRoots:[],sandbox:S,selectedCapabilityRoots:[]}}function cr(u,f){
549
+ return{...u,sessionStartSource:"startup",threadSource:f}}function dr(u){return{approvalPolicy:u.approvalPolicy,baseInstructions:u.
550
550
  baseInstructions,config:u.config,cwd:u.cwd,systemPrompt:u.systemPrompt,model:u.model,runtimeWorkspaceRoots:u.runtimeWorkspaceRoots,
551
551
  sandbox:u.sandbox}}function w({approvalPolicy:u,cwd:f,effectiveSettings:h,outputSchema:g}){let y={approvalPolicy:u,cwd:f,
552
552
  environments:[],model:h.model,outputSchema:g,runtimeWorkspaceRoots:[],sandboxPolicy:{networkAccess:!1,type:"readOnly"},summary:"\
553
553
  none"};return h.request.reasoning&&(y.effort=h.thinking),y}return Object.freeze({assertCompatibility:D,executionContext:O,
554
- inspect:ae,configuration:wt,hasConfiguration:_e,threadSettings:ir,threadStartSettings:ar,threadResumeSettings:cr,turnSettings:w,
555
- start:he,resume:vt})}var Rv=fd();var Zy=Object.freeze({PROVIDER_FAILURE:"provider_failure",RESPONSE_DELIVERY_FAILURE:"response_delivery_failure",SERVICE_RESTART:"\
554
+ inspect:ae,configuration:wt,hasConfiguration:_e,threadSettings:ar,threadStartSettings:cr,threadResumeSettings:dr,turnSettings:w,
555
+ start:he,resume:vt})}var kv=vd();var eI=Object.freeze({PROVIDER_FAILURE:"provider_failure",RESPONSE_DELIVERY_FAILURE:"response_delivery_failure",SERVICE_RESTART:"\
556
556
  service_restart",USER_CANCELLED:"user_cancelled",CONTROL_RECONFIGURATION:"control_reconfiguration",INTERRUPTED:"interrup\
557
- ted"});var fI=Number.MAX_SAFE_INTEGER;var kd=(Number(process.env.AGENT_REPLY_MINUTES)||15)*60*1e3;function Qr(t){return{stoppedShort:`(Check from ${t}: your reply ended by saying what you'd do next, and then stopped, s\
557
+ ted"});var hI=Number.MAX_SAFE_INTEGER;var Dd=(Number(process.env.AGENT_REPLY_MINUTES)||15)*60*1e3;function en(t){return{stoppedShort:`(Check from ${t}: your reply ended by saying what you'd do next, and then stopped, s\
558
558
  o the person is left waiting. Carry on now with your tools and finish the job, then reply with the result. If you can't,\
559
559
  say plainly why.)`,markup:`(Check from ${t}: your last message contained raw markup, such as a tool call written out as\
560
560
  text or special tokens, so nothing in it ran and the person can't read it. Carry on now: call the tools properly to do \
561
- what's left, then reply in plain words.)`,unsupported:e=>`(Check from ${t}: your reply says ${e.map(r=>`"${r}"`).join(",\
561
+ what's left, then reply in plain words.)`,unsupported:e=>`(Check from ${t}: your reply says ${e.map(n=>`"${n}"`).join(",\
562
562
  ")}, but no tool in this reply did that, so it hasn't happened. Do it now with the right tool, or answer again without \
563
563
  saying it's done.)`,resumed:"(This reply was interrupted part-way, when the server running it stopped. Your steps so far\
564
- are above and what they did stays done. Carry on from where you got to, without redoing them, and finish the job.)"}}var MI=["You check an assistant's reply against a record of what its tools did while writing that reply.","List each sta\
564
+ are above and what they did stays done. Carry on from where you got to, without redoing them, and finish the job.)"}}var zI=["You check an assistant's reply against a record of what its tools did while writing that reply.","List each sta\
565
565
  tement in the reply that says something was done in this reply (made, saved, sent, attached, added, changed, deleted, bo\
566
566
  oked, set up, fixed, run, tested) that the record doesn't support.","A claim is supported if a tool call and its answer \
567
567
  in the record show it happened. Ignore plans, offers, questions, advice, facts about the person, things said to have hap\
568
568
  pened earlier in the conversation, and descriptions of what a file or app contains.",'Reply with JSON only: {"unsupporte\
569
569
  d": ["short quote of each unsupported claim"]}, with [] when every claim is supported.'].join(`
570
- `);var iS=64*1024;var Kd="the app",fS=Qr(Kd);var hS=16*1024*1024;var yS=new URL("./../../../@jskit-ai/assistant-core/src/server/conversation/commandWrapper.js",import.meta.url).href;var tu=Object.freeze({streaming:!1,instructions:!1,configuration:!1,goals:!1,goalBudgets:!1,goalCommands:Object.freeze({}),
571
- attachments:!1,tools:!1,nativeTools:!1});var Wx=Object.freeze({goals:!0,goalBudgets:!1,goalCommands:Object.freeze({set:Object.freeze({delivery:"message",interruptsTurn:!1}),
570
+ `);var dS=64*1024;var Zd="the app",gS=en(Zd);var wS=16*1024*1024;var xS=new URL("./../../../@jskit-ai/assistant-core/src/server/conversation/commandWrapper.js",import.meta.url).href;var su=Object.freeze({streaming:!1,instructions:!1,configuration:!1,goals:!1,goalBudgets:!1,goalCommands:Object.freeze({}),
571
+ attachments:!1,tools:!1,nativeTools:!1});var Qx=Object.freeze({goals:!0,goalBudgets:!1,goalCommands:Object.freeze({set:Object.freeze({delivery:"message",interruptsTurn:!1}),
572
572
  resume:Object.freeze({delivery:"message",interruptsTurn:!1}),pause:Object.freeze({delivery:"control",interruptsTurn:!0}),
573
- cancel:Object.freeze({delivery:"message",interruptsTurn:!0})})}),Kx=Object.freeze({});var bb=new URL("./../../../@jskit-ai/assistant-core/src/server/conversation/codexRuntime.js",import.meta.url).href;import{createHash as Ds}from"node:crypto";import{open as Iu}from"node:fs/promises";import zs from"node:path";var an=1024*1024,Su=256*1024,Ls=512,xu=128,bu=16*1024;function cn({errorPrefix:t="",identityNamespace:e="codex-account-v\
574
- 1",secretNamespace:r="codex-auth-secret-v1"}={}){function n(d="",p="",{messageCode:m}={}){let l=new Error(I(p)||"Codex h\
573
+ cancel:Object.freeze({delivery:"message",interruptsTurn:!0})})}),eb=Object.freeze({});var Ob=new URL("./../../../@jskit-ai/assistant-core/src/server/conversation/codexRuntime.js",import.meta.url).href;import{createHash as Us}from"node:crypto";import{open as Tu}from"node:fs/promises";import Fs from"node:path";var cn=1024*1024,Cu=256*1024,qs=512,_u=128,Eu=16*1024;function dn({errorPrefix:t="",identityNamespace:e="codex-account-v\
574
+ 1",secretNamespace:n="codex-auth-secret-v1"}={}){function r(d="",p="",{messageCode:m}={}){let l=new Error(I(p)||"Codex h\
575
575
  elper authentication is unavailable. Reconnect Codex and retry.");return l.code=I(d)||`${t}codex_helper_auth_unavailable`,
576
576
  I(p)?m&&(l.messageCode=m):l.messageCode="assistant.codex.helperAuthUnavailable",l.messageCode&&(l.messageParams={}),l}function o(d,{
577
- label:p="Codex authentication value",maxLength:m=0}={}){if(typeof d!="string"||d.length===0||d.length>m)throw n(`${t}cod\
577
+ label:p="Codex authentication value",maxLength:m=0}={}){if(typeof d!="string"||d.length===0||d.length>m)throw r(`${t}cod\
578
578
  ex_helper_auth_invalid`,`${p} is missing or invalid. Reconnect Codex and retry.`);return d}function s(d="",p=""){return`\
579
- sha256:${Ds("sha256").update(`${e}\0`,"utf8").update(I(d),"utf8").update("\0","utf8").update(String(p||""),"utf8").digest(
580
- "hex")}`}function i(d=""){return Ds("sha256").update(`${r}\0`,"utf8").update(String(d||""),"utf8").digest("hex")}async function a(d=""){
581
- let p=null;try{p=await Iu(d,"r");let m=await p.stat();if(!m.isFile()||m.size>an)throw n(`${t}codex_helper_auth_invalid`,
579
+ sha256:${Us("sha256").update(`${e}\0`,"utf8").update(I(d),"utf8").update("\0","utf8").update(String(p||""),"utf8").digest(
580
+ "hex")}`}function i(d=""){return Us("sha256").update(`${n}\0`,"utf8").update(String(d||""),"utf8").digest("hex")}async function a(d=""){
581
+ let p=null;try{p=await Tu(d,"r");let m=await p.stat();if(!m.isFile()||m.size>cn)throw r(`${t}codex_helper_auth_invalid`,
582
582
  "The selected Codex authentication record is invalid. Reconnect Codex and retry.",{messageCode:"assistant.codex.authReco\
583
- rdInvalid"});let l=Buffer.alloc(an+1),v=0;for(;v<l.length;){let{bytesRead:b}=await p.read(l,v,l.length-v,null);if(b===0)
584
- break;v+=b}if(v>an)throw n(`${t}codex_helper_auth_invalid`,"The selected Codex authentication record is too large. Recon\
583
+ rdInvalid"});let l=Buffer.alloc(cn+1),v=0;for(;v<l.length;){let{bytesRead:b}=await p.read(l,v,l.length-v,null);if(b===0)
584
+ break;v+=b}if(v>cn)throw r(`${t}codex_helper_auth_invalid`,"The selected Codex authentication record is too large. Recon\
585
585
  nect Codex and retry.",{messageCode:"assistant.codex.authRecordTooLarge"});let x=JSON.parse(l.subarray(0,v).toString("ut\
586
586
  f8"));if(!E(x))throw new Error("invalid authentication record");return x}catch(m){throw m?.code?.startsWith?.(`${t}codex\
587
- _helper_auth_`)?m:n(`${t}codex_helper_auth_unavailable`,"The selected Codex authentication record could not be read. Rec\
587
+ _helper_auth_`)?m:r(`${t}codex_helper_auth_unavailable`,"The selected Codex authentication record could not be read. Rec\
588
588
  onnect Codex and retry.",{messageCode:"assistant.codex.authRecordUnreadable"})}finally{await p?.close().catch(()=>null)}}
589
- async function c(d={}){let p=I(d.toolHomeSource);if(!p||!zs.isAbsolute(p))throw n(`${t}codex_helper_auth_unavailable`,"T\
589
+ async function c(d={}){let p=I(d.toolHomeSource);if(!p||!Fs.isAbsolute(p))throw r(`${t}codex_helper_auth_unavailable`,"T\
590
590
  he selected Codex account is unavailable. Reconnect Codex and retry.",{messageCode:"assistant.codex.accountUnavailable"});
591
- let m=await a(zs.join(p,".codex","auth.json")),l=I(m.auth_mode).toLowerCase();if(l==="chatgpt"){let v=E(m.tokens)?m.tokens:
592
- {},x=o(v.account_id,{label:"Codex account identity",maxLength:Ls}),b=o(v.access_token,{label:"Codex access token",maxLength:Su}),
593
- O=v.chatgpt_plan_type??v.plan_type,P=O==null||O===""?"":o(O,{label:"Codex plan type",maxLength:xu});return Object.freeze(
591
+ let m=await a(Fs.join(p,".codex","auth.json")),l=I(m.auth_mode).toLowerCase();if(l==="chatgpt"){let v=E(m.tokens)?m.tokens:
592
+ {},x=o(v.account_id,{label:"Codex account identity",maxLength:qs}),b=o(v.access_token,{label:"Codex access token",maxLength:Cu}),
593
+ O=v.chatgpt_plan_type??v.plan_type,P=O==null||O===""?"":o(O,{label:"Codex plan type",maxLength:_u});return Object.freeze(
594
594
  {accessToken:b,accountId:x,authMode:"chatgpt",identitySignature:s("chatgpt",x),planType:P,secretSignature:i(b)})}if(["ap\
595
- ikey","api_key"].includes(l)){let v=o(m.OPENAI_API_KEY,{label:"Codex API key",maxLength:bu});return Object.freeze({apiKey:v,
596
- authMode:"apiKey",identitySignature:s("apiKey",v),secretSignature:i(v)})}throw n(`${t}codex_helper_auth_invalid`,"The se\
595
+ ikey","api_key"].includes(l)){let v=o(m.OPENAI_API_KEY,{label:"Codex API key",maxLength:Eu});return Object.freeze({apiKey:v,
596
+ authMode:"apiKey",identitySignature:s("apiKey",v),secretSignature:i(v)})}throw r(`${t}codex_helper_auth_invalid`,"The se\
597
597
  lected Codex authentication mode is unsupported. Reconnect Codex and retry.",{messageCode:"assistant.codex.authModeUnsup\
598
- ported"})}return Object.freeze({error:n,identitySignature:s,readRecord:a,readSelected:c})}var Hb=Object.freeze({label:"Checking the Codex sign-in",operationId:"codex-auth-preflight"});var Yb=cn().error;var ST=4*1024*1024;var PC=Object.freeze({goals:!0,goalBudgets:!0,goalCommands:Object.freeze({set:Object.freeze({delivery:"control",interruptsTurn:!1}),
598
+ ported"})}return Object.freeze({error:r,identitySignature:s,readRecord:a,readSelected:c})}var Xb=Object.freeze({label:"Checking the Codex sign-in",operationId:"codex-auth-preflight"});var nT=dn().error;var ET=4*1024*1024;var zC=Object.freeze({goals:!0,goalBudgets:!0,goalCommands:Object.freeze({set:Object.freeze({delivery:"control",interruptsTurn:!1}),
599
599
  resume:Object.freeze({delivery:"control",interruptsTurn:!1}),pause:Object.freeze({delivery:"control",interruptsTurn:!0}),
600
- cancel:Object.freeze({delivery:"control",interruptsTurn:!1})})});var zC=2*1024*1024,LC=32*1024*1024,UC=2*1024*1024;function F(t){if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null||
601
- Nu(e)}function Nu(t){return t!==null&&typeof t=="object"&&Object.getPrototypeOf(t)===null&&Reflect.ownKeys(t).length===0}function ln(t){return t!==null&&typeof t=="object"&&F(t.structure)&&F(t.operations)&&typeof t.validateWith=="function"&&
600
+ cancel:Object.freeze({delivery:"control",interruptsTurn:!1})})});var BC=2*1024*1024,HC=32*1024*1024,VC=2*1024*1024;function z(t){if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null||
601
+ zu(e)}function zu(t){return t!==null&&typeof t=="object"&&Object.getPrototypeOf(t)===null&&Reflect.ownKeys(t).length===0}function pn(t){return t!==null&&typeof t=="object"&&z(t.structure)&&z(t.operations)&&typeof t.validateWith=="function"&&
602
602
  typeof t.toJsonSchema=="function"&&typeof t.cleanup=="function"}function Kt(t,e){if(!Object.hasOwn(e,"items"))return null;
603
- let{items:r}=e;if(ln(r))return{kind:"schema",schema:r};if(!F(r)||typeof r.type!="string")throw new Error(`Array field "${t}\
604
- " must define items as either a Schema instance or a field definition object.`);return{kind:"definition",definition:r}}function lt(t,e){
605
- if(!Object.hasOwn(e,"values"))return null;let{values:r}=e;if(ln(r))return{kind:"schema",schema:r};if(!F(r)||typeof r.type!=
603
+ let{items:n}=e;if(pn(n))return{kind:"schema",schema:n};if(!z(n)||typeof n.type!="string")throw new Error(`Array field "${t}\
604
+ " must define items as either a Schema instance or a field definition object.`);return{kind:"definition",definition:n}}function lt(t,e){
605
+ if(!Object.hasOwn(e,"values"))return null;let{values:n}=e;if(pn(n))return{kind:"schema",schema:n};if(!z(n)||typeof n.type!=
606
606
  "string")throw new Error(`Object field "${t}" must define values as either a Schema instance or a field definition objec\
607
- t.`);return{kind:"definition",definition:r}}function Jt(t,e){let r=Object.hasOwn(e,"schema"),n=Object.hasOwn(e,"values"),
608
- o=Object.hasOwn(e,"additionalProperties");if(r&&n)throw new Error(`Object field "${t}" cannot define both schema and val\
607
+ t.`);return{kind:"definition",definition:n}}function Jt(t,e){let n=Object.hasOwn(e,"schema"),r=Object.hasOwn(e,"values"),
608
+ o=Object.hasOwn(e,"additionalProperties");if(n&&r)throw new Error(`Object field "${t}" cannot define both schema and val\
609
609
  ues.`);if(o&&e.additionalProperties!==!0)throw new Error(`Object field "${t}" only supports additionalProperties: true.`);
610
- if(n&&e.additionalProperties===!0)throw new Error(`Object field "${t}" cannot define both values and additionalPropertie\
611
- s: true.`);if(r){if(!ln(e.schema))throw new Error(`Object field "${t}" must define schema as a Schema instance.`);return{
612
- kind:"nested",schema:e.schema,allowAdditionalProperties:e.additionalProperties===!0}}return n?{kind:"map",valuesConfig:lt(
613
- t,e)}:e.additionalProperties===!0?{kind:"opaque"}:{kind:"plain"}}function Le(t){return t?.type==="number"||t?.type==="integer"||t?.type==="epochMilliseconds"||t?.type==="epochSeconds"}var pn="^(?:0|-?[1-9]\\d*)$",Us="\\d{4}",Fs="0[1-9]|1[0-2]",qs="0[1-9]|[12]\\d|3[01]",$s="[01]\\d|2[0-3]",Ue="[0-5]\\d",
614
- Xt=`(?:${$s}):${Ue}`,Bs=`(?:Z|[+-](?:${$s}):${Ue})`,Hs=`(${Us})-(${Fs})-(${qs})`,Vs=`${Us}-(?:${Fs})-(?:${qs})`,Gs=`^${Vs}\
615
- $`,Mu=new RegExp(`^${Hs}$`),ju=new RegExp(`^${Xt}(?::${Ue}(?:\\.(\\d+))?)?$`),Du=new RegExp(`^${Hs}T${Xt}:${Ue}(?:\\.(\\d+\
616
- ))?${Bs}$`),zu=new RegExp(pn),Lu=[31,28,31,30,31,30,31,31,30,31,30,31];function Uu(t){return t%4===0&&(t%100!==0||t%400===
617
- 0)}function Fu(t,e){return e===2?Uu(t)?29:28:Lu[e-1]}function Ws(t,e,r){let n=Number(t),o=Number(e),s=Number(r);return o>=
618
- 1&&o<=12&&s>=1&&s<=Fu(n,o)}function pt(t,e){let r=t.temporalPrecision;if(r!==void 0){if(!Number.isInteger(r)||r<0)throw new Error(
619
- `temporalPrecision for "${e}" must be a non-negative integer.`);return r}}function Ks(t,e){return t===void 0?!0:e===void 0||
620
- t.length<=e}function Js(t){if(typeof t!="string")return!1;let e=Mu.exec(t);return e!==null&&Ws(e[1],e[2],e[3])}function Xs(t,e){
621
- if(typeof t!="string")return!1;let r=ju.exec(t);return r!==null&&Ks(r[1],e)}function Ys(t,e){if(typeof t!="string")return!1;
622
- let r=Du.exec(t);return r===null?!1:Ws(r[1],r[2],r[3])&&Ks(r[4],e)}function Zs(t){return t===void 0?"(?:\\.\\d+)?":t===0?
623
- "":`(?:\\.\\d{1,${t}})?`}function Qs(t,e){let r=pt(t,e);return`^${Xt}(?::${Ue}${Zs(r)})?$`}function ei(t,e){let r=pt(t,e);
624
- return`^${Vs}T${Xt}:${Ue}${Zs(r)}${Bs}$`}function fn(t,e){let r;if(typeof t=="number")r=t;else if(typeof t=="string"&&zu.
625
- test(t))r=Number(t);else return null;return!Number.isSafeInteger(r)||r<-e||r>e?null:r===0?0:r}var qu=new Set(["__proto__","prototype","constructor"]);function C(t,e,r){Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0})}function $u(t,e){if(qu.
626
- has(t))throw new Error(`${e}() received unsafe path segment "${t}".`)}function Bu(t){return typeof t!="string"?t:t.replace(
627
- /\[(.+?)\]/g,".$1").replace(/^\.+/,"").replace(/\.+/g,".").replace(/\.$/,"")}function mn(t,e,{normalize:r=!1,allowEmpty:n=!1}={}){
628
- let o=r?Bu(t):t;if(typeof o!="string"||o.trim()===""){if(n&&o==="")return[];throw new Error(`${e}() expects a non-empty \
610
+ if(r&&e.additionalProperties===!0)throw new Error(`Object field "${t}" cannot define both values and additionalPropertie\
611
+ s: true.`);if(n){if(!pn(e.schema))throw new Error(`Object field "${t}" must define schema as a Schema instance.`);return{
612
+ kind:"nested",schema:e.schema,allowAdditionalProperties:e.additionalProperties===!0}}return r?{kind:"map",valuesConfig:lt(
613
+ t,e)}:e.additionalProperties===!0?{kind:"opaque"}:{kind:"plain"}}function Ue(t){return t?.type==="number"||t?.type==="integer"||t?.type==="epochMilliseconds"||t?.type==="epochSeconds"}function fn(t,e=""){
614
+ if(z(t))for(let[n,r]of Object.entries(t)){if(!z(r))continue;let o=e?`${e}.${n}`:n;for(let s of["minItems","maxItems"]){if(!Object.
615
+ hasOwn(r,s))continue;let i=r[s];if(r.type!=="array"||!Number.isInteger(i)||i<0)throw new Error(`Field "${o}" ${s} must b\
616
+ e a non-negative integer on an array field.`)}if(r.minItems>r.maxItems)throw new Error(`Field "${o}" minItems (${r.minItems}\
617
+ ) is above its maxItems (${r.maxItems}).`);r.type==="array"&&z(r.items)&&typeof r.items.type=="string"&&fn({"[]":r.items},
618
+ o)}}var mn="^(?:0|-?[1-9]\\d*)$",$s="\\d{4}",Bs="0[1-9]|1[0-2]",Hs="0[1-9]|[12]\\d|3[01]",Vs="[01]\\d|2[0-3]",Fe="[0-5]\\d",
619
+ Xt=`(?:${Vs}):${Fe}`,Gs=`(?:Z|[+-](?:${Vs}):${Fe})`,Ws=`(${$s})-(${Bs})-(${Hs})`,Ks=`${$s}-(?:${Bs})-(?:${Hs})`,Js=`^${Ks}\
620
+ $`,Lu=new RegExp(`^${Ws}$`),Uu=new RegExp(`^${Xt}(?::${Fe}(?:\\.(\\d+))?)?$`),Fu=new RegExp(`^${Ws}T${Xt}:${Fe}(?:\\.(\\d+\
621
+ ))?${Gs}$`),qu=new RegExp(mn),$u=[31,28,31,30,31,30,31,31,30,31,30,31];function Bu(t){return t%4===0&&(t%100!==0||t%400===
622
+ 0)}function Hu(t,e){return e===2?Bu(t)?29:28:$u[e-1]}function Xs(t,e,n){let r=Number(t),o=Number(e),s=Number(n);return o>=
623
+ 1&&o<=12&&s>=1&&s<=Hu(r,o)}function pt(t,e){let n=t.temporalPrecision;if(n!==void 0){if(!Number.isInteger(n)||n<0)throw new Error(
624
+ `temporalPrecision for "${e}" must be a non-negative integer.`);return n}}function Ys(t,e){return t===void 0?!0:e===void 0||
625
+ t.length<=e}function Zs(t){if(typeof t!="string")return!1;let e=Lu.exec(t);return e!==null&&Xs(e[1],e[2],e[3])}function Qs(t,e){
626
+ if(typeof t!="string")return!1;let n=Uu.exec(t);return n!==null&&Ys(n[1],e)}function ei(t,e){if(typeof t!="string")return!1;
627
+ let n=Fu.exec(t);return n===null?!1:Xs(n[1],n[2],n[3])&&Ys(n[4],e)}function ti(t){return t===void 0?"(?:\\.\\d+)?":t===0?
628
+ "":`(?:\\.\\d{1,${t}})?`}function ri(t,e){let n=pt(t,e);return`^${Xt}(?::${Fe}${ti(n)})?$`}function ni(t,e){let n=pt(t,e);
629
+ return`^${Ks}T${Xt}:${Fe}${ti(n)}${Gs}$`}function hn(t,e){let n;if(typeof t=="number")n=t;else if(typeof t=="string"&&qu.
630
+ test(t))n=Number(t);else return null;return!Number.isSafeInteger(n)||n<-e||n>e?null:n===0?0:n}var Vu=new Set(["__proto__","prototype","constructor"]);function C(t,e,n){Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0})}function Gu(t,e){if(Vu.
631
+ has(t))throw new Error(`${e}() received unsafe path segment "${t}".`)}function Wu(t){return typeof t!="string"?t:t.replace(
632
+ /\[(.+?)\]/g,".$1").replace(/^\.+/,"").replace(/\.+/g,".").replace(/\.$/,"")}function gn(t,e,{normalize:n=!1,allowEmpty:r=!1}={}){
633
+ let o=n?Wu(t):t;if(typeof o!="string"||o.trim()===""){if(r&&o==="")return[];throw new Error(`${e}() expects a non-empty \
629
634
  dotted path string.`)}let s=o.split(".");if(s.some(i=>i===""))throw new Error(`${e}() received an invalid path "${o}".`);
630
- for(let i of s)$u(i,e);return s}var Hu="http://json-schema.org/draft-07/schema#",fe="x-json-rest-schema",hn=["object","array","string","number","boolean"],
631
- gn=Symbol("json-rest-schema.exportContext"),Vu=["true","1","yes","y","on"],Gu=["false","0","no","n","off"];function ti(t){
632
- return{anyOf:[{type:"integer",minimum:-t,maximum:t},{type:"string",pattern:pn}]}}function be(t,e){return{[fe]:{[t]:e}}}var Wu={
633
- none:()=>({type:hn}),blob:()=>({type:hn}),serialize:()=>({type:hn}),object:()=>({type:"object"}),array:()=>({type:"array"}),
635
+ for(let i of s)Gu(i,e);return s}var Ku="http://json-schema.org/draft-07/schema#",fe="x-json-rest-schema",vn=["object","array","string","number","boolean"],
636
+ wn=Symbol("json-rest-schema.exportContext"),Ju=["true","1","yes","y","on"],Xu=["false","0","no","n","off"];function oi(t){
637
+ return{anyOf:[{type:"integer",minimum:-t,maximum:t},{type:"string",pattern:mn}]}}function be(t,e){return{[fe]:{[t]:e}}}var Yu={
638
+ none:()=>({type:vn}),blob:()=>({type:vn}),serialize:()=>({type:vn}),object:()=>({type:"object"}),array:()=>({type:"array"}),
634
639
  file:()=>({type:"string"}),string:()=>({type:"string"}),number:()=>({type:["number","string"]}),integer:()=>({type:["int\
635
- eger","string"]}),epochMilliseconds:()=>ti(864e13),epochSeconds:()=>ti(864e10),dateTime:({definition:t,fieldName:e})=>({
636
- type:"string",format:"date-time",pattern:ei(t,e)}),date:()=>({type:"string",format:"date",pattern:Gs}),time:({definition:t,
637
- fieldName:e})=>({type:"string",pattern:Qs(t,e)}),boolean:({definition:t})=>{if(t.strictBoolean===!0)return{type:"boolean"};
638
- let e=new Set([...Vu,String(t.stringTrueWhen||"true").trim().toLowerCase()]),r=new Set([...Gu,String(t.stringFalseWhen||
639
- "false").trim().toLowerCase()]);return{anyOf:[{type:"boolean"},{type:"number",enum:[0,1]},{type:"string",enum:[...r,...e]}]}},
640
- id:()=>({type:["integer","string"],minimum:1,pattern:"^[1-9][0-9]*$"})},Ku={minLength:({definition:t,parameterValue:e})=>t.
640
+ eger","string"]}),epochMilliseconds:()=>oi(864e13),epochSeconds:()=>oi(864e10),dateTime:({definition:t,fieldName:e})=>({
641
+ type:"string",format:"date-time",pattern:ni(t,e)}),date:()=>({type:"string",format:"date",pattern:Js}),time:({definition:t,
642
+ fieldName:e})=>({type:"string",pattern:ri(t,e)}),boolean:({definition:t})=>{if(t.strictBoolean===!0)return{type:"boolean"};
643
+ let e=new Set([...Ju,String(t.stringTrueWhen||"true").trim().toLowerCase()]),n=new Set([...Xu,String(t.stringFalseWhen||
644
+ "false").trim().toLowerCase()]);return{anyOf:[{type:"boolean"},{type:"number",enum:[0,1]},{type:"string",enum:[...n,...e]}]}},
645
+ id:()=>({type:["integer","string"],minimum:1,pattern:"^[1-9][0-9]*$"})},Zu={minLength:({definition:t,parameterValue:e})=>t.
641
646
  type==="string"?{minLength:e}:null,maxLength:({definition:t,parameterValue:e})=>t.type==="string"?{maxLength:e}:null,min:({
642
- definition:t,parameterValue:e})=>Le(t)?{minimum:e}:null,max:({definition:t,parameterValue:e})=>Le(t)?{maximum:e}:null,pattern:({
647
+ definition:t,parameterValue:e})=>Ue(t)?{minimum:e}:null,max:({definition:t,parameterValue:e})=>Ue(t)?{maximum:e}:null,pattern:({
643
648
  definition:t,parameterValue:e})=>t.type==="string"?{pattern:e instanceof RegExp?e.source:e}:null,enum:({parameterValue:t})=>({
644
- enum:t}),notEmpty:({parameterValue:t,definition:e})=>!t||e.type==="array"?null:{minLength:1},uppercase:({parameterValue:t})=>t?
645
- be("transforms",{uppercase:!0}):null,lowercase:({parameterValue:t})=>t?be("transforms",{lowercase:!0}):null,length:({parameterValue:t})=>be(
646
- "transforms",{length:t}),unsigned:({parameterValue:t})=>t?be("metadata",{unsigned:!0}):null,precision:({parameterValue:t})=>be(
647
- "metadata",{precision:t}),scale:({parameterValue:t})=>be("metadata",{scale:t}),temporalPrecision:({parameterValue:t})=>be(
648
- "metadata",{temporalPrecision:t}),strictBoolean:()=>null,required:()=>null,nullable:()=>null,nullOnEmpty:()=>null,defaultTo:()=>null};
649
- function In(t,e){for(let r of Object.keys(e)){let n=e[r],o=t[r];if(n&&o&&typeof n=="object"&&typeof o=="object"&&!Array.
650
- isArray(n)&&!Array.isArray(o)){In(o,n);continue}t[r]=n}}function Ju(t,e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(
651
- "JSON Schema export hooks must return an object or null.");for(let r of Object.keys(e)){if(r===fe&&t[r]&&typeof t[r]=="o\
652
- bject"&&typeof e[r]=="object"&&!Array.isArray(t[r])&&!Array.isArray(e[r])){In(t[r],e[r]);continue}t[r]=e[r]}}function Xu(t,e){
653
- let n=[...Array.isArray(t.anyOf)&&Object.keys(t).length===1?t.anyOf:[t],...e];return n.length===1?t:{anyOf:n}}function Yu(t,e){
654
- if(!Object.hasOwn(t.types,e.type))throw new Error(`No casting function for type: ${e.type}`);let r=t.types[e.type];if(typeof r.
655
- toJsonSchema=="function")return r.toJsonSchema;let n=Wu[e.type];if(!n)throw new Error(`Type '${e.type}' cannot be export\
656
- ed to JSON Schema without a toJsonSchema hook.`);return n}function Zu(t,e,r){if(!Object.hasOwn(t.validators,e))return null;
657
- let n=t.validators[e];if(typeof n.toJsonSchema=="function")return n.toJsonSchema;let o=Ku[e];if(o)return o;throw new Error(
658
- `Validator '${e}' on field '${r}' cannot be exported to JSON Schema without a toJsonSchema hook.`)}function ri(t){if(t===
659
- void 0)return"create";if(["create","replace","patch"].includes(t))return t;throw new Error(`Unsupported JSON Schema expo\
660
- rt mode '${t}'. Expected 'create', 'replace', or 'patch'.`)}function Qu(t,e={}){if(e.mode!==void 0&&e.operation!==void 0){
661
- let r=ri(e.mode);if(r!==e.operation)throw new Error(`Conflicting JSON Schema export options: mode '${r}' does not match \
662
- operation '${e.operation}'.`)}if(e.operation!==void 0){if(!Object.hasOwn(t.operations,e.operation))throw new Error(`Unkn\
663
- own JSON Schema export operation '${e.operation}'.`);return e.operation}return ri(e.mode)}function el(t,e={}){if(e.operationName!==
664
- void 0&&e.operationDescriptor!==void 0)return{operationName:e.operationName,operation:e.operationDescriptor};let r=Qu(t,
665
- e);return{operationName:r,operation:t.operations[r]}}function tl(t={}){let e={...t};return Object.defineProperty(e,gn,{value:{
666
- definitions:{},nodes:[],nextDefinitionId:1,rootNode:null},enumerable:!1}),e}function Zt(t={}){return t[gn]?t[gn]:{definitions:{},
667
- nodes:[],nextDefinitionId:1,rootNode:null}}function rl(t){return String(t).replace(/[^a-zA-Z0-9]+/g,"_").replace(/^_+|_+$/g,
668
- "")||"operation"}function vn(t){return F(t)&&Object.keys(t).length===1&&typeof t.$ref=="string"}function Yt(t){return vn(
669
- t)?{allOf:[t]}:t}function nl(t,e,r,n,o){return t.nodes.find(s=>s.schema===e&&s.operationName===r&&s.operation===n&&s.additionalProperties===
670
- o)||null}function ol(t,e){let r=rl(e),n=`SchemaNode_${t.nextDefinitionId}_${r}`;return t.nextDefinitionId+=1,n}function ni(t,e,r,n,o,{
671
- root:s=!1}={}){let i=Zt(e),a=nl(i,t,r,n,o);if(a)return s&&(a.pointer="#",i.rootNode=a),a;let c={schema:t,operationName:r,
672
- operation:n,additionalProperties:o,status:"new",definitionName:s?null:ol(i,r),pointer:s?"#":null};return s?i.rootNode=c:
673
- c.pointer=`#/definitions/${c.definitionName}`,i.nodes.push(c),c}function oi(t,e){if(t.status==="built")return{$ref:t.pointer};
674
- if(t.status==="building")return{$ref:t.pointer};let r=Zt(e);t.status="building",t.pointer!=="#"&&(r.definitions[t.definitionName]=
675
- {});let n=sl(t.schema,e,t.operationName,t.operation,t.additionalProperties);return t.status="built",t.pointer==="#"?n:(r.
676
- definitions[t.definitionName]=n,{$ref:t.pointer})}function Sn(t,e,r,n,o=!1){let s=Zt(e),i=ni(t,e,r,n,o);return s.rootNode===
677
- i?{$ref:"#"}:oi(i,e)}function ft(t,{referenceBacked:e=!1}={}){return{schema:t,referenceBacked:e}}function sl(t,e,r,n,o=!1){
678
- let s={},i=[];for(let[c,d]of Object.entries(t.structure))C(s,c,xn(t,c,d,e,r,n)),n.enforceRequired&&d.required===!0&&i.push(
679
- c);let a={type:"object",properties:s,additionalProperties:o};return i.length>0&&(a.required=i),a}function il(t,e,r,n,o,s){
680
- let i=Kt(e,r);if(!i)return null;if(i.kind==="schema")return{...Yt(Sn(i.schema,n,"replace",i.schema.operations.replace,!1)),
681
- [fe]:{castType:"object"}};let a=r.items.type==="object"&&Object.hasOwn(r.items,"schema")?"replace":o,c=a==="replace"?t.operations.
682
- replace:s;return xn(t,`${e}[]`,r.items,n,a,c)}function al(t,e,r,n,o,s){let i=lt(e,r);if(!i)return null;if(i.kind==="sche\
683
- ma")return{...Yt(Sn(i.schema,n,"replace",i.schema.operations.replace,!1)),[fe]:{castType:"object"}};let a=i.definition.type===
684
- "object"&&Object.hasOwn(i.definition,"schema")?"replace":o,c=a==="replace"?t.operations.replace:s;return xn(t,`${e}.*`,i.
685
- definition,n,a,c)}function cl(t,e,r,n,o,s){if(r.type==="object"){let a=Jt(e,r);if(a.kind==="nested")return ft(Sn(a.schema,
686
- n,o,s,a.allowAdditionalProperties===!0),{referenceBacked:!0});if(a.kind==="opaque")return ft({type:"object",additionalProperties:!0});
687
- if(a.kind==="map")return ft({type:"object",additionalProperties:al(t,e,r,n,o,s)})}let i=Yu(t,r)({schema:t,fieldName:e,definition:r,
688
- operation:o,mode:o,options:n});if(!i||typeof i!="object"||Array.isArray(i))throw new Error(`Type '${r.type}' on field '${e}\
689
- ' returned an invalid JSON Schema fragment.`);if(r.type==="array"){let a=il(t,e,r,n,o,s);if(a)return ft({...i,items:a},{
690
- referenceBacked:vn(i)})}return ft(i,{referenceBacked:vn(i)})}function xn(t,e,r,n,o,s){let i={schema:t,fieldName:e,definition:r,
691
- operation:o,mode:o,options:n},a=cl(t,e,r,n,o,s),c=a.referenceBacked?Yt(a.schema):{...a.schema},d={castType:r.type};for(let l of Object.
692
- keys(r)){if(l==="type"||!Object.hasOwn(t.validators,l))continue;let v=Zu(t,l,e);if(!v)continue;let x=v({...i,parameterName:l,
693
- parameterValue:r[l],fieldSchema:{...c}});x&&Ju(c,x)}c[fe]&&(In(d,c[fe]),delete c[fe]);let p=[];r.nullable===!0&&p.push({
694
- type:"null"}),r.nullOnEmpty===!0&&p.push({const:""});let m=Yt(Xu(c,p));if(r.defaultTo!==void 0&&s.applyDefaults)if(typeof r.
695
- defaultTo!="function"){let l=t._normalizeDefault(r,r.defaultTo,{fieldPath:e,currentObject:{},containerKey:e,objectBeforeCast:{},
696
- options:{},settings:t._buildOperationSettings(o,s,{})});if(Object.keys(l.errors).length>0){let v=Object.values(l.errors)[0];
697
- throw new Error(`defaultTo for "${e}" is invalid (${v.code}).`)}m.default=l.value}else d.defaults={providedByFunction:!0};
698
- return m[fe]=d,m}function si(t,e={}){let r=tl(e),{operationName:n,operation:o}=el(t,r),s=r.additionalProperties===void 0?
699
- !1:r.additionalProperties,i=Zt(r),a=ni(t,r,n,o,s,{root:!0}),c={$schema:Hu,...oi(a,r)};return Object.keys(i.definitions).
700
- length>0&&(c.definitions=i.definitions),c}function ii(t){return t!==null&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function En(t){return t instanceof
701
- $e}function dl(){return{self:!1,children:{}}}function ai(t){return Object.keys(t.children).length>0}function Te(t,e){return`${t}\
702
- .${String(e)}`}function fi(t,e){return t===""?String(e):Te(t,e)}function ci(t,e){if(t===e)return"";let r=`${e}.`;return t.
703
- startsWith(r)?t.slice(r.length):null}function Fe(t,e){let r={};for(let n of Object.values(t)){let o=Te(e,n.field);C(r,o,
704
- {...n,field:o})}return r}function Cn(t){return mn(t,"validatePath")}function di(t){let e={};for(let r of t){let n=Cn(r),
705
- o=e;for(let s=0;s<n.length;s++){let i=n[s];Object.hasOwn(o,i)||C(o,i,dl()),s===n.length-1&&(o[i].self=!0),o=o[i].children}}
706
- return e}function ul(t,e){let r=t;for(let n of e){if(r==null||typeof r!="object"||!Object.hasOwn(r,n))return;r=r[n]}return r}
707
- function Qt(t){return t===null?!0:Array.isArray(t)||F(t)?Object.keys(t).length>0:t!==void 0}function ui(t){return[...t].
708
- sort((e,r)=>{let n=/^[0-9]+$/.test(e),o=/^[0-9]+$/.test(r);return n&&o?Number(e)-Number(r):n?-1:o?1:e.localeCompare(r)})}
709
- function ll(t){return/^[0-9]+$/.test(t)}function pl(t,e=new WeakMap){if(e.has(t))return e.get(t);let r=Object.create($e.
710
- prototype);return e.set(t,r),r.structure=null,r.types=t.types,r.validators=t.validators,r.operations=t.operations,r.structure=
711
- tr(er(t.structure,e)),r._installOperationMethods(),Object.freeze(r)}function er(t,e=new WeakMap){if(t===null||typeof t!=
712
- "object")return t;if(En(t))return pl(t,e);if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){let n=new RegExp(
713
- t.source,t.flags);return n.lastIndex=t.lastIndex,n}if(e.has(t))return e.get(t);if(Array.isArray(t)){let n=[];e.set(t,n);
714
- for(let o of t)n.push(er(o,e));return n}if(!F(t))return t;let r={};e.set(t,r);for(let[n,o]of Object.entries(t))C(r,n,er(
715
- o,e));return r}function tr(t,e=new WeakSet){if(t===null||typeof t!="object"||e.has(t)||En(t))return t;if(e.add(t),Array.
716
- isArray(t))for(let r of t)tr(r,e);else for(let r of Reflect.ownKeys(t))tr(t[r],e);return Object.freeze(t)}function bn(t){
717
- return tr(er(t))}function _n(t,e,r=""){if(!En(t)||!Array.isArray(e)||e.length<1)return null;let[n,...o]=e;if(!Object.hasOwn(
718
- t.structure,n))return null;let s=t.structure[n];if(o.length<1)return s;let i=fi(r,n);return mi(t,s,o,i)}function mi(t,e,r,n){
719
- if(e?.type==="object"){let o=t._resolveObjectFieldMode(n,e);return o.kind!=="nested"?null:_n(o.schema,r,n)}if(e?.type===
720
- "array"){let o=t._resolveArrayItemsConfig(n,e);if(!o||r.length<1)return null;let[s,...i]=r;if(!ll(s))return null;let a=Te(
721
- n,s);return o.kind==="schema"?i.length<1?null:_n(o.schema,i,a):i.length<1?o.definition:mi(t,o.definition,i,a)}return null}
722
- function qe(t,e){let r={...t};if(Array.isArray(t.skipFields)){let n=t.skipFields.map(o=>ci(o,e)).filter(o=>o!==null&&o!==
723
- "");n.length>0?r.skipFields=n:delete r.skipFields}if(F(t.skipParams)){let n={};for(let[o,s]of Object.entries(t.skipParams)){
724
- let i=ci(o,e);i===null||i===""||C(n,i,s)}Object.keys(n).length>0?r.skipParams=n:delete r.skipParams}return r}var fl=Object.
649
+ enum:t}),minItems:({definition:t,parameterValue:e})=>t.type==="array"?{minItems:e}:null,maxItems:({definition:t,parameterValue:e})=>t.
650
+ type==="array"?{maxItems:e}:null,notEmpty:({parameterValue:t,definition:e})=>!t||e.type==="array"?null:{minLength:1},uppercase:({
651
+ parameterValue:t})=>t?be("transforms",{uppercase:!0}):null,lowercase:({parameterValue:t})=>t?be("transforms",{lowercase:!0}):
652
+ null,length:({parameterValue:t})=>be("transforms",{length:t}),unsigned:({parameterValue:t})=>t?be("metadata",{unsigned:!0}):
653
+ null,precision:({parameterValue:t})=>be("metadata",{precision:t}),scale:({parameterValue:t})=>be("metadata",{scale:t}),temporalPrecision:({
654
+ parameterValue:t})=>be("metadata",{temporalPrecision:t}),strictBoolean:()=>null,required:()=>null,nullable:()=>null,nullOnEmpty:()=>null,
655
+ defaultTo:()=>null};function xn(t,e){for(let n of Object.keys(e)){let r=e[n],o=t[n];if(r&&o&&typeof r=="object"&&typeof o==
656
+ "object"&&!Array.isArray(r)&&!Array.isArray(o)){xn(o,r);continue}t[n]=r}}function Qu(t,e){if(!e||typeof e!="object"||Array.
657
+ isArray(e))throw new Error("JSON Schema export hooks must return an object or null.");for(let n of Object.keys(e)){if(n===
658
+ fe&&t[n]&&typeof t[n]=="object"&&typeof e[n]=="object"&&!Array.isArray(t[n])&&!Array.isArray(e[n])){xn(t[n],e[n]);continue}
659
+ t[n]=e[n]}}function el(t,e){let r=[...Array.isArray(t.anyOf)&&Object.keys(t).length===1?t.anyOf:[t],...e];return r.length===
660
+ 1?t:{anyOf:r}}function tl(t,e){if(!Object.hasOwn(t.types,e.type))throw new Error(`No casting function for type: ${e.type}`);
661
+ let n=t.types[e.type];if(typeof n.toJsonSchema=="function")return n.toJsonSchema;let r=Yu[e.type];if(!r)throw new Error(
662
+ `Type '${e.type}' cannot be exported to JSON Schema without a toJsonSchema hook.`);return r}function rl(t,e,n){if(!Object.
663
+ hasOwn(t.validators,e))return null;let r=t.validators[e];if(typeof r.toJsonSchema=="function")return r.toJsonSchema;let o=Zu[e];
664
+ if(o)return o;throw new Error(`Validator '${e}' on field '${n}' cannot be exported to JSON Schema without a toJsonSchema\
665
+ hook.`)}function si(t){if(t===void 0)return"create";if(["create","replace","patch"].includes(t))return t;throw new Error(
666
+ `Unsupported JSON Schema export mode '${t}'. Expected 'create', 'replace', or 'patch'.`)}function nl(t,e={}){if(e.mode!==
667
+ void 0&&e.operation!==void 0){let n=si(e.mode);if(n!==e.operation)throw new Error(`Conflicting JSON Schema export option\
668
+ s: mode '${n}' does not match operation '${e.operation}'.`)}if(e.operation!==void 0){if(!Object.hasOwn(t.operations,e.operation))
669
+ throw new Error(`Unknown JSON Schema export operation '${e.operation}'.`);return e.operation}return si(e.mode)}function ol(t,e={}){
670
+ if(e.operationName!==void 0&&e.operationDescriptor!==void 0)return{operationName:e.operationName,operation:e.operationDescriptor};
671
+ let n=nl(t,e);return{operationName:n,operation:t.operations[n]}}function sl(t={}){let e={...t};return Object.defineProperty(
672
+ e,wn,{value:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null},enumerable:!1}),e}function Zt(t={}){return t[wn]?
673
+ t[wn]:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null}}function il(t){return String(t).replace(/[^a-zA-Z0-9]+/g,
674
+ "_").replace(/^_+|_+$/g,"")||"operation"}function yn(t){return z(t)&&Object.keys(t).length===1&&typeof t.$ref=="string"}
675
+ function Yt(t){return yn(t)?{allOf:[t]}:t}function al(t,e,n,r,o){return t.nodes.find(s=>s.schema===e&&s.operationName===
676
+ n&&s.operation===r&&s.additionalProperties===o)||null}function cl(t,e){let n=il(e),r=`SchemaNode_${t.nextDefinitionId}_${n}`;
677
+ return t.nextDefinitionId+=1,r}function ii(t,e,n,r,o,{root:s=!1}={}){let i=Zt(e),a=al(i,t,n,r,o);if(a)return s&&(a.pointer=
678
+ "#",i.rootNode=a),a;let c={schema:t,operationName:n,operation:r,additionalProperties:o,status:"new",definitionName:s?null:
679
+ cl(i,n),pointer:s?"#":null};return s?i.rootNode=c:c.pointer=`#/definitions/${c.definitionName}`,i.nodes.push(c),c}function ai(t,e){
680
+ if(t.status==="built")return{$ref:t.pointer};if(t.status==="building")return{$ref:t.pointer};let n=Zt(e);t.status="build\
681
+ ing",t.pointer!=="#"&&(n.definitions[t.definitionName]={});let r=dl(t.schema,e,t.operationName,t.operation,t.additionalProperties);
682
+ return t.status="built",t.pointer==="#"?r:(n.definitions[t.definitionName]=r,{$ref:t.pointer})}function bn(t,e,n,r,o=!1){
683
+ let s=Zt(e),i=ii(t,e,n,r,o);return s.rootNode===i?{$ref:"#"}:ai(i,e)}function ft(t,{referenceBacked:e=!1}={}){return{schema:t,
684
+ referenceBacked:e}}function dl(t,e,n,r,o=!1){let s={},i=[];for(let[c,d]of Object.entries(t.structure))C(s,c,Tn(t,c,d,e,n,
685
+ r)),r.enforceRequired&&d.required===!0&&i.push(c);let a={type:"object",properties:s,additionalProperties:o};return i.length>
686
+ 0&&(a.required=i),a}function ul(t,e,n,r,o,s){let i=Kt(e,n);if(!i)return null;if(i.kind==="schema")return{...Yt(bn(i.schema,
687
+ r,"replace",i.schema.operations.replace,!1)),[fe]:{castType:"object"}};let a=n.items.type==="object"&&Object.hasOwn(n.items,
688
+ "schema")?"replace":o,c=a==="replace"?t.operations.replace:s;return Tn(t,`${e}[]`,n.items,r,a,c)}function ll(t,e,n,r,o,s){
689
+ let i=lt(e,n);if(!i)return null;if(i.kind==="schema")return{...Yt(bn(i.schema,r,"replace",i.schema.operations.replace,!1)),
690
+ [fe]:{castType:"object"}};let a=i.definition.type==="object"&&Object.hasOwn(i.definition,"schema")?"replace":o,c=a==="re\
691
+ place"?t.operations.replace:s;return Tn(t,`${e}.*`,i.definition,r,a,c)}function pl(t,e,n,r,o,s){if(n.type==="object"){let a=Jt(
692
+ e,n);if(a.kind==="nested")return ft(bn(a.schema,r,o,s,a.allowAdditionalProperties===!0),{referenceBacked:!0});if(a.kind===
693
+ "opaque")return ft({type:"object",additionalProperties:!0});if(a.kind==="map")return ft({type:"object",additionalProperties:ll(
694
+ t,e,n,r,o,s)})}let i=tl(t,n)({schema:t,fieldName:e,definition:n,operation:o,mode:o,options:r});if(!i||typeof i!="object"||
695
+ Array.isArray(i))throw new Error(`Type '${n.type}' on field '${e}' returned an invalid JSON Schema fragment.`);if(n.type===
696
+ "array"){let a=ul(t,e,n,r,o,s);if(a)return ft({...i,items:a},{referenceBacked:yn(i)})}return ft(i,{referenceBacked:yn(i)})}
697
+ function Tn(t,e,n,r,o,s){let i={schema:t,fieldName:e,definition:n,operation:o,mode:o,options:r},a=pl(t,e,n,r,o,s),c=a.referenceBacked?
698
+ Yt(a.schema):{...a.schema},d={castType:n.type};for(let l of Object.keys(n)){if(l==="type"||!Object.hasOwn(t.validators,l))
699
+ continue;let v=rl(t,l,e);if(!v)continue;let x=v({...i,parameterName:l,parameterValue:n[l],fieldSchema:{...c}});x&&Qu(c,x)}
700
+ c[fe]&&(xn(d,c[fe]),delete c[fe]);let p=[];n.nullable===!0&&p.push({type:"null"}),n.nullOnEmpty===!0&&p.push({const:""});
701
+ let m=Yt(el(c,p));if(n.defaultTo!==void 0&&s.applyDefaults)if(typeof n.defaultTo!="function"){let l=t._normalizeDefault(
702
+ n,n.defaultTo,{fieldPath:e,currentObject:{},containerKey:e,objectBeforeCast:{},options:{},settings:t._buildOperationSettings(
703
+ o,s,{})});if(Object.keys(l.errors).length>0){let v=Object.values(l.errors)[0];throw new Error(`defaultTo for "${e}" is i\
704
+ nvalid (${v.code}).`)}m.default=l.value}else d.defaults={providedByFunction:!0};return m[fe]=d,m}function ci(t,e={}){let n=sl(
705
+ e),{operationName:r,operation:o}=ol(t,n),s=n.additionalProperties===void 0?!1:n.additionalProperties,i=Zt(n),a=ii(t,n,r,
706
+ o,s,{root:!0}),c={$schema:Ku,...ai(a,n)};return Object.keys(i.definitions).length>0&&(c.definitions=i.definitions),c}function di(t){return t!==null&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function Rn(t){return t instanceof
707
+ Be}function fl(){return{self:!1,children:{}}}function ui(t){return Object.keys(t.children).length>0}function Te(t,e){return`${t}\
708
+ .${String(e)}`}function gi(t,e){return t===""?String(e):Te(t,e)}function li(t,e){if(t===e)return"";let n=`${e}.`;return t.
709
+ startsWith(n)?t.slice(n.length):null}function qe(t,e){let n={};for(let r of Object.values(t)){let o=Te(e,r.field);C(n,o,
710
+ {...r,field:o})}return n}function An(t){return gn(t,"validatePath")}function pi(t){let e={};for(let n of t){let r=An(n),
711
+ o=e;for(let s=0;s<r.length;s++){let i=r[s];Object.hasOwn(o,i)||C(o,i,fl()),s===r.length-1&&(o[i].self=!0),o=o[i].children}}
712
+ return e}function ml(t,e){let n=t;for(let r of e){if(n==null||typeof n!="object"||!Object.hasOwn(n,r))return;n=n[r]}return n}
713
+ function Qt(t){return t===null?!0:Array.isArray(t)||z(t)?Object.keys(t).length>0:t!==void 0}function fi(t){return[...t].
714
+ sort((e,n)=>{let r=/^[0-9]+$/.test(e),o=/^[0-9]+$/.test(n);return r&&o?Number(e)-Number(n):r?-1:o?1:e.localeCompare(n)})}
715
+ function hl(t){return/^[0-9]+$/.test(t)}function gl(t,e=new WeakMap){if(e.has(t))return e.get(t);let n=Object.create(Be.
716
+ prototype);return e.set(t,n),n.structure=null,n.types=t.types,n.validators=t.validators,n.operations=t.operations,n.structure=
717
+ tr(er(t.structure,e)),n._installOperationMethods(),Object.freeze(n)}function er(t,e=new WeakMap){if(t===null||typeof t!=
718
+ "object")return t;if(Rn(t))return gl(t,e);if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){let r=new RegExp(
719
+ t.source,t.flags);return r.lastIndex=t.lastIndex,r}if(e.has(t))return e.get(t);if(Array.isArray(t)){let r=[];e.set(t,r);
720
+ for(let o of t)r.push(er(o,e));return r}if(!z(t))return t;let n={};e.set(t,n);for(let[r,o]of Object.entries(t))C(n,r,er(
721
+ o,e));return n}function tr(t,e=new WeakSet){if(t===null||typeof t!="object"||e.has(t)||Rn(t))return t;if(e.add(t),Array.
722
+ isArray(t))for(let n of t)tr(n,e);else for(let n of Reflect.ownKeys(t))tr(t[n],e);return Object.freeze(t)}function Cn(t){
723
+ return tr(er(t))}var _n=new WeakMap;function On(t,e,n=""){if(!Rn(t)||!Array.isArray(e)||e.length<1)return null;let[r,...o]=e;
724
+ if(!Object.hasOwn(t.structure,r))return null;let s=t.structure[r];if(o.length<1)return s;let i=gi(n,r);return vi(t,s,o,i)}
725
+ function vi(t,e,n,r){if(e?.type==="object"){let o=t._resolveObjectFieldMode(r,e);return o.kind!=="nested"?null:On(o.schema,
726
+ n,r)}if(e?.type==="array"){let o=t._resolveArrayItemsConfig(r,e);if(!o||n.length<1)return null;let[s,...i]=n;if(!hl(s))return null;
727
+ let a=Te(r,s);return o.kind==="schema"?i.length<1?null:On(o.schema,i,a):i.length<1?o.definition:vi(t,o.definition,i,a)}return null}
728
+ function $e(t,e){let n={...t};if(Array.isArray(t.skipFields)){let r=t.skipFields.map(o=>li(o,e)).filter(o=>o!==null&&o!==
729
+ "");r.length>0?n.skipFields=r:delete n.skipFields}if(z(t.skipParams)){let r={};for(let[o,s]of Object.entries(t.skipParams)){
730
+ let i=li(o,e);i===null||i===""||C(r,i,s)}Object.keys(r).length>0?n.skipParams=r:delete n.skipParams}return n}var vl=Object.
725
731
  freeze({create:Object.freeze({targetFields:"schema",enforceRequired:!0,applyDefaults:!0,outputFields:"validated",rejectExplicitUndefined:!0}),
726
732
  replace:Object.freeze({targetFields:"schema",enforceRequired:!0,applyDefaults:!0,outputFields:"validated",rejectExplicitUndefined:!0}),
727
733
  patch:Object.freeze({targetFields:"input",enforceRequired:!1,applyDefaults:!1,outputFields:"input",rejectExplicitUndefined:!0})});
728
- function li(t,e,r,n){let o=e[r];if(!n.includes(o))throw new Error(`Operation "${t}" must define ${r} as one of: ${n.join(
729
- ", ")}.`)}function Tn(t,e,r,n=!0){let o=e[r];if(!(o===void 0&&!n)&&typeof o!="boolean")throw new Error(`Operation "${t}"\
730
- must define ${r} as a boolean.`)}function ml(t,e){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`Op\
731
- eration "${t}" must be an object.`);return li(t,e,"targetFields",["schema","input"]),Tn(t,e,"enforceRequired"),Tn(t,e,"a\
732
- pplyDefaults"),li(t,e,"outputFields",["validated","input"]),Tn(t,e,"rejectExplicitUndefined",!1),Object.freeze({targetFields:e.
734
+ function mi(t,e,n,r){let o=e[n];if(!r.includes(o))throw new Error(`Operation "${t}" must define ${n} as one of: ${r.join(
735
+ ", ")}.`)}function En(t,e,n,r=!0){let o=e[n];if(!(o===void 0&&!r)&&typeof o!="boolean")throw new Error(`Operation "${t}"\
736
+ must define ${n} as a boolean.`)}function wl(t,e){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`Op\
737
+ eration "${t}" must be an object.`);return mi(t,e,"targetFields",["schema","input"]),En(t,e,"enforceRequired"),En(t,e,"a\
738
+ pplyDefaults"),mi(t,e,"outputFields",["validated","input"]),En(t,e,"rejectExplicitUndefined",!1),Object.freeze({targetFields:e.
733
739
  targetFields,enforceRequired:e.enforceRequired,applyDefaults:e.applyDefaults,outputFields:e.outputFields,rejectExplicitUndefined:e.
734
- rejectExplicitUndefined===void 0?!0:e.rejectExplicitUndefined})}function hl(t={}){if(typeof t!="object"||t===null||Array.
735
- isArray(t))throw new Error("Schema operations must be an object.");let e=Object.create(null);for(let[r,n]of Object.entries(
736
- fl))C(e,r,n);for(let[r,n]of Object.entries(t))C(e,r,ml(r,n));return Object.freeze(e)}function pi(t){let e=Object.create(
737
- null);for(let[r,n]of Object.entries(t))C(e,r,n);return Object.freeze(e)}function gl(t){let e={...t};return delete e.operation,
738
- delete e.mode,e}var $e=class{constructor(e,r,n,o={}){this.structure=e,this.types=pi(r),this.validators=pi(n),this.operations=
739
- hl(o),this._installOperationMethods()}_typeError(e){return this._paramError(e,"TYPE_CAST_FAILED","Value could not be cas\
740
- t to the required type.")}_paramError(e,r,n,o={}){let s=new Error(n);return s.errorObject={field:e,code:r,message:n,params:o},
741
- s}_paramToBeSkipped(e,r,n){return typeof r!="object"||r===null?!1:!!(Array.isArray(r[n])&&r[n].includes(e))}_fieldToBeSkipped(e,r){
742
- return Array.isArray(r.skipFields)&&r.skipFields.includes(e)}_mergeErrors(e,r){for(let[n,o]of Object.entries(r))C(e,n,o)}_singleErrorMap(e){
743
- let r={};return C(r,e.field,e),r}_assertSupportedOptions(e={}){if(Object.hasOwn(e,"onlyObjectValues"))throw new Error("U\
740
+ rejectExplicitUndefined===void 0?!0:e.rejectExplicitUndefined})}function yl(t={}){if(typeof t!="object"||t===null||Array.
741
+ isArray(t))throw new Error("Schema operations must be an object.");let e=Object.create(null);for(let[n,r]of Object.entries(
742
+ vl))C(e,n,r);for(let[n,r]of Object.entries(t))C(e,n,wl(n,r));return Object.freeze(e)}function hi(t){let e=Object.create(
743
+ null);for(let[n,r]of Object.entries(t))C(e,n,r);return Object.freeze(e)}function Il(t){let e={...t};return delete e.operation,
744
+ delete e.mode,e}var Be=class{constructor(e,n,r,o={}){fn(e),this.structure=e,this.types=hi(n),this.validators=hi(r),this.
745
+ operations=yl(o),this._installOperationMethods()}_typeError(e){return this._paramError(e,"TYPE_CAST_FAILED","Value could\
746
+ not be cast to the required type.")}_paramError(e,n,r,o={}){let s=new Error(r);return s.errorObject={field:e,code:n,message:r,
747
+ params:o},s}_paramToBeSkipped(e,n,r){return typeof n!="object"||n===null?!1:!!(Array.isArray(n[r])&&n[r].includes(e))}_fieldToBeSkipped(e,n){
748
+ return Array.isArray(n.skipFields)&&n.skipFields.includes(e)}_mergeErrors(e,n){for(let[r,o]of Object.entries(n))C(e,r,o)}_singleErrorMap(e){
749
+ let n={};return C(n,e.field,e),n}_assertSupportedOptions(e={}){if(Object.hasOwn(e,"onlyObjectValues"))throw new Error("U\
744
750
  nsupported validation option `onlyObjectValues`. Call `patch()` directly.");if(Object.hasOwn(e,"mode"))throw new Error("\
745
751
  Unsupported validation option `mode`. Call `validateWith()` or an operation method directly.");if(Object.hasOwn(e,"opera\
746
752
  tion"))throw new Error("Unsupported validation option `operation`. Call `validateWith()` or an operation method directly\
747
- .")}_buildOperationSettings(e,r,n){return{operationName:e,operation:r,targetFieldNames:r.targetFields==="input"?Object.keys(
748
- n):Object.keys(this.structure),outputFieldNames:r.outputFields==="input"?Object.keys(n):Object.keys(this.structure),enforceRequired:r.
749
- enforceRequired,applyDefaults:r.applyDefaults,rejectExplicitUndefined:r.rejectExplicitUndefined,defaultedFields:new Set,
750
- isFieldPresent:o=>Object.hasOwn(n,o)}}_assertPlainObjectInput(e,r){if(!F(r))throw new Error(`${e}() expects a plain obje\
751
- ct input.`)}_resolvePathValidationRequest(e={}){let r=e.operation??e.mode??"patch";if(Object.hasOwn(e,"operation")&&Object.
753
+ .")}_buildOperationSettings(e,n,r){return{operationName:e,operation:n,targetFieldNames:n.targetFields==="input"?Object.keys(
754
+ r):Object.keys(this.structure),outputFieldNames:n.outputFields==="input"?Object.keys(r):Object.keys(this.structure),enforceRequired:n.
755
+ enforceRequired,applyDefaults:n.applyDefaults,rejectExplicitUndefined:n.rejectExplicitUndefined,defaultedFields:new Set,
756
+ isFieldPresent:o=>Object.hasOwn(r,o)}}_assertPlainObjectInput(e,n){if(!z(n))throw new Error(`${e}() expects a plain obje\
757
+ ct input.`)}_resolvePathValidationRequest(e={}){let n=e.operation??e.mode??"patch";if(Object.hasOwn(e,"operation")&&Object.
752
758
  hasOwn(e,"mode")&&e.operation!==e.mode)throw new Error("Path validation options `operation` and `mode` must match when b\
753
- oth are provided.");if(!Object.hasOwn(this.operations,r))throw new Error(`Unknown operation "${r}".`);let n=this.operations[r];
754
- return{operationName:r,operation:n,validationOptions:gl(e)}}_buildOperationResult(e,r,n){let o={};for(let s of n.outputFieldNames){
755
- if(!Object.hasOwn(this.structure,s))continue;let i=n.isFieldPresent(s);(r[s]!==void 0||i&&e[s]===null||n.defaultedFields.
756
- has(s))&&(!i&&!n.defaultedFields.has(s)||C(o,s,r[s]))}return o}_resolveObjectFieldMode(e,r){return Jt(e,r)}_resolveArrayItemsConfig(e,r){
757
- return Kt(e,r)}_resolveObjectValuesConfig(e,r){return lt(e,r)}_buildArrayItemSettings(e,r){return e.type==="object"&&Object.
758
- hasOwn(e,"schema")?{...r,operationName:"replace",operation:this.operations.replace}:r}_castValue(e,r,n,o,s,i,a,c){let d=e.
759
+ oth are provided.");if(!Object.hasOwn(this.operations,n))throw new Error(`Unknown operation "${n}".`);let r=this.operations[n];
760
+ return{operationName:n,operation:r,validationOptions:Il(e)}}_buildOperationResult(e,n,r){let o={};for(let s of r.outputFieldNames){
761
+ if(!Object.hasOwn(this.structure,s))continue;let i=r.isFieldPresent(s);(n[s]!==void 0||i&&e[s]===null||r.defaultedFields.
762
+ has(s))&&(!i&&!r.defaultedFields.has(s)||C(o,s,n[s]))}return o}_resolveObjectFieldMode(e,n){return Jt(e,n)}_resolveArrayItemsConfig(e,n){
763
+ return Kt(e,n)}_resolveObjectValuesConfig(e,n){return lt(e,n)}_buildArrayItemSettings(e,n){return e.type==="object"&&Object.
764
+ hasOwn(e,"schema")?{...n,operationName:"replace",operation:this.operations.replace}:n}_castValue(e,n,r,o,s,i,a,c){let d=e.
759
765
  nullable===!0||a.nullable===!0,p=e.nullOnEmpty===!0||a.nullOnEmpty===!0;if(!Object.hasOwn(this.types,e.type))throw new Error(
760
- `No casting function for type: ${e.type}`);let m=this.types[e.type];if(r===null)return d?(C(o,s,null),{errors:{},shouldContinue:!1}):
761
- {errors:this._singleErrorMap({field:n,code:"NOT_NULLABLE",message:"Field cannot be null",params:{}}),shouldContinue:!1};
762
- if(r===""&&p)return C(o,s,null),{errors:{},shouldContinue:!1};let l={schema:this,definition:e,value:r,fieldName:n,object:o,
763
- objectBeforeCast:i,valueBeforeCast:r,options:a,mode:c.operationName,operation:c.operationName,fieldPresent:!0,computedOptions:{
764
- nullable:d||p,nullOnEmpty:p},throwTypeError:()=>{throw this._typeError(n)},throwParamError:(v,x,b)=>{throw this._paramError(
765
- n,v,x,b)}};try{let v=m(l);if(ii(v))throw new Error(`Type handler for "${e.type}" must be synchronous.`);v!==void 0&&(C(o,
766
+ `No casting function for type: ${e.type}`);let m=this.types[e.type];if(n===null)return d?(C(o,s,null),{errors:{},shouldContinue:!1}):
767
+ {errors:this._singleErrorMap({field:r,code:"NOT_NULLABLE",message:"Field cannot be null",params:{}}),shouldContinue:!1};
768
+ if(n===""&&p)return C(o,s,null),{errors:{},shouldContinue:!1};let l={schema:this,definition:e,value:n,fieldName:r,object:o,
769
+ objectBeforeCast:i,valueBeforeCast:n,options:a,mode:c.operationName,operation:c.operationName,fieldPresent:!0,computedOptions:{
770
+ nullable:d||p,nullOnEmpty:p},throwTypeError:()=>{throw this._typeError(r)},throwParamError:(v,x,b)=>{throw this._paramError(
771
+ r,v,x,b)}};try{let v=m(l);if(di(v))throw new Error(`Type handler for "${e.type}" must be synchronous.`);v!==void 0&&(C(o,
766
772
  s,v),l.value=v)}catch(v){if(v.errorObject)return{errors:this._singleErrorMap(v.errorObject),shouldContinue:!1};throw v}return{
767
- errors:{},context:l,shouldContinue:!0}}_runFieldValidators(e,r,n,o,s,i){for(let a of Object.keys(e)){if(a==="type"||this.
768
- _paramToBeSkipped(a,i.skipParams,r)||!Object.hasOwn(this.validators,a))continue;let c=this.validators[a];try{s.parameterName=
769
- a,s.parameterValue=e[a];let d=c(s);if(ii(d))throw new Error(`Validator handler for "${a}" must be synchronous.`);d!==void 0&&
770
- (C(n,o,d),s.value=d)}catch(d){if(d.errorObject)return this._singleErrorMap(d.errorObject);throw d}}return{}}_normalizeAndValidateValue(e,r,n,o,s,i,a,c){
771
- let d=this._castValue(e,r,n,o,s,i,a,c);if(Object.keys(d.errors).length>0)return d.errors;if(!d.shouldContinue)return{};let{
772
- context:p}=d,m=this._validateNestedValue(e,n,o,s,a,c);return Object.keys(m).length>0?m:(p.value=o[s],this._runFieldValidators(
773
- e,n,o,s,p,a))}_normalizeDefault(e,r,{fieldPath:n,currentObject:o,containerKey:s,objectBeforeCast:i,options:a,settings:c}){
774
- let d={...o};return C(d,s,r),{errors:this._normalizeAndValidateValue(e,r,n,d,s,i,a,c),value:d[s]}}_validateNestedValue(e,r,n,o,s,i){
775
- if(e.type==="object"){let c=this._resolveObjectFieldMode(r,e);return c.kind==="nested"?this._validateNestedObjectSchema(
776
- c,r,n,o,s,i):c.kind==="map"?this._validateObjectValues(r,n,o,c.valuesConfig,s,i):{}}if(e.type!=="array")return{};let a=this.
777
- _resolveArrayItemsConfig(r,e);return a?this._validateArrayItems(r,n,o,a,s,i):{}}_validateNestedObjectSchema(e,r,n,o,s,i){
778
- let a=n[o],c=e.allowAdditionalProperties?this._extractKnownObjectFields(a,e.schema):a,d=e.schema._validateWithOperation(
779
- i.operationName,i.operation,c,qe(s,r));return C(n,o,e.allowAdditionalProperties?this._mergeKnownAndPassthroughObjectFields(
780
- a,e.schema,d.validatedObject):d.validatedObject),Fe(d.errors,r)}_extractKnownObjectFields(e,r){let n={};for(let[o,s]of Object.
781
- entries(e))Object.hasOwn(r.structure,o)&&C(n,o,s);return n}_mergeKnownAndPassthroughObjectFields(e,r,n){let o={};for(let s of Object.
782
- keys(e)){if(!Object.hasOwn(r.structure,s)){C(o,s,e[s]);continue}Object.hasOwn(n,s)&&C(o,s,n[s])}for(let[s,i]of Object.entries(
783
- n))Object.hasOwn(o,s)||C(o,s,i);return o}_validateObjectValues(e,r,n,o,s,i){let a=r[n],c={...a},d={};C(r,n,c);for(let p of Object.
773
+ errors:{},context:l,shouldContinue:!0}}_runFieldValidators(e,n,r,o,s,i){for(let a of Object.keys(e)){if(a==="type"||this.
774
+ _paramToBeSkipped(a,i.skipParams,n)||!Object.hasOwn(this.validators,a))continue;let c=this.validators[a];try{s.parameterName=
775
+ a,s.parameterValue=e[a];let d=c(s);if(di(d))throw new Error(`Validator handler for "${a}" must be synchronous.`);d!==void 0&&
776
+ (C(r,o,d),s.value=d)}catch(d){if(d.errorObject)return this._singleErrorMap(d.errorObject);throw d}}return{}}_normalizeAndValidateValue(e,n,r,o,s,i,a,c){
777
+ let d=this._castValue(e,n,r,o,s,i,a,c);if(Object.keys(d.errors).length>0)return d.errors;if(!d.shouldContinue)return{};let{
778
+ context:p}=d,m=this._validateNestedValue(e,r,o,s,a,c);return Object.keys(m).length>0?m:(p.value=o[s],this._runFieldValidators(
779
+ e,r,o,s,p,a))}_normalizeDefault(e,n,{fieldPath:r,currentObject:o,containerKey:s,objectBeforeCast:i,options:a,settings:c}){
780
+ let d={...o};return C(d,s,n),{errors:this._normalizeAndValidateValue(e,n,r,d,s,i,a,c),value:d[s]}}_validateNestedValue(e,n,r,o,s,i){
781
+ if(e.type==="object"){let c=this._resolveObjectFieldMode(n,e);return c.kind==="nested"?this._validateNestedObjectSchema(
782
+ c,n,r,o,s,i):c.kind==="map"?this._validateObjectValues(n,r,o,c.valuesConfig,s,i):{}}if(e.type!=="array")return{};let a=this.
783
+ _resolveArrayItemsConfig(n,e);return a?this._validateArrayItems(n,r,o,a,s,i):{}}_validateNestedObjectSchema(e,n,r,o,s,i){
784
+ let a=r[o],c=e.allowAdditionalProperties?this._extractKnownObjectFields(a,e.schema):a,d=e.schema._validateWithOperation(
785
+ i.operationName,i.operation,c,$e(s,n));return C(r,o,e.allowAdditionalProperties?this._mergeKnownAndPassthroughObjectFields(
786
+ a,e.schema,d.validatedObject):d.validatedObject),qe(d.errors,n)}_extractKnownObjectFields(e,n){let r={};for(let[o,s]of Object.
787
+ entries(e))Object.hasOwn(n.structure,o)&&C(r,o,s);return r}_mergeKnownAndPassthroughObjectFields(e,n,r){let o={};for(let s of Object.
788
+ keys(e)){if(!Object.hasOwn(n.structure,s)){C(o,s,e[s]);continue}Object.hasOwn(r,s)&&C(o,s,r[s])}for(let[s,i]of Object.entries(
789
+ r))Object.hasOwn(o,s)||C(o,s,i);return o}_validateObjectValues(e,n,r,o,s,i){let a=n[r],c={...a},d={};C(n,r,c);for(let p of Object.
784
790
  keys(a)){let m=Te(e,p);if(this._fieldToBeSkipped(m,s))continue;let l=c[p];if(l===void 0){i.rejectExplicitUndefined?this.
785
791
  _mergeErrors(d,this._singleErrorMap(this._typeError(m).errorObject)):delete c[p];continue}if(o.kind==="schema"){let x=o.
786
- schema._validateWithOperation("replace",o.schema.operations.replace,l,qe(s,m));C(c,p,x.validatedObject),this._mergeErrors(
787
- d,Fe(x.errors,m));continue}let v=this._normalizeAndValidateValue(o.definition,l,m,c,p,a,s,this._buildArrayItemSettings(o.
788
- definition,i));this._mergeErrors(d,v)}return d}_validateArrayItems(e,r,n,o,s,i){let a=r[n],c=a.slice(),d={};C(r,n,c);for(let p=0;p<
792
+ schema._validateWithOperation("replace",o.schema.operations.replace,l,$e(s,m));C(c,p,x.validatedObject),this._mergeErrors(
793
+ d,qe(x.errors,m));continue}let v=this._normalizeAndValidateValue(o.definition,l,m,c,p,a,s,this._buildArrayItemSettings(o.
794
+ definition,i));this._mergeErrors(d,v)}return d}_validateArrayItems(e,n,r,o,s,i){let a=n[r],c=a.slice(),d={};C(n,r,c);for(let p=0;p<
789
795
  c.length;p++){let m=Te(e,p);if(this._fieldToBeSkipped(m,s))continue;if(!Object.hasOwn(a,p)||c[p]===void 0){i.rejectExplicitUndefined?
790
796
  this._mergeErrors(d,this._singleErrorMap(this._typeError(m).errorObject)):delete c[p];continue}if(o.kind==="schema"){let v=o.
791
- schema._validateWithOperation("replace",o.schema.operations.replace,c[p],qe(s,m));C(c,p,v.validatedObject),this._mergeErrors(
792
- d,Fe(v.errors,m));continue}let l=this._normalizeAndValidateValue(o.definition,c[p],m,c,p,a,s,this._buildArrayItemSettings(
793
- o.definition,i));this._mergeErrors(d,l)}return d}_validateField(e,r,n,o,s){if(!Object.hasOwn(this.structure,e))return{};
794
- let i=this.structure[e];if(this._fieldToBeSkipped(e,o))return{};let a=s.isFieldPresent(e),c=r[e],d=c===void 0;return s.enforceRequired&&
797
+ schema._validateWithOperation("replace",o.schema.operations.replace,c[p],$e(s,m));C(c,p,v.validatedObject),this._mergeErrors(
798
+ d,qe(v.errors,m));continue}let l=this._normalizeAndValidateValue(o.definition,c[p],m,c,p,a,s,this._buildArrayItemSettings(
799
+ o.definition,i));this._mergeErrors(d,l)}return d}_validateField(e,n,r,o,s){if(!Object.hasOwn(this.structure,e))return{};
800
+ let i=this.structure[e];if(this._fieldToBeSkipped(e,o))return{};let a=s.isFieldPresent(e),c=n[e],d=c===void 0;return s.enforceRequired&&
795
801
  i.required&&(!a||d)&&!this._paramToBeSkipped("required",o.skipParams,e)?this._singleErrorMap({field:e,code:"REQUIRED",message:"\
796
802
  Field is required",params:{}}):a?d?s.rejectExplicitUndefined?this._singleErrorMap(this._typeError(e).errorObject):{}:this.
797
- _normalizeAndValidateValue(i,c,e,n,e,r,o,s):{}}_validateWithOperation(e,r,n,o){this._assertSupportedOptions(o);let s={},
798
- i={...n},a=this._buildOperationSettings(e,r,n);for(let c of Object.keys(n))Object.hasOwn(this.structure,c)||C(s,c,{field:c,
803
+ _normalizeAndValidateValue(i,c,e,r,e,n,o,s):{}}_validateWithOperation(e,n,r,o){this._assertSupportedOptions(o);let s={},
804
+ i={...r},a=this._buildOperationSettings(e,n,r);for(let c of Object.keys(r))Object.hasOwn(this.structure,c)||C(s,c,{field:c,
799
805
  code:"FIELD_NOT_ALLOWED",message:"Field not allowed",params:{}});for(let c of a.targetFieldNames){let d=this._validateField(
800
- c,n,i,o,a);this._mergeErrors(s,d)}if(a.applyDefaults){for(let c of Object.keys(this.structure))if(!a.isFieldPresent(c)&&
806
+ c,r,i,o,a);this._mergeErrors(s,d)}if(a.applyDefaults){for(let c of Object.keys(this.structure))if(!a.isFieldPresent(c)&&
801
807
  this.structure[c].defaultTo!==void 0){let d=this.structure[c],p=typeof d.defaultTo=="function"?d.defaultTo():d.defaultTo,
802
- m=this._normalizeDefault(d,p,{fieldPath:c,currentObject:i,containerKey:c,objectBeforeCast:n,options:o,settings:a});if(this.
808
+ m=this._normalizeDefault(d,p,{fieldPath:c,currentObject:i,containerKey:c,objectBeforeCast:r,options:o,settings:a});if(this.
803
809
  _mergeErrors(s,m.errors),Object.keys(m.errors).length>0)continue;C(i,c,m.value),a.defaultedFields.add(c)}}return{validatedObject:this.
804
- _buildOperationResult(n,i,a),errors:s}}_validateSelectedTree(e,r,n,o,s=""){let i={},a={};for(let c of ui(Object.keys(e))){
805
- let d=fi(s,c);if(!Object.hasOwn(this.structure,c))throw new Error(`Unknown schema path "${d}".`);let p=this._validateSelectedField(
806
- c,e[c],r,a,n,o,d);this._mergeErrors(i,p)}return{validatedObject:a,errors:i}}_validateSelectedField(e,r,n,o,s,i,a){if(!Object.
807
- hasOwn(this.structure,e))return{};let c=this.structure[e],d=r.self===!0,p=ai(r);if(this._fieldToBeSkipped(a,s))return{};
808
- let m=Object.hasOwn(n,e),l=n[e],v={};if(!m){if(d&&i.enforceRequired&&c.required&&!this._paramToBeSkipped("required",s.skipParams,
810
+ _buildOperationResult(r,i,a),errors:s}}_validateSelectedTree(e,n,r,o,s=""){let i={},a={};for(let c of fi(Object.keys(e))){
811
+ let d=gi(s,c);if(!Object.hasOwn(this.structure,c))throw new Error(`Unknown schema path "${d}".`);let p=this._validateSelectedField(
812
+ c,e[c],n,a,r,o,d);this._mergeErrors(i,p)}return{validatedObject:a,errors:i}}_validateSelectedField(e,n,r,o,s,i,a){if(!Object.
813
+ hasOwn(this.structure,e))return{};let c=this.structure[e],d=n.self===!0,p=ui(n);if(this._fieldToBeSkipped(a,s))return{};
814
+ let m=Object.hasOwn(r,e),l=r[e],v={};if(!m){if(d&&i.enforceRequired&&c.required&&!this._paramToBeSkipped("required",s.skipParams,
809
815
  a)&&this._mergeErrors(v,this._singleErrorMap({field:a,code:"REQUIRED",message:"Field is required",params:{}})),d&&i.applyDefaults&&
810
816
  c.defaultTo!==void 0){let P=typeof c.defaultTo=="function"?c.defaultTo():c.defaultTo,j=this._normalizeDefault(c,P,{fieldPath:a,
811
- currentObject:o,containerKey:e,objectBeforeCast:n,options:s,settings:i});this._mergeErrors(v,j.errors),Object.keys(j.errors).
817
+ currentObject:o,containerKey:e,objectBeforeCast:r,options:s,settings:i});this._mergeErrors(v,j.errors),Object.keys(j.errors).
812
818
  length===0&&C(o,e,j.value)}return v}if(l===void 0)return d&&i.rejectExplicitUndefined?this._singleErrorMap(this._typeError(
813
- a).errorObject):{};let x={[e]:l};if(d){let P=this._normalizeAndValidateValue(c,l,a,x,e,n,s,i);return Object.hasOwn(x,e)&&
814
- x[e]!==void 0?C(o,e,x[e]):x[e]===null&&C(o,e,null),P}if(!p)return{};let b=this._castValue(c,l,a,x,e,n,s,i);if(Object.keys(
815
- b.errors).length>0)return b.errors;if(!b.shouldContinue)return{};let O=this._validateSelectedDescendants(c,r.children,a,
816
- x,e,s,i);return Qt(x[e])&&C(o,e,x[e]),O}_validateSelectedDescendants(e,r,n,o,s,i,a){if(e.type==="object"){let c=this._resolveObjectFieldMode(
817
- n,e);if(c.kind!=="nested")throw new Error(`Schema path "${n}" does not support nested field selection.`);let d=o[s];if(!F(
818
- d))return{};let p=c.schema._validateSelectedTree(r,d,qe(i,n),{...a,defaultedFields:new Set});return C(o,s,p.validatedObject),
819
- Fe(p.errors,n)}if(e.type==="array"){let c=this._resolveArrayItemsConfig(n,e);if(!c)throw new Error(`Schema path "${n}" d\
820
- oes not define array items for nested selection.`);return this._validateSelectedArrayItems(n,o,s,c,r,i,a)}throw new Error(
821
- `Schema path "${n}" does not support nested field selection.`)}_validateSelectedArrayItems(e,r,n,o,s,i,a){let c=[],d=r[n],
822
- p={};C(r,n,c);for(let m of ui(Object.keys(s))){if(!/^[0-9]+$/.test(m))throw new Error(`Schema path "${Te(e,m)}" is inval\
823
- id because array segments must use numeric indexes.`);let l=Number(m),v=Te(e,l),x=s[m],b=x.self===!0,O=ai(x);if(this._fieldToBeSkipped(
819
+ a).errorObject):{};let x={[e]:l};if(d){let P=this._normalizeAndValidateValue(c,l,a,x,e,r,s,i);return Object.hasOwn(x,e)&&
820
+ x[e]!==void 0?C(o,e,x[e]):x[e]===null&&C(o,e,null),P}if(!p)return{};let b=this._castValue(c,l,a,x,e,r,s,i);if(Object.keys(
821
+ b.errors).length>0)return b.errors;if(!b.shouldContinue)return{};let O=this._validateSelectedDescendants(c,n.children,a,
822
+ x,e,s,i);return Qt(x[e])&&C(o,e,x[e]),O}_validateSelectedDescendants(e,n,r,o,s,i,a){if(e.type==="object"){let c=this._resolveObjectFieldMode(
823
+ r,e);if(c.kind!=="nested")throw new Error(`Schema path "${r}" does not support nested field selection.`);let d=o[s];if(!z(
824
+ d))return{};let p=c.schema._validateSelectedTree(n,d,$e(i,r),{...a,defaultedFields:new Set});return C(o,s,p.validatedObject),
825
+ qe(p.errors,r)}if(e.type==="array"){let c=this._resolveArrayItemsConfig(r,e);if(!c)throw new Error(`Schema path "${r}" d\
826
+ oes not define array items for nested selection.`);return this._validateSelectedArrayItems(r,o,s,c,n,i,a)}throw new Error(
827
+ `Schema path "${r}" does not support nested field selection.`)}_validateSelectedArrayItems(e,n,r,o,s,i,a){let c=[],d=n[r],
828
+ p={};C(n,r,c);for(let m of fi(Object.keys(s))){if(!/^[0-9]+$/.test(m))throw new Error(`Schema path "${Te(e,m)}" is inval\
829
+ id because array segments must use numeric indexes.`);let l=Number(m),v=Te(e,l),x=s[m],b=x.self===!0,O=ui(x);if(this._fieldToBeSkipped(
824
830
  v,i))continue;if(!Object.hasOwn(d,l)){b&&a.rejectExplicitUndefined&&C(p,v,this._typeError(v).errorObject);continue}let P=d[l];
825
831
  if(P===void 0){b&&a.rejectExplicitUndefined&&C(p,v,this._typeError(v).errorObject);continue}if(o.kind==="schema"){if(b){
826
- let q=o.schema._validateWithOperation("replace",o.schema.operations.replace,P,qe(i,v));Qt(q.validatedObject)&&C(c,l,q.validatedObject),
827
- this._mergeErrors(p,Fe(q.errors,v));continue}if(!O)continue;let H=o.schema._validateSelectedTree(x.children,P,qe(i,v),{...a,
832
+ let q=o.schema._validateWithOperation("replace",o.schema.operations.replace,P,$e(i,v));Qt(q.validatedObject)&&C(c,l,q.validatedObject),
833
+ this._mergeErrors(p,qe(q.errors,v));continue}if(!O)continue;let H=o.schema._validateSelectedTree(x.children,P,$e(i,v),{...a,
828
834
  operationName:"replace",operation:o.schema.operations.replace,defaultedFields:new Set});Qt(H.validatedObject)&&C(c,l,H.validatedObject),
829
- this._mergeErrors(p,Fe(H.errors,v));continue}let j=this._buildArrayItemSettings(o.definition,a),D=[P];if(b){let H=this._normalizeAndValidateValue(
835
+ this._mergeErrors(p,qe(H.errors,v));continue}let j=this._buildArrayItemSettings(o.definition,a),D=[P];if(b){let H=this._normalizeAndValidateValue(
830
836
  o.definition,P,v,D,0,d,i,j);Object.hasOwn(D,0)&&D[0]!==void 0?C(c,l,D[0]):D[0]===null&&C(c,l,null),this._mergeErrors(p,H);
831
- continue}if(!O)continue;let L=this._castValue(o.definition,P,v,D,0,d,i,j);if(Object.keys(L.errors).length>0){this._mergeErrors(
832
- p,L.errors);continue}if(!L.shouldContinue)continue;let J=this._validateSelectedDescendants(o.definition,x.children,v,D,0,
833
- i,j);Qt(D[0])&&C(c,l,D[0]),this._mergeErrors(p,J)}return p}validateWith(e,r,n={}){if(!Object.hasOwn(this.operations,e))throw new Error(
834
- `Unknown operation "${e}".`);let o=this.operations[e];return this._assertPlainObjectInput(e,r),this._validateWithOperation(
835
- e,o,r,n)}validateAt(e,r,n={}){this._assertPlainObjectInput("validateAt",r);let o=Cn(e),{operationName:s,operation:i,validationOptions:a}=this.
836
- _resolvePathValidationRequest(n),c=this._validateSelectedTree(di([e]),r,a,this._buildOperationSettings(s,i,r));return{validatedValue:ul(
837
- c.validatedObject,o),errors:c.errors}}validatePaths(e,r,n={}){if(this._assertPlainObjectInput("validatePaths",r),!Array.
837
+ continue}if(!O)continue;let U=this._castValue(o.definition,P,v,D,0,d,i,j);if(Object.keys(U.errors).length>0){this._mergeErrors(
838
+ p,U.errors);continue}if(!U.shouldContinue)continue;let J=this._validateSelectedDescendants(o.definition,x.children,v,D,0,
839
+ i,j);Qt(D[0])&&C(c,l,D[0]),this._mergeErrors(p,J)}return p}validateWith(e,n,r={}){if(!Object.hasOwn(this.operations,e))throw new Error(
840
+ `Unknown operation "${e}".`);let o=this.operations[e];return this._assertPlainObjectInput(e,n),this._validateWithOperation(
841
+ e,o,n,r)}validateAt(e,n,r={}){this._assertPlainObjectInput("validateAt",n);let o=An(e),{operationName:s,operation:i,validationOptions:a}=this.
842
+ _resolvePathValidationRequest(r),c=this._validateSelectedTree(pi([e]),n,a,this._buildOperationSettings(s,i,n));return{validatedValue:ml(
843
+ c.validatedObject,o),errors:c.errors}}validatePaths(e,n,r={}){if(this._assertPlainObjectInput("validatePaths",n),!Array.
838
844
  isArray(e)||e.length===0)throw new Error("validatePaths() expects a non-empty array of schema paths.");let{operationName:o,
839
- operation:s,validationOptions:i}=this._resolvePathValidationRequest(n);return this._validateSelectedTree(di(e),r,i,this.
840
- _buildOperationSettings(o,s,r))}_installOperationMethods(){for(let e of Object.keys(this.operations)){if(e in this)throw new Error(
841
- `Operation name "${e}" is reserved and cannot be used as a schema method.`);this[e]=(r,n={})=>this.validateWith(e,r,n)}}toJsonSchema(e={}){
842
- return si(this,e)}getFieldDefinitions(){return bn(this.structure)}getFieldDefinition(e){if(typeof e!="string"||e.trim()===
843
- "")throw new Error("Field path must be a non-empty string.");let r=_n(this,Cn(e.trim()));return r===null?null:bn(r)}getFieldMessages(e){
844
- let r=this.getFieldDefinition(e);return!r||typeof r.messages!="object"||r.messages===null?Object.freeze({}):bn(r.messages)}cleanup(e,r){
845
- let n={};for(let o of Object.keys(e))Object.hasOwn(this.structure,o)&&this.structure[o][r]&&C(n,o,e[o]);return n}};var{parse:w_,stringify:vl}=JSON,{keys:y_}=Object,wl=String,yl="string";var hi="object",Il=(t,e)=>e;var gi=(t,e,r)=>{let n=wl(e.push(r)-1);return t.set(r,n),n};var vi=(t,e,r)=>{let n=e&&typeof e===hi?(p,m)=>p===""||-1<e.indexOf(p)?m:void 0:e||Il,o=new Map,s=[],i=[],a=+gi(o,s,n.call(
846
- {"":t},"",t)),c=!a;for(;a<s.length;)c=!0,i[a]=vl(s[a++],d,r);return"["+i.join(",")+"]";function d(p,m){if(c)return c=!c,
847
- m;let l=n.call(this,p,m);switch(typeof l){case hi:if(l===null)return l;case yl:return o.get(l)||gi(o,s,l)}return l}};var xl=new Set(["true","1","yes","y","on"]),bl=new Set(["false","0","no","n","off"]);function Tl(t){return t!==null&&(typeof t==
848
- "object"||typeof t=="function")&&typeof t.then=="function"}function wi(t){if(typeof t=="number")return Number.isFinite(t)?
845
+ operation:s,validationOptions:i}=this._resolvePathValidationRequest(r);return this._validateSelectedTree(pi(e),n,i,this.
846
+ _buildOperationSettings(o,s,n))}_installOperationMethods(){for(let e of Object.keys(this.operations)){if(e in this)throw new Error(
847
+ `Operation name "${e}" is reserved and cannot be used as a schema method.`);this[e]=(n,r={})=>this.validateWith(e,n,r)}}toJsonSchema(e={}){
848
+ return ci(this,e)}getFieldDefinitions(){return _n.has(this)||_n.set(this,Cn(this.structure)),_n.get(this)}getFieldDefinition(e){
849
+ if(typeof e!="string"||e.trim()==="")throw new Error("Field path must be a non-empty string.");let n=On(this,An(e.trim()));
850
+ return n===null?null:Cn(n)}getFieldMessages(e){let n=this.getFieldDefinition(e);return!n||typeof n.messages!="object"||n.
851
+ messages===null?Object.freeze({}):Cn(n.messages)}cleanup(e,n){let r={};for(let o of Object.keys(e))Object.hasOwn(this.structure,
852
+ o)&&this.structure[o][n]&&C(r,o,e[o]);return r}};var{parse:__,stringify:Sl}=JSON,{keys:E_}=Object,xl=String,bl="string";var wi="object",Tl=(t,e)=>e;var yi=(t,e,n)=>{let r=xl(e.push(n)-1);return t.set(n,r),r};var Ii=(t,e,n)=>{let r=e&&typeof e===wi?(p,m)=>p===""||-1<e.indexOf(p)?m:void 0:e||Tl,o=new Map,s=[],i=[],a=+yi(o,s,r.call(
853
+ {"":t},"",t)),c=!a;for(;a<s.length;)c=!0,i[a]=Sl(s[a++],d,n);return"["+i.join(",")+"]";function d(p,m){if(c)return c=!c,
854
+ m;let l=r.call(this,p,m);switch(typeof l){case wi:if(l===null)return l;case bl:return o.get(l)||yi(o,s,l)}return l}};var _l=new Set(["true","1","yes","y","on"]),El=new Set(["false","0","no","n","off"]);function Al(t){return t!==null&&(typeof t==
855
+ "object"||typeof t=="function")&&typeof t.then=="function"}function Si(t){if(typeof t=="number")return Number.isFinite(t)?
849
856
  t:null;if(typeof t=="bigint"){let e=Number(t);return Number.isSafeInteger(e)?e:null}if(typeof t=="string"){let e=t.trim();
850
- if(e==="")return null;let r=Number(e);return Number.isFinite(r)?r:null}return null}function An(t,e){if(Object.is(t,e))return!0;
857
+ if(e==="")return null;let n=Number(e);return Number.isFinite(n)?n:null}return null}function Pn(t,e){if(Object.is(t,e))return!0;
851
858
  if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(t instanceof RegExp&&e instanceof RegExp)return t.
852
859
  source===e.source&&t.flags===e.flags;if(Array.isArray(t)||Array.isArray(e)){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==
853
- e.length)return!1;for(let o=0;o<t.length;o++)if(!An(t[o],e[o]))return!1;return!0}if(t===null||e===null||typeof t!="objec\
854
- t"||typeof e!="object"||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;let r=Object.keys(t),n=Object.keys(
855
- e);if(r.length!==n.length)return!1;for(let o of r)if(!Object.hasOwn(e,o)||!An(t[o],e[o]))return!1;return!0}var Cl={install(t){
856
- let{addType:e,addValidator:r}=t;e("none",n=>n.value),e("file",n=>{let o=n.value;o==null&&n.throwTypeError();let s=typeof o;
857
- if(s==="string"||s==="number"||s==="boolean"){let i=o.toString();return n.definition.noTrim?i:i.trim()}n.throwTypeError()}),
858
- e("string",n=>{let o=n.value;if(o==null)return"";let s=typeof o;if(s==="string"||s==="number"||s==="boolean"){let i=o.toString();
859
- return n.definition.noTrim?i:i.trim()}n.throwTypeError()}),e("blob",n=>n.value),e("number",n=>{let o=wi(n.value);return o===
860
- null&&n.throwTypeError(),o}),e("integer",n=>{let o=wi(n.value);return(o===null||!Number.isInteger(o))&&n.throwTypeError(),
861
- o}),e("epochMilliseconds",n=>{let o=fn(n.value,864e13);return o===null&&n.throwTypeError(),o}),e("epochSeconds",n=>{let o=fn(
862
- n.value,864e10);return o===null&&n.throwTypeError(),o}),e("dateTime",n=>{let o=pt(n.definition,n.fieldName);return Ys(n.
863
- value,o)||n.throwTypeError(),n.value}),e("date",n=>(Js(n.value)||n.throwTypeError(),n.value)),e("time",n=>{let o=pt(n.definition,
864
- n.fieldName);return Xs(n.value,o)||n.throwTypeError(),n.value}),e("array",n=>n.definition.type==="array"&&!Array.isArray(
865
- n.value)?[n.value]:n.value),e("object",n=>(F(n.value)||n.throwTypeError(),n.value)),e("serialize",n=>{try{return JSON.stringify(
866
- n.value)}catch{try{return vi(n.value)}catch{n.throwTypeError()}}}),e("boolean",n=>{if(typeof n.value=="boolean")return n.
867
- value;if(typeof n.value=="number"){if(n.value===1)return!0;if(n.value===0)return!1;n.throwTypeError()}if(typeof n.value==
868
- "bigint"){if(n.value===1n)return!0;if(n.value===0n)return!1;n.throwTypeError()}if(typeof n.value=="string"){let o=String(
869
- n.definition.stringFalseWhen||"false").trim().toLowerCase(),s=String(n.definition.stringTrueWhen||"true").trim().toLowerCase(),
870
- i=n.value.trim().toLowerCase(),a=new Set([...bl,o]),c=new Set([...xl,s]);if(a.has(i))return!1;if(c.has(i))return!0}n.throwTypeError()}),
871
- e("id",n=>{if(typeof n.value=="number"){if(Number.isSafeInteger(n.value)&&n.value>0)return n.value;n.throwTypeError()}if(typeof n.
872
- value=="bigint"){if(n.value>0n&&n.value<=BigInt(Number.MAX_SAFE_INTEGER))return Number(n.value);n.throwTypeError()}if(typeof n.
873
- value=="string"){let o=n.value.trim();/^[1-9][0-9]*$/.test(o)||n.throwTypeError();let s=Number(o);return Number.isSafeInteger(
874
- s)||n.throwTypeError(),s}n.throwTypeError()}),r("minLength",n=>{n.value!==void 0&&n.definition.type==="string"&&n.value.
875
- toString&&n.value.toString().length<n.parameterValue&&n.throwParamError("MIN_LENGTH",`Length must be at least ${n.parameterValue}\
876
- characters.`,{min:n.parameterValue,actual:n.value.toString().length})}),r("min",n=>{n.value!==void 0&&Le(n.definition)&&
877
- typeof n.value=="number"&&n.value<n.parameterValue&&n.throwParamError("MIN_VALUE",`Value must be at least ${n.parameterValue}\
878
- .`,{min:n.parameterValue,actual:n.value})}),r("maxLength",n=>{n.value!==void 0&&n.definition.type==="string"&&n.value.toString&&
879
- n.value.toString().length>n.parameterValue&&n.throwParamError("MAX_LENGTH",`Length must be no more than ${n.parameterValue}\
880
- characters.`,{max:n.parameterValue,actual:n.value.toString().length})}),r("max",n=>{n.value!==void 0&&Le(n.definition)&&
881
- typeof n.value=="number"&&n.value>n.parameterValue&&n.throwParamError("MAX_VALUE",`Value must be no more than ${n.parameterValue}\
882
- .`,{max:n.parameterValue,actual:n.value})}),r("enum",n=>{if(!Array.isArray(n.parameterValue))throw new Error(`Enum for ${n.
883
- fieldName} must be an array.`);n.parameterValue.some(s=>An(s,n.value))||n.throwParamError("ENUM_VALUE","Value must match\
884
- one of the allowed enum values.",{allowed:n.parameterValue})}),r("pattern",n=>{if(n.value===void 0||n.definition.type!==
885
- "string"||typeof n.value!="string")return;let o=n.parameterValue,s=o instanceof RegExp?new RegExp(o.source,o.flags):typeof o==
886
- "string"?new RegExp(o):null;if(!s)throw new Error(`Pattern for ${n.fieldName} must be a string or RegExp.`);s.test(n.value)||
887
- n.throwParamError("PATTERN","Value does not match the required pattern.",{pattern:s.source})}),r("strictBoolean",n=>{if(n.
888
- parameterValue){if(n.definition.type!=="boolean")throw new Error(`strictBoolean can only be used on boolean fields (${n.
889
- fieldName}).`);typeof n.valueBeforeCast!="boolean"&&n.throwParamError("STRICT_BOOLEAN","Value must be a boolean.")}}),r(
890
- "validator",n=>{if(typeof n.parameterValue!="function")throw new Error(`Validator for ${n.fieldName} must be a function.`);
891
- let o=n.parameterValue(n.value,n.object,n);if(Tl(o))throw new Error(`Custom validator for "${n.fieldName}" must be synch\
892
- ronous.`);typeof o=="string"&&n.throwParamError("CUSTOM_VALIDATOR_FAILED",o)}),r("uppercase",n=>{if(typeof n.value=="str\
893
- ing")return n.value.toUpperCase()}),r("lowercase",n=>{if(typeof n.value=="string")return n.value.toLowerCase()}),r("leng\
894
- th",n=>{if(typeof n.value=="string")return n.value.substr(0,n.parameterValue);Number.isInteger(Number(n.valueBeforeCast))&&
895
- String(n.valueBeforeCast).length>n.parameterValue&&n.throwParamError("RANGE_EXCEEDED","Numeric value is out of the allow\
896
- ed character range.",{max:n.parameterValue,actual:String(n.valueBeforeCast).length})}),r("notEmpty",n=>{n.parameterValue&&
897
- typeof n.value=="string"&&n.value===""&&n.throwParamError("NOT_EMPTY","Field cannot be empty.")}),r("required",()=>{}),r(
898
- "unsigned",()=>{}),r("precision",()=>{}),r("scale",()=>{}),r("temporalPrecision",n=>{if(n.definition.type!=="time"&&n.definition.
899
- type!=="dateTime")throw new Error(`temporalPrecision can only be used on time or dateTime fields (${n.fieldName}).`)}),r(
900
- "nullable",()=>{}),r("nullOnEmpty",()=>{}),r("defaultTo",()=>{})}},yi=Cl;var xi=new WeakMap,bi=new WeakMap,Ti=Symbol.for("json-rest-schema.registry-metadata");function _l(t,e,r){if(typeof r!="f\
901
- unction")throw new Error(`Type handler for '${e}' must be a function.`);C(t,e,r)}function El(t,e,r){if(typeof r!="functi\
902
- on")throw new Error(`Validator handler for '${e}' must be a function.`);C(t,e,r)}function rr(t={}){let e=Object.create(null);
903
- for(let[r,n]of Object.entries(t))C(e,r,n);return e}function Al(t,e){if(typeof t.install!="function")throw new Error("Plu\
904
- gin must have an install method.");t.install(e)}function Ii(t,e,r){xi.set(t,e),bi.set(t,r),Object.defineProperty(t,Ti,{value:Object.
905
- freeze({getTypes:()=>e,getValidators:()=>r}),enumerable:!1,configurable:!1,writable:!1})}function Ol(t){if(!t||typeof t!=
906
- "object"&&typeof t!="function")return null;let e=xi.get(t),r=bi.get(t);if(e&&r)return{types:e,validators:r};let n=t[Ti];
907
- return n&&typeof n.getTypes=="function"&&typeof n.getValidators=="function"?{types:n.getTypes(),validators:n.getValidators()}:
860
+ e.length)return!1;for(let o=0;o<t.length;o++)if(!Pn(t[o],e[o]))return!1;return!0}if(t===null||e===null||typeof t!="objec\
861
+ t"||typeof e!="object"||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;let n=Object.keys(t),r=Object.keys(
862
+ e);if(n.length!==r.length)return!1;for(let o of n)if(!Object.hasOwn(e,o)||!Pn(t[o],e[o]))return!1;return!0}var Ol={install(t){
863
+ let{addType:e,addValidator:n}=t;e("none",r=>r.value),e("file",r=>{let o=r.value;o==null&&r.throwTypeError();let s=typeof o;
864
+ if(s==="string"||s==="number"||s==="boolean"){let i=o.toString();return r.definition.noTrim?i:i.trim()}r.throwTypeError()}),
865
+ e("string",r=>{let o=r.value;if(o==null)return"";let s=typeof o;if(s==="string"||s==="number"||s==="boolean"){let i=o.toString();
866
+ return r.definition.noTrim?i:i.trim()}r.throwTypeError()}),e("blob",r=>r.value),e("number",r=>{let o=Si(r.value);return o===
867
+ null&&r.throwTypeError(),o}),e("integer",r=>{let o=Si(r.value);return(o===null||!Number.isInteger(o))&&r.throwTypeError(),
868
+ o}),e("epochMilliseconds",r=>{let o=hn(r.value,864e13);return o===null&&r.throwTypeError(),o}),e("epochSeconds",r=>{let o=hn(
869
+ r.value,864e10);return o===null&&r.throwTypeError(),o}),e("dateTime",r=>{let o=pt(r.definition,r.fieldName);return ei(r.
870
+ value,o)||r.throwTypeError(),r.value}),e("date",r=>(Zs(r.value)||r.throwTypeError(),r.value)),e("time",r=>{let o=pt(r.definition,
871
+ r.fieldName);return Qs(r.value,o)||r.throwTypeError(),r.value}),e("array",r=>r.definition.type==="array"&&!Array.isArray(
872
+ r.value)?[r.value]:r.value),e("object",r=>(z(r.value)||r.throwTypeError(),r.value)),e("serialize",r=>{try{return JSON.stringify(
873
+ r.value)}catch{try{return Ii(r.value)}catch{r.throwTypeError()}}}),e("boolean",r=>{if(typeof r.value=="boolean")return r.
874
+ value;if(typeof r.value=="number"){if(r.value===1)return!0;if(r.value===0)return!1;r.throwTypeError()}if(typeof r.value==
875
+ "bigint"){if(r.value===1n)return!0;if(r.value===0n)return!1;r.throwTypeError()}if(typeof r.value=="string"){let o=String(
876
+ r.definition.stringFalseWhen||"false").trim().toLowerCase(),s=String(r.definition.stringTrueWhen||"true").trim().toLowerCase(),
877
+ i=r.value.trim().toLowerCase(),a=new Set([...El,o]),c=new Set([..._l,s]);if(a.has(i))return!1;if(c.has(i))return!0}r.throwTypeError()}),
878
+ e("id",r=>{if(typeof r.value=="number"){if(Number.isSafeInteger(r.value)&&r.value>0)return r.value;r.throwTypeError()}if(typeof r.
879
+ value=="bigint"){if(r.value>0n&&r.value<=BigInt(Number.MAX_SAFE_INTEGER))return Number(r.value);r.throwTypeError()}if(typeof r.
880
+ value=="string"){let o=r.value.trim();/^[1-9][0-9]*$/.test(o)||r.throwTypeError();let s=Number(o);return Number.isSafeInteger(
881
+ s)||r.throwTypeError(),s}r.throwTypeError()}),n("minLength",r=>{r.value!==void 0&&r.definition.type==="string"&&r.value.
882
+ toString&&r.value.toString().length<r.parameterValue&&r.throwParamError("MIN_LENGTH",`Length must be at least ${r.parameterValue}\
883
+ characters.`,{min:r.parameterValue,actual:r.value.toString().length})}),n("min",r=>{r.value!==void 0&&Ue(r.definition)&&
884
+ typeof r.value=="number"&&r.value<r.parameterValue&&r.throwParamError("MIN_VALUE",`Value must be at least ${r.parameterValue}\
885
+ .`,{min:r.parameterValue,actual:r.value})}),n("maxLength",r=>{r.value!==void 0&&r.definition.type==="string"&&r.value.toString&&
886
+ r.value.toString().length>r.parameterValue&&r.throwParamError("MAX_LENGTH",`Length must be no more than ${r.parameterValue}\
887
+ characters.`,{max:r.parameterValue,actual:r.value.toString().length})}),n("max",r=>{r.value!==void 0&&Ue(r.definition)&&
888
+ typeof r.value=="number"&&r.value>r.parameterValue&&r.throwParamError("MAX_VALUE",`Value must be no more than ${r.parameterValue}\
889
+ .`,{max:r.parameterValue,actual:r.value})}),n("enum",r=>{if(!Array.isArray(r.parameterValue))throw new Error(`Enum for ${r.
890
+ fieldName} must be an array.`);r.parameterValue.some(s=>Pn(s,r.value))||r.throwParamError("ENUM_VALUE","Value must match\
891
+ one of the allowed enum values.",{allowed:r.parameterValue})}),n("pattern",r=>{if(r.value===void 0||r.definition.type!==
892
+ "string"||typeof r.value!="string")return;let o=r.parameterValue,s=o instanceof RegExp?new RegExp(o.source,o.flags):typeof o==
893
+ "string"?new RegExp(o):null;if(!s)throw new Error(`Pattern for ${r.fieldName} must be a string or RegExp.`);s.test(r.value)||
894
+ r.throwParamError("PATTERN","Value does not match the required pattern.",{pattern:s.source})}),n("strictBoolean",r=>{if(r.
895
+ parameterValue){if(r.definition.type!=="boolean")throw new Error(`strictBoolean can only be used on boolean fields (${r.
896
+ fieldName}).`);typeof r.valueBeforeCast!="boolean"&&r.throwParamError("STRICT_BOOLEAN","Value must be a boolean.")}}),n(
897
+ "validator",r=>{if(typeof r.parameterValue!="function")throw new Error(`Validator for ${r.fieldName} must be a function.`);
898
+ let o=r.parameterValue(r.value,r.object,r);if(Al(o))throw new Error(`Custom validator for "${r.fieldName}" must be synch\
899
+ ronous.`);typeof o=="string"&&r.throwParamError("CUSTOM_VALIDATOR_FAILED",o)}),n("uppercase",r=>{if(typeof r.value=="str\
900
+ ing")return r.value.toUpperCase()}),n("lowercase",r=>{if(typeof r.value=="string")return r.value.toLowerCase()}),n("leng\
901
+ th",r=>{if(typeof r.value=="string")return r.value.substr(0,r.parameterValue);Number.isInteger(Number(r.valueBeforeCast))&&
902
+ String(r.valueBeforeCast).length>r.parameterValue&&r.throwParamError("RANGE_EXCEEDED","Numeric value is out of the allow\
903
+ ed character range.",{max:r.parameterValue,actual:String(r.valueBeforeCast).length})}),n("minItems",r=>{Array.isArray(r.
904
+ value)&&r.value.length<r.parameterValue&&r.throwParamError("MIN_ITEMS",`Must have at least ${r.parameterValue} items.`,{
905
+ min:r.parameterValue,actual:r.value.length})}),n("maxItems",r=>{Array.isArray(r.value)&&r.value.length>r.parameterValue&&
906
+ r.throwParamError("MAX_ITEMS",`Must have no more than ${r.parameterValue} items.`,{max:r.parameterValue,actual:r.value.length})}),
907
+ n("notEmpty",r=>{r.parameterValue&&typeof r.value=="string"&&r.value===""&&r.throwParamError("NOT_EMPTY","Field cannot b\
908
+ e empty.")}),n("required",()=>{}),n("unsigned",()=>{}),n("precision",()=>{}),n("scale",()=>{}),n("temporalPrecision",r=>{
909
+ if(r.definition.type!=="time"&&r.definition.type!=="dateTime")throw new Error(`temporalPrecision can only be used on tim\
910
+ e or dateTime fields (${r.fieldName}).`)}),n("nullable",()=>{}),n("nullOnEmpty",()=>{}),n("defaultTo",()=>{})}},xi=Ol;var _i=new WeakMap,Ei=new WeakMap,Ai=Symbol.for("json-rest-schema.registry-metadata"),rr=new WeakSet;function Rl(t,e,n){
911
+ if(typeof n!="function")throw new Error(`Type handler for '${e}' must be a function.`);C(t,e,n)}function Pl(t,e,n){if(typeof n!=
912
+ "function")throw new Error(`Validator handler for '${e}' must be a function.`);C(t,e,n)}function nr(t={}){let e=Object.create(
913
+ null);for(let[n,r]of Object.entries(t))C(e,n,r);return e}function bi(t,e){if(typeof t.install!="function")throw new Error(
914
+ "Plugin must have an install method.");t.install(e)}function Ti(t,e,n){_i.set(t,e),Ei.set(t,n),Object.defineProperty(t,Ai,
915
+ {value:Object.freeze({getTypes:()=>e,getValidators:()=>n}),enumerable:!1,configurable:!1,writable:!1})}function kl(t){if(!t||
916
+ typeof t!="object"&&typeof t!="function")return null;let e=_i.get(t),n=Ei.get(t);if(e&&n)return{types:e,validators:n};let r=t[Ai];
917
+ return r&&typeof r.getTypes=="function"&&typeof r.getValidators=="function"?{types:r.getTypes(),validators:r.getValidators()}:
908
918
  typeof t=="object"&&t.types&&typeof t.types=="object"&&t.validators&&typeof t.validators=="object"&&typeof t.create=="fu\
909
919
  nction"&&typeof t.replace=="function"&&typeof t.patch=="function"&&typeof t.toJsonSchema=="function"?{types:t.types,validators:t.
910
- validators}:null}function Rl(t){return t.length===1&&Array.isArray(t[0])?t[0]:t}function Pl(t,e){return t===e}function Si(t,e,r){
911
- for(let[n,o]of Object.entries(e)){if(Object.hasOwn(t,n)&&!Pl(t[n],o))throw new Error(`Cannot merge schema factories with\
912
- conflicting ${r} "${n}".`);C(t,n,o)}}function kl(t,e,r){let n=Rl(r).filter(Boolean);if(n.length<1)return{types:rr(t),validators:rr(
913
- e)};let o=Object.create(null),s=Object.create(null);for(let i of n){let a=Ol(i);if(!a)throw new Error("Factory sources m\
914
- ust be schema instances or schema factories created by json-rest-schema.");Si(o,a.types,"type"),Si(s,a.validators,"valid\
915
- ator")}return{types:o,validators:s}}function Ci({types:t={},validators:e={},installCore:r=!0}={}){let n=rr(t),o=rr(e),s=(i,a={})=>{
916
- let c=new $e(i,n,o,a.operations);return Ii(c,n,o),c};return Ii(s,n,o),s.addType=(i,a)=>{_l(n,i,a)},s.addValidator=(i,a)=>{
917
- El(o,i,a)},s.use=i=>{Al(i,{addType:s.addType,addValidator:s.addValidator})},s.createFactory=(...i)=>{let a=kl(n,o,i);return Ci(
918
- {types:a.types,validators:a.validators,installCore:!1})},r&&s.use(yi),s}var Q=Ci({installCore:!0});var F_=Object.freeze({schema:Q({}),mode:"replace"});var _i=/^[a-z][a-z0-9_.-]*$/u,Ml=/^[A-Za-z_$][A-Za-z0-9_$]*$/u;function jl(t){return String(t||"").trim().toLowerCase()}
919
- function Pn(t,e){let r=jl(t);if(!_i.test(r))throw new TypeError(`${e} must match ${_i.toString()}.`);return r}function On(t,e){
920
+ validators}:null}function Ml(t){return t.length===1&&Array.isArray(t[0])?t[0]:t}function Ci(t,e,n){for(let[r,o]of Object.
921
+ entries(e)){if(Object.hasOwn(t,r)&&t[r]!==o){if(rr.has(o))continue;if(!rr.has(t[r]))throw new Error(`Cannot merge schema\
922
+ factories with conflicting ${n} "${r}".`)}C(t,r,o)}}function Nl(t,e,n){let r=Ml(n).filter(Boolean);if(r.length<1)return{
923
+ types:nr(t),validators:nr(e)};let o=Object.create(null),s=Object.create(null);for(let i of r){let a=kl(i);if(!a)throw new Error(
924
+ "Factory sources must be schema instances or schema factories created by json-rest-schema.");Ci(o,a.types,"type"),Ci(s,a.
925
+ validators,"validator")}return{types:o,validators:s}}function Oi({types:t={},validators:e={},installCore:n=!0}={}){let r=nr(
926
+ t),o=nr(e),s=(i,a={})=>{let c=new Be(i,r,o,a.operations);return Ti(c,r,o),c};return Ti(s,r,o),s.addType=(i,a)=>{Rl(r,i,a)},
927
+ s.addValidator=(i,a)=>{Pl(o,i,a)},s.use=i=>{bi(i,{addType:s.addType,addValidator:s.addValidator})},s.createFactory=(...i)=>{
928
+ let a=Nl(r,o,i);return Oi({types:a.types,validators:a.validators,installCore:!1})},n&&bi(xi,{addType:(i,a)=>{rr.add(a),s.
929
+ addType(i,a)},addValidator:(i,a)=>{rr.add(a),s.addValidator(i,a)}}),s}var Q=Oi({installCore:!0});var K_=Object.freeze({schema:Q({}),mode:"replace"});var Ri=/^[a-z][a-z0-9_.-]*$/u,Dl=/^[A-Za-z_$][A-Za-z0-9_$]*$/u;function zl(t){return String(t||"").trim().toLowerCase()}
930
+ function Nn(t,e){let n=zl(t);if(!Ri.test(n))throw new TypeError(`${e} must match ${Ri.toString()}.`);return n}function kn(t,e){
920
931
  if(t==null)return Object.freeze({});if(!E(t))throw new TypeError(`${e} must be an object mapping local names to capabili\
921
- ty ids.`);let r={},n=new Set;for(let[o,s]of Object.entries(t)){let i=String(o||"").trim();if(!Ml.test(i))throw new TypeError(
922
- `${e} local name "${i}" must be a JavaScript identifier.`);let a=Pn(s,`${e}.${i}`);if(n.has(a))throw new TypeError(`${e}\
923
- declares capability "${a}" more than once.`);n.add(a),r[i]=a}return Object.freeze(r)}function Dl(t,e,r){if(t==null)return Object.
924
- freeze({});if(!E(t))throw new TypeError(`${r}.hints must be an object mapping required capability ids to what to registe\
925
- r.`);let n=new Set(Object.values(e)),o={};for(let[s,i]of Object.entries(t)){let a=Pn(s,`${r}.hints key`);if(!n.has(a))throw new TypeError(
926
- `${r}.hints names "${a}", which the provider does not require.`);if(typeof i!="string"||!i.trim())throw new TypeError(`${r}\
927
- .hints["${a}"] must be the text that says what to register.`);o[a]=i.trim()}return Object.freeze(o)}function zl(t){let e=new Map;
928
- for(let[r,n]of Object.entries(t))for(let o of Object.keys(n)){if(e.has(o))throw new TypeError(`Provider local name "${o}\
929
- " is declared by both ${e.get(o)} and ${r}.`);e.set(o,r)}}function Rn(t,e){if(t==null)return null;if(typeof t!="function")
930
- throw new TypeError(`${e} must be a function when provided.`);return t}function nr({id:t,requires:e={},optional:r={},provides:n={},
931
- hints:o={},setup:s,boot:i=null,shutdown:a=null}={}){let c=Pn(t,"Provider id"),d=On(e,`${c}.requires`),p=On(r,`${c}.optio\
932
- nal`),m=On(n,`${c}.provides`);zl({requires:d,optional:p,provides:m});let l=Rn(s,`${c}.setup`);if(!l)throw new TypeError(
933
- `${c}.setup is required.`);return Object.freeze({id:c,requires:d,optional:p,provides:m,hints:Dl(o,d,c),setup:l,boot:Rn(i,
934
- `${c}.boot`),shutdown:Rn(a,`${c}.shutdown`)})}var Ei="public";var Ll="/api",Ai=`${Ll}/bootstrap`;function Nn(){let t=[],e=new Set,r=!1;function n({id:a,order:c=0,contribute:d}={}){if(r)throw new Error("Bootstrap regis\
932
+ ty ids.`);let n={},r=new Set;for(let[o,s]of Object.entries(t)){let i=String(o||"").trim();if(!Dl.test(i))throw new TypeError(
933
+ `${e} local name "${i}" must be a JavaScript identifier.`);let a=Nn(s,`${e}.${i}`);if(r.has(a))throw new TypeError(`${e}\
934
+ declares capability "${a}" more than once.`);r.add(a),n[i]=a}return Object.freeze(n)}function Ll(t,e,n){if(t==null)return Object.
935
+ freeze({});if(!E(t))throw new TypeError(`${n}.hints must be an object mapping required capability ids to what to registe\
936
+ r.`);let r=new Set(Object.values(e)),o={};for(let[s,i]of Object.entries(t)){let a=Nn(s,`${n}.hints key`);if(!r.has(a))throw new TypeError(
937
+ `${n}.hints names "${a}", which the provider does not require.`);if(typeof i!="string"||!i.trim())throw new TypeError(`${n}\
938
+ .hints["${a}"] must be the text that says what to register.`);o[a]=i.trim()}return Object.freeze(o)}function Ul(t){let e=new Map;
939
+ for(let[n,r]of Object.entries(t))for(let o of Object.keys(r)){if(e.has(o))throw new TypeError(`Provider local name "${o}\
940
+ " is declared by both ${e.get(o)} and ${n}.`);e.set(o,n)}}function Mn(t,e){if(t==null)return null;if(typeof t!="function")
941
+ throw new TypeError(`${e} must be a function when provided.`);return t}function or({id:t,requires:e={},optional:n={},provides:r={},
942
+ hints:o={},setup:s,boot:i=null,shutdown:a=null}={}){let c=Nn(t,"Provider id"),d=kn(e,`${c}.requires`),p=kn(n,`${c}.optio\
943
+ nal`),m=kn(r,`${c}.provides`);Ul({requires:d,optional:p,provides:m});let l=Mn(s,`${c}.setup`);if(!l)throw new TypeError(
944
+ `${c}.setup is required.`);return Object.freeze({id:c,requires:d,optional:p,provides:m,hints:Ll(o,d,c),setup:l,boot:Mn(i,
945
+ `${c}.boot`),shutdown:Mn(a,`${c}.shutdown`)})}var Pi="public";var Fl="/api",ki=`${Fl}/bootstrap`;function Dn(){let t=[],e=new Set,n=!1;function r({id:a,order:c=0,contribute:d}={}){if(n)throw new Error("Bootstrap regis\
935
946
  tration is closed after the first payload is resolved.");let p=_(a);if(!p)throw new TypeError("Bootstrap contributor id \
936
947
  is required.");if(typeof d!="function")throw new TypeError(`Bootstrap contributor "${p}" requires contribute().`);if(e.has(
937
948
  p))throw new Error(`Bootstrap contributor "${p}" is duplicated.`);return e.add(p),t.push(Object.freeze({id:p,order:Number.
938
- isFinite(c)?Number(c):0,contribute:d})),i}async function o(a={}){r=!0;let c={},d=t.map((p,m)=>({entry:p,index:m})).sort(
949
+ isFinite(c)?Number(c):0,contribute:d})),i}async function o(a={}){n=!0;let c={},d=t.map((p,m)=>({entry:p,index:m})).sort(
939
950
  (p,m)=>p.entry.order-m.entry.order||p.index-m.index).map(({entry:p})=>p);for(let p of d){let m=await p.contribute(Object.
940
951
  freeze({...E(a)?a:{},payload:Object.freeze({...c})}));c={...c,...E(m)?m:{}}}return Object.freeze(c)}function s(){return Object.
941
- freeze({sealed:r,contributorIds:Object.freeze(t.map(a=>a.id).sort())})}let i=Object.freeze({register:n,resolve:o,diagnostics:s});
942
- return i}var Ul=nr({id:"runtime.bootstrap",requires:{http:"runtime.http"},provides:{bootstrap:"runtime.bootstrap"},setup({http:t}){
943
- let e=Nn();return t.router.register("GET",Ai,{auth:Ei,meta:{tags:["bootstrap"],summary:"Resolve app bootstrap payload"}},
944
- async(r,n)=>{n.code(200).send(await e.resolve({request:r,reply:n,query:r.query||{}}))}),{bootstrap:e}}});function Fl(t){if(!E(t))throw new TypeError("Event listener must be an object.");let e=String(t.id||"").trim();if(!e)throw new TypeError(
952
+ freeze({sealed:n,contributorIds:Object.freeze(t.map(a=>a.id).sort())})}let i=Object.freeze({register:r,resolve:o,diagnostics:s});
953
+ return i}var ql=or({id:"runtime.bootstrap",requires:{http:"runtime.http"},provides:{bootstrap:"runtime.bootstrap"},setup({http:t}){
954
+ let e=Dn();return t.router.register("GET",ki,{auth:Pi,meta:{tags:["bootstrap"],summary:"Resolve app bootstrap payload"}},
955
+ async(n,r)=>{r.code(200).send(await e.resolve({request:n,reply:r,query:n.query||{}}))}),{bootstrap:e}}});function $l(t){if(!E(t))throw new TypeError("Event listener must be an object.");let e=String(t.id||"").trim();if(!e)throw new TypeError(
945
956
  "Event listener id is required.");if(typeof t.handle!="function")throw new TypeError(`Event listener "${e}" requires han\
946
957
  dle().`);if(t.matches!=null&&typeof t.matches!="function")throw new TypeError(`Event listener "${e}" matches must be a f\
947
- unction when provided.`);return Object.freeze({id:e,handle:t.handle,matches:t.matches??null})}function ql(t){if(!E(t))throw new TypeError(
958
+ unction when provided.`);return Object.freeze({id:e,handle:t.handle,matches:t.matches??null})}function Bl(t){if(!E(t))throw new TypeError(
948
959
  "Published event must be an object.");let e=String(t.type||"").trim();if(!e)throw new TypeError("Published event type is\
949
- required.");return Object.freeze({...t,type:e})}function Mn(){let t=[],e=new Set;function r(i){let a=Fl(i);if(e.has(a.id))
950
- throw new Error(`Event listener "${a.id}" is duplicated.`);return e.add(a.id),t.push(a),s}async function n(i){let a=ql(i);
960
+ required.");return Object.freeze({...t,type:e})}function zn(){let t=[],e=new Set;function n(i){let a=$l(i);if(e.has(a.id))
961
+ throw new Error(`Event listener "${a.id}" is duplicated.`);return e.add(a.id),t.push(a),s}async function r(i){let a=Bl(i);
951
962
  for(let c of t)c.matches&&c.matches(a)!==!0||await c.handle(a);return a}function o(){return Object.freeze({listenerIds:Object.
952
- freeze(t.map(i=>i.id))})}let s=Object.freeze({register:r,publish:n,diagnostics:o});return s}var $l=nr({id:"runtime.events",provides:{events:"runtime.events"},setup(){return{events:Mn()}}});function Ce(t,e=new WeakSet){if(!t||typeof t!="object"||e.has(t))return t;e.add(t);for(let r of Object.getOwnPropertyNames(
953
- t))Ce(t[r],e);return Object.freeze(t)}var PE=Object.freeze({REQUIRED:{messageKey:"required",code:"kernel.validation.field.required"},TYPE_CAST_FAILED:{messageKey:"\
963
+ freeze(t.map(i=>i.id))})}let s=Object.freeze({register:n,publish:r,diagnostics:o});return s}var Hl=or({id:"runtime.events",provides:{events:"runtime.events"},setup(){return{events:zn()}}});function Ce(t,e=new WeakSet){if(!t||typeof t!="object"||e.has(t))return t;e.add(t);for(let n of Object.getOwnPropertyNames(
964
+ t))Ce(t[n],e);return Object.freeze(t)}var UE=Object.freeze({REQUIRED:{messageKey:"required",code:"kernel.validation.field.required"},TYPE_CAST_FAILED:{messageKey:"\
954
965
  default",code:"kernel.validation.field.typeCastFailed"},NOT_NULLABLE:{messageKey:"default",code:"kernel.validation.field\
955
966
  .notNullable"},MIN_LENGTH:{messageKey:"minLength",code:"kernel.validation.field.minLength"},MAX_LENGTH:{messageKey:"maxL\
956
967
  ength",code:"kernel.validation.field.maxLength"},MIN_ITEMS:{messageKey:"minItems",code:"kernel.validation.field.minItems"},
@@ -960,10 +971,10 @@ code:"kernel.validation.field.pattern"},ENUM_VALUE:{messageKey:"enum",code:"kern
960
971
  messageKey:"additionalProperties",code:"kernel.validation.field.notAllowed"},CUSTOM_VALIDATOR_FAILED:{messageKey:"valida\
961
972
  tor",code:""},STRICT_BOOLEAN:{messageKey:"default",code:"kernel.validation.field.strictBoolean"},RANGE_EXCEEDED:{messageKey:"\
962
973
  default",code:"kernel.validation.field.rangeExceeded"},NOT_EMPTY:{messageKey:"default",code:"kernel.validation.field.not\
963
- Empty"}}),kE=Object.freeze({code:"kernel.validation.invalid",message:"Invalid value."}),NE=Object.freeze(["create","repl\
964
- ace","patch","toJsonSchema"]);var Gl=Q({cursor:{type:"id",required:!1},limit:{type:"number",required:!1,min:1,unsigned:!0}}),Wl=Object.freeze({schema:Gl,
965
- mode:"patch"});var Ri=Object.freeze({type:"string",pattern:"^(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d)?$",minLength:5}),Kl=Object.freeze(
966
- {...Ri,nullable:!0});var oA=new Map([{keyword:"required",code:"kernel.validation.required"},{keyword:"type",code:"kernel.validation.type"},{keyword:"\
974
+ Empty"}}),FE=Object.freeze({code:"kernel.validation.invalid",message:"Invalid value."}),qE=Object.freeze(["create","repl\
975
+ ace","patch","toJsonSchema"]);var Kl=Q({cursor:{type:"id",required:!1},limit:{type:"number",required:!1,min:1,unsigned:!0}}),Jl=Object.freeze({schema:Kl,
976
+ mode:"patch"});var Ni=Object.freeze({type:"string",pattern:"^(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d)?$",minLength:5}),Xl=Object.freeze(
977
+ {...Ni,nullable:!0});var pA=new Map([{keyword:"required",code:"kernel.validation.required"},{keyword:"type",code:"kernel.validation.type"},{keyword:"\
967
978
  minLength",code:"kernel.validation.minLength"},{keyword:"maxLength",code:"kernel.validation.maxLength"},{keyword:"minimu\
968
979
  m",code:"kernel.validation.minimum"},{keyword:"maximum",code:"kernel.validation.maximum"},{keyword:"exclusiveMinimum",code:"\
969
980
  kernel.validation.exclusiveMinimum"},{keyword:"exclusiveMaximum",code:"kernel.validation.exclusiveMaximum"},{keyword:"mu\
@@ -975,32 +986,32 @@ additionalItems",code:"kernel.validation.additionalItems"},{keyword:"uniqueItems
975
986
  perties"},{keyword:"additionalProperties",code:"kernel.validation.additionalProperties"},{keyword:"propertyNames",code:"\
976
987
  kernel.validation.propertyNames"},{keyword:"oneOf",code:"kernel.validation.oneOf"},{keyword:"anyOf",code:"kernel.validat\
977
988
  ion.anyOf"},{keyword:"not",code:"kernel.validation.not"},{keyword:"if",code:"kernel.validation.if"}].map(({keyword:t,code:e})=>[
978
- t,e]));var Pi="^[1-9][0-9]*$",jn=Ce({type:"string",minLength:1,pattern:Pi}),Xl=Ce({...jn,nullable:!0}),Yl=Ce({schema:Q({recordId:{
979
- ...jn,required:!0,messages:{pattern:{code:"kernel.validation.recordIdInvalid",message:"Record id must be a canonical pos\
980
- itive integer string."}}}}),mode:"patch"});var ki=20,QA=32*1024,eO=48*1024,Dn=Object.freeze({search:"assistant_action_search",contract:"assistant_action_contract",
981
- execute:"assistant_action_execute"}),zn=Object.freeze({type:"object",additionalProperties:!0}),ep=Object.freeze({type:"o\
989
+ t,e]));var ji="^[1-9][0-9]*$",Ln=Ce({type:"string",minLength:1,pattern:ji}),Zl=Ce({...Ln,nullable:!0}),Ql=Ce({schema:Q({recordId:{
990
+ ...Ln,required:!0,messages:{pattern:{code:"kernel.validation.recordIdInvalid",message:"Record id must be a canonical pos\
991
+ itive integer string."}}}}),mode:"patch"});var Di=20,aO=32*1024,cO=48*1024,Un=Object.freeze({search:"assistant_action_search",contract:"assistant_action_contract",
992
+ execute:"assistant_action_execute"}),Fn=Object.freeze({type:"object",additionalProperties:!0}),rp=Object.freeze({type:"o\
982
993
  bject",additionalProperties:!1,properties:{query:{type:"string",maxLength:200,description:"Optional literal words or act\
983
994
  ion-id fragments; every word must match. Use short resource or operation terms such as list. Omit query to browse all av\
984
995
  ailable actions."},cursor:{type:"string",maxLength:1e3,description:"Opaque cursor returned by the previous search page."},
985
- limit:{type:"integer",minimum:1,maximum:ki,description:"Maximum compact matches to return."}}}),tp=Object.freeze({type:"\
986
- object",additionalProperties:!1,required:["items","nextCursor","total"],properties:{items:{type:"array",maxItems:ki,items:{
996
+ limit:{type:"integer",minimum:1,maximum:Di,description:"Maximum compact matches to return."}}}),np=Object.freeze({type:"\
997
+ object",additionalProperties:!1,required:["items","nextCursor","total"],properties:{items:{type:"array",maxItems:Di,items:{
987
998
  type:"object",additionalProperties:!1,required:["actionId","version","kind","description"],properties:{actionId:{type:"s\
988
999
  tring"},version:{type:"integer",minimum:1},kind:{type:"string"},description:{type:"string"}}}},nextCursor:{anyOf:[{type:"\
989
- string"},{type:"null"}]},total:{type:"integer",minimum:0}}}),rp=Object.freeze({type:"object",additionalProperties:!1,required:[
990
- "actionId"],properties:{actionId:{type:"string",minLength:1,maxLength:300},version:{type:"integer",minimum:1}}}),np=Object.
1000
+ string"},{type:"null"}]},total:{type:"integer",minimum:0}}}),op=Object.freeze({type:"object",additionalProperties:!1,required:[
1001
+ "actionId"],properties:{actionId:{type:"string",minLength:1,maxLength:300},version:{type:"integer",minimum:1}}}),sp=Object.
991
1002
  freeze({type:"object",additionalProperties:!1,required:["actionId","version","kind","description","inputSchema","outputS\
992
1003
  chema"],properties:{actionId:{type:"string"},version:{type:"integer",minimum:1},kind:{type:"string"},description:{type:"\
993
- string"},inputSchema:zn,outputSchema:zn}}),op=Object.freeze({type:"object",additionalProperties:!1,required:["actionId",
994
- "input"],properties:{actionId:{type:"string",minLength:1,maxLength:300},version:{type:"integer",minimum:1},input:zn}}),sp=Object.
1004
+ string"},inputSchema:Fn,outputSchema:Fn}}),ip=Object.freeze({type:"object",additionalProperties:!1,required:["actionId",
1005
+ "input"],properties:{actionId:{type:"string",minLength:1,maxLength:300},version:{type:"integer",minimum:1},input:Fn}}),ap=Object.
995
1006
  freeze({type:"object",additionalProperties:!1,required:["actionId","version","result"],properties:{actionId:{type:"strin\
996
- g"},version:{type:"integer",minimum:1},result:{}}}),Ni=Object.freeze([Object.freeze({name:Dn.search,description:"Discove\
1007
+ g"},version:{type:"integer",minimum:1},result:{}}}),zi=Object.freeze([Object.freeze({name:Un.search,description:"Discove\
997
1008
  r application actions available to the current user and surface, including list, search, and query operations for multip\
998
1009
  le records. Search before claiming a capability is unavailable. If terminology does not match, use broader terms or omit\
999
- query to browse. Returns compact paged matches without schemas; follow nextCursor when more discovery is needed.",parameters:ep,
1000
- outputSchema:tp}),Object.freeze({name:Dn.contract,description:"Load the exact input and output contract for one availabl\
1001
- e action before executing it.",parameters:rp,outputSchema:np}),Object.freeze({name:Dn.execute,description:"Execute one a\
1002
- vailable action after loading its exact contract in this turn. The action result is returned in result.",parameters:op,outputSchema:sp})]);var iR=new URL("./../../../@jskit-ai/assistant-core/src/server/conversation/openCodeProcess.js",import.meta.url).href;var pR=256*1024;var fR=2*1024*1024;var mR=Ni.map(({name:t,description:e,parameters:r})=>({type:"function",function:{name:t,description:e,parameters:r}}));var HR=Object.freeze({});var rP=Object.freeze([]);var xp=Object.freeze({resolve(){throw new M(400,"File attachments are not configured for this conversation.",{code:"conv\
1003
- ersation_attachments_not_configured",messageCode:"assistant.conversation.attachmentsNotConfigured"})}});var lP=Object.freeze([{message:"This conversation exceeds the configured API history limit. Start another conversation o\
1010
+ query to browse. Returns compact paged matches without schemas; follow nextCursor when more discovery is needed.",parameters:rp,
1011
+ outputSchema:np}),Object.freeze({name:Un.contract,description:"Load the exact input and output contract for one availabl\
1012
+ e action before executing it.",parameters:op,outputSchema:sp}),Object.freeze({name:Un.execute,description:"Execute one a\
1013
+ vailable action after loading its exact contract in this turn. The action result is returned in result.",parameters:ip,outputSchema:ap})]);var mR=new URL("./../../../@jskit-ai/assistant-core/src/server/conversation/openCodeProcess.js",import.meta.url).href;var IR=256*1024;var SR=2*1024*1024;var xR=zi.map(({name:t,description:e,parameters:n})=>({type:"function",function:{name:t,description:e,parameters:n}}));var ZR=Object.freeze({});var uP=Object.freeze([]);var Tp=Object.freeze({resolve(){throw new N(400,"File attachments are not configured for this conversation.",{code:"conv\
1014
+ ersation_attachments_not_configured",messageCode:"assistant.conversation.attachmentsNotConfigured"})}});var yP=Object.freeze([{message:"This conversation exceeds the configured API history limit. Start another conversation o\
1004
1015
  r increase the limit.",messageCode:"assistant.conversation.apiHistoryLimit"},{message:"The model reached its output toke\
1005
1016
  n limit before completing the answer. Increase maxOutputTokens in the conversation limits.",messageCode:"assistant.conve\
1006
1017
  rsation.outputTokenLimit"},{message:"The model stream ended without confirming its application tool calls.",messageCode:"\
@@ -1019,21 +1030,21 @@ t be saved. Restore storage access and retry saving.",messageCode:"assistant.con
1019
1030
  Conversation progress could not be saved. Restore access to its storage before continuing.",messageCode:"assistant.conve\
1020
1031
  rsation.progressUnsaved"},{message:"The conversation request exceeded its time limit.",messageCode:"assistant.conversati\
1021
1032
  on.requestTimedOut"},{message:"Work stopped.",messageCode:"assistant.conversation.workStopped"},{message:"Stopped by use\
1022
- r.",messageCode:"assistant.conversation.stoppedByUser"}]);var He=Object.freeze({text:16e3,toolName:256,arguments:256*1024,toolProgress:280});var KP=Q({kind:{type:"string",enum:["reply","tool"],required:!0},text:{type:"string",maxLength:He.text,required:!1},toolName:{
1023
- type:"string",maxLength:He.toolName,required:!1},arguments:{type:"string",maxLength:He.arguments,required:!1}}),JP={type:"\
1033
+ r.",messageCode:"assistant.conversation.stoppedByUser"}]);var Ve=Object.freeze({text:16e3,toolName:256,arguments:256*1024,toolProgress:280});var ok=Q({kind:{type:"string",enum:["reply","tool"],required:!0},text:{type:"string",maxLength:Ve.text,required:!1},toolName:{
1034
+ type:"string",maxLength:Ve.toolName,required:!1},arguments:{type:"string",maxLength:Ve.arguments,required:!1}}),sk={type:"\
1024
1035
  object",additionalProperties:!1,required:["kind","text","toolName","arguments"],properties:{kind:{type:"string",enum:["r\
1025
- eply","tool"]},text:{type:"string",maxLength:He.text,description:"The final reply, or a brief progress sentence for the \
1026
- first tool request; empty for subsequent tool requests."},toolName:{type:"string",maxLength:He.toolName},arguments:{type:"\
1027
- string",maxLength:He.arguments}}};var J0=Object.freeze({});function kp(){throw new TypeError("Hook delivery requires an instruction resolver.")}function Vn({resolveConversation:t,
1028
- readInstructions:e=kp}){if(typeof t!="function")throw new TypeError("Conversation hook delivery requires a binding resol\
1029
- ver.");return async function(n){if(n.scope!=="session")return{kind:"unclaimed"};let o=await t(n);if(!o)return{kind:"uncl\
1036
+ eply","tool"]},text:{type:"string",maxLength:Ve.text,description:"The final reply, or a brief progress sentence for the \
1037
+ first tool request; empty for subsequent tool requests."},toolName:{type:"string",maxLength:Ve.toolName},arguments:{type:"\
1038
+ string",maxLength:Ve.arguments}}};var sM=Object.freeze({});function Np(){throw new TypeError("Hook delivery requires an instruction resolver.")}function Kn({resolveConversation:t,
1039
+ readInstructions:e=Np}){if(typeof t!="function")throw new TypeError("Conversation hook delivery requires a binding resol\
1040
+ ver.");return async function(r){if(r.scope!=="session")return{kind:"unclaimed"};let o=await t(r);if(!o)return{kind:"uncl\
1030
1041
  aimed"};if(o.delivery==="native")return{kind:"delivery",text:""};if(o.delivery!=="hook")throw new TypeError("Unknown con\
1031
- versation instruction delivery mode.");let s=await e(o,n);if(typeof s!="string"||!s.trim())throw new TypeError("Managed \
1032
- conversation instructions are unavailable.");return{kind:"delivery",text:s}}}var Z0=Object.freeze({codex:Object.freeze({requiresWriterExclusion:!1}),claude:Object.freeze({requiresWriterExclusion:!0,
1042
+ versation instruction delivery mode.");let s=await e(o,r);if(typeof s!="string"||!s.trim())throw new TypeError("Managed \
1043
+ conversation instructions are unavailable.");return{kind:"delivery",text:s}}}var cM=Object.freeze({codex:Object.freeze({requiresWriterExclusion:!1}),claude:Object.freeze({requiresWriterExclusion:!0,
1033
1044
  allowsManagedServer:!1,matchesProcess:({executable:t,commandLine:e})=>/(?:^|[\0/])claude(?:\0|$)|@anthropic-ai\/claude-code\//u.
1034
1045
  test(`${t||""}\0${e}`)}),opencode:Object.freeze({requiresWriterExclusion:!0,allowsManagedServer:!0,matchesProcess:({executable:t,
1035
- commandLine:e})=>/(?:^|[\0/])opencode(?:\0|$)/u.test(`${t||""}\0${e}`)})});import{readFile as Np}from"node:fs/promises";import Gn from"node:path";function sr(t){return String(t||"").trim()}var Mp=Object.freeze(["main","temporary"]),qi=Object.freeze(["managedDatabaseRefresh","managedEnvironment","managedGit",
1036
- "managedPreview"]),$i=Object.freeze(["managedPages"]),jp=64*1024,RN=Object.freeze(["When user input is necessary, ask no\
1046
+ commandLine:e})=>/(?:^|[\0/])opencode(?:\0|$)/u.test(`${t||""}\0${e}`)})});import{readFile as jp}from"node:fs/promises";import Jn from"node:path";function ir(t){return String(t||"").trim()}var Dp=Object.freeze(["main","temporary"]),Vi=Object.freeze(["managedDatabaseRefresh","managedEnvironment","managedGit",
1047
+ "managedPreview"]),Gi=Object.freeze(["managedPages"]),zp=64*1024,FM=Object.freeze(["When user input is necessary, ask no\
1037
1048
  more than three concise, high-impact questions at once.","Put multiple questions on separate lines as `[1] Question`, `\
1038
1049
  [2] Question`, and so on.","For a small fixed set of useful choices, put `Possible answers:` and a short bullet list dir\
1039
1050
  ectly beneath its own question, before the next one; never collect several questions' answers into one trailing list.","\
@@ -1046,7 +1057,7 @@ Possible answers:
1046
1057
  [2] Tell the main agent before changes?
1047
1058
  Possible answers:
1048
1059
  - Yes, tell main first
1049
- - No, proceed independently`]),PN=Object.freeze(["The Vibe64-managed preview is the canonical application server; never \
1060
+ - No, proceed independently`]),qM=Object.freeze(["The Vibe64-managed preview is the canonical application server; never \
1050
1061
  start a duplicate or replacement server. If it is unavailable, report that blocker. Describe only rendered browser evide\
1051
1062
  nce.","When adopting an authenticated app, or when its login blocks Preview inspection, inspect identity support/names w\
1052
1063
  ith `vibe64-helper preview status`; prefer `vibe64-helper preview browser identity <configured-name>` to requesting pass\
@@ -1061,108 +1072,111 @@ eview-identities`), then verify each with `vibe64-helper preview browser identit
1061
1072
  s per-run enable flag and secret. Do not create users, change roles, reset passwords or weaken production auth for impor\
1062
1073
  t. If choices are deferred/declined, say access stays unconfigured and continue independent setup work without repeated \
1063
1074
  credential requests. Public/non-web apps need no adapter.","Use `vibe64-helper preview status`, `screenshot`, `logs`, an\
1064
- d `browser eval` (Playwright code on stdin) for rendered inspection.","The top Preview toolbar Stop and `vibe64-helper p\
1065
- review stop` stop this session's application and managed browser, not chat or source. Status reports the saved stopped c\
1066
- hoice. A status read, screenshot, browser inspection, source edit or session reopening is not permission to restart it; \
1067
- use `vibe64-helper preview ensure --wait` only for a deliberate Start. Scoped browser tests restore the prior stopped ch\
1068
- oice.","For interactive navigation, use the proxy URL from `vibe64-helper preview inspect-url` or status `currentPage.ur\
1069
- l` / `endpoints.browser.url`. Inside browser eval, use `await page.goto(new URL('/your-path', preview.url).href)`. The d\
1070
- irect application endpoint under diagnostics bypasses Preview identity and is not a browser-navigation URL.","Use the ma\
1071
- naged preview browser for interactive browsing and `vibe64-helper playwright` only for an existing configured project su\
1072
- ite; never install another browser. Pin `@playwright/test` exactly to the `platformVersion` that `vibe64-helper playwrig\
1073
- ht readiness` reports. The login state belongs to the host: pass `process.env.PLAYWRIGHT_STORAGE_STATE` unchanged to `us\
1074
- e.storageState`, and never read, parse or edit that file or its cookies in the Playwright config (`vibe64-helper playwri\
1075
- ght` refuses such a config). If tests run signed out with it, that is a host defect: report it with the evidence; do not\
1076
- work around it.","For browser evidence, batch related actions and assertions, return only needed values and inspect rel\
1077
- evant locators or regions; screenshot at meaningful checkpoints or failures, not after every click. Reuse the managed br\
1078
- owser when isolation permits, keep required viewport, identity and security checks, and use existing automated cases for\
1079
- repeat verification.","For browser tests that write or reset data, inspect `vibe64-helper preview targets --json` and t\
1080
- he project's `genesis/stack.md` Outputs. Run `vibe64-helper playwright --target <declared-test-target> test <suite argum\
1081
- ents>` (or `npm-run <script>` in place of `test`). Vibe64 starts that web target, waits for readiness, uses its declared\
1082
- application identity, and restores the previous Preview when the command finishes or is cancelled; report restoration f\
1083
- ailures.","A target name is not proof of test isolation. Before running a destructive suite, the application must verify\
1084
- the server's actual test database and suppress real email, invoices, payments, and other external effects. Keep managed\
1085
- Env unchanged. The test launcher and its preview-identity command must use the same database. Follow the application's \
1086
- declared test resources and never invent a database name. Never spoof safety checks by changing only the test runner's e\
1087
- nvironment.","If no suitable test target exists, add one through the project's existing Outputs contract and application\
1088
- -owned test scripts within authorized scope; normal Preview stays the default. Validate the exact disposable database be\
1089
- fore resetting it, prepare fixtures before reporting readiness, and make Playwright use PLAYWRIGHT_BASE_URL (the started\
1090
- target's URL) without starting another server. If test resources or external-effect controls are missing, report that b\
1091
- locker. `vibe64-helper preview ensure --target <id> --wait --json` deliberately selects an interactive target until chan\
1092
- ged. If browser startup is slow, measure migrations, fixtures and server startup before retrying or extending deadlines.",
1093
- "Keep test output small: run relevant files/cases, save stdout/stderr to local artifacts and keep exit status. Report co\
1094
- unts, duration, failed cases, actionable errors and artifact paths, reading only needed failure excerpts. Retain startup\
1095
- , resource and Preview-restoration errors even if tests pass, and trailing wrapper diagnostics separately from JSON. Do \
1096
- not rerun for output or reread unchanged logs.","Batch related browser tests in one managed suite (one Preview switch an\
1097
- d restore). Suites and live Preview actions are sequential: no browser actions, ensure/restart or target changes during \
1098
- a suite or restoration. Wait on the original execution, including background runs, through cleanup/restoration (empty po\
1099
- lls: yield_time_ms: 30000 where supported; shorter only for interactive input); read-only status/logs stay available. Be\
1100
- fore live inspection, confirm `vibe64-helper playwright status` shows no active run and `vibe64-helper preview status` i\
1101
- s ready on the restored target. To stop, run `vibe64-helper playwright cancel <run-id>`, which waits for cleanup/restora\
1102
- tion; retry if cleanup needs attention. Never kill test/Preview PIDs or change locks; launcher exit alone does not prove\
1103
- tests stopped. Recheck status before reporting a busy blocker.","If a managed command reports kernel task denials or a \
1104
- resource incident, report the blocker with its diagnostic and incident ID and ask the platform operator to inspect that \
1105
- evidence before retrying; never raise test timeouts or weaken assertions to work around a process/thread limit. A generi\
1106
- c browser timeout without resource evidence does not establish a platform cause."]),kN=Object.freeze(['Pages: `vibe64-he\
1107
- lper pages publish <file.html|folder> [--title "Title"]` publishes an HTML page (one file, or a folder with index.html a\
1108
- nd its own scripts, styles, data and images) that everyone with access to this project can open from Vibe64\'s Pages list\
1109
- ; `vibe64-helper pages update <page-id> <file.html|folder>` gives a page a new version under the same link (it keeps ten\
1110
- ; `vibe64-helper pages revert <page-id> <version>` brings one back); `vibe64-helper pages list` lists them. A page runs \
1111
- sandboxed and loads only its own files, never other addresses, CDNs or Vibe64 itself, so ship every script, style and da\
1112
- ta file inside it. Write page files outside the repository (for example in VIBE64_DROP_ZONE) unless they belong there. G\
1113
- ive the printed link in the chat as a Markdown link; Vibe64 shows it as a card.',"Before writing a page, read `vibe64-he\
1114
- lper pages guide` in full and follow it: link `_vibe64/page.css` and build from its components (a header, summary tiles \
1115
- first, sections of cards, status pills, tables for comparisons, inline SVG charts), never a wall of text.",'After answer\
1116
- ing with a report, comparison, status or progress overview, dashboard, diagram, plan or review, end the reply with a one\
1117
- -line offer, such as "Want this as a page everyone on the project can open?" (or, when a related page exists, offer to a\
1118
- dd it there). Make or change a page only once they say yes.',"When the person says the result is for other people (a col\
1119
- league, the team, a client, a manager, a meeting) or that they will come back to it, make the page without asking and gi\
1120
- ve its link.","When a page's content will change over time (test results, progress, metrics), say the page can be kept u\
1121
- p to date. When the person wants that, build it as the guide's \"A page that keeps itself up to date\" says: index.html fo\
1122
- r the layout, data.json for the numbers, then `vibe64-helper pages refresh <page-id>` with --every or --daily. Choose --\
1123
- command with a small script that writes data.json, which needs no AI, whenever a script can gather the data; use --promp\
1124
- t only when gathering it needs judgement.","Before making a page, check `vibe64-helper pages list`: when a page about th\
1125
- e same subject already exists, update it instead of making a new one.","Do not offer pages for quick answers, code chang\
1126
- es, or documents that belong in the repository. Offer at most once per topic; do not nag.","Everyone with access to the \
1127
- project can open a page: never put secrets in one, or anything not every project member should see."]),NN=Object.freeze(
1128
- ["Each managed shell command receives current development Env from Vibe64, including declared resource bindings; use the\
1129
- m in ordinary commands. Do not build environment injection or copy managed credentials into source. Resource provisionin\
1130
- g and application migrations remain separate preparation steps.","Use `vibe64-helper env status [development|production|\
1131
- all]` to inspect configured key names without revealing values.","Pipe an available value to `vibe64-helper env set <dev\
1132
- elopment|production> <KEY> [--secret]`; never put values in arguments, logs, or repository files. Use empty stdin only w\
1133
- hen the user requested an empty value. The host decides whose session may change production values; when it refuses, rep\
1134
- ort its message instead of retrying.","When the person refers to a saved key, account or accounts hub, run `vibe64-helpe\
1135
- r env saved` (names, descriptions and fields, never values) and link the matching field to the variable the application \
1136
- reads with `vibe64-helper env link <development|production> <KEY> <saved-id> <field-id>` instead of asking for the value\
1137
- .","Keep development and production values separate. Never invent credentials, copy a value between scopes without expli\
1138
- cit direction, or edit Vibe64 runtime/session storage.","After an Env mutation, report only the affected scope and key n\
1139
- ames, never their values, and claim success only when the command succeeded.","Store a secret the application needs gene\
1140
- rated (such as an application key) by generating it with the framework's own generator and piping it to `vibe64-helper e\
1141
- nv set <scope> <KEY> --secret`. Never write it into a generated `.env` file: Vibe64 regenerates that file from Env."]);function Wn(t,e){
1142
- if(!t||typeof t!="object"||Array.isArray(t))throw new TypeError(`${e} must be an object.`);return t}function mt(t,e,r){let n=new Set(
1143
- e),o=Object.keys(t).filter(s=>!n.has(s));if(o.length>0)throw new TypeError(`${r} contains unsupported fields: ${o.join("\
1144
- , ")}.`)}function Dp(t){if(mt(t,["conversationKind","scope","session","hostGuidance"],"Vibe64 session context"),t.hostGuidance!==
1145
- void 0&&(typeof t.hostGuidance!="string"||Buffer.byteLength(t.hostGuidance,"utf8")>1024))throw new TypeError("Vibe64 hos\
1146
- t guidance must be bounded text supplied by the host.");if(!Mp.includes(t.conversationKind))throw new TypeError("Vibe64 \
1147
- session context has an unknown conversationKind.");let e=Wn(t.session,"Vibe64 session capabilities");mt(e,[...qi,...$i],
1148
- "Vibe64 session capabilities");let r=Object.fromEntries(qi.map(n=>{if(typeof e[n]!="boolean")throw new TypeError(`Vibe64\
1149
- session capability ${n} must be boolean.`);return[n,e[n]]}));for(let n of $i){if(e[n]!==void 0&&typeof e[n]!="boolean")
1150
- throw new TypeError(`Vibe64 session capability ${n} must be boolean.`);e[n]===!0&&(r[n]=!0)}return{conversationKind:t.conversationKind,
1151
- scope:"session",...t.hostGuidance?{hostGuidance:t.hostGuidance}:{},session:r}}function zp(t){mt(t,["scope","stableContex\
1152
- t"],"Vibe64 ephemeral context");let e=String(t.stableContext||"").trim();if(!e||e.length>jp)throw new TypeError("Vibe64 \
1153
- ephemeral context requires bounded stableContext.");return{scope:"ephemeral",stableContext:e}}function Lp(t){if(t.scope===
1154
- "session")return Dp(t);if(t.scope==="ephemeral")return zp(t);throw new TypeError("The Vibe64 driver supports session and\
1155
- ephemeral scopes only.")}async function Bi(t={},{readRegistry:e=Np,workdir:r=""}={}){let n=Wn(t,"Vibe64 host resolver request");if(mt(n,["data","\
1156
- providerSessionId","parentSessionIds","scope"],"Vibe64 host resolver request"),!["session","turn"].includes(n.scope))throw new TypeError(
1157
- "The Vibe64 host resolver scope must be session or turn.");if(n.scope==="turn")return null;let o=Wn(n.data,"Vibe64 host \
1158
- resolver data");mt(o,["registryPath"],"Vibe64 host resolver data");let s=sr(o.registryPath);if(!Gn.isAbsolute(s))throw new TypeError(
1075
+ d `browser eval` (Playwright code on stdin) for rendered inspection.","When the person asks to see a page of the app, ru\
1076
+ n `vibe64-helper preview open <path>` with its path inside the app (for example `/orders/42?tab=notes`): it moves the Pr\
1077
+ eview they have open to that page and says the AI opened it. Your managed browser is a separate copy and never moves the\
1078
+ ir pane. If it reports `moved: 0`, give them the path to type into the Preview address box.","The top Preview toolbar St\
1079
+ op and `vibe64-helper preview stop` stop this session's application and managed browser, not chat or source. Status repo\
1080
+ rts the saved stopped choice. A status read, screenshot, browser inspection, source edit or session reopening is not per\
1081
+ mission to restart it; use `vibe64-helper preview ensure --wait` only for a deliberate Start. Scoped browser tests resto\
1082
+ re the prior stopped choice.","For interactive navigation, use the proxy URL from `vibe64-helper preview inspect-url` or\
1083
+ status `currentPage.url` / `endpoints.browser.url`. Inside browser eval, use `await page.goto(new URL('/your-path', pre\
1084
+ view.url).href)`. The direct application endpoint under diagnostics bypasses Preview identity and is not a browser-navig\
1085
+ ation URL.","Use the managed preview browser for interactive browsing and `vibe64-helper playwright` only for an existin\
1086
+ g configured project suite; never install another browser. Pin `@playwright/test` exactly to the `platformVersion` that \
1087
+ `vibe64-helper playwright readiness` reports. The login state belongs to the host: pass `process.env.PLAYWRIGHT_STORAGE_\
1088
+ STATE` unchanged to `use.storageState`, and never read, parse or edit that file or its cookies in the Playwright config \
1089
+ (`vibe64-helper playwright` refuses such a config). If tests run signed out with it, that is a host defect: report it wi\
1090
+ th the evidence; do not work around it.","For browser evidence, batch related actions and assertions, return only needed\
1091
+ values and inspect relevant locators or regions; screenshot at meaningful checkpoints or failures, not after every clic\
1092
+ k. Reuse the managed browser when isolation permits, keep required viewport, identity and security checks, and use exist\
1093
+ ing automated cases for repeat verification.","For browser tests that write or reset data, inspect `vibe64-helper previe\
1094
+ w targets --json` and the project's `genesis/stack.md` Outputs. Run `vibe64-helper playwright --target <declared-test-ta\
1095
+ rget> test <suite arguments>` (or `npm-run <script>` in place of `test`). Vibe64 starts that web target, waits for readi\
1096
+ ness, uses its declared application identity, and restores the previous Preview when the command finishes or is cancelle\
1097
+ d; report restoration failures.","A target name is not proof of test isolation. Before running a destructive suite, the \
1098
+ application must verify the server's actual test database and suppress real email, invoices, payments, and other externa\
1099
+ l effects. Keep managed Env unchanged. The test launcher and its preview-identity command must use the same database. Fo\
1100
+ llow the application's declared test resources and never invent a database name. Never spoof safety checks by changing o\
1101
+ nly the test runner's environment.","If no suitable test target exists, add one through the project's existing Outputs c\
1102
+ ontract and application-owned test scripts within authorized scope; normal Preview stays the default. Validate the exact\
1103
+ disposable database before resetting it, prepare fixtures before reporting readiness, and make Playwright use PLAYWRIGH\
1104
+ T_BASE_URL (the started target's URL) without starting another server. If test resources or external-effect controls are\
1105
+ missing, report that blocker. `vibe64-helper preview ensure --target <id> --wait --json` deliberately selects an intera\
1106
+ ctive target until changed. If browser startup is slow, measure migrations, fixtures and server startup before retrying \
1107
+ or extending deadlines.","Keep test output small: run relevant files/cases, save stdout/stderr to local artifacts and ke\
1108
+ ep exit status. Report counts, duration, failed cases, actionable errors and artifact paths, reading only needed failure\
1109
+ excerpts. Retain startup, resource and Preview-restoration errors even if tests pass, and trailing wrapper diagnostics \
1110
+ separately from JSON. Do not rerun for output or reread unchanged logs.","Batch related browser tests in one managed sui\
1111
+ te (one Preview switch and restore). Suites and live Preview actions are sequential: no browser actions, ensure/restart \
1112
+ or target changes during a suite or restoration. Wait on the original execution, including background runs, through clea\
1113
+ nup/restoration (empty polls: yield_time_ms: 30000 where supported; shorter only for interactive input); read-only statu\
1114
+ s/logs stay available. Before live inspection, confirm `vibe64-helper playwright status` shows no active run and `vibe64\
1115
+ -helper preview status` is ready on the restored target. To stop, run `vibe64-helper playwright cancel <run-id>`, which \
1116
+ waits for cleanup/restoration; retry if cleanup needs attention. Never kill test/Preview PIDs or change locks; launcher \
1117
+ exit alone does not prove tests stopped. Recheck status before reporting a busy blocker.","If a managed command reports \
1118
+ kernel task denials or a resource incident, report the blocker with its diagnostic and incident ID and ask the platform \
1119
+ operator to inspect that evidence before retrying; never raise test timeouts or weaken assertions to work around a proce\
1120
+ ss/thread limit. A generic browser timeout without resource evidence does not establish a platform cause."]),$M=Object.freeze(
1121
+ ['Pages: `vibe64-helper pages publish <file.html|folder> [--title "Title"]` publishes an HTML page (one file, or a folde\
1122
+ r with index.html and its own scripts, styles, data and images) that everyone with access to this project can open from \
1123
+ Vibe64\'s Pages list; `vibe64-helper pages update <page-id> <file.html|folder>` gives a page a new version under the same\
1124
+ link (it keeps ten; `vibe64-helper pages revert <page-id> <version>` brings one back); `vibe64-helper pages list` lists\
1125
+ them. A page runs sandboxed and loads only its own files, never other addresses, CDNs or Vibe64 itself, so ship every s\
1126
+ cript, style and data file inside it. Write page files outside the repository (for example in VIBE64_DROP_ZONE) unless t\
1127
+ hey belong there. Give the printed link in the chat as a Markdown link; Vibe64 shows it as a card.',"Before writing a pa\
1128
+ ge, read `vibe64-helper pages guide` in full and follow it: link `_vibe64/page.css` and build from its components (a hea\
1129
+ der, summary tiles first, sections of cards, status pills, tables for comparisons, inline SVG charts), never a wall of t\
1130
+ ext.",'After answering with a report, comparison, status or progress overview, dashboard, diagram, plan or review, end t\
1131
+ he reply with a one-line offer, such as "Want this as a page everyone on the project can open?" (or, when a related page\
1132
+ exists, offer to add it there). Make or change a page only once they say yes.',"When the person says the result is for \
1133
+ other people (a colleague, the team, a client, a manager, a meeting) or that they will come back to it, make the page wi\
1134
+ thout asking and give its link.","When a page's content will change over time (test results, progress, metrics), say the\
1135
+ page can be kept up to date. When the person wants that, build it as the guide's \"A page that keeps itself up to date\" \
1136
+ says: index.html for the layout, data.json for the numbers, then `vibe64-helper pages refresh <page-id>` with --every or\
1137
+ --daily. Choose --command with a small script that writes data.json, which needs no AI, whenever a script can gather th\
1138
+ e data; use --prompt only when gathering it needs judgement.","Before making a page, check `vibe64-helper pages list`: w\
1139
+ hen a page about the same subject already exists, update it instead of making a new one.","Do not offer pages for quick \
1140
+ answers, code changes, or documents that belong in the repository. Offer at most once per topic; do not nag.","Everyone \
1141
+ with access to the project can open a page: never put secrets in one, or anything not every project member should see."]),
1142
+ BM=Object.freeze(["Each managed shell command receives current development Env from Vibe64, including declared resource \
1143
+ bindings; use them in ordinary commands. Do not build environment injection or copy managed credentials into source. Res\
1144
+ ource provisioning and application migrations remain separate preparation steps.","Use `vibe64-helper env status [develo\
1145
+ pment|production|all]` to inspect configured key names without revealing values.","Pipe an available value to `vibe64-he\
1146
+ lper env set <development|production> <KEY> [--secret]`; never put values in arguments, logs, or repository files. Use e\
1147
+ mpty stdin only when the user requested an empty value. The host decides whose session may change production values; whe\
1148
+ n it refuses, report its message instead of retrying.","When the person refers to a saved key, account or accounts hub, \
1149
+ run `vibe64-helper env saved` (names, descriptions and fields, never values) and link the matching field to the variable\
1150
+ the application reads with `vibe64-helper env link <development|production> <KEY> <saved-id> <field-id>` instead of ask\
1151
+ ing for the value.","Keep development and production values separate. Never invent credentials, copy a value between sco\
1152
+ pes without explicit direction, or edit Vibe64 runtime/session storage.","After an Env mutation, report only the affecte\
1153
+ d scope and key names, never their values, and claim success only when the command succeeded.","Store a secret the appli\
1154
+ cation needs generated (such as an application key) by generating it with the framework's own generator and piping it to\
1155
+ `vibe64-helper env set <scope> <KEY> --secret`. Never write it into a generated `.env` file: Vibe64 regenerates that fi\
1156
+ le from Env."]);function Xn(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new TypeError(`${e} must be an object\
1157
+ .`);return t}function mt(t,e,n){let r=new Set(e),o=Object.keys(t).filter(s=>!r.has(s));if(o.length>0)throw new TypeError(
1158
+ `${n} contains unsupported fields: ${o.join(", ")}.`)}function Lp(t){if(mt(t,["conversationKind","scope","session","host\
1159
+ Guidance"],"Vibe64 session context"),t.hostGuidance!==void 0&&(typeof t.hostGuidance!="string"||Buffer.byteLength(t.hostGuidance,
1160
+ "utf8")>1024))throw new TypeError("Vibe64 host guidance must be bounded text supplied by the host.");if(!Dp.includes(t.conversationKind))
1161
+ throw new TypeError("Vibe64 session context has an unknown conversationKind.");let e=Xn(t.session,"Vibe64 session capabi\
1162
+ lities");mt(e,[...Vi,...Gi],"Vibe64 session capabilities");let n=Object.fromEntries(Vi.map(r=>{if(typeof e[r]!="boolean")
1163
+ throw new TypeError(`Vibe64 session capability ${r} must be boolean.`);return[r,e[r]]}));for(let r of Gi){if(e[r]!==void 0&&
1164
+ typeof e[r]!="boolean")throw new TypeError(`Vibe64 session capability ${r} must be boolean.`);e[r]===!0&&(n[r]=!0)}return{
1165
+ conversationKind:t.conversationKind,scope:"session",...t.hostGuidance?{hostGuidance:t.hostGuidance}:{},session:n}}function Up(t){
1166
+ mt(t,["scope","stableContext"],"Vibe64 ephemeral context");let e=String(t.stableContext||"").trim();if(!e||e.length>zp)throw new TypeError(
1167
+ "Vibe64 ephemeral context requires bounded stableContext.");return{scope:"ephemeral",stableContext:e}}function Fp(t){if(t.
1168
+ scope==="session")return Lp(t);if(t.scope==="ephemeral")return Up(t);throw new TypeError("The Vibe64 driver supports ses\
1169
+ sion and ephemeral scopes only.")}async function Wi(t={},{readRegistry:e=jp,workdir:n=""}={}){let r=Xn(t,"Vibe64 host resolver request");if(mt(r,["data","\
1170
+ providerSessionId","parentSessionIds","scope"],"Vibe64 host resolver request"),!["session","turn"].includes(r.scope))throw new TypeError(
1171
+ "The Vibe64 host resolver scope must be session or turn.");if(r.scope==="turn")return null;let o=Xn(r.data,"Vibe64 host \
1172
+ resolver data");mt(o,["registryPath"],"Vibe64 host resolver data");let s=ir(o.registryPath);if(!Jn.isAbsolute(s))throw new TypeError(
1159
1173
  "Vibe64 host resolver data requires an absolute registryPath.");let i=JSON.parse(await e(s,"utf8"));if(!Array.isArray(i?.
1160
- sessions))throw new TypeError("The conversation ownership registry is invalid.");let a=i.sessions,c=sr(n.providerSessionId);
1161
- if(n.parentSessionIds!==void 0&&(!Array.isArray(n.parentSessionIds)||n.parentSessionIds.length>32||n.parentSessionIds.some(
1162
- l=>typeof l!="string"||!l.trim())))throw new TypeError("Invalid native conversation ancestry.");let p=[c,...n.parentSessionIds||
1163
- []].filter(Boolean).map(l=>a.find(v=>sr(v?.upstreamSessionId)===l)).find(Boolean),m=p?.promptContext;if(!m)return null;if(r&&
1164
- p.workdir&&Gn.resolve(r)!==Gn.resolve(p.workdir))throw new Error("The managed conversation belongs to a different projec\
1165
- t directory.");return Lp(m)}var Kn="";for await(let t of process.stdin)if(Kn+=t,Buffer.byteLength(Kn)>256*1024)throw new Error("Conversation instruc\
1166
- tion input exceeds 256 KiB.");var Hi=JSON.parse(Kn);if(process.argv[2]==="--instructions"){let{vibe64ConversationInstructions:t}=await import("@local/vibe64-genesis/server");
1167
- process.stdout.write(await t(Hi))}else{let t=Vn({resolveConversation:async e=>await Bi(e,{workdir:process.cwd()})?{delivery:"\
1168
- native"}:null});process.stdout.write(JSON.stringify(await t(Hi)))}
1174
+ sessions))throw new TypeError("The conversation ownership registry is invalid.");let a=i.sessions,c=ir(r.providerSessionId);
1175
+ if(r.parentSessionIds!==void 0&&(!Array.isArray(r.parentSessionIds)||r.parentSessionIds.length>32||r.parentSessionIds.some(
1176
+ l=>typeof l!="string"||!l.trim())))throw new TypeError("Invalid native conversation ancestry.");let p=[c,...r.parentSessionIds||
1177
+ []].filter(Boolean).map(l=>a.find(v=>ir(v?.upstreamSessionId)===l)).find(Boolean),m=p?.promptContext;if(!m)return null;if(n&&
1178
+ p.workdir&&Jn.resolve(n)!==Jn.resolve(p.workdir))throw new Error("The managed conversation belongs to a different projec\
1179
+ t directory.");return Fp(m)}var Yn="";for await(let t of process.stdin)if(Yn+=t,Buffer.byteLength(Yn)>256*1024)throw new Error("Conversation instruc\
1180
+ tion input exceeds 256 KiB.");var Ki=JSON.parse(Yn);if(process.argv[2]==="--instructions"){let{vibe64ConversationInstructions:t}=await import("@local/vibe64-genesis/server");
1181
+ process.stdout.write(await t(Ki))}else{let t=Kn({resolveConversation:async e=>await Wi(e,{workdir:process.cwd()})?{delivery:"\
1182
+ native"}:null});process.stdout.write(JSON.stringify(await t(Ki)))}