sliccy 6.110.2 → 6.110.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/node-server/_cloud_core/src/cone-config/index.d.ts.map +1 -1
- package/dist/node-server/_cloud_core/src/cone-config/index.js +9 -6
- package/dist/node-server/_shared/transcript-export.d.ts.map +1 -1
- package/dist/node-server/_shared/transcript-export.js.map +1 -1
- package/dist/node-server/electron-runtime.d.ts +9 -0
- package/dist/node-server/electron-runtime.js +3 -3
- package/dist/ui/.vite/manifest.json +487 -331
- package/dist/ui/assets/{account-store-Bg1KKHOx.js → account-store-B_euqvU1.js} +3 -3
- package/dist/ui/assets/{account-store-8sKKUZ8J.js → account-store-D2KwZ_JF.js} +1 -1
- package/dist/ui/assets/{adobe-0CWIpyju.js → adobe-Cki2HdAO.js} +1 -1
- package/dist/ui/assets/adobe-D5Qr-WPC.js +2 -0
- package/dist/ui/assets/{agent-bridge-B43SVYcu.js → agent-bridge-Bn0WMBTn.js} +1 -1
- package/dist/ui/assets/agent-message-to-chat-Cc7vTUN1.js +1 -0
- package/dist/ui/assets/{agent-panels-9uCI5yeM.js → agent-panels-DXR6E-bx.js} +1 -1
- package/dist/ui/assets/{apply-layout-Bz-0rXhV.js → apply-layout-DPUrW7E1.js} +1 -1
- package/dist/ui/assets/{apps-C16RztyU.js → apps-CxDQe9yg.js} +3 -3
- package/dist/ui/assets/attachments-329cIT1j.js +1 -0
- package/dist/ui/assets/{azure-openai-DoQszniP.js → azure-openai-BWtPfHSZ.js} +1 -1
- package/dist/ui/assets/{azure-openai-BCKGDF-y.js → azure-openai-C1PRVW4U.js} +1 -1
- package/dist/ui/assets/{bsh-watchdog--Df_ThJG.js → bsh-watchdog-COvv_9Ni.js} +1 -1
- package/dist/ui/assets/{cdp-BzUC7d2h.js → cdp-CV7RtjZN.js} +1 -1
- package/dist/ui/assets/{cerebras-kH_bQsg2.js → cerebras-BCQIQgbC.js} +1 -1
- package/dist/ui/assets/{cerebras-CQwhL4Ig.js → cerebras-gMA2dLvG.js} +1 -1
- package/dist/ui/assets/chat-session-store-pWb1-jNp.js +1 -0
- package/dist/ui/assets/{connect-surface-BMrb-EnN.js → connect-surface-DQxDKDVQ.js} +1 -1
- package/dist/ui/assets/core-BVWxlTTk.js +95 -0
- package/dist/ui/assets/db-cKsBsMMN.js +1 -0
- package/dist/ui/assets/dictation-priming-CNllGgNq.js +1 -0
- package/dist/ui/assets/dip-DKmRJ7Vw.js +233 -0
- package/dist/ui/assets/{directed-approval-zeD_orXz.js → directed-approval-D76SQA01.js} +1 -1
- package/dist/ui/assets/dist-BamC4SL9.js +1 -0
- package/dist/ui/assets/dist-Bwf-JITi.js +12 -0
- package/dist/ui/assets/dist-CJQsHfm3.js +6 -0
- package/dist/ui/assets/dist-Cre853-J.js +23 -0
- package/dist/ui/assets/dist-D9gC7MoR.js +1 -0
- package/dist/ui/assets/esptool-operations-DEqDNikQ.js +12 -0
- package/dist/ui/assets/export-provider-BEHTjSYw.js +1 -0
- package/dist/ui/assets/{follower-navigate-watcher-BoAzVfrf.js → follower-navigate-watcher-BMWK2tPF.js} +1 -1
- package/dist/ui/assets/follower-presentation-DqBw0YiV.js +1 -0
- package/dist/ui/assets/fs-Bbg8o7F_.js +1 -0
- package/dist/ui/assets/fs-ybjwwXNY.js +2 -0
- package/dist/ui/assets/github-B4QpYLh4.js +2 -0
- package/dist/ui/assets/github-OxXVARDc.js +1 -0
- package/dist/ui/assets/{github-copilot-Xp2l1YxD.js → github-copilot-CdB5cKgY.js} +1 -1
- package/dist/ui/assets/github-copilot-uKaBUS0r.js +2 -0
- package/dist/ui/assets/{github-install-DRa8AaBY.js → github-install-IRaqAW5t.js} +1 -1
- package/dist/ui/assets/{github-zip-BpPiUirA.js → github-zip-D1HC1UDF.js} +1 -1
- package/dist/ui/assets/{guest-tool-gate-Odk1glKI.js → guest-tool-gate-MzqLI9n7.js} +1 -1
- package/dist/ui/assets/handoff-link-BzmwBKCE.js +1 -0
- package/dist/ui/assets/hear-L1cFtax_.js +1 -0
- package/dist/ui/assets/intercepted-oauth-B0tP4D7f.js +1 -0
- package/dist/ui/assets/{js-realm-worker-D6DSLfXh.js → js-realm-worker-C_6Rz8Xq.js} +4 -4
- package/dist/ui/assets/{kernel-worker-DQDT4Cud.js → kernel-worker-DP91cGf5.js} +656 -645
- package/dist/ui/assets/lick-manager-y-5bIVRR.js +2 -0
- package/dist/ui/assets/{lick-urls-51I5JBZv.js → lick-urls-CLl4eksX.js} +1 -1
- package/dist/ui/assets/lick-ws-bridge-BD2lQGbd.js +1 -0
- package/dist/ui/assets/{lick-ws-bridge-rxCk9AYw.js → lick-ws-bridge-CBO4U0Rd.js} +1 -1
- package/dist/ui/assets/{local-llm-OBHKAcNH.js → local-llm-DQaA6Xum.js} +2 -2
- package/dist/ui/assets/local-llm-qWWWUQwI.js +2 -0
- package/dist/ui/assets/main-CDW7cA9Q.js +22 -0
- package/dist/ui/assets/main-cherry-DM457LUs.js +1 -0
- package/dist/ui/assets/mount-Bye7RRyn.js +1 -0
- package/dist/ui/assets/{mount-Rb9VVKip.js → mount-CKqZ8Dw9.js} +2 -2
- package/dist/ui/assets/mount-index-BCzDM4LQ.js +1 -0
- package/dist/ui/assets/mount-picker-popup-DFcbLJQx.js +1 -0
- package/dist/ui/assets/mount-recovery-DLvtOBuL.js +2 -0
- package/dist/ui/assets/navigation-watcher-CUyfUWfd.js +1 -0
- package/dist/ui/assets/new-session-D_qcj8sH.js +2 -0
- package/dist/ui/assets/oauth-bootstrap-BggoSb8S.js +2 -0
- package/dist/ui/assets/oauth-service-NaEg6KHx.js +1 -0
- package/dist/ui/assets/{oauth-service-CUpgufjo.js → oauth-service-TDESX_tk.js} +1 -1
- package/dist/ui/assets/onboarding-orchestrator-CYP2ZqYz.js +1 -0
- package/dist/ui/assets/openai-codex-0QkemnWA.js +1 -0
- package/dist/ui/assets/openai-codex-Ywc_TGt7.js +1 -0
- package/dist/ui/assets/openrouter-Bigkgk_-.js +1 -0
- package/dist/ui/assets/{openrouter-meLV8ehE.js → openrouter-D7e8-Jky.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-DudFNSW4.js → openrouter-oauth-B-7NH7br.js} +1 -1
- package/dist/ui/assets/openrouter-oauth-C_xB6iEI.js +1 -0
- package/dist/ui/assets/panel-rpc-handlers-gt5P9UqB.js +2 -0
- package/dist/ui/assets/{panelize-shell-65i9Hq7n.js → panelize-shell-CYxm6Ct5.js} +1 -1
- package/dist/ui/assets/provider-DQ4cOwEh.js +2 -0
- package/dist/ui/assets/{provider-BE0mTIGf.js → provider-MJj2wPLX.js} +1 -1
- package/dist/ui/assets/provider-settings-B60i2ftL.js +2 -0
- package/dist/ui/assets/provider-settings-CxlhAPcv.js +1 -0
- package/dist/ui/assets/provider-store-access-B_svgffl.js +1 -0
- package/dist/ui/assets/provider-store-access-CglhtJ4J.js +2 -0
- package/dist/ui/assets/providers-Drh9RBhg.js +2 -0
- package/dist/ui/assets/{providers-BlPz5ou6.js → providers-fS5pOEQR.js} +1 -1
- package/dist/ui/assets/{quick-llm-CcFoANd_.js → quick-llm-DunO9KZO.js} +1 -1
- package/dist/ui/assets/{recovery-screen-44Uu5Cgy.js → recovery-screen-DtISSxAv.js} +1 -1
- package/dist/ui/assets/{redirect-uri-C_VlH29S.js → redirect-uri-DC3PdAtX.js} +1 -1
- package/dist/ui/assets/remote-cdp-transport-CgOXLjZ8.js +1 -0
- package/dist/ui/assets/{remote-terminal-view-vsJYhJKi.js → remote-terminal-view-DpxIbz7w.js} +1 -1
- package/dist/ui/assets/{run-BQu73khp.js → run-DgD5DSV8.js} +1 -1
- package/dist/ui/assets/{secret-env-Hwyj0iR1.js → secret-env-CvkpMxjz.js} +1 -1
- package/dist/ui/assets/secrets-bridge-client-H8-Z1RVR.js +1 -0
- package/dist/ui/assets/session-freezer-CNHYB1nc.js +162 -0
- package/dist/ui/assets/{setup-feature-flags-remote-ITlSmr_i.js → setup-feature-flags-remote-6EhUbJpO.js} +1 -1
- package/dist/ui/assets/setup-standalone-prelude-B8nDv9xv.js +2 -0
- package/dist/ui/assets/setup-sudo-B0OWsay7.js +2 -0
- package/dist/ui/assets/sidecar-repair-431vRT2V.js +1 -0
- package/dist/ui/assets/{skills-B0o8gPTv.js → skills-SI_H-dAw.js} +2 -2
- package/dist/ui/assets/slicc-editor-Bhg4cWBq.js +12 -0
- package/dist/ui/assets/slicc-editor-CL_D1iJB.js +1 -0
- package/dist/ui/assets/slicc-version-B-ZvN_5f.js +1 -0
- package/dist/ui/assets/{sprinkle-manager-DAE09Bc2.js → sprinkle-manager-DjLsrQSV.js} +1 -1
- package/dist/ui/assets/{sprinkle-renderer-C9L5ZRvl.js → sprinkle-renderer-1C1DNVyK.js} +2 -2
- package/dist/ui/assets/state-CDIZhQs-.js +42 -0
- package/dist/ui/assets/{store-C3RMRz9d.js → store-CxmVEGqi.js} +1 -1
- package/dist/ui/assets/{store-CzQ9Fvfr.js → store-DLL7d3Pv.js} +1 -1
- package/dist/ui/assets/{sudo-CPH7ANoV.js → sudo-C9n-aAFC.js} +1 -1
- package/dist/ui/assets/sync-dialog-ACgl0n-p.js +1 -0
- package/dist/ui/assets/timestamp-preference-sKwBl5I8.js +2 -0
- package/dist/ui/assets/tool-ui-eSQ1g2I1.js +1 -0
- package/dist/ui/assets/tray-leader-BkvHMG47.js +1 -0
- package/dist/ui/assets/{tray-leave-runtime-3_wlFPFU.js → tray-leave-runtime-OxVT1X8O.js} +1 -1
- package/dist/ui/assets/tray-runtime-config-CjsIUSv2.js +1 -0
- package/dist/ui/assets/tray-runtime-config-CluPgaPA.js +1 -0
- package/dist/ui/assets/tray-sidecar-DlsvQaxt.js +2 -0
- package/dist/ui/assets/tray-sync-protocol-BZ5yhJH9.js +1 -0
- package/dist/ui/assets/tray-sync-protocol-BlwQKL0e.js +1 -0
- package/dist/ui/assets/tray-url-config-Cx0gvYq6.js +1 -0
- package/dist/ui/assets/tray-webrtc-DfkvaMcO.js +1 -0
- package/dist/ui/assets/{upgrade-detection-TsOPChOa.js → upgrade-detection-BNeR8v1u.js} +1 -1
- package/dist/ui/assets/voice-reply-Bl9WzOJ_.js +1 -0
- package/dist/ui/assets/wc-attach-Dc31zmRt.js +13 -0
- package/dist/ui/assets/wc-extension-D5FlsMCt.js +2 -0
- package/dist/ui/assets/wc-float-label-CwzsTOti.js +1 -0
- package/dist/ui/assets/wc-floatbar-online-CCdIg4mG.js +1 -0
- package/dist/ui/assets/wc-follower-Bke4661H.js +17 -0
- package/dist/ui/assets/wc-follower-oauth-C-U310E1.js +5 -0
- package/dist/ui/assets/wc-live-CJ-SgVZ0.js +8 -0
- package/dist/ui/assets/wc-nav-TcC8J6nL.js +2 -0
- package/dist/ui/assets/wc-onboarding-BOs5rY9y.js +2 -0
- package/dist/ui/assets/{wc-permissions-CCJrTH49.js → wc-permissions-C77Upopt.js} +3 -3
- package/dist/ui/assets/wc-permissions-providers-CKzd9Xhn.js +2 -0
- package/dist/ui/assets/{wc-placeholder-CPMV2eO3.js → wc-placeholder-Cgt7DIlO.js} +3 -3
- package/dist/ui/assets/{wc-settings-M8e_JWQh.js → wc-settings-BBeVfukN.js} +3 -3
- package/dist/ui/assets/{wc-shell-WlrdsROD.js → wc-shell-DPug1uqg.js} +193 -194
- package/dist/ui/assets/{wc-shortcut-config-BftmZXGf.js → wc-shortcut-config-KuxMSZRS.js} +1 -1
- package/dist/ui/assets/{wc-sprinkles-DhXJLTUO.js → wc-sprinkles-DDuK1vDI.js} +2 -2
- package/dist/ui/assets/wc-transcript-export-DKIleW7-.js +2 -0
- package/dist/ui/assets/wc-tray-CAP6mm59.js +5 -0
- package/dist/ui/assets/welcome-detection-BxyK5SuW.js +1 -0
- package/dist/ui/assets/xai-grok-DnhaUq5y.js +1 -0
- package/dist/ui/assets/{xai-grok-DH1oX2E5.js → xai-grok-rlwyXPmo.js} +1 -1
- package/dist/ui/index.html +11 -8
- package/dist/ui/packages/webapp/index.html +11 -8
- package/dist/ui/slicc-editor.js +1 -1
- package/package.json +5 -4
- package/dist/ui/assets/adobe-ChXsF6gw.js +0 -2
- package/dist/ui/assets/backend-local-_o3dnerJ.js +0 -12
- package/dist/ui/assets/core-DpOt0gTq.js +0 -95
- package/dist/ui/assets/dist-CMD3ZuiV.js +0 -1
- package/dist/ui/assets/dist-CWHNqkcj.js +0 -1
- package/dist/ui/assets/dist-CrVgSn_b.js +0 -6
- package/dist/ui/assets/dist-DkG8wgj1.js +0 -23
- package/dist/ui/assets/esp8266-1y0C3qJ1.js +0 -1
- package/dist/ui/assets/esptool-operations-CiccBbBW.js +0 -12
- package/dist/ui/assets/fs-BsqtoiKD.js +0 -2
- package/dist/ui/assets/fs-DKRiXKHo.js +0 -1
- package/dist/ui/assets/github-DGUqMidV.js +0 -1
- package/dist/ui/assets/github-DqsEulTB.js +0 -2
- package/dist/ui/assets/github-copilot-DJf8cE1K.js +0 -2
- package/dist/ui/assets/handoff-link-BObMRgsx.js +0 -1
- package/dist/ui/assets/hear-Du8SABf8.js +0 -1
- package/dist/ui/assets/intercepted-oauth-BIKnTjZm.js +0 -1
- package/dist/ui/assets/lick-manager-DsQLFcKr.js +0 -2
- package/dist/ui/assets/lick-ws-bridge-1UPwiSVX.js +0 -1
- package/dist/ui/assets/local-llm-Cjzjpqa1.js +0 -2
- package/dist/ui/assets/logger-DQgFbfwx.js +0 -1
- package/dist/ui/assets/main-BK-7ArIz.js +0 -22
- package/dist/ui/assets/main-cherry-C6fqCnLL.js +0 -1
- package/dist/ui/assets/mount-BrQpW9eO.js +0 -1
- package/dist/ui/assets/mount-index-CD1UKs2l.js +0 -1
- package/dist/ui/assets/mount-picker-popup-C4q1Q3pK.js +0 -1
- package/dist/ui/assets/mount-recovery-Cb-AXW35.js +0 -2
- package/dist/ui/assets/navigation-watcher-DrWMx-B4.js +0 -1
- package/dist/ui/assets/new-session-CF4YpiQ9.js +0 -2
- package/dist/ui/assets/oauth-bootstrap-YFOy1SIX.js +0 -2
- package/dist/ui/assets/oauth-service-DJuzPXsg.js +0 -1
- package/dist/ui/assets/onboarding-orchestrator-Dmh6rOJl.js +0 -1
- package/dist/ui/assets/openai-codex-84EHUcAD.js +0 -1
- package/dist/ui/assets/openai-codex-DY_L0KSA.js +0 -1
- package/dist/ui/assets/openrouter-oauth-CblQ27-K.js +0 -1
- package/dist/ui/assets/openrouter-z7GGvxCM.js +0 -1
- package/dist/ui/assets/panel-rpc-handlers-DmiAyTiy.js +0 -2
- package/dist/ui/assets/picker-approval-D89YhXsA.js +0 -12
- package/dist/ui/assets/provider-BLbTGk-_.js +0 -2
- package/dist/ui/assets/provider-settings-Dq-yRgMh.js +0 -1
- package/dist/ui/assets/provider-store-access-CJdYrcvf.js +0 -1
- package/dist/ui/assets/provider-store-access-NHOQWINx.js +0 -1
- package/dist/ui/assets/providers-B3OPYf2o.js +0 -2
- package/dist/ui/assets/remote-cdp-transport-DeDqT7I4.js +0 -1
- package/dist/ui/assets/secrets-bridge-client-CHZomqvU.js +0 -1
- package/dist/ui/assets/sidecar-repair-Ddcz9Mvv.js +0 -1
- package/dist/ui/assets/slicc-editor-D-eO_pjd.js +0 -23
- package/dist/ui/assets/slicc-editor-Sdfe-_x_.js +0 -1
- package/dist/ui/assets/slicc-version-BrPYMXS9.js +0 -1
- package/dist/ui/assets/state-BSTmV4yO.js +0 -42
- package/dist/ui/assets/sync-dialog-vSEl3KxP.js +0 -1
- package/dist/ui/assets/tool-ui-DRnUkp2g.js +0 -1
- package/dist/ui/assets/tool-ui-DfXu6quJ.js +0 -1
- package/dist/ui/assets/tray-leader-B_FxjW0d.js +0 -1
- package/dist/ui/assets/tray-runtime-config-Bpo7AZhY.js +0 -1
- package/dist/ui/assets/tray-runtime-config-Dv3NVv5v.js +0 -1
- package/dist/ui/assets/tray-sidecar-BIcoXTJN.js +0 -2
- package/dist/ui/assets/voice-reply-O_Z2C0eg.js +0 -1
- package/dist/ui/assets/wc-attach-DM5yRZRS.js +0 -13
- package/dist/ui/assets/wc-extension-Dg5dOqTK.js +0 -2
- package/dist/ui/assets/wc-float-label-Bmp3gmHN.js +0 -1
- package/dist/ui/assets/wc-floatbar-online-B8ug4UwE.js +0 -1
- package/dist/ui/assets/wc-follower-G03aUmAn.js +0 -17
- package/dist/ui/assets/wc-follower-oauth-D15d_vbh.js +0 -5
- package/dist/ui/assets/wc-live-CiwhsK8i.js +0 -399
- package/dist/ui/assets/wc-nav-D8Bi3zRA.js +0 -2
- package/dist/ui/assets/wc-onboarding-DUBWYyMl.js +0 -2
- package/dist/ui/assets/wc-permissions-providers-CET8Rh_M.js +0 -2
- package/dist/ui/assets/wc-transcript-export-DjpmBvLP.js +0 -2
- package/dist/ui/assets/wc-tray-BdgbNPhM.js +0 -5
- package/dist/ui/assets/welcome-detection-0SaDZUV0.js +0 -1
- package/dist/ui/assets/xai-grok-CVEtAfJK.js +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/oauth-service-DJuzPXsg.js","assets/preload-helper-Czpn1I53.js","assets/proxied-fetch-CFWkfPNA.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/base64-DJRlyqZu.js","assets/src-CAWTvdAa.js","assets/runtime-env-Dlaokqg1.js","assets/fetch-body-D2PwksUW.js","assets/api-endpoint-GRCyib6X.js","assets/runtime-env-CgsZ7LTp.js","assets/runtime-env-E-i2SW1s.js","assets/panel-rpc-B3MSVImO.js","assets/permissions-surface-registry-CilCRwhh.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{H as e,Y as t,d as n,y as r}from"./account-store-Bg1KKHOx.js";import{a as i}from"./diagnostics-DN_idNHx.js";import{t as a}from"./preload-helper-Czpn1I53.js";import{c as o,i as s,l as c,n as l,r as u,u as d}from"./claude-model-version-C0HLsjny.js";import{a as f,r as p,s as m,t as h}from"./legacy-api-aliases-7-tLus57.js";import{n as g,t as _}from"./silent-renew-backoff-t_Cd4Zw7.js";import{t as v}from"./panel-rpc-B3MSVImO.js";import"./main-BK-7ArIz.js";import{getOAuthPageOrigin as ee}from"./oauth-service-DJuzPXsg.js";import{n as y}from"./temperature-support-BZ2SNscA.js";import{t as b}from"./llm-session-id-bZQs6gBN.js";var te={proxyEndpoint:`https://adobe-llm-proxy.paolo-moz.workers.dev`,redirectUri:`https://www.sliccy.ai/auth/callback`,extensionRedirectUri:`https://akjjllgokmbgpbdbmafpiefnhidlmbgf.chromiumapp.org/adobe`};function ne(e,t){return l(e,t)}function x(e,t,n){return e!==`xhigh`||!t?e:s(t,n)?`xhigh`:u(t,n)?`max`:`high`}function re(e,t){let n=e?t?.thinkingLevelMap?.[e]:void 0;return x((()=>{if(typeof n==`string`)return n;switch(e){case`minimal`:case`low`:return`low`;case`medium`:return`medium`;case`xhigh`:return`xhigh`;default:return`high`}})(),t?.id,t?.name)}function ie(e,t){return async(n,r)=>{let i=t?await t(n,r)??n:n,a=i.thinking;return a&&a.type===`enabled`&&(i.thinking={type:`adaptive`,...a.display===void 0?{}:{display:a.display}},i.output_config={...i.output_config??{},effort:e}),i}}function S(e,t){if(!ne(e.id,e.name))return t;let n=t,r=x(n.effort??re(n.reasoning,e),e.id,e.name);return{...t,onPayload:ie(r,n.onPayload)}}function ae(e,t){let n={id:e.id,name:e.name??e.id},r=t?.api??e.api,i=t?.context_window??e.context_window,a=t?.max_tokens??e.max_tokens,o=t?.reasoning??e.reasoning,s=t?.input??e.input;r&&(n.api=r),i!==void 0&&(n.context_window=i),a!==void 0&&(n.max_tokens=a),o!==void 0&&(n.reasoning=o),s&&(n.input=s);let c=t?.cost??e.cost;return c&&(n.cost=c),/haiku/i.test(e.id)&&(n.compat={supportsEagerToolInputStreaming:!1}),/sonnet-5\b/i.test(e.id)&&!n.thinkingLevelMap&&(n.thinkingLevelMap={xhigh:`xhigh`}),n}var C=Object.assign({"/packages/webapp/providers/adobe-config.json":te})[`/packages/webapp/providers/adobe-config.json`]??{clientId:``,proxyEndpoint:``,scopes:`openid,profile,email`};function w(){let e=r(`adobe`);if(e)return e.replace(/\/$/,``);if(C.proxyEndpoint)return C.proxyEndpoint.replace(/\/$/,``);throw Error(`Adobe proxy endpoint not configured — set it in Settings or adobe-config.json`)}var T=new Map,E=new Map,D=`slicc-adobe-models`;function O(e){try{localStorage.setItem(D,JSON.stringify(e))}catch{}}async function k(e){let t=T.get(e);if(t)return t;try{let t=await fetch(`${e}/v1/config`,{headers:{[G]:`6.110.2`}});if(t.ok){let n=await t.json();return T.set(e,n),n}console.warn(`[adobe] Proxy /v1/config returned ${t.status}, falling back to build-time config`)}catch(e){console.warn(`[adobe] Failed to fetch proxy config:`,e instanceof Error?e.message:String(e))}return{}}function A(e){let t=e.clientId||C.clientId;if(!t)throw Error(`Could not determine IMS client ID — proxy /v1/config did not return one and adobe-config.json is empty`);return t}function j(e){return e.scopes||C.scopes}function M(e){return e.imsEnvironment||C.imsEnvironment||`prod`}var N={prod:`https://ims-na1.adobelogin.com`,stg1:`https://ims-na1-stg1.adobelogin.com`};function P(e){return N[e??C.imsEnvironment??`prod`]??N.prod}var F=typeof chrome<`u`&&!!chrome?.runtime?.id;function I(){return n().find(e=>e.providerId===`adobe`)}async function oe(e,t){try{let n=await fetch(`${P(t)}/ims/userinfo/v2`,{headers:{Authorization:`Bearer ${e}`}});if(n.ok){let e=await n.json();return{name:e.displayName||e.name||e.email,avatar:e.picture||e.avatar_url}}console.warn(`[adobe] User profile fetch returned ${n.status}, account will have no display name`)}catch(e){console.warn(`[adobe] Failed to fetch user profile:`,e instanceof Error?e.message:String(e))}return{}}function L(e){let t=e.indexOf(`#`);if(t<0)return null;let n=new URLSearchParams(e.slice(t+1)),r=n.get(`access_token`);return r?{accessToken:r,expiresIn:parseInt(n.get(`expires_in`)??`86400`,10),scope:n.get(`scope`)??void 0}:null}var R={id:`adobe`,name:`Adobe`,description:`Claude via Adobe — login with your Adobe ID`,requiresApiKey:!1,requiresBaseUrl:!C.proxyEndpoint,baseUrlPlaceholder:`https://your-proxy.example.com`,baseUrlDescription:`Anthropic-compatible proxy endpoint`,isOAuth:!0,defaultModelId:`sonnet`,oauthTokenDomains:[`ims-na1.adobelogin.com`,`ims-na1-stg1.adobelogin.com`,`*.adobelogin.com`,`*.adobe.io`,`firefall.adobe.io`,`admin.hlx.page`,`admin.hlx.live`,`admin.aem.page`,`admin.aem.live`],getModelIds:()=>{let e=e=>ae(e,E.get(e.id));for(let t of Q.values())if(t.length){let n=t.map(t=>e({id:t.id,name:t.name??t.id,reasoning:t.reasoning,input:t.input,cost:t.cost}));return O(n),n}for(let t of T.values())if(t.models?.length)return t.models.map(t=>e(t));try{let e=localStorage.getItem(D);if(e){let t=JSON.parse(e);if(t.length)return t}}catch{}return[{id:`claude-sonnet-4-6`,name:`Claude Sonnet 4.6`}]},onOAuthLogin:async(t,n,r)=>{let i=w(),a=await k(i),o=A(a),s=j(a),c=M(a),l=F?null:await ee(),u=F?null:g({pageHref:l.href,pageOrigin:l.origin,configuredRedirectUri:C.redirectUri},()=>crypto.randomUUID()),d=F?C.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:u.redirectUri,f=u?.oauthState,p=u?.expectedNonce??null,m=new URLSearchParams({client_id:o,scope:s,response_type:`token`,redirect_uri:d});f&&m.set(`state`,f),r?.forceReauth&&m.set(`prompt`,`login`);let h=await t(`${P(c)}/ims/authorize/v2?${m}`);if(!h)return;if(p&&h)try{if(new URL(h).searchParams.get(`nonce`)!==p){console.error(`[adobe] OAuth nonce mismatch — possible CSRF`);return}}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}let _=L(h);if(!_){console.error(`[adobe] Could not extract token from redirect URL`);return}let v=await oe(_.accessToken,c);await e({providerId:`adobe`,accessToken:_.accessToken,tokenExpiresAt:Date.now()+_.expiresIn*1e3,userName:v.name,userAvatar:v.avatar,scopes:_.scope,baseUrl:C.proxyEndpoint?void 0:i}),await $().catch(e=>console.warn(`[adobe] Failed to fetch models after login:`,e instanceof Error?e.message:String(e))),n()},onOAuthLogout:async()=>{let t=I();if(t?.accessToken)try{let e=T.values().next().value??{},n=e.clientId||C.clientId,r=M(e);if(n){let e=await fetch(`${P(r)}/ims/revoke`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({token:t.accessToken,token_type_hint:`access_token`,client_id:n})});e.ok||console.warn(`[adobe] Token revocation returned ${e.status}, token may still be valid server-side`)}}catch(e){console.warn(`[adobe] Failed to revoke token:`,e instanceof Error?e.message:String(e))}await e({providerId:`adobe`,accessToken:``})},onSilentRenew:async()=>I()?.accessToken?V():null,refreshModels:async e=>{await $(e);let t=R.getModelIds?.();t?.length&&O(t)}},z=null,se=_();async function B(){let e=I();if(!e?.accessToken)throw Error(`Not logged in to Adobe — please log in first`);if((e.tokenExpiresAt??0)-Date.now()>6e4)return e.accessToken;console.log(`[adobe] Token expired or expiring soon, attempting silent renewal...`);let t=await se.run(()=>V());if(t)return t;let n=I();if((n?.tokenExpiresAt??0)-Date.now()>0&&n?.accessToken)return n.accessToken;throw Error(`Adobe session expired — please log in again`)}function ce(){let e=I();return!e?.tokenExpiresAt||Date.now()>e.tokenExpiresAt-6e4}async function V(){if(typeof window>`u`){let e=v();if(!e)return null;try{let{accessToken:t}=await e.call(`silent-renew`,{providerId:`adobe`},{timeoutMs:13e4});return t}catch(e){return console.warn(`[adobe] worker→page silent-renew bridge failed:`,e instanceof Error?e.message:String(e)),null}}return z||(z=le().finally(()=>{z=null}),z)}function H(e,t){let n=A(t),r=j(t),i=M(t),a=F?null:g({pageHref:window.location.href,pageOrigin:window.location.origin,configuredRedirectUri:C.redirectUri},()=>crypto.randomUUID()),o=F?C.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:a.redirectUri,s=a?.oauthState,c=a?.expectedNonce??null,l=new URLSearchParams({client_id:n,scope:r,response_type:`token`,redirect_uri:o,prompt:`none`});return s&&l.set(`state`,s),{authorizeUrl:`${P(i)}/ims/authorize/v2?${l}`,expectedNonce:c,proxyEndpoint:e}}function U(e,t){if(!t)return!0;try{if(new URL(e).searchParams.get(`nonce`)!==t)return console.error(`[adobe] OAuth nonce mismatch — possible CSRF`),!1}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}return!0}async function W(t,n){let r=I();await e({providerId:`adobe`,accessToken:t.accessToken,tokenExpiresAt:Date.now()+t.expiresIn*1e3,userName:r?.userName,userAvatar:r?.userAvatar,scopes:t.scope,baseUrl:C.proxyEndpoint?void 0:n})}async function le(){try{let e=w(),{authorizeUrl:t,expectedNonce:n}=H(e,await k(e)),{createOAuthLauncher:r}=await a(async()=>{let{createOAuthLauncher:e}=await import(`./oauth-service-DJuzPXsg.js`);return{createOAuthLauncher:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])),i=await r()(t,{interactive:!1});if(!i||!U(i,n))return null;let o=L(i);return o?(await W(o,e),console.log(`[adobe] Token renewed silently`),await $().catch(e=>console.warn(`[adobe] Failed to refresh models after silent renewal:`,e instanceof Error?e.message:String(e))),o.accessToken):null}catch(e){return console.warn(`[adobe] Silent renewal error:`,e instanceof Error?e.message:String(e)),null}}var G=`X-Slicc-Version`;function K(e){let t={},n=G.toLowerCase();if(e.headers)for(let[r,i]of Object.entries(e.headers))r.toLowerCase()!==n&&(t[r]=i);return t[G]=`6.110.2`,{...e,headers:t}}var ue=`adobe-provider-fallback`,q=new Set;function J(e,t){if(e.headers){for(let[t,n]of Object.entries(e.headers))if(t.toLowerCase()===`x-session-id`&&n!=null)return e}return q.has(t)||(q.add(t),console.warn(`[adobe] Missing X-Session-Id from ${t} — using daily fallback. Attach an X-Session-Id header at the call site (see scoop-context.ts streamWithSessionId or docs/pitfalls.md).`)),{...e,headers:{...e.headers??{},"X-Session-Id":b(ue)}}}function de(){q.clear()}function Y(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:`adobe-anthropic`,provider:`adobe`,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}var X=(e,t,n={})=>{let r=i();return(async()=>{try{let i=await B();if(String(e.api).includes(`openai`)){let a={...e,baseUrl:`${w()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=p(a,t,K(J({...n,apiKey:i},`streamAdobe[openai]`)));for await(let e of o)r.push(e)}else{let a={...e,baseUrl:w(),api:`anthropic-messages`},o=h(a,t,K(J(S(e,y(e.id,e.name,{...n,apiKey:i})),`streamAdobe[anthropic]`)));for await(let e of o)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(Y(e,t)),r.end()}})(),r},Z=(e,t,n)=>{let r=i();return(async()=>{try{let i=await B();if(String(e.api).includes(`openai`)){let a={...e,baseUrl:`${w()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=m(a,t,K(J({...n,apiKey:i},`streamSimpleAdobe[openai]`)));for await(let e of o)r.push(e)}else{let a={...e,baseUrl:w(),api:`anthropic-messages`},o=f(a,t,K(J(S(e,y(e.id,e.name,{...n,apiKey:i})),`streamSimpleAdobe[anthropic]`)));for await(let e of o)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(Y(e,t)),r.end()}})(),r};function fe(e){let t={id:e.id,name:e.name};return e.api!==void 0&&(t.api=e.api),e.context_window!==void 0&&(t.context_window=e.context_window),e.max_tokens!==void 0&&(t.max_tokens=e.max_tokens),e.reasoning!==void 0&&(t.reasoning=e.reasoning),e.input!==void 0&&(t.input=e.input),t}function pe(){let e=new Map;for(let t of c())try{for(let n of o(t))e.set(n.id,n)}catch{}return e}function me(e,n,r){let i=`adobe-${e.api===`openai`?`openai`:`anthropic`}`,a=r.get(e.id);if(a)return{...a,provider:`adobe`,api:i};let o=t(e.id,r);return{id:e.id,name:e.name??e.id,provider:`adobe`,api:i,baseUrl:n,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:o,inputCost:o.input,outputCost:o.output,cacheReadCost:o.cacheRead,cacheWriteCost:o.cacheWrite,reasoning:!0}}function he(e,t){for(let t of e)E.set(t.id,fe(t));let n=pe();return e.map(e=>me(e,t,n))}async function ge(e){try{let t=e??await B(),n=w(),r=await fetch(`${n}/v1/models`,{headers:{Authorization:`Bearer ${t}`,[G]:`6.110.2`}});if(!r.ok)console.warn(`[adobe] Proxy /v1/models returned ${r.status}, falling back to Anthropic models`);else{let e=await r.json();if(e.data?.length)return he(e.data,n)}}catch(e){console.warn(`[adobe] Failed to fetch proxy models:`,e instanceof Error?e.message:String(e))}return null}var Q=new Map;function _e(){return o(`anthropic`).map(e=>({...e,provider:`adobe`,api:`adobe-anthropic`}))}async function $(e){let t=w(),n=Q.get(t);if(n)return n;let r=await ge(e);return r?(Q.set(t,r),r):_e()}function ve(){d({api:`adobe-anthropic`,stream:X,streamSimple:Z}),d({api:`adobe-openai`,stream:X,streamSimple:Z})}export{de as __resetAdobeSessionIdWarningCacheForTests,R as config,L as extractTokenFromUrl,$ as getAdobeModels,B as getValidAccessToken,ce as isTokenExpired,ve as register};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./logger-LESFN7Hj.js";import{t}from"./runtime-env-DadgceZk.js";import"./runtime-env-Dtj99aNH.js";import{i as n,n as r}from"./tool-ui-DRnUkp2g.js";import{t as i}from"./html-B_Hg2WOy.js";import{t as a}from"./types-idfTVsM8.js";const o=Symbol(`picker-approval-timeout`),s={directory:{title:`Mount local directory`,approve:`Select directory`},"usb-device":{title:`Connect USB device`,approve:`Select USB device`},"serial-port":{title:`Connect serial port`,approve:`Select serial port`},"hid-device":{title:`Connect HID device`,approve:`Select HID device`}};function c(e,t=[],n){let r=s[e],a=t.length?` data-action-data='${JSON.stringify({filters:t}).replace(/'/g,`'`)}'`:``,o=e===`directory`&&n?`<div class="sprinkle-action-card__meta">Target: ${i(n)}</div>`:``;return`
|
|
2
|
-
<div class="sprinkle-action-card">
|
|
3
|
-
<div class="sprinkle-action-card__header">
|
|
4
|
-
<div class="sprinkle-action-card__title-group">${r.title}${o}</div>
|
|
5
|
-
<span class="sprinkle-badge sprinkle-badge--notice">approval</span>
|
|
6
|
-
</div>
|
|
7
|
-
<div class="sprinkle-action-card__actions">
|
|
8
|
-
<button class="sprinkle-btn sprinkle-btn--secondary" data-action="deny">Deny</button>
|
|
9
|
-
<button class="sprinkle-btn sprinkle-btn--primary" data-action="approve" data-picker="${e}"${a}>${r.approve}</button>
|
|
10
|
-
</div>
|
|
11
|
-
</div>
|
|
12
|
-
`}async function l(e,t,i){let a=n.generateId(),s=!1,l=r({id:a,html:c(e,t),onAction:async(e,t)=>{if(e!==`approve`)return{denied:!0};let n=t;return n?.cancelled?{cancelled:!0}:n?.error?{error:String(n.error)}:n?.granted&&typeof n.handle==`string`?{approved:!0,handle:n.handle,info:n.info??null}:n?.granted&&n?.info?{approved:!0,info:n.info}:{error:`picker returned an unexpected response`}}},i.onUpdate).catch(e=>{if(s)return o;throw e}),u,d=new Promise(t=>{u=setTimeout(()=>{s=!0,n.cancel(a,`${e}: timed out`),t(o)},12e4)}),f=await Promise.race([l,d]);if(u&&clearTimeout(u),f===o)throw Error(`${e}: timed out after 120s waiting for user approval`);let p=f;if(p.denied)throw Error(`${e}: denied by user`);if(p.cancelled)throw Error(`${e}: cancelled`);if(p.error)throw Error(`${e}: ${p.error}`);if(!p.approved||!p.info)throw Error(`${e}: no device selected`);return{handle:p.handle??``,info:p.info}}const u=(()=>{try{return console}catch{return}})(),d={directory:{width:320,height:120},"usb-device":{width:320,height:120},"serial-port":{width:320,height:120},"hid-device":{width:320,height:120}};function f(){return globalThis.chrome??null}function p(){let e=f();return t()&&typeof e?.windows?.create==`function`}async function m(e,t=[],n=`picker-${Date.now()}-${Math.random().toString(36).slice(2)}`,r={}){let i=f();if(!i?.runtime?.onMessage||!i.windows?.create)throw Error(`picker popup: chrome.windows.create not available`);let a=i.runtime.onMessage,o=i.windows.onRemoved,s=i.runtime.getURL?.bind(i.runtime),c=d[e],l=encodeURIComponent(JSON.stringify(t??[])),p=`kind=${encodeURIComponent(e)}&requestId=${encodeURIComponent(n)}&filters=${l}`,m=s?`${s(`picker-popup.html`)}?${p}`:`picker-popup.html?${p}`;return new Promise(t=>{let s=!1,l,d,f=()=>{try{a.removeListener(h)}catch{}if(o&&g)try{o.removeListener(g)}catch{}l!==void 0&&clearTimeout(l)},p=e=>{s||(s=!0,f(),t(e))},h=t=>{if(s)return;let r=t;if(r?.source!==`picker-popup`||r.kind!==e||r.requestId!==n)return;let{source:i,kind:a,requestId:o,...c}=r;p(c)};a.addListener(h);let g=o?e=>{d!==void 0&&e===d&&p({cancelled:!0})}:void 0;o&&g&&o.addListener(g),r.timeoutMs&&r.timeoutMs>0&&(l=setTimeout(()=>p({cancelled:!0}),r.timeoutMs)),i.windows.create({url:m,type:`popup`,width:c.width,height:c.height,focused:!0}).then(e=>{if(!e?.id){p({error:`failed to open picker window`});return}d=e.id}).catch(e=>{u?.warn?.(`picker popup window.create failed`,e),p({error:e instanceof Error?e.message:String(e)})})})}const h=e(`mount-picker-popup`),g=6e4;function _(e){let t=e??`mount-${Date.now().toString(36)}`;return new Promise(e=>{let n=!1,r=t=>{n||(n=!0,clearTimeout(i),e(t))},i=setTimeout(()=>r({cancelled:!0}),g);m(`directory`,[],t,{timeoutMs:g}).then(e=>{let n=e;if(n.error){h.error(`picker popup launch failed for directory kind`,{requestId:t,error:n.error}),r({error:`Failed to open directory picker window`});return}r(n)}).catch(e=>{h.error(`picker popup launch threw for directory kind`,{requestId:t,error:e instanceof Error?e.message:String(e),name:e instanceof Error?e.name:void 0}),r({error:`Failed to open directory picker window`})})})}async function v(e){let t=await new Promise((e,t)=>{let n=indexedDB.open(`slicc-pending-mount`,1);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains(`handles`)||n.result.createObjectStore(`handles`)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)}),n=t.transaction(`handles`,`readwrite`),r=n.objectStore(`handles`),i=r.get(e),a=r.delete(e);a.onerror=()=>{h.warn(`Failed to delete pending handle from IDB`,{idbKey:e,error:a.error})};let o=await new Promise((e,t)=>{n.oncomplete=()=>e(i.result??null),i.onerror=()=>t(i.error??Error(`IDB get failed`)),n.onerror=()=>t(n.error??Error(`IDB transaction failed`)),n.onabort=()=>t(n.error??Error(`IDB transaction aborted`))});return t.close(),o}async function y(e){let t=e;if(t.requestPermission){let n=await t.requestPermission({mode:`readwrite`});if(n!==`granted`)throw Error(`Permission denied for "${e.name}" (${n})`)}}const b=Symbol(`mount:timeout`),x=Symbol(`mount:no-panel`);var S=class e{kind=`local`;source=void 0;profile=void 0;mountId;handle;closed=!1;constructor(e,t){this.handle=e,this.mountId=t.mountId}static fromHandle(t,n){return new e(t,n)}static async create(t){if(t.isScoop())throw Error(`mount: cannot mount local directories from a scoop (no UI). Ask the cone.`);let n;return n=t.toolContext?await e.acquireHandleViaToolUI(t.toolContext,t.targetPath):t.isExtension?await e.acquireHandleViaPopup():await e.acquireHandleViaDirectPicker(),new e(n,{mountId:t.mountId})}static async acquireHandleViaPopup(){try{let e=await _();if(e.cancelled)throw Error(`mount: cancelled`);if(e.error)throw Error(`mount: ${e.error}`);if(e.handleInIdb&&typeof e.idbKey==`string`){let t=await v(e.idbKey);if(!t)throw Error(`mount: no directory handle found in storage`);return await y(t),t}throw Error(`mount: unexpected popup result`)}catch(e){throw Error(`mount: ${e instanceof Error?e.message:String(e)}`)}}static async acquireHandleViaDirectPicker(){if(typeof window>`u`||!(`showDirectoryPicker`in window))throw Error(`mount: local picker requires a user gesture in the panel (unavailable in this runtime). Ask the agent to mount it instead.`);try{return await window.showDirectoryPicker({mode:`readwrite`})}catch(e){throw e instanceof Error&&e.name===`AbortError`?Error(`mount: cancelled`):Error(`mount: ${e instanceof Error?e.message:String(e)}`)}}static async acquireHandleViaToolUI(t,i){let a=n.generateId(),o=!1,s=!1,l=r({id:a,html:c(`directory`,[],i),onAction:(t,n)=>e.resolveApprovalAction(t,n)},t.onUpdate).catch(e=>{if(o)return b;if(s)return x;throw e}),u,d=new Promise(e=>{u=setTimeout(()=>{o=!0,n.cancel(a,`mount: timed out`),e(b)},3e5)}),f=new Promise(e=>{n.waitForMount(a,5e3).then(()=>{},()=>{o||(s=!0,n.cancel(a,`mount: panel did not render the approval card`),e(x))})}),p=await Promise.race([l,d,f]);if(u&&clearTimeout(u),p===b)throw Error(`mount: timed out after 5 minute(s) waiting for user approval`);if(p===x)throw Error(`mount: chat panel did not render the approval card — open the chat panel and retry`);if(!p)throw Error(`mount: tool UI not available`);let m=p;if(m.denied)throw Error(`mount: denied by user`);if(m.cancelled)throw Error(`mount: cancelled`);if(m.error)throw Error(`mount: ${m.error}`);if(!m.handle)throw Error(`mount: no directory selected`);return m.handle}static async resolveApprovalAction(e,t){if(e!==`approve`)return{denied:!0};let n=t;if(n?.handleInIdb&&typeof n.idbKey==`string`)try{let e=await v(n.idbKey);return e?(await y(e),{approved:!0,handle:e}):{error:`No directory handle found in storage`}}catch(e){return{error:e instanceof Error?e.message:String(e)}}if(n?.cancelled)return{cancelled:!0};if(n?.error)return{error:String(n.error)};try{return{approved:!0,handle:await window.showDirectoryPicker({mode:`readwrite`})}}catch(e){return e instanceof Error&&e.name===`AbortError`?{cancelled:!0}:{error:e instanceof Error?e.message:String(e)}}}getHandle(){return this.handle}assertOpen(e){if(this.closed)throw new a(`EBADF`,`mount closed`,e)}splitPath(e){return e.replace(/^\/+/,``).replace(/\/+$/,``).split(`/`).filter(e=>e.length>0)}async resolveDir(e,t=!1){let n=this.splitPath(e),r=this.handle;for(let i of n)try{r=await r.getDirectoryHandle(i,{create:t})}catch(t){throw this.toFsError(t,e)}return r}async resolveFile(e,t=!1){let n=this.splitPath(e);if(n.length===0)throw new a(`EISDIR`,`is a directory`,e);let r=n.pop(),i=this.handle;for(let r of n)try{i=await i.getDirectoryHandle(r,{create:t})}catch(t){throw this.toFsError(t,e)}try{return await i.getFileHandle(r,{create:t})}catch(t){throw this.toFsError(t,e)}}toFsError(e,t){if(e instanceof a)return e;if(e instanceof DOMException){if(e.name===`NotFoundError`)return new a(`ENOENT`,`no such file or directory`,t);if(e.name===`TypeMismatchError`)return new a(`ENOTDIR`,`not a directory`,t);if(e.name===`NotAllowedError`)return new a(`EACCES`,`permission denied`,t);if(e.name===`InvalidModificationError`)return new a(`ENOTEMPTY`,`directory not empty`,t)}if(e instanceof Error){if(e.name===`NotFound`||e.name===`NotFoundError`)return new a(`ENOENT`,`no such file or directory`,t);if(e.name===`TypeMismatch`||e.name===`TypeMismatchError`)return new a(`ENOTDIR`,`not a directory`,t);if(e.name===`InvalidModification`||e.name===`InvalidModificationError`)return new a(`ENOTEMPTY`,`directory not empty`,t)}return new a(`EINVAL`,e instanceof Error?e.message:String(e),t)}async readDir(e){this.assertOpen(e);let t=await this.resolveDir(e),n=[];for await(let[e,r]of t)if(r.kind===`file`){let t=await r.getFile();n.push({name:e,kind:`file`,size:t.size,lastModified:t.lastModified})}else n.push({name:e,kind:`directory`});return n}async readFile(e){this.assertOpen(e);let t=await(await this.resolveFile(e)).getFile();return new Uint8Array(await t.arrayBuffer())}async writeFile(e,t){this.assertOpen(e);let n=await(await this.resolveFile(e,!0)).createWritable();await n.write(t),await n.close()}async stat(e){if(this.assertOpen(e),this.splitPath(e).length===0)return{kind:`directory`,size:0,mtime:0};try{let t=await(await this.resolveFile(e)).getFile();return{kind:`file`,size:t.size,mtime:t.lastModified}}catch{}return await this.resolveDir(e),{kind:`directory`,size:0,mtime:0}}async mkdir(e){this.assertOpen(e),await this.resolveDir(e,!0)}async remove(e,t){this.assertOpen(e);let n=this.splitPath(e);if(n.length===0)throw new a(`EINVAL`,`cannot remove mount root`,e);let r=n.pop(),i=n.join(`/`),o=await this.resolveDir(i||`/`);try{await o.removeEntry(r,{recursive:t?.recursive??!1})}catch(t){throw this.toFsError(t,e)}}async refresh(){return this.assertOpen(`/`),{added:[],removed:[],changed:[],unchanged:0,errors:[]}}describe(){return{displayName:this.handle.name}}async close(){this.closed=!0}};export{m as a,p as i,v as n,l as o,y as r,S as t};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{t as n}from"./logger-LESFN7Hj.js";import{r,t as i}from"./base64-DzRgusa4.js";import"./src-CcFD5QfS.js";import"./proxied-fetch-BduXImRw.js";import{t as a}from"./runtime-env-DadgceZk.js";import{i as o,n as s,t as c}from"./api-endpoint-C00IT5T9.js";import{t as l}from"./compat-Dujkqs4W.js";import"./libesm-CSMdpGMF.js";import"./runtime-env-Dtj99aNH.js";import{t as u}from"./port-bridge-client-D5ndzGCE.js";import{r as d,t as f}from"./image-markers-D3wDAnBQ.js";import{o as p,s as m}from"./tool-ui-DRnUkp2g.js";const h={assign:0,create:0,clone:0,discard:0,update:0};function g(e,t){return h.assign+=1,{...e,...t}}function _(e,t,n){return e>=t&&e<=n}function v(e){return e===8205}function y(e){return _(e,55296,56319)}function ee(e){return _(e,127462,127487)}function te(e){return _(e,65024,65039)}function ne(e){return _(e,768,879)||_(e,6832,6911)||_(e,7616,7679)||_(e,65056,65071)}function re(e){return e>65535?2:1}function ie(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(ne(n)||te(n))t+=re(n);else break}return t}function ae(e,t){let n=e.codePointAt(t),r=t+re(n);for(r=ie(e,r);r<e.length-1&&e[r]===``;){let t=e.codePointAt(r+1);r+=1+re(t),r=ie(e,r)}return ee(n)&&r<e.length&&ee(e.codePointAt(r))&&(r+=re(e.codePointAt(r))),r}function oe(e){return y(e)||ne(e)||te(e)||v(e)}function se(e){let t=0,n=0;for(;n<e.length;)n=ae(e,n),t++;return t}function ce(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=ae(e,r),n++,n>=t)return!0;return!1}function le(e,t){let n=0,r=0;for(;r<e.length;)if(r=ae(e,r),n++,n>t)return!1;return!0}function ue(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(oe(e.charCodeAt(n)))return ce(e,t);if(n++,n>=t)return!0}return!1}function de(e,t){let n=0;for(;n<e.length;){if(oe(e.charCodeAt(n)))return le(e,t);if(n++,n>t)return!1}return!0}var fe=e({Entries:()=>ze,EntriesRegExp:()=>Re,Every:()=>Fe,EveryAll:()=>Ie,GraphemeCount:()=>Me,HasPropertyKey:()=>C,IsArray:()=>pe,IsBigInt:()=>me,IsBoolean:()=>he,IsClassInstance:()=>Ae,IsConstructor:()=>ge,IsDeepEqual:()=>We,IsEqual:()=>x,IsFunction:()=>_e,IsGreaterEqualThan:()=>Oe,IsGreaterThan:()=>Te,IsInteger:()=>ve,IsLessEqualThan:()=>De,IsLessThan:()=>Ee,IsMaxLength:()=>Ne,IsMinLength:()=>Pe,IsMultipleOf:()=>ke,IsNull:()=>ye,IsNumber:()=>be,IsObject:()=>b,IsObjectNotArray:()=>xe,IsString:()=>Se,IsSymbol:()=>Ce,IsUndefined:()=>we,IsUnsafePropertyKey:()=>Le,IsValueLike:()=>je,Keys:()=>w,ShiftLeft:()=>S,Symbols:()=>Be,Values:()=>Ve});function pe(e){return Array.isArray(e)}function me(e){return x(typeof e,`bigint`)}function he(e){return x(typeof e,`boolean`)}function ge(e){if(we(e)||!_e(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function _e(e){return x(typeof e,`function`)}function ve(e){return Number.isInteger(e)}function ye(e){return x(e,null)}function be(e){return Number.isFinite(e)}function xe(e){return b(e)&&!pe(e)}function b(e){return x(typeof e,`object`)&&!ye(e)}function Se(e){return x(typeof e,`string`)}function Ce(e){return x(typeof e,`symbol`)}function we(e){return x(e,void 0)}function x(e,t){return e===t}function Te(e,t){return e>t}function Ee(e,t){return e<t}function De(e,t){return e<=t}function Oe(e,t){return e>=t}function ke(e,t){if(me(e)||me(t))return BigInt(e)%BigInt(t)===0n;if(!be(e)||ve(e)&&1/t%1==0)return!0;let n=e%t;return Math.min(Math.abs(n),Math.abs(n-t),Math.abs(n+t))<1e-10}function Ae(e){if(!b(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return!ye(t)&&x(typeof t.constructor,`function`)&&!(x(t.constructor,globalThis.Object)||x(t.constructor.name,`Object`))}function je(e){return me(e)||he(e)||ye(e)||be(e)||Se(e)||we(e)}function Me(e){return se(e)}function Ne(e,t){return de(e,t)}function Pe(e,t){return ue(e,t)}function Fe(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function Ie(e,t,n){let r=!0;for(let i=t;i<e.length;i++)n(e[i],i)||(r=!1);return r}function S(e,t,n){return x(e.length,0)?n():t(e[0],e.slice(1))}function Le(e){return x(e,`__proto__`)||x(e,`constructor`)||x(e,`prototype`)}function C(e,t){return Le(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function Re(e){return w(e).map(t=>[RegExp(`^${t}$`),e[t]])}function ze(e){return Object.entries(e)}function w(e){return Object.getOwnPropertyNames(e)}function Be(e){return Object.getOwnPropertySymbols(e)}function Ve(e){return Object.values(e)}function He(e,t){if(!b(t))return!1;let n=w(e);return x(n.length,w(t).length)&&n.every(n=>We(e[n],t[n]))}function Ue(e,t){return pe(t)&&x(e.length,t.length)&&e.every((n,r)=>We(e[r],t[r]))}function We(e,t){return pe(e)?Ue(e,t):b(e)?He(e,t):x(e,t)}function Ge(e){return e instanceof Boolean}function Ke(e){return e instanceof Number}function qe(e){return e instanceof String}function Je(e){return globalThis.ArrayBuffer.isView(e)}function Ye(e){return e instanceof globalThis.RegExp}function Xe(e){return e instanceof globalThis.Date}function Ze(e){return e instanceof globalThis.Set}function Qe(e){return e instanceof globalThis.Map}function $e(e){return e}function et(e){return C(e,`~kind`)||C(e,`~unsafe`)}function tt(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let e of Object.keys(n)){if(Le(e))continue;let r=n[e];C(r,`value`)&&Object.defineProperty(t,e,{...r,value:lt(r.value)})}return t}function nt(e){let t={};for(let n of w(e))Le(n)||(t[n]=lt(e[n]));for(let n of Be(e))t[n]=lt(e[n]);return t}function rt(e){return Ae(e)?$e(e):et(e)?tt(e):nt(e)}function it(e){return e.map(e=>lt(e))}function at(e){return e.slice()}function ot(e){return new RegExp(e.source,e.flags)}function st(e){return new Map(lt([...e.entries()]))}function ct(e){return new Set(lt([...e.values()]))}function lt(e){return Je(e)?at(e):Ye(e)?ot(e):Qe(e)?st(e):Ze(e)?ct(e):pe(e)?it(e):b(e)?rt(e):e}function ut(e){return h.clone+=1,lt(e)}const dt={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function ft(){return dt}function pt(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function mt(e,t){return{...e,...t}}function T(e,t,n={}){h.create+=1;let r=ft(),i=mt(t,n),a=r.enumerableKind?mt(i,e):pt(i,e);return r.immutableTypes?Object.freeze(a):a}function ht(e,t){h.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(ut(e)),i=new Set(t);for(let e of Object.keys(r))i.has(e)||Object.defineProperty(n,e,r[e]);return n}function E(e,t,n){h.update+=1;let r=ft(),i=ut(e);for(let e of Object.keys(t))Object.defineProperty(i,e,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[e]});for(let e of Object.keys(n))Object.defineProperty(i,e,{configurable:!0,enumerable:!0,writable:!0,value:n[e]});return i}function D(e,t){return b(e)&&C(e,`~kind`)&&x(e[`~kind`],t)}function gt(e){return b(e)}function O(e,t,n){return T({"~kind":`Deferred`},{type:`deferred`,action:e,parameters:t,options:n},{})}function _t(e){return D(e,`Deferred`)}function vt(e){return E(e,{"~readonly":!0},{})}function yt(e,t){return E(vt(e),{},t)}function bt(e,t,n,r){return yt(J(e,t,n),r)}function xt(e){return E(e,{"~optional":!0},{})}function St(e,t){return E(xt(e),{},t)}function Ct(e,t,n,r){return St(J(e,t,n),r)}function wt(e,t){return T({"~kind":`Array`},{type:`array`,items:e},t)}function k(e){return D(e,`Array`)}function Tt(e){return ht(e,[`~kind`,`type`,`items`])}function Et(e,t,n={}){return T({"~kind":`Constructor`},{type:`constructor`,parameters:e,instanceType:t},n)}function Dt(e){return D(e,`Constructor`)}function Ot(e){return ht(e,[`~kind`,`type`,`parameters`,`instanceType`])}function kt(e,t,n={}){return T({"~kind":`Function`},{type:`function`,parameters:e,returnType:t},n)}function At(e){return D(e,`Function`)}function jt(e){return ht(e,[`~kind`,`type`,`parameters`,`returnType`])}function Mt(e,t){return T({"~kind":`Ref`},{$ref:e},t)}function Nt(e){return D(e,`Ref`)}function Pt(e,t){return T({"~kind":`Generic`},{type:`generic`,parameters:e,expression:t})}function Ft(e){return D(e,`Generic`)}function It(e){return T({"~kind":`Any`},{},e)}function Lt(e){return D(e,`Any`)}function A(e){return T({"~kind":`Never`},{not:{}},e)}function Rt(e){return D(e,`Never`)}function zt(e,t={}){return St(e,t)}function Bt(e){return zt(e)}function Vt(e){return gt(e)&&C(e,`~optional`)}function Ht(e){return w(e).filter(t=>!Vt(e[t]))}function Ut(e){return w(e)}function Wt(e){return Ve(e)}function j(e,t={}){let n=Ht(e);return T({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}function M(e){return D(e,`Object`)}function Gt(e){return ht(e,[`~kind`,`type`,`properties`,`required`])}function Kt(e){return T({"~kind":`Unknown`},{},e)}function qt(e){return D(e,`Unknown`)}function Jt(e,t,n){return T({"~kind":`Cyclic`},{$defs:w(e).reduce((t,n)=>({...t,[n]:E(e[n],{},{$id:n})}),{}),$ref:t},n)}function Yt(e){return D(e,`Cyclic`)}function Xt(e){return xe(e)&&C(e,`~unsafe`)&&ye(e[`~unsafe`])}function Zt(e){return D(e,`Infer`)}function Qt(e,t,n,r={}){return T({"~kind":`Dependent`},{if:e,then:t,else:n},r)}function $t(e){return D(e,`Dependent`)}function en(e){return ht(e,[`~kind`,`if`,`then`,`else`])}function tn(e){return D(e,`Enum`)}function nn(e,t={}){return T({"~kind":`Intersect`},{allOf:e},t)}function N(e){return D(e,`Intersect`)}function rn(e){return ht(e,[`~kind`,`allOf`])}function an(){throw Error(`Unreachable`)}var on=e({Hash:()=>Nn,HashCode:()=>Mn});function sn(e){let t=new Set,n=e;for(;n&&n!==Object.prototype;){for(let e of Reflect.ownKeys(n))e!==`constructor`&&typeof e!=`symbol`&&t.add(e);n=Object.getPrototypeOf(n)}return[...t]}function cn(e){return typeof e==`number`}var P;(function(e){e[e.Array=0]=`Array`,e[e.BigInt=1]=`BigInt`,e[e.Boolean=2]=`Boolean`,e[e.Date=3]=`Date`,e[e.Constructor=4]=`Constructor`,e[e.Function=5]=`Function`,e[e.Null=6]=`Null`,e[e.Number=7]=`Number`,e[e.Object=8]=`Object`,e[e.RegExp=9]=`RegExp`,e[e.String=10]=`String`,e[e.Symbol=11]=`Symbol`,e[e.TypeArray=12]=`TypeArray`,e[e.Undefined=13]=`Undefined`})(P||={});let ln=BigInt(`14695981039346656037`);const[un,dn]=[BigInt(`1099511628211`),BigInt(`18446744073709551616`)],fn=Array.from({length:256}).map((e,t)=>BigInt(t)),pn=new Float64Array(1),mn=new DataView(pn.buffer),hn=new Uint8Array(pn.buffer);function F(e){ln^=fn[e],ln=ln*un%dn}function gn(e){F(P.Array);for(let t of e)jn(t)}function _n(e){F(P.BigInt),mn.setBigInt64(0,e);for(let e of hn)F(e)}function vn(e){F(P.Boolean),F(+!!e)}function yn(e){F(P.Constructor),jn(e.toString())}function bn(e){F(P.Date),jn(e.getTime())}function xn(e){F(P.Function),jn(e.toString())}function Sn(e){F(P.Null)}function Cn(e){F(P.Number),mn.setFloat64(0,e,!0);for(let e of hn)F(e)}function wn(e){F(P.Object);for(let t of sn(e).sort())jn(t),jn(e[t])}function Tn(e){F(P.RegExp),Dn(e.toString())}const En=new TextEncoder;function Dn(e){F(P.String);for(let t of En.encode(e))F(t)}function On(e){F(P.Symbol),jn(e.toString())}function kn(e){F(P.TypeArray);let t=new Uint8Array(e.buffer);for(let e=0;e<t.length;e++)F(t[e])}function An(e){return F(P.Undefined)}function jn(e){return Je(e)?kn(e):Xe(e)?bn(e):Ye(e)?Tn(e):Ge(e)?vn(e.valueOf()):qe(e)?Dn(e.valueOf()):Ke(e)?Cn(e.valueOf()):cn(e)?Cn(e):pe(e)?gn(e):he(e)?vn(e):me(e)?_n(e):ge(e)?yn(e):ye(e)?Sn(e):b(e)?wn(e):Se(e)?Dn(e):Ce(e)?On(e):we(e)?An(e):_e(e)?xn(e):an()}function Mn(e){return ln=BigInt(`14695981039346656037`),jn(e),ln}function Nn(e){return Mn(e).toString(16).padStart(16,`0`)}function Pn(e){return gt(e)&&C(e,`~codec`)&&b(e[`~codec`])&&C(e[`~codec`],`encode`)&&C(e[`~codec`],`decode`)}function Fn(e){return gt(e)&&C(e,`~immutable`)}function In(e,t={}){return yt(e,t)}function Ln(e){return gt(e)&&C(e,`~readonly`)}function Rn(e){return T({"~kind":`BigInt`},{type:`bigint`},e)}function zn(e){return D(e,`BigInt`)}function Bn(e){return D(e,`Boolean`)}const Vn=`-?(?:0|[1-9][0-9]*)`;function Hn(e){return T({"~kind":`Integer`},{type:`integer`},e)}function Un(e){return D(e,`Integer`)}var Wn=class extends Error{constructor(e){super(`Invalid Literal value`),Object.defineProperty(this,"cause",{value:{value:e},writable:!1,configurable:!1,enumerable:!1})}};function Gn(e){return me(e)?`bigint`:he(e)?`boolean`:be(e)?`number`:Se(e)?`string`:(()=>{throw new Wn(e)})()}function I(e,t){return T({"~kind":`Literal`},{type:Gn(e),const:e},t)}function Kn(e){return me(e)||he(e)||be(e)||Se(e)}function qn(e){return L(e)&&me(e.const)}function Jn(e){return L(e)&&he(e.const)}function Yn(e){return L(e)&&be(e.const)}function Xn(e){return L(e)&&Se(e.const)}function L(e){return D(e,`Literal`)}function Zn(e){return T({"~kind":`Null`},{type:`null`},e)}function Qn(e){return D(e,`Null`)}const $n=`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`;function er(e){return T({"~kind":`Number`},{type:`number`},e)}function tr(e){return D(e,`Number`)}function nr(e){return T({"~kind":`Symbol`},{type:`symbol`},e)}function rr(e){return D(e,`Symbol`)}function ir(e){return T({"~kind":`String`},{type:`string`},e)}function ar(e){return D(e,`String`)}function R(e,t={}){return T({"~kind":`Union`},{anyOf:e},t)}function z(e){return D(e,`Union`)}function or(e){return ht(e,[`~kind`,`anyOf`])}function sr(e){let t=Aa(e);return x(t.length,2)?t[0]:[]}function cr(e){return!0}function lr(e){return S(e,(e,t)=>dr(e)?lr(t):!1,()=>!0)}function ur(e){return!x(e.length,0)&&lr(e)}function dr(e){return z(e)?ur(e.anyOf):L(e)?cr(e.const):!1}function fr(e){return ur(e)}function pr(e){return T({"~kind":`TemplateLiteral`},{type:`string`,pattern:e},{})}function mr(e,t,n=[]){return S(e,(e,r)=>mr(r,t,[...n,`${e}${t}`]),()=>n)}function hr(e,t){return x(e.length,0)?[`${t}`]:mr(e,t)}function gr(e,t,n=[]){return S(t,(t,r)=>gr(e,r,[...n,..._r(e,t)]),()=>n)}function _r(e,t){return z(t)?gr(e,t.anyOf):L(t)?hr(e,t.const):an()}function vr(e,t){return S(t,(t,n)=>vr(_r(e,t),n),()=>e)}function yr(e){return e.map(e=>I(e))}function br(e){return R(yr(vr([],e)))}function xr(e){return x(e.length,0)?an():x(e.length,1)&&L(e[0])?e[0]:br(e)}function Sr(e){let t=sr(e);return x(t.length,0)?ir():fr(t)?xr(t):pr(e)}function Cr(e){let t=Sr(e);return Za(t)?ir():t}function wr(e,t){return T({"~kind":`Record`},{type:`object`,patternProperties:{[e]:t}})}function Tr(e){return wr(Oi,e)}function Er(e){return j({true:e,false:e})}function Dr(e,t={}){let[n,r,i]=[e,e.length,!1];return T({"~kind":`Tuple`},{type:`array`,additionalItems:i,items:n,minItems:r},t)}function B(e){return D(e,`Tuple`)}function Or(e){return ht(e,[`~kind`,`type`,`items`,`minItems`,`additionalItems`])}function kr(e){return ht(e,[`~readonly`])}function Ar(e,t){return E(kr(e),{},t)}function jr(e,t,n,r){return Ar(J(e,t,n),r)}function Mr(e,t={}){return Ar(e,t)}function Nr(e){return ht(e,[`~optional`])}function Pr(e,t){return E(Nr(e),{},t)}function Fr(e,t,n,r){return Pr(J(e,t,n),r)}function Ir(e,t={}){return Pr(e,t)}function Lr(e){return e.reduceRight((e,t,n)=>({[n]:t,...e}),{})}function Rr(e){return j(Lr(e.items))}function zr(e,t){return Ln(e)?!!Ln(t):!1}function Br(e,t){return Vt(e)?!!Vt(t):!1}function Vr(e,t){let n=zr(e,t),r=Br(e,t),i=Mr(Ir(ii([e,t])));return n&&r?In(zt(i)):n&&!r?In(i):!n&&r?zt(i):i}function Hr(e,t,n){return n in e?n in t?Vr(e[n],t[n]):e[n]:n in t?t[n]:A()}function Ur(e,t){return[...new Set([...w(t),...w(e)])].reduce((n,r)=>({...n,[r]:Hr(e,t,r)}),{})}function Wr(e){return M(e)?e.properties:B(e)?Lr(e.items):an()}function Gr(e,t){return j(Ur(Wr(e),Wr(t)))}function Kr(e,t){let n=Zs(e,t);return x(n,`left-inside`)?e:x(n,`right-inside`)||x(n,`equal`)?t:A()}function qr(e){return M(e)||B(e)}function Jr(e,t){let n=z(e),r=z(t);return n||r}function Yr(e,t){let n=si(e),r=si(t),i=Jr(n,r),a=qr(n),o=qr(r);return i?ii([n,r]):a&&o?Gr(n,r):a&&!o?n:!a&&o?r:Kr(n,r)}function Xr(e,t,n=[]){return S(t,(t,r)=>Xr(e,r,[...n,Yr(e,t)]),()=>x(n.length,0)?[e]:n)}function Zr(e,t,n=[]){return S(e,(e,r)=>Zr(r,t,[...n,...Qr([e],t)]),()=>n)}function Qr(e,t=[]){return S(e,(e,n)=>z(e)?Qr(n,Zr(e.anyOf,t)):Qr(n,Xr(e,t)),()=>t)}function $r(e,t){return no(Xs({},e,t))?[]:[e]}function ei(e,t){return e.reduce((e,n)=>[...e,...$r(n,t)],[])}function ti(e,t){let n=si(e);return oi(ei(z(n)?n.anyOf:[n],t))}function ni(e,t,n){return oi([nn([e,t]),ti(n,e)])}function ri(e){return oi(e.map(e=>I(e)))}function ii(e){return ci(nc(Qr(e)))}function ai(e){return si(Cr(e))}function oi(e){return ci(nc(e))}function si(e){return $t(e)?ni(e.if,e.then,e.else):tn(e)?ri(e.enum):N(e)?ii(e.allOf):Za(e)?ai(e.pattern):z(e)?oi(e.anyOf):e}function ci(e){return x(e.length,1)?e[0]:x(e.length,0)?A():R(e)}function li(e,t){return Ci(ri(e),t)}function ui(e,t){return wr(Ei,t)}function di(e,t){return Ci(ii(e),t)}function fi(e,t){return Se(e)||be(e)?j({[e]:t}):x(e,!1)?j({false:t}):x(e,!0)?j({true:t}):j({})}function pi(e,t){return wr(Di,t)}function mi(e,t){return C(e,`pattern`)&&(Se(e.pattern)||e.pattern instanceof RegExp)?wr(e.pattern.toString(),t):wr(Oi,t)}function hi(e,t){return fr(sr(e))?Ci(ai(e),t):wr(e,t)}function gi(e){return z(e)?_i(e.anyOf):[e]}function _i(e){return e.reduce((e,t)=>[...e,...gi(t)],[])}function vi(e){return e.some(e=>ar(e)||tr(e)||Un(e))}function yi(e,t){return x(vi(e),!0)?wr(Oi,t):void 0}function bi(e,t){return e.reduce((e,n)=>L(n)&&(Se(n.const)||be(n.const))?{...e,[n.const]:t}:e,{})}function xi(e,t){return j(bi(e,t))}function Si(e,t){let n=_i(e),r=yi(n,t);return gt(r)?r:xi(n,t)}function Ci(e,t){return Lt(e)?Tr(t):Bn(e)?Er(t):tn(e)?li(e.enum,t):Un(e)?ui(e,t):N(e)?di(e.allOf,t):L(e)?fi(e.const,t):tr(e)?pi(e,t):z(e)?Si(e.anyOf,t):ar(e)?mi(e,t):Za(e)?hi(e.pattern,t):j({})}function wi(e,t,n){return q([e])?E(Ci(e,t),{},n):ki(e,t,n)}function Ti(e,t,n,r,i){return wi(J(e,t,n),J(e,t,r),i)}const Ei=`^${Vn}$`,Di=`^${$n}$`,Oi=`^.*$`;function ki(e,t,n={}){return O(`Record`,[e,t],n)}function Ai(e,t,n={}){return wi(e,t,n)}function ji(e,t){return wr(e,t)}function Mi(e){return x(e,Oi)?ir():x(e,Ei)?Hn():x(e,Di)?er():Sr(e)}function Ni(e){return w(e.patternProperties)[0]}function Pi(e){return Mi(Ni(e))}function Fi(e){return e.patternProperties[Ni(e)]}function Ii(e){return D(e,`Record`)}function Li(e){return T({"~kind":`Rest`},{type:`rest`,items:e},{})}function Ri(e){return D(e,`Rest`)}function zi(e){return D(e,`This`)}function Bi(e){return T({"~kind":`Undefined`},{type:`undefined`},e)}function Vi(e){return D(e,`Undefined`)}function Hi(e){return D(e,`Void`)}function Ui(e){return Rn()}function Wi(e){return ir()}function Gi(e){return er()}function Ki(e){return Hn()}function qi(e){return A()}function Ji(e){return I(e)}function Yi(e){return e}function Xi(e){return R(e[1])}function Zi(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Qi(e){return[e[0],...e[1]]}function $i(e){return e}function ea(e){return e[1]}function ta(e){return x(e.length,2)}function na(e,t,n){return ta(e)?t(e[0],e[1]):n()}function ra(e,t){return x(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function ia(e,t){for(let n=0;n<e.length;n++){let r=ra(e[n],t);if(ta(r))return r}return[]}function aa(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}const oa=[...aa(97,122),...aa(65,90)],sa=[`0`,...aa(49,57)];function ca(e){let t=e.indexOf(`*/`);return x(t,-1)?``:e.slice(t+2)}function la(e){let t=e.indexOf(`
|
|
2
|
-
`);return x(t,-1)?``:e.slice(t)}function ua(e){return e.replace(/^[ \t\r\f\v]+/,``)}function da(e){let t=ua(e);return t.startsWith(`/*`)?da(ca(t.slice(2))):t.startsWith(`//`)?da(la(t.slice(2))):t}function fa(e){let t=e.trimStart();return t.startsWith(`/*`)?fa(ca(t.slice(2))):t.startsWith(`//`)?fa(la(t.slice(2))):t}[...sa];function pa(e,t){return ia([e],t)}function ma(e,t){return x(e,``)?[``,t]:e.startsWith(`
|
|
3
|
-
`)?pa(e,da(t)):e.startsWith(` `)?pa(e,t):pa(e,fa(t))}[...oa,...sa],[...sa];function ha(e){return x(e,``)?[]:[e.slice(0,1),e.slice(1)]}function ga(e,t){return S(e,(e,n)=>t.startsWith(e)?!0:ga(n,t),()=>!1)}function _a(e,t,n=``){return na(ha(t),(r,i)=>ga(e,t)?[n,t]:_a(e,i,`${n}${r}`),()=>[])}function va(e,t){return na(_a(e,t),(e,t)=>x(e,``)?[]:[e,t],()=>[])}const V=(e,t,n=()=>[])=>e.length===2?t(e):n(),ya=e=>V(ma(`-?(?:0|[1-9][0-9]*)n`,e),([e,t])=>[Ui(e),t]),ba=e=>V(ma(`.*`,e),([e,t])=>[Wi(e),t]),xa=e=>V(ma(`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`,e),([e,t])=>[Gi(e),t]),Sa=e=>V(ma(`-?(?:0|[1-9][0-9]*)`,e),([e,t])=>[Ki(e),t]),Ca=e=>V(ma(`(?!)`,e),([e,t])=>[qi(e),t]),wa=e=>V(va([`-?(?:0|[1-9][0-9]*)n`,`.*`,`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`,`-?(?:0|[1-9][0-9]*)`,`(?!)`,`(`,`)`,`$`,`|`],e),([e,t])=>[Ji(e),t]),Ta=e=>V(V(ya(e),([e,t])=>[e,t],()=>V(ba(e),([e,t])=>[e,t],()=>V(xa(e),([e,t])=>[e,t],()=>V(Sa(e),([e,t])=>[e,t],()=>V(Ca(e),([e,t])=>[e,t],()=>V(Ea(e),([e,t])=>[e,t],()=>V(wa(e),([e,t])=>[e,t],()=>[]))))))),([e,t])=>[Yi(e),t]),Ea=e=>V(V(ma(`(`,e),([e,t])=>V(ka(t),([t,n])=>V(ma(`)`,n),([n,r])=>[[e,t,n],r]))),([e,t])=>[Xi(e),t]),Da=e=>V(V(V(Oa(e),([e,t])=>V(ma(`|`,t),([t,n])=>V(Da(n),([n,r])=>[[e,t,n],r]))),([e,t])=>[e,t],()=>V(V(Oa(e),([e,t])=>[[e],t]),([e,t])=>[e,t],()=>V([[],e],([e,t])=>[e,t],()=>[]))),([e,t])=>[Zi(e),t]),Oa=e=>V(V(Ta(e),([e,t])=>V(ka(t),([t,n])=>[[e,t],n])),([e,t])=>[Qi(e),t]),ka=e=>V(V(Da(e),([e,t])=>[e,t],()=>V(Oa(e),([e,t])=>[e,t],()=>[])),([e,t])=>[$i(e),t]),Aa=e=>V(V(ma(`^`,e),([e,t])=>V(ka(t),([t,n])=>V(ma(`$`,n),([n,r])=>[[e,t,n],r]))),([e,t])=>[ea(e),t]);function ja(e){return e.join(`|`)}function Ma(e){return e.slice(1,e.length-1)}function Na(e,t,n){return Wa(t,`${n}${e}`)}function Pa(e,t){return Wa(e,`${t}-?(?:0|[1-9][0-9]*)n`)}function Fa(e,t){return Wa(e,`${t}${Vn}`)}function Ia(e,t){return Wa(e,`${t}${$n}`)}function La(e,t){return Ua(R([I(`false`),I(`true`)]),e,t)}function Ra(e,t){return Wa(e,`${t}.*`)}function za(e,t,n){return Wa(t,`${n}${Ma(e)}`)}function Ba(e,t,n){return Ua(qa(e,{}),t,n)}function Va(e,t,n){return Ua(ri(e),t,n)}function Ha(e,t,n,r=[]){return S(e,(e,i)=>Ha(i,t,n,[...r,Ua(e,[],``)]),()=>Wa(t,`${n}(${ja(r)})`))}function Ua(e,t,n){return tn(e)?Va(e.enum,t,n):Un(e)?Fa(t,n):L(e)?Na(e.const,t,n):zn(e)?Pa(t,n):Bn(e)?La(t,n):tr(e)?Ia(t,n):ar(e)?Ra(t,n):Za(e)?za(e.pattern,t,n):Xa(e)?Ba(e.parameters[0],t,n):z(e)?Ha(e.anyOf,t,n):`(?!)`}function Wa(e,t){return S(e,(e,n)=>Ua(e,n,t),()=>t)}function Ga(e){return`^${Wa(e,``)}$`}function Ka(e){return pr(Ga(e))}function qa(e,t){return q(e)?E(Ka(e),{},t):Ya(e,t)}function Ja(e,t,n,r){return qa(ef(e,t,n),r)}function Ya(e,t={}){return O(`TemplateLiteral`,[e],t)}function Xa(e){return gt(e)&&C(e,`action`)&&x(e.action,`TemplateLiteral`)}function Za(e){return D(e,`TemplateLiteral`)}function Qa(e){return T({"~kind":`ExtendsUnion`},{inferred:e})}function $a(e){return b(e)&&C(e,`~kind`)&&C(e,`inferred`)&&x(e[`~kind`],`ExtendsUnion`)&&b(e.inferred)}function H(e){return T({"~kind":`ExtendsTrue`},{inferred:e})}function eo(e){return b(e)&&C(e,`~kind`)&&C(e,`inferred`)&&x(e[`~kind`],`ExtendsTrue`)&&b(e.inferred)}function U(){return T({"~kind":`ExtendsFalse`},{})}function to(e){return b(e)&&C(e,`~kind`)&&x(e[`~kind`],`ExtendsFalse`)}function no(e){return $a(e)||eo(e)}function W(e,t,n){return no(e)?t(e.inferred):n()}function ro(e,t,n,r){return W(K(e,n,r),r=>H(g(g(e,r),{[t]:n})),()=>U())}function io(e,t){return H(e)}function ao(e,t,n,r,i){return W(K(e,t,n),e=>W(K(e,t,r),e=>H(e),()=>U()),()=>W(K(e,t,i),e=>H(e),()=>U()))}function oo(e,t,n){return K(e,t,ri(n))}function so(e,t,n){return S(n,(n,r)=>W(K(e,t,n),e=>so(e,t,r),()=>U()),()=>H(e))}function co(e,t,n){return K(e,t,ai(n))}function lo(e,t,n){return S(n,(n,r)=>W(K(e,t,n),e=>H(e),()=>lo(e,t,r)),()=>U())}function G(e,t,n){return Lt(n)?io(e,t):$t(n)?ao(e,t,n.if,n.then,n.else):tn(n)?oo(e,t,n.enum):Zt(n)?ro(e,n.name,t,n.extends):N(n)?so(e,t,n.allOf):Za(n)?co(e,t,n.pattern):z(n)?lo(e,t,n.anyOf):qt(n)?H(e):U()}function uo(e,t,n){return Zt(n)?G(e,t,n):Lt(n)||qt(n)?H(e):Qa(e)}function fo(e,t){let n=Fn(e),r=Fn(t);return n&&r||!n&&r?!0:!(n&&!r)}function po(e,t,n,r){return k(r)?fo(t,r)?K(e,n,r.items):U():G(e,t,r)}function mo(e,t,n){return zn(n)?H(e):G(e,t,n)}function ho(e,t,n){return Bn(n)?H(e):G(e,t,n)}function go(e,t,n,r,i){let a=Zt(r)?t:r,o=Zt(r)?r:t,s=Vt(t),c=Vt(r);return!s&&c?U():W(K(e,a,o),e=>yo(e,n,i),()=>U())}function _o(e,t,n,r){return S(r,(r,i)=>go(e,t,n,r,i),()=>Vt(t)?H(e):U())}function vo(e,t,n){return S(t,(t,r)=>_o(e,t,r,n),()=>H(e))}function yo(e,t,n){return vo(e,t,n)}function bo(e,t,n){return Hi(n)?H(e):K(e,t,n)}function xo(e,t,n,r){return Lt(r)||qt(r)?H(e):Dt(r)?W(yo(e,t,r.parameters),e=>bo(e,n,r.instanceType),()=>U()):U()}function So(e,t,n,r,i){return W(K(e,t,i),()=>K(e,n,i),()=>K(e,r,i))}function Co(e,t,n){return K(e,ri(t),n)}function wo(e,t,n,r){return Lt(r)||qt(r)?H(e):At(r)?W(yo(e,t,r.parameters),e=>bo(e,n,r.returnType),()=>U()):U()}function To(e,t,n){return Un(n)||tr(n)?H(e):G(e,t,n)}function Eo(e,t,n){return K(e,ii(t),n)}function Do(e,t,n){return t===n?H(e):U()}function Oo(e,t,n){return L(n)?Do(e,t,n.const):zn(n)?H(e):G(e,I(t),n)}function ko(e,t,n){return L(n)?Do(e,t,n.const):Bn(n)?H(e):G(e,I(t),n)}function Ao(e,t,n){return L(n)?Do(e,t,n.const):tr(n)?H(e):G(e,I(t),n)}function jo(e,t,n){return L(n)?Do(e,t,n.const):ar(n)?H(e):G(e,I(t),n)}function Mo(e,t,n){return me(t.const)?Oo(e,t.const,n):he(t.const)?ko(e,t.const,n):be(t.const)?Ao(e,t.const,n):Se(t.const)?jo(e,t.const,n):an()}function No(e,t,n){return Zt(n)?G(e,t,n):H(e)}function Po(e,t,n){return Qn(n)?H(e):G(e,t,n)}function Fo(e,t,n){return tr(n)?H(e):G(e,t,n)}function Io(e,t,n){return Vt(t)?Vt(n)?H(e):U():H(e)}function Lo(e,t,n){return Zt(n)&&Rt(n.extends)?U():W(K(e,t,n),e=>Io(e,t,n),()=>U())}function Ro(e,t){return e.reduce((e,n)=>n in t&&no(t[n])?{...e,...t[n].inferred}:an(),{})}function zo(e,t,n){let r={};for(let i of w(n))r[i]=i in t?Lo({},t[i],n[i]):Vt(n[i])?Zt(n[i])?H(g(e,{[n[i].name]:n[i].extends})):H(e):U();let i=Ve(r).every(e=>no(e)),a=i?Ro(w(r),r):{};return i?H(a):U()}function Bo(e,t,n){let r=zo(e,t,n);return no(r)?H(g(e,r.inferred)):U()}function Vo(e,t,n){return Bo(e,t,n)}function Ho(e,t){return w(t).reduce((n,r)=>({...n,[r]:C(e,r)?z(n[r])?R([...n[r].anyOf,t[r]]):R([e[r],t[r]]):t[r]}),e)}function Uo(e,t,n,r){return S(t,(t,i)=>W(K({},e[t],n),t=>Uo(e,i,n,Ho(r,t)),()=>U()),()=>H(r))}function Wo(e,t,n,r){return Uo(t,w(t),r,e)}function Go(e,t,n){return Ii(n)?Wo(e,t,Ni(n),Fi(n)):M(n)?Vo(e,t,n.properties):G(e,j(t),n)}function Ko(e,t){return x(w(t).length,0)?H(e):U()}function qo(e,t,n,r,i){return K(e,n,i)}function Jo(e,t,n,r){return Ii(r)?qo(e,Mi(t),n,Mi(Ni(r)),Fi(r)):M(r)?Ko(e,r.properties):Lt(r)||qt(r)?H(e):U()}function Yo(e,t,n){return ar(n)?H(e):G(e,t,n)}function Xo(e,t,n){return rr(n)?H(e):G(e,t,n)}function Zo(e,t,n){return K(e,ai(t),n)}function Qo(e,t){return T({"~kind":`Inferrable`},{name:e,type:t},{})}function $o(e){return b(e)&&C(e,`~kind`)&&C(e,`name`)&&C(e,`type`)&&x(e[`~kind`],`Inferrable`)&&Se(e.name)&&b(e.type)}function es(e){return Ri(e)?Zt(e.items)?k(e.items.extends)?Qo(e.items.name,e.items.extends.items):qt(e.items.extends)?Qo(e.items.name,e.items.extends):void 0:an():void 0}function ts(e){return Zt(e)?Qo(e.name,e.extends):void 0}function ns(e,t,n=[]){return S(e,(e,r)=>W(K({},e,t),()=>ns(r,t,[...n,e]),()=>void 0),()=>n)}function rs(e,t,n,r){let i=ns(n,r);return pe(i)?H(g(e,{[t]:Dr(i)})):U()}function is(e,t,n,r){let i=ns(n,r);return pe(i)?H(g(e,{[t]:R(i)})):U()}function as(e){return[...e].reverse()}function os(e,t){return t?as(e):e}function ss(e){let t=e.length>0?e[0]:void 0;return gt(gt(t)?es(t):void 0)}function cs(e,t,n,r,i,a){return W(K(e,n,i),e=>ds(e,t,r,a),()=>U())}function ls(e,t,n,r,i){let a=es(r);return $o(a)?rs(e,a.name,os(n,t),a.type):S(n,(n,a)=>cs(e,t,n,a,r,i),()=>U())}function us(e,t,n,r){return S(r,(r,i)=>ls(e,t,n,r,i),()=>x(n.length,0)?H(e):U())}function ds(e,t,n,r){return us(e,t,n,r)}function fs(e,t,n){let r=$d(e,Zd([],[]),n),i=ss(r);return ds(e,i,os(t,i),os(r,i))}function ps(e,t,n){let r=ts(n);return $o(r)?is(e,r.name,t,r.type):S(t,(t,r)=>W(K(e,t,n),e=>ps(e,r,n),()=>U()),()=>H(e))}function ms(e,t,n){let r=$d(e,Zd([],[]),t);return B(n)?fs(e,r,n.items):k(n)?ps(e,r,n.items):G(e,Dr(r),n)}function hs(e,t,n){return Hi(n)||Vi(n)?H(e):G(e,t,n)}function gs(e,t,n){return S(n,(n,r)=>W(K(e,t,n),e=>H(e),()=>gs(e,t,r)),()=>U())}function _s(e,t,n){return S(t,(t,r)=>W(gs(e,t,n),e=>_s(e,r,n),()=>U()),()=>H(e))}function vs(e,t,n){let r=ts(n);return $o(r)?is(e,r.name,t,r.type):z(n)?_s(e,t,n.anyOf):_s(e,t,[n])}function ys(e,t,n){return Zt(n)?G(e,t,n):Lt(n)||qt(n)?H(e):U()}function bs(e,t,n){return Hi(n)?H(e):G(e,t,n)}function K(e,t,n){return Lt(t)?uo(e,t,n):k(t)?po(e,t,t.items,n):zn(t)?mo(e,t,n):Bn(t)?ho(e,t,n):Dt(t)?xo(e,t.parameters,t.instanceType,n):$t(t)?So(e,t.if,t.then,t.else,n):tn(t)?Co(e,t.enum,n):At(t)?wo(e,t.parameters,t.returnType,n):Un(t)?To(e,t,n):N(t)?Eo(e,t.allOf,n):L(t)?Mo(e,t,n):Rt(t)?No(e,t,n):Qn(t)?Po(e,t,n):tr(t)?Fo(e,t,n):M(t)?Go(e,t.properties,n):Ii(t)?Jo(e,Ni(t),Fi(t),n):ar(t)?Yo(e,t,n):rr(t)?Xo(e,t,n):Za(t)?Zo(e,t.pattern,n):B(t)?ms(e,t.items,n):Vi(t)?hs(e,t,n):z(t)?vs(e,t.anyOf,n):qt(t)?ys(e,t,n):Hi(t)?bs(e,t,n):U()}function xs(e,t){return ii([...e,j(t)])}function Ss(e,t,n){return q(e)?E(xs(e,t),{},n):ws(e,t,n)}function Cs(e,t,n,r,i){return Ss(ef(e,t,n),Qd(e,t,r),i)}function ws(e,t,n={}){return O(`Interface`,[e,t],n)}function Ts(e){return gt(e)&&C(e,`action`)&&x(e.action,`Interface`)}function Es(e,t,n){return e.includes(n)?!0:ks([...e,n],t,t[n])}function Ds(e,t,n){return Os(e,t,Wt(n))}function Os(e,t,n){return S(n,(n,r)=>ks(e,t,n)?!0:Os(e,t,r),()=>!1)}function ks(e,t,n){return Nt(n)?Es(e,t,n.$ref):k(n)?ks(e,t,n.items):Dt(n)?Os(e,t,[...n.parameters,n.instanceType]):At(n)?Os(e,t,[...n.parameters,n.returnType]):Ts(n)?Ds(e,t,n.parameters[1]):N(n)?Os(e,t,n.allOf):M(n)?Ds(e,t,n.properties):z(n)?Os(e,t,n.anyOf):B(n)?Os(e,t,n.items):Ii(n)?ks(e,t,Fi(n)):!1}function As(e,t,n){return ks(e,t,n)}function js(e,t){return t.reduce((t,n)=>As([n],e,e[n])?[...t,n]:t,[])}function Ms(e){return js(e,Ut(e))}function Ns(e,t,n){return n.includes(t)?n:t in e?Is(e,e[t],[...n,t]):an()}function Ps(e,t,n){return Fs(e,Wt(t),n)}function Fs(e,t,n){return t.reduce((t,n)=>Is(e,n,t),n)}function Is(e,t,n){return Nt(t)?Ns(e,t.$ref,n):k(t)?Is(e,t.items,n):Dt(t)?Fs(e,[...t.parameters,t.instanceType],n):At(t)?Fs(e,[...t.parameters,t.returnType],n):Ts(t)?Ps(e,t.parameters[1],n):N(t)?Fs(e,t.allOf,n):M(t)?Ps(e,t.properties,n):z(t)?Fs(e,t.anyOf,n):B(t)?Fs(e,t.items,n):Ii(t)?Is(e,Fi(t),n):n}function Ls(e,t,n){return Is(e,n,[t])}function Rs(e){return It()}function zs(e){return w(e).reduce((t,n)=>({...t,[n]:Vs(e[n])}),{})}function Bs(e){return e.reduce((e,t)=>[...e,Vs(t)],[])}function Vs(e){return Nt(e)?Rs(e.$ref):k(e)?wt(Vs(e.items),Tt(e)):Dt(e)?Et(Bs(e.parameters),Vs(e.instanceType)):At(e)?kt(Bs(e.parameters),Vs(e.returnType)):N(e)?nn(Bs(e.allOf)):M(e)?j(zs(e.properties)):Ii(e)?Ai(Pi(e),Vs(Fi(e))):z(e)?R(Bs(e.anyOf)):B(e)?Dr(Bs(e.items)):e}function Hs(e,t){return t in e?Vs(e[t]):Kt()}function Us(e){return Hs(e.$defs,e.$ref)}function Ws(e,t,n){let r=ef(e,Zd([],[]),t),i=Qd({},Zd([],[]),n);return ii([...r,j(i)])}function Gs(e,t){return w(e).filter(e=>t.includes(e)).reduce((t,n)=>{let r=e[n],i=Ts(r)?Ws(e,r.parameters[0],r.parameters[1]):r;return{...t,[n]:i}},{})}function Ks(e,t,n){return Jt(Gs(e,Ls(e,t,n)),t)}function qs(e,t){return t in e?Nt(e[t])?qs(e,e[t].$ref):e[t]:A()}function Js(e,t){return qs(e,t)}function Ys(e){return Yt(e)?Us(e):Xt(e)?Kt():e}function Xs(e,t,n){return K(e,Ys(t),Ys(n))}function Zs(e,t){let n=[qt(e)?U():Xs({},e,t),qt(e)?H({}):Xs({},t,e)];return no(n[0])&&no(n[1])?`equal`:no(n[0])&&to(n[1])?`left-inside`:to(n[0])&&no(n[1])?`right-inside`:`disjoint`}function Qs(e,t){return t.filter(t=>Zs(e,t)!==`right-inside`)}function $s(e,t){return x(t.some(t=>{let n=Zs(e,t);return x(n,`left-inside`)||x(n,`equal`)}),!1)}function ec(e,t){let n=si(e);return Lt(n)?[n]:$s(n,t)?[...Qs(n,t),n]:t}function tc(e){return e.reduce((e,t)=>M(t)?[...e,t]:Rt(t)?e:ec(t,e),[])}function nc(e){return _i(tc(e))}function rc(e,t){return E(si(e),{},t)}function ic(e,t,n,r){return rc(J(e,t,n),r)}function ac(e,t=[]){return _t(e)&&x(e.action,`Conditional`)?Nt(e.parameters[0])?ac(e.parameters[2],ac(e.parameters[3],[...t,e.parameters[0].$ref])):ac(e.parameters[2],ac(e.parameters[3],t)):_t(e)&&x(e.action,`Mapped`)&&_t(e.parameters[1])&&x(e.parameters[1].action,`KeyOf`)&&Nt(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function oc(e,t){return e.reduce((e,n)=>[...e,t.includes(n.name)],[])}function sc(e,t,n=[]){return S(e,(e,r)=>S(t,(t,i)=>sc(r,i,[...n,[t,e]]),()=>n),()=>n)}function cc(e){return z(e)?[...e.anyOf]:[e]}function lc(e,t){return e.reduce((e,n)=>[...e,[...n,t]],[])}function uc(e,t){return t.reduce((t,n)=>[...t,...lc(e,n)],[])}function dc(e){return e.reduce((e,t)=>x(t[0],!0)?uc(e,cc(t[1])):uc(e,[t[1]]),[[]])}function fc(e,t,n){let r=sc(t,oc(e,ac(n)));return _t(n)&&x(n.action,`Conditional`)||_t(n)&&x(n.action,`Mapped`)?dc(r):[t]}function pc(){return[`(not-resolvable)`,A()]}function mc(){return[`(not-generic)`,A()]}function hc(e,t,n){return[e,Pt(t,n)]}function gc(e,t,n){return t in e?_c(e,t,e[t],n):pc()}function _c(e,t,n,r){return Ft(n)?hc(t,n.parameters,n.expression):Nt(n)?gc(e,n.$ref,r):mc()}function vc(e,t,n){return _c(e,`(anonymous)`,t,n)}function yc(e,t,n){if(Zt(t)||jc(t)||no(Xs({},t,n)))return;let r={parameter:e,expect:n,actual:t};throw Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:r})}function bc(e,t,n,r,i){let a=J(e,t,i);return yc(n,a,r),g(e,{[n]:a})}function xc(e,t,n,r,i){let a=J(e,t,n.extends),o=J(e,t,n.equals);return S(i,(i,o)=>Sc(bc(e,t,n.name,a,i),t,r,o),()=>Sc(bc(e,t,n.name,a,o),t,r,[]))}function Sc(e,t,n,r){return S(n,(n,i)=>xc(e,t,n,i,r),()=>e)}function Cc(e,t,n,r){return Sc(e,t,n,r)}function wc(e){return Te(e.callstack.length,0)?e.callstack[e.callstack.length-1]:``}function Tc(e,t){return x(wc(e),t)}function Ec(e,t,n,r,i,a){let o=Cc(e,t,r,a),s=J(o,Zd([...t.callstack,n.$ref],t.visited),i);return J(o,Zd([],[]),s)}function Dc(e,t,n,r,i,a){return a.reduce((a,o)=>[...a,Ec(e,t,n,r,i,o)],[])}function Oc(e,t,n,r,i,a){let o=Dc(e,t,n,r,i,fc(r,a,i));return x(o.length,1)?o[0]:oi(o)}function kc(e,t,n,r){let i=ef(e,t,r),a=vc(e,n,r),o=a[0],s=a[1];return Ft(s)?Tc(t,o)?Ac(Mt(o),i):Oc(e,t,Mt(o),s.parameters,s.expression,i):Ac(n,i)}function Ac(e,t){return T({"~kind":`Call`},{type:`call`,target:e,arguments:t},{})}function jc(e){return D(e,`Call`)}function Mc(e){return ht(e,[`~immutable`])}function Nc(e,t){return E(Mc(e),{},t)}function Pc(e,t,n,r){return Nc(J(e,t,n),r)}function Fc(e,t){return e(t)}function Ic(e,t){return Se(t)?I(Fc(e,t)):I(t)}function Lc(e,t){return zc(e,ai(t))}function Rc(e,t){return R(t.map(t=>zc(e,t)))}function zc(e,t){return L(t)?Ic(e,t.const):Za(t)?Lc(e,t.pattern):z(t)?Rc(e,t.anyOf):t}function Bc(e,t={}){return O(`Capitalize`,[e],t)}function Vc(e,t={}){return O(`Lowercase`,[e],t)}function Hc(e,t={}){return O(`Uncapitalize`,[e],t)}function Uc(e,t={}){return O(`Uppercase`,[e],t)}const Wc=e=>e[0].toUpperCase()+e.slice(1),Gc=e=>e.toLowerCase(),Kc=e=>e[0].toLowerCase()+e.slice(1),qc=e=>e.toUpperCase();function Jc(e,t){return q([e])?E(zc(Wc,e),{},t):Bc(e,t)}function Yc(e,t){return q([e])?E(zc(Gc,e),{},t):Vc(e,t)}function Xc(e,t){return q([e])?E(zc(Kc,e),{},t):Hc(e,t)}function Zc(e,t){return q([e])?E(zc(qc,e),{},t):Uc(e,t)}function Qc(e,t,n,r){return Jc(J(e,t,n),r)}function $c(e,t,n,r){return Yc(J(e,t,n),r)}function el(e,t,n,r){return Xc(J(e,t,n),r)}function tl(e,t,n,r){return Zc(J(e,t,n),r)}function nl(e,t,n,r,i={}){return O(`Conditional`,[e,t,n,r],i)}function rl(e,t,n,r,i,a){let o=Xs(e,n,r);return $a(o)?R([J(o.inferred,t,i),J(e,t,a)]):eo(o)?J(o.inferred,t,i):J(e,t,a)}function il(e,t,n,r,i,a,o){return q([n,r])?E(rl(e,t,n,r,i,a),{},o):nl(n,r,i,a,o)}function al(e,t,n,r,i,a,o){return il(e,t,J(e,t,n),J(e,t,r),i,a,o)}function ol(e,t={}){return O(`ConstructorParameters`,[e],t)}function sl(e){let t=Dt(e)?e.parameters:[];return Dr($d({},Zd([],[]),t))}function cl(e,t){return q([e])?E(sl(e),{},t):ol(e,t)}function ll(e,t,n,r){return cl(J(e,t,n),r)}function ul(e,t,n={}){return O(`Exclude`,[e,t],n)}function dl(e,t,n){return q([e,t])?E(ti(e,t),{},n):ul(e,t,n)}function fl(e,t,n,r,i){return dl(J(e,t,n),J(e,t,r),i)}function pl(e,t,n={}){return O(`Extract`,[e,t],n)}function ml(e,t){return no(Xs({},e,t))?[e]:[]}function hl(e,t){return e.reduce((e,n)=>[...e,...ml(n,t)],[])}function gl(e,t){let n=si(e);return oi(hl(z(n)?n.anyOf:[n],t))}function _l(e,t,n){return q([e,t])?E(gl(e,t),{},n):pl(e,t,n)}function vl(e,t,n,r,i){return _l(J(e,t,n),J(e,t,r),i)}function yl(e,t,n={}){return O(`Index`,[e,t],n)}function bl(e,t){return kl(Js(e,t))}function xl(e,t,n){return kl(ni(e,t,n))}function Sl(e,t){let n=w(e).filter(e=>!C(t,e)),r=w(t).filter(t=>!C(e,t)),i=w(e).filter(e=>C(t,e)),a=n.reduce((t,n)=>({...t,[n]:e[n]}),{}),o=r.reduce((e,n)=>({...e,[n]:t[n]}),{}),s=i.reduce((n,r)=>({...n,[r]:ii([e[r],t[r]])}),{});return g(g(a,o),s)}function Cl(e){return e.reduce((e,t)=>Sl(e,kl(t)),{})}function wl(e){return e}function Tl(e){return kl(Rr(Dr(e)))}function El(e,t){return w(e).filter(e=>e in t).reduce((n,r)=>({...n,[r]:oi([e[r],t[r]])}),{})}function Dl(e,t){return S(e,(e,n)=>Dl(n,El(t,kl(e))),()=>t)}function Ol(e){return S(e,(e,t)=>Dl(t,kl(e)),()=>an())}function kl(e){return Yt(e)?bl(e.$defs,e.$ref):$t(e)?xl(e.if,e.then,e.else):N(e)?Cl(e.allOf):z(e)?Ol(e.anyOf):B(e)?Tl(e.items):M(e)?wl(e.properties):{}}function Al(e){return j(kl(e))}const jl=RegExp(`^(?:0|[1-9][0-9]*)$`);function Ml(e){let t=`${e}`;return jl.test(t)?parseInt(t):e}function Nl(e){return I(Ml(e))}function Pl(e){return e.map(e=>Fl(e))}function Fl(e){return N(e)?nn(Pl(e.allOf)):z(e)?R(Pl(e.anyOf)):L(e)?Nl(e.const):e}function Il(e,t){return no(Xs({},Fl(t),er()))?e:L(t)&&x(t.const,`length`)?er():A()}function Ll(e,t){return Wl(Js(e,t))}function Rl(e,t,n){return Wl(ni(e,t,n))}function zl(e){return Wl(ri(e))}function Bl(e){return Wl(ii(e))}function Vl(e){return[`${e}`]}function Hl(e){return Wl(ai(e))}function Ul(e){return e.reduce((e,t)=>[...e,...Wl(t)],[])}function Wl(e){return Yt(e)?Ll(e.$defs,e.$ref):$t(e)?Rl(e.if,e.then,e.else):tn(e)?zl(e.enum):N(e)?Bl(e.allOf):L(e)?Vl(e.const):Za(e)?Hl(e.pattern):z(e)?Ul(e.anyOf):[]}function Gl(e){return Wl(e)}function Kl(e,t){return t.map(t=>ql(e,t))}function ql(e,t){return k(t)?wt(ql(e,t.items)):Dt(t)?Et(Kl(e,t.parameters),ql(e,t.instanceType)):At(t)?kt(Kl(e,t.parameters),ql(e,t.returnType)):B(t)?Dr(Kl(e,t.items)):z(t)?R(Kl(e,t.anyOf)):N(t)?nn(Kl(e,t.allOf)):zi(t)?j(e):t}function Jl(e,t){return ql(e,t)}function Yl(e,t){return Jl(e,t in e?e[t]:A())}function Xl(e,t){return t.reduce((t,n)=>[...t,Yl(e,n)],[])}function Zl(e,t){return oi(Xl(e,Gl(t)))}const Ql=new RegExp(Ei);function $l(e){return e.filter(e=>Ql.test(e))}function eu(e){return oi(Xl(e,$l(Ut(e))))}function tu(e,t){return tr(t)?eu(e):Zl(e,t)}function nu(e){return I(Ml(e))}function ru(e){return e.map(e=>iu(e))}function iu(e){return N(e)?nn(ru(e.allOf)):z(e)?R(ru(e.anyOf)):L(e)?nu(e.const):e}function au(e,t){return e.reduceRight((e,n,r)=>no(Xs({},I(r),t))?[n,...e]:e,[])}function ou(e,t){return ci(au(e,iu(t)))}function su(e){return ci(e)}function cu(e,t){return L(t)&&x(t.const,`length`)?I(e.length):tr(t)||Un(t)?su(e):ou(e,t)}function lu(e,t){return k(e)?Il(e.items,t):M(e)?tu(e.properties,t):B(e)?cu(e.items,t):A()}function uu(e){return Yt(e)||$t(e)||N(e)||z(e)?Al(e):e}function du(e,t,n){return q([e,t])?E(lu(uu(e),t),{},n):yl(e,t,n)}function fu(e,t,n,r,i){return du(J(e,t,n),J(e,t,r),i)}function pu(e,t={}){return O(`InstanceType`,[e],t)}function mu(e){return Dt(e)?e.instanceType:A()}function hu(e,t){return q([e])?E(mu(e),{},t):pu(e,t)}function gu(e,t,n,r={}){return hu(J(e,t,n),r)}function _u(e,t={}){return O(`KeyOf`,[e],t)}function vu(){return R([er(),ir(),nr()])}function yu(e){return er()}function bu(e){return e.reduce((e,t)=>Kn(t)?[...e,I(Ml(t))]:an(),[])}function xu(e){return ci(bu(w(e)))}function Su(e){return Pi(e)}function Cu(e){return ci(e.map((e,t)=>I(t)))}function wu(e){return Lt(e)?vu():k(e)?yu(e.items):M(e)?xu(e.properties):Ii(e)?Su(e):B(e)?Cu(e.items):A()}function Tu(e){return Yt(e)||$t(e)||N(e)||z(e)?Al(e):e}function Eu(e,t){return q([e])?E(wu(Tu(e)),{},t):_u(e,t)}function Du(e,t,n,r){return Eu(J(e,t,n),r)}function Ou(e,t,n,r,i={}){return O(`Mapped`,[e,t,n,r],i)}function ku(e){return Nu(ai(e))}function Au(e){return e.reduce((e,t)=>[...e,...Nu(t)],[])}function ju(e){return Nu(ri(e))}function Mu(e){return be(e)?[I(`${e}`)]:[I(e)]}function Nu(e){return tn(e)?ju(e.enum):L(e)?Mu(e.const):Za(e)?ku(e.pattern):z(e)?Au(e.anyOf):[e]}function Pu(e){return Nu(e)}function Fu(e){return Za(e)?ai(e.pattern):e}function Iu(e,t,n,r,i,a){let o=g(e,{[n.name]:r}),s=Fu(J(o,t,i)),c=J(o,t,a);return Yn(s)||Xn(s)?{[s.const]:c}:{}}function Lu(e,t,n,r,i,a){return r.reduce((r,o)=>[...r,Iu(e,t,n,o,i,a)],[])}function Ru(e){return e.reduce((e,t)=>[...e,j(t)],[])}function zu(e,t,n,r,i,a){return ii(Ru(Lu(e,t,n,Pu(r),i,a)))}function Bu(e,t,n,r,i,a,o){return q([r])?E(zu(e,t,n,r,i,a),{},o):Ou(n,r,i,a,o)}function Vu(e,t,n,r,i,a,o){return Bu(e,t,n,J(e,t,r),i,a,o)}function Hu(e,t,n){let r=g(e,t);return w(t).filter(e=>n.includes(e)).reduce((e,n)=>({...e,[n]:Ks(r,n,t[n])}),{})}function Uu(e,t,n){let r=g(e,t);return w(t).filter(e=>!n.includes(e)).reduce((e,n)=>({...e,[n]:J(r,Zd([],[]),t[n])}),{})}function Wu(e,t,n){let r=Ms(t),i=Hu(e,t,r),a=Uu(e,t,r);return E({...i,...a},{},n)}function Gu(e,t,n,r){return Wu(e,n,r)}function Ku(e,t={}){return O(`NonNullable`,[e],t)}function qu(e){return dl(e,R([Zn(),Bi()]),{})}function Ju(e,t){return q([e])?E(qu(e),{},t):Ku(e,t)}function Yu(e,t,n,r){return Ju(J(e,t,n),r)}function Xu(e,t,n={}){return O(`Omit`,[e,t],n)}function Zu(e){let t=Al(e);return M(t)?t.properties:an()}function Qu(e,t){return w(e).reduce((n,r)=>t.includes(r)?n:{...n,[r]:e[r]},{})}function $u(e,t){return j(Qu(Zu(e),Gl(t)))}function ed(e,t,n){return q([e,t])?E($u(e,t),{},n):Xu(e,t,n)}function td(e,t,n,r,i){return ed(J(e,t,n),J(e,t,r),i)}function nd(e,t={}){return O(`Parameters`,[e],t)}function rd(e){let t=At(e)?e.parameters:[];return Dr($d({},Zd([],[]),t))}function id(e,t){return q([e])?E(rd(e),{},t):nd(e,t)}function ad(e,t,n,r){return id(J(e,t,n),r)}function od(e,t={}){return O(`Partial`,[e],t)}function sd(e,t){let n=fd(Js(e,t));return Jt(g(e,{[t]:n}),t)}function cd(e,t,n){return fd(ni(e,t,n))}function ld(e){return fd(ii(e))}function ud(e){return R(e.map(e=>fd(e)))}function dd(e){return j(w(e).reduce((t,n)=>({...t,[n]:zt(e[n])}),{}))}function fd(e){return Yt(e)?sd(e.$defs,e.$ref):$t(e)?cd(e.if,e.then,e.else):N(e)?ld(e.allOf):z(e)?ud(e.anyOf):M(e)?dd(e.properties):j({})}function pd(e,t){return q([e])?E(fd(e),{},t):od(e,t)}function md(e,t,n,r){return pd(J(e,t,n),r)}function hd(e,t,n={}){return O(`Pick`,[e,t],n)}function gd(e,t){return w(e).reduce((n,r)=>t.includes(r)?g(n,{[r]:e[r]}):n,{})}function _d(e,t){return j(gd(Zu(e),Gl(t)))}function vd(e,t,n){return q([e,t])?E(_d(e,t),{},n):hd(e,t,n)}function yd(e,t,n,r,i){return vd(J(e,t,n),J(e,t,r),i)}function bd(e,t={}){return O(`ReadonlyObject`,[e],t)}function xd(e){return lf(wt(e))}function Sd(e,t){let n=Od(Js(e,t));return Jt(g(e,{[t]:n}),t)}function Cd(e,t,n){return Od(ni(e,t,n))}function wd(e){return Od(ii(e))}function Td(e){return j(w(e).reduce((t,n)=>({...t,[n]:In(e[n])}),{}))}function Ed(e){return lf(Dr(e))}function Dd(e){return R(e.map(e=>Od(e)))}function Od(e){return k(e)?xd(e.items):Yt(e)?Sd(e.$defs,e.$ref):$t(e)?Cd(e.if,e.then,e.else):N(e)?wd(e.allOf):M(e)?Td(e.properties):B(e)?Ed(e.items):z(e)?Dd(e.anyOf):e}function kd(e,t){return q([e])?E(Od(e),{},t):bd(e)}function Ad(e,t,n,r){return kd(J(e,t,n),r)}function jd(e,t,n,r){return t.visited.includes(r)?n:r in e?J(e,Zd(t.callstack,[...t.visited,r]),e[r]):n}function Md(e,t){let n=Ld(Js(e,t));return Jt(g(e,{[t]:n}),t)}function Nd(e,t,n){return Ld(ni(e,t,n))}function Pd(e){return Ld(ii(e))}function Fd(e){return R(e.map(e=>Ld(e)))}function Id(e){return j(w(e).reduce((t,n)=>({...t,[n]:Ir(e[n])}),{}))}function Ld(e){return Yt(e)?Md(e.$defs,e.$ref):$t(e)?Nd(e.if,e.then,e.else):N(e)?Pd(e.allOf):z(e)?Fd(e.anyOf):M(e)?Id(e.properties):j({})}function Rd(e,t={}){return O(`Required`,[e],t)}function zd(e,t){return q([e])?E(Ld(e),{},t):Rd(e,t)}function Bd(e,t,n,r){return zd(J(e,t,n),r)}function Vd(e,t={}){return O(`ReturnType`,[e],t)}function Hd(e){return At(e)?e.returnType:A()}function Ud(e,t){return q([e])?E(Hd(e),{},t):Vd(e,t)}function Wd(e,t,n,r={}){return Ud(J(e,t,n),r)}function Gd(e,t){return O(`With`,[e,t],{})}function Kd(e,t){return qd(e,t)}function qd(e,t){return q([e])?E(e,{},t):Gd(e,t)}function Jd(e,t,n,r){return qd(J(e,t,n),r)}function Yd(e){return Ri(e)?B(e.items)?Xd(e.items.items):Zt(e.items)||Nt(e.items)?[e]:[A()]:[e]}function Xd(e){return e.reduce((e,t)=>[...e,...Yd(t)],[])}function Zd(e,t){return{callstack:e,visited:t}}function q(e){return S(e,(e,t)=>!Nt(e)&&q(t),()=>!0)}function Qd(e,t,n){return w(n).reduce((r,i)=>({...r,[i]:J(e,t,n[i])}),{})}function $d(e,t,n){return Xd(ef(e,t,n))}function ef(e,t,n){return n.map(n=>J(e,t,n))}function tf(e,t){let n=Vt(e)?St(t,{}):t,r=Ln(e)?yt(n,{}):n;return Fn(e)?sf(r,{}):r}function nf(e,t,n,r,i){return x(n,`AddImmutable`)?cf(e,t,r[0],i):x(n,`RemoveImmutable`)?Pc(e,t,r[0],i):x(n,`AddReadonly`)?bt(e,t,r[0],i):x(n,`RemoveReadonly`)?jr(e,t,r[0],i):x(n,`AddOptional`)?Ct(e,t,r[0],i):x(n,`RemoveOptional`)?Fr(e,t,r[0],i):x(n,`Capitalize`)?Qc(e,t,r[0],i):x(n,`Conditional`)?al(e,t,r[0],r[1],r[2],r[3],i):x(n,`ConstructorParameters`)?ll(e,t,r[0],i):x(n,`Evaluate`)?ic(e,t,r[0],i):x(n,`Exclude`)?fl(e,t,r[0],r[1],i):x(n,`Extract`)?vl(e,t,r[0],r[1],i):x(n,`Index`)?fu(e,t,r[0],r[1],i):x(n,`InstanceType`)?gu(e,t,r[0],i):x(n,`Interface`)?Cs(e,t,r[0],r[1],i):x(n,`KeyOf`)?Du(e,t,r[0],i):x(n,`Lowercase`)?$c(e,t,r[0],i):x(n,`Mapped`)?Vu(e,t,r[0],r[1],r[2],r[3],i):x(n,`Module`)?Gu(e,t,r[0],i):x(n,`NonNullable`)?Yu(e,t,r[0],i):x(n,`Pick`)?yd(e,t,r[0],r[1],i):x(n,`Parameters`)?ad(e,t,r[0],i):x(n,`Partial`)?md(e,t,r[0],i):x(n,`Omit`)?td(e,t,r[0],r[1],i):x(n,`ReadonlyObject`)?Ad(e,t,r[0],i):x(n,`Record`)?Ti(e,t,r[0],r[1],i):x(n,`Required`)?Bd(e,t,r[0],i):x(n,`ReturnType`)?Wd(e,t,r[0],i):x(n,`TemplateLiteral`)?Ja(e,t,r[0],i):x(n,`Uncapitalize`)?el(e,t,r[0],i):x(n,`Uppercase`)?tl(e,t,r[0],i):x(n,`With`)?Jd(e,t,r[0],r[1]):O(n,r,i)}function rf(e,t,n){return tf(n,Nt(n)?jd(e,t,n,n.$ref):k(n)?wt(J(e,t,n.items),Tt(n)):jc(n)?kc(e,t,n.target,n.arguments):Dt(n)?Et(ef(e,t,n.parameters),J(e,t,n.instanceType),Ot(n)):At(n)?kt(ef(e,t,n.parameters),J(e,t,n.returnType),jt(n)):$t(n)?Qt(J(e,t,n.if),J(e,t,n.then),J(e,t,n.else),en(n)):N(n)?nn(ef(e,t,n.allOf),rn(n)):M(n)?j(Qd(e,t,n.properties),Gt(n)):Ii(n)?ji(Ni(n),J(e,t,Fi(n))):Ri(n)?Li(J(e,t,n.items)):B(n)?Dr($d(e,t,n.items),Or(n)):z(n)?R(ef(e,t,n.anyOf),or(n)):n)}function J(e,t,n){return _t(n)?nf(e,t,n.action,n.parameters,n.options):rf(e,t,n)}function af(e,t){return J(e,Zd([],[]),t)}function of(e){return E(e,{"~immutable":!0},{})}function sf(e,t){return E(of(e),{},t)}function cf(e,t,n,r){return sf(J(e,t,n),r)}function lf(e,t={}){return sf(e,t)}function uf(e,t={}){return rc(e,t)}function df(e,t){let n=Zs(e,t);return x(n,`right-inside`)?1:+!!x(n,`disjoint`)}function ff(e,t,n=[]){return S(t,(r,i)=>x(df(e,r),1)?ff(e,i,[...n,r]):[...n,e,...t],()=>[...n,e])}function pf(e,t=[]){return S(e,(e,n)=>pf(n,ff(e,t)),()=>t)}function mf(e){return pf(e)}function hf(e,t){try{return Promise.resolve(t(gf))}catch(e){return Promise.reject(e)}}const gf={startSpan:hf,addEvent:()=>{},setAttributes:()=>{},setStatus:()=>{}};Object.freeze(gf);const _f=Symbol.for(`yaml.alias`),vf=Symbol.for(`yaml.document`),yf=Symbol.for(`yaml.map`),bf=Symbol.for(`yaml.pair`),xf=Symbol.for(`yaml.scalar`),Sf=Symbol.for(`yaml.seq`),Cf=Symbol.for(`yaml.node.type`),wf=e=>!!e&&typeof e==`object`&&e[Cf]===_f,Tf=e=>!!e&&typeof e==`object`&&e[Cf]===vf,Ef=e=>!!e&&typeof e==`object`&&e[Cf]===yf,Y=e=>!!e&&typeof e==`object`&&e[Cf]===bf,X=e=>!!e&&typeof e==`object`&&e[Cf]===xf,Df=e=>!!e&&typeof e==`object`&&e[Cf]===Sf;function Of(e){if(e&&typeof e==`object`)switch(e[Cf]){case yf:case Sf:return!0}return!1}function Z(e){if(e&&typeof e==`object`)switch(e[Cf]){case _f:case yf:case xf:case Sf:return!0}return!1}const kf=e=>(X(e)||Of(e))&&!!e.anchor,Af=Symbol(`break visit`),jf=Symbol(`skip children`),Mf=Symbol(`remove node`);function Nf(e,t){let n=Ff(t);Tf(e)?Pf(null,e.contents,n,Object.freeze([e]))===Mf&&(e.contents=null):Pf(null,e,n,Object.freeze([]))}Nf.BREAK=Af,Nf.SKIP=jf,Nf.REMOVE=Mf;function Pf(e,t,n,r){let i=If(e,t,n,r);if(Z(i)||Y(i))return Lf(e,r,i),Pf(e,i,n,r);if(typeof i!=`symbol`){if(Of(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=Pf(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Af)return Af;else i===Mf&&(t.items.splice(e,1),--e)}}else if(Y(t)){r=Object.freeze(r.concat(t));let e=Pf(`key`,t.key,n,r);if(e===Af)return Af;e===Mf&&(t.key=null);let i=Pf(`value`,t.value,n,r);if(i===Af)return Af;i===Mf&&(t.value=null)}}return i}function Ff(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function If(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Ef(t))return n.Map?.(e,t,r);if(Df(t))return n.Seq?.(e,t,r);if(Y(t))return n.Pair?.(e,t,r);if(X(t))return n.Scalar?.(e,t,r);if(wf(t))return n.Alias?.(e,t,r)}function Lf(e,t,n){let r=t[t.length-1];if(Of(r))r.items[e]=n;else if(Y(r))e===`key`?r.key=n:r.value=n;else if(Tf(r))r.contents=n;else{let e=wf(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function Rf(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function zf(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=zf(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=zf(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=zf(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=zf(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function Bf(e,t,n){if(Array.isArray(e))return e.map((e,t)=>Bf(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!kf(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var Vf=class{constructor(e){Object.defineProperty(this,Cf,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Tf(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=Bf(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?zf(i,{"":o},``,o):o}},Hf=class extends Vf{constructor(e){super(_f),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Nf(e,{Node:(e,t)=>{(wf(t)||kf(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(Bf(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=Uf(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(Rf(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function Uf(e,t,n){if(wf(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(Of(t)){let r=0;for(let i of t.items){let t=Uf(e,i,n);t>r&&(r=t)}return r}if(Y(t)){let r=Uf(e,t.key,n),i=Uf(e,t.value,n);return Math.max(r,i)}return 1}const Wf=e=>!e||typeof e!=`function`&&typeof e!=`object`;var Q=class extends Vf{constructor(e){super(xf),this.value=e}toJSON(e,t){return t?.keep?this.value:Bf(this.value,e,t)}toString(){return String(this.value)}};Q.BLOCK_FOLDED=`BLOCK_FOLDED`,Q.BLOCK_LITERAL=`BLOCK_LITERAL`,Q.PLAIN=`PLAIN`,Q.QUOTE_DOUBLE=`QUOTE_DOUBLE`,Q.QUOTE_SINGLE=`QUOTE_SINGLE`;function Gf(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function Kf(e,t,n){if(Tf(e)&&(e=e.contents),Z(e))return e;if(Y(e)){let t=n.schema[yf].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new Hf(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=`tag:yaml.org,2002:`+t.slice(2));let l=Gf(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new Q(e);return c&&(c.node=t),t}l=e instanceof Map?o[yf]:Symbol.iterator in Object(e)?o[Sf]:o[yf]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new Q(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function qf(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return Kf(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}const Jf=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;var Yf=class extends Vf{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>Z(t)||Y(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Jf(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(Of(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,qf(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(Of(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&X(i)?i.value:i:Of(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!Y(t))return!1;let n=t.value;return n==null||e&&X(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return Of(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(Of(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,qf(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};const Xf=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function Zf(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Qf=(e,t,n)=>e.endsWith(`
|
|
4
|
-
`)?Zf(n,t):n.includes(`
|
|
5
|
-
`)?`
|
|
6
|
-
`+Zf(n,t):(e.endsWith(` `)?``:` `)+n,$f=`flow`;function ep(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=tp(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
|
|
7
|
-
`)n===`block`&&(h=tp(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
|
|
8
|
-
`&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
|
|
9
|
-
`&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function tp(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
|
|
10
|
-
`);r=t,i=t+1,a=e[i]}return r}const np=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),rp=e=>/^(%|---|\.\.\.)/m.test(e);function ip(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
|
|
11
|
-
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function ap(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(rp(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
|
|
12
|
-
|
|
13
|
-
`;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
|
|
14
|
-
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:ep(o,a,`quoted`,np(t,!1))}function op(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
15
|
-
`)||/[ \t]\n|\n[ \t]/.test(e))return ap(e,t);let n=t.indent||(rp(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:ep(r,n,$f,np(t,!1))}function sp(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=ap;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?op:i&&!t?ap:n?op:ap}return r(e,t)}let cp;try{cp=RegExp(`(^|(?<!
|
|
16
|
-
))
|
|
17
|
-
+(?!
|
|
18
|
-
|$)`,`g`)}catch{cp=/\n+(?!\n|$)/g}function lp({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return sp(n,r);let l=r.indent||(r.forceBlockIndent||rp(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===Q.BLOCK_FOLDED?!1:t===Q.BLOCK_LITERAL||!ip(n,c,l.length);if(!n)return u?`|
|
|
19
|
-
`:`>
|
|
20
|
-
`;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
|
|
21
|
-
`&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
|
|
22
|
-
`);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
|
|
23
|
-
`&&(p=p.slice(0,-1)),p.replace(cp,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
|
|
24
|
-
`)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
|
|
25
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=np(r,!0);o!==`folded`&&t!==Q.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=ep(`${v}${e}${p}`,l,`block`,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function up(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
|
|
26
|
-
`)||u&&/[[\]{},]/.test(a))return sp(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
|
|
27
|
-
`)?sp(a,t):lp(e,t,n,r);if(!s&&!u&&i!==Q.PLAIN&&a.includes(`
|
|
28
|
-
`))return lp(e,t,n,r);if(rp(a)){if(c===``)return t.forceBlockIndent=!0,lp(e,t,n,r);if(s&&c===l)return sp(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return sp(a,t)}return s?d:ep(d,c,$f,np(t,!1))}function dp(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==Q.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=Q.QUOTE_DOUBLE);let c=e=>{switch(e){case Q.BLOCK_FOLDED:case Q.BLOCK_LITERAL:return i||a?sp(o.value,t):lp(o,t,n,r);case Q.QUOTE_DOUBLE:return ap(o.value,t);case Q.QUOTE_SINGLE:return op(o.value,t);case Q.PLAIN:return up(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function fp(e,t){let n=Object.assign({blockQuote:!0,commentString:Xf,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function pp(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(X(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function mp(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(X(e)||Of(e))&&e.anchor;a&&Rf(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function hp(e,t,n,r){if(Y(e))return e.toString(t,n,r);if(wf(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=Z(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=pp(t.doc.schema.tags,a);let o=mp(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):X(a)?dp(a,t,n,r):a.toString(t,n,r);return o?X(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function gp({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=Z(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(Of(e)||!Z(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||Of(e)||(X(e)?e.type===Q.BLOCK_FOLDED||e.type===Q.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=hp(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=Qf(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Qf(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=Qf(g,n.indent,l(f))));let _,v,y;Z(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&X(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Df(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let ee=!1,te=hp(t,n,()=>ee=!0,()=>h=!0),ne=` `;if(f||_||v){if(ne=_?`
|
|
29
|
-
`:``,v){let e=l(v);ne+=`\n${Zf(e,n.indent)}`}te===``&&!n.inFlow?ne===`
|
|
30
|
-
`&&y&&(ne=`
|
|
31
|
-
|
|
32
|
-
`):ne+=`\n${n.indent}`}else if(!p&&Of(t)){let e=te[0],r=te.indexOf(`
|
|
33
|
-
`),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=te.indexOf(` `);e===`&`&&n!==-1&&n<r&&te[n+1]===`!`&&(n=te.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(ne=`\n${n.indent}`)}}else(te===``||te[0]===`
|
|
34
|
-
`)&&(ne=``);return g+=ne+te,n.inFlow?ee&&r&&r():y&&!ee?g+=Qf(g,n.indent,l(y)):h&&i&&i(),g}function _p(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}const vp={identify:e=>e===`<<`||typeof e==`symbol`&&e.description===`<<`,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new Q(Symbol(`<<`)),{addToJSMap:bp}),stringify:()=>`<<`},yp=(e,t)=>(vp.identify(t)||X(t)&&(!t.type||t.type===Q.PLAIN)&&vp.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===vp.tag&&e.default);function bp(e,t,n){let r=Sp(e,n);if(Df(r))for(let n of r.items)xp(e,t,n);else if(Array.isArray(r))for(let n of r)xp(e,t,n);else xp(e,t,r)}function xp(e,t,n){let r=Sp(e,n);if(!Ef(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function Sp(e,t){return e&&wf(t)?t.resolve(e.doc,e):t}function Cp(e,t,{key:n,value:r}){if(Z(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(yp(e,n))bp(e,t,r);else{let i=Bf(n,``,e);if(t instanceof Map)t.set(i,Bf(r,i,e));else if(t instanceof Set)t.add(i);else{let a=wp(n,i,e),o=Bf(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function wp(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(Z(e)&&n?.doc){let t=fp(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),_p(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function Tp(e,t,n){return new Ep(Kf(e,void 0,n),Kf(t,void 0,n))}var Ep=class e{constructor(e,t=null){Object.defineProperty(this,Cf,{value:bf}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return Z(n)&&(n=n.clone(t)),Z(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Cp(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?gp(this,e,t,n):JSON.stringify(this)}};function Dp(e,t,n){return(t.inFlow??e.flow?kp:Op)(e,t,n)}function Op({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(Z(i))!d&&i.spaceBefore&&f.push(``),Ap(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(Y(i)){let e=Z(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),Ap(n,f,e.commentBefore,d))}d=!1;let s=hp(i,u,()=>o=null,()=>d=!0);o&&(s+=Qf(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
|
|
35
|
-
`}}return e?(p+=`
|
|
36
|
-
`+Zf(l(e),c),s&&s()):d&&o&&o(),p}function kp({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(Z(i))i.spaceBefore&&d.push(``),Ap(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(Y(i)){let e=Z(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),Ap(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=Z(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=hp(i,c,()=>a=null);l||=d.length>u||o.includes(`
|
|
37
|
-
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=Qf(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
|
|
38
|
-
`;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function Ap({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=Zf(t(r),e);n.push(i.trimStart())}}function jp(e,t){let n=X(t)?t.value:t;for(let r of e)if(Y(r)&&(r.key===t||r.key===n||X(r.key)&&r.key.value===n))return r}var Mp=class extends Yf{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(yf,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Tp(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=Y(e)?e:!e||typeof e!=`object`||!(`key`in e)?new Ep(e,e?.value):new Ep(e.key,e.value);let r=jp(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);X(r.value)&&Wf(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=jp(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=jp(this.items,e)?.value;return(!t&&X(n)?n.value:n)??void 0}has(e){return!!jp(this.items,e)}set(e,t){this.add(new Ep(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)Cp(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!Y(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Dp(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}};const Np={collection:`map`,default:!0,nodeClass:Mp,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Ef(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>Mp.from(e,t,n)};var Pp=class extends Yf{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(Sf,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Fp(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=Fp(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&X(r)?r.value:r}has(e){let t=Fp(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=Fp(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];X(r)&&Wf(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(Bf(e,String(r++),t));return n}toString(e,t,n){return e?Dp(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(Kf(a,void 0,n))}}return i}};function Fp(e){let t=X(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}const Ip={collection:`seq`,default:!0,nodeClass:Pp,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Df(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Pp.from(e,t,n)};function Lp(e){return typeof e==`bigint`||Number.isInteger(e)}const Rp=({value:e})=>JSON.stringify(e),zp=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Rp},{identify:e=>e==null,createNode:()=>new Q(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Rp},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Rp},{identify:Lp,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Lp(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Rp}];[Np,Ip].concat(zp,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function Bp(e,t,n){let{replacer:r}=n,i=new Pp(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Tp(o,s,n))}return i}var Vp=class e extends Pp{constructor(){super(),this.add=Mp.prototype.add.bind(this),this.delete=Mp.prototype.delete.bind(this),this.get=Mp.prototype.get.bind(this),this.has=Mp.prototype.has.bind(this),this.set=Mp.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(Y(e)?(r=Bf(e.key,``,t),i=Bf(e.value,r,t)):r=Bf(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Bp(e,t,n),i=new this;return i.items=r.items,i}};Vp.tag=`tag:yaml.org,2002:omap`;var Hp=class e extends Mp{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=Y(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new Ep(e.key,null):new Ep(e,null),jp(this.items,t.key)||this.items.push(t)}get(e,t){let n=jp(this.items,e);return!t&&Y(n)?X(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=jp(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Ep(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Tp(e,null,n));return i}};Hp.tag=`tag:yaml.org,2002:set`;const Up=Symbol(`break visit`),Wp=Symbol(`skip children`),Gp=Symbol(`remove item`);function Kp(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),qp(Object.freeze([]),e,t)}Kp.BREAK=Up,Kp.SKIP=Wp,Kp.REMOVE=Gp,Kp.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Kp.parentCollection=(e,t)=>{let n=Kp.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function qp(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=qp(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Up)return Up;else r===Gp&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}t(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}let r=/^\s+$/,i=/(?:[^\\]|^)\\$/,a=/^\\!/,o=/^\\#/,s=/\r?\n/g,c=/^\.{0,2}\/|^\.{1,2}$/,l=/\/$/,u=`node-ignore`;typeof Symbol<`u`&&(u=Symbol.for(`node-ignore`));let d=u,f=(e,t,n)=>(Object.defineProperty(e,t,{value:n}),n),p=/([0-z])-([0-z])/g,m=()=>!1,h=e=>e.replace(p,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:``),g=e=>{let{length:t}=e;return e.slice(0,t-t%2)},_=[[/^\uFEFF/,()=>``],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`],[/\\\\/g,()=>`\\`],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===`\\`?`\\[${n}${g(r)}${i}`:i===`]`&&r.length%2==0?`[${h(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`]],v=/(^|\\\/)?\\\*$/,y=`regex`,ee=`checkRegex`,te={[y](e,t){return`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`},[ee](e,t){return`${t?`${t}[^/]*`:`[^/]*`}(?=$|\\/$)`}},ne=e=>_.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),re=e=>typeof e==`string`,ie=e=>e&&re(e)&&!r.test(e)&&!i.test(e)&&e.indexOf(`#`)!==0,ae=e=>e.split(s).filter(Boolean);var oe=class{constructor(e,t,n,r,i,a){this.pattern=e,this.mark=t,this.negative=i,f(this,`body`,n),f(this,`ignoreCase`,r),f(this,`regexPrefix`,a)}get regex(){let e=`_regex`;return this[e]?this[e]:this._make(y,e)}get checkRegex(){let e=`_checkRegex`;return this[e]?this[e]:this._make(ee,e)}_make(e,t){let n=this.regexPrefix.replace(v,te[e]),r=this.ignoreCase?new RegExp(n,`i`):new RegExp(n);return f(this,t,r)}};let se=({pattern:e,mark:t},n)=>{let r=!1,i=e;i.indexOf(`!`)===0&&(r=!0,i=i.substr(1)),i=i.replace(a,`!`).replace(o,`#`);let s=ne(i);return new oe(e,t,i,n,r,s)};var ce=class{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[d]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(re(e)&&(e={pattern:e}),ie(e.pattern)){let t=se(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(re(e)?ae(e):e).forEach(this._add,this),this._added}test(e,t,n){let r=!1,i=!1,a;this._rules.forEach(o=>{let{negative:s}=o;i===s&&r!==i||s&&!r&&!i&&!t||o[n].test(e)&&(r=!s,i=s,a=s?void 0:o)});let o={ignored:r,unignored:i};return a&&(o.rule=a),o}};let le=(e,t)=>{throw new t(e)},ue=(e,t,n)=>re(e)?e?!ue.isNotRelative(e)||n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),de=e=>c.test(e);ue.isNotRelative=de,ue.convert=e=>e;var fe=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){f(this,d,!0),this._rules=new ce(t),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,t,n,r){let i=e&&ue.convert(e);return ue(i,e,this._strictPathCheck?le:m),this._t(i,t,n,r)}checkIgnore(e){if(!l.test(e))return this.test(e);let t=e.split(`/`).filter(Boolean);if(t.pop(),t.length){let e=this._t(t.join(`/`)+`/`,this._testCache,!0,t);if(e.ignored)return e}return this._rules.test(e,!1,ee)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(`/`).filter(Boolean),r.pop(),!r.length)return t[e]=this._rules.test(e,n,y);let i=this._t(r.join(`/`)+`/`,t,n,r);return t[e]=i.ignored?i:this._rules.test(e,n,y)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};let pe=e=>new fe(e),me=e=>ue(e&&ue.convert(e),e,m),he=()=>{ue.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;ue.isNotRelative=t=>e.test(t)||de(t)};typeof process<`u`&&process.platform===`win32`&&he(),t.exports=pe,pe.default=pe,t.exports.isPathValid=me,f(t.exports,Symbol.for(`setupWindows`),he)}))();const Jp={"pi.session.id":{type:`string`,required:!0,cardinality:`high`,description:`Session id`},"pi.lane.name":{type:`string`,required:!0,cardinality:`high`,description:`Lane name`},"pi.operation.id":{type:`string`,required:!0,cardinality:`high`,description:`Durable operation id`},"pi.operation.recovery":{type:`boolean`,required:!0,description:`Whether this invocation resumes durable work`}},Yp={"pi.error.code":{type:`string`,cardinality:`low`,description:`Stable operation error code`},"pi.error.type":{type:`string`,cardinality:`low`,description:`Low-cardinality operation error class`}};({...Jp}),{...Yp},{...Jp},{...Yp},{...Jp},{...Yp},globalThis.Buffer,j({command:ir({description:`Bash command to execute`}),timeout:Bt(er({description:`Timeout in seconds (optional, no default timeout)`}))});const Xp=j({oldText:ir({description:`Exact text for one targeted replacement. It must be unique in the original file and must not overlap with any other edits[].oldText in the same call.`}),newText:ir({description:`Replacement text for this targeted edit.`})},{});j({path:ir({description:`Path to the file to edit (relative or absolute)`}),edits:wt(Xp,{description:`One or more targeted replacements. Each edit is matched against the original file, not incrementally. Do not include overlapping or nested edits. If two changes touch the same block or nearby lines, merge them into one edit instead.`})},{}),j({path:ir({description:`Path to the file to read (relative or absolute)`}),offset:Bt(er({description:`Line number to start reading from (1-indexed)`})),limit:Bt(er({description:`Maximum number of lines to read`}))}),j({path:ir({description:`Path to the file to write (relative or absolute)`}),content:ir({description:`Content to write to the file`})});const Zp={enabled:!0,reserveTokens:16384,keepRecentTokens:2e4};function Qp(e,t,n){return n.enabled?e>t-n.reserveTokens:!1}function $p(e){if(typeof e==`string`)return e.length;let t=0;for(let n of e)n.type===`text`&&n.text?t+=n.text.length:n.type===`image`&&(t+=4800);return t}function em(e){let t=0;switch(e.role){case`user`:return t=$p(e.content),Math.ceil(t/4);case`assistant`:{let n=e;for(let e of n.content)e.type===`text`?t+=e.text.length:e.type===`thinking`?t+=e.thinking.length:e.type===`toolCall`&&(t+=e.name.length+JSON.stringify(e.arguments).length);return Math.ceil(t/4)}case`custom`:case`toolResult`:return t=$p(e.content),Math.ceil(t/4);case`bashExecution`:return t=e.command.length+e.output.length,Math.ceil(t/4);case`branchSummary`:case`compactionSummary`:return t=e.summary.length,Math.ceil(t/4)}return 0}const $=n(`context-compaction`);function tm(e,t){return e.role===t}function nm(e){let t=0;for(;t<e.length&&tm(e[t],`toolResult`);){let n=e[t];$.warn(`Dropping orphaned toolResult (no preceding assistant message)`,{toolCallId:n.toolCallId}),t++}return t>0?e.slice(t):e}function rm(e){let t=[];for(let n of e){let e=n;switch(e.role){case`user`:t.push(`<user>\n${im(e.content)}\n</user>`);break;case`assistant`:t.push(`<assistant>\n${im(e.content)}\n</assistant>`);break;case`toolResult`:{let n=e.toolName??`tool`;t.push(`<tool-result name="${n}">\n${im(e.content)}\n</tool-result>`);break}case`bashExecution`:t.push(`<bash>\n$ ${e.command??``}\n${e.output??``}\n</bash>`);break;case`branchSummary`:case`compactionSummary`:t.push(`<prior-summary>\n${e.summary??``}\n</prior-summary>`);break;default:t.push(`<${e.role}>\n${im(e.content)}\n</${e.role}>`)}}return t.join(`
|
|
39
|
-
|
|
40
|
-
`)}function im(e){if(typeof e==`string`)return e;if(!Array.isArray(e))return``;let t=[];for(let n of e){let e=n;e.type===`text`&&e.text?t.push(e.text):e.type===`thinking`&&e.thinking?t.push(`[thinking] ${e.thinking}`):e.type===`toolCall`?t.push(`[tool-call ${e.name??`?`}] ${JSON.stringify(e.arguments??{})}`):e.type===`image`&&t.push(`[image]`)}return t.join(`
|
|
41
|
-
`)}function am(e){return`You are a context compaction assistant. You are shown the prefix of a conversation between a user and an AI coding assistant, and asked to produce either a structured summary, durable memory bullets, or a short title — depending on the user's instruction.
|
|
42
|
-
|
|
43
|
-
Do NOT continue the conversation. Do NOT answer questions inside the conversation. Output ONLY what the user asks for in the format specified.
|
|
44
|
-
|
|
45
|
-
<conversation>
|
|
46
|
-
${e}
|
|
47
|
-
</conversation>`}async function om(e,t,n,r,i,a,o){let s=await l(e,{systemPrompt:n,messages:[{role:`user`,content:[{type:`text`,text:r}],timestamp:Date.now()}]},{maxTokens:i,apiKey:t,headers:a,signal:o});if(s.stopReason===`error`)throw Error(`Compaction call failed: ${s.errorMessage||`Unknown error`}`);return s.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
48
|
-
`).trim()}function sm(e){if(typeof e==`string`)return e.length;if(!Array.isArray(e))return 0;let t=0;for(let n of e){let e=n;if(e.type===`text`&&e.text)t+=e.text.length;else if(e.type===`thinking`&&e.thinking)t+=e.thinking.length;else if(e.type===`toolCall`&&e.arguments!==void 0)try{t+=JSON.stringify(e.arguments).length}catch{}else e.type===`image`&&e.source?.data&&(t+=e.source.data.length)}return t}function cm(e,t){let n=Math.max(1,Math.round(e/1024));return`[${t===`assistant`?`Assistant message elided`:`Tool result elided`}: ${n} KB, exceeds half the context window. Re-run with smaller arguments — e.g. open --view --size low.]`}function lm(e){let t=e.role,n=e.content,r=sm(n);if(t===`toolResult`)return{...e,content:[{type:`text`,text:cm(r,t)}]};let i=(Array.isArray(n)?n.filter(e=>e.type===`toolCall`):[]).map(e=>{let t=0;if(e.arguments!==void 0)try{t=JSON.stringify(e.arguments).length}catch{}return{type:e.type,id:e.id,name:e.name,arguments:{elided:!0,originalBytes:t}}});return{...e,content:[{type:`text`,text:cm(r,t)},...i]}}function um(e,t,n){let r=(t-n)/2,i=0,a=0;return{messages:e.map(e=>{if(em(e)<=r)return e;let t=e.role;if(t!==`toolResult`&&t!==`assistant`)return e;let n=e,o=sm(n.content);return t===`toolResult`?(i++,a+=o,lm(e)):(Array.isArray(n.content)?n.content:[]).filter(e=>e.type===`toolCall`).length===0?e:(i++,a+=o,lm(e))}),elidedCount:i,elidedBytes:a}}function dm(e,t,n){let r=0,i=0,a=um(e.map(e=>{let t=gm(e);return t!==e&&(r++,i+=sm(e.content)-sm(t.content)),t}),t,n);return{messages:a.messages,elidedCount:r+a.elidedCount,elidedBytes:i+a.elidedBytes}}function fm(e){let t=0;for(let n of e)t+=em(n);return t}function pm(e,t){return e.length!==t.length||e.some((e,n)=>e!==t[n])}function mm(e,t){try{e.onCompactionStateChange?.(t)}catch(e){$.warn(`onCompactionStateChange listener threw`,{error:e instanceof Error?e.message:String(e)})}}function hm(e,t,n,r,i,a){let o=um(e,n,r),s=o.messages,c=o.elidedCount,l=o.elidedBytes,u=c>0?fm(s):t,d=u>n*i;if(d){let e=dm(s,n,r);s=e.messages,c+=e.elidedCount,l+=e.elidedBytes}if(!d&&c===0)return{messages:e,isHopeless:!1,earlyReturn:null};$.warn(`Compaction oversized-message elision`,{totalTokens:t,postSizeTokens:u,contextWindow:n,isHopeless:d,elidedCount:c,elidedBytes:l});let f=Qp(fm(s),n,a)?null:vm([],s,n,a);return{messages:s,isHopeless:d,earlyReturn:f}}function gm(e){let t=e.content;if(!Array.isArray(t))return e;let n=!1,r=t.map(e=>{let t=e;return t.type===`image`?(n=!0,{type:`text`,text:`[image elided during compaction: ~${Math.max(1,Math.round((t.source?.data??t.data??``).length/1024))} KB. Re-attach or re-read the image if it is still needed.]`}):e});return n?{...e,content:r}:e}function _m(e){for(let t=e.length-1;t>=0;t--)if(tm(e[t],`user`))return t;return-1}function vm(e,t,n,r){let i=_m(t),a=t.map((e,t)=>i!==-1&&t>=i?e:gm(e));if(Qp(fm([...e,...a]),n,r))for(let t=0;t<a.length;t++){let i=gm(a[t]);if(i!==a[t]&&(a=[...a.slice(0,t),i,...a.slice(t+1)],!Qp(fm([...e,...a]),n,r)))break}return a}function ym(e,t){let n=0,r=e.length;for(let i=e.length-1;i>=0;i--){let a=em(e[i]);if(n+a>t&&r<e.length)break;n+=a,r=i}for(;r>0&&tm(e[r],`toolResult`);)r--;return r<=0||r>=e.length?($.warn(`Cannot find valid cut point for compaction`),null):{messagesToSummarize:e.slice(0,r),messagesToKeep:nm(e.slice(r))}}async function bm(e,t,n,r){if(!(!e.onMemoryUpdates||e.shouldExtractMemories?.()===!1))try{mm(e,`extracting-memory`);let i=await om(e.model,t,n,`From the conversation above, extract durable memories worth persisting to a global memory file shared across future sessions.
|
|
49
|
-
|
|
50
|
-
Focus on:
|
|
51
|
-
- User preferences, working style, opinions stated explicitly.
|
|
52
|
-
- Stable project facts (architecture decisions, conventions, constraints).
|
|
53
|
-
- Validated approaches the user accepted ("yes, exactly", "perfect"), not just corrections.
|
|
54
|
-
- External resources/links the user named.
|
|
55
|
-
|
|
56
|
-
DO NOT include:
|
|
57
|
-
- Ephemeral state (current task, in-progress work).
|
|
58
|
-
- Information already obvious from the codebase (file paths, function names, framework conventions).
|
|
59
|
-
- Generic restatements of what the conversation was about.
|
|
60
|
-
|
|
61
|
-
If nothing in the conversation is worth persisting, return exactly the single line:
|
|
62
|
-
NONE
|
|
63
|
-
|
|
64
|
-
Otherwise, output ONLY a markdown bullet list (one bullet per memory), no headers, no preamble, no follow-up. Each bullet is one line. Be specific. Prefer one fact per bullet over multi-clause sentences.`,2048,e.headers,r);if(i?.trim()&&i.trim()!==`NONE`)try{await e.onMemoryUpdates(i.trim()),$.info(`Memory extraction applied`,{bulletsLength:i.length})}catch(e){$.warn(`onMemoryUpdates callback threw`,{error:e instanceof Error?e.message:String(e)})}else $.info(`Memory extraction returned no durable memories`)}catch(e){$.warn(`Memory extraction call failed (compaction still applied)`,{error:e instanceof Error?e.message:String(e)})}}async function xm(e,t,n,r,i,a,o,s){try{let c=um(n,a,i).messages,l=am(rm(c)),u=Math.floor(.8*i);mm(e,`summarizing`);let d=await om(e.model,t,l,`Produce a structured context checkpoint summary of the conversation above that another LLM can use to continue the work.
|
|
65
|
-
|
|
66
|
-
Use this EXACT format:
|
|
67
|
-
|
|
68
|
-
## Goal
|
|
69
|
-
[What is the user trying to accomplish? Can be multiple items if the session covers different tasks.]
|
|
70
|
-
|
|
71
|
-
## Constraints & Preferences
|
|
72
|
-
- [Any constraints, preferences, or requirements mentioned by user]
|
|
73
|
-
- [Or "(none)" if none were mentioned]
|
|
74
|
-
|
|
75
|
-
## Progress
|
|
76
|
-
### Done
|
|
77
|
-
- [x] [Completed tasks/changes]
|
|
78
|
-
|
|
79
|
-
### In Progress
|
|
80
|
-
- [ ] [Current work]
|
|
81
|
-
|
|
82
|
-
### Blocked
|
|
83
|
-
- [Issues preventing progress, if any]
|
|
84
|
-
|
|
85
|
-
## Key Decisions
|
|
86
|
-
- **[Decision]**: [Brief rationale]
|
|
87
|
-
|
|
88
|
-
## Next Steps
|
|
89
|
-
1. [Ordered list of what should happen next]
|
|
90
|
-
|
|
91
|
-
## Critical Context
|
|
92
|
-
- [Any data, examples, or references needed to continue]
|
|
93
|
-
- [Or "(none)" if not applicable]
|
|
94
|
-
|
|
95
|
-
Keep each section concise. Preserve exact file paths, function names, and error messages. Output ONLY the summary, with no preamble or follow-up.`,u,e.headers,s),f={role:`user`,content:[{type:`text`,text:`<context-summary>\n${d}\n</context-summary>`}],timestamp:Date.now()};return $.info(`LLM summarization successful`,{originalMessages:o,compactedMessages:1+r.length,summaryLength:d.length}),await bm(e,t,l,s),mm(e,`idle`),[f,...r]}catch(e){return $.warn(`LLM summarization failed, falling back to naive drop`,{error:e instanceof Error?e.message:String(e)}),null}}function Sm(e){let t=e.contextWindow??2e5,n=e.reserveTokens??Zp.reserveTokens,r=e.keepRecentTokens??Zp.keepRecentTokens,i=e.hopelessMultiplier??4,a={enabled:!0,reserveTokens:n,keepRecentTokens:r};return async(o,s,c)=>{if(o.length===0)return o;let l=fm(o);if(!c?.force&&!Qp(l,t,a))return o;let u=hm(o,l,t,n,i,a);if(u.earlyReturn)return u.earlyReturn;let d=u.messages,f=u.isHopeless;$.info(`Context compaction triggered`,{totalTokens:l,contextWindow:t,threshold:t-n,messageCount:d.length});let p=ym(d,r);if(!p)return d;let{messagesToSummarize:m,messagesToKeep:h}=p;$.info(`Compaction cut point`,{summarizing:m.length,keeping:h.length});let g=f?void 0:e.getApiKey();if(g){let r=await xm(e,g,m,h,n,t,o.length,s);if(r){let[e,...n]=r;return[e,...vm([e],n,t,a)]}}else f||$.warn(`No API key available for LLM summarization, falling back to naive drop`);mm(e,`fallback`),mm(e,`idle`);let _={role:`user`,content:[{type:`text`,text:`[Earlier conversation messages were compacted to save context space]`}],timestamp:Date.now()},v=vm([_],h,t,a);return $.info(`Naive compaction applied`,{originalMessages:o.length,compactedMessages:1+v.length}),[_,...v]}}function Cm(){return a()?`extension-direct`:s()?`extension-delegate`:globalThis.__slicc_connect_mode?`connect`:`node-rest`}function wm(){return Cm()===`node-rest`}const Tm=u({portName:`secrets.crud`,panelRpcOp:`secrets-bridge`,timeoutMs:1e4,onUnavailable:`resolve-undefined`,makeError:e=>Error(e),logNamespace:`secrets-bridge`,toPortMessage:({type:e,payload:t})=>({type:e,...t}),toPanelRpcPayload:({type:e,payload:t})=>({type:e,payload:t})});function Em(e,t){return Tm({type:e,payload:t})}const Dm=n(`secret-scrub`),Om=`[tool output withheld: secret scrub unavailable]`,km=async e=>e;function Am(){let e=Cm();return e===`extension-direct`?async e=>{if(!e)return e;try{let t=await new Promise(t=>{chrome.runtime.sendMessage({type:`secrets.scrub-tool-result`,text:e},e=>t(e??{}))});return t.error?(Dm.debug(`SW scrub-tool-result returned error`),Om):typeof t.text==`string`?t.text:Om}catch{return Dm.debug(`SW scrub-tool-result failed`),Om}}:e===`extension-delegate`?async e=>{if(!e)return e;try{let t=await Em(`secrets.scrub-tool-result`,{text:e});return t?.error?(Dm.debug(`Bridge scrub-tool-result returned error`),Om):typeof t?.text==`string`?t.text:Om}catch{return Dm.debug(`Bridge scrub-tool-result failed`),Om}}:e===`connect`?km:async e=>{if(!e)return e;try{let t=await fetch(o(`/api/secrets/scrub`),{method:`POST`,headers:c({"content-type":`application/json`}),body:JSON.stringify({text:e})});if(!t.ok)return Dm.debug(`Server scrub-tool-result returned non-ok`,{status:t.status}),e;let n=await t.json();return typeof n.text==`string`?n.text:e}catch(t){return Dm.debug(`Server scrub-tool-result failed`,{error:t instanceof Error?t.message:String(t)}),e}}}const jm=n(`image-processor`),Mm=3932160;function Nm(e){let t=e.replace(/[\t\n\f\r ]/g,``),n=t.length%4;return n===2?`${t}==`:n===3?`${t}=`:t}function Pm(e,t){let n=i(Nm(e.slice(0,t)));return new DataView(n.buffer,n.byteOffset,n.byteLength)}function Fm(e,t){return e>0&&t>0?{width:e,height:t}:null}function Im(e){if(e.length<32)return null;let t=Pm(e,32);return Fm(t.getUint32(16,!1),t.getUint32(20,!1))}function Lm(e){if(e.length<16)return null;let t=Pm(e,16);return Fm(t.getUint16(6,!0),t.getUint16(8,!0))}function Rm(e){let t=Pm(e,Math.min(87384,e.length));for(let e=0;e<t.byteLength-8;e++){if(t.getUint8(e)!==255)continue;let n=t.getUint8(e+1);if(n===192||n===194)return Fm(t.getUint16(e+7,!1),t.getUint16(e+5,!1))}return null}function zm(e,t){try{let n=Nm(e);if(t===`image/png`)return Im(n);if(t===`image/gif`)return Lm(n);if(t===`image/jpeg`)return Rm(n)}catch{}return null}async function Bm(e){if(!d(e.mimeType))return jm.warn(`Unsupported image format`,{mimeType:e.mimeType}),{type:`text`,text:`[Image removed: unsupported format "${e.mimeType}". Supported: JPEG, PNG, GIF, WebP]`};let t=e.data.length,n=zm(e.data,e.mimeType);if(!(t>5242880||n!==null&&(n.width>8e3||n.height>8e3)||n!==null&&Math.max(n.width,n.height)>1568))return e;jm.info(`Image needs processing`,{base64Size:t,dimensions:n?`${n.width}x${n.height}`:`unknown`,reason:t>5242880?`size`:`dimensions`});let a,o;try{let e=await import(`./magick-wasm-266b8ntc.js`).then(e=>e.r);a=e.getMagick,o=e.MIME_TO_MAGICK_FORMAT}catch(e){return jm.error(`ImageMagick WASM module unavailable`,{error:e instanceof Error?e.message:String(e)}),{type:`text`,text:`[Image removed: resize service unavailable (ImageMagick WASM could not be loaded)]`}}let s;try{s=await a()}catch(e){return jm.error(`ImageMagick WASM initialization failed`,{error:e instanceof Error?e.message:String(e)}),{type:`text`,text:`[Image removed: resize service unavailable (WASM init failed)]`}}try{let n=i(Nm(e.data)),a={data:null,mime:e.mimeType};if(await s.ImageMagick.read(n,async t=>{let n=t.width,r=t.height,i=Math.max(n,r);if(i>1568){let e=1568/i,a=Math.round(n*e),o=Math.round(r*e);t.resize(a,o),jm.info(`Resized image`,{from:`${n}x${r}`,to:`${a}x${o}`})}let s=o[e.mimeType]||`JPEG`;t.write(s,e=>{a.data=new Uint8Array(e)}),a.data&&a.data.length>Mm&&s!==`JPEG`?(jm.info(`Still over 5MB, compressing to JPEG q80`),t.quality=80,t.write(`JPEG`,e=>{a.data=new Uint8Array(e)}),a.mime=`image/jpeg`):a.data&&a.data.length>Mm&&(jm.info(`Still over 5MB as JPEG, reducing quality to 60`),t.quality=60,t.write(`JPEG`,e=>{a.data=new Uint8Array(e)}))}),!a.data)return jm.warn(`ImageMagick produced no output`),{type:`text`,text:`[Image removed: could not be processed (empty output from resize)]`};if(a.data.length>Mm)return jm.warn(`Image still over 5MB after resize+compress`,{size:a.data.length}),{type:`text`,text:`[Image removed: still ${Math.round(a.data.length/1024/1024*10)/10}MB after resize and compression, exceeds 5MB API limit]`};let c=r(a.data);return jm.info(`Image processed successfully`,{originalBase64:t,newBase64:c.length,mimeType:a.mime}),{type:`image`,data:c,mimeType:a.mime}}catch(n){return jm.error(`Image data processing failed (corrupt or unreadable)`,{mimeType:e.mimeType,estimatedBytes:t,error:n instanceof Error?n.message:String(n)}),{type:`text`,text:`[Image removed: image data could not be processed (${n instanceof Error?n.message:`corrupt or unreadable`})]`}}}const Vm=n(`tool-adapter`);function Hm(e){let t=[],n=0;for(let r of f(e)){if(r.kind===`inert`||!r.parsed)continue;let i=e.slice(n,r.index);i.trim()&&t.push({type:`text`,text:i.trimEnd()}),t.push({type:`image`,mimeType:r.parsed.mimeType,data:r.parsed.data}),n=r.index+r.marker.length}let r=e.slice(n);return(r.trim()||t.length===0)&&t.push({type:`text`,text:r||e}),t}async function Um(e){let t=Hm(e),n=[];for(let e of t)e.type===`image`?n.push(await Bm(e)):n.push(e);return n}function Wm(e,t,n,r){if(!r)return{tracked:null,effectiveSignal:n};let i=r.processManager.spawn({kind:`tool`,argv:[e.name,...Zm(t)],owner:r.owner,ppid:r.getParentPid?.()});n?.aborted?r.processManager.signal(i.pid,`SIGINT`):n&&n.addEventListener(`abort`,()=>r.processManager.signal(i.pid,`SIGINT`),{once:!0});let a=r.processManager.onSignal((e,t)=>{e.pid===i.pid&&t===`SIGKILL`&&r.processManager.exit(i.pid,null)});return{tracked:{record:i,manager:r.processManager,unsubscribeKill:a},effectiveSignal:i.abort.signal}}function Gm(e,t){e&&e.manager.exit(e.record.pid,t)}async function Km(e,t,n){if(!n||typeof e!=`string`||e.length===0)return e;try{return await n.scrubToolResult(e)}catch(n){return Vm.warn(`Tool-result scrub failed, falling back to unscrubbed content`,{tool:t,error:n instanceof Error?n.message:String(n)}),e}}async function qm(e,t){try{return await Um(e)}catch(n){return Vm.warn(`Image processing failed, falling back to raw content`,{tool:t,error:n instanceof Error?n.message:String(n)}),Hm(e)}}async function Jm(e,t,n,r){let i=n?.currentGate();if(!i)return!0;if(r?.aborted)return!1;try{return await i.approve(e.name,t)&&r?.aborted!==!0}catch(t){return Vm.warn(`Tool-call gate threw — refusing the call`,{tool:e.name,error:t instanceof Error?t.message:String(t)}),!1}}function Ym(e,t,n,r){return{name:e.name,label:e.name,description:e.description,parameters:e.inputSchema,async execute(i,a,o,s){let c;if(s&&(c=m({onUpdate:s,toolName:e.name,toolCallId:i})),!await Jm(e,a,r,o))return c&&p(c),{content:[{type:`text`,text:`${e.name}: not approved (guest-caused turn).`}],details:{isError:!0}};let l=Wm(e,a,o,t);try{let t=await e.execute(a??{},l.effectiveSignal),r=await qm(await Km(t.content,e.name,n),e.name);return Gm(l.tracked,+!!t.isError),{content:r,details:{isError:t.isError}}}catch(e){throw Gm(l.tracked,l.tracked?.record.abort.signal.aborted?null:1),e}finally{c&&p(c),l.tracked?.unsubscribeKill()}}}}function Xm(e,t,n,r){return e.map(e=>Ym(e,t,n,r))}function Zm(e){if(typeof e!=`object`||!e)return[];let t=e;for(let e of[`command`,`file_path`,`path`,`pattern`,`url`,`key`,`name`,`query`,`message`]){let n=t[e];if(typeof n==`string`&&n.length>0)return[n]}for(let e of Object.values(t))if(typeof e==`string`&&e.length>0)return[e];return[]}export{Rt as $,tr as A,ye as At,zn as B,fe as Bt,Dr as C,Te as Ct,ar as D,Ne as Dt,R as E,Ee as Et,Yn as F,Ce as Ft,nn as G,Nn as H,Xn as I,we as It,Yt as J,N as K,I as L,Le as Lt,L as M,b as Mt,qn as N,xe as Nt,ir as O,Pe as Ot,Jn as P,Se as Pt,Vt as Q,Un as R,je as Rt,B as S,Oe as St,z as T,De as Tt,on as U,Pn as V,an as W,M as X,Kt as Y,j as Z,Ii as _,he as _t,wm as a,k as at,Ni as b,x as bt,pm as c,ft as ct,uf as d,Re as dt,Nt as et,af as f,Fe as ft,Vi as g,me as gt,Hi as h,pe as ht,Em as i,Tt as it,Qn as j,be as jt,rr as k,ke as kt,nm as l,ut as lt,Za as m,C as mt,Zm as n,At as nt,Cm as o,wt as ot,Kd as p,Ie as pt,tn as q,Am as r,Dt as rt,Sm as s,gt as st,Xm as t,Mt as tt,mf as u,ze as ut,Ai as v,ge as vt,Cr as w,ve as wt,Fi as x,_e as xt,Pi as y,We as yt,Bn as z,w as zt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,D as t,E as n,O as r,T as i,j as a,w as o}from"./slicc-editor-D-eO_pjd.js";var s=class e{constructor(e,t,n,r,i,a,o,s,c,l=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=s,this.curContext=c,this.lookAhead=l,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?`!`+this.score:``}`}static start(t,n,r=0){let i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new c(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=r.dynamicPrecedence(n);if(a&&(this.score+=a),t==0){this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(n,this.reducePos);return}let o=this.stack.length-(t-1)*3-(e&262144?6:0),s=o?this.stack[o-2]:this.p.ranges[0].from,c=this.reducePos-s;c>=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=s,this.p.lastBigReductionSize=c));let l=o?this.stack[o-1]:0,u=this.bufferBase+this.buffer.length-l;if(n<r.minRepeatTerm||e&131072){let e=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,s,e,u+4,!0)}if(e&262144)this.state=this.stack[o];else{let e=this.stack[o-3];this.state=r.getGoto(e,n,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this,r=this.buffer.length;if(r==0&&e.parent&&(r=e.bufferBase-e.parent.bufferBase,e=e.parent),r>0&&e.buffer[r-4]==0&&e.buffer[r-1]>-1){if(t==n)return;if(e.buffer[r-2]>=t){e.buffer[r-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;this.pos=r;let o=a.stateFlag(i,1);!o&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(i,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(;n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new l(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>t&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216)){if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new c(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},c=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},l=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}},u=class e{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new e(t,n,n-t.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new e(this.stack,this.pos,this.index)}};function d(e,t=Uint16Array){if(typeof e!=`string`)return e;let n=null;for(let r=0,i=0;r<e.length;){let a=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(t==126){a=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),a+=i,n)break;a*=46}n?n[i++]=a:n=new t(a)}return n}var f=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},p=new f,m=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk=``,this.chunkOff=0,this.chunk2=``,this.chunk2Pos=0,this.next=-1,this.token=p,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(t==null)return-1;if(n=t,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=n;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw RangeError(`Token end out of bounds`);this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.next=this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?-1:this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=``,this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=p,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk=``,this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n=``;for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},h=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;v(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};h.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;var g=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?d(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(v(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};g.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;var _=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function v(e,t,n,r,i,a){let o=0,s=1<<r,{dialect:c}=n.p.parser;scan:for(;(s&e[o])!=0;){let n=e[o+1];for(let r=o+3;r<n;r+=2)if((e[r+1]&s)>0){let n=e[r];if(c.allows(n)&&(t.token.value==-1||t.token.value==n||b(n,t.token.value,i,a))){t.acceptToken(n);break}}let r=t.next,l=0,u=e[o+2];if(t.next<0&&u>l&&e[n+u*3-3]==65535){o=e[n+u*3-1];continue scan}for(;l<u;){let i=l+u>>1,a=n+i+(i<<1),s=e[a],c=e[a+1]||65536;if(r<s)u=i;else if(r>=c)l=i+1;else{o=e[a+2],t.advance();continue scan}}break}}function y(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function b(e,t,n,r){let i=y(n,r,t);return i<0||y(n,r,e)<i}var x=typeof process<`u`&&/\bparse\b/.test({}.LOG),S=null;function C(e,t,n){let r=e.cursor(i.IncludeAnonymous);for(r.moveTo(t);;)if(!(n<0?r.childBefore(t):r.childAfter(t)))for(;;){if((n<0?r.to<t:r.from>t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}var w=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?C(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?C(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let r=this.trees[t],i=this.index[t];if(i==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=r.children[i],s=this.start[t]+r.positions[i];if(s>e)return this.nextStart=s,null;if(o instanceof a){if(s==e){if(s<this.safeFrom)return null;let e=s+o.length;if(e<=this.safeTo){let t=o.prop(n.lookAhead);if(!t||e+t<this.fragment.to)return o}}this.index[t]++,s+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[t]++,this.nextStart=s+o.length}}},T=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new f)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,a=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let r=0;r<i.length;r++){if(!(1<<r&a))continue;let c=i[r],l=this.tokens[r];if(!(n&&!c.fallback)&&((c.contextual||l.start!=e.pos||l.mask!=a||l.context!=o)&&(this.updateCachedToken(l,c,e),l.mask=a,l.context=o),l.lookAhead>l.end+25&&(s=Math.max(l.lookAhead,s)),l.value!=0)){let r=t;if(l.extended>-1&&(t=this.addActions(e,l.extended,l.end,t)),t=this.addActions(e,l.value,l.end,t),!c.extend&&(n=l,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),!n&&e.pos==this.stream.end&&(n=new f,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new f,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let i=t.specializers[r](this.stream.read(e.start,e.end),n);if(i>=0&&n.p.parser.dialect.allows(i>>1)){i&1?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:i}=e,{parser:a}=e.p,{data:o}=a;for(let e=0;e<2;e++)for(let s=a.stateSlot(i,e?2:1);;s+=3){if(o[s]==65535){if(o[s+1]==1)s=M(o,s+2);else{r==0&&o[s+1]==2&&(r=this.putAction(M(o,s+2),t,n,r));break}}o[s]==t&&(r=this.putAction(M(o,s+1),t,n,r))}return r}},E=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new m(t,r),this.tokens=new T(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[s.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>e.bufferLength*4?new w(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let o=e[a];for(;;){if(this.tokens.mainToken=null,o.pos>t)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&N(r);if(e)return x&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw x&&r&&console.log(`Stuck with token `+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):`none`)),SyntaxError(`No parse at `+t);this.recovering||=5}if(this.recovering&&r){let e=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(e)return x&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e<n.length-1;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let i=n[r];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500){if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}}n.length>12&&(n.sort((e,t)=>t.score-e.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let e=1;e<n.length;e++)n[e].pos<this.minStackPos&&(this.minStackPos=n[e].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}advanceStack(e,t,r){let i=e.pos,{parser:o}=this,s=x?this.stackID(e)+` -> `:``;if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,r=t?e.curContext.hash:0;for(let c=this.fragments.nodeAt(i);c;){let i=this.parser.nodeSet.types[c.type.id]==c.type?o.getGoto(e.state,c.type.id):-1;if(i>-1&&c.length&&(!t||(c.prop(n.contextHash)||0)==r))return e.useNode(c,i),x&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(c.type.id)})`),!0;if(!(c instanceof a)||c.children.length==0||c.positions[0]>0)break;let l=c.children[0];if(l instanceof a&&c.positions[0]==0)c=l;else break}}let c=o.stateSlot(e.state,4);if(c>0)return e.reduce(c),x&&console.log(s+this.stackID(e)+` (via always-reduce ${o.getName(c&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let n=0;n<l.length;){let a=l[n++],c=l[n++],u=l[n++],d=n==l.length||!r,f=d?e:e.split(),p=this.tokens.mainToken;if(f.apply(a,c,p?p.start:f.pos,u),x&&console.log(s+this.stackID(f)+` (via ${a&65536?`reduce of ${o.getName(a&65535)}`:`shift`} for ${o.getName(c)} @ ${i}${f==e?``:`, split`})`),d)return!0;f.pos>i?t.push(f):r.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return D(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=t[a<<1],c=t[(a<<1)+1],l=x?this.stackID(o)+` -> `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),x&&console.log(l+this.stackID(o)+` (restarted)`),this.advanceFully(o,n))))continue;let u=o.split(),d=l;for(let e=0;e<10&&u.forceReduce()&&(x&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)x&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))x&&console.log(l+this.stackID(e)+` (via recover-insert)`),this.advanceFully(e,n);this.stream.end>o.pos?(c==o.pos&&(c++,s=0),o.recoverByDelete(s,c),x&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),D(o,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),a.build({buffer:u.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(S||=new WeakMap).get(e);return t||S.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function D(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e)){t[n].score<e.score&&(t[n]=e);return}}t.push(e)}var O=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},k=e=>e,A=class{constructor(e){this.start=e.start,this.shift=e.shift||k,this.reduce=e.reduce||k,this.reuse=e.reuse||k,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},j=class i extends e{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let i=e.nodeNames.split(` `);this.minRepeatTerm=i.length;for(let t=0;t<e.repeatNodeCount;t++)i.push(``);let a=Object.keys(e.topRules).map(t=>e.topRules[t][1]),s=[];for(let e=0;e<i.length;e++)s.push([]);function c(e,t,n){s[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];typeof e==`string`&&(e=n[e]);for(let n=1;n<t.length;){let r=t[n++];if(r>=0)c(r,e,t[n++]);else{let i=t[n+-r];for(let a=-r;a>0;a--)c(t[n++],e,i);n++}}}this.nodeSet=new t(i.map((t,n)=>r.define({name:n>=this.minRepeatTerm?void 0:t,id:n,props:s[n],top:a.indexOf(n)>-1,error:n==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(n)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=o;let l=d(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(P),this.states=d(e.states,Uint32Array),this.data=d(e.stateData),this.goto=d(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>typeof e==`number`?new h(l,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new E(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],a=t&1,o=r[i++];if(a&&n)return o;for(let n=i+(t>>1);i<n;i++)if(r[i]==e)return o;if(a)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),a;;i+=3){if((a=n[i])==65535){if(n[i+1]==1)a=n[i=M(n,i+2)];else if(n[i+1]==2)return M(n,i+2);else break}if(a==t||a==0)return M(n,i+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=M(this.data,n+2);else break}r=t(M(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=M(this.data,n+2);else break}if(!(this.data[n+2]&1)){let e=this.data[n+1];t.some((t,n)=>n&1&&t==e)||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(i.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(t=>{let n=e.tokenizers.find(e=>e.from==t);return n?n.to:t})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,r)=>{let i=e.specializers.find(e=>e.from==n.external);if(!i)return n;let a=Object.assign(Object.assign({},n),{external:i.to});return t.specializers[r]=P(a),a})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(` `)){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n=this.dialects[t[e]],i;(i=this.data[n++])!=65535;)(r||=new Uint8Array(this.maxTerm+1))[i]=1;return new O(e,n,r)}static deserialize(e){return new i(e)}};function M(e,t){return e[t]|e[t+1]<<16}function N(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||e!=null&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}function P(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}export{g as i,_ as n,j as r,A as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,S as t,a as n,g as r,l as i,m as a,n as o,p as s}from"./slicc-editor-D-eO_pjd.js";import{r as c}from"./dist-CMD3ZuiV.js";var l=t({String:e.string,Number:e.number,"True False":e.bool,PropertyName:e.propertyName,Null:e.null,", :":e.separator,"[ ]":e.squareBracket,"{ }":e.brace}),u=c.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:`#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O`,goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:`⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array`,maxTerm:25,nodeProps:[[`isolate`,-2,6,11,``],[`openedBy`,7,`{`,14,`[`],[`closedBy`,8,`}`,15,`]`]],propSources:[l],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),d=o.define({name:`json`,parser:u.configure({props:[r.add({Object:i({except:/^\s*\}/}),Array:i({except:/^\s*\]/})}),a.add({"Object Array":s})]}),languageData:{closeBrackets:{brackets:[`[`,`{`,`"`]},indentOnInput:/^\s*[\}\]]$/}});function f(){return new n(d)}export{f as json};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{A as e,C as t,D as n,E as r,H as i,I as a,J as o,M as s,O as c,P as l,R as u,S as d,_ as f,a as p,b as m,g as h,h as g,i as ee,j as _,m as te,o as ne,r as re,u as ie,v as ae,x as oe,z as se}from"./slicc-editor-D-eO_pjd.js";import{html as ce,htmlCompletionSource as le,t as ue}from"./dist-DkG8wgj1.js";var de=class e{static create(t,n,r,i,a){let o=i+(i<<8)+t+(n<<4)|0;return new e(t,n,r,o,a,[],[])}constructor(e,t,n,i,a,o,s){this.type=e,this.value=t,this.from=n,this.hash=i,this.end=a,this.children=o,this.positions=s,this.hashProp=[[r.contextHash,i]]}addChild(e,t){e.prop(r.contextHash)!=this.hash&&(e=new _(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let n=this.children.length-1;return n>=0&&(t=Math.max(t,this.positions[n]+this.children[n].length+this.from)),new _(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(e,t,n)=>new _(c.none,e,t,n,this.hashProp)})}},v;(function(e){e[e.Document=1]=`Document`,e[e.CodeBlock=2]=`CodeBlock`,e[e.FencedCode=3]=`FencedCode`,e[e.Blockquote=4]=`Blockquote`,e[e.HorizontalRule=5]=`HorizontalRule`,e[e.BulletList=6]=`BulletList`,e[e.OrderedList=7]=`OrderedList`,e[e.ListItem=8]=`ListItem`,e[e.ATXHeading1=9]=`ATXHeading1`,e[e.ATXHeading2=10]=`ATXHeading2`,e[e.ATXHeading3=11]=`ATXHeading3`,e[e.ATXHeading4=12]=`ATXHeading4`,e[e.ATXHeading5=13]=`ATXHeading5`,e[e.ATXHeading6=14]=`ATXHeading6`,e[e.SetextHeading1=15]=`SetextHeading1`,e[e.SetextHeading2=16]=`SetextHeading2`,e[e.HTMLBlock=17]=`HTMLBlock`,e[e.LinkReference=18]=`LinkReference`,e[e.Paragraph=19]=`Paragraph`,e[e.CommentBlock=20]=`CommentBlock`,e[e.ProcessingInstructionBlock=21]=`ProcessingInstructionBlock`,e[e.Escape=22]=`Escape`,e[e.Entity=23]=`Entity`,e[e.HardBreak=24]=`HardBreak`,e[e.Emphasis=25]=`Emphasis`,e[e.StrongEmphasis=26]=`StrongEmphasis`,e[e.Link=27]=`Link`,e[e.Image=28]=`Image`,e[e.InlineCode=29]=`InlineCode`,e[e.HTMLTag=30]=`HTMLTag`,e[e.Comment=31]=`Comment`,e[e.ProcessingInstruction=32]=`ProcessingInstruction`,e[e.Autolink=33]=`Autolink`,e[e.HeaderMark=34]=`HeaderMark`,e[e.QuoteMark=35]=`QuoteMark`,e[e.ListMark=36]=`ListMark`,e[e.LinkMark=37]=`LinkMark`,e[e.EmphasisMark=38]=`EmphasisMark`,e[e.CodeMark=39]=`CodeMark`,e[e.CodeText=40]=`CodeText`,e[e.CodeInfo=41]=`CodeInfo`,e[e.LinkTitle=42]=`LinkTitle`,e[e.LinkLabel=43]=`LinkLabel`,e[e.URL=44]=`URL`})(v||={});var fe=class{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}},pe=class{constructor(){this.text=``,this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return b(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,n=0){for(let r=t;r<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return n}findColumn(e){let t=0;for(let n=0;t<this.text.length&&n<e;t++)n+=this.text.charCodeAt(t)==9?4-n%4:1;return t}scrub(){if(!this.baseIndent)return this.text;let e=``;for(let t=0;t<this.basePos;t++)e+=` `;return e+this.text.slice(this.basePos)}};function me(e,t,n){if(n.pos==n.text.length||e!=t.block&&n.indent>=t.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let r=(e.type==v.OrderedList?T:w)(n,t,!1);return r>0&&(e.type!=v.BulletList||C(n,t,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==e.value}var he={[v.Blockquote](e,t,n){return n.next==62&&(n.markers.push(R(v.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(y(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0)},[v.ListItem](e,t,n){return n.indent<n.baseIndent+e.value&&n.next>-1?!1:(n.moveBaseColumn(n.baseIndent+e.value),!0)},[v.OrderedList]:me,[v.BulletList]:me,[v.Document](){return!0}};function y(e){return e==32||e==9||e==10||e==13}function b(e,t=0){for(;t<e.length&&y(e.charCodeAt(t));)t++;return t}function ge(e,t,n){for(;t>n&&y(e.charCodeAt(t-1));)t--;return t}function x(e){if(e.next!=96&&e.next!=126)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;if(t<e.pos+3)return-1;if(e.next==96){for(let n=t;n<e.text.length;n++)if(e.text.charCodeAt(n)==96)return-1}return t}function S(e){return e.next==62?e.text.charCodeAt(e.pos+1)==32?2:1:-1}function C(e,t,n){if(e.next!=42&&e.next!=45&&e.next!=95)return-1;let r=1;for(let t=e.pos+1;t<e.text.length;t++){let n=e.text.charCodeAt(t);if(n==e.next)r++;else if(!y(n))return-1}return n&&e.next==45&&ye(e)>-1&&e.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(j.SetextHeading)>-1||r<3?-1:1}function _e(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function w(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||y(e.text.charCodeAt(e.pos+1)))&&(!n||_e(t,v.BulletList)||e.skipSpace(e.pos+2)<e.text.length)?1:-1}function T(e,t,n){let r=e.pos,i=e.next;for(;i>=48&&i<=57;){if(r++,r==e.text.length)return-1;i=e.text.charCodeAt(r)}return r==e.pos||r>e.pos+9||i!=46&&i!=41||r<e.text.length-1&&!y(e.text.charCodeAt(r+1))||n&&!_e(t,v.OrderedList)&&(e.skipSpace(r+1)==e.text.length||r>e.pos+1||e.next!=49)?-1:r+1-e.pos}function ve(e){if(e.next!=35)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==35;)t++;if(t<e.text.length&&e.text.charCodeAt(t)!=32)return-1;let n=t-e.pos;return n>6?-1:n}function ye(e){if(e.next!=45&&e.next!=61||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;let n=t;for(;t<e.text.length&&y(e.text.charCodeAt(t));)t++;return t==e.text.length?n:-1}var E=/^[ \t]*$/,be=/-->/,xe=/\?>/,D=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,be],[/^\s*<\?/,xe],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,E],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,E]];function Se(e,t,n){if(e.next!=60)return-1;let r=e.text.slice(e.pos);for(let e=0,t=D.length-+!!n;e<t;e++)if(D[e][0].test(r))return e;return-1}function Ce(e,t){let n=e.countIndent(t,e.pos,e.indent),r=e.countIndent(e.skipSpace(t),t,n);return r>=n+5?n+1:r}function O(e,t,n){let r=e.length-1;r>=0&&e[r].to==t&&e[r].type==v.CodeText?e[r].to=n:e.push(R(v.CodeText,t,n))}var k={LinkReference:void 0,IndentedCode(e,t){let n=t.baseIndent+4;if(t.indent<n)return!1;let r=t.findColumn(n),i=e.lineStart+r,a=e.lineStart+t.text.length,o=[],s=[];for(O(o,i,a);e.nextLine()&&t.depth>=e.stack.length;)if(t.pos==t.text.length){O(s,e.lineStart-1,e.lineStart);for(let e of t.markers)s.push(e)}else if(t.indent<n)break;else{if(s.length){for(let e of s)e.type==v.CodeText?O(o,e.from,e.to):o.push(e);s=[]}O(o,e.lineStart-1,e.lineStart);for(let e of t.markers)o.push(e);a=e.lineStart+t.text.length;let n=e.lineStart+t.findColumn(t.baseIndent+4);n<a&&O(o,n,a)}return s.length&&(s=s.filter(e=>e.type!=v.CodeText),s.length&&(t.markers=s.concat(t.markers))),e.addNode(e.buffer.writeElements(o,-i).finish(v.CodeBlock,a-i),i),!0},FencedCode(e,t){let n=x(t);if(n<0)return!1;let r=e.lineStart+t.pos,i=t.next,a=n-t.pos,o=t.skipSpace(n),s=ge(t.text,t.text.length,o),c=[R(v.CodeMark,r,r+a)];o<s&&c.push(R(v.CodeInfo,e.lineStart+o,e.lineStart+s));for(let n=!0,r=!0,o=!1;e.nextLine()&&t.depth>=e.stack.length;n=!1){let s=t.pos;if(t.indent-t.baseIndent<4)for(;s<t.text.length&&t.text.charCodeAt(s)==i;)s++;if(s-t.pos>=a&&t.skipSpace(s)==t.text.length){for(let e of t.markers)c.push(e);r&&o&&O(c,e.lineStart-1,e.lineStart),c.push(R(v.CodeMark,e.lineStart+t.pos,e.lineStart+s)),e.nextLine();break}{o=!0,n||(O(c,e.lineStart-1,e.lineStart),r=!1);for(let e of t.markers)c.push(e);let i=e.lineStart+t.basePos,a=e.lineStart+t.text.length;i<a&&(O(c,i,a),r=!1)}}return e.addNode(e.buffer.writeElements(c,-r).finish(v.FencedCode,e.prevLineEnd()-r),r),!0},Blockquote(e,t){let n=S(t);return n<0?!1:(e.startContext(v.Blockquote,t.pos),e.addNode(v.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1),t.moveBase(t.pos+n),null)},HorizontalRule(e,t){if(C(t,e,!1)<0)return!1;let n=e.lineStart+t.pos;return e.nextLine(),e.addNode(v.HorizontalRule,n),!0},BulletList(e,t){let n=w(t,e,!1);if(n<0)return!1;e.block.type!=v.BulletList&&e.startContext(v.BulletList,t.basePos,t.next);let r=Ce(t,t.pos+1);return e.startContext(v.ListItem,t.basePos,r-t.baseIndent),e.addNode(v.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},OrderedList(e,t){let n=T(t,e,!1);if(n<0)return!1;e.block.type!=v.OrderedList&&e.startContext(v.OrderedList,t.basePos,t.text.charCodeAt(t.pos+n-1));let r=Ce(t,t.pos+n);return e.startContext(v.ListItem,t.basePos,r-t.baseIndent),e.addNode(v.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},ATXHeading(e,t){let n=ve(t);if(n<0)return!1;let r=t.pos,i=e.lineStart+r,a=ge(t.text,t.text.length,r),o=a;for(;o>r&&t.text.charCodeAt(o-1)==t.next;)o--;(o==a||o==r||!y(t.text.charCodeAt(o-1)))&&(o=t.text.length);let s=e.buffer.write(v.HeaderMark,0,n).writeElements(e.parser.parseInline(t.text.slice(r+n+1,o),i+n+1),-i);o<t.text.length&&s.write(v.HeaderMark,o-r,a-r);let c=s.finish(v.ATXHeading1-1+n,t.text.length-r);return e.nextLine(),e.addNode(c,i),!0},HTMLBlock(e,t){let n=Se(t,e,!1);if(n<0)return!1;let r=e.lineStart+t.pos,i=D[n][1],a=[],o=i!=E;for(;!i.test(t.text)&&e.nextLine();){if(t.depth<e.stack.length){o=!1;break}for(let e of t.markers)a.push(e)}o&&e.nextLine();let s=i==be?v.CommentBlock:i==xe?v.ProcessingInstructionBlock:v.HTMLBlock,c=e.prevLineEnd();return e.addNode(e.buffer.writeElements(a,-r).finish(s,c-r),r),!0},SetextHeading:void 0},we=class{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,t,n){if(this.stage==-1)return!1;let r=n.content+`
|
|
2
|
-
`+t.scrub(),i=this.advance(r);return i>-1&&i<r.length&&this.complete(e,n,i)}finish(e,t){return(this.stage==2||this.stage==3)&&b(t.content,this.pos)==t.content.length&&this.complete(e,t,t.content.length)}complete(e,t,n){return e.addLeafElement(t,R(v.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;)if(this.stage==-1)return-1;else if(this.stage==0){if(!this.nextStage(ze(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(R(v.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Le(e,b(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=b(e,this.pos),n=0;if(t>this.pos){let r=Re(e,t,this.start);if(r){let t=A(e,r.to-this.start);t>0&&(this.nextStage(r),n=t)}}return n||=A(e,this.pos),n>0&&n<e.length?n:-1}else return A(e,this.pos)}};function A(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(n==10)break;if(!y(n))return-1}return t}var Te=class{nextLine(e,t,n){let r=t.depth<e.stack.length?-1:ye(t),i=t.next;if(r<0)return!1;let a=R(v.HeaderMark,e.lineStart+t.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(n,R(i==61?v.SetextHeading1:v.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),a])),!0}finish(){return!1}},j={LinkReference(e,t){return t.content.charCodeAt(0)==91?new we(t):null},SetextHeading(){return new Te}},Ee=[(e,t)=>ve(t)>=0,(e,t)=>x(t)>=0,(e,t)=>S(t)>=0,(e,t)=>w(t,e,!0)>=0,(e,t)=>T(t,e,!0)>=0,(e,t)=>C(t,e,!0)>=0,(e,t)=>Se(t,e,!0)>=0],De={text:``,end:0},Oe=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.line=new pe,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=de.create(v.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new Ve(n,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let t=0;;){let n=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;t<e.markers.length&&(!n||e.markers[t].from<n.end);){let n=e.markers[t++];this.addNode(n.type,n.from,n.to)}if(!n)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;start:for(;;){for(let t of this.parser.blockParsers)if(t){let n=t(this,e);if(n!=0){if(n==1)return null;e.forward();continue start}}break}let t=new fe(this.lineStart+e.pos,e.text.slice(e.pos));for(let e of this.parser.leafBlockParsers)if(e){let n=e(this,t);n&&t.parsers.push(n)}lines:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,t))break lines}for(let n of t.parsers)if(n.nextLine(this,e,t))return null;t.content+=`
|
|
3
|
-
`+e.scrub();for(let n of e.markers)t.marks.push(n)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=He(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=De;if(t.end=e,e>=this.to)t.text=``;else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let e=this.absoluteLineStart,n=this.rangeI;for(;this.ranges[n].to<t.end;){n++;let r=this.ranges[n].from,i=this.lineChunkAt(r);t.end=r+i.length,t.text=t.text.slice(0,this.ranges[n-1].to-e)+i,e=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(t);e.depth<this.stack.length;e.depth++){let t=this.stack[e.depth],n=this.parser.skipContextMarkup[t.type];if(!n)throw Error(`Unhandled block context `+v[t.type]);let r=this.line.markers.length;if(!n(t,this,e)){this.line.markers.length>r&&(t.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),n;if(this.input.lineChunks)n=t==`
|
|
4
|
-
`?``:t;else{let e=t.indexOf(`
|
|
5
|
-
`);n=e<0?t:t.slice(0,e)}return e+n.length>this.to?n.slice(0,this.to-e):n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,n=0){this.block=de.create(e,n,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,n=0){this.startContext(this.parser.getNodeType(e),t,n)}addNode(e,t,n){typeof e==`number`&&(e=new _(this.parser.nodeSet.types[e],I,I,(n??this.prevLineEnd())-t)),this.block.addChild(e,t-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,t){this.addNode(this.buffer.writeElements(G(t.children,e.marks),-t.from).finish(t.type,t.to-t.from),t.from)}finishContext(){let e=this.stack.pop(),t=this.stack[this.stack.length-1];t.addChild(e.toTree(this.parser.nodeSet),e.from-t.from),this.block=t}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?M(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let t of e.parsers)if(t.finish(this,e))return;let t=G(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(v.Paragraph,e.content.length),e.start)}elt(e,t,n,r){return typeof e==`string`?R(this.parser.getNodeType(e),t,n,r):new Me(e,t)}get buffer(){return new je(this.parser.nodeSet)}};function M(e,t,n,r,i){let a=e[t].to,o=[],s=[],c=n.from+r;function l(n,i){for(;i?n>=a:n>a;){let i=e[t+1].from-a;r+=i,n+=i,t++,a=e[t].to}}for(let u=n.firstChild;u;u=u.nextSibling){l(u.from+r,!0);let n=u.from+r,d,f=i.get(u.tree);f?d=f:u.to+r>a?(d=M(e,t,u,r,i),l(u.to+r,!1)):d=u.toTree(),o.push(d),s.push(n-c)}return l(n.to+r,!1),new _(n.type,o,s,n.to+r-c,n.tree?n.tree.propValues:void 0)}var ke=class t extends e{constructor(e,t,n,r,i,a,o,s,c){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=n,this.blockNames=r,this.endLeafBlock=i,this.skipContextMarkup=a,this.inlineParsers=o,this.inlineNames=s,this.wrappers=c,this.nodeTypes=Object.create(null);for(let t of e.types)this.nodeTypes[t.name]=t.id}createParse(e,t,n){let r=new Oe(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}configure(e){let i=P(e);if(!i)return this;let{nodeSet:a,skipContextMarkup:o}=this,s=this.blockParsers.slice(),l=this.leafBlockParsers.slice(),u=this.blockNames.slice(),f=this.inlineParsers.slice(),p=this.inlineNames.slice(),m=this.endLeafBlock.slice(),h=this.wrappers;if(N(i.defineNodes)){o=Object.assign({},o);let e=a.types.slice(),t;for(let n of i.defineNodes){let{name:i,block:a,composite:s,style:l}=typeof n==`string`?{name:n}:n;if(e.some(e=>e.name==i))continue;s&&(o[e.length]=(e,t,n)=>s(t,n,e.value));let u=e.length,d=s?[`Block`,`BlockContext`]:a?u>=v.ATXHeading1&&u<=v.SetextHeading2?[`Block`,`LeafBlock`,`Heading`]:[`Block`,`LeafBlock`]:void 0;e.push(c.define({id:u,name:i,props:d&&[[r.group,d]]})),l&&(t||={},Array.isArray(l)||l instanceof oe?t[i]=l:Object.assign(t,l))}a=new n(e),t&&(a=a.extend(d(t)))}if(N(i.props)&&(a=a.extend(...i.props)),N(i.remove))for(let e of i.remove){let t=this.blockNames.indexOf(e),n=this.inlineNames.indexOf(e);t>-1&&(s[t]=l[t]=void 0),n>-1&&(f[n]=void 0)}if(N(i.parseBlock))for(let e of i.parseBlock){let t=u.indexOf(e.name);if(t>-1)s[t]=e.parse,l[t]=e.leaf;else{let t=e.before?F(u,e.before):e.after?F(u,e.after)+1:u.length-1;s.splice(t,0,e.parse),l.splice(t,0,e.leaf),u.splice(t,0,e.name)}e.endLeaf&&m.push(e.endLeaf)}if(N(i.parseInline))for(let e of i.parseInline){let t=p.indexOf(e.name);if(t>-1)f[t]=e.parse;else{let t=e.before?F(p,e.before):e.after?F(p,e.after)+1:p.length-1;f.splice(t,0,e.parse),p.splice(t,0,e.name)}}return i.wrap&&(h=h.concat(i.wrap)),new t(a,s,l,u,m,o,f,p,h)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let n=new W(this,e,t);outer:for(let e=t;e<n.end;){let t=n.char(e);for(let r of this.inlineParsers)if(r){let i=r(n,t,e);if(i>=0){e=i;continue outer}}e++}return n.resolveMarkers(0)}};function N(e){return e!=null&&e.length>0}function P(e){if(!Array.isArray(e))return e;if(e.length==0)return null;let t=P(e[0]);if(e.length==1)return t;let n=P(e.slice(1));if(!n||!t)return t||n;let r=(e,t)=>(e||I).concat(t||I),i=t.wrap,a=n.wrap;return{props:r(t.props,n.props),defineNodes:r(t.defineNodes,n.defineNodes),parseBlock:r(t.parseBlock,n.parseBlock),parseInline:r(t.parseInline,n.parseInline),remove:r(t.remove,n.remove),wrap:i?a?(e,t,n,r)=>i(a(e,t,n,r),t,n,r):i:a}}function F(e,t){let n=e.indexOf(t);if(n<0)throw RangeError(`Position specified relative to unknown parser ${t}`);return n}var Ae=[c.none];for(let e=1,t;t=v[e];e++)Ae[e]=c.define({id:e,name:t,props:e>=v.Escape?[]:[[r.group,e in he?[`Block`,`BlockContext`]:[`Block`,`LeafBlock`]]],top:t==`Document`});var I=[],je=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,t,n,r=0){return this.content.push(e,t,n,4+r*4),this}writeElements(e,t=0){for(let n of e)n.writeTo(this,t);return this}finish(e,t){return _.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:e,length:t})}},L=class{constructor(e,t,n,r=I){this.type=e,this.from=t,this.to=n,this.children=r}writeTo(e,t){let n=e.content.length;e.writeElements(this.children,t),e.content.push(this.type,this.from+t,this.to+t,e.content.length+4-n)}toTree(e){return new je(e).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}},Me=class{constructor(e,t){this.tree=e,this.from=t}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return I}writeTo(e,t){e.nodes.push(this.tree),e.content.push(e.nodes.length-1,this.from+t,this.to+t,-1)}toTree(){return this.tree}};function R(e,t,n,r){return new L(e,t,n,r)}var Ne={resolve:`Emphasis`,mark:`EmphasisMark`},Pe={resolve:`Emphasis`,mark:`EmphasisMark`},z={},B={},V=class{constructor(e,t,n,r){this.type=e,this.from=t,this.to=n,this.side=r}},Fe=`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`,H=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{H=RegExp(`[\\p{S}|\\p{P}]`,`u`)}catch{}var U={Escape(e,t,n){if(t!=92||n==e.end-1)return-1;let r=e.char(n+1);for(let t=0;t<32;t++)if(Fe.charCodeAt(t)==r)return e.append(R(v.Escape,n,n+2));return-1},Entity(e,t,n){if(t!=38)return-1;let r=/^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(e.slice(n+1,n+31));return r?e.append(R(v.Entity,n,n+1+r[0].length)):-1},InlineCode(e,t,n){if(t!=96||n&&e.char(n-1)==96)return-1;let r=n+1;for(;r<e.end&&e.char(r)==96;)r++;let i=r-n,a=0;for(;r<e.end;r++)if(e.char(r)==96){if(a++,a==i&&e.char(r+1)!=96)return e.append(R(v.InlineCode,n,r+1,[R(v.CodeMark,n,n+i),R(v.CodeMark,r+1-i,r+1)]))}else a=0;return-1},HTMLTag(e,t,n){if(t!=60||n==e.end-1)return-1;let r=e.slice(n+1,e.end),i=/^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(r);if(i)return e.append(R(v.Autolink,n,n+1+i[0].length,[R(v.LinkMark,n,n+1),R(v.URL,n+1,n+i[0].length),R(v.LinkMark,n+i[0].length,n+1+i[0].length)]));let a=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(r);if(a)return e.append(R(v.Comment,n,n+1+a[0].length));let o=/^\?[^]*?\?>/.exec(r);if(o)return e.append(R(v.ProcessingInstruction,n,n+1+o[0].length));let s=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(r);return s?e.append(R(v.HTMLTag,n,n+1+s[0].length)):-1},Emphasis(e,t,n){if(t!=95&&t!=42)return-1;let r=n+1;for(;e.char(r)==t;)r++;let i=e.slice(n-1,n),a=e.slice(r,r+1),o=H.test(i),s=H.test(a),c=/\s|^$/.test(i),l=/\s|^$/.test(a),u=!l&&(!s||c||o),d=!c&&(!o||l||s),f=u&&(t==42||!d||o),p=d&&(t==42||!u||s);return e.append(new V(t==95?Ne:Pe,n,r,!!f|(p?2:0)))},HardBreak(e,t,n){if(t==92&&e.char(n+1)==10)return e.append(R(v.HardBreak,n,n+2));if(t==32){let t=n+1;for(;e.char(t)==32;)t++;if(e.char(t)==10&&t>=n+2)return e.append(R(v.HardBreak,n,t+1))}return-1},Link(e,t,n){return t==91?e.append(new V(z,n,n+1,1)):-1},Image(e,t,n){return t==33&&e.char(n+1)==91?e.append(new V(B,n,n+2,1)):-1},LinkEnd(e,t,n){if(t!=93)return-1;for(let t=e.parts.length-1;t>=0;t--){let r=e.parts[t];if(r instanceof V&&(r.type==z||r.type==B)){if(!r.side||e.skipSpace(r.to)==n&&!/[(\[]/.test(e.slice(n+1,n+2)))return e.parts[t]=null,-1;let i=e.takeContent(t),a=e.parts[t]=Ie(e,i,r.type==z?v.Link:v.Image,r.from,n+1);if(r.type==z)for(let n=0;n<t;n++){let t=e.parts[n];t instanceof V&&t.type==z&&(t.side=0)}return a.to}}return-1}};function Ie(e,t,n,r,i){let{text:a}=e,o=e.char(i),s=i;if(t.unshift(R(v.LinkMark,r,r+(n==v.Image?2:1))),t.push(R(v.LinkMark,i-1,i)),o==40){let n=e.skipSpace(i+1),r=Le(a,n-e.offset,e.offset),o;r&&(n=e.skipSpace(r.to),n!=r.to&&(o=Re(a,n-e.offset,e.offset),o&&(n=e.skipSpace(o.to)))),e.char(n)==41&&(t.push(R(v.LinkMark,i,i+1)),s=n+1,r&&t.push(r),o&&t.push(o),t.push(R(v.LinkMark,n,s)))}else if(o==91){let n=ze(a,i-e.offset,e.offset,!1);n&&(t.push(n),s=n.to)}return R(n,r,s,t)}function Le(e,t,n){if(e.charCodeAt(t)==60){for(let r=t+1;r<e.length;r++){let i=e.charCodeAt(r);if(i==62)return R(v.URL,t+n,r+1+n);if(i==60||i==10)return!1}return null}{let r=0,i=t;for(let t=!1;i<e.length;i++){let n=e.charCodeAt(i);if(y(n))break;if(t)t=!1;else if(n==40)r++;else if(n==41){if(!r)break;r--}else n==92&&(t=!0)}return i>t?R(v.URL,t+n,i+n):i==e.length&&null}}function Re(e,t,n){let r=e.charCodeAt(t);if(r!=39&&r!=34&&r!=40)return!1;let i=r==40?41:r;for(let r=t+1,a=!1;r<e.length;r++){let o=e.charCodeAt(r);if(a)a=!1;else if(o==i)return R(v.LinkTitle,t+n,r+1+n);else o==92&&(a=!0)}return null}function ze(e,t,n,r){for(let i=!1,a=t+1,o=Math.min(e.length,a+999);a<o;a++){let o=e.charCodeAt(a);if(i)i=!1;else if(o==93)return!r&&R(v.LinkLabel,t+n,a+1+n);else{if(r&&!y(o)&&(r=!1),o==91)return!1;o==92&&(i=!0)}}return null}var W=class{constructor(e,t,n){this.parser=e,this.text=t,this.offset=n,this.parts=[]}char(e){return e>=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,t){return this.text.slice(e-this.offset,t-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,t,n,r,i){return this.append(new V(e,t,n,!!r|(i?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let t=this.parts[e];if(t instanceof V&&(t.type==z||t.type==B))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let t=e;t<this.parts.length;t++){let n=this.parts[t];if(!(n instanceof V&&n.type.resolve&&n.side&2))continue;let r=n.type==Ne||n.type==Pe,i=n.to-n.from,a,o=t-1;for(;o>=e;o--){let e=this.parts[o];if(e instanceof V&&e.side&1&&e.type==n.type&&!(r&&(n.side&1||e.side&2)&&(e.to-e.from+i)%3==0&&((e.to-e.from)%3||i%3))){a=e;break}}if(!a)continue;let s=n.type.resolve,c=[],l=a.from,u=n.to;if(r){let e=Math.min(2,a.to-a.from,i);l=a.to-e,u=n.from+e,s=e==1?`Emphasis`:`StrongEmphasis`}a.type.mark&&c.push(this.elt(a.type.mark,l,a.to));for(let e=o+1;e<t;e++)this.parts[e]instanceof L&&c.push(this.parts[e]),this.parts[e]=null;n.type.mark&&c.push(this.elt(n.type.mark,n.from,u));let d=this.elt(s,l,u,c);this.parts[o]=r&&a.from!=l?new V(a.type,a.from,l,a.side):null,(this.parts[t]=r&&n.to!=u?new V(n.type,u,n.to,n.side):null)?this.parts.splice(t,0,d):this.parts[t]=d}let t=[];for(let n=e;n<this.parts.length;n++){let e=this.parts[n];e instanceof L&&t.push(e)}return t}findOpeningDelimiter(e){for(let t=this.parts.length-1;t>=0;t--){let n=this.parts[t];if(n instanceof V&&n.type==e&&n.side&1)return t}return null}takeContent(e){let t=this.resolveMarkers(e);return this.parts.length=e,t}getDelimiterAt(e){let t=this.parts[e];return t instanceof V?t:null}skipSpace(e){return b(this.text,e-this.offset)+this.offset}elt(e,t,n,r){return typeof e==`string`?R(this.parser.getNodeType(e),t,n,r):new Me(e,t)}};W.linkStart=z,W.imageStart=B;function G(e,t){if(!t.length)return e;if(!e.length)return t;let n=e.slice(),r=0;for(let e of t){for(;r<n.length&&n[r].to<e.to;)r++;if(r<n.length&&n[r].from<e.from){let t=n[r];t instanceof L&&(n[r]=new L(t.type,t.from,t.to,G(t.children,[e])))}else n.splice(r++,0,e)}return n}var Be=[v.CodeBlock,v.ListItem,v.OrderedList,v.BulletList],Ve=class{constructor(e,t){this.fragments=e,this.input=t,this.i=0,this.fragment=null,this.fragmentEnd=-1,this.cursor=null,e.length&&(this.fragment=e[this.i++])}nextFragment(){this.fragment=this.i<this.fragments.length?this.fragments[this.i++]:null,this.cursor=null,this.fragmentEnd=-1}moveTo(e,t){for(;this.fragment&&this.fragment.to<=e;)this.nextFragment();if(!this.fragment||this.fragment.from>(e?e-1:0))return!1;if(this.fragmentEnd<0){let e=this.fragment.to;for(;e>0&&this.input.read(e-1,e)!=`
|
|
6
|
-
`;)e--;this.fragmentEnd=e?e-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let r=e+this.fragment.offset;for(;n.to<=r;)if(!n.parent())return!1;for(;;){if(n.from>=r)return this.fragment.from<=t;if(!n.childAfter(r))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(r.contextHash)==e}takeNodes(e){let t=this.cursor,n=this.fragment.offset,r=this.fragmentEnd-+!!this.fragment.openEnd,i=e.absoluteLineStart,a=i,o=e.block.children.length,s=a,c=o;for(;;){if(t.to-n>r){if(t.type.isAnonymous&&t.firstChild())continue;break}let i=He(t.from-n,e.ranges);if(t.to-n<=e.ranges[e.rangeI].to)e.addNode(t.tree,i);else{let n=new _(e.parser.nodeSet.types[v.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(n,t.tree),e.addNode(n,i)}if(t.type.is(`Block`)&&(Be.indexOf(t.type.id)<0?(a=t.to-n,o=e.block.children.length):(a=s,o=c),s=t.to-n,c=e.block.children.length),!t.nextSibling())break}for(;e.block.children.length>o;)e.block.children.pop(),e.block.positions.pop();return a-i}};function He(e,t){let n=e;for(let r=1;r<t.length;r++){let i=t[r-1].to,a=t[r].from;i<e&&(n-=a-i)}return n}var Ue=d({"Blockquote/...":t.quote,HorizontalRule:t.contentSeparator,"ATXHeading1/... SetextHeading1/...":t.heading1,"ATXHeading2/... SetextHeading2/...":t.heading2,"ATXHeading3/...":t.heading3,"ATXHeading4/...":t.heading4,"ATXHeading5/...":t.heading5,"ATXHeading6/...":t.heading6,"Comment CommentBlock":t.comment,Escape:t.escape,Entity:t.character,"Emphasis/...":t.emphasis,"StrongEmphasis/...":t.strong,"Link/... Image/...":t.link,"OrderedList/... BulletList/...":t.list,"BlockQuote/...":t.quote,"InlineCode CodeText":t.monospace,"URL Autolink":t.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":t.processingInstruction,"CodeInfo LinkLabel":t.labelName,LinkTitle:t.string,Paragraph:t.content}),We=new ke(new n(Ae).extend(Ue),Object.keys(k).map(e=>k[e]),Object.keys(k).map(e=>j[e]),Object.keys(k),Ee,he,Object.keys(U).map(e=>U[e]),Object.keys(U),[]);function Ge(e,t,n){let r=[];for(let i=e.firstChild,a=t;;i=i.nextSibling){let e=i?i.from:n;if(e>a&&r.push({from:a,to:e}),!i)break;a=i.to}return r}function Ke(e){let{codeParser:t,htmlParser:n}=e;return{wrap:s((e,r)=>{let i=e.type.id;if(t&&(i==v.CodeBlock||i==v.FencedCode)){let n=``;if(i==v.FencedCode){let t=e.node.getChild(v.CodeInfo);t&&(n=r.read(t.from,t.to))}let a=t(n);if(a)return{parser:a,overlay:e=>e.type.id==v.CodeText,bracketed:i==v.FencedCode}}else if(n&&(i==v.HTMLBlock||i==v.HTMLTag||i==v.CommentBlock))return{parser:n,overlay:Ge(e.node,e.from,e.to)};return null})}}var qe={resolve:`Strikethrough`,mark:`StrikethroughMark`},Je={defineNodes:[{name:`Strikethrough`,style:{"Strikethrough/...":t.strikethrough}},{name:`StrikethroughMark`,style:t.processingInstruction}],parseInline:[{name:`Strikethrough`,parse(e,t,n){if(t!=126||e.char(n+1)!=126||e.char(n+2)==126)return-1;let r=e.slice(n-1,n),i=e.slice(n+2,n+3),a=/\s|^$/.test(r),o=/\s|^$/.test(i),s=H.test(r),c=H.test(i);return e.addDelimiter(qe,n,n+2,!o&&(!c||a||s),!a&&(!s||o||c))},after:`Emphasis`}]};function K(e,t,n=0,r,i=0){let a=0,o=!0,s=-1,c=-1,l=!1,u=()=>{r.push(e.elt(`TableCell`,i+s,i+c,e.parser.parseInline(t.slice(s,c),i+s)))};for(let d=n;d<t.length;d++){let n=t.charCodeAt(d);n==124&&!l?((!o||s>-1)&&a++,o=!1,r&&(s>-1&&u(),r.push(e.elt(`TableDelimiter`,d+i,d+i+1))),s=c=-1):(l||n!=32&&n!=9)&&(s<0&&(s=d),c=d+1),l=!l&&n==92}return s>-1&&(a++,r&&u()),a}function Ye(e,t){for(let n=t;n<e.length;n++){let t=e.charCodeAt(n);if(t==124)return!0;t==92&&n++}return!1}var Xe=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,Ze=class{constructor(){this.rows=null}nextLine(e,t,n){if(this.rows==null){this.rows=!1;let r;if((t.next==45||t.next==58||t.next==124)&&Xe.test(r=t.text.slice(t.pos))){let i=[];K(e,n.content,0,i,n.start)==K(e,r,t.pos)&&(this.rows=[e.elt(`TableHeader`,n.start,n.start+n.content.length,i),e.elt(`TableDelimiter`,e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let n=[];K(e,t.text,t.pos,n,e.lineStart),this.rows.push(e.elt(`TableRow`,e.lineStart+t.pos,e.lineStart+t.text.length,n))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt(`Table`,t.start,t.start+t.content.length,this.rows)),!0):!1}},Qe={defineNodes:[{name:`Table`,block:!0},{name:`TableHeader`,style:{"TableHeader/...":t.heading}},`TableRow`,{name:`TableCell`,style:t.content},{name:`TableDelimiter`,style:t.processingInstruction}],parseBlock:[{name:`Table`,leaf(e,t){return Ye(t.content,0)?new Ze:null},endLeaf(e,t,n){if(n.parsers.some(e=>e instanceof Ze)||!Ye(t.text,t.basePos))return!1;let r=e.peekLine();return Xe.test(r)&&K(e,t.text,t.basePos)==K(e,r,t.basePos)},before:`SetextHeading`}]},$e=class{nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt(`Task`,t.start,t.start+t.content.length,[e.elt(`TaskMarker`,t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}},et={defineNodes:[{name:`Task`,block:!0,style:t.list},{name:`TaskMarker`,style:t.atom}],parseBlock:[{name:`TaskList`,leaf(e,t){return/^\[[ xX]\][ \t]/.test(t.content)&&e.parentType().name==`ListItem`?new $e:null},after:`SetextHeading`}]},tt=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,nt=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,rt=/[\w-]+\.[\w-]+($|\/)/,it=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,at=/\/[a-zA-Z\d@.]+/gy;function ot(e,t,n,r){let i=0;for(let a=t;a<n;a++)e[a]==r&&i++;return i}function st(e,t){nt.lastIndex=t;let n=nt.exec(e);if(!n||rt.exec(n[0])[0].indexOf(`_`)>-1)return-1;let r=t+n[0].length;for(;;){let n=e[r-1],i;if(/[?!.,:*_~]/.test(n)||n==`)`&&ot(e,t,r,`)`)>ot(e,t,r,`(`))r--;else if(n==`;`&&(i=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(e.slice(t,r))))r=t+i.index;else break}return r}function ct(e,t){it.lastIndex=t;let n=it.exec(e);if(!n)return-1;let r=n[0][n[0].length-1];return r==`_`||r==`-`?-1:t+n[0].length-+(r==`.`)}var lt=[Qe,et,Je,{parseInline:[{name:`Autolink`,parse(e,t,n){let r=n-e.offset;if(r&&/\w/.test(e.text[r-1]))return-1;tt.lastIndex=r;let i=tt.exec(e.text),a=-1;return!i||(i[1]||i[2]?(a=st(e.text,r+i[0].length),a>-1&&e.hasOpenLink&&(a=r+/([^\[\]]|\[[^\]]*\])*/.exec(e.text.slice(r,a))[0].length)):i[3]?a=ct(e.text,r):(a=ct(e.text,r+i[0].length),a>-1&&i[0]==`xmpp:`&&(at.lastIndex=a,i=at.exec(e.text),i&&(a=i.index+i[0].length))),a<0)?-1:(e.addElement(e.elt(`URL`,n,a+e.offset)),a+e.offset)}}]}];function ut(e,t,n){return(r,i,a)=>{if(i!=e||r.char(a+1)==e)return-1;let o=[r.elt(n,a,a+1)];for(let i=a+1;i<r.end;i++){let s=r.char(i);if(s==e)return r.addElement(r.elt(t,a,i+1,o.concat(r.elt(n,i,i+1))));if(s==92&&o.push(r.elt(`Escape`,i,i+++2)),y(s))break}return-1}}var dt={defineNodes:[{name:`Superscript`,style:t.special(t.content)},{name:`SuperscriptMark`,style:t.processingInstruction}],parseInline:[{name:`Superscript`,parse:ut(94,`Superscript`,`SuperscriptMark`)}]},ft={defineNodes:[{name:`Subscript`,style:t.special(t.content)},{name:`SubscriptMark`,style:t.processingInstruction}],parseInline:[{name:`Subscript`,parse:ut(126,`Subscript`,`SubscriptMark`)}]},pt={defineNodes:[{name:`Emoji`,style:t.character}],parseInline:[{name:`Emoji`,parse(e,t,n){let r;return t!=58||!(r=/^[a-zA-Z_0-9]+:/.exec(e.slice(n+1,e.end)))?-1:e.addElement(e.elt(`Emoji`,n,n+1+r[0].length))}}]},mt=ie({commentTokens:{block:{open:`<!--`,close:`-->`}}}),ht=new r,gt=We.configure({props:[te.add(e=>!e.is(`Block`)||e.is(`Document`)||q(e)!=null||_t(e)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),ht.add(q),h.add({Document:()=>null}),ae.add({Document:mt})]});function q(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function _t(e){return e.name==`OrderedList`||e.name==`BulletList`}function vt(e,t){let n=e;for(;;){let e=n.nextSibling,r;if(!e||(r=q(e.type))!=null&&r<=t)break;n=e}return n.to}var yt=g.of((e,t,n)=>{for(let r=m(e).resolveInner(n,-1);r&&!(r.from<t);r=r.parent){let e=r.type.prop(ht);if(e==null)continue;let t=vt(r,e);if(t>n)return{from:n,to:t}}return null});function J(e){return new re(mt,e,[],`markdown`)}var bt=J(gt),Y=J(gt.configure([lt,ft,dt,pt,{props:[te.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]));function xt(e,t){return n=>{if(n&&e){let t=null;if(n=/\S*/.exec(n)[0],t=typeof e==`function`?e(n):ee.matchLanguageName(e,n,!0),t instanceof ee)return t.support?t.support.language.parser:ne.getSkippingParser(t.load());if(t)return t.parser}return t?t.parser:null}}var X=class{constructor(e,t,n,r,i,a,o){this.node=e,this.from=t,this.to=n,this.spaceBefore=r,this.spaceAfter=i,this.type=a,this.item=o}blank(e,t=!0){let n=this.spaceBefore+(this.node.name==`Blockquote`?`>`:``);if(e!=null){for(;n.length<e;)n+=` `;return n}for(let e=this.to-this.from-n.length-this.spaceAfter.length;e>0;e--)n+=` `;return n+(t?this.spaceAfter:``)}marker(e,t){let n=this.node.name==`OrderedList`?String(+Ct(this.item,e)[2]+t):``;return this.spaceBefore+n+this.type+this.spaceAfter}};function St(e,t){let n=[],r=[];for(let t=e;t;t=t.parent){if(t.name==`FencedCode`)return r;(t.name==`ListItem`||t.name==`Blockquote`)&&n.push(t)}for(let e=n.length-1;e>=0;e--){let i=n[e],a,o=t.lineAt(i.from),s=i.from-o.from;if(i.name==`Blockquote`&&(a=/^ *>( ?)/.exec(o.text.slice(s))))r.push(new X(i,s,s+a[0].length,``,a[1],`>`,null));else if(i.name==`ListItem`&&i.parent.name==`OrderedList`&&(a=/^( *)\d+([.)])( *)/.exec(o.text.slice(s)))){let e=a[3],t=a[0].length;e.length>=4&&(e=e.slice(0,e.length-4),t-=4),r.push(new X(i.parent,s,s+t,a[1],e,a[2],i))}else if(i.name==`ListItem`&&i.parent.name==`BulletList`&&(a=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(o.text.slice(s)))){let e=a[4],t=a[0].length;e.length>4&&(e=e.slice(0,e.length-4),t-=4);let n=a[2];a[3]&&(n+=a[3].replace(/[xX]/,` `)),r.push(new X(i.parent,s,s+t,a[1],e,n,i))}}return r}function Ct(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function Z(e,t,n,r=0){for(let i=-1,a=e;;){if(a.name==`ListItem`){let e=Ct(a,t),o=+e[2];if(i>=0){if(o!=i+1)return;n.push({from:a.from+e[1].length,to:a.from+e[0].length,insert:String(i+2+r)})}i=o}let e=a.nextSibling;if(!e)break;a=e}}function Q(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(f)!=` `)return e;let r=o(e,4,n),i=``;for(let e=r;e>0;)e>=4?(i+=` `,e-=4):(i+=` `,e--);return i+e.slice(n)}var wt=((e={})=>({state:t,dispatch:n})=>{let r=m(t),{doc:i}=t,a=null,s=t.changeByRange(n=>{if(!n.empty||!Y.isActiveAt(t,n.from,-1)&&!Y.isActiveAt(t,n.from,1))return a={range:n};let s=n.from,c=i.lineAt(s),l=St(r.resolveInner(s,-1),i);for(;l.length&&l[l.length-1].from>s-c.from;)l.pop();if(!l.length)return a={range:n};let d=l[l.length-1];if(d.to-d.spaceAfter.length>s-c.from)return a={range:n};let f=s>=d.to-d.spaceAfter.length&&!/\S/.test(c.text.slice(d.to));if(d.item&&f){if(d.item.from<c.from&&!/^[\s>]*$/.test(c.text.slice(0,d.to)))return a={range:n};let r=d.node.firstChild,o=d.node.getChild(`ListItem`,`ListItem`);if(r.to>=s||o&&o.to<s||c.from>0&&!/[^\s>]/.test(i.lineAt(c.from-1).text)||e.nonTightLists===!1){let e=l.length>1?l[l.length-2]:null,t,n=``;e&&e.item?(t=c.from+e.from,n=e.marker(i,1)):t=c.from+(e?e.to:0);let r=[{from:t,to:s,insert:n}];return d.node.name==`OrderedList`&&Z(d.item,i,r,-2),e&&e.node.name==`OrderedList`&&Z(e.item,i,r),{range:u.cursor(t+n.length),changes:r}}{let e=Dt(l,t,c);return{range:u.cursor(s+e.length+1),changes:{from:c.from,insert:e+t.lineBreak}}}}if(d.node.name==`Blockquote`&&f&&c.from){let e=i.lineAt(c.from-1),r=/>\s*$/.exec(e.text);if(r&&r.index==d.from){let i=t.changes([{from:e.from+r.index,to:e.to},{from:c.from+d.from,to:c.to}]);return{range:n.map(i),changes:i}}}let p=[];d.node.name==`OrderedList`&&Z(d.item,i,p);let m=d.item&&d.item.from<c.from,h=``;if(!m||/^[\s\d.)\-+*>]*/.exec(c.text)[0].length>=d.to)for(let e=0,t=l.length-1;e<=t;e++)h+=e==t&&!m?l[e].marker(i,1):l[e].blank(e<t?o(c.text,4,l[e+1].from)-h.length:null);let g=s;for(;g>c.from&&/\s/.test(c.text.charAt(g-c.from-1));)g--;return h=Q(h,t),Et(d.node,t.doc)&&(h=Dt(l,t,c)+t.lineBreak+h),p.push({from:g,to:s,insert:t.lineBreak+h}),{range:u.cursor(g+h.length+1),changes:p}});return!a&&(n(t.update(s,{scrollIntoView:!0,userEvent:`input`})),!0)})();function Tt(e){return e.name==`QuoteMark`||e.name==`ListMark`}function Et(e,t){if(e.name!=`OrderedList`&&e.name!=`BulletList`)return!1;let n=e.firstChild,r=e.getChild(`ListItem`,`ListItem`);if(!r)return!1;let i=t.lineAt(n.to),a=t.lineAt(r.from),o=/^[\s>]*$/.test(i.text);return i.number+ +!o<a.number}function Dt(e,t,n){let r=``;for(let t=0,i=e.length-2;t<=i;t++)r+=e[t].blank(t<i?o(n.text,4,e[t+1].from)-r.length:null,t<i);return Q(r,t)}function Ot(e,t){let n=e.resolveInner(t,-1),r=t;Tt(n)&&(r=n.from,n=n.parent);for(let e;e=n.childBefore(r);)if(Tt(e))r=e.from;else if(e.name==`OrderedList`||e.name==`BulletList`)n=e.lastChild,r=n.to;else break;return n}var kt=[{key:`Enter`,run:wt},{key:`Backspace`,run:({state:e,dispatch:t})=>{let n=m(e),r=null,i=e.changeByRange(t=>{let i=t.from,{doc:a}=e;if(t.empty&&Y.isActiveAt(e,t.from)){let t=a.lineAt(i),r=St(Ot(n,i),a);if(r.length){let n=r[r.length-1],a=n.to-n.spaceAfter.length+ +!!n.spaceAfter;if(i-t.from>a&&!/\S/.test(t.text.slice(a,i-t.from)))return{range:u.cursor(t.from+a),changes:{from:t.from+a,to:i}};if(i-t.from==a&&(n.item&&t.from<=n.item.from||/^[\s>]*$/.test(t.text.slice(0,n.to)))){let r=t.from+n.from;if(n.item&&n.node.from<n.item.from&&/\S/.test(t.text.slice(n.from,n.to))){let i=n.blank(o(t.text,4,n.to)-o(t.text,4,n.from));return r==t.from&&(i=Q(i,e)),{range:u.cursor(r+i.length),changes:{from:r,to:t.from+n.to,insert:i}}}if(r<i)return{range:u.cursor(r),changes:{from:r,to:i}}}}}return r={range:t}});return!r&&(t(e.update(i,{scrollIntoView:!0,userEvent:`delete`})),!0)}}],At=ce({matchClosingTags:!1});function jt(e={}){let{codeLanguages:t,defaultCodeLanguage:n,addKeymap:r=!0,base:{parser:o}=bt,completeHTMLTags:s=!0,pasteURLAsLink:c=!0,htmlTagLanguage:l=At}=e;if(!(o instanceof ke))throw RangeError("Base parser provided to `markdown` should be a Markdown parser");let u=e.extensions?[e.extensions]:[],d=[l.support,yt],f;c&&d.push(Ft),n instanceof p?(d.push(n.support),f=n.language):n&&(f=n);let m=t||f?xt(t,f):void 0;u.push(Ke({codeParser:m,htmlParser:l.language.parser})),r&&d.push(i.high(a.of(kt)));let h=J(o.configure(u));return s&&d.push(h.data.of({autocomplete:Mt})),new p(h,d)}function Mt(e){let{state:t,pos:n}=e,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(n-25,n));if(!r)return null;let i=m(t).resolveInner(n,-1);for(;i&&!i.type.isTop;){if(i.name==`CodeBlock`||i.name==`FencedCode`||i.name==`ProcessingInstructionBlock`||i.name==`CommentBlock`||i.name==`Link`||i.name==`Image`)return null;i=i.parent}return{from:n-r[0].length,to:n,options:Nt(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}var $=null;function Nt(){if($)return $;let e=le(new ue(se.create({extensions:At}),0,!0));return $=e?e.options:[]}var Pt=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,Ft=l.domEventHandlers({paste:(e,t)=>{let{main:n}=t.state.selection;if(n.empty)return!1;let r=e.clipboardData?.getData(`text/plain`);if(!r||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(r)||(/^www\./.test(r)&&(r=`https://`+r),!Y.isActiveAt(t.state,n.from,1)))return!1;let i=m(t.state),a=!1;return i.iterate({from:n.from,to:n.to,enter:e=>{(e.from>n.from||Pt.test(e.name))&&(a=!0)},leave:e=>{e.to<n.to&&(a=!0)}}),!a&&(t.dispatch({changes:[{from:n.from,insert:`[`},{from:n.to,insert:`](${r})`}],userEvent:`input.paste`,scrollIntoView:!0}),!0)}});export{jt as markdown};
|