@uibot/cli 0.18.1 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -0
- package/dist/app-host-template.json +1 -0
- package/dist/app-scaffold.d.ts +15 -0
- package/dist/cli.js +210 -141
- package/dist/commands/agent-skills.d.ts +1 -0
- package/dist/commands/app.d.ts +10 -0
- package/dist/commands/logo.d.ts +1 -0
- package/dist/commands/resource.d.ts +1 -0
- package/dist/distribution-snapshot.d.ts +38 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12446 -214
- package/dist/resource-runtime.d.ts +1 -0
- package/dist/resources/agent-kit/manifest.json +245 -0
- package/dist/resources/agent-kit/prompt-admin/en.md +17 -0
- package/dist/resources/agent-kit/prompt-admin/zh.md +17 -0
- package/dist/resources/agent-kit/prompt-auth/en.md +17 -0
- package/dist/resources/agent-kit/prompt-auth/zh.md +17 -0
- package/dist/resources/agent-kit/prompt-chat/en.md +17 -0
- package/dist/resources/agent-kit/prompt-chat/zh.md +17 -0
- package/dist/resources/agent-kit/prompt-data/en.md +17 -0
- package/dist/resources/agent-kit/prompt-data/zh.md +17 -0
- package/dist/resources/agent-kit/prompt-documents/en.md +17 -0
- package/dist/resources/agent-kit/prompt-documents/zh.md +17 -0
- package/dist/resources/agent-kit/prompt-industry/en.md +17 -0
- package/dist/resources/agent-kit/prompt-industry/zh.md +17 -0
- package/dist/resources/agent-kit/recipe-admin-workbench/en.md +31 -0
- package/dist/resources/agent-kit/recipe-admin-workbench/zh.md +31 -0
- package/dist/resources/agent-kit/recipe-auth-flow/en.md +56 -0
- package/dist/resources/agent-kit/recipe-auth-flow/zh.md +56 -0
- package/dist/resources/agent-kit/recipe-knowledge-desk/en.md +20 -0
- package/dist/resources/agent-kit/recipe-knowledge-desk/zh.md +20 -0
- package/dist/resources/agent-kit/uibot-data-workbench/en.md +28 -0
- package/dist/resources/agent-kit/uibot-data-workbench/zh.md +28 -0
- package/dist/resources/agent-kit/uibot-knowledge-interface/en.md +26 -0
- package/dist/resources/agent-kit/uibot-knowledge-interface/zh.md +26 -0
- package/dist/resources/agent-kit/uibot-logo/en.md +20 -0
- package/dist/resources/agent-kit/uibot-logo/zh.md +20 -0
- package/dist/resources/agent-kit/uibot-resources/en.md +40 -0
- package/dist/resources/agent-kit/uibot-resources/zh.md +40 -0
- package/dist/resources/bundle.json +1 -1
- package/dist/shells/shadcn-admin-shell.yaml +5 -4
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/licenses/UIBot-LICENSE +21 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/licenses/blocks-icons-LICENSE +46 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/licenses/shadcn-THIRD_PARTY_LICENSE +21 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-apps.json +61 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-chats.json +54 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-dashboard.json +70 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-error-401.json +54 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-error-403.json +54 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-error-404.json +54 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-error-500.json +54 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-error-503.json +54 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-forgot-password.json +59 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-help.json +53 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-otp.json +59 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-overview.json +62 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-settings-account.json +61 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-settings-appearance.json +61 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-settings-display.json +61 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-settings-notifications.json +61 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-settings-profile.json +61 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-settings.json +65 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-shell.json +173 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-sign-in-2.json +67 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-sign-in.json +59 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-sign-up.json +59 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-tasks.json +66 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/admin-users.json +66 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/ai-chat.json +74 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/analytics-dashboard.json +65 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/app-shell-floating.json +54 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/app-shell-icon-rail.json +54 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/app-shell-inset.json +54 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/app-shell-settings.json +54 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/app-shell-sidebar.json +54 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/app-shell-workspace.json +54 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/auth-centered.json +61 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/auth-enterprise.json +61 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/auth-recovery.json +64 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/auth-registration.json +63 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/auth-split.json +67 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/auth.json +61 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/blog.json +64 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/charts.json +238 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/chat-artifact.json +49 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/chat-focused.json +49 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/chat-history.json +49 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/chat-knowledge.json +49 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/chat-support.json +49 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/chat-workspace.json +136 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/collection-shared.json +23 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/commerce-workspace.json +69 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/console-billing.json +68 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/console-page.json +289 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/console-shell.json +29 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/content.json +444 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/creation-shared.json +24 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/crm-workspace.json +73 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/crm.json +67 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/dashboard-01.json +78 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/dashboard.json +257 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/data-studio.json +368 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/data-table.json +352 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/data.json +405 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/document-assistant.json +54 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/document-library.json +49 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/document-reading.json +49 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/document-workspace.json +164 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/document-writing.json +49 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/drilldown-menu.json +233 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/ecommerce.json +65 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/education-workspace.json +82 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/feedback.json +344 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/field.json +164 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/form.json +429 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/grid.json +188 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/interactive.json +355 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/item-grid.json +219 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/kanban.json +154 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/layout.json +790 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/lms.json +74 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/marketing.json +402 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/nav.json +285 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/portfolio.json +62 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/presentation.json +454 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/pricing.json +63 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/primitives.json +360 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/saas-landing.json +60 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sections.json +734 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/settings.json +72 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/shadcn-admin-shell.json +49 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/shadcn-admin.json +77 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sidebar-01.json +42 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sidebar-02.json +42 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sidebar-03.json +30 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sidebar-04.json +30 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sidebar-05.json +36 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sidebar-06.json +42 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sidebar-07.json +54 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sidebar-08.json +54 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sidebar-09.json +36 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sidebar-10.json +66 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sidebar-11.json +30 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sidebar-12.json +48 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sidebar-13.json +30 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sidebar-14.json +30 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sidebar-15.json +84 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sidebar-16.json +66 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sidebar-drilldown.json +29 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/sidebar-primitives.json +155 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/store.json +75 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/support-inbox.json +63 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/team-directory.json +59 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/uibot-base.json +30 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/r/workspace.json +181 -0
- package/dist/snapshots/4501a880e17691677109b35118b89434252d4e65aa7b9a7c3a174a38ce2b418f/snapshot.json +1 -0
- package/dist/templates/auth.yaml +84 -67
- package/dist/templates/shadcn-admin.yaml +12210 -122
- package/package.json +12 -9
package/dist/cli.js
CHANGED
|
@@ -1,142 +1,145 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
var $d=Object.create;var{getPrototypeOf:Md,defineProperty:ns,getOwnPropertyNames:_d}=Object;var is=Object.prototype.hasOwnProperty;function Fd(e){return this[e]}var jd,qd,Bd=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var i=t?jd??=new WeakMap:qd??=new WeakMap,o=i.get(e);if(o)return o}r=e!=null?$d(Md(e)):{};let s=t||!e||!e.__esModule||!is.call(e,"default")?ns(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of _d(e))if(!is.call(s,a))ns(s,a,{get:Fd.bind(e,a),enumerable:!0})}if(n)i.set(e,s);return s};var y=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var K=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};var er=import.meta.require;var Ye=y(function(nD,As){var ef=Number.MAX_SAFE_INTEGER||9007199254740991,tf=["major","premajor","minor","preminor","patch","prepatch","prerelease"];As.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:ef,RELEASE_TYPES:tf,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var yt=y(function(iD,Ds){var rf=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Ds.exports=rf});var Ge=y(function(ie,Os){var{MAX_SAFE_COMPONENT_LENGTH:Xn,MAX_SAFE_BUILD_LENGTH:nf,MAX_LENGTH:of}=Ye(),sf=yt();ie=Os.exports={};var af=ie.re=[],cf=ie.safeRe=[],R=ie.src=[],lf=ie.safeSrc=[],C=ie.t={},uf=0,Zn="[a-zA-Z0-9-]",df=[["\\s",1],["\\d",of],[Zn,nf]],pf=(e)=>{for(let[t,r]of df)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},P=(e,t,r)=>{let n=pf(t),i=uf++;sf(e,i,t),C[e]=i,R[i]=t,lf[i]=n,af[i]=new RegExp(t,r?"g":void 0),cf[i]=new RegExp(n,r?"g":void 0)};P("NUMERICIDENTIFIER","0|[1-9]\\d*");P("NUMERICIDENTIFIERLOOSE","\\d+");P("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Zn}*`);P("MAINVERSION",`(${R[C.NUMERICIDENTIFIER]})\\.(${R[C.NUMERICIDENTIFIER]})\\.(${R[C.NUMERICIDENTIFIER]})`);P("MAINVERSIONLOOSE",`(${R[C.NUMERICIDENTIFIERLOOSE]})\\.(${R[C.NUMERICIDENTIFIERLOOSE]})\\.(${R[C.NUMERICIDENTIFIERLOOSE]})`);P("PRERELEASEIDENTIFIER",`(?:${R[C.NONNUMERICIDENTIFIER]}|${R[C.NUMERICIDENTIFIER]})`);P("PRERELEASEIDENTIFIERLOOSE",`(?:${R[C.NONNUMERICIDENTIFIER]}|${R[C.NUMERICIDENTIFIERLOOSE]})`);P("PRERELEASE",`(?:-(${R[C.PRERELEASEIDENTIFIER]}(?:\\.${R[C.PRERELEASEIDENTIFIER]})*))`);P("PRERELEASELOOSE",`(?:-?(${R[C.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${R[C.PRERELEASEIDENTIFIERLOOSE]})*))`);P("BUILDIDENTIFIER",`${Zn}+`);P("BUILD",`(?:\\+(${R[C.BUILDIDENTIFIER]}(?:\\.${R[C.BUILDIDENTIFIER]})*))`);P("FULLPLAIN",`v?${R[C.MAINVERSION]}${R[C.PRERELEASE]}?${R[C.BUILD]}?`);P("FULL",`^${R[C.FULLPLAIN]}$`);P("LOOSEPLAIN",`[v=\\s]*${R[C.MAINVERSIONLOOSE]}${R[C.PRERELEASELOOSE]}?${R[C.BUILD]}?`);P("LOOSE",`^${R[C.LOOSEPLAIN]}$`);P("GTLT","((?:<|>)?=?)");P("XRANGEIDENTIFIERLOOSE",`${R[C.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);P("XRANGEIDENTIFIER",`${R[C.NUMERICIDENTIFIER]}|x|X|\\*`);P("XRANGEPLAIN",`[v=\\s]*(${R[C.XRANGEIDENTIFIER]})(?:\\.(${R[C.XRANGEIDENTIFIER]})(?:\\.(${R[C.XRANGEIDENTIFIER]})(?:${R[C.PRERELEASE]})?${R[C.BUILD]}?)?)?`);P("XRANGEPLAINLOOSE",`[v=\\s]*(${R[C.XRANGEIDENTIFIERLOOSE]})(?:\\.(${R[C.XRANGEIDENTIFIERLOOSE]})(?:\\.(${R[C.XRANGEIDENTIFIERLOOSE]})(?:${R[C.PRERELEASELOOSE]})?${R[C.BUILD]}?)?)?`);P("XRANGE",`^${R[C.GTLT]}\\s*${R[C.XRANGEPLAIN]}$`);P("XRANGELOOSE",`^${R[C.GTLT]}\\s*${R[C.XRANGEPLAINLOOSE]}$`);P("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Xn}})(?:\\.(\\d{1,${Xn}}))?(?:\\.(\\d{1,${Xn}}))?`);P("COERCE",`${R[C.COERCEPLAIN]}(?:$|[^\\d])`);P("COERCEFULL",R[C.COERCEPLAIN]+`(?:${R[C.PRERELEASE]})?(?:${R[C.BUILD]})?(?:$|[^\\d])`);P("COERCERTL",R[C.COERCE],!0);P("COERCERTLFULL",R[C.COERCEFULL],!0);P("LONETILDE","(?:~>?)");P("TILDETRIM",`(\\s*)${R[C.LONETILDE]}\\s+`,!0);ie.tildeTrimReplace="$1~";P("TILDE",`^${R[C.LONETILDE]}${R[C.XRANGEPLAIN]}$`);P("TILDELOOSE",`^${R[C.LONETILDE]}${R[C.XRANGEPLAINLOOSE]}$`);P("LONECARET","(?:\\^)");P("CARETTRIM",`(\\s*)${R[C.LONECARET]}\\s+`,!0);ie.caretTrimReplace="$1^";P("CARET",`^${R[C.LONECARET]}${R[C.XRANGEPLAIN]}$`);P("CARETLOOSE",`^${R[C.LONECARET]}${R[C.XRANGEPLAINLOOSE]}$`);P("COMPARATORLOOSE",`^${R[C.GTLT]}\\s*(${R[C.LOOSEPLAIN]})$|^$`);P("COMPARATOR",`^${R[C.GTLT]}\\s*(${R[C.FULLPLAIN]})$|^$`);P("COMPARATORTRIM",`(\\s*)${R[C.GTLT]}\\s*(${R[C.LOOSEPLAIN]}|${R[C.XRANGEPLAIN]})`,!0);ie.comparatorTrimReplace="$1$2$3";P("HYPHENRANGE",`^\\s*(${R[C.XRANGEPLAIN]})\\s+-\\s+(${R[C.XRANGEPLAIN]})\\s*$`);P("HYPHENRANGELOOSE",`^\\s*(${R[C.XRANGEPLAINLOOSE]})\\s+-\\s+(${R[C.XRANGEPLAINLOOSE]})\\s*$`);P("STAR","(<|>)?=?\\s*\\*");P("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");P("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var pr=y(function(oD,Ts){var ff=Object.freeze({loose:!0}),gf=Object.freeze({}),mf=(e)=>{if(!e)return gf;if(typeof e!=="object")return ff;return e};Ts.exports=mf});var ei=y(function(sD,$s){var Ls=/^[0-9]+$/,Ns=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=Ls.test(e),n=Ls.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},hf=(e,t)=>Ns(t,e);$s.exports={compareIdentifiers:Ns,rcompareIdentifiers:hf}});var q=y(function(aD,_s){var fr=yt(),{MAX_LENGTH:Ms,MAX_SAFE_INTEGER:gr}=Ye(),{safeRe:mr,t:hr}=Ge(),yf=pr(),{compareIdentifiers:ti}=ei(),bf=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(ti(e[n],r[n])!==0)return!1;return!0};class te{constructor(e,t){if(t=yf(t),e instanceof te)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else e=e.version;else if(typeof e!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Ms)throw TypeError(`version is longer than ${Ms} characters`);fr("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?mr[hr.LOOSE]:mr[hr.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>gr||this.major<0)throw TypeError("Invalid major version");if(this.minor>gr||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>gr||this.patch<0)throw TypeError("Invalid patch version");if(!r[4])this.prerelease=[];else this.prerelease=r[4].split(".").map((n)=>{if(/^[0-9]+$/.test(n)){let i=+n;if(i>=0&&i<gr)return i}return n});this.build=r[5]?r[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(e){if(fr("SemVer.compare",this.version,this.options,e),!(e instanceof te)){if(typeof e==="string"&&e===this.version)return 0;e=new te(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof te))e=new te(e,this.options);if(this.major<e.major)return-1;if(this.major>e.major)return 1;if(this.minor<e.minor)return-1;if(this.minor>e.minor)return 1;if(this.patch<e.patch)return-1;if(this.patch>e.patch)return 1;return 0}comparePre(e){if(!(e instanceof te))e=new te(e,this.options);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(fr("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return ti(r,n)}while(++t)}compareBuild(e){if(!(e instanceof te))e=new te(e,this.options);let t=0;do{let r=this.build[t],n=e.build[t];if(fr("build compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return ti(r,n)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?mr[hr.PRERELEASELOOSE]:mr[hr.PRERELEASE]);if(!n||n[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",t,r);this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let n=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let i=this.prerelease.length;while(--i>=0)if(typeof this.prerelease[i]==="number")this.prerelease[i]++,i=-2;if(i===-1){if(t===this.prerelease.join(".")&&r===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let i=[t,n];if(r===!1)i=[t];if(bf(this.prerelease,t)){let o=this.prerelease[t.split(".").length];if(isNaN(o))this.prerelease=i}else this.prerelease=i}break}default:throw Error(`invalid increment argument: ${e}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}_s.exports=te});var ye=y(function(cD,js){var Fs=q(),Sf=(e,t,r=!1)=>{if(e instanceof Fs)return e;try{return new Fs(e,t)}catch(n){if(!r)return null;throw n}};js.exports=Sf});var Bs=y(function(lD,qs){var Rf=ye(),Cf=(e,t)=>{let r=Rf(e,t);return r?r.version:null};qs.exports=Cf});var Vs=y(function(uD,Us){var kf=ye(),wf=(e,t)=>{let r=kf(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};Us.exports=wf});var zs=y(function(dD,Hs){var Ks=q(),xf=(e,t,r,n,i)=>{if(typeof r==="string")i=n,n=r,r=void 0;try{return new Ks(e instanceof Ks?e.version:e,r).inc(t,n,i).version}catch(o){return null}};Hs.exports=xf});var Ws=y(function(pD,Gs){var Ys=ye(),vf=(e,t)=>{let r=Ys(e,null,!0),n=Ys(t,null,!0),i=r.compare(n);if(i===0)return null;let o=i>0,s=o?r:n,a=o?n:r,c=!!s.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(s)===0){if(a.minor&&!a.patch)return"minor";return"patch"}}let d=c?"pre":"";if(r.major!==n.major)return d+"major";if(r.minor!==n.minor)return d+"minor";if(r.patch!==n.patch)return d+"patch";return"prerelease"};Gs.exports=vf});var Qs=y(function(fD,Js){var Ef=q(),If=(e,t)=>new Ef(e,t).major;Js.exports=If});var Zs=y(function(gD,Xs){var Pf=q(),Af=(e,t)=>new Pf(e,t).minor;Xs.exports=Af});var ta=y(function(mD,ea){var Df=q(),Of=(e,t)=>new Df(e,t).patch;ea.exports=Of});var na=y(function(hD,ra){var Tf=ye(),Lf=(e,t)=>{let r=Tf(e,t);return r&&r.prerelease.length?r.prerelease:null};ra.exports=Lf});var W=y(function(yD,oa){var ia=q(),Nf=(e,t,r)=>new ia(e,r).compare(new ia(t,r));oa.exports=Nf});var aa=y(function(bD,sa){var $f=W(),Mf=(e,t,r)=>$f(t,e,r);sa.exports=Mf});var la=y(function(SD,ca){var _f=W(),Ff=(e,t)=>_f(e,t,!0);ca.exports=Ff});var yr=y(function(RD,da){var ua=q(),jf=(e,t,r)=>{let n=new ua(e,r),i=new ua(t,r);return n.compare(i)||n.compareBuild(i)};da.exports=jf});var fa=y(function(CD,pa){var qf=yr(),Bf=(e,t)=>e.sort((r,n)=>qf(r,n,t));pa.exports=Bf});var ma=y(function(kD,ga){var Uf=yr(),Vf=(e,t)=>e.sort((r,n)=>Uf(n,r,t));ga.exports=Vf});var bt=y(function(wD,ha){var Kf=W(),Hf=(e,t,r)=>Kf(e,t,r)>0;ha.exports=Hf});var br=y(function(xD,ya){var zf=W(),Yf=(e,t,r)=>zf(e,t,r)<0;ya.exports=Yf});var ri=y(function(vD,ba){var Gf=W(),Wf=(e,t,r)=>Gf(e,t,r)===0;ba.exports=Wf});var ni=y(function(ED,Sa){var Jf=W(),Qf=(e,t,r)=>Jf(e,t,r)!==0;Sa.exports=Qf});var Sr=y(function(ID,Ra){var Xf=W(),Zf=(e,t,r)=>Xf(e,t,r)>=0;Ra.exports=Zf});var Rr=y(function(PD,Ca){var eg=W(),tg=(e,t,r)=>eg(e,t,r)<=0;Ca.exports=tg});var ii=y(function(AD,ka){var rg=ri(),ng=ni(),ig=bt(),og=Sr(),sg=br(),ag=Rr(),cg=(e,t,r,n)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return rg(e,r,n);case"!=":return ng(e,r,n);case">":return ig(e,r,n);case">=":return og(e,r,n);case"<":return sg(e,r,n);case"<=":return ag(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};ka.exports=cg});var xa=y(function(DD,wa){var lg=q(),ug=ye(),{safeRe:Cr,t:kr}=Ge(),dg=(e,t)=>{if(e instanceof lg)return e;if(typeof e==="number")e=String(e);if(typeof e!=="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?Cr[kr.COERCEFULL]:Cr[kr.COERCE]);else{let c=t.includePrerelease?Cr[kr.COERCERTLFULL]:Cr[kr.COERCERTL],l;while((l=c.exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||l.index+l[0].length!==r.index+r[0].length)r=l;c.lastIndex=l.index+l[1].length+l[2].length}c.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",o=r[4]||"0",s=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return ug(`${n}.${i}.${o}${s}${a}`,t)};wa.exports=dg});var Ea=y(function(OD,va){var pg=ye(),fg=Ye(),gg=q(),mg=(e,t,r)=>{if(!fg.RELEASE_TYPES.includes(t))return null;let n=hg(e,r);return n&&yg(n,t)},hg=(e,t)=>{let r=e instanceof gg?e.version:e;return pg(r,t)},yg=(e,t)=>{if(bg(t))return e.version;switch(e.prerelease=[],t){case"major":e.minor=0,e.patch=0;break;case"minor":e.patch=0;break}return e.format()},bg=(e)=>e.startsWith("pre");va.exports=mg});var Aa=y(function(TD,Pa){class Ia{constructor(){this.max=1000,this.map=new Map}get(e){let t=this.map.get(e);if(t===void 0)return;else return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}}Pa.exports=Ia});var J=y(function(LD,La){var Sg=/\s+/g;class St{constructor(e,t){if(t=Cg(t),e instanceof St)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new St(e.raw,t);if(e instanceof oi)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(Sg," "),this.set=this.raw.split("||").map((r)=>this.parseRange(r.trim())).filter((r)=>r.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter((n)=>!Oa(n[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&Dg(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){if(e>0)this.formatted+="||";let t=this.set[e];for(let r=0;r<t.length;r++){if(r>0)this.formatted+=" ";this.formatted+=t[r].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(Ag,"");let r=((this.options.includePrerelease&&Ig)|(this.options.loose&&Pg))+":"+e,n=Da.get(r);if(n)return n;let i=this.options.loose,o=i?V[B.HYPHENRANGELOOSE]:V[B.HYPHENRANGE];e=e.replace(o,Bg(this.options.includePrerelease)),T("hyphen replace",e),e=e.replace(V[B.COMPARATORTRIM],xg),T("comparator trim",e),e=e.replace(V[B.TILDETRIM],vg),T("tilde trim",e),e=e.replace(V[B.CARETTRIM],Eg),T("caret trim",e);let s=e.split(" ").map((d)=>Og(d,this.options)).join(" ").split(/\s+/).map((d)=>qg(d,this.options));if(i)s=s.filter((d)=>(T("loose invalid filter",d,this.options),!!d.match(V[B.COMPARATORLOOSE])));T("range list",s);let a=new Map,c=s.map((d)=>new oi(d,this.options));for(let d of c){if(Oa(d))return[d];a.set(d.value,d)}if(a.size>1&&a.has(""))a.delete("");let l=[...a.values()];return Da.set(r,l),l}intersects(e,t){if(!(e instanceof St))throw TypeError("a Range is required");return this.set.some((r)=>Ta(r,t)&&e.set.some((n)=>Ta(n,t)&&r.every((i)=>n.every((o)=>i.intersects(o,t)))))}test(e){if(!e)return!1;if(typeof e==="string")try{e=new kg(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(Ug(this.set[t],e,this.options))return!0;return!1}}La.exports=St;var Rg=Aa(),Da=new Rg,Cg=pr(),oi=Rt(),T=yt(),kg=q(),{safeRe:V,src:wg,t:B,comparatorTrimReplace:xg,tildeTrimReplace:vg,caretTrimReplace:Eg}=Ge(),{FLAG_INCLUDE_PRERELEASE:Ig,FLAG_LOOSE:Pg}=Ye(),Ag=new RegExp(wg[B.BUILD],"g"),Oa=(e)=>e.value==="<0.0.0-0",Dg=(e)=>e.value==="",Ta=(e,t)=>{let r=!0,n=e.slice(),i=n.pop();while(r&&n.length)r=n.every((o)=>i.intersects(o,t)),i=n.pop();return r},Og=(e,t)=>(e=e.replace(V[B.BUILD],""),T("comp",e,t),e=$g(e,t),T("caret",e),e=Lg(e,t),T("tildes",e),e=_g(e,t),T("xrange",e),e=jg(e,t),T("stars",e),e),F=(e)=>!e||e.toLowerCase()==="x"||e==="*",Tg=(e,t,r)=>F(e)&&!F(t)||F(t)&&r&&!F(r),Lg=(e,t)=>e.trim().split(/\s+/).map((r)=>Ng(r,t)).join(" "),Ng=(e,t)=>{let r=t.loose?V[B.TILDELOOSE]:V[B.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(i,o,s,a,c)=>{T("tilde",e,i,o,s,a,c);let l;if(F(o))l="";else if(F(s))l=`>=${o}.0.0${n} <${+o+1}.0.0-0`;else if(F(a))l=`>=${o}.${s}.0${n} <${o}.${+s+1}.0-0`;else if(c)T("replaceTilde pr",c),l=`>=${o}.${s}.${a}-${c} <${o}.${+s+1}.0-0`;else l=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`;return T("tilde return",l),l})},$g=(e,t)=>e.trim().split(/\s+/).map((r)=>Mg(r,t)).join(" "),Mg=(e,t)=>{T("caret",e,t);let r=t.loose?V[B.CARETLOOSE]:V[B.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(i,o,s,a,c)=>{T("caret",e,i,o,s,a,c);let l;if(F(o))l="";else if(F(s))l=`>=${o}.0.0${n} <${+o+1}.0.0-0`;else if(F(a))if(o==="0")l=`>=${o}.${s}.0${n} <${o}.${+s+1}.0-0`;else l=`>=${o}.${s}.0${n} <${+o+1}.0.0-0`;else if(c)if(T("replaceCaret pr",c),o==="0")if(s==="0")l=`>=${o}.${s}.${a}-${c} <${o}.${s}.${+a+1}-0`;else l=`>=${o}.${s}.${a}-${c} <${o}.${+s+1}.0-0`;else l=`>=${o}.${s}.${a}-${c} <${+o+1}.0.0-0`;else if(T("no pr"),o==="0")if(s==="0")l=`>=${o}.${s}.${a} <${o}.${s}.${+a+1}-0`;else l=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`;else l=`>=${o}.${s}.${a} <${+o+1}.0.0-0`;return T("caret return",l),l})},_g=(e,t)=>(T("replaceXRanges",e,t),e.split(/\s+/).map((r)=>Fg(r,t)).join(" ")),Fg=(e,t)=>{e=e.trim();let r=t.loose?V[B.XRANGELOOSE]:V[B.XRANGE];return e.replace(r,(n,i,o,s,a,c)=>{if(T("xRange",e,n,i,o,s,a,c),Tg(o,s,a))return e;let l=F(o),d=l||F(s),p=d||F(a),f=p;if(i==="="&&f)i="";if(c=t.includePrerelease?"-0":"",l)if(i===">"||i==="<")n="<0.0.0-0";else n="*";else if(i&&f){if(d)s=0;if(a=0,i===">")if(i=">=",d)o=+o+1,s=0,a=0;else s=+s+1,a=0;else if(i==="<=")if(i="<",d)o=+o+1;else s=+s+1;if(i==="<")c="-0";n=`${i+o}.${s}.${a}${c}`}else if(d)n=`>=${o}.0.0${c} <${+o+1}.0.0-0`;else if(p)n=`>=${o}.${s}.0${c} <${o}.${+s+1}.0-0`;return T("xRange return",n),n})},jg=(e,t)=>(T("replaceStars",e,t),e.trim().replace(V[B.STAR],"")),qg=(e,t)=>(T("replaceGTE0",e,t),e.trim().replace(V[t.includePrerelease?B.GTE0PRE:B.GTE0],"")),Bg=(e)=>(t,r,n,i,o,s,a,c,l,d,p,f)=>{if(F(n))r="";else if(F(i))r=`>=${n}.0.0${e?"-0":""}`;else if(F(o))r=`>=${n}.${i}.0${e?"-0":""}`;else if(s)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(F(l))c="";else if(F(d))c=`<${+l+1}.0.0-0`;else if(F(p))c=`<${l}.${+d+1}.0-0`;else if(f)c=`<=${l}.${d}.${p}-${f}`;else if(e)c=`<${l}.${d}.${+p+1}-0`;else c=`<=${c}`;return`${r} ${c}`.trim()},Ug=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++){if(T(e[n].semver),e[n].semver===oi.ANY)continue;if(e[n].semver.prerelease.length>0){let i=e[n].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}}return!1}return!0}});var Rt=y(function(ND,ja){var Ct=Symbol("SemVer ANY");class wr{static get ANY(){return Ct}constructor(e,t){if(t=Na(t),e instanceof wr)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),ai("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===Ct)this.value="";else this.value=this.operator+this.semver.version;ai("comp",this)}parse(e){let t=this.options.loose?$a[Ma.COMPARATORLOOSE]:$a[Ma.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);if(this.operator=r[1]!==void 0?r[1]:"",this.operator==="=")this.operator="";if(!r[2])this.semver=Ct;else this.semver=new _a(r[2],this.options.loose)}toString(){return this.value}test(e){if(ai("Comparator.test",e,this.options.loose),this.semver===Ct||e===Ct)return!0;if(typeof e==="string")try{e=new _a(e,this.options)}catch(t){return!1}return si(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof wr))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new Fa(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new Fa(this.value,t).test(e.semver)}if(t=Na(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0"))return!1;if(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&e.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&e.operator.startsWith("<"))return!0;if(this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("="))return!0;if(si(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(si(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}ja.exports=wr;var Na=pr(),{safeRe:$a,t:Ma}=Ge(),si=ii(),ai=yt(),_a=q(),Fa=J()});var kt=y(function($D,qa){var Vg=J(),Kg=(e,t,r)=>{try{t=new Vg(t,r)}catch(n){return!1}return t.test(e)};qa.exports=Kg});var Ua=y(function(MD,Ba){var Hg=J(),zg=(e,t)=>new Hg(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));Ba.exports=zg});var Ka=y(function(_D,Va){var Yg=q(),Gg=J(),Wg=(e,t,r)=>{let n=null,i=null,o=null;try{o=new Gg(t,r)}catch(s){return null}return e.forEach((s)=>{if(o.test(s)){if(!n||i.compare(s)===-1)n=s,i=new Yg(n,r)}}),n};Va.exports=Wg});var za=y(function(FD,Ha){var Jg=q(),Qg=J(),Xg=(e,t,r)=>{let n=null,i=null,o=null;try{o=new Qg(t,r)}catch(s){return null}return e.forEach((s)=>{if(o.test(s)){if(!n||i.compare(s)===1)n=s,i=new Jg(n,r)}}),n};Ha.exports=Xg});var Wa=y(function(jD,Ga){var ci=q(),Zg=J(),Ya=bt(),em=(e,t)=>{e=new Zg(e,t);let r=new ci("0.0.0");if(e.test(r))return r;if(r=new ci("0.0.0-0"),e.test(r))return r;r=null;for(let n=0;n<e.set.length;++n){let i=e.set[n],o=null;if(i.forEach((s)=>{let a=new ci(s.semver.version);switch(s.operator){case">":if(a.prerelease.length===0)a.patch++;else a.prerelease.push(0);a.raw=a.format();case"":case">=":if(!o||Ya(a,o))o=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${s.operator}`)}}),o&&(!r||Ya(r,o)))r=o}if(r&&e.test(r))return r;return null};Ga.exports=em});var Qa=y(function(qD,Ja){var tm=J(),rm=(e,t)=>{try{return new tm(e,t).range||"*"}catch(r){return null}};Ja.exports=rm});var xr=y(function(BD,tc){var nm=q(),ec=Rt(),{ANY:im}=ec,om=J(),sm=kt(),Xa=bt(),Za=br(),am=Rr(),cm=Sr(),lm=(e,t,r,n)=>{e=new nm(e,n),t=new om(t,n);let i,o,s,a,c;switch(r){case">":i=Xa,o=am,s=Za,a=">",c=">=";break;case"<":i=Za,o=cm,s=Xa,a="<",c="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(sm(e,t,n))return!1;for(let l=0;l<t.set.length;++l){let d=t.set[l],p=null,f=null;if(d.forEach((u)=>{if(u.semver===im)u=new ec(">=0.0.0");if(p=p||u,f=f||u,i(u.semver,p.semver,n))p=u;else if(s(u.semver,f.semver,n))f=u}),p.operator===a||p.operator===c)return!1;if((!f.operator||f.operator===a)&&o(e,f.semver))return!1;else if(f.operator===c&&s(e,f.semver))return!1}return!0};tc.exports=lm});var nc=y(function(UD,rc){var um=xr(),dm=(e,t,r)=>um(e,t,">",r);rc.exports=dm});var oc=y(function(VD,ic){var pm=xr(),fm=(e,t,r)=>pm(e,t,"<",r);ic.exports=fm});var cc=y(function(KD,ac){var sc=J(),gm=(e,t,r)=>(e=new sc(e,r),t=new sc(t,r),e.intersects(t,r));ac.exports=gm});var uc=y(function(HD,lc){var mm=kt(),hm=W();lc.exports=(e,t,r)=>{let n=[],i=null,o=null,s=e.sort((d,p)=>hm(d,p,r));for(let d of s)if(mm(d,t,r)){if(o=d,!i)i=d}else{if(o)n.push([i,o]);o=null,i=null}if(i)n.push([i,null]);let a=[];for(let[d,p]of n)if(d===p)a.push(d);else if(!p&&d===s[0])a.push("*");else if(!p)a.push(`>=${d}`);else if(d===s[0])a.push(`<=${p}`);else a.push(`${d} - ${p}`);let c=a.join(" || "),l=typeof t.raw==="string"?t.raw:String(t);return c.length<l.length?c:t}});var hc=y(function(zD,mc){var dc=J(),di=Rt(),{ANY:li}=di,ui=kt(),pi=W(),ym=(e,t,r={})=>{if(e===t)return!0;e=new dc(e,r),t=new dc(t,r);let n=!1;e:for(let i of e.set){for(let o of t.set){let s=Sm(i,o,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},bm=[new di(">=0.0.0-0")],pc=[new di(">=0.0.0")],Sm=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===li)if(t.length===1&&t[0].semver===li)return!0;else if(r.includePrerelease)e=bm;else e=pc;if(t.length===1&&t[0].semver===li)if(r.includePrerelease)return!0;else t=pc;let n=new Set,i,o;for(let u of e)if(u.operator===">"||u.operator===">=")i=fc(i,u,r);else if(u.operator==="<"||u.operator==="<=")o=gc(o,u,r);else n.add(u.semver);if(n.size>1)return null;let s;if(i&&o){if(s=pi(i.semver,o.semver,r),s>0)return null;else if(s===0&&(i.operator!==">="||o.operator!=="<="))return null}for(let u of n){if(i&&!ui(u,String(i),r))return null;if(o&&!ui(u,String(o),r))return null;for(let m of t)if(!ui(u,String(m),r))return!1;return!0}let a,c,l,d,p=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,f=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;if(p&&p.prerelease.length===1&&o.operator==="<"&&p.prerelease[0]===0)p=!1;for(let u of t){if(d=d||u.operator===">"||u.operator===">=",l=l||u.operator==="<"||u.operator==="<=",i){if(f){if(u.semver.prerelease&&u.semver.prerelease.length&&u.semver.major===f.major&&u.semver.minor===f.minor&&u.semver.patch===f.patch)f=!1}if(u.operator===">"||u.operator===">="){if(a=fc(i,u,r),a===u&&a!==i)return!1}else if(i.operator===">="&&!u.test(i.semver))return!1}if(o){if(p){if(u.semver.prerelease&&u.semver.prerelease.length&&u.semver.major===p.major&&u.semver.minor===p.minor&&u.semver.patch===p.patch)p=!1}if(u.operator==="<"||u.operator==="<="){if(c=gc(o,u,r),c===u&&c!==o)return!1}else if(o.operator==="<="&&!u.test(o.semver))return!1}if(!u.operator&&(o||i)&&s!==0)return!1}if(i&&l&&!o&&s!==0)return!1;if(o&&d&&!i&&s!==0)return!1;if(f||p)return!1;return!0},fc=(e,t,r)=>{if(!e)return t;let n=pi(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},gc=(e,t,r)=>{if(!e)return t;let n=pi(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};mc.exports=ym});var Rc=y(function(YD,Sc){var fi=Ge(),yc=Ye(),Rm=q(),bc=ei(),Cm=ye(),km=Bs(),wm=Vs(),xm=zs(),vm=Ws(),Em=Qs(),Im=Zs(),Pm=ta(),Am=na(),Dm=W(),Om=aa(),Tm=la(),Lm=yr(),Nm=fa(),$m=ma(),Mm=bt(),_m=br(),Fm=ri(),jm=ni(),qm=Sr(),Bm=Rr(),Um=ii(),Vm=xa(),Km=Ea(),Hm=Rt(),zm=J(),Ym=kt(),Gm=Ua(),Wm=Ka(),Jm=za(),Qm=Wa(),Xm=Qa(),Zm=xr(),eh=nc(),th=oc(),rh=cc(),nh=uc(),ih=hc();Sc.exports={parse:Cm,valid:km,clean:wm,inc:xm,diff:vm,major:Em,minor:Im,patch:Pm,prerelease:Am,compare:Dm,rcompare:Om,compareLoose:Tm,compareBuild:Lm,sort:Nm,rsort:$m,gt:Mm,lt:_m,eq:Fm,neq:jm,gte:qm,lte:Bm,cmp:Um,coerce:Vm,truncate:Km,Comparator:Hm,Range:zm,satisfies:Ym,toComparators:Gm,maxSatisfying:Wm,minSatisfying:Jm,minVersion:Qm,validRange:Xm,outside:Zm,gtr:eh,ltr:th,intersects:rh,simplifyRange:nh,subset:ih,SemVer:Rm,re:fi.re,src:fi.src,tokens:fi.t,SEMVER_SPEC_VERSION:yc.SEMVER_SPEC_VERSION,RELEASE_TYPES:yc.RELEASE_TYPES,compareIdentifiers:bc.compareIdentifiers,rcompareIdentifiers:bc.rcompareIdentifiers}});var oh;var gi=K(()=>{oh=Bd(Rc(),1)});var A=y(function(fh){var mi=Symbol.for("yaml.alias"),Cc=Symbol.for("yaml.document"),vr=Symbol.for("yaml.map"),kc=Symbol.for("yaml.pair"),hi=Symbol.for("yaml.scalar"),Er=Symbol.for("yaml.seq"),pe=Symbol.for("yaml.node.type"),sh=(e)=>!!e&&typeof e==="object"&&e[pe]===mi,ah=(e)=>!!e&&typeof e==="object"&&e[pe]===Cc,ch=(e)=>!!e&&typeof e==="object"&&e[pe]===vr,lh=(e)=>!!e&&typeof e==="object"&&e[pe]===kc,wc=(e)=>!!e&&typeof e==="object"&&e[pe]===hi,uh=(e)=>!!e&&typeof e==="object"&&e[pe]===Er;function xc(e){if(e&&typeof e==="object")switch(e[pe]){case vr:case Er:return!0}return!1}function dh(e){if(e&&typeof e==="object")switch(e[pe]){case mi:case vr:case hi:case Er:return!0}return!1}var ph=(e)=>(wc(e)||xc(e))&&!!e.anchor;fh.ALIAS=mi;fh.DOC=Cc;fh.MAP=vr;fh.NODE_TYPE=pe;fh.PAIR=kc;fh.SCALAR=hi;fh.SEQ=Er;fh.hasAnchor=ph;fh.isAlias=sh;fh.isCollection=xc;fh.isDocument=ah;fh.isMap=ch;fh.isNode=dh;fh.isPair=lh;fh.isScalar=wc;fh.isSeq=uh});var wt=y(function(Dh){var j=A(),z=Symbol("break visit"),vc=Symbol("skip children"),oe=Symbol("remove node");function Ir(e,t){let r=Ec(t);if(j.isDocument(e)){if(We(null,e.contents,r,Object.freeze([e]))===oe)e.contents=null}else We(null,e,r,Object.freeze([]))}Ir.BREAK=z;Ir.SKIP=vc;Ir.REMOVE=oe;function We(e,t,r,n){let i=Ic(e,t,r,n);if(j.isNode(i)||j.isPair(i))return Pc(e,n,i),We(e,i,r,n);if(typeof i!=="symbol"){if(j.isCollection(t)){n=Object.freeze(n.concat(t));for(let o=0;o<t.items.length;++o){let s=We(o,t.items[o],r,n);if(typeof s==="number")o=s-1;else if(s===z)return z;else if(s===oe)t.items.splice(o,1),o-=1}}else if(j.isPair(t)){n=Object.freeze(n.concat(t));let o=We("key",t.key,r,n);if(o===z)return z;else if(o===oe)t.key=null;let s=We("value",t.value,r,n);if(s===z)return z;else if(s===oe)t.value=null}}return i}async function Pr(e,t){let r=Ec(t);if(j.isDocument(e)){if(await Je(null,e.contents,r,Object.freeze([e]))===oe)e.contents=null}else await Je(null,e,r,Object.freeze([]))}Pr.BREAK=z;Pr.SKIP=vc;Pr.REMOVE=oe;async function Je(e,t,r,n){let i=await Ic(e,t,r,n);if(j.isNode(i)||j.isPair(i))return Pc(e,n,i),Je(e,i,r,n);if(typeof i!=="symbol"){if(j.isCollection(t)){n=Object.freeze(n.concat(t));for(let o=0;o<t.items.length;++o){let s=await Je(o,t.items[o],r,n);if(typeof s==="number")o=s-1;else if(s===z)return z;else if(s===oe)t.items.splice(o,1),o-=1}}else if(j.isPair(t)){n=Object.freeze(n.concat(t));let o=await Je("key",t.key,r,n);if(o===z)return z;else if(o===oe)t.key=null;let s=await Je("value",t.value,r,n);if(s===z)return z;else if(s===oe)t.value=null}}return i}function Ec(e){if(typeof e==="object"&&(e.Collection||e.Node||e.Value))return 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);return e}function Ic(e,t,r,n){if(typeof r==="function")return r(e,t,n);if(j.isMap(t))return r.Map?.(e,t,n);if(j.isSeq(t))return r.Seq?.(e,t,n);if(j.isPair(t))return r.Pair?.(e,t,n);if(j.isScalar(t))return r.Scalar?.(e,t,n);if(j.isAlias(t))return r.Alias?.(e,t,n);return}function Pc(e,t,r){let n=t[t.length-1];if(j.isCollection(n))n.items[e]=r;else if(j.isPair(n))if(e==="key")n.key=r;else n.value=r;else if(j.isDocument(n))n.contents=r;else{let i=j.isAlias(n)?"alias":"scalar";throw Error(`Cannot replace node with ${i} parent`)}}Dh.visit=Ir;Dh.visitAsync=Pr});var yi=y(function(Mh){var Ac=A(),Lh=wt(),Nh={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},$h=(e)=>e.replace(/[!,[\]{}]/g,(t)=>Nh[t]);class Q{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Q.defaultYaml,e),this.tags=Object.assign({},Q.defaultTags,t)}clone(){let e=new Q(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new Q(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Q.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Q.defaultTags);break}return e}add(e,t){if(this.atNextDocument)this.yaml={explicit:Q.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Q.defaultTags),this.atNextDocument=!1;let r=e.trim().split(/[ \t]+/),n=r.shift();switch(n){case"%TAG":{if(r.length!==2){if(t(0,"%TAG directive should contain exactly two parts"),r.length<2)return!1}let[i,o]=r;return this.tags[i]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[i]=r;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;else{let o=/^\d+\.\d+$/.test(i);return t(6,`Unsupported YAML version ${i}`,o),!1}}default:return t(0,`Unknown directive ${n}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);if(o==="!"||o==="!!")return t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null;if(e[e.length-1]!==">")t("Verbatim tags must end with a >");return o}let[,r,n]=e.match(/^(.*!)([^!]*)$/s);if(!n)t(`The ${e} tag has no suffix`);let i=this.tags[r];if(i)try{return i+decodeURIComponent(n)}catch(o){return t(String(o)),null}if(r==="!")return e;return t(`Could not resolve tag: ${e}`),null}tagString(e){for(let[t,r]of Object.entries(this.tags))if(e.startsWith(r))return t+$h(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),n;if(e&&r.length>0&&Ac.isNode(e.contents)){let i={};Lh.visit(e.contents,(o,s)=>{if(Ac.isNode(s)&&s.tag)i[s.tag]=!0}),n=Object.keys(i)}else n=[];for(let[i,o]of r){if(i==="!!"&&o==="tag:yaml.org,2002:")continue;if(!e||n.some((s)=>s.startsWith(o)))t.push(`%TAG ${i} ${o}`)}return t.join(`
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { createRequire as __uibotCreateRequire } from "node:module";
|
|
3
|
+
import { fileURLToPath as __uibotFileURLToPath } from "node:url";
|
|
4
|
+
const __uibotRequire = __uibotCreateRequire(import.meta.url);
|
|
5
|
+
const __uibotDir = __uibotFileURLToPath(new URL(".", import.meta.url));
|
|
6
|
+
import{createRequire as gf}from"node:module";var af=Object.create;var{getPrototypeOf:cf,defineProperty:Xs,getOwnPropertyNames:lf}=Object;var Zs=Object.prototype.hasOwnProperty;function uf(e){return this[e]}var df,pf,ff=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var i=t?df??=new WeakMap:pf??=new WeakMap,o=i.get(e);if(o)return o}r=e!=null?af(cf(e)):{};let s=t||!e||!e.__esModule||!Zs.call(e,"default")?Xs(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of lf(e))if(!Zs.call(s,a))Xs(s,a,{get:uf.bind(e,a),enumerable:!0})}if(n)i.set(e,s);return s};var b=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var X=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};var at=gf(import.meta.url);var ht=b(function(FD,Ta){var Hg=Number.MAX_SAFE_INTEGER||9007199254740991,Kg=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Ta.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Hg,RELEASE_TYPES:Kg,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Kt=b(function(qD,Na){var zg=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Na.exports=zg});var yt=b(function(we,La){var{MAX_SAFE_COMPONENT_LENGTH:ji,MAX_SAFE_BUILD_LENGTH:Gg,MAX_LENGTH:Yg}=ht(),Jg=Kt();we=La.exports={};var Wg=we.re=[],Qg=we.safeRe=[],x=we.src=[],Xg=we.safeSrc=[],I=we.t={},Zg=0,Fi="[a-zA-Z0-9-]",em=[["\\s",1],["\\d",Yg],[Fi,Gg]],tm=(e)=>{for(let[t,r]of em)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},L=(e,t,r)=>{let n=tm(t),i=Zg++;Jg(e,i,t),I[e]=i,x[i]=t,Xg[i]=n,Wg[i]=new RegExp(t,r?"g":void 0),Qg[i]=new RegExp(n,r?"g":void 0)};L("NUMERICIDENTIFIER","0|[1-9]\\d*");L("NUMERICIDENTIFIERLOOSE","\\d+");L("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Fi}*`);L("MAINVERSION",`(${x[I.NUMERICIDENTIFIER]})\\.(${x[I.NUMERICIDENTIFIER]})\\.(${x[I.NUMERICIDENTIFIER]})`);L("MAINVERSIONLOOSE",`(${x[I.NUMERICIDENTIFIERLOOSE]})\\.(${x[I.NUMERICIDENTIFIERLOOSE]})\\.(${x[I.NUMERICIDENTIFIERLOOSE]})`);L("PRERELEASEIDENTIFIER",`(?:${x[I.NONNUMERICIDENTIFIER]}|${x[I.NUMERICIDENTIFIER]})`);L("PRERELEASEIDENTIFIERLOOSE",`(?:${x[I.NONNUMERICIDENTIFIER]}|${x[I.NUMERICIDENTIFIERLOOSE]})`);L("PRERELEASE",`(?:-(${x[I.PRERELEASEIDENTIFIER]}(?:\\.${x[I.PRERELEASEIDENTIFIER]})*))`);L("PRERELEASELOOSE",`(?:-?(${x[I.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${x[I.PRERELEASEIDENTIFIERLOOSE]})*))`);L("BUILDIDENTIFIER",`${Fi}+`);L("BUILD",`(?:\\+(${x[I.BUILDIDENTIFIER]}(?:\\.${x[I.BUILDIDENTIFIER]})*))`);L("FULLPLAIN",`v?${x[I.MAINVERSION]}${x[I.PRERELEASE]}?${x[I.BUILD]}?`);L("FULL",`^${x[I.FULLPLAIN]}$`);L("LOOSEPLAIN",`[v=\\s]*${x[I.MAINVERSIONLOOSE]}${x[I.PRERELEASELOOSE]}?${x[I.BUILD]}?`);L("LOOSE",`^${x[I.LOOSEPLAIN]}$`);L("GTLT","((?:<|>)?=?)");L("XRANGEIDENTIFIERLOOSE",`${x[I.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);L("XRANGEIDENTIFIER",`${x[I.NUMERICIDENTIFIER]}|x|X|\\*`);L("XRANGEPLAIN",`[v=\\s]*(${x[I.XRANGEIDENTIFIER]})(?:\\.(${x[I.XRANGEIDENTIFIER]})(?:\\.(${x[I.XRANGEIDENTIFIER]})(?:${x[I.PRERELEASE]})?${x[I.BUILD]}?)?)?`);L("XRANGEPLAINLOOSE",`[v=\\s]*(${x[I.XRANGEIDENTIFIERLOOSE]})(?:\\.(${x[I.XRANGEIDENTIFIERLOOSE]})(?:\\.(${x[I.XRANGEIDENTIFIERLOOSE]})(?:${x[I.PRERELEASELOOSE]})?${x[I.BUILD]}?)?)?`);L("XRANGE",`^${x[I.GTLT]}\\s*${x[I.XRANGEPLAIN]}$`);L("XRANGELOOSE",`^${x[I.GTLT]}\\s*${x[I.XRANGEPLAINLOOSE]}$`);L("COERCEPLAIN",`(^|[^\\d])(\\d{1,${ji}})(?:\\.(\\d{1,${ji}}))?(?:\\.(\\d{1,${ji}}))?`);L("COERCE",`${x[I.COERCEPLAIN]}(?:$|[^\\d])`);L("COERCEFULL",x[I.COERCEPLAIN]+`(?:${x[I.PRERELEASE]})?(?:${x[I.BUILD]})?(?:$|[^\\d])`);L("COERCERTL",x[I.COERCE],!0);L("COERCERTLFULL",x[I.COERCEFULL],!0);L("LONETILDE","(?:~>?)");L("TILDETRIM",`(\\s*)${x[I.LONETILDE]}\\s+`,!0);we.tildeTrimReplace="$1~";L("TILDE",`^${x[I.LONETILDE]}${x[I.XRANGEPLAIN]}$`);L("TILDELOOSE",`^${x[I.LONETILDE]}${x[I.XRANGEPLAINLOOSE]}$`);L("LONECARET","(?:\\^)");L("CARETTRIM",`(\\s*)${x[I.LONECARET]}\\s+`,!0);we.caretTrimReplace="$1^";L("CARET",`^${x[I.LONECARET]}${x[I.XRANGEPLAIN]}$`);L("CARETLOOSE",`^${x[I.LONECARET]}${x[I.XRANGEPLAINLOOSE]}$`);L("COMPARATORLOOSE",`^${x[I.GTLT]}\\s*(${x[I.LOOSEPLAIN]})$|^$`);L("COMPARATOR",`^${x[I.GTLT]}\\s*(${x[I.FULLPLAIN]})$|^$`);L("COMPARATORTRIM",`(\\s*)${x[I.GTLT]}\\s*(${x[I.LOOSEPLAIN]}|${x[I.XRANGEPLAIN]})`,!0);we.comparatorTrimReplace="$1$2$3";L("HYPHENRANGE",`^\\s*(${x[I.XRANGEPLAIN]})\\s+-\\s+(${x[I.XRANGEPLAIN]})\\s*$`);L("HYPHENRANGELOOSE",`^\\s*(${x[I.XRANGEPLAINLOOSE]})\\s+-\\s+(${x[I.XRANGEPLAINLOOSE]})\\s*$`);L("STAR","(<|>)?=?\\s*\\*");L("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");L("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Gr=b(function(BD,$a){var rm=Object.freeze({loose:!0}),nm=Object.freeze({}),im=(e)=>{if(!e)return nm;if(typeof e!=="object")return rm;return e};$a.exports=im});var qi=b(function(UD,ja){var _a=/^[0-9]+$/,Ma=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=_a.test(e),n=_a.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},om=(e,t)=>Ma(t,e);ja.exports={compareIdentifiers:Ma,rcompareIdentifiers:om}});var Y=b(function(VD,qa){var Yr=Kt(),{MAX_LENGTH:Fa,MAX_SAFE_INTEGER:Jr}=ht(),{safeRe:Wr,t:Qr}=yt(),sm=Gr(),{compareIdentifiers:Bi}=qi(),am=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(Bi(e[n],r[n])!==0)return!1;return!0};class pe{constructor(e,t){if(t=sm(t),e instanceof pe)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else e=e.version;else if(typeof e!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Fa)throw TypeError(`version is longer than ${Fa} characters`);Yr("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?Wr[Qr.LOOSE]:Wr[Qr.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>Jr||this.major<0)throw TypeError("Invalid major version");if(this.minor>Jr||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>Jr||this.patch<0)throw TypeError("Invalid patch version");if(!r[4])this.prerelease=[];else this.prerelease=r[4].split(".").map((n)=>{if(/^[0-9]+$/.test(n)){let i=+n;if(i>=0&&i<Jr)return i}return n});this.build=r[5]?r[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(e){if(Yr("SemVer.compare",this.version,this.options,e),!(e instanceof pe)){if(typeof e==="string"&&e===this.version)return 0;e=new pe(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof pe))e=new pe(e,this.options);if(this.major<e.major)return-1;if(this.major>e.major)return 1;if(this.minor<e.minor)return-1;if(this.minor>e.minor)return 1;if(this.patch<e.patch)return-1;if(this.patch>e.patch)return 1;return 0}comparePre(e){if(!(e instanceof pe))e=new pe(e,this.options);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(Yr("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return Bi(r,n)}while(++t)}compareBuild(e){if(!(e instanceof pe))e=new pe(e,this.options);let t=0;do{let r=this.build[t],n=e.build[t];if(Yr("build compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return Bi(r,n)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?Wr[Qr.PRERELEASELOOSE]:Wr[Qr.PRERELEASE]);if(!n||n[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",t,r);this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let n=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let i=this.prerelease.length;while(--i>=0)if(typeof this.prerelease[i]==="number")this.prerelease[i]++,i=-2;if(i===-1){if(t===this.prerelease.join(".")&&r===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let i=[t,n];if(r===!1)i=[t];if(am(this.prerelease,t)){let o=this.prerelease[t.split(".").length];if(isNaN(o))this.prerelease=i}else this.prerelease=i}break}default:throw Error(`invalid increment argument: ${e}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}qa.exports=pe});var Ne=b(function(HD,Ua){var Ba=Y(),cm=(e,t,r=!1)=>{if(e instanceof Ba)return e;try{return new Ba(e,t)}catch(n){if(!r)return null;throw n}};Ua.exports=cm});var Ha=b(function(KD,Va){var lm=Ne(),um=(e,t)=>{let r=lm(e,t);return r?r.version:null};Va.exports=um});var za=b(function(zD,Ka){var dm=Ne(),pm=(e,t)=>{let r=dm(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};Ka.exports=pm});var Ja=b(function(GD,Ya){var Ga=Y(),fm=(e,t,r,n,i)=>{if(typeof r==="string")i=n,n=r,r=void 0;try{return new Ga(e instanceof Ga?e.version:e,r).inc(t,n,i).version}catch(o){return null}};Ya.exports=fm});var Xa=b(function(YD,Qa){var Wa=Ne(),gm=(e,t)=>{let r=Wa(e,null,!0),n=Wa(t,null,!0),i=r.compare(n);if(i===0)return null;let o=i>0,s=o?r:n,a=o?n:r,c=!!s.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(s)===0){if(a.minor&&!a.patch)return"minor";return"patch"}}let u=c?"pre":"";if(r.major!==n.major)return u+"major";if(r.minor!==n.minor)return u+"minor";if(r.patch!==n.patch)return u+"patch";return"prerelease"};Qa.exports=gm});var ec=b(function(JD,Za){var mm=Y(),hm=(e,t)=>new mm(e,t).major;Za.exports=hm});var rc=b(function(WD,tc){var ym=Y(),bm=(e,t)=>new ym(e,t).minor;tc.exports=bm});var ic=b(function(QD,nc){var Sm=Y(),wm=(e,t)=>new Sm(e,t).patch;nc.exports=wm});var sc=b(function(XD,oc){var km=Ne(),vm=(e,t)=>{let r=km(e,t);return r&&r.prerelease.length?r.prerelease:null};oc.exports=vm});var ie=b(function(ZD,cc){var ac=Y(),Rm=(e,t,r)=>new ac(e,r).compare(new ac(t,r));cc.exports=Rm});var uc=b(function(eT,lc){var Cm=ie(),xm=(e,t,r)=>Cm(t,e,r);lc.exports=xm});var pc=b(function(tT,dc){var Im=ie(),Em=(e,t)=>Im(e,t,!0);dc.exports=Em});var Xr=b(function(rT,gc){var fc=Y(),Am=(e,t,r)=>{let n=new fc(e,r),i=new fc(t,r);return n.compare(i)||n.compareBuild(i)};gc.exports=Am});var hc=b(function(nT,mc){var Pm=Xr(),Om=(e,t)=>e.sort((r,n)=>Pm(r,n,t));mc.exports=Om});var bc=b(function(iT,yc){var Dm=Xr(),Tm=(e,t)=>e.sort((r,n)=>Dm(n,r,t));yc.exports=Tm});var zt=b(function(oT,Sc){var Nm=ie(),Lm=(e,t,r)=>Nm(e,t,r)>0;Sc.exports=Lm});var Zr=b(function(sT,wc){var $m=ie(),_m=(e,t,r)=>$m(e,t,r)<0;wc.exports=_m});var Ui=b(function(aT,kc){var Mm=ie(),jm=(e,t,r)=>Mm(e,t,r)===0;kc.exports=jm});var Vi=b(function(cT,vc){var Fm=ie(),qm=(e,t,r)=>Fm(e,t,r)!==0;vc.exports=qm});var en=b(function(lT,Rc){var Bm=ie(),Um=(e,t,r)=>Bm(e,t,r)>=0;Rc.exports=Um});var tn=b(function(uT,Cc){var Vm=ie(),Hm=(e,t,r)=>Vm(e,t,r)<=0;Cc.exports=Hm});var Hi=b(function(dT,xc){var Km=Ui(),zm=Vi(),Gm=zt(),Ym=en(),Jm=Zr(),Wm=tn(),Qm=(e,t,r,n)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return Km(e,r,n);case"!=":return zm(e,r,n);case">":return Gm(e,r,n);case">=":return Ym(e,r,n);case"<":return Jm(e,r,n);case"<=":return Wm(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};xc.exports=Qm});var Ec=b(function(pT,Ic){var Xm=Y(),Zm=Ne(),{safeRe:rn,t:nn}=yt(),eh=(e,t)=>{if(e instanceof Xm)return e;if(typeof e==="number")e=String(e);if(typeof e!=="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?rn[nn.COERCEFULL]:rn[nn.COERCE]);else{let c=t.includePrerelease?rn[nn.COERCERTLFULL]:rn[nn.COERCERTL],l;while((l=c.exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||l.index+l[0].length!==r.index+r[0].length)r=l;c.lastIndex=l.index+l[1].length+l[2].length}c.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",o=r[4]||"0",s=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Zm(`${n}.${i}.${o}${s}${a}`,t)};Ic.exports=eh});var Oc=b(function(fT,Pc){var th=Ne(),Ac=ht(),rh=Y(),nh=(e,t,r)=>{if(!Ac.RELEASE_TYPES.includes(t))return null;let n=ih(e,r);return n&&oh(n,t)},ih=(e,t)=>{let r=e instanceof rh?e.version:e;return th(r,t)},oh=(e,t)=>{if(sh(t))return e.version;switch(e.prerelease=[],t){case"major":e.minor=0,e.patch=0;break;case"minor":e.patch=0;break}return e.format()},sh=(e)=>e.startsWith("pre");Pc.exports=nh});var Nc=b(function(gT,Tc){class Dc{constructor(){this.max=1000,this.map=new Map}get(e){let t=this.map.get(e);if(t===void 0)return;else return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}}Tc.exports=Dc});var oe=b(function(mT,Mc){var ah=/\s+/g;class Gt{constructor(e,t){if(t=lh(t),e instanceof Gt)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new Gt(e.raw,t);if(e instanceof on)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(ah," "),this.set=this.raw.split("||").map((r)=>this.parseRange(r.trim())).filter((r)=>r.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter((n)=>!$c(n[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&bh(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){if(e>0)this.formatted+="||";let t=this.set[e];for(let r=0;r<t.length;r++){if(r>0)this.formatted+=" ";this.formatted+=t[r].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(yh,"");let r=((this.options.includePrerelease&&mh)|(this.options.loose&&hh))+":"+e,n=Lc.get(r);if(n)return n;let i=this.options.loose,o=i?W[J.HYPHENRANGELOOSE]:W[J.HYPHENRANGE];e=e.replace(o,Ph(this.options.includePrerelease)),B("hyphen replace",e),e=e.replace(W[J.COMPARATORTRIM],ph),B("comparator trim",e),e=e.replace(W[J.TILDETRIM],fh),B("tilde trim",e),e=e.replace(W[J.CARETTRIM],gh),B("caret trim",e);let s=e.split(" ").map((u)=>Sh(u,this.options)).join(" ").split(/\s+/).map((u)=>Ah(u,this.options));if(i)s=s.filter((u)=>(B("loose invalid filter",u,this.options),!!u.match(W[J.COMPARATORLOOSE])));B("range list",s);let a=new Map,c=s.map((u)=>new on(u,this.options));for(let u of c){if($c(u))return[u];a.set(u.value,u)}if(a.size>1&&a.has(""))a.delete("");let l=[...a.values()];return Lc.set(r,l),l}intersects(e,t){if(!(e instanceof Gt))throw TypeError("a Range is required");return this.set.some((r)=>_c(r,t)&&e.set.some((n)=>_c(n,t)&&r.every((i)=>n.every((o)=>i.intersects(o,t)))))}test(e){if(!e)return!1;if(typeof e==="string")try{e=new uh(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(Oh(this.set[t],e,this.options))return!0;return!1}}Mc.exports=Gt;var ch=Nc(),Lc=new ch,lh=Gr(),on=Yt(),B=Kt(),uh=Y(),{safeRe:W,src:dh,t:J,comparatorTrimReplace:ph,tildeTrimReplace:fh,caretTrimReplace:gh}=yt(),{FLAG_INCLUDE_PRERELEASE:mh,FLAG_LOOSE:hh}=ht(),yh=new RegExp(dh[J.BUILD],"g"),$c=(e)=>e.value==="<0.0.0-0",bh=(e)=>e.value==="",_c=(e,t)=>{let r=!0,n=e.slice(),i=n.pop();while(r&&n.length)r=n.every((o)=>i.intersects(o,t)),i=n.pop();return r},Sh=(e,t)=>(e=e.replace(W[J.BUILD],""),B("comp",e,t),e=Rh(e,t),B("caret",e),e=kh(e,t),B("tildes",e),e=xh(e,t),B("xrange",e),e=Eh(e,t),B("stars",e),e),K=(e)=>!e||e.toLowerCase()==="x"||e==="*",wh=(e,t,r)=>K(e)&&!K(t)||K(t)&&r&&!K(r),kh=(e,t)=>e.trim().split(/\s+/).map((r)=>vh(r,t)).join(" "),vh=(e,t)=>{let r=t.loose?W[J.TILDELOOSE]:W[J.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(i,o,s,a,c)=>{B("tilde",e,i,o,s,a,c);let l;if(K(o))l="";else if(K(s))l=`>=${o}.0.0${n} <${+o+1}.0.0-0`;else if(K(a))l=`>=${o}.${s}.0${n} <${o}.${+s+1}.0-0`;else if(c)B("replaceTilde pr",c),l=`>=${o}.${s}.${a}-${c} <${o}.${+s+1}.0-0`;else l=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`;return B("tilde return",l),l})},Rh=(e,t)=>e.trim().split(/\s+/).map((r)=>Ch(r,t)).join(" "),Ch=(e,t)=>{B("caret",e,t);let r=t.loose?W[J.CARETLOOSE]:W[J.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(i,o,s,a,c)=>{B("caret",e,i,o,s,a,c);let l;if(K(o))l="";else if(K(s))l=`>=${o}.0.0${n} <${+o+1}.0.0-0`;else if(K(a))if(o==="0")l=`>=${o}.${s}.0${n} <${o}.${+s+1}.0-0`;else l=`>=${o}.${s}.0${n} <${+o+1}.0.0-0`;else if(c)if(B("replaceCaret pr",c),o==="0")if(s==="0")l=`>=${o}.${s}.${a}-${c} <${o}.${s}.${+a+1}-0`;else l=`>=${o}.${s}.${a}-${c} <${o}.${+s+1}.0-0`;else l=`>=${o}.${s}.${a}-${c} <${+o+1}.0.0-0`;else if(B("no pr"),o==="0")if(s==="0")l=`>=${o}.${s}.${a} <${o}.${s}.${+a+1}-0`;else l=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`;else l=`>=${o}.${s}.${a} <${+o+1}.0.0-0`;return B("caret return",l),l})},xh=(e,t)=>(B("replaceXRanges",e,t),e.split(/\s+/).map((r)=>Ih(r,t)).join(" ")),Ih=(e,t)=>{e=e.trim();let r=t.loose?W[J.XRANGELOOSE]:W[J.XRANGE];return e.replace(r,(n,i,o,s,a,c)=>{if(B("xRange",e,n,i,o,s,a,c),wh(o,s,a))return e;let l=K(o),u=l||K(s),d=u||K(a),f=d;if(i==="="&&f)i="";if(c=t.includePrerelease?"-0":"",l)if(i===">"||i==="<")n="<0.0.0-0";else n="*";else if(i&&f){if(u)s=0;if(a=0,i===">")if(i=">=",u)o=+o+1,s=0,a=0;else s=+s+1,a=0;else if(i==="<=")if(i="<",u)o=+o+1;else s=+s+1;if(i==="<")c="-0";n=`${i+o}.${s}.${a}${c}`}else if(u)n=`>=${o}.0.0${c} <${+o+1}.0.0-0`;else if(d)n=`>=${o}.${s}.0${c} <${o}.${+s+1}.0-0`;return B("xRange return",n),n})},Eh=(e,t)=>(B("replaceStars",e,t),e.trim().replace(W[J.STAR],"")),Ah=(e,t)=>(B("replaceGTE0",e,t),e.trim().replace(W[t.includePrerelease?J.GTE0PRE:J.GTE0],"")),Ph=(e)=>(t,r,n,i,o,s,a,c,l,u,d,f)=>{if(K(n))r="";else if(K(i))r=`>=${n}.0.0${e?"-0":""}`;else if(K(o))r=`>=${n}.${i}.0${e?"-0":""}`;else if(s)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(K(l))c="";else if(K(u))c=`<${+l+1}.0.0-0`;else if(K(d))c=`<${l}.${+u+1}.0-0`;else if(f)c=`<=${l}.${u}.${d}-${f}`;else if(e)c=`<${l}.${u}.${+d+1}-0`;else c=`<=${c}`;return`${r} ${c}`.trim()},Oh=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++){if(B(e[n].semver),e[n].semver===on.ANY)continue;if(e[n].semver.prerelease.length>0){let i=e[n].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}}return!1}return!0}});var Yt=b(function(hT,Vc){var Jt=Symbol("SemVer ANY");class sn{static get ANY(){return Jt}constructor(e,t){if(t=jc(t),e instanceof sn)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),zi("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===Jt)this.value="";else this.value=this.operator+this.semver.version;zi("comp",this)}parse(e){let t=this.options.loose?Fc[qc.COMPARATORLOOSE]:Fc[qc.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);if(this.operator=r[1]!==void 0?r[1]:"",this.operator==="=")this.operator="";if(!r[2])this.semver=Jt;else this.semver=new Bc(r[2],this.options.loose)}toString(){return this.value}test(e){if(zi("Comparator.test",e,this.options.loose),this.semver===Jt||e===Jt)return!0;if(typeof e==="string")try{e=new Bc(e,this.options)}catch(t){return!1}return Ki(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof sn))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new Uc(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new Uc(this.value,t).test(e.semver)}if(t=jc(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0"))return!1;if(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&e.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&e.operator.startsWith("<"))return!0;if(this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("="))return!0;if(Ki(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(Ki(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}Vc.exports=sn;var jc=Gr(),{safeRe:Fc,t:qc}=yt(),Ki=Hi(),zi=Kt(),Bc=Y(),Uc=oe()});var Wt=b(function(yT,Hc){var Dh=oe(),Th=(e,t,r)=>{try{t=new Dh(t,r)}catch(n){return!1}return t.test(e)};Hc.exports=Th});var zc=b(function(bT,Kc){var Nh=oe(),Lh=(e,t)=>new Nh(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));Kc.exports=Lh});var Yc=b(function(ST,Gc){var $h=Y(),_h=oe(),Mh=(e,t,r)=>{let n=null,i=null,o=null;try{o=new _h(t,r)}catch(s){return null}return e.forEach((s)=>{if(o.test(s)){if(!n||i.compare(s)===-1)n=s,i=new $h(n,r)}}),n};Gc.exports=Mh});var Wc=b(function(wT,Jc){var jh=Y(),Fh=oe(),qh=(e,t,r)=>{let n=null,i=null,o=null;try{o=new Fh(t,r)}catch(s){return null}return e.forEach((s)=>{if(o.test(s)){if(!n||i.compare(s)===1)n=s,i=new jh(n,r)}}),n};Jc.exports=qh});var Zc=b(function(kT,Xc){var Gi=Y(),Bh=oe(),Qc=zt(),Uh=(e,t)=>{e=new Bh(e,t);let r=new Gi("0.0.0");if(e.test(r))return r;if(r=new Gi("0.0.0-0"),e.test(r))return r;r=null;for(let n=0;n<e.set.length;++n){let i=e.set[n],o=null;if(i.forEach((s)=>{let a=new Gi(s.semver.version);switch(s.operator){case">":if(a.prerelease.length===0)a.patch++;else a.prerelease.push(0);a.raw=a.format();case"":case">=":if(!o||Qc(a,o))o=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${s.operator}`)}}),o&&(!r||Qc(r,o)))r=o}if(r&&e.test(r))return r;return null};Xc.exports=Uh});var tl=b(function(vT,el){var Vh=oe(),Hh=(e,t)=>{try{return new Vh(e,t).range||"*"}catch(r){return null}};el.exports=Hh});var an=b(function(RT,ol){var Kh=Y(),il=Yt(),{ANY:zh}=il,Gh=oe(),Yh=Wt(),rl=zt(),nl=Zr(),Jh=tn(),Wh=en(),Qh=(e,t,r,n)=>{e=new Kh(e,n),t=new Gh(t,n);let i,o,s,a,c;switch(r){case">":i=rl,o=Jh,s=nl,a=">",c=">=";break;case"<":i=nl,o=Wh,s=rl,a="<",c="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(Yh(e,t,n))return!1;for(let l=0;l<t.set.length;++l){let u=t.set[l],d=null,f=null;if(u.forEach((p)=>{if(p.semver===zh)p=new il(">=0.0.0");if(d=d||p,f=f||p,i(p.semver,d.semver,n))d=p;else if(s(p.semver,f.semver,n))f=p}),d.operator===a||d.operator===c)return!1;if((!f.operator||f.operator===a)&&o(e,f.semver))return!1;else if(f.operator===c&&s(e,f.semver))return!1}return!0};ol.exports=Qh});var al=b(function(CT,sl){var Xh=an(),Zh=(e,t,r)=>Xh(e,t,">",r);sl.exports=Zh});var ll=b(function(xT,cl){var ey=an(),ty=(e,t,r)=>ey(e,t,"<",r);cl.exports=ty});var pl=b(function(IT,dl){var ul=oe(),ry=(e,t,r)=>(e=new ul(e,r),t=new ul(t,r),e.intersects(t,r));dl.exports=ry});var gl=b(function(ET,fl){var ny=Wt(),iy=ie();fl.exports=(e,t,r)=>{let n=[],i=null,o=null,s=e.sort((u,d)=>iy(u,d,r));for(let u of s)if(ny(u,t,r)){if(o=u,!i)i=u}else{if(o)n.push([i,o]);o=null,i=null}if(i)n.push([i,null]);let a=[];for(let[u,d]of n)if(u===d)a.push(u);else if(!d&&u===s[0])a.push("*");else if(!d)a.push(`>=${u}`);else if(u===s[0])a.push(`<=${d}`);else a.push(`${u} - ${d}`);let c=a.join(" || "),l=typeof t.raw==="string"?t.raw:String(t);return c.length<l.length?c:t}});var wl=b(function(AT,Sl){var ml=oe(),Wi=Yt(),{ANY:Yi}=Wi,Ji=Wt(),Qi=ie(),oy=(e,t,r={})=>{if(e===t)return!0;e=new ml(e,r),t=new ml(t,r);let n=!1;e:for(let i of e.set){for(let o of t.set){let s=ay(i,o,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},sy=[new Wi(">=0.0.0-0")],hl=[new Wi(">=0.0.0")],ay=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Yi)if(t.length===1&&t[0].semver===Yi)return!0;else if(r.includePrerelease)e=sy;else e=hl;if(t.length===1&&t[0].semver===Yi)if(r.includePrerelease)return!0;else t=hl;let n=new Set,i,o;for(let p of e)if(p.operator===">"||p.operator===">=")i=yl(i,p,r);else if(p.operator==="<"||p.operator==="<=")o=bl(o,p,r);else n.add(p.semver);if(n.size>1)return null;let s;if(i&&o){if(s=Qi(i.semver,o.semver,r),s>0)return null;else if(s===0&&(i.operator!==">="||o.operator!=="<="))return null}for(let p of n){if(i&&!Ji(p,String(i),r))return null;if(o&&!Ji(p,String(o),r))return null;for(let m of t)if(!Ji(p,String(m),r))return!1;return!0}let a,c,l,u,d=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,f=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;if(d&&d.prerelease.length===1&&o.operator==="<"&&d.prerelease[0]===0)d=!1;for(let p of t){if(u=u||p.operator===">"||p.operator===">=",l=l||p.operator==="<"||p.operator==="<=",i){if(f){if(p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===f.major&&p.semver.minor===f.minor&&p.semver.patch===f.patch)f=!1}if(p.operator===">"||p.operator===">="){if(a=yl(i,p,r),a===p&&a!==i)return!1}else if(i.operator===">="&&!p.test(i.semver))return!1}if(o){if(d){if(p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===d.major&&p.semver.minor===d.minor&&p.semver.patch===d.patch)d=!1}if(p.operator==="<"||p.operator==="<="){if(c=bl(o,p,r),c===p&&c!==o)return!1}else if(o.operator==="<="&&!p.test(o.semver))return!1}if(!p.operator&&(o||i)&&s!==0)return!1}if(i&&l&&!o&&s!==0)return!1;if(o&&u&&!i&&s!==0)return!1;if(f||d)return!1;return!0},yl=(e,t,r)=>{if(!e)return t;let n=Qi(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},bl=(e,t,r)=>{if(!e)return t;let n=Qi(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};Sl.exports=oy});var vl=b(function(PT,kl){var bt=yt(),cn=ht(),cy=Y(),ln=qi(),ly=Ne(),uy=Ha(),dy=za(),py=Ja(),fy=Xa(),gy=ec(),my=rc(),hy=ic(),yy=sc(),by=ie(),Sy=uc(),wy=pc(),ky=Xr(),vy=hc(),Ry=bc(),Cy=zt(),xy=Zr(),Iy=Ui(),Ey=Vi(),Ay=en(),Py=tn(),Oy=Hi(),Dy=Ec(),Ty=Oc(),Ny=Yt(),Ly=oe(),$y=Wt(),_y=zc(),My=Yc(),jy=Wc(),Fy=Zc(),qy=tl(),By=an(),Uy=al(),Vy=ll(),Hy=pl(),Ky=gl(),zy=wl();kl.exports={parse:ly,valid:uy,clean:dy,inc:py,diff:fy,major:gy,minor:my,patch:hy,prerelease:yy,compare:by,rcompare:Sy,compareLoose:wy,compareBuild:ky,sort:vy,rsort:Ry,gt:Cy,lt:xy,eq:Iy,neq:Ey,gte:Ay,lte:Py,cmp:Oy,coerce:Dy,truncate:Ty,Comparator:Ny,Range:Ly,satisfies:$y,toComparators:_y,maxSatisfying:My,minSatisfying:jy,minVersion:Fy,validRange:qy,outside:By,gtr:Uy,ltr:Vy,intersects:Hy,simplifyRange:Ky,subset:zy,SemVer:cy,re:bt.re,src:bt.src,tokens:bt.t,SEMVER_SPEC_VERSION:cn.SEMVER_SPEC_VERSION,RELEASE_TYPES:cn.RELEASE_TYPES,compareIdentifiers:ln.compareIdentifiers,rcompareIdentifiers:ln.rcompareIdentifiers}});var Gy;var Xi=X(()=>{Gy=ff(vl(),1)});var _=b(function(tb){var Zi=Symbol.for("yaml.alias"),Rl=Symbol.for("yaml.document"),un=Symbol.for("yaml.map"),Cl=Symbol.for("yaml.pair"),eo=Symbol.for("yaml.scalar"),dn=Symbol.for("yaml.seq"),Pe=Symbol.for("yaml.node.type"),Yy=(e)=>!!e&&typeof e==="object"&&e[Pe]===Zi,Jy=(e)=>!!e&&typeof e==="object"&&e[Pe]===Rl,Wy=(e)=>!!e&&typeof e==="object"&&e[Pe]===un,Qy=(e)=>!!e&&typeof e==="object"&&e[Pe]===Cl,xl=(e)=>!!e&&typeof e==="object"&&e[Pe]===eo,Xy=(e)=>!!e&&typeof e==="object"&&e[Pe]===dn;function Il(e){if(e&&typeof e==="object")switch(e[Pe]){case un:case dn:return!0}return!1}function Zy(e){if(e&&typeof e==="object")switch(e[Pe]){case Zi:case un:case eo:case dn:return!0}return!1}var eb=(e)=>(xl(e)||Il(e))&&!!e.anchor;tb.ALIAS=Zi;tb.DOC=Rl;tb.MAP=un;tb.NODE_TYPE=Pe;tb.PAIR=Cl;tb.SCALAR=eo;tb.SEQ=dn;tb.hasAnchor=eb;tb.isAlias=Yy;tb.isCollection=Il;tb.isDocument=Jy;tb.isMap=Wy;tb.isNode=Zy;tb.isPair=Qy;tb.isScalar=xl;tb.isSeq=Xy});var Qt=b(function(bb){var z=_(),ee=Symbol("break visit"),El=Symbol("skip children"),ke=Symbol("remove node");function pn(e,t){let r=Al(t);if(z.isDocument(e)){if(St(null,e.contents,r,Object.freeze([e]))===ke)e.contents=null}else St(null,e,r,Object.freeze([]))}pn.BREAK=ee;pn.SKIP=El;pn.REMOVE=ke;function St(e,t,r,n){let i=Pl(e,t,r,n);if(z.isNode(i)||z.isPair(i))return Ol(e,n,i),St(e,i,r,n);if(typeof i!=="symbol"){if(z.isCollection(t)){n=Object.freeze(n.concat(t));for(let o=0;o<t.items.length;++o){let s=St(o,t.items[o],r,n);if(typeof s==="number")o=s-1;else if(s===ee)return ee;else if(s===ke)t.items.splice(o,1),o-=1}}else if(z.isPair(t)){n=Object.freeze(n.concat(t));let o=St("key",t.key,r,n);if(o===ee)return ee;else if(o===ke)t.key=null;let s=St("value",t.value,r,n);if(s===ee)return ee;else if(s===ke)t.value=null}}return i}async function fn(e,t){let r=Al(t);if(z.isDocument(e)){if(await wt(null,e.contents,r,Object.freeze([e]))===ke)e.contents=null}else await wt(null,e,r,Object.freeze([]))}fn.BREAK=ee;fn.SKIP=El;fn.REMOVE=ke;async function wt(e,t,r,n){let i=await Pl(e,t,r,n);if(z.isNode(i)||z.isPair(i))return Ol(e,n,i),wt(e,i,r,n);if(typeof i!=="symbol"){if(z.isCollection(t)){n=Object.freeze(n.concat(t));for(let o=0;o<t.items.length;++o){let s=await wt(o,t.items[o],r,n);if(typeof s==="number")o=s-1;else if(s===ee)return ee;else if(s===ke)t.items.splice(o,1),o-=1}}else if(z.isPair(t)){n=Object.freeze(n.concat(t));let o=await wt("key",t.key,r,n);if(o===ee)return ee;else if(o===ke)t.key=null;let s=await wt("value",t.value,r,n);if(s===ee)return ee;else if(s===ke)t.value=null}}return i}function Al(e){if(typeof e==="object"&&(e.Collection||e.Node||e.Value))return 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);return e}function Pl(e,t,r,n){if(typeof r==="function")return r(e,t,n);if(z.isMap(t))return r.Map?.(e,t,n);if(z.isSeq(t))return r.Seq?.(e,t,n);if(z.isPair(t))return r.Pair?.(e,t,n);if(z.isScalar(t))return r.Scalar?.(e,t,n);if(z.isAlias(t))return r.Alias?.(e,t,n);return}function Ol(e,t,r){let n=t[t.length-1];if(z.isCollection(n))n.items[e]=r;else if(z.isPair(n))if(e==="key")n.key=r;else n.value=r;else if(z.isDocument(n))n.contents=r;else{let i=z.isAlias(n)?"alias":"scalar";throw Error(`Cannot replace node with ${i} parent`)}}bb.visit=pn;bb.visitAsync=fn});var to=b(function(Cb){var Dl=_(),kb=Qt(),vb={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Rb=(e)=>e.replace(/[!,[\]{}]/g,(t)=>vb[t]);class se{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},se.defaultYaml,e),this.tags=Object.assign({},se.defaultTags,t)}clone(){let e=new se(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new se(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:se.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},se.defaultTags);break}return e}add(e,t){if(this.atNextDocument)this.yaml={explicit:se.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},se.defaultTags),this.atNextDocument=!1;let r=e.trim().split(/[ \t]+/),n=r.shift();switch(n){case"%TAG":{if(r.length!==2){if(t(0,"%TAG directive should contain exactly two parts"),r.length<2)return!1}let[i,o]=r;return this.tags[i]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[i]=r;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;else{let o=/^\d+\.\d+$/.test(i);return t(6,`Unsupported YAML version ${i}`,o),!1}}default:return t(0,`Unknown directive ${n}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);if(o==="!"||o==="!!")return t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null;if(e[e.length-1]!==">")t("Verbatim tags must end with a >");return o}let[,r,n]=e.match(/^(.*!)([^!]*)$/s);if(!n)t(`The ${e} tag has no suffix`);let i=this.tags[r];if(i)try{return i+decodeURIComponent(n)}catch(o){return t(String(o)),null}if(r==="!")return e;return t(`Could not resolve tag: ${e}`),null}tagString(e){for(let[t,r]of Object.entries(this.tags))if(e.startsWith(r))return t+Rb(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),n;if(e&&r.length>0&&Dl.isNode(e.contents)){let i={};kb.visit(e.contents,(o,s)=>{if(Dl.isNode(s)&&s.tag)i[s.tag]=!0}),n=Object.keys(i)}else n=[];for(let[i,o]of r){if(i==="!!"&&o==="tag:yaml.org,2002:")continue;if(!e||n.some((s)=>s.startsWith(o)))t.push(`%TAG ${i} ${o}`)}return t.join(`
|
|
7
|
+
`)}}se.defaultYaml={explicit:!1,version:"1.2"};se.defaultTags={"!!":"tag:yaml.org,2002:"};Cb.Directives=se});var gn=b(function(Pb){var Tl=_(),Ib=Qt();function Eb(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(r)}return!0}function Nl(e){let t=new Set;return Ib.visit(e,{Value(r,n){if(n.anchor)t.add(n.anchor)}}),t}function Ll(e,t){for(let r=1;;++r){let n=`${e}${r}`;if(!t.has(n))return n}}function Ab(e,t){let r=[],n=new Map,i=null;return{onAnchor:(o)=>{r.push(o),i??(i=Nl(e));let s=Ll(t,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s==="object"&&s.anchor&&(Tl.isScalar(s.node)||Tl.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}Pb.anchorIsValid=Eb;Pb.anchorNames=Nl;Pb.createNodeAnchors=Ab;Pb.findNewAnchor=Ll});var ro=b(function(Lb){function Xt(e,t,r,n){if(n&&typeof n==="object")if(Array.isArray(n))for(let i=0,o=n.length;i<o;++i){let s=n[i],a=Xt(e,n,String(i),s);if(a===void 0)delete n[i];else if(a!==s)n[i]=a}else if(n instanceof Map)for(let i of Array.from(n.keys())){let o=n.get(i),s=Xt(e,n,i,o);if(s===void 0)n.delete(i);else if(s!==o)n.set(i,s)}else if(n instanceof Set)for(let i of Array.from(n)){let o=Xt(e,n,i,i);if(o===void 0)n.delete(i);else if(o!==i)n.delete(i),n.add(o)}else for(let[i,o]of Object.entries(n)){let s=Xt(e,n,i,o);if(s===void 0)delete n[i];else if(s!==o)n[i]=s}return e.call(t,r,n)}Lb.applyReviver=Xt});var Le=b(function(Mb){var _b=_();function $l(e,t,r){if(Array.isArray(e))return e.map((n,i)=>$l(n,String(i),r));if(e&&typeof e.toJSON==="function"){if(!r||!_b.hasAnchor(e))return e.toJSON(t,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(e,n),r.onCreate=(o)=>{n.res=o,delete r.onCreate};let i=e.toJSON(t,r);if(r.onCreate)r.onCreate(i);return i}if(typeof e==="bigint"&&!r?.keep)return Number(e);return e}Mb.toJS=$l});var mn=b(function(Bb){var Fb=ro(),_l=_(),qb=Le();class Ml{constructor(e){Object.defineProperty(this,_l.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)e.range=this.range.slice();return e}toJS(e,{mapAsMap:t,maxAliasCount:r,onAnchor:n,reviver:i}={}){if(!_l.isDocument(e))throw TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof r==="number"?r:100},s=qb.toJS(this,"",o);if(typeof n==="function")for(let{count:a,res:c}of o.anchors.values())n(c,a);return typeof i==="function"?Fb.applyReviver(i,{"":s},"",s):s}}Bb.NodeBase=Ml});var Zt=b(function(Gb){var Vb=gn(),Hb=Qt(),kt=_(),Kb=mn(),zb=Le();class jl extends Kb.NodeBase{constructor(e){super(kt.ALIAS);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 r;if(t?.aliasResolveCache)r=t.aliasResolveCache;else if(r=[],Hb.visit(e,{Node:(i,o)=>{if(kt.isAlias(o)||kt.hasAnchor(o))r.push(o)}}),t)t.aliasResolveCache=r;let n=void 0;for(let i of r){if(i===this)break;if(i.anchor===this.source)n=i}if(n&&t){let{anchors:i,doc:o,maxAliasCount:s}=t,a=i.get(n);if(!a)zb.toJS(n,null,t),a=i.get(n);if(a?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(s>=0){if(a.count+=1,a.aliasCount===0)a.aliasCount=hn(o,n,i);if(a.count*a.aliasCount>s)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}}return n}toJSON(e,t){if(!t)return{source:this.source};let r=this.resolve(t.doc,t);if(!r){let n=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(n)}return t.anchors.get(r).res}toString(e,t,r){let n=`*${this.source}`;if(e){if(Vb.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(i)}if(e.implicitKey)return`${n} `}return n}}function hn(e,t,r){if(kt.isAlias(t)){let n=t.resolve(e),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(kt.isCollection(t)){let n=0;for(let i of t.items){let o=hn(e,i,r);if(o>n)n=o}return n}else if(kt.isPair(t)){let n=hn(e,t.key,r),i=hn(e,t.value,r);return Math.max(n,i)}return 1}Gb.Alias=jl});var V=b(function(Zb){var Jb=_(),Wb=mn(),Qb=Le(),Xb=(e)=>!e||typeof e!=="function"&&typeof e!=="object";class Qe extends Wb.NodeBase{constructor(e){super(Jb.SCALAR);this.value=e}toJSON(e,t){return t?.keep?this.value:Qb.toJS(this.value,e,t)}toString(){return String(this.value)}}Qe.BLOCK_FOLDED="BLOCK_FOLDED";Qe.BLOCK_LITERAL="BLOCK_LITERAL";Qe.PLAIN="PLAIN";Qe.QUOTE_DOUBLE="QUOTE_DOUBLE";Qe.QUOTE_SINGLE="QUOTE_SINGLE";Zb.Scalar=Qe;Zb.isScalarValue=Xb});var er=b(function(sS){var rS=Zt(),Xe=_(),Fl=V(),nS="tag:yaml.org,2002:";function iS(e,t,r){if(t){let n=r.filter((o)=>o.tag===t),i=n.find((o)=>!o.format)??n[0];if(!i)throw Error(`Tag ${t} not found`);return i}return r.find((n)=>n.identify?.(e)&&!n.format)}function oS(e,t,r){if(Xe.isDocument(e))e=e.contents;if(Xe.isNode(e))return e;if(Xe.isPair(e)){let d=r.schema[Xe.MAP].createNode?.(r.schema,null,r);return d.items.push(e),d}if(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)e=e.valueOf();let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,c=void 0;if(n&&e&&typeof e==="object")if(c=a.get(e),c)return c.anchor??(c.anchor=i(e)),new rS.Alias(c.anchor);else c={anchor:null,node:null},a.set(e,c);if(t?.startsWith("!!"))t=nS+t.slice(2);let l=iS(e,t,s.tags);if(!l){if(e&&typeof e.toJSON==="function")e=e.toJSON();if(!e||typeof e!=="object"){let d=new Fl.Scalar(e);if(c)c.node=d;return d}l=e instanceof Map?s[Xe.MAP]:(Symbol.iterator in Object(e))?s[Xe.SEQ]:s[Xe.MAP]}if(o)o(l),delete r.onTagObj;let u=l?.createNode?l.createNode(r.schema,e,r):typeof l?.nodeClass?.from==="function"?l.nodeClass.from(r.schema,e,r):new Fl.Scalar(e);if(t)u.tag=t;else if(!l.default)u.tag=l.tag;if(c)c.node=u;return u}sS.createNode=oS});var yn=b(function(uS){var cS=er(),ve=_(),lS=mn();function no(e,t,r){let n=r;for(let i=t.length-1;i>=0;--i){let o=t[i];if(typeof o==="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return cS.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var ql=(e)=>e==null||typeof e==="object"&&!!e[Symbol.iterator]().next().done;class Bl extends lS.NodeBase{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));if(e)t.schema=e;if(t.items=t.items.map((r)=>ve.isNode(r)||ve.isPair(r)?r.clone(e):r),this.range)t.range=this.range.slice();return t}addIn(e,t){if(ql(e))this.add(t);else{let[r,...n]=e,i=this.get(r,!0);if(ve.isCollection(i))i.addIn(n,t);else if(i===void 0&&this.schema)this.set(r,no(this.schema,n,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let n=this.get(t,!0);if(ve.isCollection(n))return n.deleteIn(r);else throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...n]=e,i=this.get(r,!0);if(n.length===0)return!t&&ve.isScalar(i)?i.value:i;else return ve.isCollection(i)?i.getIn(n,t):void 0}hasAllNullValues(e){return this.items.every((t)=>{if(!ve.isPair(t))return!1;let r=t.value;return r==null||e&&ve.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let n=this.get(t,!0);return ve.isCollection(n)?n.hasIn(r):!1}setIn(e,t){let[r,...n]=e;if(n.length===0)this.set(r,t);else{let i=this.get(r,!0);if(ve.isCollection(i))i.setIn(n,t);else if(i===void 0&&this.schema)this.set(r,no(this.schema,n,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}}}uS.Collection=Bl;uS.collectionFromPath=no;uS.isEmptyPath=ql});var tr=b(function(hS){var gS=(e)=>e.replace(/^(?!$)(?: $)?/gm,"#");function io(e,t){if(/^\n+$/.test(e))return e.substring(1);return t?e.replace(/^(?! *$)/gm,t):e}var mS=(e,t,r)=>e.endsWith(`
|
|
8
|
+
`)?io(r,t):r.includes(`
|
|
6
9
|
`)?`
|
|
7
|
-
`+
|
|
8
|
-
`){if(r==="block")g=
|
|
9
|
-
`&&
|
|
10
|
-
`&&
|
|
11
|
-
${t}${e.slice(0,
|
|
12
|
-
${t}${e.slice(
|
|
13
|
-
`);n=t,i=t+1,o=e[i]}return n}
|
|
14
|
-
`){if(o-s>n)return!0;if(s=o+1,i-s<=n)return!1}return!0}function
|
|
10
|
+
`+io(r,t):(e.endsWith(" ")?"":" ")+r;hS.indentComment=io;hS.lineComment=mS;hS.stringifyComment=gS});var Vl=b(function(kS){function wS(e,t,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return e;if(i<o)o=0;let c=Math.max(1+o,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;if(typeof n==="number")if(n>i-Math.max(2,o))l.push(0);else d=i-n;let f=void 0,p=void 0,m=!1,g=-1,h=-1,y=-1;if(r==="block"){if(g=Ul(e,g,t.length),g!==-1)d=g+c}for(let k;k=e[g+=1];){if(r==="quoted"&&k==="\\"){switch(h=g,e[g+1]){case"x":g+=3;break;case"u":g+=5;break;case"U":g+=9;break;default:g+=1}y=g}if(k===`
|
|
11
|
+
`){if(r==="block")g=Ul(e,g,t.length);d=g+t.length+c,f=void 0}else{if(k===" "&&p&&p!==" "&&p!==`
|
|
12
|
+
`&&p!=="\t"){let A=e[g+1];if(A&&A!==" "&&A!==`
|
|
13
|
+
`&&A!=="\t")f=g}if(g>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r==="quoted"){while(p===" "||p==="\t")p=k,k=e[g+=1],m=!0;let A=g>y+1?g-2:h-1;if(u[A])return e;l.push(A),u[A]=!0,d=A+c,f=void 0}else m=!0}p=k}if(m&&a)a();if(l.length===0)return e;if(s)s();let S=e.slice(0,l[0]);for(let k=0;k<l.length;++k){let A=l[k],P=l[k+1]||e.length;if(A===0)S=`
|
|
14
|
+
${t}${e.slice(0,P)}`;else{if(r==="quoted"&&u[A])S+=`${e[A]}\\`;S+=`
|
|
15
|
+
${t}${e.slice(A+1,P)}`}}return S}function Ul(e,t,r){let n=t,i=t+1,o=e[i];while(o===" "||o==="\t")if(t<i+r)o=e[++t];else{do o=e[++t];while(o&&o!==`
|
|
16
|
+
`);n=t,i=t+1,o=e[i]}return n}kS.FOLD_BLOCK="block";kS.FOLD_FLOW="flow";kS.FOLD_QUOTED="quoted";kS.foldFlowLines=wS});var nr=b(function(PS){var fe=V(),$e=Vl(),Sn=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),wn=(e)=>/^(%|---|\.\.\.)/m.test(e);function IS(e,t,r){if(!t||t<0)return!1;let n=t-r,i=e.length;if(i<=n)return!1;for(let o=0,s=0;o<i;++o)if(e[o]===`
|
|
17
|
+
`){if(o-s>n)return!0;if(s=o+1,i-s<=n)return!1}return!0}function rr(e,t){let r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=t,i=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(wn(e)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c]){if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n")s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\";if(l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:if(u.substr(0,2)==="00")s+="\\x"+u.substr(2);else s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length<i)c+=1;else{s+=r.slice(a,c)+`
|
|
15
18
|
|
|
16
19
|
`;while(r[c+2]==="\\"&&r[c+3]==="n"&&r[c+4]!=='"')s+=`
|
|
17
|
-
`,c+=2;if(s+=o,r[c+2]===" ")s+="\\";c+=1,a=c+1}break;default:c+=1}}return s=a?s+r.slice(a):r,n?s
|
|
18
|
-
`)||/[ \t]\n|\n[ \t]/.test(e))return
|
|
19
|
-
${r}`)+"'";return t.implicitKey?n
|
|
20
|
+
`,c+=2;if(s+=o,r[c+2]===" ")s+="\\";c+=1,a=c+1}break;default:c+=1}}return s=a?s+r.slice(a):r,n?s:$e.foldFlowLines(s,o,$e.FOLD_QUOTED,Sn(t,!1))}function oo(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
21
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return rr(e,t);let r=t.indent||(wn(e)?" ":""),n="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
22
|
+
${r}`)+"'";return t.implicitKey?n:$e.foldFlowLines(n,r,$e.FOLD_FLOW,Sn(t,!1))}function vt(e,t){let{singleQuote:r}=t.options,n;if(r===!1)n=rr;else{let i=e.includes('"'),o=e.includes("'");if(i&&!o)n=oo;else if(o&&!i)n=rr;else n=r?oo:rr}return n(e,t)}var so;try{so=new RegExp(`(^|(?<!
|
|
20
23
|
))
|
|
21
24
|
+(?!
|
|
22
|
-
|$)`,"g")}catch{
|
|
25
|
+
|$)`,"g")}catch{so=/\n+(?!\n|$)/g}function bn({comment:e,type:t,value:r},n,i,o){let{blockQuote:s,commentString:a,lineWidth:c}=n.options;if(!s||/\n[\t ]+$/.test(r))return vt(r,n);let l=n.indent||(n.forceBlockIndent||wn(r)?" ":""),u=s==="literal"?!0:s==="folded"||t===fe.Scalar.BLOCK_FOLDED?!1:t===fe.Scalar.BLOCK_LITERAL?!0:!IS(r,c,l.length);if(!r)return u?`|
|
|
23
26
|
`:`>
|
|
24
|
-
`;let
|
|
25
|
-
`&&
|
|
26
|
-
`);if(m===-1)
|
|
27
|
-
`)
|
|
28
|
-
`)
|
|
29
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),
|
|
30
|
-
${l}${
|
|
31
|
-
${l}${S}${r}${
|
|
32
|
-
`)||
|
|
33
|
-
`)?
|
|
34
|
-
`))return
|
|
35
|
-
${c}`);if(s){let f=(g)=>g.default&&g.tag!=="tag:yaml.org,2002:str"&&g.test?.test(
|
|
36
|
-
${t.indent}${a}`}
|
|
37
|
-
${a}:`}else if(h=`${h}:`,f)h+=
|
|
38
|
-
`:"",S){let
|
|
39
|
-
${
|
|
40
|
-
`&&k)
|
|
41
|
-
|
|
42
|
-
`}else
|
|
43
|
-
${r.indent}`}else if(!
|
|
44
|
-
`),
|
|
45
|
-
${r.indent}`}}else if(
|
|
46
|
-
`)
|
|
27
|
+
`;let d,f;for(f=r.length;f>0;--f){let P=r[f-1];if(P!==`
|
|
28
|
+
`&&P!=="\t"&&P!==" ")break}let p=r.substring(f),m=p.indexOf(`
|
|
29
|
+
`);if(m===-1)d="-";else if(r===p||m!==p.length-1){if(d="+",o)o()}else d="";if(p){if(r=r.slice(0,-p.length),p[p.length-1]===`
|
|
30
|
+
`)p=p.slice(0,-1);p=p.replace(so,`$&${l}`)}let g=!1,h,y=-1;for(h=0;h<r.length;++h){let P=r[h];if(P===" ")g=!0;else if(P===`
|
|
31
|
+
`)y=h;else break}let S=r.substring(0,y<h?y+1:h);if(S)r=r.substring(S.length),S=S.replace(/\n+/g,`$&${l}`);let A=(g?l?"2":"1":"")+d;if(e){if(A+=" "+a(e.replace(/ ?[\r\n]+/g," ")),i)i()}if(!u){let P=r.replace(/\n+/g,`
|
|
32
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),O=!1,D=Sn(n,!0);if(s!=="folded"&&t!==fe.Scalar.BLOCK_FOLDED)D.onOverflow=()=>{O=!0};let C=$e.foldFlowLines(`${S}${P}${p}`,l,$e.FOLD_BLOCK,D);if(!O)return`>${A}
|
|
33
|
+
${l}${C}`}return r=r.replace(/\n+/g,`$&${l}`),`|${A}
|
|
34
|
+
${l}${S}${r}${p}`}function ES(e,t,r,n){let{type:i,value:o}=e,{actualString:s,implicitKey:a,indent:c,indentStep:l,inFlow:u}=t;if(a&&o.includes(`
|
|
35
|
+
`)||u&&/[[\]{},]/.test(o))return vt(o,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(`
|
|
36
|
+
`)?vt(o,t):bn(e,t,r,n);if(!a&&!u&&i!==fe.Scalar.PLAIN&&o.includes(`
|
|
37
|
+
`))return bn(e,t,r,n);if(wn(o)){if(c==="")return t.forceBlockIndent=!0,bn(e,t,r,n);else if(a&&c===l)return vt(o,t)}let d=o.replace(/\n+/g,`$&
|
|
38
|
+
${c}`);if(s){let f=(g)=>g.default&&g.tag!=="tag:yaml.org,2002:str"&&g.test?.test(d),{compat:p,tags:m}=t.doc.schema;if(m.some(f)||p?.some(f))return vt(o,t)}return a?d:$e.foldFlowLines(d,c,$e.FOLD_FLOW,Sn(t,!1))}function AS(e,t,r,n){let{implicitKey:i,inFlow:o}=t,s=typeof e.value==="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;if(a!==fe.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value))a=fe.Scalar.QUOTE_DOUBLE}let c=(u)=>{switch(u){case fe.Scalar.BLOCK_FOLDED:case fe.Scalar.BLOCK_LITERAL:return i||o?vt(s.value,t):bn(s,t,r,n);case fe.Scalar.QUOTE_DOUBLE:return rr(s.value,t);case fe.Scalar.QUOTE_SINGLE:return oo(s.value,t);case fe.Scalar.PLAIN:return ES(s,t,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=t.options,f=i&&u||d;if(l=c(f),l===null)throw Error(`Unsupported default string type ${f}`)}return l}PS.stringifyString=AS});var ir=b(function(jS){var DS=gn(),_e=_(),TS=tr(),NS=nr();function LS(e,t){let r=Object.assign({blockQuote:!0,commentString:TS.stringifyComment,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),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:e,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent==="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function $S(e,t){if(t.tag){let i=e.filter((o)=>o.tag===t.tag);if(i.length>0)return i.find((o)=>o.format===t.format)??i[0]}let r=void 0,n;if(_e.isScalar(t)){n=t.value;let i=e.filter((o)=>o.identify?.(n));if(i.length>1){let o=i.filter((s)=>s.test);if(o.length>0)i=o}r=i.find((o)=>o.format===t.format)??i.find((o)=>!o.format)}else n=t,r=e.find((i)=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw Error(`Tag not resolved for ${i} value`)}return r}function _S(e,t,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(_e.isScalar(e)||_e.isCollection(e))&&e.anchor;if(o&&DS.anchorIsValid(o))r.add(o),i.push(`&${o}`);let s=e.tag??(t.default?null:t.tag);if(s)i.push(n.directives.tagString(s));return i.join(" ")}function MS(e,t,r,n){if(_e.isPair(e))return e.toString(t,r,n);if(_e.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(t.resolvedAliases)t.resolvedAliases.add(e);else t.resolvedAliases=new Set([e]);e=e.resolve(t.doc)}}let i=void 0,o=_e.isNode(e)?e:t.doc.createNode(e,{onTagObj:(c)=>i=c});i??(i=$S(t.doc.schema.tags,o));let s=_S(o,i,t);if(s.length>0)t.indentAtStart=(t.indentAtStart??0)+s.length+1;let a=typeof i.stringify==="function"?i.stringify(o,t,r,n):_e.isScalar(o)?NS.stringifyString(o,t,r,n):o.toString(t,r,n);if(!s)return a;return _e.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
|
|
39
|
+
${t.indent}${a}`}jS.createStringifyContext=LS;jS.stringify=MS});var zl=b(function(US){var Oe=_(),Hl=V(),Kl=ir(),or=tr();function BS({key:e,value:t},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=Oe.isNode(e)&&e.comment||null;if(d){if(f)throw Error("With simple keys, key nodes cannot have comments");if(Oe.isCollection(e)||!Oe.isNode(e)&&typeof e==="object")throw Error("With simple keys, collection cannot be used as a key value")}let p=!d&&(!e||f&&t==null&&!r.inFlow||Oe.isCollection(e)||(Oe.isScalar(e)?e.type===Hl.Scalar.BLOCK_FOLDED||e.type===Hl.Scalar.BLOCK_LITERAL:typeof e==="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,g=!1,h=Kl.stringify(e,r,()=>m=!0,()=>g=!0);if(!p&&!r.inFlow&&h.length>1024){if(d)throw Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||t==null){if(m&&n)n();return h===""?"?":p?`? ${h}`:h}}else if(o&&!d||t==null&&p){if(h=`? ${h}`,f&&!m)h+=or.lineComment(h,r.indent,l(f));else if(g&&i)i();return h}if(m)f=null;if(p){if(f)h+=or.lineComment(h,r.indent,l(f));h=`? ${h}
|
|
40
|
+
${a}:`}else if(h=`${h}:`,f)h+=or.lineComment(h,r.indent,l(f));let y,S,k;if(Oe.isNode(t))y=!!t.spaceBefore,S=t.commentBefore,k=t.comment;else if(y=!1,S=null,k=null,t&&typeof t==="object")t=s.createNode(t);if(r.implicitKey=!1,!p&&!f&&Oe.isScalar(t))r.indentAtStart=h.length+1;if(g=!1,!u&&c.length>=2&&!r.inFlow&&!p&&Oe.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor)r.indent=r.indent.substring(2);let A=!1,P=Kl.stringify(t,r,()=>A=!0,()=>g=!0),O=" ";if(f||y||S){if(O=y?`
|
|
41
|
+
`:"",S){let D=l(S);O+=`
|
|
42
|
+
${or.indentComment(D,r.indent)}`}if(P===""&&!r.inFlow){if(O===`
|
|
43
|
+
`&&k)O=`
|
|
44
|
+
|
|
45
|
+
`}else O+=`
|
|
46
|
+
${r.indent}`}else if(!p&&Oe.isCollection(t)){let D=P[0],C=P.indexOf(`
|
|
47
|
+
`),j=C!==-1,te=r.inFlow??t.flow??t.items.length===0;if(j||!te){let R=!1;if(j&&(D==="&"||D==="!")){let w=P.indexOf(" ");if(D==="&"&&w!==-1&&w<C&&P[w+1]==="!")w=P.indexOf(" ",w+1);if(w===-1||C<w)R=!0}if(!R)O=`
|
|
48
|
+
${r.indent}`}}else if(P===""||P[0]===`
|
|
49
|
+
`)O="";if(h+=O+P,r.inFlow){if(A&&n)n()}else if(k&&!A)h+=or.lineComment(h,r.indent,l(k));else if(g&&i)i();return h}US.stringifyPair=BS});var ao=b(function(zS){var Gl=at("process");function HS(e,...t){if(e==="debug")console.log(...t)}function KS(e,t){if(e==="debug"||e==="warn")if(typeof Gl.emitWarning==="function")Gl.emitWarning(t);else console.warn(t)}zS.debug=HS;zS.warn=KS});var Cn=b(function(WS){var Rn=_(),Yl=V(),kn="<<",vn={identify:(e)=>e===kn||typeof e==="symbol"&&e.description===kn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Yl.Scalar(Symbol(kn)),{addToJSMap:Jl}),stringify:()=>kn},JS=(e,t)=>(vn.identify(t)||Rn.isScalar(t)&&(!t.type||t.type===Yl.Scalar.PLAIN)&&vn.identify(t.value))&&e?.doc.schema.tags.some((r)=>r.tag===vn.tag&&r.default);function Jl(e,t,r){let n=Wl(e,r);if(Rn.isSeq(n))for(let i of n.items)co(e,t,i);else if(Array.isArray(n))for(let i of n)co(e,t,i);else co(e,t,n)}function co(e,t,r){let n=Wl(e,r);if(!Rn.isMap(n))throw Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,e,Map);for(let[o,s]of i)if(t instanceof Map){if(!t.has(o))t.set(o,s)}else if(t instanceof Set)t.add(o);else if(!Object.prototype.hasOwnProperty.call(t,o))Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return t}function Wl(e,t){return e&&Rn.isAlias(t)?t.resolve(e.doc,e):t}WS.addMergeToJSMap=Jl;WS.isMergeKey=JS;WS.merge=vn});var uo=b(function(iw){var ew=ao(),Ql=Cn(),tw=ir(),Xl=_(),lo=Le();function rw(e,t,{key:r,value:n}){if(Xl.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,n);else if(Ql.isMergeKey(e,r))Ql.addMergeToJSMap(e,t,n);else{let i=lo.toJS(r,"",e);if(t instanceof Map)t.set(i,lo.toJS(n,i,e));else if(t instanceof Set)t.add(i);else{let o=nw(r,i,e),s=lo.toJS(n,o,e);if(o in t)Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0});else t[o]=s}}return t}function nw(e,t,r){if(t===null)return"";if(typeof t!=="object")return String(t);if(Xl.isNode(e)&&r?.doc){let n=tw.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=e.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);if(o.length>40)o=o.substring(0,36)+'..."';ew.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(t)}iw.addPairToJSMap=rw});var Me=b(function(lw){var Zl=er(),sw=zl(),aw=uo(),xn=_();function cw(e,t,r){let n=Zl.createNode(e,void 0,r),i=Zl.createNode(t,void 0,r);return new In(n,i)}class In{constructor(e,t=null){Object.defineProperty(this,xn.NODE_TYPE,{value:xn.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:r}=this;if(xn.isNode(t))t=t.clone(e);if(xn.isNode(r))r=r.clone(e);return new In(t,r)}toJSON(e,t){let r=t?.mapAsMap?new Map:{};return aw.addPairToJSMap(t,r,this)}toString(e,t,r){return e?.doc?sw.stringifyPair(this,e,t,r):JSON.stringify(this)}}lw.Pair=In;lw.createPair=cw});var po=b(function(mw){var Ze=_(),eu=ir(),En=tr();function pw(e,t,r){return(t.inFlow??e.flow?gw:fw)(e,t,r)}function fw({comment:e,items:t},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;m<t.length;++m){let g=t[m],h=null;if(Ze.isNode(g)){if(!d&&g.spaceBefore)f.push("");if(An(r,f,g.commentBefore,d),g.comment)h=g.comment}else if(Ze.isPair(g)){let S=Ze.isNode(g.key)?g.key:null;if(S){if(!d&&S.spaceBefore)f.push("");An(r,f,S.commentBefore,d)}}d=!1;let y=eu.stringify(g,u,()=>h=null,()=>d=!0);if(h)y+=En.lineComment(y,o,l(h));if(d&&h)d=!1;f.push(n+y)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let m=1;m<f.length;++m){let g=f[m];p+=g?`
|
|
47
50
|
${c}${g}`:`
|
|
48
|
-
`}}if(e){if(
|
|
49
|
-
`+
|
|
50
|
-
`)),m<e.length-1)
|
|
51
|
+
`}}if(e){if(p+=`
|
|
52
|
+
`+En.indentComment(l(e),c),a)a()}else if(d&&s)s();return p}function gw({items:e},t,{flowChars:r,itemIndent:n}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=t;n+=o;let c=Object.assign({},t,{indent:n,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let m=0;m<e.length;++m){let g=e[m],h=null;if(Ze.isNode(g)){if(g.spaceBefore)d.push("");if(An(t,d,g.commentBefore,!1),g.comment)h=g.comment}else if(Ze.isPair(g)){let S=Ze.isNode(g.key)?g.key:null;if(S){if(S.spaceBefore)d.push("");if(An(t,d,S.commentBefore,!1),S.comment)l=!0}let k=Ze.isNode(g.value)?g.value:null;if(k){if(k.comment)h=k.comment;if(k.commentBefore)l=!0}else if(g.value==null&&S?.comment)h=S.comment}if(h)l=!0;let y=eu.stringify(g,c,()=>h=null);if(l||(l=d.length>u||y.includes(`
|
|
53
|
+
`)),m<e.length-1)y+=",";else if(t.options.trailingComma){if(t.options.lineWidth>0)l||(l=d.reduce((S,k)=>S+k.length+2,2)+(y.length+2)>t.options.lineWidth);if(l)y+=","}if(h)y+=En.lineComment(y,n,a(h));d.push(y),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;else{if(!l){let m=d.reduce((g,h)=>g+h.length+2,2);l=t.options.lineWidth>0&&m>t.options.lineWidth}if(l){let m=f;for(let g of d)m+=g?`
|
|
51
54
|
${o}${i}${g}`:`
|
|
52
55
|
`;return`${m}
|
|
53
|
-
${i}${
|
|
54
|
-
`:" ")}return
|
|
56
|
+
${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}}function An({indent:e,options:{commentString:t}},r,n,i){if(n&&i)n=n.replace(/^\n+/,"");if(n){let o=En.indentComment(t(n),e);r.push(o.trimStart())}}mw.stringifyCollection=pw});var Fe=b(function(kw){var yw=po(),bw=uo(),Sw=yn(),je=_(),Pn=Me(),ww=V();function sr(e,t){let r=je.isScalar(t)?t.value:t;for(let n of e)if(je.isPair(n)){if(n.key===t||n.key===r)return n;if(je.isScalar(n.key)&&n.key.value===r)return n}return}class tu extends Sw.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(je.MAP,e);this.items=[]}static from(e,t,r){let{keepUndefined:n,replacer:i}=r,o=new this(e),s=(a,c)=>{if(typeof i==="function")c=i.call(t,a,c);else if(Array.isArray(i)&&!i.includes(a))return;if(c!==void 0||n)o.items.push(Pn.createPair(a,c,r))};if(t instanceof Map)for(let[a,c]of t)s(a,c);else if(t&&typeof t==="object")for(let a of Object.keys(t))s(a,t[a]);if(typeof e.sortMapEntries==="function")o.items.sort(e.sortMapEntries);return o}add(e,t){let r;if(je.isPair(e))r=e;else if(!e||typeof e!=="object"||!("key"in e))r=new Pn.Pair(e,e?.value);else r=new Pn.Pair(e.key,e.value);let n=sr(this.items,r.key),i=this.schema?.sortMapEntries;if(n){if(!t)throw Error(`Key ${r.key} already set`);if(je.isScalar(n.value)&&ww.isScalarValue(r.value))n.value.value=r.value;else n.value=r.value}else if(i){let o=this.items.findIndex((s)=>i(r,s)<0);if(o===-1)this.items.push(r);else this.items.splice(o,0,r)}else this.items.push(r)}delete(e){let t=sr(this.items,e);if(!t)return!1;return this.items.splice(this.items.indexOf(t),1).length>0}get(e,t){let n=sr(this.items,e)?.value;return(!t&&je.isScalar(n)?n.value:n)??void 0}has(e){return!!sr(this.items,e)}set(e,t){this.add(new Pn.Pair(e,t),!0)}toJSON(e,t,r){let n=r?new r:t?.mapAsMap?new Map:{};if(t?.onCreate)t.onCreate(n);for(let i of this.items)bw.addPairToJSMap(t,n,i);return n}toString(e,t,r){if(!e)return JSON.stringify(this);for(let n of this.items)if(!je.isPair(n))throw Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);if(!e.allNullValues&&this.hasAllNullValues(!1))e=Object.assign({},e,{allNullValues:!0});return yw.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:t})}}kw.YAMLMap=tu;kw.findPair=sr});var Rt=b(function(Iw){var Cw=_(),ru=Fe(),xw={collection:"map",default:!0,nodeClass:ru.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){if(!Cw.isMap(e))t("Expected a mapping for this tag");return e},createNode:(e,t,r)=>ru.YAMLMap.from(e,t,r)};Iw.map=xw});var qe=b(function(Nw){var Aw=er(),Pw=po(),Ow=yn(),Dn=_(),Dw=V(),Tw=Le();class nu extends Ow.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Dn.SEQ,e);this.items=[]}add(e){this.items.push(e)}delete(e){let t=On(e);if(typeof t!=="number")return!1;return this.items.splice(t,1).length>0}get(e,t){let r=On(e);if(typeof r!=="number")return;let n=this.items[r];return!t&&Dn.isScalar(n)?n.value:n}has(e){let t=On(e);return typeof t==="number"&&t<this.items.length}set(e,t){let r=On(e);if(typeof r!=="number")throw Error(`Expected a valid index, not ${e}.`);let n=this.items[r];if(Dn.isScalar(n)&&Dw.isScalarValue(t))n.value=t;else this.items[r]=t}toJSON(e,t){let r=[];if(t?.onCreate)t.onCreate(r);let n=0;for(let i of this.items)r.push(Tw.toJS(i,String(n++),t));return r}toString(e,t,r){if(!e)return JSON.stringify(this);return Pw.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:t})}static from(e,t,r){let{replacer:n}=r,i=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let s of t){if(typeof n==="function"){let a=t instanceof Set?s:String(o++);s=n.call(t,a,s)}i.items.push(Aw.createNode(s,void 0,r))}}return i}}function On(e){let t=Dn.isScalar(e)?e.value:e;if(t&&typeof t==="string")t=Number(t);return typeof t==="number"&&Number.isInteger(t)&&t>=0?t:null}Nw.YAMLSeq=nu});var Ct=b(function(Mw){var $w=_(),iu=qe(),_w={collection:"seq",default:!0,nodeClass:iu.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){if(!$w.isSeq(e))t("Expected a sequence for this tag");return e},createNode:(e,t,r)=>iu.YAMLSeq.from(e,t,r)};Mw.seq=_w});var ar=b(function(Bw){var Fw=nr(),qw={identify:(e)=>typeof e==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(e)=>e,stringify(e,t,r,n){return t=Object.assign({actualString:!0},t),Fw.stringifyString(e,t,r,n)}};Bw.string=qw});var Tn=b(function(Vw){var ou=V(),su={identify:(e)=>e==null,createNode:()=>new ou.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ou.Scalar(null),stringify:({source:e},t)=>typeof e==="string"&&su.test.test(e)?e:t.options.nullStr};Vw.nullTag=su});var fo=b(function(zw){var Kw=V(),au={identify:(e)=>typeof e==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:(e)=>new Kw.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},r){if(e&&au.test.test(e)){let n=e[0]==="t"||e[0]==="T";if(t===n)return e}return t?r.options.trueStr:r.options.falseStr}};zw.boolTag=au});var xt=b(function(Jw){function Yw({format:e,minFractionDigits:t,tag:r,value:n}){if(typeof n==="bigint")return String(n);let i=typeof n==="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!e&&t&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");if(s<0)s=o.length,o+=".";let a=t-(o.length-s-1);while(a-- >0)o+="0"}return o}Jw.stringifyNumber=Yw});var mo=b(function(tk){var Qw=V(),go=xt(),Xw={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(e)=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:go.stringifyNumber},Zw={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:(e)=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():go.stringifyNumber(e)}},ek={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Qw.Scalar(parseFloat(e)),r=e.indexOf(".");if(r!==-1&&e[e.length-1]==="0")t.minFractionDigits=e.length-r-1;return t},stringify:go.stringifyNumber};tk.float=ek;tk.floatExp=Zw;tk.floatNaN=Xw});var yo=b(function(ck){var cu=xt(),Nn=(e)=>typeof e==="bigint"||Number.isInteger(e),ho=(e,t,r,{intAsBigInt:n})=>n?BigInt(e):parseInt(e.substring(t),r);function lu(e,t,r){let{value:n}=e;if(Nn(n)&&n>=0)return r+n.toString(t);return cu.stringifyNumber(e)}var ok={identify:(e)=>Nn(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,r)=>ho(e,2,8,r),stringify:(e)=>lu(e,8,"0o")},sk={identify:Nn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,r)=>ho(e,0,10,r),stringify:cu.stringifyNumber},ak={identify:(e)=>Nn(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,r)=>ho(e,2,16,r),stringify:(e)=>lu(e,16,"0x")};ck.int=sk;ck.intHex=ak;ck.intOct=ok});var uu=b(function(bk){var pk=Rt(),fk=Tn(),gk=Ct(),mk=ar(),hk=fo(),bo=mo(),So=yo(),yk=[pk.map,gk.seq,mk.string,fk.nullTag,hk.boolTag,So.intOct,So.int,So.intHex,bo.floatNaN,bo.floatExp,bo.float];bk.schema=yk});var pu=b(function(Ik){var wk=V(),kk=Rt(),vk=Ct();function du(e){return typeof e==="bigint"||Number.isInteger(e)}var Ln=({value:e})=>JSON.stringify(e),Rk=[{identify:(e)=>typeof e==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(e)=>e,stringify:Ln},{identify:(e)=>e==null,createNode:()=>new wk.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ln},{identify:(e)=>typeof e==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:(e)=>e==="true",stringify:Ln},{identify:du,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:r})=>r?BigInt(e):parseInt(e,10),stringify:({value:e})=>du(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:Ln}],Ck={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},xk=[kk.map,vk.seq].concat(Rk,Ck);Ik.schema=xk});var ko=b(function(Ok){var cr=at("buffer"),wo=V(),Ak=nr(),Pk={identify:(e)=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof cr.Buffer==="function")return cr.Buffer.from(e,"base64");else if(typeof atob==="function"){let r=atob(e.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i<r.length;++i)n[i]=r.charCodeAt(i);return n}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:r},n,i,o){if(!r)return"";let s=r,a;if(typeof cr.Buffer==="function")a=s instanceof cr.Buffer?s.toString("base64"):cr.Buffer.from(s.buffer).toString("base64");else if(typeof btoa==="function"){let c="";for(let l=0;l<s.length;++l)c+=String.fromCharCode(s[l]);a=btoa(c)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=wo.Scalar.BLOCK_LITERAL),t!==wo.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),l=Math.ceil(a.length/c),u=Array(l);for(let d=0,f=0;d<l;++d,f+=c)u[d]=a.substr(f,c);a=u.join(t===wo.Scalar.BLOCK_LITERAL?`
|
|
57
|
+
`:" ")}return Ak.stringifyString({comment:e,type:t,value:a},n,i,o)}};Ok.binary=Pk});var _n=b(function($k){var $n=_(),vo=Me(),Tk=V(),Nk=qe();function fu(e,t){if($n.isSeq(e))for(let r=0;r<e.items.length;++r){let n=e.items[r];if($n.isPair(n))continue;else if($n.isMap(n)){if(n.items.length>1)t("Each pair must have its own sequence indicator");let i=n.items[0]||new vo.Pair(new Tk.Scalar(null));if(n.commentBefore)i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}
|
|
55
58
|
${i.key.commentBefore}`:n.commentBefore;if(n.comment){let o=i.value??i.key;o.comment=o.comment?`${n.comment}
|
|
56
|
-
${o.comment}`:n.comment}n=i}e.items[r]=Jr.isPair(n)?n:new _i.Pair(n)}else t("Expected a sequence for this tag");return e}function pl(e,t,r){let{replacer:n}=r,i=new HS.YAMLSeq(e);i.tag="tag:yaml.org,2002:pairs";let o=0;if(t&&Symbol.iterator in Object(t))for(let s of t){if(typeof n==="function")s=n.call(t,String(o++),s);let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(_i.createPair(a,c,r))}return i}var zS={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:dl,createNode:pl};YS.createPairs=pl;YS.pairs=zS;YS.resolvePairs=dl});var ji=y(function(ZS){var fl=A(),Fi=be(),$t=we(),QS=xe(),gl=Qr();class $e extends QS.YAMLSeq{constructor(){super();this.add=$t.YAMLMap.prototype.add.bind(this),this.delete=$t.YAMLMap.prototype.delete.bind(this),this.get=$t.YAMLMap.prototype.get.bind(this),this.has=$t.YAMLMap.prototype.has.bind(this),this.set=$t.YAMLMap.prototype.set.bind(this),this.tag=$e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let r=new Map;if(t?.onCreate)t.onCreate(r);for(let n of this.items){let i,o;if(fl.isPair(n))i=Fi.toJS(n.key,"",t),o=Fi.toJS(n.value,i,t);else i=Fi.toJS(n,"",t);if(r.has(i))throw Error("Ordered maps must not include duplicate keys");r.set(i,o)}return r}static from(e,t,r){let n=gl.createPairs(e,t,r),i=new this;return i.items=n.items,i}}$e.tag="tag:yaml.org,2002:omap";var XS={collection:"seq",identify:(e)=>e instanceof Map,nodeClass:$e,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let r=gl.resolvePairs(e,t),n=[];for(let{key:i}of r.items)if(fl.isScalar(i))if(n.includes(i.value))t(`Ordered maps must not include duplicate keys: ${i.value}`);else n.push(i.value);return Object.assign(new $e,r)},createNode:(e,t,r)=>$e.from(e,t,r)};ZS.YAMLOMap=$e;ZS.omap=XS});var Sl=y(function(rR){var ml=L();function hl({value:e,source:t},r){if(t&&(e?yl:bl).test.test(t))return t;return e?r.options.trueStr:r.options.falseStr}var yl={identify:(e)=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new ml.Scalar(!0),stringify:hl},bl={identify:(e)=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new ml.Scalar(!1),stringify:hl};rR.falseTag=bl;rR.trueTag=yl});var Rl=y(function(lR){var oR=L(),qi=tt(),sR={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(e)=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:qi.stringifyNumber},aR={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:(e)=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():qi.stringifyNumber(e)}},cR={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new oR.Scalar(parseFloat(e.replace(/_/g,""))),r=e.indexOf(".");if(r!==-1){let n=e.substring(r+1).replace(/_/g,"");if(n[n.length-1]==="0")t.minFractionDigits=n.length}return t},stringify:qi.stringifyNumber};lR.float=cR;lR.floatExp=aR;lR.floatNaN=sR});var kl=y(function(yR){var Cl=tt(),Mt=(e)=>typeof e==="bigint"||Number.isInteger(e);function Xr(e,t,r,{intAsBigInt:n}){let i=e[0];if(i==="-"||i==="+")t+=1;if(e=e.substring(t).replace(/_/g,""),n){switch(r){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let s=BigInt(e);return i==="-"?BigInt(-1)*s:s}let o=parseInt(e,r);return i==="-"?-1*o:o}function Bi(e,t,r){let{value:n}=e;if(Mt(n)){let i=n.toString(t);return n<0?"-"+r+i.substr(1):r+i}return Cl.stringifyNumber(e)}var fR={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,r)=>Xr(e,2,2,r),stringify:(e)=>Bi(e,2,"0b")},gR={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,r)=>Xr(e,1,8,r),stringify:(e)=>Bi(e,8,"0")},mR={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,r)=>Xr(e,0,10,r),stringify:Cl.stringifyNumber},hR={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,r)=>Xr(e,2,16,r),stringify:(e)=>Bi(e,16,"0x")};yR.int=mR;yR.intBin=fR;yR.intHex=hR;yR.intOct=gR});var Ui=y(function(wR){var tn=A(),Zr=Ce(),en=we();class Me extends en.YAMLMap{constructor(e){super(e);this.tag=Me.tag}add(e){let t;if(tn.isPair(e))t=e;else if(e&&typeof e==="object"&&"key"in e&&"value"in e&&e.value===null)t=new Zr.Pair(e.key,null);else t=new Zr.Pair(e,null);if(!en.findPair(this.items,t.key))this.items.push(t)}get(e,t){let r=en.findPair(this.items,e);return!t&&tn.isPair(r)?tn.isScalar(r.key)?r.key.value:r.key:r}set(e,t){if(typeof t!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let r=en.findPair(this.items,e);if(r&&!t)this.items.splice(this.items.indexOf(r),1);else if(!r&&t)this.items.push(new Zr.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,r);else throw Error("Set items must all have null values")}static from(e,t,r){let{replacer:n}=r,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t){if(typeof n==="function")o=n.call(t,o,o);i.items.push(Zr.createPair(o,null,r))}return i}}Me.tag="tag:yaml.org,2002:set";var kR={collection:"map",identify:(e)=>e instanceof Set,nodeClass:Me,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,r)=>Me.from(e,t,r),resolve(e,t){if(tn.isMap(e))if(e.hasAllNullValues(!0))return Object.assign(new Me,e);else t("Set items must all have null values");else t("Expected a mapping for this tag");return e}};wR.YAMLSet=Me;wR.set=kR});var Ki=y(function(AR){var ER=tt();function Vi(e,t){let r=e[0],n=r==="-"||r==="+"?e.substring(1):e,i=(s)=>t?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function wl(e){let{value:t}=e,r=(s)=>s;if(typeof t==="bigint")r=(s)=>BigInt(s);else if(isNaN(t)||!isFinite(t))return ER.stringifyNumber(e);let n="";if(t<0)n="-",t*=r(-1);let i=r(60),o=[t%i];if(t<60)o.unshift(0);else if(t=(t-o[0])/i,o.unshift(t%i),t>=60)t=(t-o[0])/i,o.unshift(t);return n+o.map((s)=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var IR={identify:(e)=>typeof e==="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:r})=>Vi(e,r),stringify:wl},PR={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:(e)=>Vi(e,!1),stringify:wl},xl={identify:(e)=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(xl.test);if(!t)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),d=t[8];if(d&&d!=="Z"){let p=Vi(d,!1);if(Math.abs(p)<30)p*=60;l-=60000*p}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};AR.floatTime=PR;AR.intTime=IR;AR.timestamp=xl});var El=y(function(VR){var LR=Ze(),NR=Yr(),$R=et(),MR=Lt(),_R=Mi(),vl=Sl(),Hi=Rl(),rn=kl(),FR=jr(),jR=ji(),qR=Qr(),BR=Ui(),zi=Ki(),UR=[LR.map,$R.seq,MR.string,NR.nullTag,vl.trueTag,vl.falseTag,rn.intBin,rn.intOct,rn.int,rn.intHex,Hi.floatNaN,Hi.floatExp,Hi.float,_R.binary,FR.merge,jR.omap,qR.pairs,BR.set,zi.intTime,zi.floatTime,zi.timestamp];VR.schema=UR});var Ml=y(function(XR){var Dl=Ze(),HR=Yr(),Ol=et(),zR=Lt(),YR=Pi(),Yi=Di(),Gi=Ti(),GR=cl(),WR=ul(),Tl=Mi(),_t=jr(),Ll=ji(),Nl=Qr(),Il=El(),$l=Ui(),nn=Ki(),Pl=new Map([["core",GR.schema],["failsafe",[Dl.map,Ol.seq,zR.string]],["json",WR.schema],["yaml11",Il.schema],["yaml-1.1",Il.schema]]),Al={binary:Tl.binary,bool:YR.boolTag,float:Yi.float,floatExp:Yi.floatExp,floatNaN:Yi.floatNaN,floatTime:nn.floatTime,int:Gi.int,intHex:Gi.intHex,intOct:Gi.intOct,intTime:nn.intTime,map:Dl.map,merge:_t.merge,null:HR.nullTag,omap:Ll.omap,pairs:Nl.pairs,seq:Ol.seq,set:$l.set,timestamp:nn.timestamp},JR={"tag:yaml.org,2002:binary":Tl.binary,"tag:yaml.org,2002:merge":_t.merge,"tag:yaml.org,2002:omap":Ll.omap,"tag:yaml.org,2002:pairs":Nl.pairs,"tag:yaml.org,2002:set":$l.set,"tag:yaml.org,2002:timestamp":nn.timestamp};function QR(e,t,r){let n=Pl.get(t);if(n&&!e)return r&&!n.includes(_t.merge)?n.concat(_t.merge):n.slice();let i=n;if(!i)if(Array.isArray(e))i=[];else{let o=Array.from(Pl.keys()).filter((s)=>s!=="yaml11").map((s)=>JSON.stringify(s)).join(", ");throw Error(`Unknown schema "${t}"; use one of ${o} or define customTags array`)}if(Array.isArray(e))for(let o of e)i=i.concat(o);else if(typeof e==="function")i=e(i.slice());if(r)i=i.concat(_t.merge);return i.reduce((o,s)=>{let a=typeof s==="string"?Al[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(Al).map((d)=>JSON.stringify(d)).join(", ");throw Error(`Unknown custom tag ${c}; use one of ${l}`)}if(!o.includes(a))o.push(a);return o},[])}XR.coreKnownTags=JR;XR.getTags=QR});var Qi=y(function(oC){var Wi=A(),tC=Ze(),rC=et(),nC=Lt(),on=Ml(),iC=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0;class Ji{constructor({compat:e,customTags:t,merge:r,resolveKnownTags:n,schema:i,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(e)?on.getTags(e,"compat"):e?on.getTags(null,e):null,this.name=typeof i==="string"&&i||"core",this.knownTags=n?on.coreKnownTags:{},this.tags=on.getTags(t,this.name,r),this.toStringOptions=s??null,Object.defineProperty(this,Wi.MAP,{value:tC.map}),Object.defineProperty(this,Wi.SCALAR,{value:nC.string}),Object.defineProperty(this,Wi.SEQ,{value:rC.seq}),this.sortMapEntries=typeof o==="function"?o:o===!0?iC:null}clone(){let e=Object.create(Ji.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}oC.Schema=Ji});var _l=y(function(lC){var aC=A(),Xi=Dt(),Ft=It();function cC(e,t){let r=[],n=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);if(c)r.push(c),n=!0;else if(e.directives.docStart)n=!0}if(n)r.push("---");let i=Xi.createStringifyContext(e,t),{commentString:o}=i.options;if(e.commentBefore){if(r.length!==1)r.unshift("");let c=o(e.commentBefore);r.unshift(Ft.indentComment(c,""))}let s=!1,a=null;if(e.contents){if(aC.isNode(e.contents)){if(e.contents.spaceBefore&&n)r.push("");if(e.contents.commentBefore){let d=o(e.contents.commentBefore);r.push(Ft.indentComment(d,""))}i.forceBlockIndent=!!e.comment,a=e.contents.comment}let c=a?void 0:()=>s=!0,l=Xi.stringify(e.contents,i,()=>a=null,c);if(a)l+=Ft.lineComment(l,"",o(a));if((l[0]==="|"||l[0]===">")&&r[r.length-1]==="---")r[r.length-1]=`--- ${l}`;else r.push(l)}else r.push(Xi.stringify(e.contents,i));if(e.directives?.docEnd)if(e.comment){let c=o(e.comment);if(c.includes(`
|
|
57
|
-
`))r.push("..."),r.push(
|
|
59
|
+
${o.comment}`:n.comment}n=i}e.items[r]=$n.isPair(n)?n:new vo.Pair(n)}else t("Expected a sequence for this tag");return e}function gu(e,t,r){let{replacer:n}=r,i=new Nk.YAMLSeq(e);i.tag="tag:yaml.org,2002:pairs";let o=0;if(t&&Symbol.iterator in Object(t))for(let s of t){if(typeof n==="function")s=n.call(t,String(o++),s);let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],c=s[a];else throw TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(vo.createPair(a,c,r))}return i}var Lk={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:fu,createNode:gu};$k.createPairs=gu;$k.pairs=Lk;$k.resolvePairs=fu});var Co=b(function(Bk){var mu=_(),Ro=Le(),lr=Fe(),Fk=qe(),hu=_n();class et extends Fk.YAMLSeq{constructor(){super();this.add=lr.YAMLMap.prototype.add.bind(this),this.delete=lr.YAMLMap.prototype.delete.bind(this),this.get=lr.YAMLMap.prototype.get.bind(this),this.has=lr.YAMLMap.prototype.has.bind(this),this.set=lr.YAMLMap.prototype.set.bind(this),this.tag=et.tag}toJSON(e,t){if(!t)return super.toJSON(e);let r=new Map;if(t?.onCreate)t.onCreate(r);for(let n of this.items){let i,o;if(mu.isPair(n))i=Ro.toJS(n.key,"",t),o=Ro.toJS(n.value,i,t);else i=Ro.toJS(n,"",t);if(r.has(i))throw Error("Ordered maps must not include duplicate keys");r.set(i,o)}return r}static from(e,t,r){let n=hu.createPairs(e,t,r),i=new this;return i.items=n.items,i}}et.tag="tag:yaml.org,2002:omap";var qk={collection:"seq",identify:(e)=>e instanceof Map,nodeClass:et,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let r=hu.resolvePairs(e,t),n=[];for(let{key:i}of r.items)if(mu.isScalar(i))if(n.includes(i.value))t(`Ordered maps must not include duplicate keys: ${i.value}`);else n.push(i.value);return Object.assign(new et,r)},createNode:(e,t,r)=>et.from(e,t,r)};Bk.YAMLOMap=et;Bk.omap=qk});var ku=b(function(Hk){var yu=V();function bu({value:e,source:t},r){if(t&&(e?Su:wu).test.test(t))return t;return e?r.options.trueStr:r.options.falseStr}var Su={identify:(e)=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new yu.Scalar(!0),stringify:bu},wu={identify:(e)=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new yu.Scalar(!1),stringify:bu};Hk.falseTag=wu;Hk.trueTag=Su});var vu=b(function(Qk){var Gk=V(),xo=xt(),Yk={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(e)=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:xo.stringifyNumber},Jk={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:(e)=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():xo.stringifyNumber(e)}},Wk={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Gk.Scalar(parseFloat(e.replace(/_/g,""))),r=e.indexOf(".");if(r!==-1){let n=e.substring(r+1).replace(/_/g,"");if(n[n.length-1]==="0")t.minFractionDigits=n.length}return t},stringify:xo.stringifyNumber};Qk.float=Wk;Qk.floatExp=Jk;Qk.floatNaN=Yk});var Cu=b(function(ov){var Ru=xt(),ur=(e)=>typeof e==="bigint"||Number.isInteger(e);function Mn(e,t,r,{intAsBigInt:n}){let i=e[0];if(i==="-"||i==="+")t+=1;if(e=e.substring(t).replace(/_/g,""),n){switch(r){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let s=BigInt(e);return i==="-"?BigInt(-1)*s:s}let o=parseInt(e,r);return i==="-"?-1*o:o}function Io(e,t,r){let{value:n}=e;if(ur(n)){let i=n.toString(t);return n<0?"-"+r+i.substr(1):r+i}return Ru.stringifyNumber(e)}var tv={identify:ur,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,r)=>Mn(e,2,2,r),stringify:(e)=>Io(e,2,"0b")},rv={identify:ur,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,r)=>Mn(e,1,8,r),stringify:(e)=>Io(e,8,"0")},nv={identify:ur,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,r)=>Mn(e,0,10,r),stringify:Ru.stringifyNumber},iv={identify:ur,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,r)=>Mn(e,2,16,r),stringify:(e)=>Io(e,16,"0x")};ov.int=nv;ov.intBin=tv;ov.intHex=iv;ov.intOct=rv});var Eo=b(function(dv){var qn=_(),jn=Me(),Fn=Fe();class tt extends Fn.YAMLMap{constructor(e){super(e);this.tag=tt.tag}add(e){let t;if(qn.isPair(e))t=e;else if(e&&typeof e==="object"&&"key"in e&&"value"in e&&e.value===null)t=new jn.Pair(e.key,null);else t=new jn.Pair(e,null);if(!Fn.findPair(this.items,t.key))this.items.push(t)}get(e,t){let r=Fn.findPair(this.items,e);return!t&&qn.isPair(r)?qn.isScalar(r.key)?r.key.value:r.key:r}set(e,t){if(typeof t!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let r=Fn.findPair(this.items,e);if(r&&!t)this.items.splice(this.items.indexOf(r),1);else if(!r&&t)this.items.push(new jn.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,r);else throw Error("Set items must all have null values")}static from(e,t,r){let{replacer:n}=r,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t){if(typeof n==="function")o=n.call(t,o,o);i.items.push(jn.createPair(o,null,r))}return i}}tt.tag="tag:yaml.org,2002:set";var uv={collection:"map",identify:(e)=>e instanceof Set,nodeClass:tt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,r)=>tt.from(e,t,r),resolve(e,t){if(qn.isMap(e))if(e.hasAllNullValues(!0))return Object.assign(new tt,e);else t("Set items must all have null values");else t("Expected a mapping for this tag");return e}};dv.YAMLSet=tt;dv.set=uv});var Po=b(function(yv){var gv=xt();function Ao(e,t){let r=e[0],n=r==="-"||r==="+"?e.substring(1):e,i=(s)=>t?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function xu(e){let{value:t}=e,r=(s)=>s;if(typeof t==="bigint")r=(s)=>BigInt(s);else if(isNaN(t)||!isFinite(t))return gv.stringifyNumber(e);let n="";if(t<0)n="-",t*=r(-1);let i=r(60),o=[t%i];if(t<60)o.unshift(0);else if(t=(t-o[0])/i,o.unshift(t%i),t>=60)t=(t-o[0])/i,o.unshift(t);return n+o.map((s)=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var mv={identify:(e)=>typeof e==="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:r})=>Ao(e,r),stringify:xu},hv={identify:(e)=>typeof e==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:(e)=>Ao(e,!1),stringify:xu},Iu={identify:(e)=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(Iu.test);if(!t)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,c),u=t[8];if(u&&u!=="Z"){let d=Ao(u,!1);if(Math.abs(d)<30)d*=60;l-=60000*d}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};yv.floatTime=hv;yv.intTime=mv;yv.timestamp=Iu});var Au=b(function(Dv){var kv=Rt(),vv=Tn(),Rv=Ct(),Cv=ar(),xv=ko(),Eu=ku(),Oo=vu(),Bn=Cu(),Iv=Cn(),Ev=Co(),Av=_n(),Pv=Eo(),Do=Po(),Ov=[kv.map,Rv.seq,Cv.string,vv.nullTag,Eu.trueTag,Eu.falseTag,Bn.intBin,Bn.intOct,Bn.int,Bn.intHex,Oo.floatNaN,Oo.floatExp,Oo.float,xv.binary,Iv.merge,Ev.omap,Av.pairs,Pv.set,Do.intTime,Do.floatTime,Do.timestamp];Dv.schema=Ov});var ju=b(function(qv){var Tu=Rt(),Nv=Tn(),Nu=Ct(),Lv=ar(),$v=fo(),To=mo(),No=yo(),_v=uu(),Mv=pu(),Lu=ko(),dr=Cn(),$u=Co(),_u=_n(),Pu=Au(),Mu=Eo(),Un=Po(),Ou=new Map([["core",_v.schema],["failsafe",[Tu.map,Nu.seq,Lv.string]],["json",Mv.schema],["yaml11",Pu.schema],["yaml-1.1",Pu.schema]]),Du={binary:Lu.binary,bool:$v.boolTag,float:To.float,floatExp:To.floatExp,floatNaN:To.floatNaN,floatTime:Un.floatTime,int:No.int,intHex:No.intHex,intOct:No.intOct,intTime:Un.intTime,map:Tu.map,merge:dr.merge,null:Nv.nullTag,omap:$u.omap,pairs:_u.pairs,seq:Nu.seq,set:Mu.set,timestamp:Un.timestamp},jv={"tag:yaml.org,2002:binary":Lu.binary,"tag:yaml.org,2002:merge":dr.merge,"tag:yaml.org,2002:omap":$u.omap,"tag:yaml.org,2002:pairs":_u.pairs,"tag:yaml.org,2002:set":Mu.set,"tag:yaml.org,2002:timestamp":Un.timestamp};function Fv(e,t,r){let n=Ou.get(t);if(n&&!e)return r&&!n.includes(dr.merge)?n.concat(dr.merge):n.slice();let i=n;if(!i)if(Array.isArray(e))i=[];else{let o=Array.from(Ou.keys()).filter((s)=>s!=="yaml11").map((s)=>JSON.stringify(s)).join(", ");throw Error(`Unknown schema "${t}"; use one of ${o} or define customTags array`)}if(Array.isArray(e))for(let o of e)i=i.concat(o);else if(typeof e==="function")i=e(i.slice());if(r)i=i.concat(dr.merge);return i.reduce((o,s)=>{let a=typeof s==="string"?Du[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(Du).map((u)=>JSON.stringify(u)).join(", ");throw Error(`Unknown custom tag ${c}; use one of ${l}`)}if(!o.includes(a))o.push(a);return o},[])}qv.coreKnownTags=jv;qv.getTags=Fv});var _o=b(function(Gv){var Lo=_(),Vv=Rt(),Hv=Ct(),Kv=ar(),Vn=ju(),zv=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0;class $o{constructor({compat:e,customTags:t,merge:r,resolveKnownTags:n,schema:i,sortMapEntries:o,toStringDefaults:s}){this.compat=Array.isArray(e)?Vn.getTags(e,"compat"):e?Vn.getTags(null,e):null,this.name=typeof i==="string"&&i||"core",this.knownTags=n?Vn.coreKnownTags:{},this.tags=Vn.getTags(t,this.name,r),this.toStringOptions=s??null,Object.defineProperty(this,Lo.MAP,{value:Vv.map}),Object.defineProperty(this,Lo.SCALAR,{value:Kv.string}),Object.defineProperty(this,Lo.SEQ,{value:Hv.seq}),this.sortMapEntries=typeof o==="function"?o:o===!0?zv:null}clone(){let e=Object.create($o.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}Gv.Schema=$o});var Fu=b(function(Qv){var Jv=_(),Mo=ir(),pr=tr();function Wv(e,t){let r=[],n=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);if(c)r.push(c),n=!0;else if(e.directives.docStart)n=!0}if(n)r.push("---");let i=Mo.createStringifyContext(e,t),{commentString:o}=i.options;if(e.commentBefore){if(r.length!==1)r.unshift("");let c=o(e.commentBefore);r.unshift(pr.indentComment(c,""))}let s=!1,a=null;if(e.contents){if(Jv.isNode(e.contents)){if(e.contents.spaceBefore&&n)r.push("");if(e.contents.commentBefore){let u=o(e.contents.commentBefore);r.push(pr.indentComment(u,""))}i.forceBlockIndent=!!e.comment,a=e.contents.comment}let c=a?void 0:()=>s=!0,l=Mo.stringify(e.contents,i,()=>a=null,c);if(a)l+=pr.lineComment(l,"",o(a));if((l[0]==="|"||l[0]===">")&&r[r.length-1]==="---")r[r.length-1]=`--- ${l}`;else r.push(l)}else r.push(Mo.stringify(e.contents,i));if(e.directives?.docEnd)if(e.comment){let c=o(e.comment);if(c.includes(`
|
|
60
|
+
`))r.push("..."),r.push(pr.indentComment(c,""));else r.push(`... ${c}`)}else r.push("...");else{let c=e.comment;if(c&&s)c=c.replace(/^\n+/,"");if(c){if((!s||a)&&r[r.length-1]!=="")r.push("");r.push(pr.indentComment(o(c),""))}}return r.join(`
|
|
58
61
|
`)+`
|
|
59
|
-
`}
|
|
62
|
+
`}Qv.stringifyDocument=Wv});var fr=b(function(sR){var Zv=Zt(),It=yn(),ae=_(),eR=Me(),tR=Le(),rR=_o(),nR=Fu(),jo=gn(),iR=ro(),oR=er(),Fo=to();class qo{constructor(e,t,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ae.NODE_TYPE,{value:ae.DOC});let n=null;if(typeof t==="function"||Array.isArray(t))n=t;else if(r===void 0&&t)r=t,t=void 0;let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=i;let{version:o}=i;if(r?._directives){if(this.directives=r._directives.atDocument(),this.directives.yaml.explicit)o=this.directives.yaml.version}else this.directives=new Fo.Directives({version:o});this.setSchema(o,r),this.contents=e===void 0?null:this.createNode(e,n,r)}clone(){let e=Object.create(qo.prototype,{[ae.NODE_TYPE]:{value:ae.DOC}});if(e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives)e.directives=this.directives.clone();if(e.schema=this.schema.clone(),e.contents=ae.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range)e.range=this.range.slice();return e}add(e){if(Et(this.contents))this.contents.add(e)}addIn(e,t){if(Et(this.contents))this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let r=jo.anchorNames(this);e.anchor=!t||r.has(t)?jo.findNewAnchor(t||"a",r):t}return new Zv.Alias(e.anchor)}createNode(e,t,r){let n=void 0;if(typeof t==="function")e=t.call({"":e},"",e),n=t;else if(Array.isArray(t)){let g=(y)=>typeof y==="number"||y instanceof String||y instanceof Number,h=t.filter(g).map(String);if(h.length>0)t=t.concat(h);n=t}else if(r===void 0&&t)r=t,t=void 0;let{aliasDuplicateObjects:i,anchorPrefix:o,flow:s,keepUndefined:a,onTagObj:c,tag:l}=r??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=jo.createNodeAnchors(this,o||"a"),p={aliasDuplicateObjects:i??!0,keepUndefined:a??!1,onAnchor:u,onTagObj:c,replacer:n,schema:this.schema,sourceObjects:f},m=oR.createNode(e,l,p);if(s&&ae.isCollection(m))m.flow=!0;return d(),m}createPair(e,t,r={}){let n=this.createNode(e,null,r),i=this.createNode(t,null,r);return new eR.Pair(n,i)}delete(e){return Et(this.contents)?this.contents.delete(e):!1}deleteIn(e){if(It.isEmptyPath(e)){if(this.contents==null)return!1;return this.contents=null,!0}return Et(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return ae.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){if(It.isEmptyPath(e))return!t&&ae.isScalar(this.contents)?this.contents.value:this.contents;return ae.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return ae.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){if(It.isEmptyPath(e))return this.contents!==void 0;return ae.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){if(this.contents==null)this.contents=It.collectionFromPath(this.schema,[e],t);else if(Et(this.contents))this.contents.set(e,t)}setIn(e,t){if(It.isEmptyPath(e))this.contents=t;else if(this.contents==null)this.contents=It.collectionFromPath(this.schema,Array.from(e),t);else if(Et(this.contents))this.contents.setIn(e,t)}setSchema(e,t={}){if(typeof e==="number")e=String(e);let r;switch(e){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new Fo.Directives({version:"1.1"});r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=e;else this.directives=new Fo.Directives({version:e});r={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;r=null;break;default:{let n=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(r)this.schema=new rR.Schema(Object.assign(r,t));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){let s={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n==="number"?n:100},a=tR.toJS(this.contents,t??"",s);if(typeof i==="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o==="function"?iR.applyReviver(o,{"":a},"",a):a}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return nR.stringifyDocument(this,e)}}function Et(e){if(ae.isCollection(e))return!0;throw Error("Expected a YAML collection as document contents")}sR.Document=qo});var gr=b(function(lR){class Hn extends Error{constructor(e,t,r,n){super();this.name=e,this.code=r,this.message=n,this.pos=t}}class qu extends Hn{constructor(e,t,r){super("YAMLParseError",e,t,r)}}class Bu extends Hn{constructor(e,t,r){super("YAMLWarning",e,t,r)}}var cR=(e,t)=>(r)=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map((a)=>t.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=e.substring(t.lineStarts[n-1],t.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="…"+s.substring(a),o-=a-1}if(s.length>80)s=s.substring(0,79)+"…";if(n>1&&/^ *$/.test(s.substring(0,o))){let a=e.substring(t.lineStarts[n-2],t.lineStarts[n-1]);if(a.length>80)a=a.substring(0,79)+`…
|
|
60
63
|
`;s=a+s}if(/[^ ]/.test(s)){let a=1,c=r.linePos[1];if(c?.line===n&&c.col>i)a=Math.max(1,Math.min(c.col-i,80-o));let l=" ".repeat(o)+"^".repeat(a);r.message+=`:
|
|
61
64
|
|
|
62
65
|
${s}
|
|
63
66
|
${l}
|
|
64
|
-
`}};
|
|
65
|
-
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let r of t.start)if(r.type==="newline")return!0;if(t.sep){for(let r of t.sep)if(r.type==="newline")return!0}if(
|
|
66
|
-
`+g.comment;else a.comment=g.comment;continue}if(g.newlineAfterProp||
|
|
67
|
-
`+k.comment;else S.comment=k.comment;let
|
|
68
|
-
`+
|
|
69
|
-
`+
|
|
70
|
-
`+
|
|
71
|
-
`+h.comment;else l.comment=h.comment;l.range=[n.offset,g,h.offset]}else l.range=[n.offset,g,g];return l}
|
|
72
|
-
`.repeat(Math.max(1,s.length-1)):"",h=n+i.length;if(t.source)h+=t.source.length;return{value:g,type:o,comment:i.comment,range:[n,h,h]}}let c=t.indent+i.indent,l=t.offset+i.length,
|
|
73
|
-
`;for(let g=
|
|
74
|
-
`;else if(h.length>c||
|
|
75
|
-
`;else if(!
|
|
67
|
+
`}};lR.YAMLError=Hn;lR.YAMLParseError=qu;lR.YAMLWarning=Bu;lR.prettifyError=cR});var mr=b(function(mR){function gR(e,{flow:t,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,d="",f="",p=!1,m=!1,g=null,h=null,y=null,S=null,k=null,A=null,P=null;for(let C of e){if(m){if(C.type!=="space"&&C.type!=="newline"&&C.type!=="comma")o(C.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");m=!1}if(g){if(l&&C.type!=="comment"&&C.type!=="newline")o(g,"TAB_AS_INDENT","Tabs are not allowed as indentation");g=null}switch(C.type){case"space":if(!t&&(r!=="doc-start"||n?.type!=="flow-collection")&&C.source.includes("\t"))g=C;u=!0;break;case"comment":{if(!u)o(C,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let j=C.source.substring(1)||" ";if(!d)d=j;else d+=f+j;f="",l=!1;break}case"newline":if(l){if(d)d+=C.source;else if(!A||r!=="seq-item-ind")c=!0}else f+=C.source;if(l=!0,p=!0,h||y)S=C;u=!0;break;case"anchor":if(h)o(C,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(C.source.endsWith(":"))o(C.offset+C.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);h=C,P??(P=C.offset),l=!1,u=!1,m=!0;break;case"tag":{if(y)o(C,"MULTIPLE_TAGS","A node can have at most one tag");y=C,P??(P=C.offset),l=!1,u=!1,m=!0;break}case r:if(h||y)o(C,"BAD_PROP_ORDER",`Anchors and tags must be after the ${C.source} indicator`);if(A)o(C,"UNEXPECTED_TOKEN",`Unexpected ${C.source} in ${t??"collection"}`);A=C,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(t){if(k)o(C,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`);k=C,l=!1,u=!1;break}default:o(C,"UNEXPECTED_TOKEN",`Unexpected ${C.type} token`),l=!1,u=!1}}let O=e[e.length-1],D=O?O.offset+O.source.length:i;if(m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!==""))o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(g&&(l&&g.indent<=s||n?.type==="block-map"||n?.type==="block-seq"))o(g,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:k,found:A,spaceBefore:c,comment:d,hasNewline:p,anchor:h,tag:y,newlineAfterProp:S,end:D,start:P??D}}mR.resolveProps=gR});var Kn=b(function(yR){function Bo(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
|
|
68
|
+
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let r of t.start)if(r.type==="newline")return!0;if(t.sep){for(let r of t.sep)if(r.type==="newline")return!0}if(Bo(t.key)||Bo(t.value))return!0}return!1;default:return!0}}yR.containsNewline=Bo});var Uo=b(function(kR){var SR=Kn();function wR(e,t,r){if(t?.type==="flow-collection"){let n=t.end[0];if(n.indent===e&&(n.source==="]"||n.source==="}")&&SR.containsNewline(t))r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}kR.flowIndentCheck=wR});var Vo=b(function(CR){var Uu=_();function RR(e,t,r){let{uniqueKeys:n}=e.options;if(n===!1)return!1;let i=typeof n==="function"?n:(o,s)=>o===s||Uu.isScalar(o)&&Uu.isScalar(s)&&o.value===s.value;return t.some((o)=>i(o.key,r))}CR.mapIncludes=RR});var Gu=b(function(OR){var Vu=Me(),IR=Fe(),Hu=mr(),ER=Kn(),Ku=Uo(),AR=Vo(),zu="All mapping items must start at the same column";function PR({composeNode:e,composeEmptyNode:t},r,n,i,o){let a=new(o?.nodeClass??IR.YAMLMap)(r.schema);if(r.atRoot)r.atRoot=!1;let c=n.offset,l=null;for(let u of n.items){let{start:d,key:f,sep:p,value:m}=u,g=Hu.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),h=!g.found;if(h){if(f){if(f.type==="block-seq")i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in f&&f.indent!==n.indent)i(c,"BAD_INDENT",zu)}if(!g.anchor&&!g.tag&&!p){if(l=g.end,g.comment)if(a.comment)a.comment+=`
|
|
69
|
+
`+g.comment;else a.comment=g.comment;continue}if(g.newlineAfterProp||ER.containsNewline(f))i(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(g.found?.indent!==n.indent)i(c,"BAD_INDENT",zu);r.atKey=!0;let y=g.end,S=f?e(r,f,g,i):t(r,y,d,null,g,i);if(r.schema.compat)Ku.flowIndentCheck(n.indent,f,i);if(r.atKey=!1,AR.mapIncludes(r,a.items,S))i(y,"DUPLICATE_KEY","Map keys must be unique");let k=Hu.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:S.range[2],onError:i,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=k.end,k.found){if(h){if(m?.type==="block-map"&&!k.hasNewline)i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(r.options.strict&&g.start<k.found.offset-1024)i(S.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let A=m?e(r,m,k,i):t(r,c,p,null,k,i);if(r.schema.compat)Ku.flowIndentCheck(n.indent,m,i);c=A.range[2];let P=new Vu.Pair(S,A);if(r.options.keepSourceTokens)P.srcToken=u;a.items.push(P)}else{if(h)i(S.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(k.comment)if(S.comment)S.comment+=`
|
|
70
|
+
`+k.comment;else S.comment=k.comment;let A=new Vu.Pair(S);if(r.options.keepSourceTokens)A.srcToken=u;a.items.push(A)}}if(l&&l<c)i(l,"IMPOSSIBLE","Map comment with trailing content");return a.range=[n.offset,c,l??c],a}OR.resolveBlockMap=PR});var Yu=b(function(_R){var TR=qe(),NR=mr(),LR=Uo();function $R({composeNode:e,composeEmptyNode:t},r,n,i,o){let a=new(o?.nodeClass??TR.YAMLSeq)(r.schema);if(r.atRoot)r.atRoot=!1;if(r.atKey)r.atKey=!1;let c=n.offset,l=null;for(let{start:u,value:d}of n.items){let f=NR.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)if(d?.type==="block-seq")i(f.end,"BAD_INDENT","All sequence items must start at the same column");else i(c,"MISSING_CHAR","Sequence item without - indicator");else{if(l=f.end,f.comment)a.comment=f.comment;continue}let p=d?e(r,d,f,i):t(r,f.end,u,null,f,i);if(r.schema.compat)LR.flowIndentCheck(n.indent,d,i);c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}_R.resolveBlockSeq=$R});var At=b(function(FR){function jR(e,t,r,n){let i="";if(e){let o=!1,s="";for(let a of e){let{source:c,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{if(r&&!o)n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";if(!i)i=u;else i+=s+u;s="";break}case"newline":if(i)s+=c;o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=c.length}}return{comment:i,offset:t}}FR.resolveEnd=jR});var Qu=b(function(YR){var BR=_(),UR=Me(),Ju=Fe(),VR=qe(),HR=At(),Wu=mr(),KR=Kn(),zR=Vo(),Ho="Block collections are not allowed within flow collections",Ko=(e)=>e&&(e.type==="block-map"||e.type==="block-seq");function GR({composeNode:e,composeEmptyNode:t},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",l=new(o?.nodeClass??(s?Ju.YAMLMap:VR.YAMLSeq))(r.schema);l.flow=!0;let u=r.atRoot;if(u)r.atRoot=!1;if(r.atKey)r.atKey=!1;let d=n.offset+n.start.source.length;for(let h=0;h<n.items.length;++h){let y=n.items[h],{start:S,key:k,sep:A,value:P}=y,O=Wu.resolveProps(S,{flow:a,indicator:"explicit-key-ind",next:k??A?.[0],offset:d,onError:i,parentIndent:n.indent,startOnNewline:!1});if(!O.found){if(!O.anchor&&!O.tag&&!A&&!P){if(h===0&&O.comma)i(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(h<n.items.length-1)i(O.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`);if(O.comment)if(l.comment)l.comment+=`
|
|
71
|
+
`+O.comment;else l.comment=O.comment;d=O.end;continue}if(!s&&r.options.strict&&KR.containsNewline(k))i(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(h===0){if(O.comma)i(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`)}else{if(!O.comma)i(O.start,"MISSING_CHAR",`Missing , between ${a} items`);if(O.comment){let D="";e:for(let C of S)switch(C.type){case"comma":case"space":break;case"comment":D=C.source.substring(1);break e;default:break e}if(D){let C=l.items[l.items.length-1];if(BR.isPair(C))C=C.value??C.key;if(C.comment)C.comment+=`
|
|
72
|
+
`+D;else C.comment=D;O.comment=O.comment.substring(D.length+1)}}}if(!s&&!A&&!O.found){let D=P?e(r,P,O,i):t(r,O.end,A,null,O,i);if(l.items.push(D),d=D.range[2],Ko(P))i(D.range,"BLOCK_IN_FLOW",Ho)}else{r.atKey=!0;let D=O.end,C=k?e(r,k,O,i):t(r,D,S,null,O,i);if(Ko(k))i(C.range,"BLOCK_IN_FLOW",Ho);r.atKey=!1;let j=Wu.resolveProps(A??[],{flow:a,indicator:"map-value-ind",next:P,offset:C.range[2],onError:i,parentIndent:n.indent,startOnNewline:!1});if(j.found){if(!s&&!O.found&&r.options.strict){if(A)for(let w of A){if(w===j.found)break;if(w.type==="newline"){i(w,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(O.start<j.found.offset-1024)i(j.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(P)if("source"in P&&P.source?.[0]===":")i(P,"MISSING_CHAR",`Missing space after : in ${a}`);else i(j.start,"MISSING_CHAR",`Missing , or : between ${a} items`);let te=P?e(r,P,j,i):j.found?t(r,j.end,A,null,j,i):null;if(te){if(Ko(P))i(te.range,"BLOCK_IN_FLOW",Ho)}else if(j.comment)if(C.comment)C.comment+=`
|
|
73
|
+
`+j.comment;else C.comment=j.comment;let R=new UR.Pair(C,te);if(r.options.keepSourceTokens)R.srcToken=y;if(s){let w=l;if(zR.mapIncludes(r,w.items,C))i(D,"DUPLICATE_KEY","Map keys must be unique");w.items.push(R)}else{let w=new Ju.YAMLMap(r.schema);w.flow=!0,w.items.push(R);let E=(te??C).range;w.range=[C.range[0],E[1],E[2]],l.items.push(w)}d=te?te.range[2]:j.end}}let f=s?"}":"]",[p,...m]=n.end,g=d;if(p?.source===f)g=p.offset+p.source.length;else{let h=a[0].toUpperCase()+a.substring(1),y=u?`${h} must end with a ${f}`:`${h} in block collection must be sufficiently indented and end with a ${f}`;if(i(d,u?"MISSING_CHAR":"BAD_INDENT",y),p&&p.source.length!==1)m.unshift(p)}if(m.length>0){let h=HR.resolveEnd(m,g,r.options.strict,i);if(h.comment)if(l.comment)l.comment+=`
|
|
74
|
+
`+h.comment;else l.comment=h.comment;l.range=[n.offset,g,h.offset]}else l.range=[n.offset,g,g];return l}YR.resolveFlowCollection=GR});var Xu=b(function(iC){var WR=_(),QR=V(),XR=Fe(),ZR=qe(),eC=Gu(),tC=Yu(),rC=Qu();function zo(e,t,r,n,i,o){let s=r.type==="block-map"?eC.resolveBlockMap(e,t,r,n,o):r.type==="block-seq"?tC.resolveBlockSeq(e,t,r,n,o):rC.resolveFlowCollection(e,t,r,n,o),a=s.constructor;if(i==="!"||i===a.tagName)return s.tag=a.tagName,s;if(i)s.tag=i;return s}function nC(e,t,r,n,i){let o=n.tag,s=!o?null:t.directives.tagName(o.source,(f)=>i(o,"TAG_RESOLVE_FAILED",f));if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;if(m&&(!p||p.offset<m.offset))i(m,"MISSING_CHAR","Missing newline after block sequence props")}let a=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!o||!s||s==="!"||s===XR.YAMLMap.tagName&&a==="map"||s===ZR.YAMLSeq.tagName&&a==="seq")return zo(e,t,r,i,s);let c=t.schema.tags.find((f)=>f.tag===s&&f.collection===a);if(!c){let f=t.schema.knownTags[s];if(f?.collection===a)t.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else{if(f)i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0);else i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0);return zo(e,t,r,i,s)}}let l=zo(e,t,r,i,s,c),u=c.resolve?.(l,(f)=>i(o,"TAG_RESOLVE_FAILED",f),t.options)??l,d=WR.isNode(u)?u:new QR.Scalar(u);if(d.range=l.range,d.tag=s,c?.format)d.format=c.format;return d}iC.composeCollection=nC});var Yo=b(function(lC){var Go=V();function sC(e,t,r){let n=t.offset,i=aC(t,e.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?Go.Scalar.BLOCK_FOLDED:Go.Scalar.BLOCK_LITERAL,s=t.source?cC(t.source):[],a=s.length;for(let g=s.length-1;g>=0;--g){let h=s[g][1];if(h===""||h==="\r")a=g;else break}if(a===0){let g=i.chomp==="+"&&s.length>0?`
|
|
75
|
+
`.repeat(Math.max(1,s.length-1)):"",h=n+i.length;if(t.source)h+=t.source.length;return{value:g,type:o,comment:i.comment,range:[n,h,h]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let g=0;g<a;++g){let[h,y]=s[g];if(y===""||y==="\r"){if(i.indent===0&&h.length>c)c=h.length}else{if(h.length<c)r(l+h.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(i.indent===0)c=h.length;if(u=g,c===0&&!e.atRoot)r(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=h.length+y.length+1}for(let g=s.length-1;g>=a;--g)if(s[g][0].length>c)a=g+1;let d="",f="",p=!1;for(let g=0;g<u;++g)d+=s[g][0].slice(c)+`
|
|
76
|
+
`;for(let g=u;g<a;++g){let[h,y]=s[g];l+=h.length+y.length+1;let S=y[y.length-1]==="\r";if(S)y=y.slice(0,-1);if(y&&h.length<c){let A=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;r(l-y.length-(S?2:1),"BAD_INDENT",A),h=""}if(o===Go.Scalar.BLOCK_LITERAL)d+=f+h.slice(c)+y,f=`
|
|
77
|
+
`;else if(h.length>c||y[0]==="\t"){if(f===" ")f=`
|
|
78
|
+
`;else if(!p&&f===`
|
|
76
79
|
`)f=`
|
|
77
80
|
|
|
78
|
-
`;
|
|
79
|
-
`,
|
|
80
|
-
`)
|
|
81
|
+
`;d+=f+h.slice(c)+y,f=`
|
|
82
|
+
`,p=!0}else if(y==="")if(f===`
|
|
83
|
+
`)d+=`
|
|
81
84
|
`;else f=`
|
|
82
|
-
`;else
|
|
83
|
-
`+s[g][0].slice(c);if(
|
|
84
|
-
`)
|
|
85
|
-
`;break;default:
|
|
86
|
-
`}let m=n+i.length+t.source.length;return{value:
|
|
85
|
+
`;else d+=f+y,f=" ",p=!1}switch(i.chomp){case"-":break;case"+":for(let g=a;g<s.length;++g)d+=`
|
|
86
|
+
`+s[g][0].slice(c);if(d[d.length-1]!==`
|
|
87
|
+
`)d+=`
|
|
88
|
+
`;break;default:d+=`
|
|
89
|
+
`}let m=n+i.length+t.source.length;return{value:d,type:o,comment:i.comment,range:[n,m,m]}}function aC({offset:e,props:t},r,n){if(t[0].type!=="block-scalar-header")return n(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=t[0],o=i[0],s=0,a="",c=-1;for(let f=1;f<i.length;++f){let p=i[f];if(!a&&(p==="-"||p==="+"))a=p;else{let m=Number(p);if(!s&&m)s=m;else if(c===-1)c=e+f}}if(c!==-1)n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,u="",d=i.length;for(let f=1;f<t.length;++f){let p=t[f];switch(p.type){case"space":l=!0;case"newline":d+=p.source.length;break;case"comment":if(r&&!l)n(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");d+=p.source.length,u=p.source.substring(1);break;case"error":n(p,"UNEXPECTED_TOKEN",p.message),d+=p.source.length;break;default:{let m=`Unexpected token in block scalar header: ${p.type}`;n(p,"UNEXPECTED_TOKEN",m);let g=p.source;if(g&&typeof g==="string")d+=g.length}}}return{mode:o,indent:s,chomp:a,comment:u,length:d}}function cC(e){let t=e.split(/\n( *)/),r=t[0],n=r.match(/^( *)/),o=[n?.[1]?[n[1],r.slice(n[1].length)]:["",r]];for(let s=1;s<t.length;s+=2)o.push([t[s],t[s+1]]);return o}lC.resolveBlockScalar=sC});var Wo=b(function(SC){var Jo=V(),dC=At();function pC(e,t,r){let{offset:n,type:i,source:o,end:s}=e,a,c,l=(f,p,m)=>r(n+f,p,m);switch(i){case"scalar":a=Jo.Scalar.PLAIN,c=fC(o,l);break;case"single-quoted-scalar":a=Jo.Scalar.QUOTE_SINGLE,c=gC(o,l);break;case"double-quoted-scalar":a=Jo.Scalar.QUOTE_DOUBLE,c=mC(o,l);break;default:return r(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let u=n+o.length,d=dC.resolveEnd(s,u,t,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function fC(e,t){let r="";switch(e[0]){case"\t":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${e[0]}`;break}case"@":case"`":{r=`reserved character ${e[0]}`;break}}if(r)t(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`);return Zu(e)}function gC(e,t){if(e[e.length-1]!=="'"||e.length===1)t(e.length,"MISSING_CHAR","Missing closing 'quote");return Zu(e.slice(1,-1)).replace(/''/g,"'")}function Zu(e){let t=/(.*?)\r?\n/sy,r=t.exec(e);if(!r)return e;let n,i;try{n=new RegExp("(?<![ \t])[ \t]+$"),i=new RegExp("^[ \t]+|(?<![ \t])[ \t]+$","g")}catch{n=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let o=r[1].replace(n,""),s=" ",a=t.lastIndex;while(r=t.exec(e)){let l=r[1].replace(i,"");if(l==="")if(s===`
|
|
87
90
|
`)o+=s;else s=`
|
|
88
|
-
`;else o+=s+l,s=" ";a=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=a,r=c.exec(e),o+s+(r?.[1]??"")}function
|
|
91
|
+
`;else o+=s+l,s=" ";a=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=a,r=c.exec(e),o+s+(r?.[1]??"")}function mC(e,t){let r="";for(let n=1;n<e.length-1;++n){let i=e[n];if(i==="\r"&&e[n+1]===`
|
|
89
92
|
`)continue;if(i===`
|
|
90
|
-
`){let{fold:o,offset:s}=
|
|
93
|
+
`){let{fold:o,offset:s}=hC(e,n);r+=o,n=s}else if(i==="\\"){let o=e[++n],s=yC[o];if(s)r+=s;else if(o===`
|
|
91
94
|
`){o=e[n+1];while(o===" "||o==="\t")o=e[++n+1]}else if(o==="\r"&&e[n+1]===`
|
|
92
|
-
`){o=e[++n+1];while(o===" "||o==="\t")o=e[++n+1]}else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;r+=
|
|
95
|
+
`){o=e[++n+1];while(o===" "||o==="\t")o=e[++n+1]}else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;r+=bC(e,n+1,a,t),n+=a}else{let a=e.substr(n-1,2);t(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),r+=a}}else if(i===" "||i==="\t"){let o=n,s=e[n+1];while(s===" "||s==="\t")s=e[++n+1];if(s!==`
|
|
93
96
|
`&&!(s==="\r"&&e[n+2]===`
|
|
94
|
-
`))r+=n>o?e.slice(o,n+1):i}else r+=i}if(e[e.length-1]!=='"'||e.length===1)t(e.length,"MISSING_CHAR",'Missing closing "quote');return r}function
|
|
97
|
+
`))r+=n>o?e.slice(o,n+1):i}else r+=i}if(e[e.length-1]!=='"'||e.length===1)t(e.length,"MISSING_CHAR",'Missing closing "quote');return r}function hC(e,t){let r="",n=e[t+1];while(n===" "||n==="\t"||n===`
|
|
95
98
|
`||n==="\r"){if(n==="\r"&&e[t+2]!==`
|
|
96
99
|
`)break;if(n===`
|
|
97
100
|
`)r+=`
|
|
98
|
-
`;t+=1,n=e[t+1]}if(!r)r=" ";return{fold:r,offset:t}}var
|
|
99
|
-
`,r:"\r",t:"\t",v:"\v",N:"
|
|
101
|
+
`;t+=1,n=e[t+1]}if(!r)r=" ";return{fold:r,offset:t}}var yC={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
102
|
+
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function bC(e,t,r,n){let i=e.substr(t,r),s=i.length===r&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=e.substr(t-2,r+2);return n(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}SC.resolveFlowScalar=pC});var td=b(function(IC){var rt=_(),ed=V(),kC=Yo(),vC=Wo();function RC(e,t,r,n){let{value:i,type:o,comment:s,range:a}=t.type==="block-scalar"?kC.resolveBlockScalar(e,t,n):vC.resolveFlowScalar(t,e.options.strict,n),c=r?e.directives.tagName(r.source,(d)=>n(r,"TAG_RESOLVE_FAILED",d)):null,l;if(e.options.stringKeys&&e.atKey)l=e.schema[rt.SCALAR];else if(c)l=CC(e.schema,i,c,r,n);else if(t.type==="scalar")l=xC(e,i,t,n);else l=e.schema[rt.SCALAR];let u;try{let d=l.resolve(i,(f)=>n(r??t,"TAG_RESOLVE_FAILED",f),e.options);u=rt.isScalar(d)?d:new ed.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??t,"TAG_RESOLVE_FAILED",f),u=new ed.Scalar(i)}if(u.range=a,u.source=i,o)u.type=o;if(c)u.tag=c;if(l.format)u.format=l.format;if(s)u.comment=s;return u}function CC(e,t,r,n,i){if(r==="!")return e[rt.SCALAR];let o=[];for(let a of e.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(t))return a;let s=e.knownTags[r];if(s&&!s.collection)return e.tags.push(Object.assign({},s,{default:!1,test:void 0})),s;return i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),e[rt.SCALAR]}function xC({atKey:e,directives:t,schema:r},n,i,o){let s=r.tags.find((a)=>(a.default===!0||e&&a.default==="key")&&a.test?.test(n))||r[rt.SCALAR];if(r.compat){let a=r.compat.find((c)=>c.default&&c.test?.test(n))??r[rt.SCALAR];if(s.tag!==a.tag){let c=t.tagString(s.tag),l=t.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;o(i,"TAG_RESOLVE_FAILED",u,!0)}}return s}IC.composeScalar=RC});var rd=b(function(PC){function AC(e,t,r){if(t){r??(r=t.length);for(let n=r-1;n>=0;--n){let i=t[n];switch(i.type){case"space":case"comment":case"newline":e-=i.source.length;continue}i=t[++n];while(i?.type==="space")e+=i.source.length,i=t[++n];break}}return e}PC.emptyScalarPosition=AC});var od=b(function(jC){var DC=Zt(),TC=_(),NC=Xu(),nd=td(),LC=At(),$C=rd(),_C={composeNode:id,composeEmptyNode:Qo};function id(e,t,r,n){let i=e.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,l,u=!0;switch(t.type){case"alias":if(l=MC(e,t,n),a||c)n(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(l=nd.composeScalar(e,t,c,n),a)l.anchor=a.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(l=NC.composeCollection(_C,e,t,r,n),a)l.anchor=a.source.substring(1)}catch(d){let f=d instanceof Error?d.message:String(d);n(t,"RESOURCE_EXHAUSTION",f)}break;default:{let d=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;n(t,"UNEXPECTED_TOKEN",d),u=!1}}if(l??(l=Qo(e,t.offset,void 0,null,r,n)),a&&l.anchor==="")n(a,"BAD_ALIAS","Anchor cannot be an empty string");if(i&&e.options.stringKeys&&(!TC.isScalar(l)||typeof l.value!=="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str"))n(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(o)l.spaceBefore=!0;if(s)if(t.type==="scalar"&&t.source==="")l.comment=s;else l.commentBefore=s;if(e.options.keepSourceTokens&&u)l.srcToken=t;return l}function Qo(e,t,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:$C.emptyScalarPosition(t,r,n),indent:-1,source:""},d=nd.composeScalar(e,u,a,l);if(s){if(d.anchor=s.source.substring(1),d.anchor==="")l(s,"BAD_ALIAS","Anchor cannot be an empty string")}if(i)d.spaceBefore=!0;if(o)d.comment=o,d.range[2]=c;return d}function MC({options:e},{offset:t,source:r,end:n},i){let o=new DC.Alias(r.substring(1));if(o.source==="")i(t,"BAD_ALIAS","Alias cannot be an empty string");if(o.source.endsWith(":"))i(t+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=t+r.length,a=LC.resolveEnd(n,s,e.strict,i);if(o.range=[t,s,a.offset],a.comment)o.comment=a.comment;return o}jC.composeEmptyNode=Qo;jC.composeNode=id});var ad=b(function(KC){var BC=fr(),sd=od(),UC=At(),VC=mr();function HC(e,t,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:t},e),c=new BC.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=VC.resolveProps(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});if(u.found){if(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline)s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}c.contents=i?sd.composeNode(l,i,u,s):sd.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=UC.resolveEnd(o,d,!1,s);if(f.comment)c.comment=f.comment;return c.range=[r,d,f.offset],c}KC.composeDoc=HC});var Xo=b(function(XC){var GC=at("process"),YC=to(),JC=fr(),hr=gr(),cd=_(),WC=ad(),QC=At();function yr(e){if(typeof e==="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:r}=e;return[t,t+(typeof r==="string"?r.length:1)]}function ld(e){let t="",r=!1,n=!1;for(let i=0;i<e.length;++i){let o=e[i];switch(o[0]){case"#":t+=(t===""?"":n?`
|
|
100
103
|
|
|
101
104
|
`:`
|
|
102
|
-
`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":if(e[i+1]?.[0]!=="#")i+=1;r=!1;break;default:if(!r)n=!0;r=!1}}return{comment:t,afterEmptyLine:n}}class
|
|
103
|
-
${r}`:r;else if(n||e.directives.docStart||!i)e.commentBefore=r;else if(
|
|
105
|
+
`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":if(e[i+1]?.[0]!=="#")i+=1;r=!1;break;default:if(!r)n=!0;r=!1}}return{comment:t,afterEmptyLine:n}}class ud{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,r,n,i)=>{let o=yr(t);if(i)this.warnings.push(new hr.YAMLWarning(o,r,n));else this.errors.push(new hr.YAMLParseError(o,r,n))},this.directives=new YC.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:r,afterEmptyLine:n}=ld(this.prelude);if(r){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
|
106
|
+
${r}`:r;else if(n||e.directives.docStart||!i)e.commentBefore=r;else if(cd.isCollection(i)&&!i.flow&&i.items.length>0){let o=i.items[0];if(cd.isPair(o))o=o.key;let s=o.commentBefore;o.commentBefore=s?`${r}
|
|
104
107
|
${s}`:r}else{let o=i.commentBefore;i.commentBefore=o?`${r}
|
|
105
|
-
${o}`:r}}if(t){for(let i=0;i<this.errors.length;++i)e.errors.push(this.errors[i]);for(let i=0;i<this.warnings.length;++i)e.warnings.push(this.warnings[i])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
106
|
-
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new
|
|
108
|
+
${o}`:r}}if(t){for(let i=0;i<this.errors.length;++i)e.errors.push(this.errors[i]);for(let i=0;i<this.warnings.length;++i)e.warnings.push(this.warnings[i])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:ld(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,r=-1){for(let n of e)yield*this.next(n);yield*this.end(t,r)}*next(e){if(GC.env.LOG_STREAM)console.dir(e,{depth:null});switch(e.type){case"directive":this.directives.add(e.source,(t,r,n)=>{let i=yr(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",r,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=WC.composeDoc(this.options,this.directives,e,this.onError);if(this.atDirectives&&!t.directives.docStart)this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(t,!1),this.doc)yield this.doc;this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new hr.YAMLParseError(yr(e),"UNEXPECTED_TOKEN",t);if(this.atDirectives||!this.doc)this.errors.push(r);else this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){this.errors.push(new hr.YAMLParseError(yr(e),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let t=QC.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
|
|
109
|
+
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new hr.YAMLParseError(yr(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),n=new JC.Document(void 0,r);if(this.atDirectives)this.onError(t,"MISSING_CHAR","Missing directives-end indicator line");n.range=[0,t,t],this.decorate(n,!1),yield n}}}XC.Composer=ud});var fd=b(function(ax){var ex=Yo(),tx=Wo(),rx=gr(),dd=nr();function nx(e,t=!0,r){if(e){let n=(i,o,s)=>{let a=typeof i==="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,o,s);else throw new rx.YAMLParseError([a,a+1],o,s)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return tx.resolveFlowScalar(e,t,n);case"block-scalar":return ex.resolveBlockScalar({options:{strict:t}},e,n)}}return null}function ix(e,t){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=t,a=dd.stringifyString({type:s,value:e},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:n,source:`
|
|
107
110
|
`}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
|
|
108
|
-
`),
|
|
109
|
-
`,f=[{type:"block-scalar-header",offset:o,indent:n,source:
|
|
110
|
-
`});return{type:"block-scalar",offset:o,indent:n,props:f,source:
|
|
111
|
+
`),u=a.substring(0,l),d=a.substring(l+1)+`
|
|
112
|
+
`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];if(!pd(f,c))f.push({type:"newline",offset:-1,indent:n,source:`
|
|
113
|
+
`});return{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function ox(e,t,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in e?e.indent:null;if(n&&typeof a==="number")a+=2;if(!s)switch(e.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=e.props[0];if(l.type!=="block-scalar-header")throw Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=dd.stringifyString({type:s,value:t},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":sx(e,c);break;case'"':Zo(e,c,"double-quoted-scalar");break;case"'":Zo(e,c,"single-quoted-scalar");break;default:Zo(e,c,"scalar")}}function sx(e,t){let r=t.indexOf(`
|
|
111
114
|
`),n=t.substring(0,r),i=t.substring(r+1)+`
|
|
112
|
-
`;if(e.type==="block-scalar"){let o=e.props[0];if(o.type!=="block-scalar-header")throw Error("Invalid block scalar header");o.source=n,e.source=i}else{let{offset:o}=e,s="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:n}];if(!
|
|
113
|
-
`});for(let c of Object.keys(e))if(c!=="type"&&c!=="offset")delete e[c];Object.assign(e,{type:"block-scalar",indent:s,props:a,source:i})}}function
|
|
114
|
-
`};delete e.items,Object.assign(e,{type:r,source:t,end:[i]});break}default:{let n="indent"in e?e.indent:-1,i="end"in e&&Array.isArray(e.end)?e.end.filter((o)=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(e))if(o!=="type"&&o!=="offset")delete e[o];Object.assign(e,{type:r,indent:n,source:t,end:i})}}}
|
|
115
|
+
`;if(e.type==="block-scalar"){let o=e.props[0];if(o.type!=="block-scalar-header")throw Error("Invalid block scalar header");o.source=n,e.source=i}else{let{offset:o}=e,s="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:n}];if(!pd(a,"end"in e?e.end:void 0))a.push({type:"newline",offset:-1,indent:s,source:`
|
|
116
|
+
`});for(let c of Object.keys(e))if(c!=="type"&&c!=="offset")delete e[c];Object.assign(e,{type:"block-scalar",indent:s,props:a,source:i})}}function pd(e,t){if(t)for(let r of t)switch(r.type){case"space":case"comment":e.push(r);break;case"newline":return e.push(r),!0}return!1}function Zo(e,t,r){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=r,e.source=t;break;case"block-scalar":{let n=e.props.slice(1),i=t.length;if(e.props[0].type==="block-scalar-header")i-=e.props[0].source.length;for(let o of n)o.offset+=i;delete e.props,Object.assign(e,{type:r,source:t,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
|
|
117
|
+
`};delete e.items,Object.assign(e,{type:r,source:t,end:[i]});break}default:{let n="indent"in e?e.indent:-1,i="end"in e&&Array.isArray(e.end)?e.end.filter((o)=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(e))if(o!=="type"&&o!=="offset")delete e[o];Object.assign(e,{type:r,indent:n,source:t,end:i})}}}ax.createScalarToken=ix;ax.resolveAsScalar=nx;ax.setScalarValue=ox});var gd=b(function(px){var dx=(e)=>("type"in e)?Gn(e):zn(e);function Gn(e){switch(e.type){case"block-scalar":{let t="";for(let r of e.props)t+=Gn(r);return t+e.source}case"block-map":case"block-seq":{let t="";for(let r of e.items)t+=zn(r);return t}case"flow-collection":{let t=e.start.source;for(let r of e.items)t+=zn(r);for(let r of e.end)t+=r.source;return t}case"document":{let t=zn(e);if(e.end)for(let r of e.end)t+=r.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let r of e.end)t+=r.source;return t}}}function zn({start:e,key:t,sep:r,value:n}){let i="";for(let o of e)i+=o.source;if(t)i+=Gn(t);if(r)for(let o of r)i+=o.source;if(n)i+=Gn(n);return i}px.stringify=dx});var yd=b(function(mx){var es=Symbol("break visit"),gx=Symbol("skip children"),md=Symbol("remove item");function nt(e,t){if("type"in e&&e.type==="document")e={start:e.start,value:e.value};hd(Object.freeze([]),e,t)}nt.BREAK=es;nt.SKIP=gx;nt.REMOVE=md;nt.itemAtPath=(e,t)=>{let r=e;for(let[n,i]of t){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};nt.parentCollection=(e,t)=>{let r=nt.itemAtPath(e,t.slice(0,-1)),n=t[t.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw Error("Parent collection not found")};function hd(e,t,r){let n=r(t,e);if(typeof n==="symbol")return n;for(let i of["key","value"]){let o=t[i];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=hd(Object.freeze(e.concat([[i,s]])),o.items[s],r);if(typeof a==="number")s=a-1;else if(a===es)return es;else if(a===md)o.items.splice(s,1),s-=1}if(typeof n==="function"&&i==="key")n=n(t,e)}}return typeof n==="function"?n(t,e):n}mx.visit=nt});var Yn=b(function(Rx){var ts=fd(),yx=gd(),bx=yd(),rs="\uFEFF",ns="\x02",is="\x18",os="\x1F",Sx=(e)=>!!e&&("items"in e),wx=(e)=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function kx(e){switch(e){case rs:return"<BOM>";case ns:return"<DOC>";case is:return"<FLOW_END>";case os:return"<SCALAR>";default:return JSON.stringify(e)}}function vx(e){switch(e){case rs:return"byte-order-mark";case ns:return"doc-mode";case is:return"flow-error-end";case os:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
115
118
|
`:case`\r
|
|
116
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}
|
|
117
|
-
`:case"\r":case"\t":return!0;default:return!1}}var
|
|
118
|
-
\r `),
|
|
119
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Rx.createScalarToken=ts.createScalarToken;Rx.resolveAsScalar=ts.resolveAsScalar;Rx.setScalarValue=ts.setScalarValue;Rx.stringify=yx.stringify;Rx.visit=bx.visit;Rx.BOM=rs;Rx.DOCUMENT=ns;Rx.FLOW_END=is;Rx.SCALAR=os;Rx.isCollection=Sx;Rx.isScalar=wx;Rx.prettyToken=kx;Rx.tokenType=vx});var as=b(function(Fx){var br=Yn();function ge(e){switch(e){case void 0:case" ":case`
|
|
120
|
+
`:case"\r":case"\t":return!0;default:return!1}}var bd=new Set("0123456789ABCDEFabcdef"),Mx=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Jn=new Set(",[]{}"),jx=new Set(` ,[]{}
|
|
121
|
+
\r `),ss=(e)=>!e||jx.has(e);class Sd{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let r=this.next??"stream";while(r&&(t||this.hasChars(1)))r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,t=this.buffer[e];while(t===" "||t==="\t")t=this.buffer[++e];if(!t||t==="#"||t===`
|
|
119
122
|
`)return!0;if(t==="\r")return this.buffer[e+1]===`
|
|
120
123
|
`;return!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let r=0;while(t===" ")t=this.buffer[++r+e];if(t==="\r"){let n=this.buffer[r+e+1];if(n===`
|
|
121
124
|
`||!n&&!this.atEnd)return e+r+1}return t===`
|
|
122
|
-
`||r>=this.indentNext||!t&&!this.atEnd?e+r:-1}if(t==="-"||t==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&
|
|
123
|
-
`,this.pos),this.lineEndPos=e;if(e===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[e-1]==="\r")e-=1;return this.buffer.substring(this.pos,e)}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===
|
|
125
|
+
`||r>=this.indentNext||!t&&!this.atEnd?e+r:-1}if(t==="-"||t==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&ge(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;if(typeof e!=="number"||e!==-1&&e<this.pos)e=this.buffer.indexOf(`
|
|
126
|
+
`,this.pos),this.lineEndPos=e;if(e===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[e-1]==="\r")e-=1;return this.buffer.substring(this.pos,e)}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===br.BOM)yield*this.pushCount(1),e=e.substring(1);if(e[0]==="%"){let t=e.length,r=e.indexOf("#");while(r!==-1){let i=e[r-1];if(i===" "||i==="\t"){t=r-1;break}else r=e.indexOf("#",r+1)}while(!0){let i=e[t-1];if(i===" "||i==="\t")t-=1;else break}let n=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield br.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if((t==="---"||t==="...")&&ge(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!ge(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&ge(t)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(ss),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,r=-1;do{if(e=yield*this.pushNewline(),e>0)t=yield*this.pushSpaces(!1),this.indentValue=r=t;else t=0;t+=yield*this.pushSpaces(!0)}while(e+t>0);let n=this.getLine();if(n===null)return this.setNext("flow");if(r!==-1&&r<this.indentNext&&n[0]!=="#"||r===0&&(n.startsWith("---")||n.startsWith("..."))&&ge(n[3])){if(!(r===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield br.FLOW_END,yield*this.parseLineStart()}let i=0;while(n[i]===",")i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),n[i]){case void 0:return"flow";case"#":return yield*this.pushCount(n.length-i),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(ss),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ge(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")while(t!==-1&&this.buffer[t+1]==="'")t=this.buffer.indexOf("'",t+2);else while(t!==-1){let i=0;while(this.buffer[t-1-i]==="\\")i+=1;if(i%2===0)break;t=this.buffer.indexOf('"',t+1)}let r=this.buffer.substring(0,t),n=r.indexOf(`
|
|
124
127
|
`,this.pos);if(n!==-1){while(n!==-1){let i=this.continueScalar(n+1);if(i===-1)break;n=r.indexOf(`
|
|
125
|
-
`,i)}if(n!==-1)t=n-(r[n-1]==="\r"?2:1)}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;while(!0){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil((t)=>
|
|
128
|
+
`,i)}if(n!==-1)t=n-(r[n-1]==="\r"?2:1)}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;while(!0){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil((t)=>ge(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,r;e:for(let i=this.pos;r=this.buffer[i];++i)switch(r){case" ":t+=1;break;case`
|
|
126
129
|
`:e=i,t=0;break;case"\r":{let o=this.buffer[i+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
127
130
|
`)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=t;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let i=this.continueScalar(e+1);if(i===-1)break;e=this.buffer.indexOf(`
|
|
128
131
|
`,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let n=e+1;r=this.buffer[n];while(r===" ")r=this.buffer[++n];if(r==="\t"){while(r==="\t"||r===" "||r==="\r"||r===`
|
|
129
132
|
`)r=this.buffer[++n];e=n-1}else if(!this.blockScalarKeep)do{let i=e-1,o=this.buffer[i];if(o==="\r")o=this.buffer[--i];let s=i;while(o===" ")o=this.buffer[--i];if(o===`
|
|
130
|
-
`&&i>=this.pos&&i+1+t>s)e=i;else break}while(!0);return yield
|
|
133
|
+
`&&i>=this.pos&&i+1+t>s)e=i;else break}while(!0);return yield br.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,r=this.pos-1,n;while(n=this.buffer[++r])if(n===":"){let i=this.buffer[r+1];if(ge(i)||e&&Jn.has(i))break;t=r}else if(ge(n)){let i=this.buffer[r+1];if(n==="\r")if(i===`
|
|
131
134
|
`)r+=1,n=`
|
|
132
|
-
`,i=this.buffer[r+1];else t=r;if(i==="#"||e&&
|
|
133
|
-
`){let o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(e&&
|
|
135
|
+
`,i=this.buffer[r+1];else t=r;if(i==="#"||e&&Jn.has(i))break;if(n===`
|
|
136
|
+
`){let o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(e&&Jn.has(n))break;t=r}if(!n&&!this.atEnd)return this.setNext("plain-scalar");return yield br.SCALAR,yield*this.pushToIndex(t+1,!0),e?"flow":"doc"}*pushCount(e){if(e>0)return yield this.buffer.substr(this.pos,e),this.pos+=e,e;return 0}*pushToIndex(e,t){let r=this.buffer.slice(this.pos,e);if(r)return yield r,this.pos+=r.length,r.length;else if(t)yield"";return 0}*pushIndicators(){let e=0;e:while(!0){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(ss),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let t=this.flowLevel>0,r=this.charAt(1);if(ge(r)||t&&Jn.has(r)){if(!t)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];while(!ge(t)&&t!==">")t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];while(t)if(Mx.has(t))t=this.buffer[++e];else if(t==="%"&&bd.has(this.buffer[e+1])&&bd.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];if(e===`
|
|
134
137
|
`)return yield*this.pushCount(1);else if(e==="\r"&&this.charAt(1)===`
|
|
135
|
-
`)return yield*this.pushCount(2);else return 0}*pushSpaces(e){let t=this.pos-1,r;do r=this.buffer[++t];while(r===" "||e&&r==="\t");let n=t-this.pos;if(n>0)yield this.buffer.substr(this.pos,n),this.pos=t;return n}*pushUntil(e){let t=this.pos,r=this.buffer[t];while(!e(r))r=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}
|
|
138
|
+
`)return yield*this.pushCount(2);else return 0}*pushSpaces(e){let t=this.pos-1,r;do r=this.buffer[++t];while(r===" "||e&&r==="\t");let n=t-this.pos;if(n>0)yield this.buffer.substr(this.pos,n),this.pos=t;return n}*pushUntil(e){let t=this.pos,r=this.buffer[t];while(!e(r))r=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}Fx.Lexer=Sd});var cs=b(function(Bx){class wd{constructor(){this.lineStarts=[],this.addNewLine=(e)=>this.lineStarts.push(e),this.linePos=(e)=>{let t=0,r=this.lineStarts.length;while(t<r){let i=t+r>>1;if(this.lineStarts[i]<e)t=i+1;else r=i}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let n=this.lineStarts[t-1];return{line:t,col:e-n+1}}}}Bx.LineCounter=wd});var ls=b(function(Kx){var Vx=at("process"),kd=Yn(),Hx=as();function Be(e,t){for(let r=0;r<e.length;++r)if(e[r].type===t)return!0;return!1}function vd(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function Cd(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Wn(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function Pt(e){if(e.length===0)return[];let t=e.length;e:while(--t>=0)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}while(e[++t]?.type==="space");return e.splice(t,e.length)}function Qn(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let r=0;r<t.length;++r)e.push(t[r])}function Rd(e){if(e.start.type==="flow-seq-start"){for(let t of e.items)if(t.sep&&!t.value&&!Be(t.start,"explicit-key-ind")&&!Be(t.sep,"map-value-ind")){if(t.key)t.value=t.key;if(delete t.key,Cd(t.value))if(t.value.end)Qn(t.value.end,t.sep);else t.value.end=t.sep;else Qn(t.start,t.sep);delete t.sep}}}class xd{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Hx.Lexer,this.onNewLine=e}*parse(e,t=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let r of this.lexer.lex(e,t))yield*this.next(r);if(!t)yield*this.end()}*next(e){if(this.source=e,Vx.env.LOG_TOKENS)console.log("|",kd.prettyToken(e));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=kd.tokenType(e);if(!t){let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}else if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+e.length);break;case"space":if(this.atNewLine&&e[0]===" ")this.indent+=e.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=e.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){while(this.stack.length>0)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){while(this.stack.length>0)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let r=this.peek(1);if(t.type==="block-scalar")t.indent="indent"in r?r.indent:0;else if(t.type==="flow-collection"&&r.type==="document")t.indent=0;if(t.type==="flow-collection")Rd(t);switch(r.type){case"document":r.value=t;break;case"block-scalar":r.props.push(t);break;case"block-map":{let n=r.items[r.items.length-1];if(n.value){r.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=r.items[r.items.length-1];if(n.value)r.items.push({start:[],value:t});else n.value=t;break}case"flow-collection":{let n=r.items[r.items.length-1];if(!n||n.value)r.items.push({start:[],key:t,sep:[]});else if(n.sep)n.value=t;else Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let n=t.items[t.items.length-1];if(n&&!n.sep&&!n.value&&n.start.length>0&&vd(n.start)===-1&&(t.indent===0||n.start.every((i)=>i.type!=="comment"||i.indent<t.indent))){if(r.type==="document")r.end=n.start;else r.items.push({start:n.start});t.items.splice(-1,1)}}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")e.start.push(this.sourceToken);this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{if(vd(e.start)!==-1)yield*this.pop(),yield*this.step();else e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);if(t)this.stack.push(t);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=Wn(this.peek(2)),r=Pt(t),n;if(e.end)n=e.end,n.push(this.sourceToken),delete e.end;else n=[this.sourceToken];let i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
|
|
136
139
|
`)+1;while(t!==0)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
137
|
-
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let r="end"in t.value?t.value.end:void 0;if((Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment")r?.push(this.sourceToken);else e.items.push({start:[this.sourceToken]})}else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){
|
|
140
|
+
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let r="end"in t.value?t.value.end:void 0;if((Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment")r?.push(this.sourceToken);else e.items.push({start:[this.sourceToken]})}else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Qn(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,n=r&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",i=[];if(n&&t.sep&&!t.value){let o=[];for(let s=0;s<t.sep.length;++s){let a=t.sep[s];switch(a.type){case"newline":o.push(s);break;case"space":break;case"comment":if(a.indent>e.indent)o.length=0;break;default:o.length=0}}if(o.length>=2)i=t.sep.splice(o[1])}switch(this.type){case"anchor":case"tag":if(n||t.value)i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0;else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"explicit-key-ind":if(!t.sep&&!t.explicitKey)t.start.push(this.sourceToken),t.explicitKey=!0;else if(n||t.value)i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(!t.sep)if(Be(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=Pt(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Be(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(Cd(t.key)&&!Be(t.sep,"newline")){let o=Pt(t.start),{key:s,sep:a}=t;a.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:s,sep:a}]})}else if(i.length>0)t.sep=t.sep.concat(i,this.sourceToken);else t.sep.push(this.sourceToken);else if(!t.sep)Object.assign(t,{key:null,sep:[this.sourceToken]});else if(t.value||n)e.items.push({start:i,key:null,sep:[this.sourceToken]});else if(Be(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else t.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);if(n||t.value)e.items.push({start:i,key:o,sep:[]}),this.onKeyLine=!0;else if(t.sep)this.stack.push(o);else Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0;return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!Be(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(r)e.items.push({start:i});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let r="end"in t.value?t.value.end:void 0;if((Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment")r?.push(this.sourceToken);else e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Qn(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;if(t.value||Be(t.start,"seq-item-ind"))e.items.push({start:[this.sourceToken]});else t.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!t||t.sep)e.items.push({start:[this.sourceToken]});else t.start.push(this.sourceToken);return;case"map-value-ind":if(!t||t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!t||t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);if(!t||t.value)e.items.push({start:[],key:n,sep:[]});else if(t.sep)this.stack.push(n);else Object.assign(t,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);if(r)this.stack.push(r);else yield*this.pop(),yield*this.step()}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let n=Wn(r),i=Pt(n);Rd(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
|
|
138
141
|
`)+1;while(t!==0)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
139
|
-
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=
|
|
142
|
+
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=Wn(e),r=Pt(t);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Wn(e),r=Pt(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){if(this.type!=="comment")return!1;if(this.indent<=t)return!1;return e.every((r)=>r.type==="newline"||r.type==="space")}*documentEnd(e){if(this.type!=="doc-mode"){if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}Kx.Parser=xd});var Od=b(function(eI){var Id=Xo(),Gx=fr(),Sr=gr(),Yx=ao(),Jx=_(),Wx=cs(),Ed=ls();function Ad(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Wx.LineCounter||null,prettyErrors:t}}function Qx(e,t={}){let{lineCounter:r,prettyErrors:n}=Ad(t),i=new Ed.Parser(r?.addNewLine),o=new Id.Composer(t),s=Array.from(o.compose(i.parse(e)));if(n&&r)for(let a of s)a.errors.forEach(Sr.prettifyError(e,r)),a.warnings.forEach(Sr.prettifyError(e,r));if(s.length>0)return s;return Object.assign([],{empty:!0},o.streamInfo())}function Pd(e,t={}){let{lineCounter:r,prettyErrors:n}=Ad(t),i=new Ed.Parser(r?.addNewLine),o=new Id.Composer(t),s=null;for(let a of o.compose(i.parse(e),!0,e.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Sr.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(n&&r)s.errors.forEach(Sr.prettifyError(e,r)),s.warnings.forEach(Sr.prettifyError(e,r));return s}function Xx(e,t,r){let n=void 0;if(typeof t==="function")n=t;else if(r===void 0&&t&&typeof t==="object")r=t;let i=Pd(e,r);if(!i)return null;if(i.warnings.forEach((o)=>Yx.warn(i.options.logLevel,o)),i.errors.length>0)if(i.options.logLevel!=="silent")throw i.errors[0];else i.errors=[];return i.toJS(Object.assign({reviver:n},r))}function Zx(e,t,r){let n=null;if(typeof t==="function"||Array.isArray(t))n=t;else if(r===void 0&&t)r=t;if(typeof r==="string")r=r.length;if(typeof r==="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(e===void 0){let{keepUndefined:i}=r??t??{};if(!i)return}if(Jx.isDocument(e)&&!n)return e.toString(r);return new Gx.Document(e,n,r).toString(r)}eI.parse=Xx;eI.parseAllDocuments=Qx;eI.parseDocument=Pd;eI.stringify=Zx});var oI,sI,aI,us,cI,Ue,lI,uI,dI,pI,YN,fI,gI,mI,Xn,Dd,hI,yI,bI,SI,wI,kI,vI,RI,CI,xI,II,EI,AI,PI,OI,DI,TI,NI,LI,$I,_I,MI,Ot,jI,FI,qI,BI,UI;var Zn=X(()=>{oI=Xo(),sI=fr(),aI=_o(),us=gr(),cI=Zt(),Ue=_(),lI=Me(),uI=V(),dI=Fe(),pI=qe(),YN=Yn(),fI=as(),gI=cs(),mI=ls(),Xn=Od(),Dd=Qt();hI=oI.Composer,yI=sI.Document,bI=aI.Schema,SI=us.YAMLError,wI=us.YAMLParseError,kI=us.YAMLWarning,vI=cI.Alias,RI=Ue.isAlias,CI=Ue.isCollection,xI=Ue.isDocument,II=Ue.isMap,EI=Ue.isNode,AI=Ue.isPair,PI=Ue.isScalar,OI=Ue.isSeq,DI=lI.Pair,TI=uI.Scalar,NI=dI.YAMLMap,LI=pI.YAMLSeq,$I=fI.Lexer,_I=gI.LineCounter,MI=mI.Parser,Ot=Xn.parse,jI=Xn.parseAllDocuments,FI=Xn.parseDocument,qI=Xn.stringify,BI=Dd.visit,UI=Dd.visitAsync});function ei(e){return typeof e==="string"&&e.trim()?e.trim():void 0}function VI(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function it(e){let t=e.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);if(!t)return{meta:"",body:e.trim()};return{meta:(t[1]??"").trim(),body:(t[2]??"").trim()}}function wr(e){let{meta:t}=it(e);if(!t)throw Error("design-md file is missing YAML frontmatter");let r=Ot(t);if(!r||typeof r!=="object")throw Error("design-md frontmatter must be a YAML object");let n=typeof r.title==="string"?r.title.trim():"",i=typeof r.name==="string"?r.name.trim():"",o=n||i;if(!o)throw Error("design-md frontmatter must include a non-empty 'title' or 'name' field");let s=ei(r.id)??ei(r.slug)??VI(o);if(!s)throw Error("design-md frontmatter must include a non-empty 'id' field");let a={id:s,title:o,category:ei(r.category)??"general",tags:Array.isArray(r.tags)?r.tags:[],origin:typeof r.origin==="string"?r.origin:"local"};if(i)a.name=i;if(typeof r.version==="string"&&r.version.trim())a.version=r.version.trim();let c=ei(r.description);if(c)a.description=c;if(typeof r.sourceUrl==="string")a.sourceUrl=r.sourceUrl;if(Array.isArray(r.exemptRules)){let l=r.exemptRules.filter((u)=>typeof u==="string"&&u.trim().length>0);if(l.length>0)a.exemptRules=l.map((u)=>u.trim())}if(Array.isArray(r.extractedTokens))a.extractedTokens=r.extractedTokens;if(typeof r.layer==="string")if(Td.includes(r.layer))a.layer=r.layer;else console.warn(`[design-md] ignoring invalid layer "${r.layer}" on id="${a.id}"; expected one of ${Td.join("|")}`);return a}var Td;var kr=X(()=>{Zn();Td=["auto","user","override"]});function Ve(e){return e&&typeof e==="object"&&!Array.isArray(e)?e:{}}function ti(e){return Object.fromEntries(Object.entries(Ve(e)).flatMap(([t,r])=>typeof r==="string"||typeof r==="number"?[[t,String(r)]]:[]))}function Nd(e){return Array.isArray(e)?e.filter((t)=>typeof t==="string"&&t.trim().length>0):[]}function GI(e){return[...e.matchAll(/^```ya?ml[^\n]*\n([\s\S]*?)^```/gim)].map((t)=>t[1]??"")}function YI(e){let{meta:t,body:r}=it(e),n=[],i=[];for(let[o,s]of[t,...GI(r)].entries()){if(!s.trim())continue;let a;try{a=Ve(Ot(s))}catch(c){if(o===0)n.push({severity:"error",message:`frontmatter is not valid YAML: ${c.message}`});continue}if(o===0||Object.keys(a).some((c)=>Ld.has(c)))i.push(a)}return{sources:i,issues:n}}function JI(e){let t={};for(let[r,n]of Object.entries(Ve(e)))if(typeof n==="string")t[r]={fontFamily:n};else{let i={};for(let[o,s]of Object.entries(Ve(n)))if(zI.has(o)&&(typeof s==="string"||typeof s==="number"))i[o]=s;t[r]=i}return t}function ds(e){let{sources:t}=YI(e),r=Object.assign({},...t);if(!Object.keys(r).some((c)=>Ld.has(c)))return;let n={colors:ti(r.colors),typography:JI(r.typography),rounded:ti(r.rounded),spacing:Object.fromEntries(Object.entries(Ve(r.spacing)).flatMap(([c,l])=>typeof l==="string"||typeof l==="number"?[[c,l]]:[])),components:Object.fromEntries(Object.entries(Ve(r.components)).map(([c,l])=>[c,ti(l)]))},i=Object.fromEntries(Object.entries(Ve(r.themes)).map(([c,l])=>[c,ti(l)]));if(Object.keys(i).length)n.themes=i;let o=Ve(r.forbidden),s=Nd(o.colors),a=Nd(o.fonts);if(s.length||a.length)n.forbidden={colors:s,fonts:a};return n}var HI,KI,Ld,zI;var ps=X(()=>{Zn();kr();HI=["colors","typography","rounded","spacing","components"],KI=["themes","forbidden"],Ld=new Set([...HI,...KI]),zI=new Set(["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","fontFeature","fontVariation"])});function fs(e){let t=new Set,r=[];for(let{pattern:n,group:i}of WI){let o=new RegExp(n.source,n.flags),s;while((s=o.exec(e))!==null){let a=(s[1]??"").trim(),c=(s[2]??"").trim(),l=`${a}:${c}`;if(!t.has(l))t.add(l),r.push({name:a,value:c,group:i})}}return r}var WI;var gs=X(()=>{WI=[{pattern:/`?(--[\w-]+)`?\s*:\s*([#\w()%., ]+)/g,group:"css-var"},{pattern:/`?([\w-]+(?:Color|Bg|Text|Border|Shadow|Radius|Font|Size|Space))`?\s*[=:]\s*["']?([^"'\n,]+)["']?/gi,group:"token"}]});import{readFileSync as QI}from"node:fs";function vr(e){let t=QI(e,"utf-8"),{body:r}=it(t),n=wr(t),i=ds(t),o=n.extractedTokens??(i&&Object.keys(i.colors).length?Object.entries(i.colors).map(([a,c])=>({name:a,value:c,group:"color"})):fs(r)),s={id:n.id,title:n.title,category:n.category,tags:n.tags??[],origin:n.origin??"local",body:r,filePath:e};if(n.sourceUrl)s.sourceUrl=n.sourceUrl;if(n.description)s.description=n.description;if(i)s.tokens=i;if(n.exemptRules)s.exemptRules=n.exemptRules;if(n.layer)s.layer=n.layer;if(o.length>0)s.extractedTokens=o;return s}var Rr=X(()=>{kr();ps();gs()});var ms=X(()=>{Rr()});var hs=()=>{};var ys=()=>{};function ri(e){return`# ${e.trim()||"project"} DESIGN
|
|
140
143
|
|
|
141
144
|
Per-project visual contract. Owned by this consumer. UIBot house seeds
|
|
142
145
|
(\`frontend-principles\`, \`control-console\`) are generation defaults only;
|
|
@@ -162,17 +165,17 @@ are surface. Color is for state, not for the current-nav paint. Sentence case.
|
|
|
162
165
|
| warning | #92400E | #FCD34D | needs attention |
|
|
163
166
|
| danger | #B91C1C | #FCA5A5 | failure |
|
|
164
167
|
|
|
165
|
-
Do not paint selected nav with accent wash. Use a 4
|
|
168
|
+
Do not paint selected nav with accent wash. Use a 4–7% mix of text on surface.
|
|
166
169
|
|
|
167
170
|
## Typographic
|
|
168
171
|
|
|
169
172
|
System sans. Tabular numbers for counts. Ladder: 11 / 12 / 13 / 14 / 16 / 20.
|
|
170
|
-
Page title 20px. Body 14px. Helper
|
|
173
|
+
Page title 20px. Body 14px. Helper ≥ 12px. No marketing display serif.
|
|
171
174
|
|
|
172
175
|
## Component
|
|
173
176
|
|
|
174
177
|
- Nav: grouped labels, selected = surface mix, hover = lighter mix.
|
|
175
|
-
- Usage: quota / tasks / hourly as hairline layers. Unknown stays
|
|
178
|
+
- Usage: quota / tasks / hourly as hairline layers. Unknown stays 未知 / n/a.
|
|
176
179
|
Percent windows may use a 4px meter; omitted layers get no zero chart.
|
|
177
180
|
- Empty / loading / error are three states. Do not nest a dashed empty card
|
|
178
181
|
inside a layer card.
|
|
@@ -181,11 +184,11 @@ Page title 20px. Body 14px. Helper \u2265 12px. No marketing display serif.
|
|
|
181
184
|
## Layout
|
|
182
185
|
|
|
183
186
|
4px grid. Radius 3 / 4 / 6 / 8 / 12. Sider ~224px on shell. Content on canvas.
|
|
184
|
-
375 / 768 / 1440. Touch targets
|
|
187
|
+
375 / 768 / 1440. Touch targets ≥ 44px on 375.
|
|
185
188
|
|
|
186
189
|
## Motion
|
|
187
190
|
|
|
188
|
-
|
|
191
|
+
≤ 150ms on color and transform. Honor prefers-reduced-motion. No card fades.
|
|
189
192
|
|
|
190
193
|
## Anti-Pattern
|
|
191
194
|
|
|
@@ -193,7 +196,7 @@ Page title 20px. Body 14px. Helper \u2265 12px. No marketing display serif.
|
|
|
193
196
|
- No purple-gradient SaaS, ALL-CAPS chrome eyebrows, or emoji as icons.
|
|
194
197
|
- No unscoped \`html, body, *\` CSS. Scope tokens to the product root.
|
|
195
198
|
- No second design system beside this file.
|
|
196
|
-
`}var
|
|
199
|
+
`}var $d=X(()=>{Rr()});import{fileURLToPath as XI}from"node:url";import{existsSync as ZI,readdirSync as eE}from"node:fs";import{join as tE}from"node:path";function ni(e=_d){if(!ZI(e))return[];let t=[];for(let r of eE(e).sort()){if(r.startsWith("_")||!r.endsWith(".design.md"))continue;try{t.push(vr(tE(e,r)))}catch(n){console.warn(`[design-md] skipping seed ${r}: ${n.message}`)}}return t}var _d;var Md=X(()=>{Rr();_d=XI(new URL("../content",import.meta.url))});import{mkdirSync as jd,writeFileSync as rE}from"node:fs";import{dirname as nE,join as iE}from"node:path";async function Fd(e,t=globalThis.fetch){let r=e.trim(),n=oE.exec(r);if(n){let i=n[1],o=n[2],s=(n[3]??"").replace(/^\/+|\/+$/g,""),a=`https://api.github.com/repos/${i}/${o}/contents`+(s?`/${s}`:""),c=await t(a,{headers:{accept:"application/vnd.github+json","user-agent":"uibot-design-md-sync"}});if(!c.ok)throw Error(`Failed to list github:${i}/${o}${s?"/"+s:""} (HTTP ${c.status})`);let l=await c.json(),u=Array.isArray(l)?l:[l],d=[];for(let f of u){if(!f||typeof f!=="object")continue;let p=f;if(p.type==="file"&&p.name&&qd(p.name)&&p.download_url)d.push(p.download_url)}if(d.length===0)throw Error(`No *.design.md / design markdown files found at github:${i}/${o}`+(s?`/${s}`:""));return{kind:"github",label:`github:${i}/${o}${s?"/"+s:""}`,fileUrls:d}}if(/^https?:\/\//i.test(r))return{kind:"url",label:r,fileUrls:[r]};throw Error(`Unsupported --from value "${e}". Use github:owner/repo[/path] or an https:// URL.`)}function qd(e){let t=e.toLowerCase();return t.endsWith(".design.md")||t.endsWith(".md")&&!t.startsWith("readme")}function Bd(e,t){let{meta:r,body:n}=it(e);if(!r)return`---
|
|
197
200
|
sourceUrl: ${JSON.stringify(t.sourceUrl)}
|
|
198
201
|
license: ${JSON.stringify(t.license)}
|
|
199
202
|
---
|
|
@@ -203,12 +206,78 @@ ${i.join(`
|
|
|
203
206
|
---
|
|
204
207
|
${n?n+(n.endsWith(`
|
|
205
208
|
`)?"":`
|
|
206
|
-
`):""}`}async function
|
|
207
|
-
`)}function Pe(e){if(/^[\w.-]+$/.test(e))return e;return JSON.stringify(e)}var Bu=K(()=>{Yt()});var Rn=K(()=>{gi();Oo();To();Lo();Wt();Lu();Oo();$u();To();Lo();Do();Po();qu();Bu()});import{lstatSync as Dp,mkdirSync as Rs,readFileSync as Op,realpathSync as Tp,writeFileSync as Cs}from"fs";import{basename as Lp,dirname as zn,isAbsolute as Np,resolve as ue,sep as bs}from"path";function tr(e){let t=e.lockfilePath??"uibot.artifacts.lock.json",r=e.manifest.items??[],n=new Map;for(let s of r)n.set(s.name,s);if(e.lockfile===null)return{ok:!1,lockfilePath:t,registryName:e.manifest.name,lockCount:0,manifestCount:r.length,drifts:[{name:"*",kind:"missing-in-lock",detail:"lockfile missing or unreadable"}]};let i=[],o=new Set;for(let s of e.lockfile.artifacts??[]){o.add(s.name);let a=n.get(s.name);if(!a){i.push({name:s.name,kind:"missing-in-manifest",lockVersion:s.version,detail:`locked ${s.name}@${s.version} not present in registry manifest`});continue}let c=Ud(a);if(c&&c!==s.version)i.push({name:s.name,kind:"version-mismatch",lockVersion:s.version,manifestVersion:c,detail:`${s.name}: lock ${s.version} \u2260 registry ${c}`})}return{ok:i.length===0,lockfilePath:t,registryName:e.manifest.name,lockCount:(e.lockfile.artifacts??[]).length,manifestCount:r.length,drifts:i}}function Ud(e){return e.artifact?.version??e.version}import{readFileSync as Vd,realpathSync as os}from"fs";import{resolve as Ve,relative as Kd,dirname as Hd,extname as zd,sep as Mn}from"path";function Yd(e){if(e.endsWith(".css"))return"style";if(e.endsWith(".tsx")||e.endsWith(".jsx"))return"component";if(/(^|\/)use-[^/]+\.ts$/.test(e))return"hook";return"lib"}function _n(e){let t=e.readFile??((c)=>Vd(c,"utf8")),r=new Map,n=(c,l=Ve(e.sourceDir))=>{let d=Kd(l,Ve(c));if(d===".."||d.startsWith(`..${Mn}`)||d.startsWith(Mn))throw Error(`Block dependency outside sourceDir: ${c}`);return d.replaceAll(Mn,"/")},i=(c)=>{if(n(Ve(e.sourceDir,c)),!e.readFile)n(os(Ve(e.sourceDir,c)),os(e.sourceDir));let l=r.get(c);if(l!==void 0)return l;let d=t(Ve(e.sourceDir,c));return r.set(c,d),d},o=(c)=>{let l=new Map,d=(p)=>{if(l.has(p))return;let f=i(p);l.set(p,{path:p,type:Yd(p),content:f});let u=f.matchAll(/(?:\bfrom\s*|\bimport\s*)["'](\.[^"']+)["']/g);for(let m of u){let g=n(Ve(e.sourceDir,Hd(p),m[1]??"")),h=zd(g)?[g]:[`${g}.ts`,`${g}.tsx`,`${g}/index.ts`,`${g}/index.tsx`],b;for(let S of h)try{i(S),b=S;break}catch(k){if(k instanceof Error&&k.message.includes("outside sourceDir"))throw k}if(!b)throw Error(`Unresolved block dependency: ${p} -> ${m[1]}`);d(b)}};return d(c),[...l.values()]},s=(c)=>{let l=new Set;for(let d of c){if(typeof d.content!=="string")continue;for(let p of d.content.matchAll(/(?:\bfrom\s*|\bimport\s*)["']([^."'/][^"']*|@[^"']+)["']/g)){let f=p[1]??"";if(f.startsWith("node:"))continue;let u=f.startsWith("@")?f.split("/").slice(0,2).join("/"):f.split("/")[0]??"";if(u==="react"||u==="react-dom"||u.startsWith("@uibot/"))continue;l.add(u)}}return[...l].sort()},a=[];for(let c of Object.keys(e.catalog)){let l=e.blockFileMap[c];if(l===void 0)continue;let d=e.catalog[c];if(d===void 0)continue;let p=i(l),f=o(l),u=s(f);a.push({name:c,category:d.category,description:d.description,sourceCode:p,files:f,catalogEntry:d,...u.length>0?{dependencies:u}:{}})}return a}function ss(e){return e.flatMap((t)=>_n(t))}import{readdirSync as Gd,readFileSync as Wd,statSync as Jd}from"fs";import{basename as Qd,join as Xd}from"path";var Zd="0.1.0";function rr(e){let{dir:t}=e,r;try{r=Gd(t)}catch{return[]}let n=e.defaultVersion??Zd,i=e.defaultLevel??"L4",o=e.defaultCategory??"template",s=[];for(let a of r){if(!/\.ya?ml$/i.test(a))continue;let c=Xd(t,a);try{if(!Jd(c).isFile())continue}catch{continue}let l=Wd(c,"utf8");if(!l.trim())continue;let d=Qd(a).replace(/\.ya?ml$/i,""),p=ep(d),f=tp(d),u=rp(l)??`${f} template`;s.push({name:p,version:n,title:f,description:u,yaml:l,absolutePath:c,templateContract:{name:p,description:u,level:i,category:o,keywords:[p,d.toLowerCase(),"uibot-template",...e.extraKeywords??[]],composedFrom:np(l)}})}return s.sort((a,c)=>a.name.localeCompare(c.name))}function ft(e){let t=new Map;for(let r of e)for(let n of rr(r)){let i=t.get(n.name);if(i)throw Error(`duplicate template source name "${n.name}": ${i.absolutePath} and ${n.absolutePath}`);t.set(n.name,n)}return[...t.values()].sort((r,n)=>r.name.localeCompare(n.name))}function nr(e){return{kind:"template",name:e.name,version:e.version,files:[{path:`${e.name}.yaml`,type:"template",content:e.yaml,target:`${e.name}.yaml`}],templateContract:e.templateContract}}function Fn(e){return{name:e.name,kind:"template",title:e.title,description:e.description,artifact:nr(e)}}function ep(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-|-$/g,"").toLowerCase()}function tp(e){return e.replace(/[-_]+/g," ").replace(/\b\w/g,(t)=>t.toUpperCase())}function rp(e){return(e.match(/^\s*title:\s*["']?(.+?)["']?\s*$/m)??e.match(/^\s*-\s*id:.*\n\s*path:.*\n\s*title:\s*["']?(.+?)["']?\s*$/m))?.[1]?.trim()}function np(e){let t=new Set;for(let r of e.matchAll(/^\s*-\s*type:\s*["']?([^"'#\n]+?)["']?\s*$/gm)){let n=r[1]?.trim();if(n)t.add(n)}for(let r of e.matchAll(/^\s*template:\s*["']?([^"'#\n]+?)["']?\s*$/gm)){let n=r[1]?.trim();if(n)t.add(n)}return[...t].sort()}var ip="0.1.0";function op(e,t={}){return{kind:"component",name:e.name,version:t.defaultVersion??ip,runtime:t.runtime??"react",files:e.files,...e.dependencies?{dependencies:e.dependencies}:{},...e.registryDependencies?{registryDependencies:e.registryDependencies}:{},...e.catalogEntry.tags?{tags:e.catalogEntry.tags}:{},catalogEntry:e.catalogEntry}}function sp(e,t={}){return{name:e.name,kind:"component",title:e.catalogEntry.name,description:e.description??e.catalogEntry.description,artifact:op(e,t)}}function as(e,t){let r={...t.runtime?{runtime:t.runtime}:{},...t.defaultVersion?{defaultVersion:t.defaultVersion}:{}},n=e.map((o)=>sp(o,r)),i=(t.templates??[]).map((o)=>Fn(o));return{name:t.name,items:[...n,...i]}}var lp={spec:["html","markdown","zip"],prototype:["html","zip"],deck:["html","pptx","zip"],poster:["html","zip"]},rP=Array.from(new Set(Object.values(lp).flat()));var ir=["component","template","design-guide","example","skill","block","package","theme"],gt=["experimental","candidate","recommended"],cs=["declared","verified","external-consumer"],or=["missing","declared","verified","external-consumer"],sr=["source","license","contract","states","accessibility","light-theme","dark-theme","responsive","dependency-closure","packed-install","typecheck","browser"],Ke=Object.freeze([Object.freeze({name:"manifest",summary:"Describe query operations and list the derived resource index.",positionals:Object.freeze([]),options:Object.freeze([])}),Object.freeze({name:"search",summary:"Search resources with deterministic bilingual ranking and reasons.",positionals:Object.freeze([Object.freeze({name:"text",property:"text",type:"string",required:!1})]),options:Object.freeze([Object.freeze({name:"kind",property:"kinds",type:"resource-kind",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"tag",property:"tags",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"category",property:"categories",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"capability",property:"capabilities",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"maturity",property:"maturities",type:"resource-maturity",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"limit",property:"limit",type:"positive-integer"})])}),Object.freeze({name:"get",summary:"Resolve one canonical resource id or unambiguous alias.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([])}),Object.freeze({name:"build",summary:"Plan dependency closure and gaps without writing or installing.",positionals:Object.freeze([Object.freeze({name:"root",property:"roots",type:"string",required:!0,variadic:!0})]),options:Object.freeze([])}),Object.freeze({name:"docs",summary:"Read curated public documentation for one resource.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([{name:"locale",property:"locale",type:"string"},{name:"page",property:"page",type:"positive-integer"}])}),Object.freeze({name:"examples",summary:"Read one bounded page of examples and exact dependencies. Follow nextPage for complete source.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([{name:"page",property:"page",type:"positive-integer"}])}),Object.freeze({name:"install-plan",summary:"Describe distribution channels without installing or writing.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([])})]);var up=["background","foreground","card","card-foreground","popover","popover-foreground","primary","primary-foreground","secondary","secondary-foreground","muted","muted-foreground","accent","accent-foreground","border","input","ring","destructive","destructive-foreground","success","success-foreground","warning","warning-foreground"],aP=[...up,"radius","font-display","font-body","font-mono"];var gA=new Set(sr),mA=new Set(or);var dp=/^(unknown|unlicensed|none|n\/?a)$/i;function jn(e){let t=e?.trim();if(!t||dp.test(t))return;return t}var pp="uibot.resource.index.v1";class ze extends Error{code;detail;constructor(e,t){super(`${e}: ${t}`);this.code=e;this.detail=t;this.name="ResourceIndexError"}}function Y(e,t){return e<t?-1:e>t?1:0}function _(e){return e.normalize("NFKC").replace(/([\p{Lu}]+)([\p{Lu}][\p{Ll}])/gu,"$1 $2").replace(/([\p{Ll}\p{N}])([\p{Lu}])/gu,"$1 $2").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim().replace(/\s+/g," ")}function fp(e){let t=_(e).replace(/ /g,"-");if(!t)throw new ze("invalid-resource-source-id",e);return t}function ce(e,t){return`${e}:${fp(t)}`}function ar(e){let t=new Map;for(let r of e){let n=r?.trim();if(!n)continue;let i=_(n);if(!i||t.has(i))continue;t.set(i,n)}return[...t.entries()].sort(([r],[n])=>Y(r,n)).map(([,r])=>r)}function mt(e){return{level:"declared",maturity:"experimental",checks:{source:"declared",license:e?"declared":"missing",contract:"declared",states:"missing",accessibility:"missing","light-theme":"missing","dark-theme":"missing",responsive:"missing","dependency-closure":"missing","packed-install":"missing",typecheck:"missing",browser:"missing"},evidence:[]}}function gp(e){let t=jn(e.license);return{type:e.type,id:e.id,...e.version?{version:e.version}:{},...e.url?{url:e.url}:{},...t?{license:t}:{}}}function He(e){return{id:e.id,kind:e.kind,title:e.title,description:e.description,...e.category?{category:e.category}:{},tags:ar(e.tags),aliases:ar(e.aliases),capabilities:ar(e.capabilities),dependencies:[...new Set(e.dependencies)].sort(Y),source:gp(e.source),receipt:e.receipt}}function mp(e){return(e.body.split(/\r?\n/).map((r)=>r.replace(/^#+\s*/,"").trim()).find(Boolean)??e.title).slice(0,240)}function hp(e){return Object.freeze(e.tags),Object.freeze(e.aliases),Object.freeze(e.capabilities),Object.freeze(e.dependencies),Object.freeze(e.source),Object.freeze(e.receipt.checks),Object.freeze(e.receipt.evidence),Object.freeze(e.receipt),Object.freeze(e)}function yp(e){let t=new Map;for(let r of Object.keys(e).sort(Y)){let n=e[r];if(!n)continue;let i=ce("component",r);for(let o of ar([r,n.name])){let s=_(o),a=t.get(s)??[];if(!a.includes(i))a.push(i);t.set(s,a.sort(Y))}}return t}function bp(e,t,r){let n=r.get(_(e))??[];if(n.length===0)throw new ze("dangling-resource-dependency",`${t} -> ${ce("component",e)}`);if(n.length>1)throw new ze("ambiguous-resource-dependency",`${t} -> ${e}: ${n.join(",")}`);return n[0]}function Sp(e,t,r,n){let i=e.startsWith("template:")?e.slice(9):e;if(Object.hasOwn(n,i))return ce("template",i);return bp(e,t,r)}function ht(e,t,r){return jn(r?.[e]??t)}function ls(e){return Object.entries(e).filter(([,t])=>t.level==="L4").sort(([t],[r])=>Y(t,r)).map(([t,r])=>({id:`${t}-example`,title:`${r.name} Example`,description:r.description,category:r.category,tags:r.keywords,aliases:[`${t} example`,`${r.name} example`],capabilities:["example:template"],dependencies:[ce("template",t)]}))}function us(e){let t=e.components??{},r=e.templates??{},n=e.designGuides??[],i=e.examples??[],o=e.skills??[],s=e.licenses,a=yp(t),c=[];for(let u of Object.keys(t).sort(Y)){let m=t[u];if(!m)continue;let g=ce("component",u),h=ht(g,void 0,s);c.push(He({id:g,kind:"component",title:m.name,description:m.description,category:m.category,tags:m.tags??[],aliases:[u,m.name],capabilities:["catalog:component"],dependencies:[],source:{type:"catalog",id:u,...h?{license:h}:{}},receipt:mt(Boolean(h))}))}for(let u of Object.keys(r).sort(Y)){let m=r[u];if(!m)continue;let g=ce("template",u),h=ht(g,void 0,s);c.push(He({id:g,kind:"template",title:m.name,description:m.description,category:m.category,tags:m.keywords,aliases:[u,m.name],capabilities:[],dependencies:(m.composedFrom??[]).map((b)=>Sp(b,g,a,r)),source:{type:"template-contract",id:u,...h?{license:h}:{}},receipt:mt(Boolean(h))}))}for(let u of[...n].sort((m,g)=>Y(m.id,g.id))){let m=ce("design-guide",u.id),g=ht(m,void 0,s);c.push(He({id:m,kind:"design-guide",title:u.title,description:mp(u),category:u.category,tags:u.tags,aliases:[u.id,u.title],capabilities:["designMd:source"],dependencies:[],source:{type:"design-md",id:u.id,...u.sourceUrl?{url:u.sourceUrl}:{},...g?{license:g}:{}},receipt:mt(Boolean(g))}))}for(let u of[...i].sort((m,g)=>Y(m.id,g.id))){let m=ce("example",u.id),g=ht(m,u.license,s);c.push(He({id:m,kind:"example",title:u.title,description:u.description,...u.category?{category:u.category}:{},tags:u.tags??[],aliases:[u.id,u.title,...u.aliases??[]],capabilities:u.capabilities??[],dependencies:u.dependencies??[],source:{type:"example",id:u.id,...u.version?{version:u.version}:{},...u.sourceUrl?{url:u.sourceUrl}:{},...g?{license:g}:{}},receipt:mt(Boolean(g))}))}for(let u of[...o].sort((m,g)=>Y(m.id,g.id))){let m=ce("skill",u.id),g=ht(m,void 0,s);c.push(He({id:m,kind:"skill",title:u.title,description:u.description?.trim()||u.title,tags:[...u.tags??[],...u.triggers??[]],aliases:[u.id,u.title,...u.triggers??[]],capabilities:["skill:definition"],dependencies:[],source:{type:"skill",id:u.id,...u.version?{version:u.version}:{},...g?{license:g}:{}},receipt:mt(Boolean(g))}))}for(let u of e.additional??[])c.push(He(u));c.sort((u,m)=>Y(u.id,m.id));let l=new Set;for(let u of c){if(l.has(u.id))throw new ze("duplicate-resource-id",u.id);l.add(u.id)}for(let u of c)for(let m of u.dependencies)if(!l.has(m))throw new ze("dangling-resource-dependency",`${u.id} -> ${m}`);let d=new Map;for(let u of c)for(let m of u.aliases){let g=_(m);if(!g)continue;let h=d.get(g)??new Set;h.add(u.id),d.set(g,h)}let p=Object.freeze(Object.fromEntries([...d.entries()].sort(([u],[m])=>Y(u,m)).map(([u,m])=>[u,Object.freeze([...m].sort(Y))]))),f=Object.freeze(c.map(hp));return Object.freeze({schemaVersion:pp,resources:f,aliases:p})}var Rp=[["data table","data grid","datatable","table","\u8868\u683C","\u6570\u636E\u8868","\u6570\u636E\u8868\u683C"],["button","action button","\u6309\u94AE","\u64CD\u4F5C\u6309\u94AE"],["dashboard","admin dashboard","\u4EEA\u8868\u76D8","\u540E\u53F0","\u7BA1\u7406\u540E\u53F0"],["kanban","kanban board","\u770B\u677F","\u4EFB\u52A1\u770B\u677F"],["form","input form","\u8868\u5355","\u8F93\u5165\u8868\u5355"],["navigation","nav","sidebar","\u5BFC\u822A","\u4FA7\u8FB9\u680F"]],Cp=Object.freeze(Rp.map((e)=>Object.freeze([...e]))),ds=new Map;for(let e of Cp){let t=Object.freeze([...new Set(e.map(_).filter(Boolean))].sort());for(let r of t)ds.set(r,t)}function qn(e){let t=_(e);return ds.get(t)??Object.freeze([t])}class H extends Error{code;detail;constructor(e,t){super(`${e}: ${t}`);this.code=e;this.detail=t;this.name="ResourceQueryError"}}var Kn=Object.freeze({"exact-id":1000,"exact-title":900,alias:800,tag:600,capability:500,category:400,token:200,fuzzy:100}),kp=Object.freeze(Object.keys(Kn)),ps=new Map(kp.map((e,t)=>[e,t])),fs=new Map([["component",0],["template",1],["design-guide",2],["example",3],["skill",4]]);function G(e,t){return e<t?-1:e>t?1:0}function gs(e){return new Set((e??[]).map(_).filter(Boolean))}function Bn(e,t){let r=gs(t);if(r.size===0)return!0;let n=gs(e);return[...r].some((i)=>n.has(i))}function wp(e,t){if(t.kinds?.length&&!t.kinds.includes(e.kind))return!1;if(!Bn(e.tags,t.tags))return!1;if(!Bn(e.category?[e.category]:[],t.categories))return!1;if(!Bn(e.capabilities,t.capabilities))return!1;if(t.maturities?.length&&!t.maturities.includes(e.receipt.maturity))return!1;return!0}function xp(e){return Boolean(e.kinds?.length||e.tags?.length||e.categories?.length||e.capabilities?.length||e.maturities?.length)}function le(e,t,r,n=Kn[t]){if(e.some((i)=>i.code===t&&i.value===r))return;e.push({code:t,value:r,score:n})}function Un(e,t){return e.find((r)=>_(r)===t)}function Vn(e){return[e.id,e.title,...e.aliases,...e.tags,...e.category?[e.category]:[],...e.capabilities]}function vp(e,t,r){if(Math.abs(e.length-t.length)>r)return r+1;let n=Array.from({length:t.length+1},(i,o)=>o);for(let i=1;i<=e.length;i+=1){let o=[i],s=i;for(let a=1;a<=t.length;a+=1){let c=(n[a-1]??r+1)+(e[i-1]===t[a-1]?0:1),l=Math.min((n[a]??r+1)+1,(o[a-1]??r+1)+1,c);o.push(l),s=Math.min(s,l)}if(s>r)return r+1;n=o}return n[t.length]??r+1}function Ep(e,t){let r=_(t),n=[];if(_(e.id)===r)le(n,"exact-id",e.id);if(_(e.title)===r)le(n,"exact-title",e.title);let i=Un(e.aliases,r);if(i)le(n,"alias",i);let o=Un(e.tags,r);if(o)le(n,"tag",o);let s=Un(e.capabilities,r);if(s)le(n,"capability",s);if(e.category&&_(e.category)===r)le(n,"category",e.category);if(!i){let l=qn(r).filter((p)=>p!==r),d=new Set(Vn(e).map(_));if(l.some((p)=>d.has(p)))le(n,"alias",t.trim())}let a=r.split(" ").filter(Boolean),c=_(Vn(e).join(" "));if(a.length>0&&a.every((l)=>c.includes(l)))le(n,"token",t.trim());if(n.length===0&&r.length>=4){let l;for(let d of Vn(e)){let p=_(d);if(p.length<4)continue;let f=vp(r,p,2);if(f<=2&&(!l||f<l.distance||f===l.distance&&G(d,l.value)<0))l={value:d,distance:f}}if(l)le(n,"fuzzy",l.value,Kn.fuzzy-l.distance)}return n.sort((l,d)=>{if(l.score!==d.score)return d.score-l.score;return(ps.get(l.code)??99)-(ps.get(d.code)??99)||G(l.value,d.value)})}function ms(e,t,r){if(t.has(r))return[r];let n=_(r),i=e.aliases[n];if(i?.length)return[...i];let o=new Set;for(let s of qn(n))for(let a of e.aliases[s]??[])o.add(a);return[...o].sort(G)}function hs(e,t){return new H("resource-alias-ambiguous",`${e.trim()}: ${t.join(",")}`)}function cr(e){let t=new Map(e.resources.map((n)=>[n.id,n]));function r(n){let i=n.trim(),o=ms(e,t,i);if(o.length===0)throw new H("resource-not-found",i);if(o.length>1)throw hs(i,o);let s=o[0],a=s?t.get(s):void 0;if(!a)throw new H("resource-not-found",i);return a}return Object.freeze({manifest:()=>e,search(n){let i=n.text?.trim()??"";if(!i&&!xp(n))throw new H("resource-query-empty","text or filter is required");if(n.limit!==void 0&&(!Number.isInteger(n.limit)||n.limit<=0))throw new H("resource-query-invalid-limit",String(n.limit));let o=e.resources.filter((s)=>wp(s,n)).map((s)=>{let a=i?Ep(s,i):[];return{resource:s,score:a.reduce((c,l)=>c+l.score,0),reasons:a}}).filter((s)=>!i||s.reasons.length>0).sort((s,a)=>a.score-s.score||G(s.resource.id,a.resource.id));return n.limit===void 0?o:o.slice(0,n.limit)},get:r,build(n){if(n.length===0||n.every((f)=>!f.trim()))throw new H("resource-query-empty","at least one build root is required");let i=[],o=new Set;for(let f of n){let u=f.trim(),m=ms(e,t,u);if(m.length===0)i.push({id:u,reason:"missing-resource"});else if(m.length>1)throw hs(u,m);else{let g=m[0];if(g)o.add(g)}}let s=new Set,a=new Set,c=new Set,l=[],d=[],p=(f,u)=>{if(s.has(f))return;if(a.has(f)){i.push({id:f,...u?{requiredBy:u}:{},reason:"dependency-cycle"});return}let m=t.get(f);if(!m){i.push({id:f,...u?{requiredBy:u}:{},reason:"missing-resource"});return}a.add(f),c.add(f);let g=[...m.dependencies].sort((h,b)=>{let S=t.get(h),k=t.get(b);return(fs.get(S?.kind??"")??99)-(fs.get(k?.kind??"")??99)||G(h,b)});for(let h of g)d.push({from:f,to:h,relation:"depends-on"}),p(h,f);a.delete(f),s.add(f),l.push(f)};for(let f of[...o].sort(G))p(f);return{roots:[...o].sort(G),nodes:[...c].sort(G).map((f)=>{let u=t.get(f);if(!u)throw new H("resource-not-found",f);return{id:f,kind:u.kind,maturity:u.receipt.maturity}}),edges:d.sort((f,u)=>G(f.from,u.from)||G(f.to,u.to)),order:l,gaps:i.sort((f,u)=>G(f.id,u.id)||G(f.requiredBy??"",u.requiredBy??"")||G(f.reason,u.reason))}}})}function lr(e){if(!e||typeof e!=="object")throw Error("invalid-public-resource-bundle");Ap(e);let t=e;if(t.schemaVersion!=="uibot.public-resources.v1"||typeof t.release?.version!=="string"||!/^[a-f0-9]{64}$/.test(t.release?.sourceHash)||t.index?.schemaVersion!=="uibot.resource.index.v1"||!Array.isArray(t.index.resources)||!t.index.aliases||!t.showcases)throw Error("invalid-public-resource-bundle");if(t.documents&&(!Array.isArray(t.documents)||t.documents.some((n)=>typeof n.title!=="string"||typeof n.markdown!=="string"||!/^\/(?:en\/)?docs\/[a-z0-9-]+$/.test(n.path))))throw Error("invalid-public-documentation");let r=new Set;for(let n of t.index.resources){if(!n||typeof n.id!=="string"||r.has(n.id)||!ir.includes(n.kind)||!n.id.startsWith(`${n.kind}:`)||typeof n.description!=="string"||typeof n.title!=="string"||!Array.isArray(n.dependencies)||!n.source||!n.receipt||!Array.isArray(n.aliases)||!Array.isArray(n.tags)||!Array.isArray(n.capabilities)||![n.aliases,n.dependencies,n.tags,n.capabilities].every((o)=>o.every((s)=>typeof s==="string"&&s.length<=1000))||!["catalog","template-contract","design-md","example","skill","registry","package","theme"].includes(n.source.type)||typeof n.source.id!=="string"||!gt.includes(n.receipt.maturity)||!cs.includes(n.receipt.level)||!Array.isArray(n.receipt.evidence)||!n.receipt.evidence.every((o)=>typeof o==="string")||!sr.every((o)=>or.includes(n.receipt.checks?.[o])))throw Error("invalid-public-resource");r.add(n.id);let i=t.showcases[n.id];if(!i||i.resourceId!==n.id||typeof i.docs?.zh!=="string"||typeof i.docs?.en!=="string"||!Array.isArray(i.examples)||!Array.isArray(i.distributions))throw Error("invalid-resource-showcase");if(typeof i.title?.zh!=="string"||typeof i.title?.en!=="string"||i.examples.some((o)=>!o||typeof o.id!=="string"||typeof o.title!=="string"||typeof o.code!=="string"||!["spec","tsx","source"].includes(o.mode)||!["tsx","json","yaml","css","ts"].includes(o.language)||!Array.isArray(o.dependencies)||!o.dependencies.every((s)=>typeof s==="string"))||i.distributions.some((o)=>!o||!["spec","npm","shadcn"].includes(o.channel)||typeof o.name!=="string"||!/^[@a-zA-Z0-9._/-]+$/.test(o.name)||typeof o.version!=="string"||!["source","published"].includes(o.availability)))throw Error("invalid-resource-content")}for(let[n,i]of Object.entries(t.index.aliases))if(!n||!Array.isArray(i)||i.some((o)=>!r.has(o)))throw Error("invalid-public-resource-alias");if(Object.keys(t.showcases).some((n)=>!r.has(n)))throw Error("unexpected-public-resource-showcase");for(let n of t.index.resources)for(let i of n.dependencies)if(!r.has(i))throw Error("invalid-public-resource-dependency")}function Hn(e){lr(e),e=JSON.parse(JSON.stringify(e));let t=(i)=>{if(i&&typeof i==="object"){for(let o of Object.values(i))t(o);Object.freeze(i)}};t(e);let r=cr(e.index),n=(i)=>{let o=r.get(i),s=e.showcases[o.id];if(!s)throw new H("resource-not-found",o.id);return s};return Object.freeze({...r,docs(i,o="zh",s=1){if(o!=="zh"&&o!=="en")throw Error("unsupported-resource-locale");let a=n(i);return{resourceId:a.resourceId,locale:o,...Ip(a.docs[o],s),release:e.release}},examples(i,o=1){let s=n(i);return{resourceId:s.resourceId,...Pp(s.examples,o),release:e.release}},installPlan(i){let o=n(i);return{resourceId:o.resourceId,distributions:o.distributions,dependencies:r.build([o.resourceId]),release:e.release}}})}var he=24000;function ys(e,t){if(!Number.isSafeInteger(e)||e<1||e>Math.max(1,t))throw new H("resource-query-invalid-limit","page is outside the available range")}function Ip(e,t){let r=Math.max(1,Math.ceil(e.length/he));return ys(t,r),{markdown:e.slice((t-1)*he,t*he),page:t,totalPages:r,...t<r?{nextPage:t+1}:{}}}function Pp(e,t){let r=e.flatMap((n)=>Array.from({length:Math.max(1,Math.ceil(n.code.length/he))},(i,o)=>({...n,code:n.code.slice(o*he,(o+1)*he),codeOffset:o*he,codeLength:n.code.length,complete:n.code.length<=he})));return ys(t,r.length),{examples:r.slice(t-1,t),page:t,totalPages:r.length,...t<r.length?{nextPage:t+1}:{}}}function Ap(e){let t=0,r=0,n=new Set,i=(o,s)=>{if(++t>300000||s>64)throw Error("public-resource-budget-exceeded");if(typeof o==="string"){if(r+=new TextEncoder().encode(o).length,r>16777216)throw Error("public-resource-budget-exceeded")}else if(o&&typeof o==="object"){if(n.has(o))throw Error("invalid-public-resource-cycle");let a=Object.getPrototypeOf(o);if(!Array.isArray(o)&&a!==Object.prototype&&a!==null)throw Error("invalid-public-resource-object");n.add(o);for(let[c,l]of Object.entries(o))i(c,s+1),i(l,s+1);n.delete(o)}else if(o!==null&&typeof o!=="boolean"&&(typeof o!=="number"||!Number.isFinite(o)))throw Error("invalid-public-resource-json")};i(e,1)}function $p(e){if(!e.name)throw Error("Artifact registry manifest requires a name");return e}async function Mp(e,t){let r=await fetch(e,t?{headers:t}:{});if(!r.ok)throw Error(`Failed to fetch ${e}: ${r.status} ${r.statusText}`);return await r.json()}async function Yn(e,t){let r=e.endsWith("/registry.json")?e:`${e.replace(/\/$/,"")}/registry.json`,n=await Mp(r,t);return $p(n)}class Gn{options;id;priority;manifestPromise;constructor(e){this.options=e;this.id=e.id??e.registryUrl,this.priority=e.priority}getManifest(){return this.manifestPromise??=Yn(this.options.registryUrl,this.options.headers),this.manifestPromise}async get(e){return(await this.getManifest()).items.find((r)=>r.name===e)}}class Wn{sources;constructor(e){this.sources=e}async resolve(e){let t=[...this.sources].sort((r,n)=>r.priority-n.priority);for(let r of t){let n=await r.get(e);if(n)return n}return}}var _p="uibot.artifacts.lock.json";function Fp(e){return ue(e,"components","registry")}function jp(e){return ue(e,"templates","registry")}function qp(e,t){if(e.kind==="component")return ue(t.componentsDir??Fp(t.workspaceRoot));return ue(t.templatesDir??jp(t.workspaceRoot))}function Bp(e){return ue(e.workspaceRoot,e.lockfilePath??_p)}function Up(e){try{return JSON.parse(Op(e,"utf8"))}catch{return{version:1,artifacts:[]}}}function Vp(e,t){Rs(zn(e),{recursive:!0}),Cs(e,`${JSON.stringify(t,null,2)}
|
|
208
|
-
`,"utf8")}function Kp(e,t){return{version:1,artifacts:[...e.artifacts.filter((n)=>n.name!==t.name),t].sort((n,i)=>n.name.localeCompare(i.name))}}function Hp(e){if(e.kind==="component")return{components:{[e.name]:e.catalogEntry}};return{templates:{[e.name]:e.templateContract}}}class Oe extends Error{artifactName;offendingPath;baseDir;constructor(e,t,r){super(`Artifact "${e}" file path escapes workspace: "${t}" resolves outside "${r}"`);this.artifactName=e;this.offendingPath=t;this.baseDir=r;this.name="ArtifactContainmentError"}}function ks(e,t){let r=t.endsWith(bs)?t:t+bs;return e===t||e.startsWith(r)}function Ss(e){let t=ue(e),r=[];while(!0)try{return Dp(t),ue(Tp(t),...r)}catch(n){if(n.code!=="ENOENT")throw n;let i=zn(t);if(i===t)throw n;r.unshift(Lp(t)),t=i}}function ws(e,t,r,n){try{let i=Ss(t),o=Ss(e);if(!ks(o,i))throw new Oe(r,n,t)}catch(i){if(i instanceof Oe)throw i;throw new Oe(r,n,t)}}function de(e,t,r){if(e.includes("\x00"))throw new Oe(r,e,t);if(Np(e))throw new Oe(r,e,t);let n=ue(t,e);if(!ks(n,t))throw new Oe(r,e,t);return ws(n,t,r,e),n}function zp(e,t){let r=[];for(let n of e.files){let i=n.target??n.path;r.push(de(i,t,e.name))}return r}function ur(e,t){let r=ue(t.workspaceRoot),n=qp(e,t);ws(n,r,e.name,n);let i=de(e.name,n,e.name),o=zp(e,i),s=[];for(let p=0;p<e.files.length;p++){let f=e.files[p],u=o[p];Rs(zn(u),{recursive:!0}),Cs(u,f.content??"","utf8"),s.push(u)}let a={name:e.name,version:e.version,source:t.source??"registry",installedAt:new Date().toISOString()},c=Bp(t),l=Up(c),d=Kp(l,a);return Vp(c,d),{artifactLock:a,catalogPatch:Hp(e),writtenFiles:s}}var Yp={string:"value","positive-integer":"n","resource-kind":"kind","resource-maturity":"maturity"};function Gp(e){let t=e.positionals.map((n)=>{let i=`${n.name}${"variadic"in n&&n.variadic?"...":""}`;return n.required?`<${i}>`:`[${i}]`}),r=e.options.map((n)=>`[--${n.name} <${Yp[n.type]}${"cliEncoding"in n&&n.cliEncoding==="comma-separated"?",...":""}>]`);return[e.name,...t,...r,"[--mode <text|json>]","[--dense]"].join(" ")}var Wp=Ke.map((e)=>({name:e.name,usage:Gp(e),summary:e.summary,group:"resources"})),Jp=[...Wp,{name:"list",usage:"list [--registry <url>]",summary:"List installable artifact registry entries.",group:"artifacts"},{name:"add",usage:"add <name> [--registry <url>] [--cwd <dir>]",summary:"Install an artifact and its registry dependencies.",group:"artifacts"},{name:"publish",usage:"publish [--out <dir>] [--name <manifest-name>]",summary:"Publish the built-in artifact registry to a directory.",group:"artifacts"},{name:"design-md sync",usage:"design-md sync --from <github:owner/repo|https-url> [--cwd <dir>] [--mode json]",summary:"Pull remote design-md with source and license stamps.",group:"design"},{name:"regressions reverify",usage:"regressions reverify [--cwd <dir>] [--skill <id>] [--mode json]",summary:"Re-run resolved regressions and reactivate failures.",group:"skills"},{name:"skills promote",usage:"skills promote <id> [--cwd <dir>] [--mode json]",summary:"Mark a skill promoted and append its usage receipt.",group:"skills"},{name:"skills rollback",usage:"skills rollback <id> [--cwd <dir>] [--mode json]",summary:"Roll back a promoted skill marker with a usage receipt.",group:"skills"},{name:"project export",usage:"project export <dir> [--cwd <dir>] [--mode json]",summary:"Copy project-local .uibot state to a directory.",group:"project"},{name:"link",usage:"link --spec-dir <relative-dir> [--source-dir <dir>] [--cwd <dir>] [--force] [--mode json]",summary:"Register consumer Spec dir + digest pin (L2 Linked).",group:"linked"},{name:"sync push",usage:"sync push [--from <dir>] [--cwd <dir>] [--mode json]",summary:"Copy YAML Spec + lock digest from sourceDir into consumer.",group:"linked"},{name:"sync pull",usage:"sync pull [--to <dir>] [--cwd <dir>] [--mode json]",summary:"Copy YAML Spec from consumer back to sourceDir.",group:"linked"},{name:"doctor",usage:"doctor [--cwd <dir>] [--registry <url>] [--mode json]",summary:"Compare the artifact lockfile with its registry.",group:"diagnostics"},{name:"init",usage:"init <dir> [--template <name>] | init --into <existing-app> [--force] [--mode json]",summary:"Scaffold a project, or L1 Embed recipe into an existing app.",group:"project"}],xs=Object.freeze(Jp.map((e)=>Object.freeze(e))),Qp=["--mode <text|json> Structured output mode for resource commands.","--dense Compact resource payloads without changing ids/order/codes.","--source <url> Query an explicit versioned public resource bundle (HTTPS or loopback).","--registry <url> Artifact registry base URL.","--cwd <dir> Workspace root (default: cwd).","--out <dir> Output directory for publish.","--from <src> Remote source for design-md sync, or local Spec source for sync push.","--to <dir> Local Spec destination for sync pull.","--spec-dir <dir> Relative consumer Spec directory for link.","--source-dir <dir> Local studio/CP Spec directory recorded by link.","--control-plane-url <url> Hosted CP base URL for remote Spec sync (no secrets).","--project-id <id> Remote Spec project id (default: default).","--force Overwrite existing .uibot/link.json or init --into files.","--into <dir> Existing app root for L1 Embed scaffold (requires package.json).","--spec-path <rel> Relative Spec YAML path for init --into (default: src/pages/home.uibot.yaml).","--mount-path <rel> Relative mount snippet path for init --into.","--template <name> Template name for greenfield init."];function Jn(){let e=xs.map((n)=>` uibot ${n.usage}`).join(`
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
`);
|
|
209
|
+
`):""}`}async function Ss(e){let t=e.fetchImpl??globalThis.fetch,r=e.defaultLicense??"UNKNOWN",n=[],i=0,o=0,s;try{s=await Fd(e.from,t)}catch(a){return{ok:!1,written:0,skipped:0,files:[],error:a instanceof Error?a.message:String(a)}}if(!e.dryRun)jd(e.outDir,{recursive:!0});for(let a of s.fileUrls){let c;try{let m=await t(a,{headers:{"user-agent":"uibot-design-md-sync"}});if(!m.ok){o+=1,n.push({id:a,path:"",sourceUrl:a,status:"skipped",reason:`HTTP ${m.status}`});continue}c=await m.text()}catch(m){return{ok:!1,written:i,skipped:o,files:n,error:`Network failure fetching ${a}: ${m instanceof Error?m.message:String(m)}`}}let l=new TextEncoder().encode(c).byteLength;if(l>bs){o+=1,n.push({id:a,path:"",sourceUrl:a,status:"skipped",reason:`exceeds ${bs} bytes (${l})`});continue}let u=Bd(c,{sourceUrl:a,license:r}),d;try{d=wr(u).id}catch(m){o+=1,n.push({id:a,path:"",sourceUrl:a,status:"skipped",reason:m instanceof Error?m.message:"invalid frontmatter"});continue}let f=`${d}.design.md`,p=iE(e.outDir,f);if(e.dryRun){n.push({id:d,path:p,sourceUrl:a,status:"dry-run"}),i+=1;continue}jd(nE(p),{recursive:!0}),rE(p,u,"utf8"),i+=1,n.push({id:d,path:p,sourceUrl:a,status:"written"})}return{ok:!0,written:i,skipped:o,files:n}}var bs=65536,oE;var Ud=X(()=>{kr();oE=/^github:([^/]+)\/([^/@]+)(?:\/(.+))?$/i});function ws(e){let t=["---"];if(t.push(`id: ${He(e.id)}`),t.push(`title: ${He(e.title)}`),t.push(`category: ${He(e.category)}`),e.tags?.length)t.push(`tags: [${e.tags.map((r)=>He(r)).join(", ")}]`);if(e.origin)t.push(`origin: ${He(e.origin)}`);if(e.sourceUrl)t.push(`sourceUrl: ${He(e.sourceUrl)}`);if(e.exemptRules?.length)t.push(`exemptRules: [${e.exemptRules.map((r)=>He(r)).join(", ")}]`);if(e.layer)t.push(`layer: ${He(e.layer)}`);return t.push("---"),t.push(""),t.push(e.body?.trimEnd()??""),t.push(""),t.join(`
|
|
210
|
+
`)}function He(e){if(/^[\w.-]+$/.test(e))return e;return JSON.stringify(e)}var Vd=X(()=>{kr()});var ii=X(()=>{Xi();ms();hs();ys();Rr();$d();ms();Md();hs();ys();gs();ps();Ud();Vd()});import{lstatSync as dg,mkdirSync as va,readFileSync as pg,realpathSync as fg,writeFileSync as Ra}from"node:fs";import{basename as gg,dirname as Ti,isAbsolute as mg,resolve as Ae,sep as wa}from"node:path";function Dr(e){let t=e.lockfilePath??"uibot.artifacts.lock.json",r=e.manifest.items??[],n=new Map;for(let s of r)n.set(s.name,s);if(e.lockfile===null)return{ok:!1,lockfilePath:t,registryName:e.manifest.name,lockCount:0,manifestCount:r.length,drifts:[{name:"*",kind:"missing-in-lock",detail:"lockfile missing or unreadable"}]};let i=[],o=new Set;for(let s of e.lockfile.artifacts??[]){o.add(s.name);let a=n.get(s.name);if(!a){i.push({name:s.name,kind:"missing-in-manifest",lockVersion:s.version,detail:`locked ${s.name}@${s.version} not present in registry manifest`});continue}let c=mf(a);if(c&&c!==s.version)i.push({name:s.name,kind:"version-mismatch",lockVersion:s.version,manifestVersion:c,detail:`${s.name}: lock ${s.version} ≠ registry ${c}`})}return{ok:i.length===0,lockfilePath:t,registryName:e.manifest.name,lockCount:(e.lockfile.artifacts??[]).length,manifestCount:r.length,drifts:i}}function mf(e){return e.artifact?.version??e.version}import{readFileSync as hf,realpathSync as ea}from"node:fs";import{resolve as ct,relative as yf,dirname as bf,extname as Sf,sep as ki}from"node:path";function wf(e){if(e.endsWith(".css"))return"style";if(e.endsWith(".tsx")||e.endsWith(".jsx"))return"component";if(/(^|\/)use-[^/]+\.ts$/.test(e))return"hook";return"lib"}function vi(e){let t=e.readFile??((c)=>hf(c,"utf8")),r=new Map,n=(c,l=ct(e.sourceDir))=>{let u=yf(l,ct(c));if(u===".."||u.startsWith(`..${ki}`)||u.startsWith(ki))throw Error(`Block dependency outside sourceDir: ${c}`);return u.replaceAll(ki,"/")},i=(c)=>{if(n(ct(e.sourceDir,c)),!e.readFile)n(ea(ct(e.sourceDir,c)),ea(e.sourceDir));let l=r.get(c);if(l!==void 0)return l;let u=t(ct(e.sourceDir,c));return r.set(c,u),u},o=(c)=>{let l=new Map,u=(d)=>{if(l.has(d))return;let f=i(d);l.set(d,{path:d,type:wf(d),content:f});let p=f.matchAll(/(?:\bfrom\s*|\bimport\s*)["'](\.[^"']+)["']/g);for(let m of p){let g=n(ct(e.sourceDir,bf(d),m[1]??"")),h=Sf(g)?[g]:[`${g}.ts`,`${g}.tsx`,`${g}/index.ts`,`${g}/index.tsx`],y;for(let S of h)try{i(S),y=S;break}catch(k){if(k instanceof Error&&k.message.includes("outside sourceDir"))throw k}if(!y)throw Error(`Unresolved block dependency: ${d} -> ${m[1]}`);u(y)}};return u(c),[...l.values()]},s=(c)=>{let l=new Set;for(let u of c){if(typeof u.content!=="string")continue;for(let d of u.content.matchAll(/(?:\bfrom\s*|\bimport\s*)["']([^."'/][^"']*|@[^"']+)["']/g)){let f=d[1]??"";if(f.startsWith("node:"))continue;let p=f.startsWith("@")?f.split("/").slice(0,2).join("/"):f.split("/")[0]??"";if(p==="react"||p==="react-dom"||p.startsWith("@uibot/"))continue;l.add(p)}}return[...l].sort()},a=[];for(let c of Object.keys(e.catalog)){let l=e.blockFileMap[c];if(l===void 0)continue;let u=e.catalog[c];if(u===void 0)continue;let d=i(l),f=o(l),p=s(f);a.push({name:c,category:u.category,description:u.description,sourceCode:d,files:f,catalogEntry:u,...p.length>0?{dependencies:p}:{}})}return a}function ta(e){return e.flatMap((t)=>vi(t))}import{readdirSync as kf,readFileSync as vf,statSync as Rf}from"node:fs";import{basename as Cf,join as xf}from"node:path";var If="0.1.0";function Tr(e){let{dir:t}=e,r;try{r=kf(t)}catch{return[]}let n=e.defaultVersion??If,i=e.defaultLevel??"L4",o=e.defaultCategory??"template",s=[];for(let a of r){if(!/\.ya?ml$/i.test(a))continue;let c=xf(t,a);try{if(!Rf(c).isFile())continue}catch{continue}let l=vf(c,"utf8");if(!l.trim())continue;let u=Cf(a).replace(/\.ya?ml$/i,""),d=Ef(u),f=Af(u),p=Pf(l)??`${f} template`;s.push({name:d,version:n,title:f,description:p,yaml:l,absolutePath:c,templateContract:{name:d,description:p,level:i,category:o,keywords:[d,u.toLowerCase(),"uibot-template",...e.extraKeywords??[]],composedFrom:Of(l)}})}return s.sort((a,c)=>a.name.localeCompare(c.name))}function Ft(e){let t=new Map;for(let r of e)for(let n of Tr(r)){let i=t.get(n.name);if(i)throw Error(`duplicate template source name "${n.name}": ${i.absolutePath} and ${n.absolutePath}`);t.set(n.name,n)}return[...t.values()].sort((r,n)=>r.name.localeCompare(n.name))}function Nr(e){return{kind:"template",name:e.name,version:e.version,files:[{path:`${e.name}.yaml`,type:"template",content:e.yaml,target:`${e.name}.yaml`}],templateContract:e.templateContract}}function Ri(e){return{name:e.name,kind:"template",title:e.title,description:e.description,artifact:Nr(e)}}function Ef(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-|-$/g,"").toLowerCase()}function Af(e){return e.replace(/[-_]+/g," ").replace(/\b\w/g,(t)=>t.toUpperCase())}function Pf(e){return(e.match(/^\s*title:\s*["']?(.+?)["']?\s*$/m)??e.match(/^\s*-\s*id:.*\n\s*path:.*\n\s*title:\s*["']?(.+?)["']?\s*$/m))?.[1]?.trim()}function Of(e){let t=new Set;for(let r of e.matchAll(/^\s*-\s*type:\s*["']?([^"'#\n]+?)["']?\s*$/gm)){let n=r[1]?.trim();if(n)t.add(n)}for(let r of e.matchAll(/^\s*template:\s*["']?([^"'#\n]+?)["']?\s*$/gm)){let n=r[1]?.trim();if(n)t.add(n)}return[...t].sort()}var Df="0.1.0";function Tf(e,t={}){return{kind:"component",name:e.name,version:t.defaultVersion??Df,runtime:t.runtime??"react",files:e.files,...e.dependencies?{dependencies:e.dependencies}:{},...e.registryDependencies?{registryDependencies:e.registryDependencies}:{},...e.catalogEntry.tags?{tags:e.catalogEntry.tags}:{},catalogEntry:e.catalogEntry}}function Nf(e,t={}){return{name:e.name,kind:"component",title:e.catalogEntry.name,description:e.description??e.catalogEntry.description,artifact:Tf(e,t)}}function ra(e,t){let r={...t.runtime?{runtime:t.runtime}:{},...t.defaultVersion?{defaultVersion:t.defaultVersion}:{}},n=e.map((o)=>Nf(o,r)),i=(t.templates??[]).map((o)=>Ri(o));return{name:t.name,items:[...n,...i]}}var _f={spec:["html","markdown","zip"],prototype:["html","zip"],deck:["html","pptx","zip"],poster:["html","zip"]},u0=Array.from(new Set(Object.values(_f).flat()));var Lr=["component","template","design-guide","example","skill","block","package","theme"],qt=["experimental","candidate","recommended"],na=["declared","verified","external-consumer"],$r=["missing","declared","verified","external-consumer"],_r=["source","license","contract","states","accessibility","light-theme","dark-theme","responsive","dependency-closure","packed-install","typecheck","browser"],lt=Object.freeze([Object.freeze({name:"manifest",summary:"Describe query operations and list the derived resource index.",positionals:Object.freeze([]),options:Object.freeze([])}),Object.freeze({name:"search",summary:"Search resources with deterministic bilingual ranking and reasons.",positionals:Object.freeze([Object.freeze({name:"text",property:"text",type:"string",required:!1})]),options:Object.freeze([...[["function","functions"],["scenario","scenarios"],["unit","units"],["industry","industries"]].map(([e,t])=>Object.freeze({name:e,property:t,type:"string",multiple:!0,cliEncoding:"comma-separated"})),Object.freeze({name:"kind",property:"kinds",type:"resource-kind",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"tag",property:"tags",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"category",property:"categories",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"capability",property:"capabilities",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"maturity",property:"maturities",type:"resource-maturity",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"limit",property:"limit",type:"positive-integer"})])}),Object.freeze({name:"get",summary:"Resolve one canonical resource id or unambiguous alias.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([])}),Object.freeze({name:"build",summary:"Plan dependency closure and gaps without writing or installing.",positionals:Object.freeze([Object.freeze({name:"root",property:"roots",type:"string",required:!0,variadic:!0})]),options:Object.freeze([])}),Object.freeze({name:"docs",summary:"Read curated public documentation for one resource.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([{name:"locale",property:"locale",type:"string"},{name:"page",property:"page",type:"positive-integer"}])}),Object.freeze({name:"examples",summary:"Read one bounded page of examples and exact dependencies. Follow nextPage for complete source.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([{name:"page",property:"page",type:"positive-integer"}])}),Object.freeze({name:"install-plan",summary:"Describe distribution channels and fixed snapshot identity/closure without installing or writing.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([])})]);var Mf=["background","foreground","card","card-foreground","popover","popover-foreground","primary","primary-foreground","secondary","secondary-foreground","muted","muted-foreground","accent","accent-foreground","border","input","ring","destructive","destructive-foreground","success","success-foreground","warning","warning-foreground"],m0=[...Mf,"radius","font-display","font-body","font-mono"];var jf=/^[A-Za-z0-9_-]{1,100}$/;function Mr(e){if(typeof e!=="string"||!jf.test(e))throw Error("Invalid application identity")}function oa(e){return Mr(e),{projectId:`app-${e}`,artifactId:`app-${e}`}}function xe(e){for(let t of[e.projectId,e.artifactId])if(!/^[A-Za-z0-9_-]{1,128}$/.test(t))throw Error("Invalid application identity");return`/apps/${e.projectId}/${e.artifactId}`}function ia(e){return typeof e==="string"&&e.length<=256&&/^\/(?:[A-Za-z0-9_-]+(?:\/[A-Za-z0-9_-]+)*)?$/.test(e)}function ut(e,t,r=!1){if(typeof e!=="string"||e.length>t||!r&&!e.trim())throw Error("Invalid application document");return e}function Ie(e){if(!e||typeof e!=="object"||Array.isArray(e))throw Error("Invalid application document");let t=e;if(Object.keys(t).some((o)=>!["contract","title","entryPath","spec","css","designMd","tsx"].includes(o)))throw Error("Unknown application field");if(t.contract!=="uibot.app.v1"||!ia(t.entryPath)||!Array.isArray(t.tsx)||t.tsx.length>32)throw Error("Invalid application manifest");let r=new Set,n=new Set,i={contract:"uibot.app.v1",title:ut(t.title,200),entryPath:t.entryPath,spec:ut(t.spec,2000000),css:ut(t.css,128000,!0),designMd:ut(t.designMd,128000,!0),tsx:t.tsx.map((o)=>{if(!o||Object.keys(o).some((s)=>!["id","path","title","source"].includes(s)))throw Error("Unknown TSX module field");if(Mr(o.id),o.id==="spec"||!ia(o.path)||r.has(o.id)||n.has(o.path))throw Error("Duplicate or invalid TSX route");return r.add(o.id),n.add(o.path),{id:o.id,path:o.path,title:ut(o.title,200),source:ut(o.source,1e5)}})};if(JSON.stringify(i).length>2000000)throw Error("Application document exceeds budget");return i}function he(e){return JSON.stringify(Ie(e))}function sa(e){if(!e||typeof e!=="object")throw Error("Invalid application snapshot");let t=e;if(xe(t),t.contract!=="uibot.linked-app.v1"||!/^[A-Za-z0-9_-]{1,128}$/.test(t.revisionId)||!Number.isSafeInteger(t.revisionNumber)||t.revisionNumber<1||typeof t.sourceHash!=="string"||!/^[a-f0-9]{64}$/.test(t.sourceHash))throw Error("Invalid application revision");return{contract:"uibot.linked-app.v1",projectId:t.projectId,artifactId:t.artifactId,revisionId:t.revisionId,revisionNumber:t.revisionNumber,sourceHash:t.sourceHash,document:Ie(t.document)}}function jr(e){if(typeof e!=="string"||!/^[A-Za-z0-9_-]{1,128}$/.test(e))throw Error("Invalid release identity")}function Ff(e){if(!e||typeof e!=="object")throw Error("Invalid application release");let t=e;if(jr(t.releaseId),jr(t.revisionId),Mr(t.operationId),!Number.isSafeInteger(t.releaseSequence)||t.releaseSequence<1||typeof t.sourceHash!=="string"||!/^[a-f0-9]{64}$/.test(t.sourceHash)||typeof t.publishedAt!=="string"||t.publishedAt.length>128||!Number.isFinite(Date.parse(t.publishedAt))||typeof t.publishedBy!=="string"||!t.publishedBy||t.publishedBy.length>128)throw Error("Invalid application release");return{releaseId:t.releaseId,releaseSequence:t.releaseSequence,revisionId:t.revisionId,sourceHash:t.sourceHash,operationId:t.operationId,publishedAt:t.publishedAt,publishedBy:t.publishedBy}}function aa(e){if(!e||typeof e!=="object")throw Error("Invalid published application");let t=e;if(jr(t.projectId),jr(t.artifactId),xe(t),t.contract!=="uibot.linked-app-release.v1"||t.channel!=="production")throw Error("Invalid published application");let r={contract:t.contract,projectId:t.projectId,artifactId:t.artifactId,channel:t.channel};if(t.published===!1){if("document"in t)throw Error("Unpublished application contains a document");return{...r,published:!1}}if(t.published!==!0)throw Error("Invalid publication state");return{...r,...Ff(t),published:!0,document:Ie(t.document)}}function Ci(e){if(e.length>2048)throw Error("Application backend origin is too long");let t=new URL(e);if(t.username||t.password||t.search||t.hash||t.pathname!=="/"||t.protocol!=="https:"&&!(t.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(t.hostname)))throw Error("Application backend must be HTTPS or loopback, with no path or credentials");return t.origin}function dt(e){if(!e||typeof e!=="object"||Array.isArray(e))throw Error("Invalid application connection");let t=e,r=["contract","origin","projectId","artifactId","path","intervalMs"];if(Object.keys(t).some((n)=>!r.includes(n))||t.contract!=="uibot.linked-app.connection.v1"||typeof t.origin!=="string"||typeof t.projectId!=="string"||typeof t.artifactId!=="string"||!Number.isSafeInteger(t.intervalMs)||t.intervalMs<250||t.intervalMs>60000||t.path!==`/api/studio/creation${xe(t)}/live`)throw Error("Invalid application connection; credentials and custom paths are not allowed");return{contract:t.contract,origin:Ci(t.origin),projectId:t.projectId,artifactId:t.artifactId,path:t.path,intervalMs:t.intervalMs}}var zO=new Set(_r),GO=new Set($r);var qf=/^(unknown|unlicensed|none|n\/?a)$/i;function xi(e){let t=e?.trim();if(!t||qf.test(t))return;return t}var Bf="uibot.resource.index.v1";class ft extends Error{code;detail;constructor(e,t){super(`${e}: ${t}`);this.code=e;this.detail=t;this.name="ResourceIndexError"}}function re(e,t){return e<t?-1:e>t?1:0}function H(e){return e.normalize("NFKC").replace(/([\p{Lu}]+)([\p{Lu}][\p{Ll}])/gu,"$1 $2").replace(/([\p{Ll}\p{N}])([\p{Lu}])/gu,"$1 $2").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim().replace(/\s+/g," ")}function Uf(e){let t=H(e).replace(/ /g,"-");if(!t)throw new ft("invalid-resource-source-id",e);return t}function Ee(e,t){return`${e}:${Uf(t)}`}function Fr(e){let t=new Map;for(let r of e){let n=r?.trim();if(!n)continue;let i=H(n);if(!i||t.has(i))continue;t.set(i,n)}return[...t.entries()].sort(([r],[n])=>re(r,n)).map(([,r])=>r)}function Bt(e){return{level:"declared",maturity:"experimental",checks:{source:"declared",license:e?"declared":"missing",contract:"declared",states:"missing",accessibility:"missing","light-theme":"missing","dark-theme":"missing",responsive:"missing","dependency-closure":"missing","packed-install":"missing",typecheck:"missing",browser:"missing"},evidence:[]}}function Vf(e){let t=xi(e.license);return{type:e.type,id:e.id,...e.version?{version:e.version}:{},...e.sourceHash?{sourceHash:e.sourceHash}:{},...e.packageName?{packageName:e.packageName}:{},...e.url?{url:e.url}:{},...t?{license:t}:{}}}function pt(e){return{id:e.id,kind:e.kind,title:e.title,description:e.description,...e.category?{category:e.category}:{},tags:Fr(e.tags),aliases:Fr(e.aliases),capabilities:Fr(e.capabilities),dependencies:[...new Set(e.dependencies)].sort(re),source:Vf(e.source),receipt:e.receipt,...e.solution?{solution:structuredClone(e.solution)}:{}}}function Hf(e){return(e.body.split(/\r?\n/).map((r)=>r.replace(/^#+\s*/,"").trim()).find(Boolean)??e.title).slice(0,240)}function Kf(e){if(e.solution){let t=(r)=>{if(r&&typeof r==="object"){for(let n of Object.values(r))t(n);Object.freeze(r)}};t(e.solution)}return Object.freeze(e.tags),Object.freeze(e.aliases),Object.freeze(e.capabilities),Object.freeze(e.dependencies),Object.freeze(e.source),Object.freeze(e.receipt.checks),Object.freeze(e.receipt.evidence),Object.freeze(e.receipt),Object.freeze(e)}function zf(e){let t=new Map;for(let r of Object.keys(e).sort(re)){let n=e[r];if(!n)continue;let i=Ee("component",r);for(let o of Fr([r,n.name])){let s=H(o),a=t.get(s)??[];if(!a.includes(i))a.push(i);t.set(s,a.sort(re))}}return t}function Gf(e,t,r){let n=r.get(H(e))??[];if(n.length===0)throw new ft("dangling-resource-dependency",`${t} -> ${Ee("component",e)}`);if(n.length>1)throw new ft("ambiguous-resource-dependency",`${t} -> ${e}: ${n.join(",")}`);return n[0]}function Yf(e,t,r,n){let i=e.startsWith("template:")?e.slice(9):e;if(Object.hasOwn(n,i))return Ee("template",i);return Gf(e,t,r)}function Ut(e,t,r){return xi(r?.[e]??t)}function ca(e){return Object.entries(e).filter(([,t])=>t.level==="L4").sort(([t],[r])=>re(t,r)).map(([t,r])=>({id:`${t}-example`,title:`${r.name} Example`,description:r.description,category:r.category,tags:r.keywords,aliases:[`${t} example`,`${r.name} example`],capabilities:["example:template"],dependencies:[Ee("template",t)]}))}function la(e){let t=e.components??{},r=e.templates??{},n=e.designGuides??[],i=e.examples??[],o=e.skills??[],s=e.licenses,a=zf(t),c=[];for(let p of Object.keys(t).sort(re)){let m=t[p];if(!m)continue;let g=Ee("component",p),h=Ut(g,void 0,s);c.push(pt({id:g,kind:"component",title:m.name,description:m.description,category:m.category,tags:m.tags??[],aliases:[p,m.name],capabilities:["catalog:component"],dependencies:[],source:{type:"catalog",id:p,...h?{license:h}:{}},receipt:Bt(Boolean(h))}))}for(let p of Object.keys(r).sort(re)){let m=r[p];if(!m)continue;let g=Ee("template",p),h=Ut(g,void 0,s);c.push(pt({id:g,kind:"template",title:m.name,description:m.description,category:m.category,tags:m.keywords,aliases:[p,m.name],capabilities:[],dependencies:(m.composedFrom??[]).map((y)=>Yf(y,g,a,r)),source:{type:"template-contract",id:p,...h?{license:h}:{}},receipt:Bt(Boolean(h))}))}for(let p of[...n].sort((m,g)=>re(m.id,g.id))){let m=Ee("design-guide",p.id),g=Ut(m,void 0,s);c.push(pt({id:m,kind:"design-guide",title:p.title,description:Hf(p),category:p.category,tags:p.tags,aliases:[p.id,p.title],capabilities:["designMd:source"],dependencies:[],source:{type:"design-md",id:p.id,...p.sourceUrl?{url:p.sourceUrl}:{},...g?{license:g}:{}},receipt:Bt(Boolean(g))}))}for(let p of[...i].sort((m,g)=>re(m.id,g.id))){let m=Ee("example",p.id),g=Ut(m,p.license,s);c.push(pt({id:m,kind:"example",title:p.title,description:p.description,...p.category?{category:p.category}:{},tags:p.tags??[],aliases:[p.id,p.title,...p.aliases??[]],capabilities:p.capabilities??[],dependencies:p.dependencies??[],source:{type:"example",id:p.id,...p.version?{version:p.version}:{},...p.sourceUrl?{url:p.sourceUrl}:{},...g?{license:g}:{}},receipt:Bt(Boolean(g))}))}for(let p of[...o].sort((m,g)=>re(m.id,g.id))){let m=Ee("skill",p.id),g=Ut(m,void 0,s);c.push(pt({id:m,kind:"skill",title:p.title,description:p.description?.trim()||p.title,tags:[...p.tags??[],...p.triggers??[]],aliases:[p.id,p.title,...p.triggers??[]],capabilities:["skill:definition"],dependencies:[],source:{type:"skill",id:p.id,...p.version?{version:p.version}:{},...g?{license:g}:{}},receipt:Bt(Boolean(g))}))}for(let p of e.additional??[])c.push(pt(p));c.sort((p,m)=>re(p.id,m.id));let l=new Set;for(let p of c){if(l.has(p.id))throw new ft("duplicate-resource-id",p.id);l.add(p.id)}for(let p of c)for(let m of p.dependencies)if(!l.has(m))throw new ft("dangling-resource-dependency",`${p.id} -> ${m}`);let u=new Map;for(let p of c)for(let m of p.aliases){let g=H(m);if(!g)continue;let h=u.get(g)??new Set;h.add(p.id),u.set(g,h)}let d=Object.freeze(Object.fromEntries([...u.entries()].sort(([p],[m])=>re(p,m)).map(([p,m])=>[p,Object.freeze([...m].sort(re))]))),f=Object.freeze(c.map(Kf));return Object.freeze({schemaVersion:Bf,resources:f,aliases:d})}var Jf=[["chat","assistant","聊天","助手","对话"],["document","documents","文档","写作"],["auth","authentication","认证","登录"],["data table","data grid","datatable","table","表格","数据表","数据表格"],["button","action button","按钮","操作按钮"],["dashboard","admin dashboard","仪表盘","后台","管理后台"],["kanban","kanban board","看板","任务看板"],["form","input form","表单","输入表单"],["navigation","nav","sidebar","导航","侧边栏"]],Wf=Object.freeze(Jf.map((e)=>Object.freeze([...e]))),ua=new Map;for(let e of Wf){let t=Object.freeze([...new Set(e.map(H).filter(Boolean))].sort());for(let r of t)ua.set(r,t)}function Ii(e){let t=H(e);return ua.get(t)??Object.freeze([t])}class Z extends Error{code;detail;constructor(e,t){super(`${e}: ${t}`);this.code=e;this.detail=t;this.name="ResourceQueryError"}}var Pi=Object.freeze({function:180,scenario:180,unit:180,industry:180,"exact-id":1000,"exact-title":900,alias:800,tag:600,capability:500,category:400,token:200,fuzzy:100}),Qf=Object.freeze(Object.keys(Pi)),da=new Map(Qf.map((e,t)=>[e,t])),pa=new Map([["component",0],["template",1],["design-guide",2],["example",3],["skill",4]]);function ne(e,t){return e<t?-1:e>t?1:0}function fa(e){return new Set((e??[]).map(H).filter(Boolean))}function Je(e,t){let r=fa(t);if(r.size===0)return!0;let n=fa(e);return[...r].some((i)=>n.has(i))}function Xf(e,t){if(!Je(e.solution?.functions??[],t.functions))return!1;if(!Je(e.solution?.scenarios??[],t.scenarios))return!1;if(!Je(e.solution?[e.solution.unit]:[],t.units))return!1;if(!Je(e.solution?.industries??[],t.industries))return!1;if(t.kinds?.length&&!t.kinds.includes(e.kind))return!1;if(!Je(e.tags,t.tags))return!1;if(!Je(e.category?[e.category]:[],t.categories))return!1;if(!Je(e.capabilities,t.capabilities))return!1;if(t.maturities?.length&&!t.maturities.includes(e.receipt.maturity))return!1;return!0}function Zf(e){return Boolean(e.functions?.length||e.scenarios?.length||e.units?.length||e.industries?.length||e.kinds?.length||e.tags?.length||e.categories?.length||e.capabilities?.length||e.maturities?.length)}function ye(e,t,r,n=Pi[t]){if(e.some((i)=>i.code===t&&i.value===r))return;e.push({code:t,value:r,score:n})}function Ei(e,t){return e.find((r)=>H(r)===t)}function Ai(e){return[e.id,e.title,...e.aliases,...e.tags,...e.category?[e.category]:[],...e.capabilities,...e.solution?.functions??[],...e.solution?.scenarios??[],...e.solution?.industries??[]]}function eg(e,t,r){if(Math.abs(e.length-t.length)>r)return r+1;let n=Array.from({length:t.length+1},(i,o)=>o);for(let i=1;i<=e.length;i+=1){let o=[i],s=i;for(let a=1;a<=t.length;a+=1){let c=(n[a-1]??r+1)+(e[i-1]===t[a-1]?0:1),l=Math.min((n[a]??r+1)+1,(o[a-1]??r+1)+1,c);o.push(l),s=Math.min(s,l)}if(s>r)return r+1;n=o}return n[t.length]??r+1}function ga(e,t){let r=H(t),n=[];if(H(e.id)===r)ye(n,"exact-id",e.id);if(H(e.title)===r)ye(n,"exact-title",e.title);let i=Ei(e.aliases,r);if(i)ye(n,"alias",i);let o=Ei(e.tags,r);if(o)ye(n,"tag",o);let s=Ei(e.capabilities,r);if(s)ye(n,"capability",s);if(e.category&&H(e.category)===r)ye(n,"category",e.category);if(!i){let l=Ii(r).filter((d)=>d!==r),u=new Set(Ai(e).map(H));if(l.some((d)=>u.has(d)))ye(n,"alias",t.trim())}let a=r.split(" ").filter(Boolean),c=H(Ai(e).join(" "));if(a.length>0&&a.every((l)=>c.includes(l)))ye(n,"token",t.trim());if(n.length===0&&r.length>=4){let l;for(let u of Ai(e)){let d=H(u);if(d.length<4)continue;let f=eg(r,d,2);if(f<=2&&(!l||f<l.distance||f===l.distance&&ne(u,l.value)<0))l={value:u,distance:f}}if(l)ye(n,"fuzzy",l.value,Pi.fuzzy-l.distance)}return n.sort((l,u)=>{if(l.score!==u.score)return u.score-l.score;return(da.get(l.code)??99)-(da.get(u.code)??99)||ne(l.value,u.value)})}function ma(e,t,r){if(t.has(r))return[r];let n=H(r),i=e.aliases[n];if(i?.length)return[...i];let o=new Set;for(let s of Ii(n))for(let a of e.aliases[s]??[])o.add(a);return[...o].sort(ne)}function ha(e,t){return new Z("resource-alias-ambiguous",`${e.trim()}: ${t.join(",")}`)}function qr(e){let t=new Map(e.resources.map((n)=>[n.id,n]));function r(n){let i=n.trim(),o=ma(e,t,i);if(o.length===0)throw new Z("resource-not-found",i);if(o.length>1)throw ha(i,o);let s=o[0],a=s?t.get(s):void 0;if(!a)throw new Z("resource-not-found",i);return a}return Object.freeze({manifest:()=>e,search(n){let i=n.text?.trim()??"";if(!i&&!Zf(n))throw new Z("resource-query-empty","text or filter is required");if(n.limit!==void 0&&(!Number.isInteger(n.limit)||n.limit<=0))throw new Z("resource-query-invalid-limit",String(n.limit));let o=e.resources.filter((s)=>Xf(s,n)).filter((s)=>!i||ga(s,i).length>0).map((s)=>{let a=i?ga(s,i):[];for(let[c,l]of[[n.functions,"function"],[n.scenarios,"scenario"],[n.units,"unit"],[n.industries,"industry"]])if(c?.length)ye(a,l,c.join(","));return{resource:s,score:a.reduce((c,l)=>c+l.score,0),reasons:a}}).filter((s)=>!i||s.reasons.length>0).sort((s,a)=>a.score-s.score||ne(s.resource.id,a.resource.id));return n.limit===void 0?o:o.slice(0,n.limit)},get:r,build(n){if(n.length===0||n.every((f)=>!f.trim()))throw new Z("resource-query-empty","at least one build root is required");let i=[],o=new Set;for(let f of n){let p=f.trim(),m=ma(e,t,p);if(m.length===0)i.push({id:p,reason:"missing-resource"});else if(m.length>1)throw ha(p,m);else{let g=m[0];if(g)o.add(g)}}let s=new Set,a=new Set,c=new Set,l=[],u=[],d=(f,p)=>{if(s.has(f))return;if(a.has(f)){i.push({id:f,...p?{requiredBy:p}:{},reason:"dependency-cycle"});return}let m=t.get(f);if(!m){i.push({id:f,...p?{requiredBy:p}:{},reason:"missing-resource"});return}a.add(f),c.add(f);let g=[...m.dependencies].sort((h,y)=>{let S=t.get(h),k=t.get(y);return(pa.get(S?.kind??"")??99)-(pa.get(k?.kind??"")??99)||ne(h,y)});for(let h of g)u.push({from:f,to:h,relation:"depends-on"}),d(h,f);a.delete(f),s.add(f),l.push(f)};for(let f of[...o].sort(ne))d(f);return{roots:[...o].sort(ne),nodes:[...c].sort(ne).map((f)=>{let p=t.get(f);if(!p)throw new Z("resource-not-found",f);return{id:f,kind:p.kind,maturity:p.receipt.maturity}}),edges:u.sort((f,p)=>ne(f.from,p.from)||ne(f.to,p.to)),order:l,gaps:i.sort((f,p)=>ne(f.id,p.id)||ne(f.requiredBy??"",p.requiredBy??"")||ne(f.reason,p.reason))}}})}function Vt(e){if(!e||typeof e!=="object")throw Error("invalid-public-resource-bundle");og(e);let t=e;if(t.schemaVersion!=="uibot.public-resources.v1"||typeof t.release?.version!=="string"||!/^[a-f0-9]{64}$/.test(t.release?.sourceHash)||t.index?.schemaVersion!=="uibot.resource.index.v1"||!Array.isArray(t.index.resources)||!t.index.aliases||!t.showcases)throw Error("invalid-public-resource-bundle");if(t.documents&&(!Array.isArray(t.documents)||t.documents.some((i)=>typeof i.title!=="string"||typeof i.markdown!=="string"||!/^\/(?:en\/)?docs\/[a-z0-9-]+$/.test(i.path))))throw Error("invalid-public-documentation");let r=new Set,n=new Set;for(let i of t.index.resources){if(!i||typeof i.id!=="string"||r.has(i.id)||!Lr.includes(i.kind)||!i.id.startsWith(`${i.kind}:`)||typeof i.description!=="string"||typeof i.title!=="string"||!Array.isArray(i.dependencies)||!i.source||!i.receipt||!Array.isArray(i.aliases)||!Array.isArray(i.tags)||!Array.isArray(i.capabilities)||![i.aliases,i.dependencies,i.tags,i.capabilities].every((s)=>s.every((a)=>typeof a==="string"&&a.length<=1000))||!["catalog","template-contract","design-md","example","skill","registry","package","theme"].includes(i.source.type)||typeof i.source.id!=="string"||i.source.sourceHash!==void 0&&!/^[a-f0-9]{64}$/.test(i.source.sourceHash)||i.source.packageName!==void 0&&(typeof i.source.packageName!=="string"||!i.source.packageName.startsWith("@uibot/"))||!qt.includes(i.receipt.maturity)||!na.includes(i.receipt.level)||!Array.isArray(i.receipt.evidence)||!i.receipt.evidence.every((s)=>typeof s==="string")||!_r.every((s)=>$r.includes(i.receipt.checks?.[s])))throw Error("invalid-public-resource");if(r.add(i.id),i.solution){let s=i.solution;if(![s.functions,s.scenarios,s.industries,s.hostRequirements,s.limitations].every((a)=>Array.isArray(a)&&a.every((c)=>typeof c==="string"&&c.length>0&&c.length<=2000))||!["page","flow","industry"].includes(s.unit)||!["interactive-demo","needs-enhancement"].includes(s.readiness)||s.members!==void 0&&(!Array.isArray(s.members)||s.members.some((a)=>typeof a.resourceId!=="string"||typeof a.version!=="string"||!a.version||a.sourceHash!==void 0&&(typeof a.sourceHash!=="string"||!/^[a-f0-9]{64}$/.test(a.sourceHash)))))throw Error("invalid-resource-solution")}let o=t.showcases[i.id];if(!o||o.resourceId!==i.id||typeof o.docs?.zh!=="string"||typeof o.docs?.en!=="string"||!Array.isArray(o.examples)||!Array.isArray(o.distributions))throw Error("invalid-resource-showcase");if(o.collection!==void 0){let s=o.collection;if(!s||typeof s.id!=="string"||!/^[a-z0-9-]+$/.test(s.id)||typeof s.group?.id!=="string"||!/^[a-z0-9-]+$/.test(s.group.id)||[s.title,s.group.title].some((a)=>!a||[a.zh,a.en].some((c)=>typeof c!=="string"||!c.trim()||c.length>200)))throw Error("invalid-resource-collection")}if(o.agentKit!==void 0){let s=o.agentKit;if(n.has(i.source?.id))throw Error("invalid-resource-agent-kit");if(n.add(i.source?.id),!s||!["skill","prompt","recipe"].includes(s.type)||(s.type==="skill"?i.kind!=="skill":i.kind!=="example")||!/^[a-z][a-z0-9-]*$/.test(i.source.id)||s.fileName!=={skill:"SKILL.md",prompt:"PROMPT.md",recipe:"RECIPE.md"}[s.type]||[s.summary?.zh,s.summary?.en].some((a)=>typeof a!=="string"||!a.trim())||!Array.isArray(s.resources)||new Set(s.resources.map((a)=>a?.id)).size!==s.resources.length||s.resources.some((a)=>!a||!i.dependencies.includes(a.id)||!t.index.resources.some((c)=>c.id===a.id&&(c.source.version??null)===a.version)||a.version!==null&&(typeof a.version!=="string"||!a.version)||typeof a.contentHash!=="string"||!/^[a-f0-9]{64}$/.test(a.contentHash)||a.sourceHash!==void 0&&(typeof a.sourceHash!=="string"||!/^[a-f0-9]{64}$/.test(a.sourceHash)))||s.resources.length!==i.dependencies.length)throw Error("invalid-resource-agent-kit")}if(o.solutionControls!==void 0){let s=new Set;if(!Array.isArray(o.solutionControls)||o.solutionControls.some((a)=>{if(!a||typeof a.id!=="string"||s.has(a.id)||typeof a.label?.zh!=="string"||typeof a.label?.en!=="string"||!Array.isArray(a.values)||!a.values.length||a.values.some((c)=>!["string","boolean","number"].includes(typeof c)||typeof c==="number"&&!Number.isFinite(c))||typeof a.target?.pageId!=="string"||typeof a.target?.property!=="string"||["__proto__","prototype","constructor"].includes(a.target.property)||a.target.blockId!==void 0&&typeof a.target.blockId!=="string")return!0;return s.add(a.id),!1}))throw Error("invalid-solution-controls")}if(o.templateContract&&(o.templateContract.name!==i.source.id||typeof o.templateContract.description!=="string"||!["L3","L4","L5"].includes(o.templateContract.level)||!["feature","template","page","app"].includes(o.templateContract.category)||!Array.isArray(o.templateContract.keywords)))throw Error("invalid-public-template-contract");if(typeof o.title?.zh!=="string"||typeof o.title?.en!=="string"||o.examples.some((s)=>!s||typeof s.id!=="string"||typeof s.title!=="string"||typeof s.code!=="string"||!["spec","tsx","source"].includes(s.mode)||!["tsx","json","yaml","css","ts"].includes(s.language)||!Array.isArray(s.dependencies)||!s.dependencies.every((a)=>typeof a==="string"))||o.distributions.some((s)=>!s||!["spec","npm","shadcn"].includes(s.channel)||typeof s.name!=="string"||!/^[@a-zA-Z0-9._/-]+$/.test(s.name)||typeof s.version!=="string"||!["source","published"].includes(s.availability)||s.connections!==void 0&&(s.channel!=="spec"||!Array.isArray(s.connections)||s.connections.some((a)=>typeof a!=="string"||!a))))throw Error("invalid-resource-content")}for(let[i,o]of Object.entries(t.index.aliases))if(!i||!Array.isArray(o)||o.some((s)=>!r.has(s)))throw Error("invalid-public-resource-alias");if(Object.keys(t.showcases).some((i)=>!r.has(i)))throw Error("unexpected-public-resource-showcase");for(let i of t.index.resources)for(let o of i.dependencies)if(!r.has(o))throw Error("invalid-public-resource-dependency");if(t.distributionSnapshot){let i=t.distributionSnapshot;if(!/^[a-f0-9]{64}$/.test(i.snapshotId)||i.manifestPath!==`../snapshots/${i.snapshotId}/snapshot.json`||!i.resources||!i.unavailable||!i.external||Object.entries(i.external).some(([o,s])=>!Object.hasOwn(i.unavailable,o)||!Array.isArray(s)||s.some((a)=>typeof a!=="string"||a.startsWith("@uibot/"))))throw Error("invalid-distribution-snapshot-reference");for(let[o,s]of Object.entries(i.resources))if(!r.has(o)||s.version!==(t.index.resources.find((a)=>a.id===o)?.source.version??t.release.version)||!/^[a-f0-9]{64}$/.test(s.resourceHash)||!Array.isArray(s.entrypoints)||!s.entrypoints.length||!Array.isArray(s.closure)||![...s.entrypoints,...s.closure].every((a)=>/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(a))||s.entrypoints.some((a)=>!s.closure.includes(a)))throw Error("invalid-distribution-snapshot-resource")}}function Br(e){Vt(e),e=JSON.parse(JSON.stringify(e));let t=(i)=>{if(i&&typeof i==="object"){for(let o of Object.values(i))t(o);Object.freeze(i)}};t(e);let r=qr(e.index),n=(i)=>{let o=r.get(i),s=e.showcases[o.id];if(!s)throw new Z("resource-not-found",o.id);return s};return Object.freeze({...r,get(i){let o=r.get(i),s=n(i).agentKit;return s?Object.freeze({...o,agentKit:s}):o},docs(i,o="zh",s=1){if(o!=="zh"&&o!=="en")throw Error("unsupported-resource-locale");let a=n(i);return{resourceId:a.resourceId,locale:o,...ng(a.docs[o],s),release:e.release}},examples(i,o=1){let s=n(i);return{resourceId:s.resourceId,...ig(s.examples,o),release:e.release}},installPlan(i){let o=n(i);return{resourceId:o.resourceId,distributions:o.distributions,dependencies:r.build([o.resourceId]),release:e.release,snapshot:e.distributionSnapshot&&Object.hasOwn(e.distributionSnapshot.resources,o.resourceId)?{snapshotId:e.distributionSnapshot.snapshotId,manifestPath:e.distributionSnapshot.manifestPath,...e.distributionSnapshot.resources[o.resourceId]}:null,snapshotUnavailable:e.distributionSnapshot?.unavailable[o.resourceId]??null,install:o.distributions.map((s)=>rg(s,e.distributionSnapshot,o.resourceId))}}})}var tg={"NowAPI.Collection":{real:"@uibot/connection-nowapi",demo:"createAdminPreviewDriver from @uibot/blocks-shadcn/solutions"},"Mock.Collection":{real:null,demo:"@uibot/connection-mock/browser"},Http:{real:"@uibot/connection-http",demo:null},"Pg.Collection":{real:"@uibot/connection-pg (server only)",demo:null}};function rg(e,t,r){let{channel:n,name:i,version:o}=e;if(n==="npm")return{channel:n,name:i,command:`add ${i}@${o}`,note:null};if(n==="spec"){let c=Object.entries(e.dependencies??{}).map(([l,u])=>`${l}@${u}`);return{channel:n,name:i,command:c.length?`add ${c.join(" ")}`:null,drivers:(e.connections??[]).map((l)=>({type:l,...tg[l]??{real:null,demo:null}})),note:"Read the Spec through examples (join paginated code), compile it strictly at build time with the Catalog from @uibot/blocks-shadcn/catalog (plus the other packages listed), then render with createLiveRuntimeAdapter from @uibot/runtime and UIBotLiveRenderer from @uibot/renderer-react, one adapter per page. Register a driver for each connection type."}}let s=!!t&&Object.hasOwn(t.resources,r),a=t?.external[r]??[];return{channel:n,name:i,command:`shadcn add @uibot/${i}`,registries:{"@uibot":"/r/{name}.json"},externalRegistryDependencies:a,note:s?"A hash-pinned snapshot exists: export and verify it, then map @uibot to the local snapshot server.":a.length?`No hash-pinned snapshot: the install also pulls stock shadcn items (${a.join(", ")}) from the host's default registry. Installing through the portal mapping still works; report the files as not snapshot-verified.`:"No hash-pinned snapshot; report the files as not snapshot-verified."}}var De=24000;function ya(e,t){if(!Number.isSafeInteger(e)||e<1||e>Math.max(1,t))throw new Z("resource-query-invalid-limit","page is outside the available range")}function ng(e,t){let r=Math.max(1,Math.ceil(e.length/De));return ya(t,r),{markdown:e.slice((t-1)*De,t*De),page:t,totalPages:r,...t<r?{nextPage:t+1}:{}}}function ig(e,t){let r=e.flatMap((n)=>Array.from({length:Math.max(1,Math.ceil(n.code.length/De))},(i,o)=>({...n,code:n.code.slice(o*De,(o+1)*De),codeOffset:o*De,codeLength:n.code.length,complete:n.code.length<=De})));return ya(t,r.length),{examples:r.slice(t-1,t),page:t,totalPages:r.length,...t<r.length?{nextPage:t+1}:{}}}function og(e){let t=0,r=0,n=new Set,i=(o,s)=>{if(++t>300000||s>64)throw Error("public-resource-budget-exceeded");if(typeof o==="string"){if(r+=new TextEncoder().encode(o).length,r>16777216)throw Error("public-resource-budget-exceeded")}else if(o&&typeof o==="object"){if(n.has(o))throw Error("invalid-public-resource-cycle");let a=Object.getPrototypeOf(o);if(!Array.isArray(o)&&a!==Object.prototype&&a!==null)throw Error("invalid-public-resource-object");n.add(o);for(let[c,l]of Object.entries(o))i(c,s+1),i(l,s+1);n.delete(o)}else if(o!==null&&typeof o!=="boolean"&&(typeof o!=="number"||!Number.isFinite(o)))throw Error("invalid-public-resource-json")};i(e,1)}import{createHash as sg}from"node:crypto";var Kr=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,Ur=/^[a-f0-9]{64}$/,Vr=/^\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+[\w.-]+)?$/,Sa=new TextEncoder,ag=new TextDecoder("utf-8",{fatal:!0});function gt(e){return sg("sha256").update(e).digest("hex")}function be(e){let t=0,r=(i,o)=>{if(++t>400000||o>32)throw Error("snapshot-json-budget-exceeded");if(Array.isArray(i))return i.map((s)=>r(s,o+1));if(i&&typeof i==="object"){if(Object.getPrototypeOf(i)!==Object.prototype)throw Error("snapshot-invalid-json");return Object.fromEntries(Object.keys(i).sort().map((s)=>[s,r(i[s],o+1)]))}if(i===null||typeof i==="string"||typeof i==="boolean"||typeof i==="number"&&Number.isFinite(i))return i;throw Error("snapshot-invalid-json")},n=JSON.stringify(r(e,0));if(Sa.encode(n).length>16777216)throw Error("snapshot-json-budget-exceeded");return n}function Hr(e){if(typeof e!=="string"||!/^[a-zA-Z0-9_./-]+$/.test(e)||e.split("/").some((t)=>!t||t==="."||t==="..")||e.startsWith("/"))throw Error(`snapshot-unsafe-path: ${e}`)}function ba(e,t){return Hr(e),{path:e,bytes:t.byteLength,sha256:gt(t)}}function cg(e){if(typeof e!=="string"||!e.startsWith("@uibot/")||!Kr.test(e.slice(7)))throw Error(`snapshot-external-registry-dependency: ${e}`);return e.slice(7)}function lg(e,t){if(!Kr.test(e)||t.byteLength>16777216)throw Error("snapshot-invalid-item");let r=JSON.parse(ag.decode(t));if(r.name!==e||!Array.isArray(r.files)||r.files.length>2000||(r.devDependencies?.length??0)>0)throw Error(`snapshot-invalid-item: ${e}`);let n={};for(let a of r.dependencies??[]){let c=a.lastIndexOf("@"),l=a.slice(0,c),u=a.slice(c+1);if(c<1||!/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/.test(l)||!Vr.test(u)||n[l]&&n[l]!==u)throw Error(`snapshot-unpinned-npm-dependency: ${a}`);n[l]=u}let i=[...new Set((r.registryDependencies??[]).map(cg))].sort(),o=new Set,s=r.files.map((a)=>{if(typeof a.content!=="string")throw Error(`snapshot-missing-file-content: ${e}`);let c=a.target??a.path;if(Hr(c),o.has(c))throw Error(`snapshot-duplicate-target: ${c}`);return o.add(c),{...ba(a.path,Sa.encode(a.content)),target:c}});return{...ba(`r/${e}.json`,t),registryDependencies:i,npmDependencies:n,files:s}}function ug(e,t){let r=new Set,n=new Set,i=(a)=>{if(!Kr.test(a)||!Object.hasOwn(e,a))throw Error(`snapshot-missing-item: ${a}`);if(n.has(a))throw Error(`snapshot-dependency-cycle: ${a}`);if(r.has(a))return;n.add(a);for(let c of e[a].registryDependencies)i(c);n.delete(a),r.add(a)};if(!t.length)throw Error("snapshot-empty-entrypoints");t.forEach(i);let o=new Map,s=new Map;for(let a of r){for(let c of e[a].files){let l=o.get(c.target);if(l&&l!==c.sha256)throw Error(`snapshot-target-conflict: ${c.target}`);o.set(c.target,c.sha256)}for(let[c,l]of Object.entries(e[a].npmDependencies)){if(s.has(c)&&s.get(c)!==l)throw Error(`snapshot-npm-conflict: ${c}`);s.set(c,l)}}return[...r].sort()}function Oi(e,t){if(!e||typeof e!=="object")throw Error("snapshot-invalid-manifest");be(e);let r=e,{snapshotId:n,...i}=r;if(r.schemaVersion!=="uibot.distribution.snapshot.v1"||r.namespace!=="@uibot"||r.license!=="MIT AND ISC"||!Vr.test(r.version)||!Ur.test(r.bundleHash)||!Ur.test(n)||t!==void 0&&t!==n||gt(be(i))!==n)throw Error("snapshot-identity-mismatch");if(!r.items||!r.resources||!Array.isArray(r.licenseFiles)||!r.licenseFiles.length)throw Error("snapshot-invalid-manifest");let o=(a)=>{if(Hr(a.path),!Ur.test(a.sha256)||!Number.isSafeInteger(a.bytes)||a.bytes<0||a.bytes>16777216)throw Error("snapshot-invalid-file-digest")},s=new Set;for(let a of r.licenseFiles){if(o(a),!a.path.startsWith("licenses/")||s.has(a.path))throw Error("snapshot-invalid-license");s.add(a.path)}for(let[a,c]of Object.entries(r.items)){if(o(c),!Kr.test(a)||c.path!==`r/${a}.json`||!Array.isArray(c.registryDependencies)||!Array.isArray(c.files)||!c.npmDependencies)throw Error("snapshot-invalid-item");for(let l of c.files)o(l),Hr(l.target);for(let[l,u]of Object.entries(c.npmDependencies))if(!/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/.test(l)||!Vr.test(u))throw Error("snapshot-unpinned-npm-dependency")}for(let a of Object.values(r.resources))if(!Vr.test(a.version)||!Ur.test(a.resourceHash)||!Array.isArray(a.entrypoints)||be(ug(r.items,a.entrypoints))!==be(a.closure))throw Error("snapshot-resource-closure-mismatch")}function Di(e,t,r,n){Oi(e,n);let i=Object.hasOwn(e.resources,t)?e.resources[t]:void 0;if(!i)throw Error(`snapshot-resource-unavailable: ${t}`);let o=(a)=>{let c=r.get(a.path);if(!c||c.byteLength!==a.bytes||gt(c)!==a.sha256)throw Error(`snapshot-file-mismatch: ${a.path}`);return c},s={};for(let a of i.closure){let c=e.items[a],l=lg(a,o(c));if(be(l)!==be(c))throw Error(`snapshot-item-metadata-mismatch: ${a}`);Object.assign(s,c.npmDependencies)}return e.licenseFiles.forEach(o),{snapshotId:e.snapshotId,resourceId:t,closure:[...i.closure],npmDependencies:s}}function hg(e){if(!e.name)throw Error("Artifact registry manifest requires a name");return e}async function yg(e,t){let r=await fetch(e,t?{headers:t}:{});if(!r.ok)throw Error(`Failed to fetch ${e}: ${r.status} ${r.statusText}`);return await r.json()}async function Ni(e,t){let r=e.endsWith("/registry.json")?e:`${e.replace(/\/$/,"")}/registry.json`,n=await yg(r,t);return hg(n)}class Li{options;id;priority;manifestPromise;constructor(e){this.options=e;this.id=e.id??e.registryUrl,this.priority=e.priority}getManifest(){return this.manifestPromise??=Ni(this.options.registryUrl,this.options.headers),this.manifestPromise}async get(e){return(await this.getManifest()).items.find((r)=>r.name===e)}}class $i{sources;constructor(e){this.sources=e}async resolve(e){let t=[...this.sources].sort((r,n)=>r.priority-n.priority);for(let r of t){let n=await r.get(e);if(n)return n}return}}var bg="uibot.artifacts.lock.json";function Sg(e){return Ae(e,"components","registry")}function wg(e){return Ae(e,"templates","registry")}function kg(e,t){if(e.kind==="component")return Ae(t.componentsDir??Sg(t.workspaceRoot));return Ae(t.templatesDir??wg(t.workspaceRoot))}function vg(e){return Ae(e.workspaceRoot,e.lockfilePath??bg)}function Rg(e){try{return JSON.parse(pg(e,"utf8"))}catch{return{version:1,artifacts:[]}}}function Cg(e,t){va(Ti(e),{recursive:!0}),Ra(e,`${JSON.stringify(t,null,2)}
|
|
211
|
+
`,"utf8")}function xg(e,t){return{version:1,artifacts:[...e.artifacts.filter((n)=>n.name!==t.name),t].sort((n,i)=>n.name.localeCompare(i.name))}}function Ig(e){if(e.kind==="component")return{components:{[e.name]:e.catalogEntry}};return{templates:{[e.name]:e.templateContract}}}class We extends Error{artifactName;offendingPath;baseDir;constructor(e,t,r){super(`Artifact "${e}" file path escapes workspace: "${t}" resolves outside "${r}"`);this.artifactName=e;this.offendingPath=t;this.baseDir=r;this.name="ArtifactContainmentError"}}function Ca(e,t){let r=t.endsWith(wa)?t:t+wa;return e===t||e.startsWith(r)}function ka(e){let t=Ae(e),r=[];while(!0)try{return dg(t),Ae(fg(t),...r)}catch(n){if(n.code!=="ENOENT")throw n;let i=Ti(t);if(i===t)throw n;r.unshift(gg(t)),t=i}}function xa(e,t,r,n){try{let i=ka(t),o=ka(e);if(!Ca(o,i))throw new We(r,n,t)}catch(i){if(i instanceof We)throw i;throw new We(r,n,t)}}function q(e,t,r){if(e.includes("\x00"))throw new We(r,e,t);if(mg(e))throw new We(r,e,t);let n=Ae(t,e);if(!Ca(n,t))throw new We(r,e,t);return xa(n,t,r,e),n}function Eg(e,t){let r=[];for(let n of e.files){let i=n.target??n.path;r.push(q(i,t,e.name))}return r}function zr(e,t){let r=Ae(t.workspaceRoot),n=kg(e,t);xa(n,r,e.name,n);let i=q(e.name,n,e.name),o=Eg(e,i),s=[];for(let d=0;d<e.files.length;d++){let f=e.files[d],p=o[d];va(Ti(p),{recursive:!0}),Ra(p,f.content??"","utf8"),s.push(p)}let a={name:e.name,version:e.version,source:t.source??"registry",installedAt:new Date().toISOString()},c=vg(t),l=Rg(c),u=xg(l,a);return Cg(c,u),{artifactLock:a,catalogPatch:Ig(e),writtenFiles:s}}import{existsSync as Ag,mkdirSync as Pg,readFileSync as Ia,writeFileSync as Og}from"node:fs";import{dirname as Dg,resolve as mt}from"node:path";function de(e){let t={_:[]};for(let r=0;r<e.length;r+=1){let n=e[r];if(!n.startsWith("--")){t._.push(n);continue}let i=n.slice(2),o=i.indexOf("=");if(o>=0){t[i.slice(0,o)]=i.slice(o+1);continue}let s=e[r+1];if(s!==void 0&&!s.startsWith("--"))t[i]=s,r+=1;else t[i]=!0}return t}function v(e,t){let r=e[t];return typeof r==="string"?r:void 0}function Tg(){let e=[mt(__uibotDir,"resources/agent-kit"),mt(__uibotDir,"../../../skills/content/agent-kit")].find((t)=>Ag(mt(t,"manifest.json")));if(!e)throw Error("agent-skills-content-unavailable");return e}async function Ea(e){let[t,...r]=e,n=de(r),i=v(n,"mode")??"text";try{if(!["text","json"].includes(i)||Object.keys(n).some((l)=>!["_","mode","locale","cwd"].includes(l)))throw Error("agent-skills-invalid-options");if(Object.entries(n).some(([l,u])=>l!=="_"&&typeof u!=="string"))throw Error("agent-skills-missing-option-value");let o=v(n,"locale")??"en";if(!["zh","en"].includes(o))throw Error("agent-skills-invalid-locale");let s=Tg(),a=JSON.parse(Ia(mt(s,"manifest.json"),"utf8")).filter((l)=>l.type==="skill"),c;if(t==="list"&&n._.length===0)c={skills:a.map(({id:l,description:u})=>({id:l,description:u[o]}))};else{let l=n._[0];if(!l||!["show","install"].includes(t??"")||n._.length!==1||!a.some((d)=>d.id===l))throw Error("agent-skill-not-found");let u=Ia(mt(s,l,`${o}.md`),"utf8");if(t==="show")c={id:l,locale:o,content:u};else{let d=mt(v(n,"cwd")??process.cwd()),f=`.agents/skills/${l}/SKILL.md`,p=q(f,d,"agent-skill");Pg(Dg(p),{recursive:!0}),q(f,d,"agent-skill"),Og(p,u,{flag:"wx"}),c={id:l,locale:o,path:p}}}if(i==="json")console.log(JSON.stringify({schema:"uibot.agent-skills.v1",ok:!0,data:c}));else if(typeof c.content==="string")console.log(c.content);else console.log(JSON.stringify(c,null,2));return 0}catch(o){let s=o.code==="EEXIST"?"agent-skill-already-exists":o instanceof Error?o.message:"agent-skills-failed";if(i==="json")console.log(JSON.stringify({schema:"uibot.agent-skills.v1",ok:!1,error:{code:s}}));else console.error(s);return 1}}import{readFileSync as Bg,statSync as Ug}from"node:fs";import{createHash as Pa,randomUUID as Ng}from"node:crypto";import{mkdir as Lg,realpath as $g,writeFile as _g}from"node:fs/promises";import{join as Mg}from"node:path";var Se=(e,t=[])=>({type:"object",properties:e,required:t,additionalProperties:!1}),Te={type:"string",minLength:1},Ht=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,_i={original:"image","favicon-16":"web/favicon-16.png","favicon-32":"web/favicon-32.png","icon-512":"pwa/icon-512.png"},jg=Se({requestId:{type:"string",pattern:Ht.source},provider:Te,model:Te,brief:Se({brand:{...Te,maxLength:100},description:{...Te,maxLength:2000},style:{enum:["symbol","monogram","mascot"]},colors:{type:"string",maxLength:300},direction:{type:"string",maxLength:2000},transparentBackground:{type:"boolean"}},["brand","description","style","colors","direction","transparentBackground"]),referenceAssetId:Te,refinement:{...Te,maxLength:2000}},["requestId","provider","model","brief"]),Fg=Se({targets:{type:"array",items:{enum:["ios","android","web","pwa"]},minItems:1,maxItems:4,uniqueItems:!0},background:{type:"string",pattern:"^#[0-9a-fA-F]{6}$"},spacing:{enum:["balanced","spacious"]},trimTransparent:{type:"boolean"},removeFaintFringe:{type:"boolean",description:"Opt in to cropping near-transparent margins below 1/32 of peak alpha. May remove faint edge details; source is unchanged. Requires trimTransparent."}},["targets","background","spacing","trimTransparent"]),Mi=[{name:"providers",description:"List configured image providers and exact model IDs before generating a logo.",inputSchema:Se({}),readOnly:!0},{name:"assets",description:"List saved logo assets and provenance. Use status with the original requestId to reconcile a generation.",inputSchema:Se({}),readOnly:!0},{name:"status",description:"Read a retained Logo request by its original UUID, including after a lost response or backend restart. running/unknown are not completion. Never automatically replay an unknown generation with a new ID.",inputSchema:Se({requestId:{type:"string",pattern:Ht.source}},["requestId"]),readOnly:!0},{name:"targets",description:"List supported app icon export targets and files.",inputSchema:Se({}),readOnly:!0},{name:"preview",description:"Inspect an existing logo before refining: original PNG or favicon-16/favicon-32/icon-512 on white with balanced spacing and transparent margins trimmed. Returns an image plus dimensions and SHA-256. Does not generate or change the asset.",inputSchema:Se({id:Te,variant:{enum:Object.keys(_i),default:"original"},removeFaintFringe:{type:"boolean",description:"Opt in for icon variants to crop near-transparent margins below 1/32 of peak alpha. May remove faint edge details; source is unchanged."}},["id"]),readOnly:!0},{name:"generate",description:"Generate and save one logo (may incur model cost), or refine an existing asset. Inspect the returned asset with preview before refining. Save an explicit requestId UUID before submitting. Same ID and content never dispatch twice; different content conflicts. On uncertainty query status with that same ID; never automatically generate with a new ID.",inputSchema:Se({request:jg},["request"]),readOnly:!1},{name:"export",description:"Export an existing logo as an app icon ZIP into the configured output directory. Returns a local path, byte count and SHA-256, not binary content. Requires output directory configuration.",inputSchema:Se({id:Te,request:Fg},["id","request"]),readOnly:!1}];class N extends Error{code;outcomeUnknown;requestId;constructor(e,t=!1,r){super(e);this.code=e;this.outcomeUnknown=t;this.requestId=r}}async function Aa(e,t,r,n){await Lg(e,{recursive:!0});let i=await $g(e),o=Mg(i,`logo-${t}-${Ng()}.${r}`);return await _g(o,n,{flag:"wx",mode:384}),{path:o,contentType:r==="png"?"image/png":"application/zip",bytes:n.length,sha256:Pa("sha256").update(n).digest("hex")}}async function qg(e,t){let r=e.body?.getReader();if(!r)throw new N("logo-empty-response");let n=[],i=0;try{for(;;){let{done:a,value:c}=await r.read();if(a)break;if(i+=c.length,i>t)throw new N("logo-response-too-large");n.push(c)}}finally{await r.cancel().catch(()=>{})}let o=new Uint8Array(i),s=0;for(let a of n)o.set(a,s),s+=a.length;return o}function Oa(e){let t;try{t=new URL(e.url)}catch{throw new N("logo-invalid-backend-origin")}if(!/^https?:$/.test(t.protocol)||t.username||t.password||t.pathname!=="/"||t.search||t.hash)throw new N("logo-invalid-backend-origin");if(t.protocol==="http:"&&!["localhost","127.0.0.1","[::1]"].includes(t.hostname))throw new N("logo-https-required");if(!e.token||/[\r\n]/.test(e.token))throw new N("logo-auth-required");let r=Mi.filter((i)=>i.name!=="export"||e.outputDir),n=async(i,o={},s)=>{let a=r.find((g)=>g.name===i);if(!a)throw new N("logo-operation-unavailable");let c=Object.keys(a.inputSchema.properties);if(Object.keys(o).some((g)=>!c.includes(g))||a.inputSchema.required.some((g)=>o[g]===void 0))throw new N("logo-invalid-arguments");if((i==="generate"||i==="export")&&(!o.request||typeof o.request!=="object"||Array.isArray(o.request)))throw new N("logo-invalid-request");if((i==="export"||i==="preview")&&(typeof o.id!=="string"||!Ht.test(o.id)))throw new N("logo-invalid-asset-id");let l=i==="generate"?o.request.requestId:i==="status"?o.requestId:void 0;if((i==="generate"||i==="status")&&(typeof l!=="string"||!Ht.test(l)))throw new N("logo-request-id-required");let u=typeof l==="string"?l:void 0,d=o.variant===void 0?"original":o.variant;if(i==="preview"&&(typeof d!=="string"||!Object.hasOwn(_i,d)))throw new N("logo-invalid-preview-variant");if(i==="preview"&&o.removeFaintFringe!==void 0&&(typeof o.removeFaintFringe!=="boolean"||d==="original"&&o.removeFaintFringe))throw new N("logo-invalid-preview-options");let f=i==="status"?`requests/${l}`:i==="targets"?"export-targets":i==="export"?`assets/${o.id}/app-kit`:i==="preview"?`assets/${o.id}/${d==="original"?"image":"preview"}`:i,p=new URL(`/api/studio/logo/${f}`,t);if(i==="preview"&&d!=="original"){if(p.search=new URLSearchParams({file:_i[d],background:"#ffffff",spacing:"balanced",trim:"1"}).toString(),o.removeFaintFringe!==void 0)p.searchParams.set("fringe",o.removeFaintFringe?"1":"0")}let m;try{m=await(e.fetch??fetch)(p,{method:a.readOnly?"GET":"POST",redirect:"error",headers:{authorization:`Bearer ${e.token}`,...a.readOnly?{}:{"content-type":"application/json"}},...a.readOnly?{}:{body:JSON.stringify(o.request)},signal:s?AbortSignal.any([s,AbortSignal.timeout(600000)]):AbortSignal.timeout(600000)})}catch{throw new N("logo-transport-failed",i==="generate",u)}if(!m.ok)throw new N(`logo-http-${m.status}`,i==="generate"&&(m.status>=500||m.status===499),u);try{let g=await qg(m,i==="export"?33554432:i==="preview"?20000000:1048576);if(i==="preview"){if(m.headers.get("content-type")?.split(";")[0]?.trim()!=="image/png"||g.length<45||![137,80,78,71,13,10,26,10].every((O,D)=>g[D]===O)||new TextDecoder().decode(g.subarray(12,16))!=="IHDR"||new TextDecoder().decode(g.subarray(-8,-4))!=="IEND")throw new N("logo-invalid-preview-response");let S=new DataView(g.buffer,g.byteOffset,g.byteLength),k=S.getUint32(16),A=S.getUint32(20),P=d==="original"?void 0:Number(String(d).split("-")[1]);if(!k||!A||k>4096||A>4096||k*A>4000000||P!==void 0&&(k!==P||A!==P))throw new N("logo-invalid-preview-response");return{preview:{id:o.id,variant:d,...d!=="original"?{removeFaintFringe:o.removeFaintFringe===!0}:{},contentType:"image/png",width:k,height:A,bytes:g.length,sha256:Pa("sha256").update(g).digest("hex")},image:{type:"image",mimeType:"image/png",data:Buffer.from(g).toString("base64")}}}if(i==="export"){if(!m.headers.get("content-type")?.startsWith("application/zip"))throw new N("logo-invalid-export-response");let S=e.outputDir;if(!S)throw new N("logo-output-directory-required");return{artifact:await Aa(S,String(o.id),"zip",g)}}let h=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(g));if(!h||typeof h!=="object")throw new N("logo-invalid-response");let y=h;if(i==="generate"||i==="status"){let S=y.request;if(!S||S.schema!=="uibot.logo-request.v1"||S.requestId!==u||!["running","succeeded","failed","unknown"].includes(String(S.state)))throw new N("logo-invalid-response");if(S.state==="succeeded"){let k=y.asset;if(!k||k.schema!=="uibot.logo-asset.v1"||typeof S.assetId!=="string"||!Ht.test(S.assetId)||k.id!==S.assetId||k.requestId!==u||typeof S.requestHash!=="string"||!/^[0-9a-f]{64}$/.test(S.requestHash)||k.requestHash!==S.requestHash)throw new N("logo-invalid-response")}else{if(y.asset!==void 0)throw new N("logo-invalid-response");y.next=`Query logo status ${u}. State ${String(S.state)} is not a generated asset; do not automatically submit a new ID.`}}else if(!Array.isArray(y[i]))throw new N("logo-invalid-response");return h}catch{throw new N("logo-response-failed",i==="generate",u)}};return{operations:r,call:n,async savePreview(i,o){if(!e.outputDir)throw new N("logo-output-directory-required");let{image:s,...a}=await n("preview",i,o);if(!s)throw new N("logo-invalid-preview-response");try{return{...a,artifact:await Aa(e.outputDir,String(i.id),"png",Buffer.from(s.data,"base64"))}}catch{throw new N("logo-preview-write-failed")}}}}function Vg(e){let t=e.filter((a)=>a!=="--help"&&a!=="-h"),r=t[0]&&!t[0].startsWith("--")?t.shift():void 0,n=de(t),i=v(n,"mode")??"text",o=Mi.filter((a)=>!r||a.name===r);if(o.length===0||n._.length||Object.keys(n).some((a)=>!["_","mode"].includes(a))||n.mode!==void 0&&typeof n.mode!=="string"||!["json","text"].includes(i))throw new N("logo-invalid-options");let s={operations:o.map((a)=>({...a,usage:`uibot logo ${a.name}${a.name==="status"?" <request-id>":a.name==="export"||a.name==="preview"?" <asset-id>":""}${a.name==="generate"||a.name==="export"?" --input <json-file>":""}${a.name==="preview"||a.name==="export"?" --out <directory>":""}`})),notes:["Help works offline and never reads input files, contacts the backend or writes assets.","For generate/export, --input contains the request object from inputSchema (without its wrapper).","Preview accepts --variant original|favicon-16|favicon-32|icon-512 and --remove-faint-fringe true|false.","Export writes an existing asset to a new local ZIP; it uses POST but never generates a logo.","Configure UIBOT_BACKEND_URL and UIBOT_AUTH_BEARER through the host environment for actual calls."]};if(i==="json")console.log(JSON.stringify({schema:"uibot.logo-agent.v1",ok:!0,data:s}));else{for(let a of s.operations)console.log(`${a.usage}
|
|
212
|
+
${a.description}
|
|
213
|
+
${JSON.stringify(a.inputSchema,null,2)}
|
|
214
|
+
`);console.log(s.notes.join(`
|
|
215
|
+
`))}return 0}async function Da(e){let[t,...r]=e,n=de(r),i=v(n,"mode")??"json";try{if(e.includes("--help")||e.includes("-h"))return Vg(e);if(!t||!["json","text"].includes(i)||Object.keys(n).some((m)=>!["_","url","mode","input","out","variant","remove-faint-fringe"].includes(m)))throw new N("logo-invalid-options");if(Object.entries(n).some(([m,g])=>m!=="_"&&typeof g!=="string"))throw new N("logo-missing-option-value");let o=v(n,"url")??process.env.UIBOT_BACKEND_URL,s=process.env.UIBOT_AUTH_BEARER;if(!o||!s)throw new N("logo-config-required");let a=v(n,"out"),c=Oa({url:o,token:s,...a?{outputDir:a}:{}}),l={},u=v(n,"remove-faint-fringe");if(u!==void 0){if(t!=="preview"||!["true","false"].includes(u))throw new N("logo-invalid-preview-options");l.removeFaintFringe=u==="true"}if(t==="export"||t==="preview"){if(n._.length!==1)throw new N("logo-asset-id-required");l.id=n._[0]}else if(t==="status"){if(n._.length!==1)throw new N("logo-request-id-required");l.requestId=n._[0]}else if(n._.length)throw new N("logo-unexpected-positional");let d=v(n,"variant");if(d!==void 0&&t!=="preview")throw new N("logo-unexpected-options");if(d!==void 0)l.variant=d;let f=v(n,"input");if(t==="generate"||t==="export"){if(!f||Ug(f).size>65536)throw new N("logo-input-required-or-too-large");l.request=JSON.parse(Bg(f,"utf8"))}else if(f||a&&t!=="preview")throw new N("logo-unexpected-options");let p=t==="preview"?await c.savePreview(l):await c.call(t,l);return console.log(JSON.stringify({schema:"uibot.logo-agent.v1",ok:!0,data:p},null,i==="text"?2:void 0)),0}catch(o){let s=o instanceof N&&o.outcomeUnknown;return console.log(JSON.stringify({schema:"uibot.logo-agent.v1",ok:!1,error:{code:o instanceof N?o.code:"logo-input-failed",outcomeUnknown:s,...o instanceof N&&o.requestId?{requestId:o.requestId}:{},...s?{next:`Query logo status ${o instanceof N?o.requestId:"<original-request-id>"}. Retain this ID; do not automatically retry with a new ID.`}:{}}})),1}}import{createHash as SE,randomUUID as As}from"node:crypto";import{existsSync as Re,mkdirSync as Ps,readFileSync as Qd,renameSync as wE,unlinkSync as xr,writeFileSync as Os}from"node:fs";import{dirname as Xd,resolve as Zd}from"node:path";import{createHash as Hd}from"node:crypto";import{existsSync as ks,readFileSync as Kd}from"node:fs";import{resolve as ce}from"node:path";import{pathToFileURL as zd}from"node:url";function Gd(e){for(let t of e)if(ks(t))return t;return null}function vs(e){if(e)return/^[a-z]+:/i.test(e)?new URL(e):zd(ce(e));let t=[ce(__uibotDir,"resources/bundle.json"),ce(__uibotDir,"../../../public/resources/bundle.json")].find(ks);if(!t)throw Error("snapshot-bundle-unavailable");return zd(t)}function Cr(e=process.cwd()){return Gd([ce(e,"examples/templates"),ce(__uibotDir,"templates"),ce(__uibotDir,"../../../examples/templates")])}function Rs(e=process.cwd()){return Gd([ce(e,"examples/shells"),ce(__uibotDir,"shells"),ce(__uibotDir,"../../../examples/shells")])}function pE(e){let t={};for(let r of e)for(let[n,i]of Object.entries(r)){if(t[n])throw Error(`duplicate built-in catalog source id: ${n}`);t[n]=i}return t}async function Yd(e){if(e){let u=vs(e);if(u.protocol==="file:"){let D=Kd(u);if(D.length>16777216)throw Error("public-resource-source-too-large");let C=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(D));Vt(C);let{release:j,schemaVersion:te,distributionSnapshot:R,...w}=C;if(Hd("sha256").update(JSON.stringify(w)).digest("hex")!==C.release.sourceHash)throw Error("public-resource-source-hash-mismatch");return Br(C)}if(u.protocol!=="https:"&&!(u.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(u.hostname)))throw Error("public-resource-source-must-use-https");let d=await fetch(u,{signal:AbortSignal.timeout(1e4),redirect:"error"});if(!d.ok)throw Error(`public-resource-source-http-${d.status}`);let f=d.body?.getReader();if(!f)throw Error("public-resource-source-empty");let p=[],m=0;try{for(;;){let{value:D,done:C}=await f.read();if(C)break;if(m+=D.byteLength,m>16777216)throw Error("public-resource-source-too-large");p.push(D)}}finally{await f.cancel()}let g=new Uint8Array(m),h=0;for(let D of p)g.set(D,h),h+=D.byteLength;let y=new TextDecoder("utf-8",{fatal:!0}).decode(g),S=JSON.parse(y);Vt(S);let{release:k,schemaVersion:A,distributionSnapshot:P,...O}=S;if(Hd("sha256").update(JSON.stringify(O)).digest("hex")!==S.release.sourceHash)throw Error("public-resource-source-hash-mismatch");return Br(S)}let t=[ce(__uibotDir,"resources/bundle.json"),ce(__uibotDir,"../../../public/resources/bundle.json")].find(ks);if(t){let u=JSON.parse(Kd(t,"utf8"));return Vt(u),Br(u)}let[r,n,i]=await Promise.all([import("@uibot/blocks-shadcn"),import("@uibot/blocks-studio"),Promise.resolve().then(() => (ii(),{}))]),o=[],s=Cr();if(s)o.push({dir:s});let a=Rs();if(a)o.push({dir:a,defaultLevel:"L3",defaultCategory:"feature",extraKeywords:["sidebar","app-shell","shell"]});let c=Ft(o),l=Object.fromEntries(c.map((u)=>[u.name,u.templateContract]));return qr(la({components:pE([r.CATALOG_ENTRIES,n.STUDIO_CATALOG_ENTRIES]),templates:l,designGuides:ni(ce(__uibotDir,"../../design-md/content")),examples:ca(l)}))}import{createHash as fE}from"node:crypto";import{existsSync as Cs,mkdirSync as xs,mkdtempSync as gE,readFileSync as Is,renameSync as mE,rmSync as hE,writeFileSync as yE}from"node:fs";import{dirname as Jd,resolve as Dt}from"node:path";var Es=["@uibot/blocks-shadcn","@uibot/compiler","@uibot/contracts","@uibot/runtime","@uibot/renderer-react","@uibot/connection-nowapi"],oi=(e)=>`${JSON.stringify(e,null,2)}
|
|
216
|
+
`,bE=(e)=>fE("sha256").update(e).digest("hex");function Wd(e){let t=Dt(e.root),r=q(e.out,t,"application scaffold");if(r===t||Cs(r))throw Error("Choose a new application directory");let n=dt(e.connection),i=e.channel??"development";if(!["development","production"].includes(i))throw Error("Invalid application channel");let o=e.templateFile??[Dt(__uibotDir,"app-host-template.json"),Dt(__uibotDir,"../dist/app-host-template.json")].find(Cs);if(!o)throw Error("Application host template unavailable; rebuild the CLI");let s=JSON.parse(Is(o,"utf8"));if(s.contract!=="uibot.app-host-template.v1"||!/^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/.test(s.version)||!s.files||typeof s.files!=="object"||!Object.hasOwn(s.files,"src/app.tsx"))throw Error("Invalid application host template");let a={...s.files},c={react:"19.2.8","react-dom":"19.2.8"};for(let d of Es)c[d]=s.version;let l={};if(e.releaseSet){let g=function(h){if(m.has(h))return;let y=p.get(h);if(!y)throw Error(`Release set missing ${h}`);m.add(h);for(let A of y.internalDeps)g(A);let S=q(y.tarball,d,"release package"),k=Is(S);if(k.byteLength>32000000||bE(k)!==y.sha256)throw Error(`Release package integrity failed: ${h}`);a[`.uibot/packages/${y.tarball}`]=k,l[h]=`file:./.uibot/packages/${y.tarball}`},d=Dt(e.releaseSet),f=JSON.parse(Is(Dt(d,"release-set.json"),"utf8"));if(!Array.isArray(f.entries)||f.entries.length>100)throw Error("Invalid release set");let p=new Map;for(let h of f.entries){if(!h||typeof h.package!=="string"||!/^@uibot\/[a-z0-9-]+$/.test(h.package)||p.has(h.package)||h.version!==s.version||typeof h.tarball!=="string"||!/^[a-z0-9][a-z0-9.-]*\.tgz$/.test(h.tarball)||!/^[a-f0-9]{64}$/.test(h.sha256)||!Array.isArray(h.internalDeps)||h.internalDeps.some((y)=>typeof y!=="string"))throw Error("Invalid or mismatched release set");p.set(h.package,h)}let m=new Set;for(let h of Es)g(h);for(let h of Es)c[h]=l[h];a[".uibot/packages/release-set.json"]=oi({...f,entries:f.entries.filter((h)=>m.has(h.package))})}a["app-server.ts"]=a["app-server.ts"].replace("if (import.meta.main) {",`if (import.meta.main) {
|
|
217
|
+
process.env.UIBOT_LINKED_APP_CHANNEL ??= ${JSON.stringify(i)};
|
|
218
|
+
process.env.UIBOT_LINKED_APP_CONNECTION_FILE ??= resolve("uibot.connection.json");`),a["package.json"]=oi({name:"uibot-connected-app",private:!0,type:"module",scripts:{dev:"vite",build:"vite build",start:"bun run app-server.ts",typecheck:"tsc --noEmit"},dependencies:c,devDependencies:{"@types/react":"19.2.18","@types/react-dom":"19.2.4","@types/bun":"1.4.4",typescript:"7.0.2",vite:"8.3.5","@tailwindcss/vite":"4.3.3",tailwindcss:"4.3.3"},...Object.keys(l).length?{overrides:l}:{}}),a["uibot.connection.json"]=oi(n),a["tsconfig.json"]=oi({compilerOptions:{target:"ES2022",module:"ESNext",moduleResolution:"bundler",jsx:"react-jsx",strict:!0,noEmit:!0,skipLibCheck:!0,types:["bun","vite/client"]},include:["src","*.ts"]}),a["vite.config.ts"]=`import { resolve } from "node:path";
|
|
219
|
+
import { defineConfig } from "vite";
|
|
220
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
221
|
+
import { linkedBackendPlugin } from "./linked-backend";
|
|
222
|
+
import { appSessionPlugin } from "./app-session-plugin";
|
|
223
|
+
|
|
224
|
+
process.env.UIBOT_LINKED_APP_CONNECTION_FILE ??= resolve("uibot.connection.json");
|
|
225
|
+
process.env.UIBOT_LINKED_APP_CHANNEL ??= ${JSON.stringify(i)};
|
|
226
|
+
export default defineConfig({
|
|
227
|
+
server: { host: "127.0.0.1", strictPort: true },
|
|
228
|
+
plugins: [tailwindcss(), appSessionPlugin(), linkedBackendPlugin("app")],
|
|
229
|
+
resolve: { dedupe: ["react", "react-dom"] },
|
|
230
|
+
oxc: { jsx: { runtime: "automatic" } },
|
|
231
|
+
});
|
|
232
|
+
`,a[".dockerignore"]=`node_modules/
|
|
233
|
+
dist/
|
|
234
|
+
.git/
|
|
235
|
+
.env*
|
|
236
|
+
*.private.json
|
|
237
|
+
*.sqlite*
|
|
238
|
+
*key*
|
|
239
|
+
.doon/
|
|
240
|
+
`,a.Dockerfile=`FROM oven/bun:1.4.4 AS build
|
|
241
|
+
WORKDIR /app
|
|
242
|
+
COPY . .
|
|
243
|
+
RUN bun install --frozen-lockfile && bun run build
|
|
244
|
+
FROM oven/bun:1.4.4
|
|
245
|
+
WORKDIR /app
|
|
246
|
+
COPY --from=build --chown=bun:bun /app /app
|
|
247
|
+
USER bun
|
|
248
|
+
ENV PORT=8080
|
|
249
|
+
EXPOSE 8080
|
|
250
|
+
CMD ["bun", "run", "start"]
|
|
251
|
+
`,a[".gitignore"]=`node_modules/
|
|
252
|
+
dist/
|
|
253
|
+
.env*
|
|
254
|
+
*.private.json
|
|
255
|
+
*.sqlite*
|
|
256
|
+
*.key
|
|
257
|
+
.uibot/app-cli.lock
|
|
258
|
+
`,a["README.md"]=`# Connected UIBot application
|
|
259
|
+
|
|
260
|
+
This independent React/Vite host uses fixed public package versions. No NowUI checkout or source alias is required. A supplied release set is integrity-checked and copied into this project; move the entire directory together. Commit the generated bun.lock after installation.
|
|
261
|
+
|
|
262
|
+
1. Run \`bun install\` then \`bun run typecheck && bun run build\`.
|
|
263
|
+
2. Configure \`UIBOT_LINKED_APP_BEARER\` in the server process environment with scoped Viewer authorization. Never use a VITE_ variable or put credentials in the connection file.
|
|
264
|
+
3. Run \`bun run dev\`. Open the printed loopback URL. HTML deep links are supported; assets and API requests do not use the page fallback.
|
|
265
|
+
4. In this directory, \`uibot app link --connection uibot.connection.json\` and \`uibot app doctor\` enable CLI authoring. \`app watch\` only pulls; \`app push\` explicitly saves local changes. CLI Editor authorization uses \`UIBOT_CONTROL_PLANE_AUTH_BEARER\` separately.
|
|
266
|
+
|
|
267
|
+
The generated channel is **${i}**. Override \`UIBOT_LINKED_APP_CHANNEL=development|production\` at startup. Development follows saves. Production reads only explicit releases and remains unpublished until a release exists. Installed TSX modules must match source hashes; changing them requires rebuilding the host.
|
|
268
|
+
|
|
269
|
+
Business data is disabled by default, without demo fallback. To reuse the Admin session host, explicitly set UIBOT_LINKED_APP_TASKS=true, UIBOT_LINKED_APP_SESSIONS=true, UIBOT_LINKED_APP_ADMIN=true and an exact UIBOT_LINKED_APP_SESSION_ORIGIN matching your chosen loopback port. UIBOT_ADMIN_TRANSPORT_FILE points to the existing private non-administrator service transport. UIBOT_LINKED_APP_AUTH=true additionally enables NowAPI email account flows. Do not copy transport files or credentials into this project. No business permissions are granted by connecting an application.
|
|
270
|
+
|
|
271
|
+
For a built host, run \`bun run build\` then \`bun run start\`, with UIBOT_APP_ORIGIN (exact HTTPS origin; HTTP only on loopback), UIBOT_LINKED_APP_CONNECTION_FILE, UIBOT_LINKED_APP_BEARER and optional PORT/HOST. The server serves only dist, fixed linked application reads and explicitly enabled per-user routes. /healthz is a liveness check, not upstream or login admission. Doon owns TLS, domain, supervision and persistent volume mounting. Dockerfile requires the generated bun.lock; build outside secret configuration directories.
|
|
272
|
+
|
|
273
|
+
Session mode additionally requires matching UIBOT_LINKED_APP_SESSION_ORIGIN, UIBOT_APP_SESSION_DB on a private persistent directory and UIBOT_APP_SESSION_KEY_FILE containing 32 random bytes as 64 lowercase hex characters (mode 0600). Keep both outside this project and backup them together. SQLite permits one writer; do not run replicas against the same store. Session records are AES-256-GCM encrypted and bound to host origin and transport scope. A restart retains completed sessions; in-flight authentication/rotation is invalidated and requires sign-in. Unknown writes are never replayed. Vite dev retains its memory-only mode.
|
|
274
|
+
|
|
275
|
+
Styles are compiled from local source, installed public packages and uibot.app.json. Link/pull the intended source before building. Newly introduced utility classes or installed TSX require rebuilding the host; saving a Spec does not distribute CSS or code. The generated browser does not run Tailwind Play. Third-party OAuth, email delivery and production identity admission remain owned by their actual services. A successful local build is not a deployment receipt.
|
|
276
|
+
`;let u;try{for(let[d,f]of Object.entries(a))if(q(d,r,"application scaffold file"),typeof f!=="string"&&!(f instanceof Uint8Array))throw Error("Invalid application template file");xs(t,{recursive:!0}),u=gE(Dt(t,".uibot-app-"));for(let[d,f]of Object.entries(a)){let p=q(d,u,"application scaffold file");xs(Jd(p),{recursive:!0}),q(d,u,"application scaffold file"),yE(p,f,{flag:"wx",mode:384})}if(q(e.out,t,"application scaffold"),Cs(r))throw Error("Application directory appeared; existing files retained");return xs(Jd(r),{recursive:!0}),q(e.out,t,"application scaffold"),mE(u,r),u=void 0,{directory:r,channel:i,files:Object.keys(a).length,packages:Object.keys(l).length}}finally{if(u)hE(u,{recursive:!0,force:!0})}}var Ke=(e)=>SE("sha256").update(e).digest("hex");function Tt(e){return Ci(e)}async function kE(e,t={}){let[r,...n]=e,i=de(n),o=Zd(v(i,"cwd")??t.cwd??process.cwd()),s=t.env??process.env,a=t.log??console.log,c=v(i,"mode")==="json",l=(R)=>a(JSON.stringify({contract:"uibot.cli.app.v1",ok:!0,result:R},null,c?void 0:2)),u=(R)=>q(R,o,"application workspace"),d=u("uibot.app.json"),f=u(".uibot/app-pending.json"),p=u(".uibot/app-link.json"),m=(R)=>JSON.parse(Qd(R,"utf8")),g=()=>Ie(m(d));function h(R,w,E=!1){let T=R.slice(o.length+1);u(T),Ps(Xd(R),{recursive:!0}),u(T);let F=`${JSON.stringify(w,null,2)}
|
|
277
|
+
`;if(E)return Os(R,F,{flag:"wx",mode:384});let Q=u(`${T}.${As()}.tmp`);Os(Q,F,{flag:"wx",mode:384});try{u(T),wE(Q,R)}finally{if(Re(Q))xr(Q)}}function y(){let R=m(p);if(R.contract!=="uibot.app-link.v1"||!/^[a-f0-9]{64}$/.test(R.sourceHash)||typeof R.revisionId!=="string"||!Number.isSafeInteger(R.revisionNumber)||R.revisionNumber<1)throw Error("Invalid application link");return xe(R),Tt(R.url),{contract:R.contract,url:Tt(R.url),projectId:R.projectId,artifactId:R.artifactId,revisionId:R.revisionId,revisionNumber:R.revisionNumber,sourceHash:R.sourceHash}}async function S(R,w={}){let E=s.UIBOT_CONTROL_PLANE_AUTH_BEARER??s.UIBOT_STUDIO_AUTH_BEARER,T=new Headers(w.headers);if(T.set("accept","application/json"),E)T.set("authorization",`Bearer ${E}`);if(w.body)T.set("content-type","application/json");return(t.fetcher??fetch)(R,{...w,headers:T,redirect:"error",signal:AbortSignal.timeout(15000),cache:"no-store"})}let k=(R)=>`${Tt(R.url)}/api/studio/creation${xe(R)}`;async function A(R){if(!R.ok)throw Error(`Application HTTP ${R.status}`);let w=R.body?.getReader();if(!w)throw Error("Invalid application response");let E=[],T=0;try{while(!0){let{done:Ye,value:G}=await w.read();if(Ye)break;if(T+=G.length,T>8000000)throw await w.cancel(),Error("Oversized application response");E.push(G)}}finally{w.releaseLock()}let F=new Uint8Array(T),Q=0;for(let Ye of E)F.set(Ye,Q),Q+=Ye.length;return JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(F))}async function P(R){let w=await A(R),E;try{E=sa(w)}catch{throw Error("Invalid application response")}if(Ke(he(E.document))!==E.sourceHash)throw Error("Application content hash mismatch");return E}function O(R,w){if(R.projectId!==w.projectId||R.artifactId!==w.artifactId)throw Error("Application identity mismatch")}function D(R,w){O(R,w),h(p,{contract:R.contract,url:R.url,projectId:R.projectId,artifactId:R.artifactId,revisionId:w.revisionId,revisionNumber:w.revisionNumber,sourceHash:w.sourceHash})}async function C(R){h(f,R,!0);let w;try{w=await S(R.create?`${R.link.url}/api/studio/creation/apps`:`${k(R.link)}/revisions`,{method:"POST",body:JSON.stringify(R.body)})}catch{throw Error("Write outcome unknown. Keep the original operation; run uibot app reconcile. Do not resend.")}if(!w.ok){if([400,401,403,404,409,413,422].includes(w.status))xr(f);throw Error(`Application HTTP ${w.status}; local edits retained`)}let E=await P(w);if(Ke(he(Ie(R.body.document)))!==E.sourceHash)throw Error("Save confirmation does not match original input");D(R.link,E),xr(f),l(E)}async function j(){let R=y();if(Re(f))throw Error("An application write is unresolved; reconcile it first");let w=he(g());if(Ke(w)!==R.sourceHash)throw Error("Local application has unsaved changes; pull refused");let E=await S(`${k(R)}/live`,{headers:{"if-none-match":`"uibot-linked-${R.revisionId}"`}});if(E.status===304){l({unchanged:!0,revisionId:R.revisionId});return}let T=await P(E);if(he(g())!==w)throw Error("Local edits changed during pull; preserved");if(T.projectId!==R.projectId||T.artifactId!==R.artifactId)throw Error("Application identity mismatch");if(T.revisionNumber<R.revisionNumber||T.revisionNumber===R.revisionNumber&&T.revisionId!==R.revisionId)throw Error("Stale application revision");if(T.revisionId===R.revisionId&&(T.sourceHash!==R.sourceHash||T.revisionNumber!==R.revisionNumber))throw Error("Immutable revision changed");h(d,T.document),D(R,T),l(T)}let te;try{if(!r||r==="help")return l({commands:["init","create","list","link","status","pull","push","watch","reconcile","open","export","connection","doctor","scaffold"]}),0;if(r==="list"){let w=Tt(v(i,"url")??y().url),E=await S(`${w}/api/studio/creation/apps`);if(!E.ok)throw Error(`Application HTTP ${E.status}`);return l(await E.json()),0}if(r==="status"){let w=y();return l({...w,dirty:Ke(he(g()))!==w.sourceHash,pendingOperationId:Re(f)?m(f).operationId:null}),0}if(r==="doctor"){let w=y(),E=v(i,"channel")??"development";if(!["development","production"].includes(E))throw Error("Invalid application channel");let T=[],F=(G,me,sf)=>T.push({name:G,status:me,message:sf}),Q=Ke(he(g()))!==w.sourceHash;F("local",Q?"warning":"pass",Q?"Local changes retained; push explicitly when ready.":"Local document matches the saved baseline."),F("operation",Re(f)?"fail":"pass",Re(f)?"Outcome unknown. Run uibot app reconcile; do not replay the write.":"No unresolved write.");try{let G=await P(await S(`${k(w)}/live`));if(G.projectId!==w.projectId||G.artifactId!==w.artifactId||G.revisionNumber<w.revisionNumber||G.revisionNumber===w.revisionNumber&&(G.sourceHash!==w.sourceHash||G.revisionId!==w.revisionId))throw Error("Invalid remote baseline");F("development","pass",`Verified saved revision r${G.revisionNumber}.`)}catch{F("development","fail","Cannot verify application. Check gateway, scoped authorization and application identity.")}try{let G=await S(`${k(w)}/releases/current`);if(!G.ok)throw Error("Release unavailable");let me=aa(await A(G));if(me.projectId!==w.projectId||me.artifactId!==w.artifactId||me.published&&Ke(he(me.document))!==me.sourceHash)throw Error("Invalid release");F("production",me.published?"pass":E==="production"?"fail":"warning",me.published?`Verified release ${me.releaseSequence}.`:"not-published: publish explicitly in application settings; production never reads the development head.")}catch{F("production",E==="production"?"fail":"warning","Release unavailable. Check the gateway release capability and scoped authorization.")}let Ye=T.every((G)=>G.status!=="fail");return a(JSON.stringify({contract:"uibot.cli.app.v1",ok:Ye,result:{channel:E,checks:T,credentialConfigured:Boolean(s.UIBOT_CONTROL_PLANE_AUTH_BEARER??s.UIBOT_STUDIO_AUTH_BEARER),host:"Run the connected host separately; this check does not start a server or validate business permissions."}},null,c?void 0:2)),Ye?0:1}if(r==="open"){let w=y(),E=new URL(v(i,"editor-url")??"http://localhost:3203/apps");if(E.username||E.password||!["https:","http:"].includes(E.protocol))throw Error("Invalid editor URL");return E.searchParams.set("project",w.projectId),E.searchParams.set("app",w.artifactId),l({editorUrl:E.href}),0}if(r==="scaffold"){let w=dt(m(u(v(i,"connection")??"uibot.connection.json")));return l(Wd({root:o,out:v(i,"out")??"my-app",connection:w,channel:v(i,"channel"),releaseSet:v(i,"release-set")})),0}Ps(o,{recursive:!0});let R=u(".uibot/app-cli.lock");if(Ps(Xd(R),{recursive:!0}),u(".uibot/app-cli.lock"),Os(R,JSON.stringify({pid:process.pid}),{flag:"wx",mode:384}),te=R,r==="connection"){let w=y(),E=dt({contract:"uibot.linked-app.connection.v1",origin:w.url,projectId:w.projectId,artifactId:w.artifactId,path:`/api/studio/creation${xe(w)}/live`,intervalMs:1000}),T=v(i,"out");if(T)h(u(T),E,!0),l({file:u(T)});else l(E);return 0}if(r==="init"){let w=v(i,"template")??"shadcn-admin";if(!/^[A-Za-z0-9_-]+$/.test(w))throw Error("Invalid template name");let E=Cr();if(!E)throw Error("Built-in templates unavailable");let T=Qd(Zd(E,`${w}.yaml`),"utf8"),F={contract:"uibot.app.v1",title:v(i,"title")??"UIBot Admin",entryPath:"/",spec:T,css:"",designMd:"",tsx:[]};return h(d,Ie(F),!0),l({file:d,template:w}),0}if(r==="export"){let w=u(v(i,"out")??"uibot.app.export.json");return h(w,g(),!0),l({file:w}),0}if(r==="reconcile"){let w=m(f);if(w.contract!=="uibot.app-pending.v1"||typeof w.operationId!=="string")throw Error("Invalid pending operation");let E=await P(await S(`${k(w.link)}/operations/${encodeURIComponent(w.operationId)}`)),T=Ie(w.body.document);if(E.sourceHash!==Ke(he(T)))throw Error("Operation receipt does not match original input");return D(w.link,E),xr(f),l({reconciled:!0,...E}),0}if(Re(f))throw Error("Unresolved application write; run uibot app reconcile");if(r==="create"){if(Re(p))throw Error("This workspace is already linked");let w=g(),E=As(),T=oa(E),F=v(i,"project-id")??T.projectId,Q={contract:"uibot.app-link.v1",url:Tt(v(i,"url")??"http://localhost:3202"),...T,projectId:F};return await C({contract:"uibot.app-pending.v1",link:Q,operationId:E,create:!0,body:{operationId:E,document:w,...v(i,"project-id")?{projectId:F}:{}}}),0}if(r==="link"){if(Re(p))throw Error("This workspace is already linked");let w=v(i,"connection");if(w&&["url","project-id","app-id"].some((Q)=>v(i,Q)))throw Error("Connection file cannot be combined with identity overrides");let E=w?dt(m(u(w))):void 0,T={contract:"uibot.app-link.v1",url:E?.origin??Tt(v(i,"url")??"http://localhost:3202"),projectId:E?.projectId??v(i,"project-id")??"",artifactId:E?.artifactId??v(i,"app-id")??""},F=await P(await S(k(T)));if(O(T,F),Re(d)&&Ke(he(g()))!==F.sourceHash)throw Error("Local application differs; link refused without overwriting");if(!Re(d))h(d,F.document,!0);return D(T,F),l(F),0}if(r==="push"){let w=y(),E=As();return await C({contract:"uibot.app-pending.v1",link:w,operationId:E,create:!1,body:{operationId:E,expectedRevisionId:w.revisionId,document:g()}}),0}if(r==="pull")return await j(),0;if(r==="watch"){let w=Number(v(i,"interval")??"1000");if(!Number.isSafeInteger(w)||w<250||w>60000)throw Error("Invalid polling interval");let E=new AbortController,T=()=>E.abort();process.once("SIGINT",T),process.once("SIGTERM",T);try{while(!E.signal.aborted&&!t.signal?.aborted)await j(),await new Promise((F)=>setTimeout(F,w))}finally{process.removeListener("SIGINT",T),process.removeListener("SIGTERM",T)}return 0}throw Error(`Unknown application command: ${r}`)}catch(R){let w=R instanceof Error?R.message:"Application command failed";return(t.error??console.error)(JSON.stringify({contract:"uibot.cli.app.v1",ok:!1,error:w})),1}finally{if(te)xr(te)}}async function ep(e,t={}){try{return await kE(e,t)}catch(r){return(t.error??console.error)(JSON.stringify({contract:"uibot.cli.app.v1",ok:!1,error:r instanceof Error?r.message:"Application command failed"})),1}}var vE={string:"value","positive-integer":"n","resource-kind":"kind","resource-maturity":"maturity"};function RE(e){let t=e.positionals.map((n)=>{let i=`${n.name}${"variadic"in n&&n.variadic?"...":""}`;return n.required?`<${i}>`:`[${i}]`}),r=e.options.map((n)=>`[--${n.name} <${vE[n.type]}${"cliEncoding"in n&&n.cliEncoding==="comma-separated"?",...":""}>]`);return[e.name,...t,...r,"[--mode <text|json>]","[--dense]"].join(" ")}var CE=lt.map((e)=>({name:e.name,usage:`${RE(e)}${e.name==="install-plan"?" [--snapshot <sha256>] [--export <directory> | --verify <directory>]":""}`,summary:e.summary,group:"resources"})),xE=[...CE,{name:"logo",usage:"logo <providers|assets|status|targets|preview|generate|export> [<asset-id>] [--variant <original|favicon-16|favicon-32|icon-512>] [--url <backend-origin>] [--input <json-file>] [--out <directory>] [--mode <json|text>]",summary:"Use authenticated Logo services; inspect an image, generate once or export app icons to an explicit directory.",group:"project"},{name:"skills list",usage:"skills list [--locale <en|zh>] [--mode <text|json>]",summary:"List bundled Agent Skills without installing them.",group:"skills"},{name:"skills show",usage:"skills show <id> [--locale <en|zh>] [--mode <text|json>]",summary:"Read one bundled Agent Skill on demand.",group:"skills"},{name:"skills install",usage:"skills install <id> [--locale <en|zh>] [--cwd <project>] [--mode <text|json>]",summary:"Install one skill into project .agents/skills without overwriting existing files.",group:"skills"},{name:"snapshot-serve",usage:"snapshot-serve <directory> [--port <n>]",summary:"Verify and serve a saved registry closure on loopback without upstream fallback.",group:"artifacts"},{name:"app",usage:"app <init|create|list|link|status|pull|push|watch|reconcile|open|export|connection|doctor|scaffold> [--cwd <dir>] [--url <backend>] [--project-id <id>] [--app-id <id>] [--connection <file>] [--out <new-dir>] [--release-set <dir>] [--channel development|production] [--mode json]",summary:"Create, edit and follow one versioned application with protected local drafts.",group:"project"},{name:"list",usage:"list [--registry <url>]",summary:"List installable artifact registry entries.",group:"artifacts"},{name:"add",usage:"add <name> [--registry <url>] [--cwd <dir>]",summary:"Install an artifact and its registry dependencies.",group:"artifacts"},{name:"publish",usage:"publish [--out <dir>] [--name <manifest-name>]",summary:"Publish the built-in artifact registry to a directory.",group:"artifacts"},{name:"design-md sync",usage:"design-md sync --from <github:owner/repo|https-url> [--cwd <dir>] [--mode json]",summary:"Pull remote design-md with source and license stamps.",group:"design"},{name:"regressions reverify",usage:"regressions reverify [--cwd <dir>] [--skill <id>] [--mode json]",summary:"Re-run resolved regressions and reactivate failures.",group:"skills"},{name:"skills promote",usage:"skills promote <id> [--cwd <dir>] [--mode json]",summary:"Mark a skill promoted and append its usage receipt.",group:"skills"},{name:"skills rollback",usage:"skills rollback <id> [--cwd <dir>] [--mode json]",summary:"Roll back a promoted skill marker with a usage receipt.",group:"skills"},{name:"project export",usage:"project export <dir> [--cwd <dir>] [--mode json]",summary:"Copy project-local .uibot state to a directory.",group:"project"},{name:"link",usage:"link --spec-dir <relative-dir> [--source-dir <dir>] [--cwd <dir>] [--force] [--mode json]",summary:"Register consumer Spec dir + digest pin (L2 Linked).",group:"linked"},{name:"sync push",usage:"sync push [--from <dir>] [--cwd <dir>] [--mode json]",summary:"Copy YAML Spec + lock digest from sourceDir into consumer.",group:"linked"},{name:"sync pull",usage:"sync pull [--to <dir>] [--cwd <dir>] [--mode json]",summary:"Copy YAML Spec from consumer back to sourceDir.",group:"linked"},{name:"doctor",usage:"doctor [--cwd <dir>] [--registry <url>] [--mode json]",summary:"Compare the artifact lockfile with its registry.",group:"diagnostics"},{name:"init",usage:"init <dir> [--template <name>] | init --into <existing-app> [--force] [--mode json]",summary:"Scaffold a project, or L1 Embed recipe into an existing app.",group:"project"}],tp=Object.freeze(xE.map((e)=>Object.freeze(e))),IE=["--mode <text|json> Structured output mode for resource commands.","--dense Compact resource payloads without changing ids/order/codes.","--source <url> Query an explicit versioned public resource bundle (HTTPS or loopback).","--registry <url> Artifact registry base URL.","--cwd <dir> Workspace root (default: cwd).","--out <dir> Output directory for publish.","--from <src> Remote source for design-md sync, or local Spec source for sync push.","--to <dir> Local Spec destination for sync pull.","--spec-dir <dir> Relative consumer Spec directory for link.","--source-dir <dir> Local studio/CP Spec directory recorded by link.","--control-plane-url <url> Hosted CP base URL for remote Spec sync (no secrets).","--project-id <id> Remote Spec project id (default: default).","--force Overwrite existing .uibot/link.json or init --into files.","--into <dir> Existing app root for L1 Embed scaffold (requires package.json).","--spec-path <rel> Relative Spec YAML path for init --into (default: src/pages/home.uibot.yaml).","--mount-path <rel> Relative mount snippet path for init --into.","--template <name> Template name for greenfield init."];function Ds(){let e=tp.map((n)=>` uibot ${n.usage}`).join(`
|
|
278
|
+
`),t=tp.map((n)=>` ${n.name.padEnd(22)} ${n.summary}`).join(`
|
|
279
|
+
`),r=IE.map((n)=>` ${n}`).join(`
|
|
280
|
+
`);return`uibot — UIBot resource and artifact CLI
|
|
212
281
|
|
|
213
282
|
Usage:
|
|
214
283
|
${e}
|
|
@@ -218,30 +287,30 @@ ${t}
|
|
|
218
287
|
|
|
219
288
|
Flags:
|
|
220
289
|
${r}
|
|
221
|
-
`}var
|
|
222
|
-
`,"utf8"),n.push(i);for(let o of t.items){let s=
|
|
223
|
-
`,"utf8"),n.push(s)}return n}async function
|
|
224
|
-
`,"utf-8")}list(e){let t=
|
|
225
|
-
`).filter(Boolean).map((r)=>{try{return JSON.parse(r)}catch{return null}}).filter((r)=>r!==null)}catch{return[]}}active(e){return this.list(e).filter((t)=>t.status==="active")}markResolved(e,t,r){if(t.length===0)return;let n=this.list(e);if(n.length===0)return;let i=new Set(t),o=new Date().toISOString(),s=n.map((c)=>{if(i.has(c.id)&&c.status==="active")return{...c,status:"resolved",resolvedBy:r,resolvedAt:o};return c}),a=
|
|
290
|
+
`}var si="http://127.0.0.1:3202/api/registry";async function rp(e,t){if(!e)throw Error("uibot add: missing artifact name");let r=t.registry??si,n=t.log??((l)=>console.log(l)),i=t.sources??[new Li({registryUrl:r,priority:0})],o=new $i(i),s=[],a=new Set,c=[e];while(c.length>0){let l=c.shift();if(a.has(l))continue;a.add(l);let u=await o.resolve(l);if(!u)throw Error(`Artifact '${l}' not found in ${r}`);let d=zr(u.artifact,{workspaceRoot:t.workspaceRoot,source:r});s.push({name:u.artifact.name,version:u.artifact.version,files:d.writtenFiles.length});let f=u.artifact.kind==="template"?"template":"component";n(`Installed ${f} ${u.artifact.name}@${u.artifact.version} → ${d.writtenFiles.length} files`);let p=u.artifact.kind==="component"?u.artifact.registryDependencies:void 0;for(let m of p??[])if(!a.has(m))c.push(m)}return{installed:s}}async function np(e={}){let t=e.registry??si,r=e.fetchManifest??((o)=>Ni(o)),n=e.log??((o)=>console.log(o)),i=await r(t);for(let o of i.items)n(`${o.name} ${o.kind} ${o.title??""}`);return i}import{mkdirSync as EE,writeFileSync as ip}from"node:fs";import{resolve as Ts}from"node:path";function AE(e,t){let r=Ts(e,"artifacts");EE(r,{recursive:!0});let n=[],i=Ts(e,"registry.json");ip(i,`${JSON.stringify(t,null,2)}
|
|
291
|
+
`,"utf8"),n.push(i);for(let o of t.items){let s=Ts(r,`${o.name}.json`);ip(s,`${JSON.stringify(o,null,2)}
|
|
292
|
+
`,"utf8"),n.push(s)}return n}async function op(e){let t=e.log??((o)=>console.log(o)),r=e.sources;if(!r){if(!e.blockFileMap||!e.catalog||!e.sourceDir)throw Error("uibot publish: provide either `sources` or `blockFileMap` + `catalog` + `sourceDir`");r=vi({sourceDir:e.sourceDir,blockFileMap:e.blockFileMap,catalog:e.catalog,...e.readFile?{readFile:e.readFile}:{}})}let n=ra(r,{name:e.manifestName??"local",...e.templates?.length?{templates:e.templates}:{}}),i=[];if(e.writeArtifacts)e.writeArtifacts(e.out,n);else i.push(...AE(e.out,n));return t(`Published ${n.items.length} artifacts → ${e.out}`),{manifest:n,writtenFiles:i}}ii();import{join as PE}from"node:path";async function sp(e){let t=e.cwd??process.cwd(),r=PE(t,".uibot","design-md"),n=await Ss({from:e.from,outDir:r,...e.license?{defaultLicense:e.license}:{},...e.dryRun?{dryRun:!0}:{}});if(e.mode==="json")console.log(JSON.stringify(n,null,2));else if(!n.ok)console.error(`uibot design-md sync: ${n.error??"failed"}`);else{console.log(`synced ${n.written} file(s) → ${r}`+(n.skipped?` (skipped ${n.skipped})`:""));for(let i of n.files)if(i.status==="written"||i.status==="dry-run")console.log(` + ${i.id} ← ${i.sourceUrl}`);else console.log(` - skip ${i.sourceUrl}: ${i.reason??""}`)}return{code:n.ok?0:1,result:n}}import{readdirSync as ZE,existsSync as hp,readFileSync as eA}from"node:fs";import{join as yp}from"node:path";Zn();import{fileURLToPath as NE}from"node:url";var LE=NE(new URL("../content",import.meta.url));import{appendFileSync as _E,existsSync as ap,mkdirSync as ME,readFileSync as jE,writeFileSync as cp}from"node:fs";import{join as lp}from"node:path";function up(e,t){return lp(e,".uibot","skills",t)}function ai(e,t){return lp(up(e,t),"regressions.jsonl")}class ci{options;constructor(e){this.options=e}append(e){let t=up(this.options.rootDir,e.skillId);if(!ap(t))ME(t,{recursive:!0});_E(ai(this.options.rootDir,e.skillId),JSON.stringify(e)+`
|
|
293
|
+
`,"utf-8")}list(e){let t=ai(this.options.rootDir,e);if(!ap(t))return[];try{return jE(t,"utf-8").split(`
|
|
294
|
+
`).filter(Boolean).map((r)=>{try{return JSON.parse(r)}catch{return null}}).filter((r)=>r!==null)}catch{return[]}}active(e){return this.list(e).filter((t)=>t.status==="active")}markResolved(e,t,r){if(t.length===0)return;let n=this.list(e);if(n.length===0)return;let i=new Set(t),o=new Date().toISOString(),s=n.map((c)=>{if(i.has(c.id)&&c.status==="active")return{...c,status:"resolved",resolvedBy:r,resolvedAt:o};return c}),a=ai(this.options.rootDir,e);cp(a,s.map((c)=>JSON.stringify(c)).join(`
|
|
226
295
|
`)+`
|
|
227
|
-
`,"utf-8")}markActive(e,t,r){if(t.length===0)return;let n=this.list(e);if(n.length===0)return;let i=new Set(t),o=new Date().toISOString(),s=n.map((c)=>{if(i.has(c.id)&&c.status==="resolved")return{...c,status:"active",context:[c.context,`reactivated@${o}: ${r}`].filter(Boolean).join(" | ")};return c}),a=
|
|
296
|
+
`,"utf-8")}markActive(e,t,r){if(t.length===0)return;let n=this.list(e);if(n.length===0)return;let i=new Set(t),o=new Date().toISOString(),s=n.map((c)=>{if(i.has(c.id)&&c.status==="resolved")return{...c,status:"active",context:[c.context,`reactivated@${o}: ${r}`].filter(Boolean).join(" | ")};return c}),a=ai(this.options.rootDir,e);cp(a,s.map((c)=>JSON.stringify(c)).join(`
|
|
228
297
|
`)+`
|
|
229
|
-
`,"utf-8")}resolved(e){return this.list(e).filter((t)=>t.status==="resolved")}}
|
|
230
|
-
`).filter((
|
|
231
|
-
`,"utf8")}function
|
|
298
|
+
`,"utf-8")}resolved(e){return this.list(e).filter((t)=>t.status==="resolved")}}Xi();import{createHash as UE}from"node:crypto";function Nt(e,t){return UE("sha256").update(JSON.stringify([e,t])).digest("hex")}function Ns(e){return typeof e==="number"&&Number.isFinite(e)&&e>=0&&e<=1}var VE=new Set(["rule-scan","structural-heuristic","model-text","model-screenshot","legacy-provider","unassessed"]),HE=new Set(["empty-input","invalid-score","provider-failed","provider-not-run","invalid-evidence","screenshot-unavailable","timeout"]);async function dp(e,t,r){let n=Nt(t,r),i=(o)=>({status:"unavailable",method:"unassessed",subjectHash:n,reason:o});if(!t.trim())return i("empty-input");try{if(e.evaluate){let s=await e.evaluate(t,r);if(!s||s.subjectHash!==n||!VE.has(s.method))return i("invalid-evidence");if(s.status==="scored"&&s.method!=="unassessed"&&Ns(s.score))return{status:"scored",method:s.method,subjectHash:n,score:s.score};if(s.status==="unavailable"&&s.score===void 0&&HE.has(s.reason))return{status:"unavailable",method:s.method,subjectHash:n,reason:s.reason};return i("invalid-evidence")}let o=await e(t,r);return Ns(o)?{status:"scored",method:"legacy-provider",subjectHash:n,score:o}:i("invalid-score")}catch{return i("provider-failed")}}var KE=[{label:"_js operator",re:/_js\s*:/g},{label:"_secret operator",re:/_secret\s*:/g},{label:"external URL",re:/https?:\/\/[^\s'"]+/g}];function zE(e,t){let r=[];for(let{label:n,re:i}of KE){let o=(e.match(i)??[]).length,s=(t.match(i)??[]).length;if(s>o)r.push(`New ${n} introduced (${o} → ${s})`)}return r}var ot={layout:["PageLayout","Card","Box","Tabs","Drawer","Modal"],nav:["PageSiderMenu","Breadcrumb","MenuLink","Link"],data:["Table","List","Stat"],form:["Form","Form.Input","Form.Select","Form.TextArea","Form.Checkbox"],feedback:["Toast","Dialog","Skeleton"],content:["Heading","Paragraph","Markdown","Divider"],action:["Button"]},GE=["Form.Submit","Button"];function YE(e){let t=Object.values(ot).filter((p)=>p.some((m)=>e.includes(m))).length,r=Object.keys(ot).length,n=Math.min(1,t/(r*0.7)),i=e.split(`
|
|
299
|
+
`).filter((p)=>p.trim().length>0).map((p)=>p.match(/^(\s*)/)?.[1]?.length??0),o=i.length>0?Math.max(...i):0,s=Math.min(1,o/12),a=ot.form.some((p)=>e.includes(p)),c=GE.some((p)=>e.includes(p)),l=!a?1:c?1:0.4,u=[...ot.layout,...ot.data].some((p)=>e.includes(p)),d=[...ot.content,...ot.action].some((p)=>e.includes(p)),f=u&&d?1:u||d?0.6:0.2;return n*0.35+s*0.15+l*0.2+f*0.3}function pp(e){let t=/```ya?ml[\s\S]*?```/i.test(e),r=/\bpage\s*:/i.test(e),n=/\bblocks\s*:/i.test(e);if(t)return 1;if(r&&n)return 0.9;if(r||n)return 0.5;return 0}function fp(e,t,r){return e*0.4+t*0.35+r*0.25}class Lt{visualScoreProvider;constructor(e={}){this.visualScoreProvider=e.visualScoreProvider??void 0}async run(e,t){let r=pp(t),n=e.expectedBlocks.filter((a)=>t.toLowerCase().includes(a.toLowerCase())),i=e.expectedBlocks.length===0?1:n.length/e.expectedBlocks.length,o=this.visualScoreProvider?await dp(this.visualScoreProvider,t,e.intent):this.structuralEvidence(t,e.intent),s=o.status==="scored"?o.score:0;return{renderable:r,schemaValid:i,visualHeuristic:s,visualEvidence:o,overallScore:fp(r,i,s),safetyOk:!0}}runSync(e,t){let r=pp(t),n=e.expectedBlocks.filter((a)=>t.toLowerCase().includes(a.toLowerCase())),i=e.expectedBlocks.length===0?1:n.length/e.expectedBlocks.length,o=this.visualScoreProvider?{status:"unavailable",method:"unassessed",subjectHash:Nt(t,e.intent),reason:"provider-not-run"}:this.structuralEvidence(t,e.intent),s=o.status==="scored"?o.score:0;return{renderable:r,schemaValid:i,visualHeuristic:s,visualEvidence:o,overallScore:fp(r,i,s),safetyOk:!0}}structuralEvidence(e,t){let r=Nt(e,t);return e.trim()?{status:"scored",method:"structural-heuristic",subjectHash:r,score:YE(e)}:{status:"unavailable",method:"unassessed",subjectHash:r,reason:"empty-input"}}checkSafetyRegressions(e,t){return zE(e,t)}}function JE(e={}){if(e.runner)return e.runner;return new Lt(e.visualScoreProvider!==void 0?{visualScoreProvider:e.visualScoreProvider}:{})}async function li(e,t,r={}){return JE(r).run(e,t)}var mp="title|text|label|content|description|heading|subtitle|placeholder|body|caption|name",X_=new RegExp(`["']?\\b(?:${mp})["']?\\s*:\\s*["']([^"'\\n]*)["']`,"gi"),Z_=new RegExp(`^\\s*-?\\s*(?:${mp})\\s*:\\s*([^\\s"'{\\[][^\\n]*)$`,"gim");function tA(e){let t=yp(e,".uibot","skills");if(!hp(t))return[];return ZE(t,{withFileTypes:!0}).filter((r)=>r.isDirectory()).map((r)=>r.name)}function rA(e,t){let r=yp(e,".uibot","skills",t,"SKILL.md");if(!hp(r))return"";return eA(r,"utf8")}async function bp(e={}){let t=e.cwd??process.cwd(),r=new ci({rootDir:t}),n=e.skillId?[e.skillId]:tA(t),i=[],o=0,s=0;for(let c of n){let l=r.resolved(c),u=rA(t,c),d=[];for(let f of l){o+=1;let p={id:f.id,intent:f.intent||"regression-reverify",expectedBlocks:f.expectedBlocks??[],skillId:c},m=await li(p,u),g=(f.expectedBlocks?.length??0)===0||m.schemaValid>=0.99,h=m.renderable>=0.5||!f.intent.trim();if(!g||!h||m.overallScore<0.3)d.push(f.id),s+=1,i.push({skillId:c,id:f.id,action:"reactivated",reason:`overallScore=${m.overallScore.toFixed(3)} schemaValid=${m.schemaValid.toFixed(3)}`});else i.push({skillId:c,id:f.id,action:"pass"})}if(d.length>0)r.markActive(c,d,"reverify-failed")}let a={ok:!0,checked:o,reactivated:s,details:i};if(e.mode==="json")console.log(JSON.stringify(a,null,2));else{console.log(`reverify: checked ${o}, reactivated ${s}`);for(let c of i)if(c.action==="reactivated")console.log(` ! ${c.skillId}/${c.id} → active (${c.reason})`)}return{code:0,result:a}}import{appendFileSync as nA,existsSync as ui,mkdirSync as wp,readFileSync as iA,writeFileSync as Sp,cpSync as oA}from"node:fs";import{join as ze,dirname as sA}from"node:path";function aA(e){return ze(e,".uibot","cli-usage.jsonl")}function $t(e,t){let r=aA(e);wp(sA(r),{recursive:!0}),nA(r,JSON.stringify({...t,at:new Date().toISOString()})+`
|
|
300
|
+
`,"utf8")}function kp(e,t){return ze(e,".uibot","skills",t)}async function vp(e,t={}){let r=t.cwd??process.cwd(),n=kp(r,e);if(!ui(n)){let o={ok:!1,error:`skill not found: ${e}`};if(t.mode==="json")console.log(JSON.stringify(o));else console.error(`uibot skills promote: ${o.error}`);return $t(r,{command:"skills.promote",id:e,ok:!1}),1}let i=ze(n,"SKILL.md");if(ui(i))Sp(ze(n,"SKILL.promoted.md"),iA(i,"utf8"));if(Sp(ze(n,"PROMOTED"),JSON.stringify({id:e,promotedAt:new Date().toISOString()},null,2)),$t(r,{command:"skills.promote",id:e,ok:!0}),t.mode==="json")console.log(JSON.stringify({ok:!0,id:e,action:"promoted"}));else console.log(`promoted skill ${e}`);return 0}async function Rp(e,t={}){let r=t.cwd??process.cwd(),n=kp(r,e),i=ze(n,"PROMOTED");if(!ui(i)){let s={ok:!1,error:`no promotion marker for skill: ${e}`};if(t.mode==="json")console.log(JSON.stringify(s));else console.error(`uibot skills rollback: ${s.error}`);return $t(r,{command:"skills.rollback",id:e,ok:!1}),1}let{unlinkSync:o}=await import("node:fs");if(o(i),$t(r,{command:"skills.rollback",id:e,ok:!0}),t.mode==="json")console.log(JSON.stringify({ok:!0,id:e,action:"rolled-back"}));else console.log(`rolled back skill ${e}`);return 0}async function Cp(e,t={}){let r=t.cwd??process.cwd(),n=ze(r,".uibot");if(!ui(n)){let i={ok:!1,error:"no .uibot directory in workspace"};if(t.mode==="json")console.log(JSON.stringify(i));else console.error(`uibot project export: ${i.error}`);return $t(r,{command:"project.export",outDir:e,ok:!1}),1}if(wp(e,{recursive:!0}),oA(n,ze(e,".uibot"),{recursive:!0}),$t(r,{command:"project.export",outDir:e,ok:!0}),t.mode==="json")console.log(JSON.stringify({ok:!0,outDir:e}));else console.log(`exported project state → ${e}`);return 0}import{existsSync as cA,readFileSync as lA}from"node:fs";import{resolve as uA}from"node:path";var dA=process.env.UIBOT_REGISTRY_URL?.trim()||"http://127.0.0.1:3202/api/registry/registry.json";async function xp(e={}){let t=e.cwd??process.cwd(),r=uA(t,e.lockfilePath??"uibot.artifacts.lock.json"),n=e.mode??"text",i=null,o=!1;if(!cA(r))o=!0;else try{i=JSON.parse(lA(r,"utf8"))}catch{o=!0}let s=e.manifest;if(!s){let c=e.registry??dA,l=e.fetchImpl??fetch;try{let u=await l(c);if(!u.ok){let d={ok:!1,error:`registry HTTP ${u.status}`,url:c};if(n==="json")console.log(JSON.stringify(d));else console.error(`uibot doctor: failed to fetch registry ${c} (${u.status})`);return 1}s=await u.json()}catch(u){let d=u instanceof Error?u.message:String(u),f="start control-plane (bun run example:control-plane) or pass --registry; offline = not a green doctor";if(n==="json")console.log(JSON.stringify({ok:!1,error:d,url:c,exitCode:1,hint:"start control-plane (bun run example:control-plane) or pass --registry; offline = not a green doctor"}));else console.error(`uibot doctor: cannot reach registry ${c}`),console.error(` ${d}`),console.error(" hint: start control-plane (bun run example:control-plane) or pass --registry; offline = not a green doctor");return 1}}if(o){let c=Dr({lockfile:null,manifest:s,lockfilePath:r});if(n==="json")console.log(JSON.stringify({...c,exitCode:2}));else console.error(`uibot doctor: no lockfile at ${r}`);return 2}let a=Dr({lockfile:i,manifest:s,lockfilePath:r});if(n==="json")console.log(JSON.stringify({...a,exitCode:a.ok?0:1}));else if(a.ok)console.log(`uibot doctor: ok (${a.lockCount} locked, registry ${a.registryName??"?"})`);else{console.error(`uibot doctor: drift detected (${a.drifts.length})`);for(let c of a.drifts)console.error(` - ${c.detail}`)}return a.ok?0:1}import{existsSync as Ir,mkdirSync as _s,writeFileSync as Ip,readdirSync as pA,readFileSync as fA,statSync as gA}from"node:fs";import{dirname as Ep,isAbsolute as mA,join as _t,relative as hA,resolve as pi,sep as yA}from"node:path";ii();class le extends Error{constructor(e){super(e);this.name="InitIntoError"}}var bA="src/pages/home.uibot.yaml",SA="src/uibot-mount.example.tsx",wA="uibot.embed.md",Ap=["@uibot/contracts","@uibot/compiler","@uibot/runtime","@uibot/renderer-react"],kA=`/**
|
|
232
301
|
* Minimal UIBot control-plane entry (scaffold from \`uibot init\`).
|
|
233
302
|
* Wire with your monorepo's createExampleControlPlane or a custom assembly.
|
|
234
303
|
*
|
|
235
304
|
* Smoke: \`bunx tsc --noEmit control-plane.ts\` after pointing imports at your packages.
|
|
236
305
|
*/
|
|
237
306
|
export async function main(): Promise<void> {
|
|
238
|
-
console.log("uibot project scaffold ready
|
|
307
|
+
console.log("uibot project scaffold ready — wire createExampleControlPlane here");
|
|
239
308
|
}
|
|
240
309
|
|
|
241
310
|
if (import.meta.main) {
|
|
242
311
|
void main();
|
|
243
312
|
}
|
|
244
|
-
`,
|
|
313
|
+
`,vA=`version: "2.0"
|
|
245
314
|
pages:
|
|
246
315
|
- id: home
|
|
247
316
|
path: /
|
|
@@ -258,7 +327,7 @@ pages:
|
|
|
258
327
|
- type: Button
|
|
259
328
|
props:
|
|
260
329
|
label: Get started
|
|
261
|
-
`,
|
|
330
|
+
`,RA=`version: "2.0"
|
|
262
331
|
pages:
|
|
263
332
|
- id: home
|
|
264
333
|
path: /
|
|
@@ -277,9 +346,9 @@ pages:
|
|
|
277
346
|
type: Paragraph
|
|
278
347
|
props:
|
|
279
348
|
text: Keep this *.uibot.yaml beside your routes; host owns router/session/ACL.
|
|
280
|
-
`;function
|
|
281
|
-
* L1 Embed mount example
|
|
282
|
-
* Proof: examples/vite-react-live
|
|
349
|
+
`;function CA(e){return`/**
|
|
350
|
+
* L1 Embed mount example — copy into a route component.
|
|
351
|
+
* Proof: examples/vite-react-live · smoke:external-consumer --phase app-runtime
|
|
283
352
|
*
|
|
284
353
|
* Spec file (edit / rename as needed): ${e}
|
|
285
354
|
*
|
|
@@ -292,7 +361,7 @@ import type { Catalog, UIBotSpec } from "@uibot/contracts";
|
|
|
292
361
|
import { createElement } from "react";
|
|
293
362
|
import { createRoot } from "react-dom/client";
|
|
294
363
|
|
|
295
|
-
// Replace with YAML
|
|
364
|
+
// Replace with YAML→JSON load, or import a typed Spec module.
|
|
296
365
|
const SPEC: UIBotSpec = {
|
|
297
366
|
version: "2.0",
|
|
298
367
|
pages: [
|
|
@@ -309,7 +378,7 @@ const SPEC: UIBotSpec = {
|
|
|
309
378
|
{
|
|
310
379
|
id: "heading",
|
|
311
380
|
type: "Heading",
|
|
312
|
-
props: { text: "compileSpec
|
|
381
|
+
props: { text: "compileSpec → createLiveRuntimeAdapter → renderer" },
|
|
313
382
|
},
|
|
314
383
|
],
|
|
315
384
|
},
|
|
@@ -344,14 +413,14 @@ export async function mountUIBot(rootEl: HTMLElement, registry: unknown): Promis
|
|
|
344
413
|
}),
|
|
345
414
|
);
|
|
346
415
|
}
|
|
347
|
-
`}function
|
|
416
|
+
`}function xA(e,t){let r=Ap.join(" ");return`# UIBot L1 Embed
|
|
348
417
|
|
|
349
418
|
Scaffolded with \`uibot init --into\`.
|
|
350
419
|
|
|
351
420
|
## Install App Runtime
|
|
352
421
|
|
|
353
422
|
\`\`\`bash
|
|
354
|
-
# From a release-set / tarball / future npm
|
|
423
|
+
# From a release-set / tarball / future npm — pin versions your release uses.
|
|
355
424
|
pnpm add ${r}
|
|
356
425
|
# or: bun add ${r}
|
|
357
426
|
\`\`\`
|
|
@@ -363,7 +432,7 @@ Apps must **not** depend on Studio or \`@uibot/application\`.
|
|
|
363
432
|
| Path | Role |
|
|
364
433
|
|------|------|
|
|
365
434
|
| \`${e}\` | Starter \`*.uibot.yaml\` Spec beside routes |
|
|
366
|
-
| \`${t}\` | \`compileSpec\`
|
|
435
|
+
| \`${t}\` | \`compileSpec\` → \`createLiveRuntimeAdapter\` → renderer |
|
|
367
436
|
| \`DESIGN.md\` | This project's visual contract. Generate reads it; UIBot house seeds do not replace it. |
|
|
368
437
|
|
|
369
438
|
## Mount
|
|
@@ -382,23 +451,23 @@ Apps must **not** depend on Studio or \`@uibot/application\`.
|
|
|
382
451
|
\`uibot link --spec-dir <rel>\` then \`uibot sync push|pull\` for Spec-as-code sync.
|
|
383
452
|
|
|
384
453
|
See \`docs/product/progressive-adoption.md\`.
|
|
385
|
-
`}async function
|
|
386
|
-
`),i("control-plane.ts",
|
|
387
|
-
`);return i("README.md",`# ${
|
|
454
|
+
`}async function Pp(e){let t=e.log??((u)=>console.log(u)),r=pi(e.dir);_s(r,{recursive:!0});let n=[],i=(u,d)=>{let f=_t(r,u);_s(Ep(f),{recursive:!0}),Ip(f,d,"utf8"),n.push(f)};i("package.json",`${JSON.stringify({name:di(r),private:!0,type:"module",scripts:{start:"bun run control-plane.ts"}},null,2)}
|
|
455
|
+
`),i("control-plane.ts",kA),i("DESIGN.md",ri(di(r)));let o=ni(),a=["frontend-principles","control-console"].map((u)=>o.find((d)=>d.id===u)).filter((u)=>Boolean(u));for(let u of a){let d=_t(".uibot","design-md",`${u.id}.design.md`);i(d,ws(u))}let c=PA(),l=!1;if(c){let u=Tr({dir:c}),d=(e.template?u.find((f)=>f.name===e.template):u.find((f)=>f.name==="saas-landing")??u[0])??null;if(d){let f=Nr(d),p=zr(f,{workspaceRoot:r,source:"uibot-init"});n.push(...p.writtenFiles),n.push(_t(r,"uibot.artifacts.lock.json")),l=!0,t(`seeded template ${d.name}`)}}if(!l)i(_t("templates","demo.yaml"),vA),i("uibot.artifacts.lock.json",`${JSON.stringify({version:1,artifacts:[]},null,2)}
|
|
456
|
+
`);return i("README.md",`# ${di(r)}
|
|
388
457
|
|
|
389
458
|
Scaffolded with \`uibot init\`.
|
|
390
459
|
|
|
391
|
-
- \`templates/\` or \`templates/registry/\`
|
|
392
|
-
- \`DESIGN.md\`
|
|
393
|
-
- \`.uibot/design-md/\`
|
|
394
|
-
- \`control-plane.ts\`
|
|
460
|
+
- \`templates/\` or \`templates/registry/\` — starter UIBot specs
|
|
461
|
+
- \`DESIGN.md\` — this project's visual contract (consumer-owned)
|
|
462
|
+
- \`.uibot/design-md/\` — UIBot house seeds (\`frontend-principles\` + \`control-console\`)
|
|
463
|
+
- \`control-plane.ts\` — wire your control-plane assembly
|
|
395
464
|
|
|
396
465
|
Next: point dependencies at \`@uibot/*\` packages and run the control-plane.
|
|
397
|
-
`),t(`initialized project at ${r} (${n.length} files)`),{dir:r,files:n}}function
|
|
398
|
-
`)?
|
|
399
|
-
`,"utf8"),m.push(
|
|
400
|
-
`,"utf8"),t}function
|
|
466
|
+
`),t(`initialized project at ${r} (${n.length} files)`),{dir:r,files:n}}function Op(e){let t=e.log??((n)=>console.log(n)),r=e.error??((n)=>console.error(n));try{let n=IA(e.into);EA(n);let i=$s(e.specPath??bA,"specPath"),o=$s(e.mountPath??SA,"mountPath"),s=$s(e.recipePath??wA,"recipePath"),a=Ls(i,n,"specPath"),c=Ls(o,n,"mountPath"),l=Ls(s,n,"recipePath"),u="DESIGN.md",d=_t(n,u),f=Ir(d),p=[{abs:a,rel:i,content:RA},{abs:c,rel:o,content:CA(i)},{abs:l,rel:s,content:xA(i,o)}];if(!f)p.push({abs:d,rel:u,content:ri(di(n))});if(!e.force){let y=p.filter((S)=>Ir(S.abs)).map((S)=>S.rel);if(y.length>0)throw new le(`refusing to overwrite existing files (pass --force): ${y.join(", ")}`)}let m=[];for(let y of p)_s(Ep(y.abs),{recursive:!0}),Ip(y.abs,y.content.endsWith(`
|
|
467
|
+
`)?y.content:`${y.content}
|
|
468
|
+
`,"utf8"),m.push(y.abs);let g=[...Ap],h={ok:!0,into:n,files:m.map((y)=>AA(n,y)),dependencies:g};if(e.mode==="json")t(JSON.stringify(h));else{t(`initialized L1 Embed into ${n}`);for(let y of h.files)t(` + ${y}`);if(t(`App Runtime deps: ${g.join(" ")}`),f)t("kept existing DESIGN.md");t(`See ${s} for the copy-paste recipe.`)}return{code:0,into:n,files:m,dependencies:g}}catch(n){let i=n instanceof Error?n.message:String(n);if(e.mode==="json")t(JSON.stringify({schema:"uibot.cli.error.v1",ok:!1,error:i}));else r(`uibot init --into: ${i}`);return{code:1,error:i}}}function IA(e){if(!e||e.includes("\x00"))throw new le("--into path is invalid");let t=pi(e);if(!Ir(t))throw new le(`directory does not exist: ${t}`);let r;try{r=gA(t)}catch{throw new le(`cannot stat --into path: ${t}`)}if(!r.isDirectory())throw new le(`--into must be a directory: ${t}`);return t}function EA(e){let t=_t(e,"package.json");if(!Ir(t))throw new le(`missing package.json in ${e} (refuse to scaffold non-app dir)`);try{let r=fA(t,"utf8");JSON.parse(r)}catch{throw new le(`invalid package.json in ${e}`)}}function Ls(e,t,r){if(!e||e.includes("\x00"))throw new le(`${r} is invalid`);if(mA(e))throw new le(`${r} must be a relative path (got absolute: ${e})`);try{return q(e,t,r)}catch(n){let i=n instanceof Error?n.message:String(n);throw new le(`${r} escapes app root: ${i}`)}}function $s(e,t){let r=e.split(/[/\\]/).join("/");if(!r||r.includes("\x00"))throw new le(`${t} is invalid`);return r}function AA(e,t){return hA(e,t).split(yA).join("/")}function di(e){return(e.replace(/\/+$/,"").split("/").pop()||"uibot-app").replace(/[^a-zA-Z0-9._-]/g,"-")}function PA(){let e=[pi(process.cwd(),"examples/templates"),pi(__uibotDir,"../../../../examples/templates")];for(let t of e)if(Ir(t))try{if(pA(t).some((r)=>r.endsWith(".yaml")||r.endsWith(".yml")))return t}catch{}return null}import{existsSync as Ms,mkdirSync as js,readFileSync as OA,writeFileSync as DA}from"node:fs";import{dirname as Dp,isAbsolute as Tp,join as qs,relative as TA,resolve as fi,sep as Fs}from"node:path";var Bs="uibot.link.v1",Us=qs(".uibot","link.json"),NA=qs(".uibot","spec.lock");class M extends Error{constructor(e){super(e);this.name="LinkPathError"}}function LA(e,t){let r=t.endsWith(Fs)?t:t+Fs;return e===t||e.startsWith(r)}function gi(e,t,r){if(!e||e.includes("\x00"))throw new M(`${r} is invalid`);if(Tp(e))throw new M(`${r} must be a relative path (got absolute: ${e})`);try{return q(e,t,r)}catch(n){let i=n instanceof Error?n.message:String(n);throw new M(`${r} escapes consumer root: ${i}`)}}function Vs(e,t){if(!e||e.includes("\x00"))throw new M("sourceDir is invalid");return Tp(e)?fi(e):fi(t,e)}function Er(e){if(!e||e.includes("\x00"))throw new M("controlPlaneUrl is invalid");let t;try{t=new URL(e.trim())}catch{throw new M(`controlPlaneUrl is not a valid URL: ${e}`)}if(t.protocol!=="http:"&&t.protocol!=="https:")throw new M(`controlPlaneUrl must be http(s) (got ${t.protocol})`);if(t.username||t.password)throw new M("controlPlaneUrl must not embed credentials; use UIBOT_CONTROL_PLANE_AUTH_BEARER / UIBOT_STUDIO_AUTH_BEARER");let r=t.pathname.replace(/\/+$/,"");return`${t.origin}${r==="/"?"":r}`}function Ar(e){let t=e.trim();if(!/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/.test(t))throw new M(`projectId invalid (expected /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/, got ${JSON.stringify(e)})`);return t}function mi(e){return qs(e,Us)}function hi(e){let t=mi(e);if(!Ms(t))throw new M(`missing ${Us}; run \`uibot link\` first`);let r=JSON.parse(OA(t,"utf8"));if(r.schema!==Bs)throw new M(`unsupported link schema: ${String(r.schema)}`);if(!r.consumerRoot||!r.specDir||!r.lockPath)throw new M("link.json missing required fields");if(r.controlPlaneUrl)r.controlPlaneUrl=Er(r.controlPlaneUrl);if(r.projectId)r.projectId=Ar(r.projectId);return r}function Hs(e){let t=mi(e.consumerRoot);js(Dp(t),{recursive:!0});let r={schema:Bs,consumerRoot:e.consumerRoot,specDir:e.specDir,...e.sourceDir?{sourceDir:e.sourceDir}:{},...e.controlPlaneUrl?{controlPlaneUrl:e.controlPlaneUrl}:{},...e.projectId?{projectId:e.projectId}:{},digest:e.digest,lockPath:e.lockPath,createdAt:e.createdAt,...e.updatedAt?{updatedAt:e.updatedAt}:{}};return DA(t,`${JSON.stringify(r,null,2)}
|
|
469
|
+
`,"utf8"),t}function Np(e){let t=e.log??((o)=>console.log(o)),r=e.error??((o)=>console.error(o)),n=fi(e.cwd??process.cwd()),i=e.lockPath??NA;try{gi(e.specDir,n,"specDir"),gi(i,n,"lockPath");let o=mi(n);if(Ms(o)&&!e.force){let g=`${Us} already exists (pass --force to overwrite)`;if(e.mode==="json")t(JSON.stringify({schema:"uibot.cli.error.v1",ok:!1,error:g}));else r(`uibot link: ${g}`);return{code:1}}let s;if(e.sourceDir)s=Vs(e.sourceDir,n);let a;if(e.controlPlaneUrl)a=Er(e.controlPlaneUrl);let c;if(e.projectId)c=Ar(e.projectId);let l=new Date().toISOString(),u=Ms(o)?hi(n):void 0,d={schema:Bs,consumerRoot:n,specDir:e.specDir.split(/[/\\]/).join("/"),...s?{sourceDir:s}:{},...a?{controlPlaneUrl:a}:{},...c?{projectId:c}:{},digest:u?.digest??null,lockPath:i.split(/[/\\]/).join("/"),createdAt:u?.createdAt??l,updatedAt:l},f=fi(n,d.specDir);if(!LA(f,n))throw new M("specDir escapes consumer root");js(f,{recursive:!0}),js(Dp(mi(n)),{recursive:!0});let p=Hs(d),m={ok:!0,path:p,consumerRoot:d.consumerRoot,specDir:d.specDir,sourceDir:d.sourceDir??null,controlPlaneUrl:d.controlPlaneUrl??null,projectId:d.projectId??null,digest:d.digest,lockPath:d.lockPath};if(e.mode==="json")t(JSON.stringify(m));else{if(t(`linked consumer → ${p}`),t(` specDir: ${d.specDir}`),d.sourceDir)t(` sourceDir: ${d.sourceDir}`);if(d.controlPlaneUrl)t(` controlPlaneUrl: ${d.controlPlaneUrl}`);if(d.projectId)t(` projectId: ${d.projectId}`);t(` digest: ${d.digest??"(unset — run uibot sync push|pull)"}`)}return{code:0,config:d}}catch(o){let s=o instanceof Error?o.message:String(o);if(e.mode==="json")t(JSON.stringify({schema:"uibot.cli.error.v1",ok:!1,error:s}));else r(`uibot link: ${s}`);return{code:1}}}function Ce(e){return gi(e.specDir,e.consumerRoot,"specDir")}function Lp(e){return gi(e.lockPath,e.consumerRoot,"lockPath")}function Mt(e,t){return TA(e,t).split(Fs).join("/")}import{createHash as $A}from"node:crypto";import{copyFileSync as _A,existsSync as Pr,mkdirSync as st,readdirSync as MA,readFileSync as _p,statSync as jA,unlinkSync as FA,writeFileSync as Mp}from"node:fs";import{dirname as Gs,join as qA,relative as BA,resolve as jp,sep as $p}from"node:path";var UA="uibot.spec.lock.v1",Fp="uibot.spec.sync.v1",VA="/api/studio/spec-sync",qp=/\.ya?ml$/i;function Ks(e,t){let r=t.endsWith($p)?t:t+$p;return e===t||e.startsWith(r)}function Si(e){if(!Pr(e))return[];let t=[],r=(n)=>{for(let i of MA(n,{withFileTypes:!0})){if(i.name==="node_modules"||i.name===".git")continue;let o=qA(n,i.name);if(i.isDirectory()){r(o);continue}if(i.isFile()&&qp.test(i.name))t.push(o)}};return r(e),t.sort((n,i)=>n.localeCompare(i))}function zs(e){return $A("sha256").update(e).digest("hex")}function HA(e){let t=Si(e).map((i)=>{let o=Mt(e,i),s=zs(_p(i));return{path:o,sha256:s}}),r=t.map((i)=>`${i.path}
|
|
401
470
|
${i.sha256}`).join(`
|
|
402
|
-
`);return{digest:`sha256:${
|
|
403
|
-
`,"utf8")}function On(e,t){if(!Zt(e)||!LE(e).isDirectory())throw new D(`source Spec directory not found: ${e}`);Be(t,{recursive:!0});let r=[];for(let n of Ln(e)){let i=ME(e,n),o=de(i,t,"sync");Be(Qo(o),{recursive:!0}),OE(n,o),r.push(dt(t,o))}return{copied:r,removedNone:!0}}function BE(e,t){Be(t,{recursive:!0});let r=[],n=new Set;for(let i of e){if(!i.path||i.path.includes("\x00")||typeof i.content!=="string")throw new D("remote Spec file entry is invalid");if(!kd.test(i.path))throw new D(`remote Spec path is not YAML: ${i.path}`);let o=de(i.path,t,"sync");Be(Qo(o),{recursive:!0}),Sd(o,i.content,"utf8");let s=dt(t,o);n.add(s),r.push(s)}for(let i of Ln(t)){let o=dt(t,i);if(!n.has(o))NE(i)}return{copied:r.sort((i,o)=>i.localeCompare(o))}}function UE(e){return Ln(e).map((t)=>{let r=bd(t,"utf8");return{path:dt(e,t),content:r,sha256:Jo(r)}})}function Tn(e,t){let r=t??e.sourceDir;if(!r)throw new D("no sourceDir: pass --from <dir> (push) / --to <dir> (pull), or re-run `uibot link --source-dir <dir>` (or configure --control-plane-url)");let n=Yo(r,e.consumerRoot),i={...e,sourceDir:n,updatedAt:new Date().toISOString()};return{sourceDir:n,config:i}}function VE(e=process.env){return e.UIBOT_CONTROL_PLANE_AUTH_BEARER?.trim()||e.UIBOT_STUDIO_AUTH_BEARER?.trim()||""||void 0}function KE(e,t){let r=Qt(e),n=t?Xt(t):"default",i=new URL(`${r}${FE}`);return i.searchParams.set("projectId",n),i.toString()}async function wd(e){let t={accept:"application/json"};if(e.bearer)t.authorization=`Bearer ${e.bearer}`;let r={method:e.method,headers:t};if(e.method==="PUT")t["content-type"]="application/json",r={...r,body:JSON.stringify(e.body)};let n;try{n=await e.fetchImpl(e.url,r)}catch(s){let a=s instanceof Error?s.message:String(s);throw new D(`control-plane request failed: ${a}`)}if(n.status<200||n.status>=300){let s="";try{let a=await n.text();s=a?`: ${a.slice(0,240)}`:""}catch{}throw new D(`control-plane Spec sync HTTP ${n.status}${s}`)}let i;try{i=await n.json()}catch{throw new D("control-plane Spec sync returned non-JSON body")}let o=i;if(!o||o.schema!==Cd||!Array.isArray(o.files))throw new D("control-plane Spec sync response missing uibot.spec.sync.v1 shape");return o}function xd(e,t){let r=t.env??process.env,n=t.controlPlaneUrl??e.controlPlaneUrl;if(!n)return null;let i=t.projectId??e.projectId,o=Qt(n),s={...e,controlPlaneUrl:o,...i?{projectId:Xt(i)}:{},updatedAt:new Date().toISOString()},a=VE(r);return{config:s,url:KE(o,s.projectId),...a?{bearer:a}:{}}}function De(e,t,r,n){let i=e.log??((s)=>console.log(s)),o=e.error??((s)=>console.error(s));if(e.mode==="json")i(JSON.stringify({ok:t,...r}));else if(t)for(let s of n)i(s);else o(`uibot sync: ${String(r.error??"failed")}`);return t?0:1}function pt(e){let t=ae(e),r=hd(e),{digest:n,files:i}=jE(t),o={schema:_E,digest:n,files:i,updatedAt:new Date().toISOString()};qE(r,o);let s={...e,digest:n,updatedAt:o.updatedAt};return Go(s),{config:s,lock:o}}async function vd(e={}){try{let t=Rd(e.cwd??process.cwd()),r=Dn(t);if(r={...r,consumerRoot:t},e.from){let{sourceDir:d,config:p}=Tn(r,e.from);if(!Wo(ae(p),p.consumerRoot))throw new D("specDir escapes consumer root");let f=ae(p),{copied:u}=On(d,f),{config:m,lock:g}=pt(p);return De(e,!0,{action:"push",mode:"local",from:d,to:f,copied:u,digest:g.digest,lockPath:m.lockPath},[`sync push: ${u.length} YAML file(s) ${d} \u2192 ${f}`,`digest: ${g.digest}`])}let n=xd(r,e);if(n&&!e.from){let d=e.fetchImpl??fetch,p=await wd({url:n.url,method:"GET",...n.bearer?{bearer:n.bearer}:{},fetchImpl:d}),f=ae(n.config);if(!Wo(f,n.config.consumerRoot))throw new D("specDir escapes consumer root");let{copied:u}=BE(p.files,f),{config:m,lock:g}=pt(n.config);return De(e,!0,{action:"push",mode:"remote",from:n.url,to:f,copied:u,remoteDigest:p.digest,digest:g.digest,lockPath:m.lockPath,projectId:p.projectId},[`sync push (remote): ${u.length} YAML file(s) ${n.url} \u2192 ${f}`,`digest: ${g.digest}`])}let{sourceDir:i,config:o}=Tn(r,e.from);if(!Wo(ae(o),o.consumerRoot))throw new D("specDir escapes consumer root");let s=ae(o),{copied:a}=On(i,s),{config:c,lock:l}=pt(o);return De(e,!0,{action:"push",mode:"local",from:i,to:s,copied:a,digest:l.digest,lockPath:c.lockPath},[`sync push: ${a.length} YAML file(s) ${i} \u2192 ${s}`,`digest: ${l.digest}`])}catch(t){let r=t instanceof Error?t.message:String(t);return De(e,!1,{action:"push",error:r},[])}}async function Ed(e={}){try{let t=Rd(e.cwd??process.cwd()),r=Dn(t);r={...r,consumerRoot:t};let n=e.to??e.from;if(n){let{sourceDir:f,config:u}=Tn(r,n),m=ae(u);if(!Zt(m))throw new D(`consumer specDir not found: ${m}`);Be(f,{recursive:!0});let{copied:g}=On(m,f),{config:h,lock:b}=pt(u);return De(e,!0,{action:"pull",mode:"local",from:m,to:f,copied:g,digest:b.digest,lockPath:h.lockPath},[`sync pull: ${g.length} YAML file(s) ${m} \u2192 ${f}`,`digest: ${b.digest}`])}let i=xd(r,e);if(i){let f=ae(i.config);if(!Zt(f))throw new D(`consumer specDir not found: ${f}`);let u=UE(f),m=e.fetchImpl??fetch,g=await wd({url:i.url,method:"PUT",...i.bearer?{bearer:i.bearer}:{},body:{schema:Cd,files:u},fetchImpl:m}),{config:h,lock:b}=pt(i.config);return De(e,!0,{action:"pull",mode:"remote",from:f,to:i.url,copied:u.map((S)=>S.path),remoteDigest:g.digest,digest:b.digest,lockPath:h.lockPath,projectId:g.projectId},[`sync pull (remote): ${u.length} YAML file(s) ${f} \u2192 ${i.url}`,`digest: ${b.digest}`])}let o=e.to??e.from,{sourceDir:s,config:a}=Tn(r,o),c=ae(a);if(!Zt(c))throw new D(`consumer specDir not found: ${c}`);Be(s,{recursive:!0});let{copied:l}=On(c,s),{config:d,lock:p}=pt(a);return De(e,!0,{action:"pull",mode:"local",from:c,to:s,copied:l,digest:p.digest,lockPath:d.lockPath},[`sync pull: ${l.length} YAML file(s) ${c} \u2192 ${s}`,`digest: ${p.digest}`])}catch(t){let r=t instanceof Error?t.message:String(t);return De(e,!1,{action:"pull",error:r},[])}}function Nn(e){let t={_:[]};for(let r=0;r<e.length;r+=1){let n=e[r];if(!n.startsWith("--")){t._.push(n);continue}let i=n.slice(2),o=i.indexOf("=");if(o>=0){t[i.slice(0,o)]=i.slice(o+1);continue}let s=e[r+1];if(s!==void 0&&!s.startsWith("--"))t[i]=s,r+=1;else t[i]=!0}return t}function I(e,t){let r=e[t];return typeof r==="string"?r:void 0}var Pd="uibot.resource.envelope.v1",$N=["resource-cli-invalid-mode","resource-cli-invalid-argument","resource-cli-internal-error"];class U extends Error{code;detail;constructor(e,t){super(`${e}: ${t}`);this.code=e;this.detail=t;this.name="ResourceCliError"}}function Xo(e){return{id:e.id,kind:e.kind,title:e.title,description:e.description,...e.category?{category:e.category}:{},...e.tags.length?{tags:e.tags}:{},...e.capabilities.length?{capabilities:e.capabilities}:{},...e.dependencies.length?{dependencies:e.dependencies}:{},source:e.source,maturity:e.receipt.maturity,receiptLevel:e.receipt.level,...e.receipt.evidence.length?{evidence:e.receipt.evidence}:{}}}function HE(e){return{id:e.resource.id,score:e.score,reasons:e.reasons,resource:Xo(e.resource)}}function Ad(){return typeof crypto.randomUUID==="function"?crypto.randomUUID():`resource-${Date.now().toString(36)}`}function Dd(e,t){return{dense:t,encoding:t?"dense-v1":"full",resourceIndexSchemaVersion:e.manifest().schemaVersion}}function zE(e,t,r,n){return{schemaVersion:Pd,requestId:r.requestId??Ad(),command:e,ok:!0,data:t,meta:Dd(r.queryService,n)}}function YE(e,t,r,n){let i=t instanceof H||t instanceof U?t.code:"resource-cli-internal-error",o=t instanceof H||t instanceof U?t.detail:"resource command failed";return{schemaVersion:Pd,requestId:r.requestId??Ad(),command:e,ok:!1,error:{code:i,message:`${i}: ${o}`,detail:o},meta:Dd(r.queryService,n)}}function $n(e,t){let r=e[t];if(r===void 0)return;if(typeof r!=="string")throw new U("resource-cli-invalid-argument",`--${t} requires a value`);let n=r.split(",").map((i)=>i.trim()).filter(Boolean);if(n.length===0)throw new U("resource-cli-invalid-argument",`--${t} is empty`);return n}function Id(e,t,r){let n=$n(e,t);if(!n)return;for(let i of n)if(!r.includes(i))throw new U("resource-cli-invalid-argument",`--${t}=${i}; expected one of ${r.join(",")}`);return n}function GE(e){let t=Id(e,"kind",ir),r=$n(e,"tag"),n=$n(e,"category"),i=$n(e,"capability"),o=Id(e,"maturity",gt),s=I(e,"limit"),a;if(e.limit!==void 0){if(!s||!/^\d+$/.test(s)||Number(s)<=0)throw new U("resource-cli-invalid-argument",`--limit=${s??"<missing>"}; expected a positive integer`);a=Number(s)}let c=e._.join(" ").trim();return{...c?{text:c}:{},...t?{kinds:t}:{},...r?{tags:r}:{},...n?{categories:n}:{},...i?{capabilities:i}:{},...o?{maturities:o}:{},...a!==void 0?{limit:a}:{}}}function WE(e,t,r){if(e==="manifest"){let n=t;for(let i of n.index.resources)r(`${i.id} ${i.kind} ${i.receipt.maturity} ${i.title}`);return}if(e==="search"){let n=t;for(let i of n.matches)r(`${i.resource.id} ${i.score} ${i.reasons.map((o)=>o.code).join(",")} ${i.resource.title}`);return}r(JSON.stringify(t,null,2))}async function Zo(e,t,r){let n=Nn(t),i=r.log??((d)=>console.log(d)),o=r.errorLog??((d)=>console.error(d)),s=n.dense,a=s===!0,c=I(n,"mode"),l=c??"text";try{let d=Ke.find((g)=>g.name===e),p=new Set(["mode","dense",...d.options.map((g)=>g.name)]),f=Object.keys(n).find((g)=>g!=="_"&&!p.has(g));if(f)throw new U("resource-cli-invalid-argument",`unsupported flag --${f} for ${e}`);if(n.mode!==void 0&&c===void 0)throw new U("resource-cli-invalid-mode","--mode requires text or json");if(l!=="text"&&l!=="json")throw new U("resource-cli-invalid-mode",`${l}; expected text or json`);if(s!==void 0&&s!==!0)throw new U("resource-cli-invalid-argument","--dense does not take a value");if(r.sourceError)throw r.sourceError;let u;switch(e){case"manifest":{if(n._.length>0)throw new U("resource-cli-invalid-argument","manifest does not accept positionals");let g=r.queryService.manifest();u={operations:Ke,index:a?{schemaVersion:g.schemaVersion,resources:g.resources.map(Xo),aliasLookup:Object.entries(g.aliases)}:g};break}case"search":{let g=r.queryService.search(GE(n));u={matches:a?g.map(HE):g};break}case"get":{if(n._.length!==1)throw new U("resource-cli-invalid-argument","get requires exactly one id or quoted alias");let g=r.queryService.get(n._[0]);u={resource:a?Xo(g):g};break}case"docs":case"examples":case"install-plan":{if(n._.length!==1)throw new U("resource-cli-invalid-argument",`${e} requires one resource id`);let g=n._[0],h=I(n,"locale")??"zh";if(e==="docs"&&h!=="zh"&&h!=="en")throw new U("resource-cli-invalid-argument","--locale requires zh or en");if(!(e==="docs"?r.queryService.docs:e==="examples"?r.queryService.examples:r.queryService.installPlan))throw new U("resource-cli-invalid-argument",`${e} is unavailable in this resource source`);let S=I(n,"page"),k=S===void 0?void 0:Number(S);if(n.page!==void 0&&(!Number.isSafeInteger(k)||(k??0)<1))throw new U("resource-cli-invalid-argument","--page requires a positive integer");u=e==="docs"?r.queryService.docs?.(g,h,k):e==="examples"?r.queryService.examples?.(g,k):r.queryService.installPlan?.(g);break}case"build":{u={plan:r.queryService.build(n._)};break}}let m=zE(e,u,r,a);if(l==="json")i(JSON.stringify(m));else WE(e,u,i);return 0}catch(d){let p=d instanceof Error?d:Error(String(d)),f=YE(e,p,r,a);if(l==="json"||c!==void 0)i(JSON.stringify(f));else o(f.error.message);return 1}}import{createHash as JE}from"crypto";import{existsSync as Od,readFileSync as QE}from"fs";import{resolve as ge}from"path";function Td(e){for(let t of e)if(Od(t))return t;return null}function es(e=process.cwd()){return Td([ge(e,"examples/templates"),ge(import.meta.dir,"templates"),ge(import.meta.dir,"../../../examples/templates")])}function ts(e=process.cwd()){return Td([ge(e,"examples/shells"),ge(import.meta.dir,"shells"),ge(import.meta.dir,"../../../examples/shells")])}function XE(e){let t={};for(let r of e)for(let[n,i]of Object.entries(r)){if(t[n])throw Error(`duplicate built-in catalog source id: ${n}`);t[n]=i}return t}async function Ld(e){if(e){let d=new URL(e);if(d.protocol!=="https:"&&!(d.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(d.hostname)))throw Error("public-resource-source-must-use-https");let p=await fetch(d,{signal:AbortSignal.timeout(1e4),redirect:"error"});if(!p.ok)throw Error(`public-resource-source-http-${p.status}`);let f=p.body?.getReader();if(!f)throw Error("public-resource-source-empty");let u=[],m=0;try{for(;;){let{value:x,done:O}=await f.read();if(O)break;if(m+=x.byteLength,m>16777216)throw Error("public-resource-source-too-large");u.push(x)}}finally{await f.cancel()}let g=new Uint8Array(m),h=0;for(let x of u)g.set(x,h),h+=x.byteLength;let b=new TextDecoder("utf-8",{fatal:!0}).decode(g),S=JSON.parse(b);lr(S);let{release:k,schemaVersion:v,...E}=S;if(JE("sha256").update(JSON.stringify(E)).digest("hex")!==S.release.sourceHash)throw Error("public-resource-source-hash-mismatch");return Hn(S)}let t=[ge(import.meta.dir,"resources/bundle.json"),ge(import.meta.dir,"../../../public/resources/bundle.json")].find(Od);if(t){let d=JSON.parse(QE(t,"utf8"));return lr(d),Hn(d)}let[r,n,i]=await Promise.all([import("@uibot/blocks-shadcn"),import("@uibot/blocks-studio"),Promise.resolve().then(() => (Rn(),{}))]),o=[],s=es();if(s)o.push({dir:s});let a=ts();if(a)o.push({dir:a,defaultLevel:"L3",defaultCategory:"feature",extraKeywords:["sidebar","app-shell","shell"]});let c=ft(o),l=Object.fromEntries(c.map((d)=>[d.name,d.templateContract]));return cr(us({components:XE([r.CATALOG_ENTRIES,n.STUDIO_CATALOG_ENTRIES]),templates:l,designGuides:Sn(ge(import.meta.dir,"../../design-md/content")),examples:ls(l)}))}async function ZE(){let[e,t,r,n]=await Promise.all([import("@uibot/blocks-shadcn"),import("@uibot/blocks-shadcn/registry-source"),import("@uibot/blocks-studio"),import("@uibot/blocks-studio/registry-source")]);return ss([{sourceDir:t.SOURCE_DIR,blockFileMap:t.BLOCK_FILE,catalog:e.CATALOG_ENTRIES},{sourceDir:n.SOURCE_DIR,blockFileMap:n.BLOCK_FILE,catalog:r.STUDIO_CATALOG_ENTRIES}])}function ee(e,t){if(I(e,"mode")==="json")console.log(JSON.stringify({schema:"uibot.cli.error.v1",ok:!1,error:t}));else console.error(t);return 1}async function Nd(e){if(e[0]==="resource")return Nd(e.slice(1));let[t,...r]=e,n=Nn(r),i=I(n,"registry");switch(t){case"manifest":case"search":case"get":case"build":case"docs":case"examples":case"install-plan":{let o=I(n,"source"),s=r.indexOf("--source"),a=s>=0?r.filter((c,l)=>l!==s&&l!==s+1):r.filter((c)=>!c.startsWith("--source="));try{let c=await Ld(o);return Zo(t,a,{queryService:c})}catch(c){return Zo(t,a,{queryService:{manifest:()=>({schemaVersion:"uibot.resource.index.v1",resources:[],aliases:{}}),search:()=>[],get:()=>{throw Error("unavailable")},build:()=>{throw Error("unavailable")}},sourceError:c instanceof Error?c:Error("resource source unavailable")})}}case"list":return await Es({...i?{registry:i}:{}}),0;case"add":{let o=n._[0];if(!o)return ee(n,"uibot add: missing artifact <name>");return await vs(o,{...i?{registry:i}:{},workspaceRoot:I(n,"cwd")??process.cwd()}),0}case"publish":{let o=await ZE(),s=[],a=es();if(a)s.push({dir:a});let c=ts();if(c)s.push({dir:c,defaultLevel:"L3",defaultCategory:"feature",extraKeywords:["sidebar","app-shell","shell"]});let l=ft(s);return await Ps({out:I(n,"out")??"dist/registry",manifestName:I(n,"name")??"uibot",sources:o,...l.length?{templates:l}:{}}),0}case"design-md":{if(n._[0]!=="sync")return ee(n,"uibot design-md: expected subcommand 'sync'");let s=I(n,"from");if(!s)return ee(n,"uibot design-md sync: missing --from <github:owner/repo|https-url>");let c=I(n,"mode")==="json"?"json":"text",l=I(n,"license"),{code:d}=await Uu({from:s,cwd:I(n,"cwd")??process.cwd(),mode:c,...l?{license:l}:{},dryRun:n["dry-run"]===!0});return d}case"regressions":{if(n._[0]!=="reverify")return ee(n,"uibot regressions: expected subcommand 'reverify'");let s=I(n,"mode")==="json"?"json":"text",a=I(n,"skill"),{code:c}=await ed({cwd:I(n,"cwd")??process.cwd(),mode:s,...a?{skillId:a}:{}});return c}case"skills":{let o=n._[0],s=n._[1],a=I(n,"mode")==="json"?"json":"text",c=I(n,"cwd")??process.cwd();if(o==="promote"){if(!s)return ee(n,"uibot skills promote: missing <id>");return id(s,{cwd:c,mode:a})}if(o==="rollback"){if(!s)return ee(n,"uibot skills rollback: missing <id>");return od(s,{cwd:c,mode:a})}return ee(n,"uibot skills: expected promote|rollback <id>")}case"project":{let o=n._[0],s=n._[1];if(o!=="export"||!s)return ee(n,"uibot project: expected export <dir>");let a=I(n,"mode")==="json"?"json":"text";return sd(s,{cwd:I(n,"cwd")??process.cwd(),mode:a})}case"link":{let o=I(n,"spec-dir")??n._[0];if(!o||typeof o!=="string")return ee(n,"uibot link: missing --spec-dir <relative-dir> (or positional <spec-dir>)");let s=I(n,"source-dir"),a=I(n,"control-plane-url"),c=I(n,"project-id"),l=I(n,"lock-path"),{code:d}=md({cwd:I(n,"cwd")??process.cwd(),specDir:o,...s?{sourceDir:s}:{},...a?{controlPlaneUrl:a}:{},...c?{projectId:c}:{},...l?{lockPath:l}:{},force:n.force===!0,mode:I(n,"mode")==="json"?"json":"text"});return d}case"sync":{let o=n._[0];if(o!=="push"&&o!=="pull")return ee(n,"uibot sync: expected subcommand 'push' or 'pull'");let s=I(n,"mode")==="json"?"json":"text",a=I(n,"cwd")??process.cwd(),c=I(n,"from"),l=I(n,"to"),d=I(n,"control-plane-url"),p=I(n,"project-id");if(o==="push")return vd({cwd:a,mode:s,...c?{from:c}:{},...d?{controlPlaneUrl:d}:{},...p?{projectId:p}:{}});return Ed({cwd:a,mode:s,...l?{to:l}:{},...c&&!l?{from:c}:{},...d?{controlPlaneUrl:d}:{},...p?{projectId:p}:{}})}case"doctor":{let o=I(n,"registry");return ad({cwd:I(n,"cwd")??process.cwd(),mode:I(n,"mode")==="json"?"json":"text",...o?{registry:o}:{}})}case"init":{let o=I(n,"into");if(o){let c=I(n,"spec-path"),l=I(n,"mount-path"),{code:d}=pd({into:o,...c?{specPath:c}:{},...l?{mountPath:l}:{},force:n.force===!0,mode:I(n,"mode")==="json"?"json":"text"});return d}let s=n._[0];if(!s)return ee(n,"uibot init: missing <dir> (or use --into <existing-app>)");let a=I(n,"template");return await dd({dir:s,...a?{template:a}:{}}),0}case"help":case"--help":case"-h":case void 0:return console.log(Jn()),0;default:{let o=`uibot: unknown command '${t}'`;if(I(n,"mode")==="json")return ee(n,o);return console.error(`${o}
|
|
404
|
-
`),console.error(
|
|
471
|
+
`);return{digest:`sha256:${zs(r||"empty")}`,files:t}}function KA(e,t){st(Gs(e),{recursive:!0}),Mp(e,`${JSON.stringify(t,null,2)}
|
|
472
|
+
`,"utf8")}function yi(e,t){if(!Pr(e)||!jA(e).isDirectory())throw new M(`source Spec directory not found: ${e}`);st(t,{recursive:!0});let r=[];for(let n of Si(e)){let i=BA(e,n),o=q(i,t,"sync");st(Gs(o),{recursive:!0}),_A(n,o),r.push(Mt(t,o))}return{copied:r,removedNone:!0}}function zA(e,t){st(t,{recursive:!0});let r=[],n=new Set;for(let i of e){if(!i.path||i.path.includes("\x00")||typeof i.content!=="string")throw new M("remote Spec file entry is invalid");if(!qp.test(i.path))throw new M(`remote Spec path is not YAML: ${i.path}`);let o=q(i.path,t,"sync");st(Gs(o),{recursive:!0}),Mp(o,i.content,"utf8");let s=Mt(t,o);n.add(s),r.push(s)}for(let i of Si(t)){let o=Mt(t,i);if(!n.has(o))FA(i)}return{copied:r.sort((i,o)=>i.localeCompare(o))}}function GA(e){return Si(e).map((t)=>{let r=_p(t,"utf8");return{path:Mt(e,t),content:r,sha256:zs(r)}})}function bi(e,t){let r=t??e.sourceDir;if(!r)throw new M("no sourceDir: pass --from <dir> (push) / --to <dir> (pull), or re-run `uibot link --source-dir <dir>` (or configure --control-plane-url)");let n=Vs(r,e.consumerRoot),i={...e,sourceDir:n,updatedAt:new Date().toISOString()};return{sourceDir:n,config:i}}function YA(e=process.env){return e.UIBOT_CONTROL_PLANE_AUTH_BEARER?.trim()||e.UIBOT_STUDIO_AUTH_BEARER?.trim()||""||void 0}function JA(e,t){let r=Er(e),n=t?Ar(t):"default",i=new URL(`${r}${VA}`);return i.searchParams.set("projectId",n),i.toString()}async function Bp(e){let t={accept:"application/json"};if(e.bearer)t.authorization=`Bearer ${e.bearer}`;let r={method:e.method,headers:t};if(e.method==="PUT")t["content-type"]="application/json",r={...r,body:JSON.stringify(e.body)};let n;try{n=await e.fetchImpl(e.url,r)}catch(s){let a=s instanceof Error?s.message:String(s);throw new M(`control-plane request failed: ${a}`)}if(n.status<200||n.status>=300){let s="";try{let a=await n.text();s=a?`: ${a.slice(0,240)}`:""}catch{}throw new M(`control-plane Spec sync HTTP ${n.status}${s}`)}let i;try{i=await n.json()}catch{throw new M("control-plane Spec sync returned non-JSON body")}let o=i;if(!o||o.schema!==Fp||!Array.isArray(o.files))throw new M("control-plane Spec sync response missing uibot.spec.sync.v1 shape");return o}function Up(e,t){let r=t.env??process.env,n=t.controlPlaneUrl??e.controlPlaneUrl;if(!n)return null;let i=t.projectId??e.projectId,o=Er(n),s={...e,controlPlaneUrl:o,...i?{projectId:Ar(i)}:{},updatedAt:new Date().toISOString()},a=YA(r);return{config:s,url:JA(o,s.projectId),...a?{bearer:a}:{}}}function Ge(e,t,r,n){let i=e.log??((s)=>console.log(s)),o=e.error??((s)=>console.error(s));if(e.mode==="json")i(JSON.stringify({ok:t,...r}));else if(t)for(let s of n)i(s);else o(`uibot sync: ${String(r.error??"failed")}`);return t?0:1}function jt(e){let t=Ce(e),r=Lp(e),{digest:n,files:i}=HA(t),o={schema:UA,digest:n,files:i,updatedAt:new Date().toISOString()};KA(r,o);let s={...e,digest:n,updatedAt:o.updatedAt};return Hs(s),{config:s,lock:o}}async function Vp(e={}){try{let t=jp(e.cwd??process.cwd()),r=hi(t);if(r={...r,consumerRoot:t},e.from){let{sourceDir:u,config:d}=bi(r,e.from);if(!Ks(Ce(d),d.consumerRoot))throw new M("specDir escapes consumer root");let f=Ce(d),{copied:p}=yi(u,f),{config:m,lock:g}=jt(d);return Ge(e,!0,{action:"push",mode:"local",from:u,to:f,copied:p,digest:g.digest,lockPath:m.lockPath},[`sync push: ${p.length} YAML file(s) ${u} → ${f}`,`digest: ${g.digest}`])}let n=Up(r,e);if(n&&!e.from){let u=e.fetchImpl??fetch,d=await Bp({url:n.url,method:"GET",...n.bearer?{bearer:n.bearer}:{},fetchImpl:u}),f=Ce(n.config);if(!Ks(f,n.config.consumerRoot))throw new M("specDir escapes consumer root");let{copied:p}=zA(d.files,f),{config:m,lock:g}=jt(n.config);return Ge(e,!0,{action:"push",mode:"remote",from:n.url,to:f,copied:p,remoteDigest:d.digest,digest:g.digest,lockPath:m.lockPath,projectId:d.projectId},[`sync push (remote): ${p.length} YAML file(s) ${n.url} → ${f}`,`digest: ${g.digest}`])}let{sourceDir:i,config:o}=bi(r,e.from);if(!Ks(Ce(o),o.consumerRoot))throw new M("specDir escapes consumer root");let s=Ce(o),{copied:a}=yi(i,s),{config:c,lock:l}=jt(o);return Ge(e,!0,{action:"push",mode:"local",from:i,to:s,copied:a,digest:l.digest,lockPath:c.lockPath},[`sync push: ${a.length} YAML file(s) ${i} → ${s}`,`digest: ${l.digest}`])}catch(t){let r=t instanceof Error?t.message:String(t);return Ge(e,!1,{action:"push",error:r},[])}}async function Hp(e={}){try{let t=jp(e.cwd??process.cwd()),r=hi(t);r={...r,consumerRoot:t};let n=e.to??e.from;if(n){let{sourceDir:f,config:p}=bi(r,n),m=Ce(p);if(!Pr(m))throw new M(`consumer specDir not found: ${m}`);st(f,{recursive:!0});let{copied:g}=yi(m,f),{config:h,lock:y}=jt(p);return Ge(e,!0,{action:"pull",mode:"local",from:m,to:f,copied:g,digest:y.digest,lockPath:h.lockPath},[`sync pull: ${g.length} YAML file(s) ${m} → ${f}`,`digest: ${y.digest}`])}let i=Up(r,e);if(i){let f=Ce(i.config);if(!Pr(f))throw new M(`consumer specDir not found: ${f}`);let p=GA(f),m=e.fetchImpl??fetch,g=await Bp({url:i.url,method:"PUT",...i.bearer?{bearer:i.bearer}:{},body:{schema:Fp,files:p},fetchImpl:m}),{config:h,lock:y}=jt(i.config);return Ge(e,!0,{action:"pull",mode:"remote",from:f,to:i.url,copied:p.map((S)=>S.path),remoteDigest:g.digest,digest:y.digest,lockPath:h.lockPath,projectId:g.projectId},[`sync pull (remote): ${p.length} YAML file(s) ${f} → ${i.url}`,`digest: ${y.digest}`])}let o=e.to??e.from,{sourceDir:s,config:a}=bi(r,o),c=Ce(a);if(!Pr(c))throw new M(`consumer specDir not found: ${c}`);st(s,{recursive:!0});let{copied:l}=yi(c,s),{config:u,lock:d}=jt(a);return Ge(e,!0,{action:"pull",mode:"local",from:c,to:s,copied:l,digest:d.digest,lockPath:u.lockPath},[`sync pull: ${l.length} YAML file(s) ${c} → ${s}`,`digest: ${d.digest}`])}catch(t){let r=t instanceof Error?t.message:String(t);return Ge(e,!1,{action:"pull",error:r},[])}}var zp="uibot.resource.envelope.v1";class U extends Error{code;detail;constructor(e,t){super(`${e}: ${t}`);this.code=e;this.detail=t;this.name="ResourceCliError"}}function Ys(e){return{id:e.id,kind:e.kind,title:e.title,description:e.description,...e.category?{category:e.category}:{},...e.agentKit?{agentKit:e.agentKit}:{},...e.tags.length?{tags:e.tags}:{},...e.capabilities.length?{capabilities:e.capabilities}:{},...e.dependencies.length?{dependencies:e.dependencies}:{},...e.solution?{solution:e.solution}:{},source:e.source,maturity:e.receipt.maturity,receiptLevel:e.receipt.level,...e.receipt.evidence.length?{evidence:e.receipt.evidence}:{}}}function WA(e){return{id:e.resource.id,score:e.score,reasons:e.reasons,resource:Ys(e.resource)}}function Gp(){return typeof crypto.randomUUID==="function"?crypto.randomUUID():`resource-${Date.now().toString(36)}`}function Yp(e,t){return{dense:t,encoding:t?"dense-v1":"full",resourceIndexSchemaVersion:e.manifest().schemaVersion}}function QA(e,t,r,n){return{schemaVersion:zp,requestId:r.requestId??Gp(),command:e,ok:!0,data:t,meta:Yp(r.queryService,n)}}function XA(e,t,r,n){let i=t instanceof Z||t instanceof U?t.code:"resource-cli-internal-error",o=t instanceof Z||t instanceof U?t.detail:"resource command failed";return{schemaVersion:zp,requestId:r.requestId??Gp(),command:e,ok:!1,error:{code:i,message:`${i}: ${o}`,detail:o},meta:Yp(r.queryService,n)}}function Or(e,t){let r=e[t];if(r===void 0)return;if(typeof r!=="string")throw new U("resource-cli-invalid-argument",`--${t} requires a value`);let n=r.split(",").map((i)=>i.trim()).filter(Boolean);if(n.length===0)throw new U("resource-cli-invalid-argument",`--${t} is empty`);return n}function Kp(e,t,r){let n=Or(e,t);if(!n)return;for(let i of n)if(!r.includes(i))throw new U("resource-cli-invalid-argument",`--${t}=${i}; expected one of ${r.join(",")}`);return n}function ZA(e){let t=Kp(e,"kind",Lr),r=Or(e,"tag"),n=Or(e,"category"),i=Or(e,"capability"),o=Kp(e,"maturity",qt),s=v(e,"limit"),a;if(e.limit!==void 0){if(!s||!/^\d+$/.test(s)||Number(s)<=0)throw new U("resource-cli-invalid-argument",`--limit=${s??"<missing>"}; expected a positive integer`);a=Number(s)}let c=e._.join(" ").trim();return{...c?{text:c}:{},...t?{kinds:t}:{},...r?{tags:r}:{},...Object.fromEntries([["function","functions"],["scenario","scenarios"],["unit","units"],["industry","industries"]].flatMap(([l,u])=>{let d=Or(e,l);return d?[[u,d]]:[]})),...n?{categories:n}:{},...i?{capabilities:i}:{},...o?{maturities:o}:{},...a!==void 0?{limit:a}:{}}}function eP(e,t,r){if(e==="manifest"){let n=t;for(let i of n.index.resources)r(`${i.id} ${i.kind} ${i.receipt.maturity} ${i.title}`);return}if(e==="search"){let n=t;for(let i of n.matches)r(`${i.resource.id} ${i.score} ${i.reasons.map((o)=>o.code).join(",")} ${i.resource.title}`);return}r(JSON.stringify(t,null,2))}async function Js(e,t,r){let n=de(t),i=r.log??((u)=>console.log(u)),o=r.errorLog??((u)=>console.error(u)),s=n.dense,a=s===!0,c=v(n,"mode"),l=c??"text";try{let u=lt.find((g)=>g.name===e),d=new Set([...e==="install-plan"?["export","verify","snapshot"]:[],"mode","dense",...u.options.map((g)=>g.name)]),f=Object.keys(n).find((g)=>g!=="_"&&!d.has(g));if(f)throw new U("resource-cli-invalid-argument",`unsupported flag --${f} for ${e}`);if(n.mode!==void 0&&c===void 0)throw new U("resource-cli-invalid-mode","--mode requires text or json");if(l!=="text"&&l!=="json")throw new U("resource-cli-invalid-mode",`${l}; expected text or json`);if(s!==void 0&&s!==!0)throw new U("resource-cli-invalid-argument","--dense does not take a value");if(r.sourceError)throw r.sourceError;let p;switch(e){case"manifest":{if(n._.length>0)throw new U("resource-cli-invalid-argument","manifest does not accept positionals");let g=r.queryService.manifest();p={operations:lt,index:a?{schemaVersion:g.schemaVersion,resources:g.resources.map(Ys),aliasLookup:Object.entries(g.aliases)}:g};break}case"search":{let g=r.queryService.search(ZA(n));p={matches:a?g.map(WA):g};break}case"get":{if(n._.length!==1)throw new U("resource-cli-invalid-argument","get requires exactly one id or quoted alias");let g=r.queryService.get(n._[0]);p={resource:a?Ys(g):g};break}case"docs":case"examples":case"install-plan":{if(n._.length!==1)throw new U("resource-cli-invalid-argument",`${e} requires one resource id`);let g=n._[0],h=v(n,"snapshot");if(n.snapshot!==void 0&&(!h||!/^[a-f0-9]{64}$/.test(h)))throw new U("resource-cli-invalid-argument","--snapshot requires a SHA-256 identity");let y=(D,C)=>{let j=D;if(h&&(C?j.snapshot?.snapshotId:j.snapshotId)!==h)throw new U("resource-cli-invalid-argument","snapshot-identity-mismatch")},S=n.export!==void 0?"export":n.verify!==void 0?"verify":void 0;if(n.export!==void 0&&n.verify!==void 0)throw new U("resource-cli-invalid-argument","choose --export or --verify");if(S&&(!v(n,S)||!r.snapshotAction))throw new U("resource-cli-invalid-argument",`--${S} requires a directory and CLI snapshot support`);if(S==="verify"){try{p=await r.snapshotAction(S,v(n,S),g,null),y(p,!1)}catch(D){throw new U("resource-cli-invalid-argument",D instanceof Error?D.message:"snapshot verification failed")}break}let k=v(n,"locale")??"zh";if(e==="docs"&&k!=="zh"&&k!=="en")throw new U("resource-cli-invalid-argument","--locale requires zh or en");if(!(e==="docs"?r.queryService.docs:e==="examples"?r.queryService.examples:r.queryService.installPlan))throw new U("resource-cli-invalid-argument",`${e} is unavailable in this resource source`);let P=v(n,"page"),O=P===void 0?void 0:Number(P);if(n.page!==void 0&&(!Number.isSafeInteger(O)||(O??0)<1))throw new U("resource-cli-invalid-argument","--page requires a positive integer");if(p=e==="docs"?r.queryService.docs?.(g,k,O):e==="examples"?r.queryService.examples?.(g,O):r.queryService.installPlan?.(g),e==="install-plan")y(p,!0);if(S==="export")try{p=await r.snapshotAction(S,v(n,S),g,p)}catch(D){throw new U("resource-cli-invalid-argument",D instanceof Error?D.message:"snapshot export failed")}break}case"build":{p={plan:r.queryService.build(n._)};break}}let m=QA(e,p,r,a);if(l==="json")i(JSON.stringify(m));else eP(e,p,i);return 0}catch(u){let d=u instanceof Error?u:Error(String(u)),f=XA(e,d,r,a);if(l==="json"||c!==void 0)i(JSON.stringify(f));else o(f.error.message);return 1}}import{existsSync as tP,lstatSync as Qp,mkdirSync as rP,readFileSync as Ws,writeFileSync as nP}from"node:fs";import{createServer as iP}from"node:http";import{once as oP}from"node:events";import{resolve as Xp,dirname as wi}from"node:path";var Zp=new TextDecoder("utf-8",{fatal:!0});function Jp(e){try{return Qp(e)}catch(t){if(t.code==="ENOENT")return;throw t}}async function Wp(e){if(e.protocol==="file:"){let a=Ws(e);if(a.length>16777216)throw Error("snapshot-file-too-large");return a}if(e.protocol!=="https:"&&!(e.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(e.hostname)))throw Error("snapshot-source-must-use-https-or-loopback");let t=await fetch(e,{signal:AbortSignal.timeout(1e4),redirect:"error"});if(!t.ok)throw Error(`snapshot-source-http-${t.status}`);let r=t.body?.getReader();if(!r)throw Error("snapshot-source-empty");let n=[],i=0;try{for(;;){let{done:a,value:c}=await r.read();if(a)break;if(i+=c.byteLength,i>16777216)throw Error("snapshot-file-too-large");n.push(c)}}finally{await r.cancel()}let o=new Uint8Array(i),s=0;for(let a of n)o.set(a,s),s+=a.byteLength;return o}function ef(e,t){if(e.byteLength>16777216)throw Error("snapshot-file-too-large");let r=JSON.parse(Zp.decode(e));return Oi(r,t),r}function tf(e,t){let r=Object.hasOwn(e.resources,t)?e.resources[t]:void 0;if(!r)throw Error(`snapshot-resource-unavailable: ${t}`);return[...r.closure.map((n)=>e.items[n].path),...e.licenseFiles.map((n)=>n.path)]}async function rf(e,t,r){if(!e.snapshot)throw Error("snapshot-resource-unavailable");let n=new URL(e.snapshot.manifestPath,t),i=await Wp(n),o=ef(i,e.snapshot.snapshotId),{snapshotId:s,manifestPath:a,...c}=e.snapshot;if(o.bundleHash!==e.release.sourceHash||be(o.resources[e.resourceId])!==be(c))throw Error("snapshot-bundle-mismatch");let l=new Map,u=i.byteLength;for(let m of tf(o,e.resourceId)){let g=await Wp(new URL(m,n));if(u+=g.byteLength,u>134217728)throw Error("snapshot-total-budget-exceeded");l.set(m,g)}let d=Di(o,e.resourceId,l,e.snapshot.snapshotId);l.set("snapshot.json",i),l.set("selection.json",new TextEncoder().encode(be({schemaVersion:"uibot.distribution.selection.v1",resourceId:e.resourceId,snapshotId:o.snapshotId})));let f=Xp(r),p=[...l].map(([m,g])=>{let h=q(m,f,"distribution-snapshot"),y=wi(h);for(;;){let k=Jp(y);if(k&&(!k.isDirectory()||k.isSymbolicLink()))throw Error("snapshot-invalid-destination");if(y===f||y===wi(y))break;y=wi(y)}let S=Jp(h);if(S&&(!S.isFile()||S.size!==g.byteLength||gt(Ws(h))!==gt(g)))throw Error(`snapshot-local-file-conflict: ${m}`);return{target:h,bytes:g}});for(let{target:m,bytes:g}of p)if(rP(wi(m),{recursive:!0}),!tP(m))nP(m,g,{flag:"wx"});return{...d,directory:f,entrypoints:o.resources[e.resourceId].entrypoints}}function Qs(e,t){let r=Xp(e),n=(u)=>{let d=q(u,r,"distribution-snapshot"),f=Qp(d);if(!f.isFile()||f.size>16777216)throw Error("snapshot-invalid-saved-file");return Ws(d)},i=JSON.parse(Zp.decode(n("selection.json")));if(i.schemaVersion!=="uibot.distribution.selection.v1"||t!==void 0&&t!==i.resourceId)throw Error("snapshot-selection-mismatch");let o=n("snapshot.json"),s=ef(o,i.snapshotId),a=new Map,c=o.length;for(let u of tf(s,i.resourceId)){let d=n(u);if(c+=d.length,c>134217728)throw Error("snapshot-total-budget-exceeded");a.set(u,d)}return{...Di(s,i.resourceId,a,i.snapshotId),entrypoints:s.resources[i.resourceId].entrypoints,files:a}}async function nf(e,t){let r=Qs(e),n=iP((s,a)=>{if(!["GET","HEAD"].includes(s.method??"")){a.writeHead(405).end();return}let c=r.files.get((s.url??"").split("?")[0].slice(1));if(!c){a.writeHead(404).end();return}a.writeHead(200,{"content-type":"application/json","cache-control":"no-store"}),a.end(s.method==="HEAD"?void 0:c)});n.listen(t,"127.0.0.1"),await oP(n,"listening");let i=n.address();if(!i||typeof i==="string")throw Error("snapshot-server-address-unavailable");let o=`http://127.0.0.1:${i.port}`;return{server:n,snapshotId:r.snapshotId,registry:{"@uibot":`${o}/r/{name}.json`},command:`bunx shadcn@4.23.0 add ${r.entrypoints.map((s)=>`${o}/r/${s}.json`).join(" ")}`}}async function sP(){let[e,t,r,n]=await Promise.all([import("@uibot/blocks-shadcn"),import("@uibot/blocks-shadcn/registry-source"),import("@uibot/blocks-studio"),import("@uibot/blocks-studio/registry-source")]);return ta([{sourceDir:t.SOURCE_DIR,blockFileMap:t.BLOCK_FILE,catalog:e.CATALOG_ENTRIES},{sourceDir:n.SOURCE_DIR,blockFileMap:n.BLOCK_FILE,catalog:r.STUDIO_CATALOG_ENTRIES}])}function ue(e,t){if(v(e,"mode")==="json")console.log(JSON.stringify({schema:"uibot.cli.error.v1",ok:!1,error:t}));else console.error(t);return 1}async function of(e){if(e[0]==="logo")return Da(e.slice(1));if(e[0]==="skills"&&["list","show","install"].includes(e[1]??""))return Ea(e.slice(1));if(e[0]==="app")return ep(e.slice(1));if(e[0]==="resource")return of(e.slice(1));let[t,...r]=e,n=de(r),i=v(n,"registry");switch(t){case"manifest":case"search":case"get":case"build":case"docs":case"examples":case"install-plan":{let o=v(n,"source"),s=r.indexOf("--source"),a=s>=0?r.filter((c,l)=>l!==s&&l!==s+1):r.filter((c)=>!c.startsWith("--source="));try{let c=await Yd(n.verify?void 0:o);return Js(t,a,{queryService:c,snapshotAction:async(l,u,d,f)=>{if(l==="verify"){let{files:p,...m}=Qs(u,d);return m}return rf(f,vs(o),u)}})}catch(c){return Js(t,a,{queryService:{manifest:()=>({schemaVersion:"uibot.resource.index.v1",resources:[],aliases:{}}),search:()=>[],get:()=>{throw Error("unavailable")},build:()=>{throw Error("unavailable")}},sourceError:c instanceof Error?c:Error("resource source unavailable")})}}case"snapshot-serve":{if(n._.length!==1||Object.keys(n).some((c)=>!["_","port"].includes(c)))throw Error("snapshot-serve requires one directory and optional --port");let o=Number(v(n,"port")??"4444");if(!Number.isSafeInteger(o)||o<0||o>65535)throw Error("invalid snapshot server port");let{server:s,...a}=await nf(n._[0],o);return console.log(JSON.stringify(a,null,2)),await new Promise(()=>{}),0}case"list":return await np({...i?{registry:i}:{}}),0;case"add":{let o=n._[0];if(!o)return ue(n,"uibot add: missing artifact <name>");return await rp(o,{...i?{registry:i}:{},workspaceRoot:v(n,"cwd")??process.cwd()}),0}case"publish":{let o=await sP(),s=[],a=Cr();if(a)s.push({dir:a});let c=Rs();if(c)s.push({dir:c,defaultLevel:"L3",defaultCategory:"feature",extraKeywords:["sidebar","app-shell","shell"]});let l=Ft(s);return await op({out:v(n,"out")??"dist/registry",manifestName:v(n,"name")??"uibot",sources:o,...l.length?{templates:l}:{}}),0}case"design-md":{if(n._[0]!=="sync")return ue(n,"uibot design-md: expected subcommand 'sync'");let s=v(n,"from");if(!s)return ue(n,"uibot design-md sync: missing --from <github:owner/repo|https-url>");let c=v(n,"mode")==="json"?"json":"text",l=v(n,"license"),{code:u}=await sp({from:s,cwd:v(n,"cwd")??process.cwd(),mode:c,...l?{license:l}:{},dryRun:n["dry-run"]===!0});return u}case"regressions":{if(n._[0]!=="reverify")return ue(n,"uibot regressions: expected subcommand 'reverify'");let s=v(n,"mode")==="json"?"json":"text",a=v(n,"skill"),{code:c}=await bp({cwd:v(n,"cwd")??process.cwd(),mode:s,...a?{skillId:a}:{}});return c}case"skills":{let o=n._[0],s=n._[1],a=v(n,"mode")==="json"?"json":"text",c=v(n,"cwd")??process.cwd();if(o==="promote"){if(!s)return ue(n,"uibot skills promote: missing <id>");return vp(s,{cwd:c,mode:a})}if(o==="rollback"){if(!s)return ue(n,"uibot skills rollback: missing <id>");return Rp(s,{cwd:c,mode:a})}return ue(n,"uibot skills: expected promote|rollback <id>")}case"project":{let o=n._[0],s=n._[1];if(o!=="export"||!s)return ue(n,"uibot project: expected export <dir>");let a=v(n,"mode")==="json"?"json":"text";return Cp(s,{cwd:v(n,"cwd")??process.cwd(),mode:a})}case"link":{let o=v(n,"spec-dir")??n._[0];if(!o||typeof o!=="string")return ue(n,"uibot link: missing --spec-dir <relative-dir> (or positional <spec-dir>)");let s=v(n,"source-dir"),a=v(n,"control-plane-url"),c=v(n,"project-id"),l=v(n,"lock-path"),{code:u}=Np({cwd:v(n,"cwd")??process.cwd(),specDir:o,...s?{sourceDir:s}:{},...a?{controlPlaneUrl:a}:{},...c?{projectId:c}:{},...l?{lockPath:l}:{},force:n.force===!0,mode:v(n,"mode")==="json"?"json":"text"});return u}case"sync":{let o=n._[0];if(o!=="push"&&o!=="pull")return ue(n,"uibot sync: expected subcommand 'push' or 'pull'");let s=v(n,"mode")==="json"?"json":"text",a=v(n,"cwd")??process.cwd(),c=v(n,"from"),l=v(n,"to"),u=v(n,"control-plane-url"),d=v(n,"project-id");if(o==="push")return Vp({cwd:a,mode:s,...c?{from:c}:{},...u?{controlPlaneUrl:u}:{},...d?{projectId:d}:{}});return Hp({cwd:a,mode:s,...l?{to:l}:{},...c&&!l?{from:c}:{},...u?{controlPlaneUrl:u}:{},...d?{projectId:d}:{}})}case"doctor":{let o=v(n,"registry");return xp({cwd:v(n,"cwd")??process.cwd(),mode:v(n,"mode")==="json"?"json":"text",...o?{registry:o}:{}})}case"init":{let o=v(n,"into");if(o){let c=v(n,"spec-path"),l=v(n,"mount-path"),{code:u}=Op({into:o,...c?{specPath:c}:{},...l?{mountPath:l}:{},force:n.force===!0,mode:v(n,"mode")==="json"?"json":"text"});return u}let s=n._[0];if(!s)return ue(n,"uibot init: missing <dir> (or use --into <existing-app>)");let a=v(n,"template");return await Pp({dir:s,...a?{template:a}:{}}),0}case"help":case"--help":case"-h":case void 0:return console.log(Ds()),0;default:{let o=`uibot: unknown command '${t}'`;if(v(n,"mode")==="json")return ue(n,o);return console.error(`${o}
|
|
473
|
+
`),console.error(Ds()),1}}}if(at.main==at.module)of(process.argv.slice(2)).then((e)=>{if(e!==0)process.exit(e)}).catch((e)=>{console.error(e instanceof Error?e.message:String(e)),process.exit(1)});export{of as main};
|