@kitn.ai/ui 0.26.0 → 0.27.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 +16 -5
- package/bin/mcp.js +16 -3
- package/bin/route.js +23 -0
- package/bin/route.test.js +58 -0
- package/dist/{elements/chunks/Icon--Y8vsFal.js → Icon-BnFKqqtY.js} +1 -1
- package/dist/action-icons-CBskfBMz.js +1 -0
- package/dist/arrow-down-Br0qtpsz.js +1 -0
- package/dist/arrow-left-Dj7xgE12.js +1 -0
- package/dist/artifact-CvXEm1lS.js +1 -0
- package/dist/assets/dev-5XzXYR21.js +91 -0
- package/dist/attachments-C43ZegEq.js +1 -0
- package/dist/{elements/chunks/audio-visualizer-D7lB6mvR.js → audio-visualizer-B-79y1Tj.js} +1 -1
- package/dist/badge-BpUbq8c0.js +1 -0
- package/dist/bash-InADTalH.js +1 -6
- package/dist/bell-sn17Ip9v.js +1 -0
- package/dist/{elements/chunks/button-flUbeufF.js → button-BH6rN0U-.js} +1 -1
- package/dist/card-renderer-Cb1gQmth.js +1 -0
- package/dist/card-routing-DifQgS7n.js +1 -0
- package/dist/check-DPeeMUYx.js +1 -0
- package/dist/checkbox-Dc9Yov_B.js +1 -0
- package/dist/checkbox-group-B1kDLLYk.js +1 -0
- package/dist/chevron-down-CHSWk7ZT.js +1 -0
- package/dist/chevron-right-B7l_fMgx.js +1 -0
- package/dist/choice-card-BT3c1S8g.js +1 -0
- package/dist/circle-Bb0yOpqM.js +1 -0
- package/dist/circle-check-BGZpCiz7.js +1 -0
- package/dist/circle-x-wobWkoSx.js +1 -0
- package/dist/{elements/chunks/cn-CU7UAWzk.js → cn-DN5AWfiS.js} +1 -1
- package/dist/{elements/chunks/code-block-BdLiTitd.js → code-block-CUQ5mtv0.js} +1 -1
- package/dist/{elements/chunks/collapsible-BzbXpPzr.js → collapsible-CPJbf6FM.js} +1 -1
- package/dist/components/attachment-types.d.ts +7 -0
- package/dist/components/audio-visualizer/fit-scale.d.ts +1 -1
- package/dist/components/card-renderer.d.ts +13 -0
- package/dist/components/card.d.ts +4 -0
- package/dist/components/chat-thread.d.ts +46 -1
- package/dist/components/conversation-item.d.ts +19 -7
- package/dist/components/conversation-list.d.ts +17 -5
- package/dist/components/form-widgets.d.ts +67 -2
- package/dist/components/form.d.ts +48 -1
- package/dist/components/message.d.ts +25 -3
- package/dist/components/reasoning.d.ts +6 -0
- package/dist/components/scroll-button.d.ts +11 -0
- package/dist/components/thread.d.ts +5 -0
- package/dist/components/tool-types.d.ts +9 -0
- package/dist/composer-CjngLzal.js +106 -0
- package/dist/confirm-card-DCx_A4bU.js +1 -0
- package/dist/construct-cli.es.js +1169 -0
- package/dist/{elements/chunks/context-VLIL3sJ-.js → context-BY8V-Nlp.js} +1 -1
- package/dist/controllable-D43BKmtX.js +1 -0
- package/dist/conversation-list-D4lLU_yS.js +1 -0
- package/dist/copy-B6DO4PqB.js +1 -0
- package/dist/core-AYMC6_lb.js +12 -5874
- package/dist/{create-tween-CQED4T0g.js → create-tween-BPzaefTp.js} +1 -1
- package/dist/{create-tween-BFT6c-Y8.js → create-tween-CnMHviKB.js} +1 -1
- package/dist/{create-tween-CJNlzoaO.js → create-tween-D1aiGZZh.js} +1 -1
- package/dist/{elements/chunks/create-tween-c4Z8TDYz.js → create-tween-DUSQUKpr.js} +2 -2
- package/dist/css-M7EaDHN_.js +1 -6
- package/dist/custom-elements.json +1400 -218
- package/dist/default-input-CucQEOqH.js +1 -0
- package/dist/define-CGGX-7Vg.js +1 -0
- package/dist/define.d.ts +4 -0
- package/dist/define.js +510 -0
- package/dist/define.server.d.ts +5 -0
- package/dist/define.server.js +506 -0
- package/dist/{elements/chunks/disclosure-CcNbyLy0.js → disclosure-CbLtajUQ.js} +1 -1
- package/dist/{elements/chunks/dropdown-BgWTthUx.js → dropdown-BwhViJFd.js} +1 -1
- package/dist/elements/agent-card.js +1 -1
- package/dist/elements/artifact.js +1 -1
- package/dist/elements/attachments.js +1 -1
- package/dist/elements/audio-visualizer.js +1 -1
- package/dist/elements/autoloader.js +1 -1
- package/dist/elements/avatar.js +1 -1
- package/dist/elements/badge.js +1 -1
- package/dist/elements/button.js +1 -1
- package/dist/elements/card.js +1 -1
- package/dist/elements/cards.js +1 -1
- package/dist/elements/chain-of-thought.js +1 -1
- package/dist/elements/chat-scope-picker.js +1 -1
- package/dist/elements/chat-workspace.js +1 -1
- package/dist/elements/chat.js +1 -1
- package/dist/elements/checkbox-group.d.ts +1 -0
- package/dist/elements/checkbox-group.js +1 -0
- package/dist/elements/checkbox.d.ts +1 -0
- package/dist/elements/checkbox.js +1 -0
- package/dist/elements/checkpoint.js +1 -1
- package/dist/elements/choice.js +1 -1
- package/dist/elements/coachmark.js +1 -1
- package/dist/elements/code-block.js +1 -1
- package/dist/elements/command.js +1 -1
- package/dist/elements/compare.js +1 -1
- package/dist/elements/composer.js +1 -1
- package/dist/elements/confirm-card.js +1 -1
- package/dist/elements/context-meter.js +1 -1
- package/dist/elements/conversation-item.js +1 -1
- package/dist/elements/conversation-list.js +1 -1
- package/dist/elements/define-entry.d.ts +12 -0
- package/dist/elements/dialog.js +1 -1
- package/dist/elements/dock.js +101 -7
- package/dist/elements/dropdown.js +1 -1
- package/dist/elements/editable-label.js +1 -1
- package/dist/elements/element-data-types.d.ts +37 -0
- package/dist/elements/embed.js +1 -1
- package/dist/elements/empty.js +1 -1
- package/dist/elements/feedback-bar.js +1 -1
- package/dist/elements/file-tree.js +1 -1
- package/dist/elements/file-upload.js +1 -1
- package/dist/elements/form.js +1 -1
- package/dist/elements/hover-card.js +1 -1
- package/dist/elements/icon.js +1 -1
- package/dist/elements/image.js +1 -1
- package/dist/elements/input.js +1 -1
- package/dist/elements/kbd.js +1 -1
- package/dist/elements/link-preview.js +1 -1
- package/dist/elements/loader.js +1 -1
- package/dist/elements/markdown.js +1 -1
- package/dist/elements/menu.js +1 -1
- package/dist/elements/message-skills.js +1 -1
- package/dist/elements/message.js +1 -1
- package/dist/elements/model-switcher.js +1 -1
- package/dist/elements/nav.js +1 -1
- package/dist/elements/notice.js +1 -1
- package/dist/elements/pane-grid.d.ts +1 -0
- package/dist/elements/pane-grid.js +1 -0
- package/dist/elements/pane-group.js +1 -1
- package/dist/elements/pane.js +1 -1
- package/dist/elements/popover.js +1 -1
- package/dist/elements/progress-bar.js +1 -1
- package/dist/elements/prompt-dock.js +1 -1
- package/dist/elements/prompt-input.js +1 -1
- package/dist/elements/prompt-suggestions.js +1 -1
- package/dist/elements/radio-group.d.ts +1 -0
- package/dist/elements/radio-group.js +1 -0
- package/dist/elements/reasoning.js +1 -1
- package/dist/elements/remote.js +1 -1
- package/dist/elements/resizable.js +1 -1
- package/dist/elements/response-stream.js +2 -2
- package/dist/elements/screen.js +1 -1
- package/dist/elements/scroll-area.js +1 -1
- package/dist/elements/scroll-button.js +1 -1
- package/dist/elements/search.js +1 -1
- package/dist/elements/segmented.js +1 -1
- package/dist/elements/select.d.ts +1 -0
- package/dist/elements/select.js +1 -0
- package/dist/elements/separator.js +1 -1
- package/dist/elements/setting-item.js +1 -1
- package/dist/elements/settings-group.js +1 -1
- package/dist/elements/skeleton.js +1 -1
- package/dist/elements/slider.d.ts +1 -0
- package/dist/elements/slider.js +1 -0
- package/dist/elements/slots.d.ts +1 -1
- package/dist/elements/source.js +1 -1
- package/dist/elements/status.js +1 -1
- package/dist/elements/switch.js +1 -1
- package/dist/elements/tabs.js +1 -1
- package/dist/elements/tasks.js +1 -1
- package/dist/elements/text-shimmer.js +1 -1
- package/dist/elements/thinking-bar.js +1 -1
- package/dist/elements/thread.js +1 -1
- package/dist/elements/toast.js +1 -1
- package/dist/elements/tool.js +1 -1
- package/dist/elements/tooltip.js +1 -1
- package/dist/elements/voice-input.js +1 -1
- package/dist/elements/voice-output.js +1 -1
- package/dist/elements.d.ts +362 -24
- package/dist/{elements/chunks/ellipsis-7gU33mL2.js → ellipsis-DFr4Vqr3.js} +1 -1
- package/dist/embed-5s_vU4J0.js +1 -0
- package/dist/engine-javascript-vq0WuIJl.js +14 -2516
- package/dist/{elements/chunks/external-link-CSOEsNlx.js → external-link-u9d85ORQ.js} +1 -1
- package/dist/file-text-CX7_x42o.js +1 -0
- package/dist/{elements/chunks/file-tree-zvB2i7P9.js → file-tree-D3kBjXI5.js} +1 -1
- package/dist/folder-V-YdIL8f.js +1 -0
- package/dist/form-BRNUMCN2.js +1 -0
- package/dist/github-dark-dimmed-DUshB20C.js +1 -4
- package/dist/github-light-JYsPkUQd.js +1 -4
- package/dist/hover-card-DaeiYrTA.js +1 -0
- package/dist/html-CPZ3oZQ7.js +1 -10
- package/dist/icon-BpixdZNq.js +1 -0
- package/dist/{elements/chunks/index-BCRhi84a.js → index-xu_pdcPi.js} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7330 -5852
- package/dist/index.server.js +5823 -4759
- package/dist/info-8mFsIjS3.js +1 -0
- package/dist/input-d1Yuu-hz.js +1 -0
- package/dist/javascript-C25yR2R2.js +1 -6
- package/dist/json-DxJze_jm.js +1 -6
- package/dist/kai.es.js +1 -1
- package/dist/kbd-961zMPFB.js +1 -0
- package/dist/link-DlZZBGaR.js +1 -0
- package/dist/{elements/chunks/link-preview-OQ9IEq0f.js → link-preview-DIIbV2Sd.js} +1 -1
- package/dist/loader-YQszHFaW.js +1 -0
- package/dist/{elements/chunks/markdown-DgBFaGAz.js → markdown-CVk1MPsj.js} +1 -1
- package/dist/mcp.es.js +1285 -79
- package/dist/message-CwKVEdZg.js +1 -0
- package/dist/message-DS8lzHc1.js +1 -0
- package/dist/message-circle-Xf8Q-vZp.js +1 -0
- package/dist/message-square-Cxnwgkns.js +1 -0
- package/dist/{elements/chunks/minimize-2-DPIUKTrT.js → minimize-2-UEZmP2QT.js} +1 -1
- package/dist/{elements/chunks/model-switcher-DsT8tFB0.js → model-switcher-Kk1jEQ5t.js} +1 -1
- package/dist/{elements/chunks/overlay-DuiwdXjm.js → overlay-C1od6LOz.js} +1 -1
- package/dist/panel-right-ryET0yyn.js +1 -0
- package/dist/paperclip-BDNoZFJP.js +1 -0
- package/dist/play-OFIvYXUQ.js +1 -0
- package/dist/primitives/card-data-types.d.ts +49 -0
- package/dist/primitives/card-routing.d.ts +1 -33
- package/dist/primitives/card-validate.d.ts +2 -2
- package/dist/primitives/chat-config.d.ts +29 -2
- package/dist/primitives/field-mask.d.ts +96 -0
- package/dist/primitives/field-semantics.d.ts +36 -0
- package/dist/primitives/input-mask.d.ts +46 -0
- package/dist/primitives/url-scheme-policy.d.ts +34 -0
- package/dist/primitives/use-resize-observer.d.ts +2 -2
- package/dist/progress-bar-BvYX0aoy.js +1 -0
- package/dist/prompt-suggestion-BRFu2lcu.js +1 -0
- package/dist/radio-DcL23cNJ.js +1 -0
- package/dist/react/index.d.ts +193 -19
- package/dist/react.js +216 -180
- package/dist/reasoning-Cackq4Rh.js +1 -0
- package/dist/register-impl-C7rENvPK.js +424 -0
- package/dist/{elements/chunks/resizable-D181b4fM.js → resizable-Cp9HUYih.js} +1 -1
- package/dist/rotate-ccw-0DLRDHH5.js +1 -0
- package/dist/rotate-cw-DOB9IGcU.js +1 -0
- package/dist/schemas/form.schema.json +21 -1
- package/dist/schemas/tool-defs.d.ts +11 -1
- package/dist/schemas.js +81 -81
- package/dist/scroll-area-emVmWP4K.js +1 -0
- package/dist/scroll-button-CeP_gv1x.js +1 -0
- package/dist/select-CWmu00tS.js +1 -0
- package/dist/{elements/chunks/separator-CeJHQqLW.js → separator-CE6vly6z.js} +1 -1
- package/dist/{elements/chunks/settings-CqaHgJF9.js → settings-CE-78SvZ.js} +1 -1
- package/dist/{elements/chunks/settings-group-CjqjLCOn.js → settings-group-ZFWNxFQR.js} +1 -1
- package/dist/{elements/chunks/skeleton-D8akBnKS.js → skeleton-BebdP4mf.js} +1 -1
- package/dist/slider-BAKRYUlz.js +1 -0
- package/dist/{solid-BtdqNZI7.js → solid-BE5ui6sy.js} +8727 -7212
- package/dist/{solid-CnavwBye.js → solid-DFhsce3O.js} +7015 -5886
- package/dist/solid.d.ts +10 -0
- package/dist/solid.js +240 -234
- package/dist/solid.server.js +240 -234
- package/dist/source-B0FlguSx.js +1 -0
- package/dist/star-CBMZvLuN.js +1 -0
- package/dist/state/index.d.ts +1 -1
- package/dist/state/mock.d.ts +32 -2
- package/dist/state.js +133 -108
- package/dist/{elements/chunks/store-Cjq0qwYN.js → store-7eoadydQ.js} +1 -1
- package/dist/svelte--5p79yCD.js +1 -15
- package/dist/switch-CViARZCy.js +1 -0
- package/dist/tasks-card-MjCcOhR_.js +1 -0
- package/dist/text-shimmer-DKlwRF2G.js +1 -0
- package/dist/textarea-3ay2Me2-.js +1 -0
- package/dist/theme.tokens.css +82 -13
- package/dist/{elements/chunks/thumbs-up-DX2Ijk3H.js → thumbs-up-DQcu2HMO.js} +1 -1
- package/dist/toast-store-C6yKOhbk.js +1 -0
- package/dist/{elements/chunks/tool-DKQ2D1DP.js → tool-BCYNlfKy.js} +1 -1
- package/dist/{elements/chunks/tooltip-B0G99y8w.js → tooltip-05zI4hjs.js} +1 -1
- package/dist/trash-2-BR1RxGky.js +1 -0
- package/dist/{elements/chunks/triangle-alert-F9cyUEyy.js → triangle-alert-DHohDOCy.js} +1 -1
- package/dist/tsx-B8rCNbgL.js +1 -6
- package/dist/typescript-RycA9KXf.js +1 -6
- package/dist/ui/checkbox-group.d.ts +83 -0
- package/dist/ui/checkbox.d.ts +40 -0
- package/dist/ui/dock.d.ts +22 -0
- package/dist/ui/icon.d.ts +3 -0
- package/dist/ui/input.d.ts +48 -2
- package/dist/ui/radio.d.ts +85 -0
- package/dist/ui/select.d.ts +71 -0
- package/dist/ui/slider.d.ts +65 -0
- package/dist/ui/switch.d.ts +9 -2
- package/dist/upload-BbGW6A_u.js +1 -0
- package/dist/url-scheme-policy-DHpoTJwB.js +1 -0
- package/dist/use-card-resolution-CJW4grFa.js +1 -0
- package/dist/{variant-aurora-B8II3-I1.js → variant-aurora-BUOVgPOB.js} +2 -2
- package/dist/{variant-aurora-CMNWOSJR.js → variant-aurora-CUsUJvFI.js} +2 -2
- package/dist/{variant-aurora-CcuDMWwQ.js → variant-aurora-CW2i4bfr.js} +1 -1
- package/dist/{elements/chunks/variant-aurora-qt6Zct8M.js → variant-aurora-xiMPty8f.js} +1 -1
- package/dist/{variant-custom-L16JLLZy.js → variant-custom-BQtOnmeO.js} +1 -1
- package/dist/{variant-custom-C714mqKl.js → variant-custom-CAm9L-E5.js} +2 -2
- package/dist/{variant-custom-BdvYC7af.js → variant-custom-CAnzzppW.js} +2 -2
- package/dist/{elements/chunks/variant-custom-tJp22_BQ.js → variant-custom-D91HjAKz.js} +1 -1
- package/dist/{variant-wave-ecwykeyL.js → variant-wave-Ca1Ls4_y.js} +2 -2
- package/dist/{variant-wave-D7ruiA1W.js → variant-wave-CxX39DKd.js} +2 -2
- package/dist/{elements/chunks/variant-wave-CaQ5ti39.js → variant-wave-DYyzIIZv.js} +1 -1
- package/dist/{variant-wave-2S4La2Ka.js → variant-wave-uY5crU_K.js} +1 -1
- package/dist/vue-BmIZj4XD.js +1 -33
- package/dist/x-C5m1JFgi.js +1 -0
- package/frameworks/react/index.tsx +198 -20
- package/llms-full.txt +1178 -21
- package/llms.txt +6 -3
- package/package.json +17 -4
- package/src/agent-tooling/catalog/invariants.ts +1 -1
- package/src/agent-tooling/catalog/surfaces.ts +72 -0
- package/src/agent-tooling/construct/cli-entry.ts +8 -0
- package/src/agent-tooling/construct/cli.ts +131 -0
- package/src/agent-tooling/construct/codegen.ts +1353 -0
- package/src/agent-tooling/construct/construct.v1.schema.json +250 -0
- package/src/agent-tooling/construct/dev.ts +148 -0
- package/src/agent-tooling/construct/fixtures/demo-widget.construct.json +7 -0
- package/src/agent-tooling/construct/fixtures/ops-console.construct.json +44 -0
- package/src/agent-tooling/construct/fixtures/owner-widget.construct.json +23 -0
- package/src/agent-tooling/construct/schema.ts +371 -0
- package/src/agent-tooling/mcp/server.ts +2 -1
- package/src/agent-tooling/mcp/tools/construct.ts +130 -0
- package/src/agent-tooling/mcp/tools/debug.ts +126 -4
- package/src/agent-tooling/mcp/tools/reference.ts +104 -3
- package/src/agent-tooling/recipes/composed-thread.ts +714 -0
- package/src/agent-tooling/recipes/index.ts +22 -0
- package/src/agent-tooling/recipes/types.ts +32 -0
- package/src/agent-tooling/registry.ts +5 -0
- package/src/components/attachment-types.ts +7 -0
- package/src/components/audio-visualizer/fit-scale.ts +1 -1
- package/src/components/card-renderer.tsx +39 -8
- package/src/components/card.tsx +10 -2
- package/src/components/chat-scope-picker.tsx +2 -2
- package/src/components/chat-thread.tsx +72 -9
- package/src/components/choice-card.tsx +102 -37
- package/src/components/coachmark.tsx +1 -1
- package/src/components/code-block.tsx +2 -2
- package/src/components/composer.tsx +89 -15
- package/src/components/confirm-card.tsx +20 -4
- package/src/components/conversation-item.tsx +33 -9
- package/src/components/conversation-list.tsx +25 -10
- package/src/components/empty.tsx +14 -3
- package/src/components/file-tree.tsx +5 -1
- package/src/components/form-widgets.tsx +257 -195
- package/src/components/form.tsx +297 -9
- package/src/components/loader.tsx +12 -5
- package/src/components/message-skills.tsx +1 -1
- package/src/components/message.tsx +71 -11
- package/src/components/prompt-input.tsx +7 -1
- package/src/components/prompt-suggestion.tsx +4 -1
- package/src/components/reasoning.tsx +30 -3
- package/src/components/response-compare.tsx +2 -2
- package/src/components/scroll-button.tsx +56 -4
- package/src/components/source.tsx +6 -1
- package/src/components/tasks-card.tsx +58 -16
- package/src/components/thread.tsx +10 -1
- package/src/components/toast.tsx +1 -1
- package/src/components/tool-types.ts +9 -0
- package/src/elements/attachments.tsx +3 -1
- package/src/elements/chat-workspace.tsx +1 -1
- package/src/elements/chat.tsx +22 -4
- package/src/elements/checkbox-group.tsx +164 -0
- package/src/elements/checkbox.tsx +134 -0
- package/src/elements/compiled.css +1 -1
- package/src/elements/composer.tsx +12 -1
- package/src/elements/conversation-item.tsx +62 -22
- package/src/elements/conversation-list.tsx +2 -2
- package/src/elements/define-entry.ts +12 -0
- package/src/elements/dock.tsx +11 -0
- package/src/elements/element-data-types.ts +40 -0
- package/src/elements/element-manifest.json +24 -0
- package/src/elements/element-meta.json +736 -46
- package/src/elements/element-nonscalar.json +15 -0
- package/src/elements/element-types.d.ts +362 -24
- package/src/elements/feedback-bar.tsx +5 -0
- package/src/elements/icon-names.json +29 -0
- package/src/elements/input.tsx +312 -23
- package/src/elements/message.tsx +2 -0
- package/src/elements/pane-grid.tsx +111 -0
- package/src/elements/prompt-input.tsx +8 -2
- package/src/elements/radio-group.tsx +129 -0
- package/src/elements/register-impl.ts +6 -0
- package/src/elements/scroll-button.tsx +54 -6
- package/src/elements/select.tsx +165 -0
- package/src/elements/slider.tsx +171 -0
- package/src/elements/slots.ts +1 -1
- package/src/elements/styles.css +89 -3
- package/src/elements/thread.tsx +2 -0
- package/src/elements/toast.tsx +14 -1
- package/src/index.ts +2 -1
- package/src/primitives/card-data-types.ts +49 -0
- package/src/primitives/card-host.tsx +4 -2
- package/src/primitives/card-routing.ts +7 -56
- package/src/primitives/card-schemas/form.schema.json +21 -1
- package/src/primitives/card-validate.ts +10 -2
- package/src/primitives/chat-config.tsx +33 -6
- package/src/primitives/field-mask.ts +256 -0
- package/src/primitives/field-semantics.ts +115 -0
- package/src/primitives/input-mask.ts +853 -0
- package/src/primitives/toast-store.ts +66 -4
- package/src/primitives/url-scheme-policy.ts +70 -0
- package/src/primitives/use-resize-observer.ts +2 -2
- package/src/schemas/tool-defs.ts +12 -2
- package/src/solid.ts +10 -0
- package/src/state/index.ts +1 -1
- package/src/state/mock.ts +92 -6
- package/src/ui/agent-card.tsx +2 -2
- package/src/ui/avatar.tsx +1 -1
- package/src/ui/checkbox-group.tsx +153 -0
- package/src/ui/checkbox.tsx +63 -0
- package/src/ui/dock.tsx +145 -6
- package/src/ui/icon.tsx +53 -0
- package/src/ui/input.tsx +249 -9
- package/src/ui/kbd.tsx +1 -1
- package/src/ui/nav.tsx +1 -1
- package/src/ui/pane-group.tsx +2 -2
- package/src/ui/radio.tsx +150 -0
- package/src/ui/select.tsx +168 -0
- package/src/ui/slider.tsx +178 -0
- package/src/ui/switch.tsx +49 -18
- package/src/utils/cn.ts +11 -5
- package/theme.css +84 -13
- package/dist/elements/chunks/action-icons-D9u3OzYW.js +0 -1
- package/dist/elements/chunks/arrow-left-CVh1TeN7.js +0 -1
- package/dist/elements/chunks/artifact-BkYcfIlZ.js +0 -1
- package/dist/elements/chunks/attachments-DwfNlubq.js +0 -1
- package/dist/elements/chunks/badge-Q0-Cmwzz.js +0 -1
- package/dist/elements/chunks/bash-InADTalH.js +0 -1
- package/dist/elements/chunks/card-renderer-3Dyl-FpN.js +0 -1
- package/dist/elements/chunks/card-routing-BK09BdmL.js +0 -1
- package/dist/elements/chunks/check-B5kBPKeo.js +0 -1
- package/dist/elements/chunks/chevron-down-DZ1GS39h.js +0 -1
- package/dist/elements/chunks/chevron-right-CvP7OUd2.js +0 -1
- package/dist/elements/chunks/choice-card-D4QUIOWZ.js +0 -1
- package/dist/elements/chunks/circle-CDf9g6MQ.js +0 -1
- package/dist/elements/chunks/circle-check-CA47Nqbz.js +0 -1
- package/dist/elements/chunks/circle-x-CJ_HVbC8.js +0 -1
- package/dist/elements/chunks/composer-Byve-n8K.js +0 -69
- package/dist/elements/chunks/confirm-card-B0flE3MN.js +0 -1
- package/dist/elements/chunks/controllable-DTwTIlwp.js +0 -1
- package/dist/elements/chunks/conversation-item-BDztezOG.js +0 -1
- package/dist/elements/chunks/copy-Nf-kqxXH.js +0 -1
- package/dist/elements/chunks/core-AYMC6_lb.js +0 -12
- package/dist/elements/chunks/css-M7EaDHN_.js +0 -1
- package/dist/elements/chunks/default-input-C2iLFq0b.js +0 -1
- package/dist/elements/chunks/define-wjHR1MkU.js +0 -1
- package/dist/elements/chunks/download-C4V7tBdb.js +0 -1
- package/dist/elements/chunks/embed-D3KewsIJ.js +0 -1
- package/dist/elements/chunks/engine-javascript-vq0WuIJl.js +0 -141
- package/dist/elements/chunks/file-text-D1G8khle.js +0 -1
- package/dist/elements/chunks/folder-WW2LGLid.js +0 -1
- package/dist/elements/chunks/form-CQirdC4W.js +0 -1
- package/dist/elements/chunks/github-dark-dimmed-DUshB20C.js +0 -1
- package/dist/elements/chunks/github-light-JYsPkUQd.js +0 -1
- package/dist/elements/chunks/hover-card-CJJkfHTK.js +0 -1
- package/dist/elements/chunks/html-CPZ3oZQ7.js +0 -1
- package/dist/elements/chunks/icon-Cfgmf4fa.js +0 -1
- package/dist/elements/chunks/info-DX3YMOt6.js +0 -1
- package/dist/elements/chunks/input-BtW9U6Sq.js +0 -1
- package/dist/elements/chunks/javascript-C25yR2R2.js +0 -1
- package/dist/elements/chunks/json-DxJze_jm.js +0 -1
- package/dist/elements/chunks/kbd-LGXwuT_V.js +0 -1
- package/dist/elements/chunks/link-2My69BqT.js +0 -1
- package/dist/elements/chunks/loader-iOxc_Tu-.js +0 -1
- package/dist/elements/chunks/message-VMZohrXx.js +0 -1
- package/dist/elements/chunks/message-circle-CpXMM-_n.js +0 -1
- package/dist/elements/chunks/message-square-DxcWtETQ.js +0 -1
- package/dist/elements/chunks/message-tZmV2A3p.js +0 -1
- package/dist/elements/chunks/paperclip-CRZVp4z_.js +0 -1
- package/dist/elements/chunks/progress-bar-DNy66e_E.js +0 -1
- package/dist/elements/chunks/prompt-suggestion-Bn64Nl7L.js +0 -1
- package/dist/elements/chunks/reasoning-Emn9N4-T.js +0 -1
- package/dist/elements/chunks/rotate-cw-CPWe37D9.js +0 -1
- package/dist/elements/chunks/scroll-area-ClZkZxIk.js +0 -1
- package/dist/elements/chunks/scroll-button-DPE-t3x_.js +0 -1
- package/dist/elements/chunks/share-CyfnNEqp.js +0 -1
- package/dist/elements/chunks/source-UWCvmVak.js +0 -1
- package/dist/elements/chunks/star-DoHFAikQ.js +0 -1
- package/dist/elements/chunks/svelte--5p79yCD.js +0 -1
- package/dist/elements/chunks/tasks-card-CmZ5xh6v.js +0 -1
- package/dist/elements/chunks/text-shimmer-DYn09zrz.js +0 -1
- package/dist/elements/chunks/textarea-skiGHURM.js +0 -1
- package/dist/elements/chunks/toast-store-CFnQpThX.js +0 -1
- package/dist/elements/chunks/tsx-B8rCNbgL.js +0 -1
- package/dist/elements/chunks/typescript-RycA9KXf.js +0 -1
- package/dist/elements/chunks/use-card-resolution-DoA2f_EU.js +0 -1
- package/dist/elements/chunks/vue-BmIZj4XD.js +0 -1
- package/dist/elements/chunks/x-B6UnOiLw.js +0 -1
- package/dist/llms/llms-full.txt +0 -2949
- package/dist/llms/llms.txt +0 -156
- package/dist/register-impl-DpE7icIb.js +0 -293
- package/dist/ui/stat.d.ts +0 -16
- package/src/ui/stat.tsx +0 -41
- /package/dist/{elements/chunks/card-tags-D8lZ-C_U.js → card-tags-D8lZ-C_U.js} +0 -0
- /package/dist/{elements/chunks/link-preview-DNILK391.js → link-preview-DNILK391.js} +0 -0
- /package/dist/{elements/chunks/slots-DaNjX0rc.js → slots-DaNjX0rc.js} +0 -0
package/theme.css
CHANGED
|
@@ -74,8 +74,45 @@
|
|
|
74
74
|
added at the bottom. */
|
|
75
75
|
--color-hover: var(--kai-color-hover, color-mix(in oklab, var(--color-muted) 60%, var(--color-background)));
|
|
76
76
|
--color-selected: var(--kai-color-selected, color-mix(in oklab, var(--color-primary) 8%, var(--color-background)));
|
|
77
|
+
/* MARKED text — the fill behind a keyword the app has flagged (the composer's
|
|
78
|
+
`highlights` rules, decorated through the CSS Custom Highlight API). This is
|
|
79
|
+
`<mark>`, not a selection and not a status: a warm yellow, the convention
|
|
80
|
+
every browser already ships for <mark> and every reader already reads as
|
|
81
|
+
"someone marked this". Deliberately NOT derived from --color-primary — that
|
|
82
|
+
token is a NEUTRAL near-black in light and near-white in dark, so any tint of
|
|
83
|
+
it is grey, which is why the highlight used to be invisible. Also not blue
|
|
84
|
+
(the browser's own ::selection is blue — a highlight must not read as a
|
|
85
|
+
selection), not red (error) and not the skill/agent pill hues (blue/violet).
|
|
86
|
+
OPAQUE, so it composites predictably over whichever field it lands on.
|
|
87
|
+
Override via --kai-color-highlight. Light: near-black text over it is 15.6:1;
|
|
88
|
+
dark: near-white text over it is 6.7:1 — both well clear of WCAG AA. */
|
|
89
|
+
--color-highlight: var(--kai-color-highlight, hsl(45 96% 78%));
|
|
90
|
+
/* SELECTED text — the kit's own ::selection fill, applied inside every kai-*
|
|
91
|
+
shadow root (see src/elements/styles.css for the scoping rationale). The kit
|
|
92
|
+
owns this because leaving it to the UA meant the browser's blue outranked the
|
|
93
|
+
kit's own deliberate emphasis: a marked keyword was LESS prominent than an
|
|
94
|
+
incidental drag-select. Stays in the cool/blue family the UA trained everyone
|
|
95
|
+
to read as "selected", so it can never be confused with the warm --color-highlight
|
|
96
|
+
mark above; OPAQUE, so a selection over a mark composites cleanly (selection
|
|
97
|
+
paints on top of a custom highlight) instead of muddying into a third colour.
|
|
98
|
+
The FOREGROUND is set too, and that is not cosmetic: without it the selected
|
|
99
|
+
glyph keeps its own colour, and the kit's coloured text — muted text (3.8:1),
|
|
100
|
+
the skill/agent pill hues (3.6:1 / 4.0:1), inline code (4.7:1) — lands at or
|
|
101
|
+
under WCAG AA on this fill. Forcing the foreground token makes the guarantee
|
|
102
|
+
hold for every glyph regardless of what colour it had. Light 13.99:1,
|
|
103
|
+
dark 8.87:1. Override via --kai-color-selection(-foreground). */
|
|
104
|
+
--color-selection: var(--kai-color-selection, hsl(213 94% 87%));
|
|
105
|
+
--color-selection-foreground: var(--kai-color-selection-foreground, hsl(240 10% 3.9%));
|
|
77
106
|
--color-border: var(--kai-color-border, hsl(240 5.9% 90%));
|
|
78
|
-
|
|
107
|
+
/* CONTROL boundary — the visible edge of an interactive form control (text
|
|
108
|
+
input, textarea, select, the radio/checkbox ring). WCAG 2.1 SC 1.4.11
|
|
109
|
+
Non-text Contrast requires >=3:1 against the adjacent surface for exactly
|
|
110
|
+
this: a control whose boundary you cannot see is not perceivable. That is
|
|
111
|
+
why this is NOT --color-border: a divider or a card outline is decorative
|
|
112
|
+
and may sit below 3:1, a control's edge may not. Do NOT use border-input
|
|
113
|
+
for list wrappers or panel outlines — use border-border there.
|
|
114
|
+
Contrast is the requirement; a thicker border does not satisfy 1.4.11. */
|
|
115
|
+
--color-input: var(--kai-color-input, hsl(240 5% 53%));
|
|
79
116
|
/* Focus ring — a deliberate blue (not a neutral) so keyboard focus is always
|
|
80
117
|
obvious and on-brand in both modes. Light uses a strong blue; dark uses a
|
|
81
118
|
brighter one for contrast on dark surfaces. Both clear WCAG 2.1 non-text
|
|
@@ -108,18 +145,42 @@
|
|
|
108
145
|
--radius-lg: var(--radius);
|
|
109
146
|
--radius-xl: calc(var(--radius) + 4px);
|
|
110
147
|
|
|
111
|
-
/* Typography scale —
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
148
|
+
/* Typography scale — ONE scale for the whole kit. Each semantic name
|
|
149
|
+
(text-micro / text-caption / text-meta / text-compact / text-body /
|
|
150
|
+
text-title / text-lg)
|
|
151
|
+
resolves through a namespaced --kai-text-* token, so overriding that token
|
|
152
|
+
on :root restyles the kit globally — it pierces the Shadow DOM via the
|
|
115
153
|
var() fallback, exactly like the --kai-color-* tokens. The bare --text-*
|
|
116
|
-
names stay internal so a host's own --text-* can't collide.
|
|
117
|
-
|
|
118
|
-
the
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
154
|
+
names stay internal so a host's own --text-* can't collide.
|
|
155
|
+
|
|
156
|
+
Tailwind's OWN scale is re-pointed at the same tokens: in Tailwind v4 the
|
|
157
|
+
`text-xs` / `text-sm` / `text-base` / `text-lg` utilities are generated FROM
|
|
158
|
+
--text-xs/sm/base/lg in this very @theme block, so aliasing them makes
|
|
159
|
+
text-xs ≡ text-meta, text-sm ≡ text-body, text-base ≡ text-title and
|
|
160
|
+
text-lg ≡ text-lg. That matters because the vast majority of the kit's call
|
|
161
|
+
sites spell the Tailwind name; without the alias the --kai-text-* knobs
|
|
162
|
+
reached ~12% of them and the "globally" promise in the theming guide was
|
|
163
|
+
false. Defaults are byte-identical to stock Tailwind, so nothing moves
|
|
164
|
+
until a consumer actually sets a --kai-text-* token — including in a
|
|
165
|
+
consumer's own Tailwind build that imports this file, which is the point:
|
|
166
|
+
one scale everywhere, kit and app moving together.
|
|
167
|
+
|
|
168
|
+
Line-heights are UNITLESS RATIOS (Tailwind's own), never fixed rem. A fixed
|
|
169
|
+
leading does not scale: --kai-text-body: 1.25rem under the old 1.45rem
|
|
170
|
+
leading gave 20px text on 23.2px leading — near solid-set — which made the
|
|
171
|
+
themable token unsafe to actually theme.
|
|
172
|
+
(Message/markdown reading size also scales with the `proseSize` prop; these
|
|
173
|
+
tokens cover the fixed chrome & controls.) */
|
|
174
|
+
--text-micro: var(--kai-text-micro, 0.625rem); --text-micro--line-height: calc(0.875 / 0.625); /* 10px — badges, pills, uppercase eyebrows */
|
|
175
|
+
--text-caption: var(--kai-text-caption, 0.6875rem); --text-caption--line-height: calc(1 / 0.6875); /* 11px — micro labels, sub-counts, xs code */
|
|
176
|
+
--text-meta: var(--kai-text-meta, 0.75rem); --text-meta--line-height: calc(1 / 0.75); /* 12px — controls, toggles, switchers, captions */
|
|
177
|
+
--text-xs: var(--kai-text-meta, 0.75rem); --text-xs--line-height: calc(1 / 0.75); /* ≡ text-meta */
|
|
178
|
+
--text-compact: var(--kai-text-compact, 0.8125rem); --text-compact--line-height: calc(1.21875 / 0.8125); /* 13px — dense chrome & code: a notch below body */
|
|
179
|
+
--text-body: var(--kai-text-body, 0.875rem); --text-body--line-height: calc(1.25 / 0.875); /* 14px — primary reading text */
|
|
180
|
+
--text-sm: var(--kai-text-body, 0.875rem); --text-sm--line-height: calc(1.25 / 0.875); /* ≡ text-body */
|
|
181
|
+
--text-title: var(--kai-text-title, 1rem); --text-title--line-height: calc(1.5 / 1); /* 16px — emphasis / headers */
|
|
182
|
+
--text-base: var(--kai-text-title, 1rem); --text-base--line-height: calc(1.5 / 1); /* ≡ text-title */
|
|
183
|
+
--text-lg: var(--kai-text-lg, 1.125rem); --text-lg--line-height: calc(1.75 / 1.125); /* 18px — section headings, lg prose */
|
|
123
184
|
|
|
124
185
|
@keyframes typing { 0%,100% { transform: translateY(0); opacity: .5 } 50% { transform: translateY(-2px); opacity: 1 } }
|
|
125
186
|
@keyframes loading-dots { 0%,100% { opacity: 0 } 50% { opacity: 1 } }
|
|
@@ -180,8 +241,18 @@
|
|
|
180
241
|
--color-destructive-soft: var(--kai-color-destructive-soft, color-mix(in oklab, var(--color-destructive) 14%, var(--color-background)));
|
|
181
242
|
--color-hover: var(--kai-color-hover, color-mix(in oklab, var(--color-muted) 60%, var(--color-background)));
|
|
182
243
|
--color-selected: var(--kai-color-selected, color-mix(in oklab, var(--color-primary) 8%, var(--color-background)));
|
|
244
|
+
/* Marked text — dark. A deep warm amber rather than the light yellow: a pale
|
|
245
|
+
highlighter on a near-black field would blow out and force the text to flip
|
|
246
|
+
colour. See the light block for the full note. */
|
|
247
|
+
--color-highlight: var(--kai-color-highlight, hsl(40 75% 26%));
|
|
248
|
+
/* Selected text — dark. A deep blue rather than the light one, for the same
|
|
249
|
+
reason the mark darkens. See the light block for the full note. */
|
|
250
|
+
--color-selection: var(--kai-color-selection, hsl(217 60% 32%));
|
|
251
|
+
--color-selection-foreground: var(--kai-color-selection-foreground, hsl(0 0% 98%));
|
|
183
252
|
--color-border: var(--kai-color-border, hsl(45 4% 17%));
|
|
184
|
-
|
|
253
|
+
/* Control boundary — see the light block. Lifted to clear 3:1 (SC 1.4.11)
|
|
254
|
+
against the dark background and card surfaces. */
|
|
255
|
+
--color-input: var(--kai-color-input, hsl(45 4% 48%));
|
|
185
256
|
--color-ring: var(--kai-color-ring, hsl(217 91% 68%));
|
|
186
257
|
--color-scrollbar-thumb: var(--kai-color-scrollbar-thumb, hsl(45 3% 30%));
|
|
187
258
|
--color-scrollbar-thumb-hover: var(--kai-color-scrollbar-thumb-hover, hsl(45 3% 42%));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as a}from"./Icon--Y8vsFal.js";import{c as o,m as r}from"./define-wjHR1MkU.js";import{f as t,b as i,s as m,p}from"./share-CyfnNEqp.js";import{c as s}from"./check-B5kBPKeo.js";import{c as k}from"./copy-Nf-kqxXH.js";import{d}from"./download-C4V7tBdb.js";import{e as y}from"./ellipsis-7gU33mL2.js";import{l as n}from"./link-2My69BqT.js";import{s as c}from"./star-DoHFAikQ.js";import{a as l,t as h}from"./thumbs-up-DX2Ijk3H.js";import{x as f}from"./x-B6UnOiLw.js";var v=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],M=e=>o(a,r(e,{name:"RefreshCw",iconNode:v})),u=M,x=[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]],g=e=>o(a,r(e,{name:"Reply",iconNode:x})),N=g,w=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],L=e=>o(a,r(e,{name:"Trash2",iconNode:w})),R=L,b=[["polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5",key:"16drj5"}],["path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",key:"ltjumu"}],["path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",key:"1kegas"}]],j=e=>o(a,r(e,{name:"Volume2",iconNode:b})),C=j;const H={copy:k,like:h,dislike:l,regenerate:u,edit:p,share:m,bookmark:i,download:d,link:n,trash:R,check:s,x:f,star:c,flag:t,reply:N,more:y,"volume-2":C};function V(e){if(e)return H[e]}const I={copy:"Copy",like:"Like",dislike:"Dislike",regenerate:"Regenerate",edit:"Edit"};export{I as B,V as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as o}from"./Icon--Y8vsFal.js";import{c as m,m as r}from"./define-wjHR1MkU.js";var e=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],t=a=>m(o,r(a,{name:"ArrowLeft",iconNode:e})),p=t;export{p as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as a,m as P,s as fe,g as k,l as y,k as F,x as J,o as Q,q as ge,i as c,S as g,t as v,d as p,a as z,b as X,u as Y,j as be,h as ve,e as me}from"./define-wjHR1MkU.js";import{c as H}from"./cn-CU7UAWzk.js";import{B as C}from"./button-flUbeufF.js";import{C as pe,a as we}from"./code-block-BdLiTitd.js";import{F as xe}from"./file-tree-zvB2i7P9.js";import{L as ke}from"./loader-iOxc_Tu-.js";import{i as ye,a as ee}from"./card-routing-BK09BdmL.js";import{a as ze}from"./arrow-left-CVh1TeN7.js";import{I as re}from"./Icon--Y8vsFal.js";import{r as Ce,h as Te,c as Fe}from"./rotate-cw-CPWe37D9.js";import{d as Pe}from"./download-C4V7tBdb.js";import{e as ne}from"./external-link-CSOEsNlx.js";import{f as Oe}from"./file-text-D1G8khle.js";import{m as Re,a as Se}from"./minimize-2-DPIUKTrT.js";var je=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ie=r=>a(re,P(r,{name:"ArrowRight",iconNode:je})),Ne=Ie,He=[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Me=r=>a(re,P(r,{name:"Eye",iconNode:He})),Ee=Me;const $e="6.0.227",te=`https://cdn.jsdelivr.net/npm/pdfjs-dist@${$e}/build`,Be=()=>import(/*@vite-ignore*/`${te}/pdf.min.mjs`),Le=`${te}/pdf.worker.min.mjs`;let Ue=Be,De=Le,M=null;function Ae(){if(!M){const r=Ue;M=(async()=>{const t=await r(),e=t.default??t;return e.GlobalWorkerOptions.workerSrc=De,e})()}return M}async function Ve(r,t,e){const i=await(await Ae()).getDocument({url:r}).promise;t.replaceChildren();const l=typeof window<"u"&&window.devicePixelRatio?window.devicePixelRatio:1;for(let s=1;s<=i.numPages;s++){const d=await i.getPage(s),u=d.getViewport({scale:1}),h=u.width>0?e/u.width:1,f=d.getViewport({scale:h*l}),b=document.createElement("canvas");b.width=Math.max(1,Math.floor(f.width)),b.height=Math.max(1,Math.floor(f.height)),b.setAttribute("role","img"),b.setAttribute("aria-label",`Page ${s}`),b.style.width="100%",b.style.height="auto",b.style.display="block";const w=b.getContext("2d");t.appendChild(b),await d.render({canvasContext:w,viewport:f}).promise}return{pages:i.numPages}}var We=v('<div><div class="relative min-h-0 flex-1">'),qe=v('<form class="min-w-0 flex-1"><label class=sr-only for=kai-artifact-path>Address</label><input id=kai-artifact-path name=kai-artifact-path type=text autocomplete=off placeholder="Enter a path or URL\u2026">'),Ke=v("<div class=flex-1 aria-hidden=true>"),_e=v('<div role=tablist aria-label=View class="flex shrink-0 items-center gap-0.5 rounded-md bg-muted p-0.5">'),Ge=v('<div data-artifact-toolbar class="flex shrink-0 items-center gap-1.5 border-b border-border bg-surface px-2 py-1.5">'),Ze=v("<button type=button role=tab>"),Je=v('<iframe class="absolute inset-0 h-full w-full border-0 bg-white">'),Qe=v('<div class="absolute inset-0 flex"><div class="w-56 shrink-0 overflow-auto border-r border-border bg-surface-sunken py-1.5 scrollbar-thin"></div><div class="min-w-0 flex-1 overflow-auto scrollbar-thin">'),Xe=v('<div class="flex h-full items-center justify-center p-6 text-sm text-muted-foreground">Select a file to view its source.'),Ye=v('<div class="flex h-full items-center justify-center p-6 text-sm text-muted-foreground">No source \u2014 this file (<!>) has no code view.'),er=v('<div class="flex flex-wrap items-center justify-center gap-2"><a class="inline-flex h-8 items-center gap-1.5 rounded-md border border-border bg-background px-3 text-xs font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"target=_blank rel="noopener noreferrer">Open in new tab</a><a class="inline-flex h-8 items-center gap-1.5 rounded-md border border-border bg-background px-3 text-xs font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"download>Download'),rr=v(`<div role=region aria-label="PDF preview unavailable"class="absolute inset-0 flex flex-col items-center justify-center gap-3 bg-card p-6 text-center"><div class="text-sm font-medium text-foreground"></div><div class="text-xs text-muted-foreground">Can't preview this PDF inline.`),nr=v(`<div class="text-xs text-muted-foreground">Blocked: that address uses a scheme this viewer won't open.`),tr=v('<div class="pointer-events-none absolute inset-0 flex items-center justify-center">'),ar=v('<div class="absolute inset-0"><div role=region aria-label="PDF preview"tabindex=0 class="absolute inset-0 flex flex-col items-center gap-3 overflow-auto bg-surface-sunken p-3 scrollbar-thin focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset">');const ir="allow-scripts allow-forms";function E(r,t){console.warn(`[kai-artifact] blocked unsafe url in ${r}: ${t}`)}function or(r,t){if(r.url)return r.url;if(!t)return r.path;try{return new URL(r.path,t).href}catch{return r.path}}function lr(r,t){if(!r)return!1;const e=t.find(l=>l.url===r||l.path===r);if(e?.type==="pdf")return!0;const i=r.split(/[?#]/)[0];return/\.pdf$/i.test(i)}function sr(r){const t=P({files:[],defaultTab:"preview",sandbox:ir,showNav:!0,showReload:!0,showHome:!0,showPathField:!0,showTabs:!0,expandable:!1,openInTab:!1,standalone:!1,readonlyPath:!1,maximized:!1},r),[e,i]=fe(t,["src","files","tab","defaultTab","activeFile","sandbox","iframeTitle","onNavigate","onTabChange","onFileSelect","maximized","onMaximizeChange","showNav","showReload","showHome","showPathField","showTabs","expandable","openInTab","standalone","readonlyPath","displayUrl","controllerRef","class"]),[l,s]=k(e.src?[e.src]:[]),[d,u]=k(e.src?0:-1),h=()=>l()[d()]??"",f=()=>d()>0,b=()=>d()<l().length-1,w=y(()=>{const n=h();return n&&ye(n)?(E("preview",n),""):n}),[O,$]=k(e.tab??e.defaultTab),[B,L]=k(e.activeFile),[ie,oe]=k(0),[R,S]=k(e.maximized??!1);F(()=>S(e.maximized??!1));const le=()=>{var n;const o=!R();S(o),(n=e.onMaximizeChange)==null||n.call(e,o)},U=y(()=>{const n=h();return!!n&&n!=="about:blank"&&ee(n)}),D=()=>{const n=h();if(!U()){n&&n!=="about:blank"&&E("openExternal",n);return}window.open(n,"_blank","noopener,noreferrer")},A=y(()=>e.expandable&&!e.standalone),se=y(()=>e.showNav||e.showReload||e.showHome||e.showPathField||e.showTabs||A()||e.openInTab);let x;F(()=>{e.tab!==void 0&&$(e.tab)}),F(()=>L(e.activeFile)),F(J(()=>e.src,n=>{n&&n!==h()&&T(n)},{defer:!0}));const V=n=>n===void 0?void 0:e.files.find(o=>o.path===n),W=y(()=>V(B())),de=y(()=>{const n=W();return!!n&&n.type!=="image"&&n.type!=="pdf"&&typeof n.code=="string"});function T(n){if(n===h()){I();return}s(o=>[...o.slice(0,d()+1),n]),u(o=>o+1),j()}function j(){var n;x&&(x.src=w()||"about:blank"),(n=e.onNavigate)==null||n.call(e,h())}function ue(n){var o;n!==O()&&($(n),(o=e.onTabChange)==null||o.call(e,n))}function q(n,o){var m;L(n),(m=e.onFileSelect)==null||m.call(e,n),T(or(o,e.src))}const K=()=>{f()&&(u(n=>n-1),j())},_=()=>{b()&&(u(n=>n+1),j())};function I(){var n;x&&(x.src="about:blank",x.src=w()||"about:blank"),oe(o=>o+1),(n=e.onNavigate)==null||n.call(e,h())}const G=()=>{e.src&&T(e.src)},Z=n=>{var o;R()!==n&&(S(n),(o=e.onMaximizeChange)==null||o.call(e,n))};Q(()=>{var n;(n=e.controllerRef)==null||n.call(e,{back:()=>K(),forward:()=>_(),reload:()=>I(),home:()=>G(),navigate:o=>T(o),selectFile:o=>{const m=V(o);m&&q(o,m)},openExternal:()=>D(),maximize:()=>Z(!0),restore:()=>Z(!1)})});const ce=()=>{var n,o;try{const m=(n=x?.contentWindow)==null?void 0:n.location.href;m&&m!=="about:blank"&&m!==h()&&(s(N=>[...N.slice(0,d()+1),m]),u(N=>N+1),(o=e.onNavigate)==null||o.call(e,m))}catch{}},he=n=>{n.preventDefault();const o=n.currentTarget.elements.namedItem("kai-artifact-path");if(e.readonlyPath||e.displayUrl!=null){o&&(o.value=e.displayUrl??h());return}o&&o.value&&T(o.value)};return(()=>{var n=We(),o=n.firstChild;return ge(n,P({get class(){return H("flex h-full w-full flex-col overflow-hidden bg-card text-card-foreground",e.standalone&&"rounded-xl border border-border",e.class)}},i),!1,!0),c(n,a(g,{get when(){return se()},get children(){return a(dr,{url:()=>e.displayUrl??h(),tab:O,canBack:f,canForward:b,canHome:()=>!!e.src,onBack:K,onForward:_,onReload:I,onHome:G,onSubmitPath:he,onTab:ue,showNav:()=>e.showNav,showReload:()=>e.showReload,showHome:()=>e.showHome,showPathField:()=>e.showPathField,showTabs:()=>e.showTabs,showExpand:A,showOpenInTab:()=>e.openInTab,maximized:R,onToggleMaximize:le,canOpenInTab:U,onOpenInTab:D,readonlyPath:()=>e.readonlyPath||e.displayUrl!=null})}}),o),c(o,a(g,{get when(){return O()==="preview"},get fallback(){return a(cr,{get files(){return e.files},activeFile:B,activeFileObj:W,hasSource:de,onSelect:q})},get children(){return a(g,{get when(){return lr(h(),e.files)},get fallback(){return a(ur,{ref:m=>x=m,src:w,get sandbox(){return e.sandbox},get title(){return e.iframeTitle??"Artifact preview"},onLoad:ce})},get children(){return a(fr,{get url(){return h()},get reloadKey(){return ie()}})}})}})),n})()}function dr(r){return(()=>{var t=Ge();return c(t,a(g,{get when(){return r.showNav()},get children(){return[a(C,{variant:"ghost",size:"icon-sm","aria-label":"Back",get disabled(){return!r.canBack()},onClick:()=>r.onBack(),get children(){return a(ze,{size:16,"aria-hidden":"true"})}}),a(C,{variant:"ghost",size:"icon-sm","aria-label":"Forward",get disabled(){return!r.canForward()},onClick:()=>r.onForward(),get children(){return a(Ne,{size:16,"aria-hidden":"true"})}})]}}),null),c(t,a(g,{get when(){return r.showReload()},get children(){return a(C,{variant:"ghost",size:"icon-sm","aria-label":"Reload",onClick:()=>r.onReload(),get children(){return a(Ce,{size:15,"aria-hidden":"true"})}})}}),null),c(t,a(g,{get when(){return r.showHome()},get children(){return a(C,{variant:"ghost",size:"icon-sm","aria-label":"Home",get disabled(){return!r.canHome()},onClick:()=>r.onHome(),get children(){return a(Te,{size:15,"aria-hidden":"true"})}})}}),null),c(t,a(g,{get when(){return r.showPathField()},get children(){var e=qe(),i=e.firstChild,l=i.nextSibling;return e.addEventListener("submit",s=>r.onSubmitPath(s)),p(l,"spellcheck",!1),z(s=>{var d=r.readonlyPath()||void 0,u=r.readonlyPath()?"true":void 0,h=H("h-7 w-full rounded-md border border-border px-2.5 text-xs text-foreground font-mono outline-none",r.readonlyPath()?"bg-muted/40 cursor-default":"bg-background focus-visible:ring-2 focus-visible:ring-ring");return d!==s.e&&(l.readOnly=s.e=d),u!==s.t&&p(l,"aria-readonly",s.t=u),h!==s.a&&X(l,s.a=h),s},{e:void 0,t:void 0,a:void 0}),z(()=>l.value=r.url()),e}}),null),c(t,a(g,{get when(){return!r.showPathField()},get children(){return Ke()}}),null),c(t,a(g,{get when(){return r.showExpand()},get children(){return a(C,{variant:"ghost",size:"icon-sm",get"aria-label"(){return r.maximized()?"Collapse":"Expand"},get"aria-expanded"(){return r.maximized()},onClick:()=>r.onToggleMaximize(),get children(){return a(g,{get when(){return r.maximized()},get fallback(){return a(Se,{size:15,"aria-hidden":"true"})},get children(){return a(Re,{size:15,"aria-hidden":"true"})}})}})}}),null),c(t,a(g,{get when(){return r.showOpenInTab()},get children(){return a(C,{variant:"ghost",size:"icon-sm","aria-label":"Open in new tab",get disabled(){return!r.canOpenInTab()},onClick:()=>r.onOpenInTab(),get children(){return a(ne,{size:15,"aria-hidden":"true"})}})}}),null),c(t,a(g,{get when(){return r.showTabs()},get children(){var e=_e();return c(e,a(ae,{label:"Preview",get icon(){return a(Ee,{size:14,"aria-hidden":"true"})},get selected(){return r.tab()==="preview"},onClick:()=>r.onTab("preview")}),null),c(e,a(ae,{label:"Code",get icon(){return a(Fe,{size:14,"aria-hidden":"true"})},get selected(){return r.tab()==="code"},onClick:()=>r.onTab("code")}),null),e}}),null),t})()}function ae(r){return(()=>{var t=Ze();return t.$$click=()=>r.onClick(),c(t,()=>r.icon,null),c(t,()=>r.label,null),z(e=>{var i=r.selected,l=H("inline-flex h-6 items-center gap-1.5 rounded px-2 text-xs font-medium transition-colors outline-none","focus-visible:ring-2 focus-visible:ring-ring",r.selected?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground");return i!==e.e&&p(t,"aria-selected",e.e=i),l!==e.t&&X(t,e.t=l),e},{e:void 0,t:void 0}),t})()}function ur(r){return(()=>{var t=Je();t.addEventListener("load",()=>r.onLoad());var e=r.ref;return typeof e=="function"?Y(e,t):r.ref=t,z(i=>{var l=r.src()||"about:blank",s=r.sandbox,d=r.title;return l!==i.e&&p(t,"src",i.e=l),s!==i.t&&p(t,"sandbox",i.t=s),d!==i.a&&p(t,"title",i.a=d),i},{e:void 0,t:void 0,a:void 0}),t})()}function cr(r){return(()=>{var t=Qe(),e=t.firstChild,i=e.nextSibling;return c(e,a(xe,{get files(){return r.files},get activeFile(){return r.activeFile()},onSelect:(l,s)=>r.onSelect(l,s)})),c(i,a(g,{get when(){return r.activeFileObj()},get fallback(){return Xe()},get children(){return a(g,{get when(){return r.hasSource()},get fallback(){return(()=>{var l=Ye(),s=l.firstChild,d=s.nextSibling;return d.nextSibling,c(l,()=>r.activeFileObj().type??"binary",d),l})()},get children(){return a(pe,{class:"h-full rounded-none border-0",get children(){return a(we,{get code(){return r.activeFileObj().code??""},get language(){return r.activeFileObj().language}})}})}})}})),t})()}function hr(r){const t=()=>{const i=r.url.split(/[?#]/)[0];return i.slice(i.lastIndexOf("/")+1)||"document.pdf"},e=y(()=>{if(r.url){if(ee(r.url))return r.url;E("pdf fallback",r.url)}});return(()=>{var i=rr(),l=i.firstChild;return l.nextSibling,c(i,a(Oe,{size:40,class:"text-muted-foreground","aria-hidden":"true"}),l),c(l,t),c(i,a(g,{get when(){return e()},get fallback(){return nr()},get children(){var s=er(),d=s.firstChild;d.firstChild;var u=d.nextSibling,h=u.firstChild;return c(d,a(ne,{size:13,"aria-hidden":"true"}),null),c(u,a(Pe,{size:13,"aria-hidden":"true"}),h),z(f=>{var b=e(),w=e();return b!==f.e&&p(d,"href",f.e=b),w!==f.t&&p(u,"href",f.t=w),f},{e:void 0,t:void 0}),s}}),null),i})()}function fr(r){const[t,e]=k("loading");let i,l=0,s;const d=async()=>{if(!i){e("error");return}const u=++l;e("loading");try{const h=i.clientWidth||600;await Ve(r.url,i,h),u===l&&e("success")}catch{u===l&&e("error")}};return F(J(()=>[r.url,r.reloadKey],()=>{d()})),Q(()=>{if(!i||typeof ResizeObserver>"u")return;const u=new ResizeObserver(()=>{t()==="success"&&(clearTimeout(s),s=setTimeout(()=>{d()},200))});u.observe(i),ve(()=>{u.disconnect(),clearTimeout(s),l++})}),(()=>{var u=ar(),h=u.firstChild;return Y(f=>i=f,h),c(u,a(g,{get when(){return be(()=>!0)()&&t()==="loading"},get children(){var f=tr();return c(f,a(ke,{variant:"circular",size:"md"})),f}}),null),c(u,a(g,{get when(){return t()==="error"},get children(){return a(hr,{get url(){return r.url}})}}),null),z(()=>p(h,"aria-busy",t()==="loading")),u})()}me(["click"]);export{sr as A};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as d,m,s as b,q as h,i as l,S as f,j as x,t as p,B as j,G as I,a as R,d as w}from"./define-wjHR1MkU.js";import{c as g}from"./cn-CU7UAWzk.js";import{B as S}from"./button-flUbeufF.js";import{H as U,a as V,b as G}from"./hover-card-CJJkfHTK.js";import{x as O}from"./x-B6UnOiLw.js";import{I as q}from"./Icon--Y8vsFal.js";import{f as W}from"./file-text-D1G8khle.js";import{p as X,g as Y,i as Z}from"./paperclip-CRZVp4z_.js";var J=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],K=e=>d(q,m(e,{name:"FileCode",iconNode:J})),Q=K,_=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]],ee=e=>d(q,m(e,{name:"FileX",iconNode:_})),te=ee;const D=[{pattern:"image/jpeg",kind:"image"},{pattern:"image/png",kind:"image"},{pattern:"image/gif",kind:"image"},{pattern:"image/webp",kind:"image"},{pattern:"application/pdf",kind:"document"},{pattern:"text/*",kind:"text"},{pattern:"application/json",kind:"text"},{pattern:"application/xml",kind:"text"},{pattern:"application/x-yaml",kind:"text"},{pattern:"application/yaml",kind:"text"}],A="text/plain",ae=["","application/octet-stream"],C=e=>e.trim().toLowerCase(),H=e=>ae.includes(e===void 0?"":C(e)),re=e=>{if(!e.startsWith("."))return e;throw new Error(`\`accept\` entry "${e}" is a file extension, and this kit takes media types only. HTML's own accept attribute does take extensions, which is exactly why this throws rather than quietly matching nothing. Use a media type instead -- "text/*" covers source files, "image/*" images, "application/pdf" PDFs, and \`encodableMediaTypes()\` is the full set. You lose nothing by dropping the extension: a file the browser cannot name is decided by decoding its bytes, which is stronger than matching its name.`)},ne=e=>(typeof e=="string"?e.split(","):e).map(C).filter(a=>a!=="").map(re),N=e=>{const a=e.indexOf("/");return a===-1?[e,""]:[e.slice(0,a),e.slice(a+1)]},k=(e,a)=>{const[r,t]=N(e),[i,n]=N(a);return r!=="*"&&r!==i?!1:t==="*"||t===n},ie=(e,a)=>{if(k(e,a))return a;if(k(a,e))return e};function P(e={}){const a=e.accept===void 0?void 0:ne(e.accept),r=[];for(const t of D){if(a===void 0){r.push({...t});continue}for(const i of a){const n=ie(t.pattern,i);n!==void 0&&!r.some(s=>s.pattern===n)&&r.push({pattern:n,kind:t.kind})}}return{types:r.map(t=>t.pattern),accept:r.map(t=>t.pattern).join(","),decide(t){const i=t===void 0?"":C(t);if(H(i))return r.some(s=>k(s.pattern,A))?{status:"undetermined"}:{status:"unsupported"};const n=r.find(s=>k(s.pattern,i));return n?{status:"allowed",kind:n.kind}:D.some(s=>k(s.pattern,i))?{status:"filtered"}:{status:"unsupported"}}}}const $=P();var T=p("<div>"),se=p("<div part=attachment>"),E=p("<span class=sr-only>"),oe=p('<img class="size-full object-cover"height=96 width=96>'),de=p('<img class="size-full rounded object-cover"height=20 width=20>'),ce=p('<span class="text-warning text-caption block truncate">unsupported attachment format'),ue=p('<div part=attachment-name><span class="block truncate">'),le=p("<div part=attachment-name>"),pe=p('<span class="text-muted-foreground text-caption block truncate">');const ge={document:W,image:Z,source:Y,text:Q,unknown:X,unsendable:te},z=e=>{if(e.type==="source-document")return"source";const a=$.decide(e.mediaType);switch(a.status){case"allowed":return a.kind;case"unsupported":return"unsendable";case"undetermined":case"filtered":return"unknown"}},me=e=>{var a;return z(e)!=="unsendable"?void 0:`${((a=e.mediaType)==null?void 0:a.trim())||"This file type"} is not one of the attachment formats a model request can carry.`},F=e=>{if(e.type==="source-document")return e.title||e.filename||"Source";const a=z(e);return e.filename||(a==="image"?"Image":"Attachment")},B=j(),L=j(),he=()=>I(B)??{variant:"grid"},M=()=>{const e=I(L);if(!e)throw new Error("Attachment components must be used within <Attachment>");return e};function fe(e){const[a,r]=b(e,["variant","class","children"]),t=()=>a.variant??"grid";return d(B.Provider,{value:{get variant(){return t()}},get children(){var i=T();return h(i,m({get class(){return g("flex items-start",t()==="list"?"flex-col gap-2":"flex-wrap gap-2",t()==="grid"&&"w-fit",a.class)}},r),!1,!0),l(i,()=>a.children),i}})}function ve(e){const[a,r]=b(e,["data","onRemove","class","children"]),t=he(),i=()=>z(a.data),n=()=>me(a.data);return d(L.Provider,{value:{get data(){return a.data},get mediaCategory(){return i()},get onRemove(){return a.onRemove},get variant(){return t.variant}},get children(){var s=se();return h(s,m({get class(){return g("group relative",t.variant==="grid"&&"size-24 overflow-hidden rounded-lg",t.variant==="inline"&&["flex h-8 cursor-pointer select-none items-center gap-1.5","rounded-md bg-surface-strong px-1.5 text-foreground","font-medium text-sm transition-all","hover:bg-muted"],t.variant==="list"&&["flex w-full items-center gap-3 rounded-lg bg-surface p-3 text-foreground","hover:bg-muted/50"],a.class)},get"data-unsendable"(){return n()===void 0?void 0:""},get title(){return n()}},r),!1,!0),l(s,d(f,{get when(){return n()},children:o=>(()=>{var u=E();return l(u,o),u})()}),null),l(s,()=>a.children,null),s}})}function ye(e){const[a,r]=b(e,["fallbackIcon","class"]),t=M(),i=()=>t.variant==="inline"?"size-3":"size-4",n=o=>d(o,{get class(){return g(i(),t.mediaCategory==="unsendable"?"text-warning":"text-muted-foreground")}}),s=()=>{if(t.mediaCategory==="image"&&t.data.type==="file"&&t.data.url)return t.variant==="grid"?(()=>{var u=oe();return R(c=>{var v=t.data.filename||"Image",y=t.data.url;return v!==c.e&&w(u,"alt",c.e=v),y!==c.t&&w(u,"src",c.t=y),c},{e:void 0,t:void 0}),u})():(()=>{var u=de();return R(c=>{var v=t.data.filename||"Image",y=t.data.url;return v!==c.e&&w(u,"alt",c.e=v),y!==c.t&&w(u,"src",c.t=y),c},{e:void 0,t:void 0}),u})();const o=ge[t.mediaCategory];return a.fallbackIcon??n(o)};return(()=>{var o=T();return h(o,m({get class(){return g("flex shrink-0 items-center justify-center overflow-hidden",t.variant==="grid"&&"size-full bg-muted",t.variant==="inline"&&"size-5 rounded bg-background",t.variant==="list"&&"size-12 rounded bg-muted",a.class)}},r),!1,!0),l(o,s),o})()}function be(e){const[a,r]=b(e,["showMediaType","class"]),t=M(),i=()=>F(t.data);return d(f,{get when(){return t.variant!=="grid"},get fallback(){return d(f,{get when(){return t.mediaCategory!=="image"},get children(){var n=le();return h(n,m({get class(){return g("absolute inset-x-0 bottom-0 truncate px-1.5 py-1 text-caption","bg-background/85 backdrop-blur-sm",t.mediaCategory==="unsendable"?"text-warning":"text-foreground",a.class)}},r),!1,!0),l(n,i),n}})},get children(){var n=ue(),s=n.firstChild;return h(n,m({get class(){return g("min-w-0 flex-1",a.class)}},r),!1,!0),l(s,i),l(n,d(f,{get when(){return x(()=>t.mediaCategory==="unsendable")()&&t.variant==="list"},get fallback(){return d(f,{get when(){return x(()=>!!(a.showMediaType&&t.variant==="list"))()&&t.data.mediaType},get children(){var o=pe();return l(o,()=>t.data.mediaType),o}})},get children(){var o=ce(),u=o.firstChild;return l(o,(()=>{var c=x(()=>!!t.data.mediaType);return()=>c()?`${t.data.mediaType} \xB7 `:""})(),u),o}}),null),n}})}function ke(e){const a=M(),r=t=>{var i;t.stopPropagation(),(i=a.onRemove)==null||i.call(a)};return d(f,{get when(){return a.onRemove},get children(){return d(S,{get"aria-label"(){return e.label??"Remove"},get class(){return g(a.variant==="grid"&&["absolute top-2 right-2 size-6 rounded-full p-0","bg-background/80 backdrop-blur-sm","opacity-0 transition-opacity group-hover:opacity-100","hover:bg-background","[&>svg]:size-3"],a.variant==="inline"&&["size-5 rounded p-0","opacity-0 transition-opacity group-hover:opacity-100","[&>svg]:size-2.5"],a.variant==="list"&&["size-8 shrink-0 rounded p-0","[&>svg]:size-4"],e.class)},onClick:r,type:"button",variant:"ghost",get children(){return[x(()=>e.children??d(O,{})),(()=>{var t=E();return l(t,()=>e.label??"Remove"),t})()]}})}})}function xe(e){return d(U,{get openDelay(){return e.openDelay??0},get closeDelay(){return e.closeDelay??0},get children(){return e.children}})}function we(e){return d(V,{get class(){return e.class},get children(){return e.children}})}function ze(e){return d(G,{get class(){return g("w-auto p-2",e.class)},get children(){return e.children}})}function Ce(e){const[a,r]=b(e,["class","children"]);return(()=>{var t=T();return h(t,m({get class(){return g("flex items-center justify-center p-4 text-muted-foreground text-sm",a.class)}},r),!1,!0),l(t,()=>a.children??"No attachments"),t})()}export{fe as A,$ as D,A as U,ve as a,xe as b,we as c,ye as d,be as e,ze as f,F as g,z as h,ke as i,Ce as j,H as n,P as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as n,q as i,m as s,i as o,t as u}from"./define-wjHR1MkU.js";import{c as m}from"./index-BCRhi84a.js";import{c}from"./cn-CU7UAWzk.js";var d=u("<span>");const f=m("inline-flex items-center justify-center rounded-full text-xs font-medium min-h-5 min-w-5",{variants:{variant:{default:"bg-muted text-muted-foreground px-2 py-0.5",count:"bg-muted text-muted-foreground h-5 px-1.5",citation:"bg-primary text-primary-foreground px-1.5 py-0.5 cursor-pointer"}},defaultVariants:{variant:"default"}});function p(a){const[t,e]=n(a,["variant","class","children"]);return(()=>{var r=d();return i(r,s({get class(){return c(f({variant:t.variant}),t.class)}},e),!1,!0),o(r,()=>t.children),r})()}export{p as B};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=Object.freeze(JSON.parse(`{"displayName":"Shell","name":"shellscript","patterns":[{"include":"#initial_context"}],"repository":{"alias_statement":{"begin":"[\\\\t ]*+(alias)[\\\\t ]*+((?:((?<!\\\\w)-\\\\w+)\\\\b[\\\\t ]*+)*)[\\\\t ]*+((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(?:(\\\\[)((?:(?:\\\\$?(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)|@)|\\\\*)|(-?\\\\d+))(]))?(?:(?:(=)|(\\\\+=))|(-=))","beginCaptures":{"1":{"name":"storage.type.alias.shell"},"2":{"patterns":[{"match":"(?<!\\\\w)-\\\\w+\\\\b","name":"string.unquoted.argument.shell constant.other.option.shell"}]},"3":{"name":"string.unquoted.argument.shell constant.other.option.shell"},"4":{"name":"variable.other.assignment.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"variable.other.assignment.shell"},"7":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"8":{"name":"punctuation.definition.array.access.shell"},"9":{"name":"keyword.operator.assignment.shell"},"10":{"name":"keyword.operator.assignment.compound.shell"},"11":{"name":"keyword.operator.assignment.compound.shell"}},"end":"(?=[\\\\t ]|$)|(?:(?:(?:(;)|(&&))|(\\\\|\\\\|))|(&))","endCaptures":{"1":{"name":"punctuation.terminator.statement.semicolon.shell"},"2":{"name":"punctuation.separator.statement.and.shell"},"3":{"name":"punctuation.separator.statement.or.shell"},"4":{"name":"punctuation.separator.statement.background.shell"}},"name":"meta.expression.assignment.alias.shell","patterns":[{"include":"#normal_context"}]},"argument":{"begin":"[\\\\t ]++(?![\\\\n#\\\\&(\\\\[|]|$|;)","beginCaptures":{},"end":"(?=[\\\\t \\\\&;|]|$|[\\\\n)\`])","endCaptures":{},"name":"meta.argument.shell","patterns":[{"include":"#argument_context"},{"include":"#line_continuation"}]},"argument_context":{"patterns":[{"captures":{"1":{"name":"string.unquoted.argument.shell","patterns":[{"match":"\\\\*","name":"variable.language.special.wildcard.shell"},{"include":"#variable"},{"include":"#numeric_literal"},{"captures":{"1":{"name":"constant.language.$1.shell"}},"match":"(?<!\\\\w)\\\\b(true|false)\\\\b(?!\\\\w)"}]}},"match":"[\\\\t ]*+([^\\\\t\\\\n \\"$\\\\&-);<>\\\\\\\\\`|]+(?!>))"},{"include":"#normal_context"}]},"arithmetic_double":{"patterns":[{"begin":"\\\\(\\\\(","beginCaptures":{"0":{"name":"punctuation.section.arithmetic.double.shell"}},"end":"\\\\)\\\\s*\\\\)","endCaptures":{"0":{"name":"punctuation.section.arithmetic.double.shell"}},"name":"meta.arithmetic.shell","patterns":[{"include":"#math"},{"include":"#string"}]}]},"arithmetic_no_dollar":{"patterns":[{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.section.arithmetic.single.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.section.arithmetic.single.shell"}},"name":"meta.arithmetic.shell","patterns":[{"include":"#math"},{"include":"#string"}]}]},"array_access_inline":{"captures":{"1":{"name":"punctuation.section.array.shell"},"2":{"patterns":[{"include":"#special_expansion"},{"include":"#string"},{"include":"#variable"}]},"3":{"name":"punctuation.section.array.shell"}},"match":"(\\\\[)([^]\\\\[]+)(])"},"array_value":{"begin":"[\\\\t ]*+((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(?:(\\\\[)((?:(?:\\\\$?(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)|@)|\\\\*)|(-?\\\\d+))(]))?(?:(?:(=)|(\\\\+=))|(-=))[\\\\t ]*+(\\\\()","beginCaptures":{"1":{"name":"variable.other.assignment.shell"},"2":{"name":"punctuation.definition.array.access.shell"},"3":{"name":"variable.other.assignment.shell"},"4":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"keyword.operator.assignment.shell"},"7":{"name":"keyword.operator.assignment.compound.shell"},"8":{"name":"keyword.operator.assignment.compound.shell"},"9":{"name":"punctuation.definition.array.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.array.shell"}},"patterns":[{"include":"#comment"},{"captures":{"1":{"name":"variable.other.assignment.array.shell entity.other.attribute-name.shell"},"2":{"name":"keyword.operator.assignment.shell punctuation.definition.assignment.shell"}},"match":"((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(=)"},{"captures":{"1":{"name":"punctuation.definition.bracket.named-array.shell"},"2":{"name":"string.unquoted.shell entity.other.attribute-name.bracket.shell"},"3":{"name":"punctuation.definition.bracket.named-array.shell"},"4":{"name":"punctuation.definition.assignment.shell"}},"match":"(\\\\[)(.+?)(])(=)"},{"include":"#normal_context"},{"include":"#simple_unquoted"}]},"assignment_statement":{"patterns":[{"include":"#array_value"},{"include":"#modified_assignment_statement"},{"include":"#normal_assignment_statement"}]},"basic_command_name":{"captures":{"1":{"name":"storage.modifier.$1.shell"},"2":{"name":"entity.name.function.call.shell entity.name.command.shell","patterns":[{"match":"(?<!\\\\w)(?:continue|return|break)(?!\\\\w)","name":"keyword.control.$0.shell"},{"match":"(?<!\\\\w)(?:unfunction|continue|autoload|unsetopt|bindkey|builtin|getopts|command|declare|unalias|history|unlimit|typeset|suspend|source|printf|unhash|disown|ulimit|return|which|alias|break|false|print|shift|times|umask|unset|read|type|exec|eval|wait|echo|dirs|jobs|kill|hash|stat|exit|test|trap|true|let|set|pwd|cd|fg|bg|fc|[.:])(?!/)(?!\\\\w)(?!-)","name":"support.function.builtin.shell"},{"include":"#variable"}]}},"match":"(?![\\\\n!#\\\\&()<>\\\\[{|]|$|[\\\\t ;])(?!nocorrect |nocorrect\\\\t|nocorrect$|readonly |readonly\\\\t|readonly$|function |function\\\\t|function$|foreach |foreach\\\\t|foreach$|coproc |coproc\\\\t|coproc$|logout |logout\\\\t|logout$|export |export\\\\t|export$|select |select\\\\t|select$|repeat |repeat\\\\t|repeat$|pushd |pushd\\\\t|pushd$|until |until\\\\t|until$|while |while\\\\t|while$|local |local\\\\t|local$|case |case\\\\t|case$|done |done\\\\t|done$|elif |elif\\\\t|elif$|else |else\\\\t|else$|esac |esac\\\\t|esac$|popd |popd\\\\t|popd$|then |then\\\\t|then$|time |time\\\\t|time$|for |for\\\\t|for$|end |end\\\\t|end$|fi |fi\\\\t|fi$|do |do\\\\t|do$|in |in\\\\t|in$|if |if\\\\t|if$)(?:((?<=^|[\\\\t \\\\&;])(?:readonly|declare|typeset|export|local)(?=[\\\\t \\\\&;]|$))|((?![\\"']|\\\\\\\\\\\\n?$)[^\\\\t\\\\n\\\\r !\\"'<>]+?))(?:(?=[\\\\t ])|(?=[\\\\n\\\\&);\`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\))","name":"meta.statement.command.name.basic.shell"},"block_comment":{"begin":"\\\\s*+(/\\\\*)","beginCaptures":{"1":{"name":"punctuation.definition.comment.begin.shell"}},"end":"\\\\*/","endCaptures":{"0":{"name":"punctuation.definition.comment.end.shell"}},"name":"comment.block.shell"},"boolean":{"match":"\\\\b(?:true|false)\\\\b","name":"constant.language.$0.shell"},"case_statement":{"begin":"\\\\b(case)\\\\b[\\\\t ]*+(.+?)[\\\\t ]*+\\\\b(in)\\\\b","beginCaptures":{"1":{"name":"keyword.control.case.shell"},"2":{"patterns":[{"include":"#initial_context"}]},"3":{"name":"keyword.control.in.shell"}},"end":"\\\\besac\\\\b","endCaptures":{"0":{"name":"keyword.control.esac.shell"}},"name":"meta.case.shell","patterns":[{"include":"#comment"},{"captures":{"1":{"name":"keyword.operator.pattern.case.default.shell"}},"match":"[\\\\t ]*+(\\\\* *\\\\))"},{"begin":"(?<!\\\\))(?![\\\\t ]*+(?:esac\\\\b|$))","beginCaptures":{},"end":"(?=\\\\besac\\\\b)|(\\\\))","endCaptures":{"1":{"name":"keyword.operator.pattern.case.shell"}},"name":"meta.case.entry.pattern.shell","patterns":[{"include":"#case_statement_context"}]},{"begin":"(?<=\\\\))","beginCaptures":{},"end":"(;;)|(?=\\\\besac\\\\b)","endCaptures":{"1":{"name":"punctuation.terminator.statement.case.shell"}},"name":"meta.case.entry.body.shell","patterns":[{"include":"#typical_statements"},{"include":"#initial_context"}]}]},"case_statement_context":{"patterns":[{"match":"\\\\*","name":"variable.language.special.quantifier.star.shell keyword.operator.quantifier.star.shell punctuation.definition.arbitrary-repetition.shell punctuation.definition.regex.arbitrary-repetition.shell"},{"match":"\\\\+","name":"variable.language.special.quantifier.plus.shell keyword.operator.quantifier.plus.shell punctuation.definition.arbitrary-repetition.shell punctuation.definition.regex.arbitrary-repetition.shell"},{"match":"\\\\?","name":"variable.language.special.quantifier.question.shell keyword.operator.quantifier.question.shell punctuation.definition.arbitrary-repetition.shell punctuation.definition.regex.arbitrary-repetition.shell"},{"match":"@","name":"variable.language.special.at.shell keyword.operator.at.shell punctuation.definition.regex.at.shell"},{"match":"\\\\|","name":"keyword.operator.orvariable.language.special.or.shell keyword.operator.alternation.ruby.shell punctuation.definition.regex.alternation.shell punctuation.separator.regex.alternation.shell"},{"match":"\\\\\\\\.","name":"constant.character.escape.shell"},{"match":"(?<=\\\\tin| in|[\\\\t ]|;;)\\\\(","name":"keyword.operator.pattern.case.shell"},{"begin":"(?<=\\\\S)(\\\\()","beginCaptures":{"1":{"name":"punctuation.definition.group.shell punctuation.definition.regex.group.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.definition.regex.group.shell"}},"name":"meta.parenthese.shell","patterns":[{"include":"#case_statement_context"}]},{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.character-class.shell"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.character-class.shell"}},"name":"string.regexp.character-class.shell","patterns":[{"match":"\\\\\\\\.","name":"constant.character.escape.shell"}]},{"include":"#string"},{"match":"[^\\\\t\\\\n )*?@\\\\[|]","name":"string.unquoted.pattern.shell string.regexp.unquoted.shell"}]},"command_name_range":{"begin":"\\\\G","beginCaptures":{},"end":"(?=[\\\\t \\\\&;|]|$|[\\\\n)\`])|(?=<)","endCaptures":{},"name":"meta.statement.command.name.shell","patterns":[{"match":"(?<!\\\\w)(?:continue|return|break)(?!\\\\w)","name":"entity.name.function.call.shell entity.name.command.shell keyword.control.$0.shell"},{"match":"(?<!\\\\w)(?:unfunction|continue|autoload|unsetopt|bindkey|builtin|getopts|command|declare|unalias|history|unlimit|typeset|suspend|source|printf|unhash|disown|ulimit|return|which|alias|break|false|print|shift|times|umask|unset|read|type|exec|eval|wait|echo|dirs|jobs|kill|hash|stat|exit|test|trap|true|let|set|pwd|cd|fg|bg|fc|[.:])(?!/)(?!\\\\w)(?!-)","name":"entity.name.function.call.shell entity.name.command.shell support.function.builtin.shell"},{"include":"#variable"},{"captures":{"1":{"name":"entity.name.function.call.shell entity.name.command.shell"}},"match":"(?<!\\\\w)(?<=\\\\G|[\\"')}])([^\\\\t\\\\n\\\\r \\"\\\\&');->\`{|]+)"},{"begin":"(?:\\\\G|(?<![\\\\t\\\\n #\\\\&;{|]))(\\\\$?)((\\")|('))","beginCaptures":{"1":{"name":"meta.statement.command.name.quoted.shell punctuation.definition.string.shell entity.name.function.call.shell entity.name.command.shell"},"2":{},"3":{"name":"meta.statement.command.name.quoted.shell string.quoted.double.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell"},"4":{"name":"meta.statement.command.name.quoted.shell string.quoted.single.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell"}},"end":"(?<!\\\\G)(?<=\\\\2)","endCaptures":{},"patterns":[{"include":"#continuation_of_single_quoted_command_name"},{"include":"#continuation_of_double_quoted_command_name"}]},{"include":"#line_continuation"},{"include":"#simple_unquoted"}]},"command_statement":{"begin":"[\\\\t ]*+(?![\\\\n!#\\\\&()<>\\\\[{|]|$|[\\\\t ;])(?!nocorrect |nocorrect\\\\t|nocorrect$|readonly |readonly\\\\t|readonly$|function |function\\\\t|function$|foreach |foreach\\\\t|foreach$|coproc |coproc\\\\t|coproc$|logout |logout\\\\t|logout$|export |export\\\\t|export$|select |select\\\\t|select$|repeat |repeat\\\\t|repeat$|pushd |pushd\\\\t|pushd$|until |until\\\\t|until$|while |while\\\\t|while$|local |local\\\\t|local$|case |case\\\\t|case$|done |done\\\\t|done$|elif |elif\\\\t|elif$|else |else\\\\t|else$|esac |esac\\\\t|esac$|popd |popd\\\\t|popd$|then |then\\\\t|then$|time |time\\\\t|time$|for |for\\\\t|for$|end |end\\\\t|end$|fi |fi\\\\t|fi$|do |do\\\\t|do$|in |in\\\\t|in$|if |if\\\\t|if$)(?!\\\\\\\\\\\\n?$)","beginCaptures":{},"end":"(?=[\\\\n\\\\&);\`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.command.shell","patterns":[{"include":"#command_name_range"},{"include":"#line_continuation"},{"include":"#option"},{"include":"#argument"},{"include":"#string"},{"include":"#heredoc"}]},"comment":{"captures":{"1":{"name":"comment.line.number-sign.shell meta.shebang.shell"},"2":{"name":"punctuation.definition.comment.shebang.shell"},"3":{"name":"comment.line.number-sign.shell"},"4":{"name":"punctuation.definition.comment.shell"}},"match":"(?:^|[\\\\t ]++)(?:((#!).*)|((#).*))"},"comments":{"patterns":[{"include":"#block_comment"},{"include":"#line_comment"}]},"compound-command":{"patterns":[{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"name":"meta.scope.logical-expression.shell","patterns":[{"include":"#logical-expression"},{"include":"#initial_context"}]},{"begin":"(?<=\\\\s|^)\\\\{(?=\\\\s|$)","beginCaptures":{"0":{"name":"punctuation.definition.group.shell"}},"end":"(?<=^|;)\\\\s*(})","endCaptures":{"1":{"name":"punctuation.definition.group.shell"}},"name":"meta.scope.group.shell","patterns":[{"include":"#initial_context"}]}]},"continuation_of_double_quoted_command_name":{"begin":"\\\\G(?<=\\")","beginCaptures":{},"contentName":"meta.statement.command.name.continuation string.quoted.double entity.name.function.call entity.name.command","end":"\\"","endCaptures":{"0":{"name":"string.quoted.double.shell punctuation.definition.string.end.shell entity.name.function.call.shell entity.name.command.shell"}},"patterns":[{"match":"\\\\\\\\[\\\\n\\"$\\\\\\\\\`]","name":"constant.character.escape.shell"},{"include":"#variable"},{"include":"#interpolation"}]},"continuation_of_single_quoted_command_name":{"begin":"\\\\G(?<=')","beginCaptures":{},"contentName":"meta.statement.command.name.continuation string.quoted.single entity.name.function.call entity.name.command","end":"'","endCaptures":{"0":{"name":"string.quoted.single.shell punctuation.definition.string.end.shell entity.name.function.call.shell entity.name.command.shell"}}},"custom_command_names":{"patterns":[]},"custom_commands":{"patterns":[]},"double_quote_context":{"patterns":[{"match":"\\\\\\\\[\\\\n\\"$\\\\\\\\\`]","name":"constant.character.escape.shell"},{"include":"#variable"},{"include":"#interpolation"}]},"double_quote_escape_char":{"match":"\\\\\\\\[\\\\n\\"$\\\\\\\\\`]","name":"constant.character.escape.shell"},"floating_keyword":{"patterns":[{"match":"(?<=^|[\\\\t \\\\&;])(?:then|elif|else|done|end|do|if|fi)(?=[\\\\t \\\\&;]|$)","name":"keyword.control.$0.shell"}]},"for_statement":{"patterns":[{"begin":"\\\\b(for)\\\\b[\\\\t ]*+((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))[\\\\t ]*+\\\\b(in)\\\\b","beginCaptures":{"1":{"name":"keyword.control.for.shell"},"2":{"name":"variable.other.for.shell"},"3":{"name":"keyword.control.in.shell"}},"end":"(?=[\\\\n\\\\&);\`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.for.in.shell","patterns":[{"include":"#string"},{"include":"#simple_unquoted"},{"include":"#normal_context"}]},{"begin":"\\\\b(for)\\\\b","beginCaptures":{"1":{"name":"keyword.control.for.shell"}},"end":"(?=[\\\\n\\\\&);\`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.for.shell","patterns":[{"include":"#arithmetic_double"},{"include":"#normal_context"}]}]},"function_definition":{"applyEndPatternLast":1,"begin":"[\\\\t ]*+(?:\\\\b(function)\\\\b[\\\\t ]*+([^\\\\t\\\\n\\\\r \\"'()=]+)(?:(\\\\()[\\\\t ]*+(\\\\)))?|([^\\\\t\\\\n\\\\r \\"'()=]+)[\\\\t ]*+(\\\\()[\\\\t ]*+(\\\\)))","beginCaptures":{"1":{"name":"storage.type.function.shell"},"2":{"name":"entity.name.function.shell"},"3":{"name":"punctuation.definition.arguments.shell"},"4":{"name":"punctuation.definition.arguments.shell"},"5":{"name":"entity.name.function.shell"},"6":{"name":"punctuation.definition.arguments.shell"},"7":{"name":"punctuation.definition.arguments.shell"}},"end":"(?<=[)}])","endCaptures":{},"name":"meta.function.shell","patterns":[{"match":"\\\\G[\\\\t\\\\n ]"},{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"name":"meta.function.body.shell","patterns":[{"include":"#initial_context"}]},{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"name":"meta.function.body.shell","patterns":[{"include":"#initial_context"}]},{"include":"#initial_context"}]},"heredoc":{"patterns":[{"begin":"((?<!<)<<-)[\\\\t ]*+([\\"'])[\\\\t ]*+([^\\"']+?)(?=[\\"\\\\&';<\\\\s])(\\\\2)(.*)","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.quote.shell"},"3":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"4":{"name":"punctuation.definition.string.heredoc.quote.shell"},"5":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.quoted.heredoc.indent.$3","end":"^\\\\t*\\\\3(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.$0.shell"}},"patterns":[]},{"begin":"((?<!<)<<(?!<))[\\\\t ]*+([\\"'])[\\\\t ]*+([^\\"']+?)(?=[\\"\\\\&';<\\\\s])(\\\\2)(.*)","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.quote.shell"},"3":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"4":{"name":"punctuation.definition.string.heredoc.quote.shell"},"5":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.quoted.heredoc.no-indent.$3","end":"^\\\\3(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.delimiter.shell"}},"patterns":[]},{"begin":"((?<!<)<<-)[\\\\t ]*+([^\\\\t \\"']+)(?=[\\"\\\\&';<\\\\s])(.*)","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"3":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.unquoted.heredoc.indent.$2","end":"^\\\\t*\\\\2(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.delimiter.shell"}},"patterns":[{"include":"#double_quote_escape_char"},{"include":"#variable"},{"include":"#interpolation"}]},{"begin":"((?<!<)<<(?!<))[\\\\t ]*+([^\\\\t \\"']+)(?=[\\"\\\\&';<\\\\s])(.*)","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"3":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.unquoted.heredoc.no-indent.$2","end":"^\\\\2(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.delimiter.shell"}},"patterns":[{"include":"#double_quote_escape_char"},{"include":"#variable"},{"include":"#interpolation"}]}]},"herestring":{"patterns":[{"begin":"(<<<)\\\\s*(('))","beginCaptures":{"1":{"name":"keyword.operator.herestring.shell"},"2":{"name":"string.quoted.single.shell"},"3":{"name":"punctuation.definition.string.begin.shell"}},"contentName":"string.quoted.single.shell","end":"(')","endCaptures":{"0":{"name":"string.quoted.single.shell"},"1":{"name":"punctuation.definition.string.end.shell"}},"name":"meta.herestring.shell"},{"begin":"(<<<)\\\\s*((\\"))","beginCaptures":{"1":{"name":"keyword.operator.herestring.shell"},"2":{"name":"string.quoted.double.shell"},"3":{"name":"punctuation.definition.string.begin.shell"}},"contentName":"string.quoted.double.shell","end":"(\\")","endCaptures":{"0":{"name":"string.quoted.double.shell"},"1":{"name":"punctuation.definition.string.end.shell"}},"name":"meta.herestring.shell","patterns":[{"include":"#double_quote_context"}]},{"captures":{"1":{"name":"keyword.operator.herestring.shell"},"2":{"name":"string.unquoted.herestring.shell","patterns":[{"include":"#initial_context"}]}},"match":"(<<<)\\\\s*(([^)\\\\\\\\\\\\s]|\\\\\\\\.)+)","name":"meta.herestring.shell"}]},"initial_context":{"patterns":[{"include":"#comment"},{"include":"#pipeline"},{"include":"#normal_statement_seperator"},{"include":"#logical_expression_double"},{"include":"#logical_expression_single"},{"include":"#assignment_statement"},{"include":"#case_statement"},{"include":"#for_statement"},{"include":"#loop"},{"include":"#function_definition"},{"include":"#line_continuation"},{"include":"#arithmetic_double"},{"include":"#misc_ranges"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#redirection"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#alias_statement"},{"include":"#normal_statement"},{"include":"#string"},{"include":"#support"}]},"inline_comment":{"captures":{"1":{"name":"comment.block.shell punctuation.definition.comment.begin.shell"},"2":{"name":"comment.block.shell"},"3":{"patterns":[{"match":"\\\\*/","name":"comment.block.shell punctuation.definition.comment.end.shell"},{"match":"\\\\*","name":"comment.block.shell"}]}},"match":"(/\\\\*)((?:[^*]|\\\\*++[^/])*+(\\\\*++/))"},"interpolation":{"patterns":[{"include":"#arithmetic_dollar"},{"include":"#subshell_dollar"},{"begin":"\`","beginCaptures":{"0":{"name":"punctuation.definition.evaluation.backticks.shell"}},"end":"\`","endCaptures":{"0":{"name":"punctuation.definition.evaluation.backticks.shell"}},"name":"string.interpolated.backtick.shell","patterns":[{"match":"\\\\\\\\[$\\\\\\\\\`]","name":"constant.character.escape.shell"},{"begin":"(?<=\\\\W)(?=#)(?!#\\\\{)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.shell"}},"end":"(?!\\\\G)","patterns":[{"begin":"#","beginCaptures":{"0":{"name":"punctuation.definition.comment.shell"}},"end":"(?=\`)","name":"comment.line.number-sign.shell"}]},{"include":"#initial_context"}]}]},"keyword":{"patterns":[{"match":"(?<=^|[\\\\&;\\\\s])(then|else|elif|fi|for|in|do|done|select|continue|esac|while|until|return)(?=[\\\\&;\\\\s]|$)","name":"keyword.control.shell"},{"match":"(?<=^|[\\\\&;\\\\s])(?:export|declare|typeset|local|readonly)(?=[\\\\&;\\\\s]|$)","name":"storage.modifier.shell"}]},"line_comment":{"begin":"\\\\s*+(//)","beginCaptures":{"1":{"name":"punctuation.definition.comment.shell"}},"end":"(?<=\\\\n)(?<!\\\\\\\\\\\\n)","endCaptures":{},"name":"comment.line.double-slash.shell","patterns":[{"include":"#line_continuation_character"}]},"line_continuation":{"match":"\\\\\\\\(?=\\\\n)","name":"constant.character.escape.line-continuation.shell"},"logical-expression":{"patterns":[{"include":"#arithmetic_no_dollar"},{"match":"=[=~]?|!=?|[<>]|&&|\\\\|\\\\|","name":"keyword.operator.logical.shell"},{"match":"(?<!\\\\S)-(nt|ot|ef|eq|ne|l[et]|g[et]|[GLNOSa-hknopr-uwxz])\\\\b","name":"keyword.operator.logical.shell"}]},"logical_expression_context":{"patterns":[{"include":"#regex_comparison"},{"include":"#arithmetic_no_dollar"},{"include":"#logical-expression"},{"include":"#logical_expression_single"},{"include":"#logical_expression_double"},{"include":"#comment"},{"include":"#boolean"},{"include":"#redirect_number"},{"include":"#numeric_literal"},{"include":"#pipeline"},{"include":"#normal_statement_seperator"},{"include":"#string"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#support"}]},"logical_expression_double":{"begin":"\\\\[\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"end":"]]","endCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"name":"meta.scope.logical-expression.shell","patterns":[{"include":"#logical_expression_context"}]},"logical_expression_single":{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"name":"meta.scope.logical-expression.shell","patterns":[{"include":"#logical_expression_context"}]},"loop":{"patterns":[{"begin":"(?<=^|[\\\\&;\\\\s])(for)\\\\s+(.+?)\\\\s+(in)(?=[\\\\&;\\\\s]|$)","beginCaptures":{"1":{"name":"keyword.control.shell"},"2":{"name":"variable.other.loop.shell","patterns":[{"include":"#string"}]},"3":{"name":"keyword.control.shell"}},"end":"(?<=^|[\\\\&;\\\\s])done(?=[\\\\&;\\\\s]|$|\\\\))","endCaptures":{"0":{"name":"keyword.control.shell"}},"name":"meta.scope.for-in-loop.shell","patterns":[{"include":"#initial_context"}]},{"begin":"(?<=^|[\\\\&;\\\\s])(while|until)(?=[\\\\&;\\\\s]|$)","beginCaptures":{"1":{"name":"keyword.control.shell"}},"end":"(?<=^|[\\\\&;\\\\s])done(?=[\\\\&;\\\\s]|$|\\\\))","endCaptures":{"0":{"name":"keyword.control.shell"}},"name":"meta.scope.while-loop.shell","patterns":[{"include":"#initial_context"}]},{"begin":"(?<=^|[\\\\&;\\\\s])(select)\\\\s+((?:[^\\\\\\\\\\\\s]|\\\\\\\\.)+)(?=[\\\\&;\\\\s]|$)","beginCaptures":{"1":{"name":"keyword.control.shell"},"2":{"name":"variable.other.loop.shell"}},"end":"(?<=^|[\\\\&;\\\\s])(done)(?=[\\\\&;\\\\s]|$|\\\\))","endCaptures":{"1":{"name":"keyword.control.shell"}},"name":"meta.scope.select-block.shell","patterns":[{"include":"#initial_context"}]},{"begin":"(?<=^|[\\\\&;\\\\s])if(?=[\\\\&;\\\\s]|$)","beginCaptures":{"0":{"name":"keyword.control.if.shell"}},"end":"(?<=^|[\\\\&;\\\\s])fi(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"keyword.control.fi.shell"}},"name":"meta.scope.if-block.shell","patterns":[{"include":"#initial_context"}]}]},"math":{"patterns":[{"include":"#variable"},{"match":"\\\\+{1,2}|-{1,2}|[!~]|\\\\*{1,2}|[%/]|<[<=]?|>[=>]?|==|!=|^|\\\\|{1,2}|&{1,2}|[,:=?]|[-%\\\\&*+/^|]=|<<=|>>=","name":"keyword.operator.arithmetic.shell"},{"match":"0[Xx]\\\\h+","name":"constant.numeric.hex.shell"},{"match":";","name":"punctuation.separator.semicolon.range"},{"match":"0\\\\d+","name":"constant.numeric.octal.shell"},{"match":"\\\\d{1,2}#[0-9@-Z_a-z]+","name":"constant.numeric.other.shell"},{"match":"\\\\d+","name":"constant.numeric.integer.shell"},{"match":"(?<!\\\\w)[0-9A-Z_a-z]+(?!\\\\w)","name":"variable.other.normal.shell"}]},"math_operators":{"patterns":[{"match":"\\\\+{1,2}|-{1,2}|[!~]|\\\\*{1,2}|[%/]|<[<=]?|>[=>]?|==|!=|^|\\\\|{1,2}|&{1,2}|[,:=?]|[-%\\\\&*+/^|]=|<<=|>>=","name":"keyword.operator.arithmetic.shell"},{"match":"0[Xx]\\\\h+","name":"constant.numeric.hex.shell"},{"match":"0\\\\d+","name":"constant.numeric.octal.shell"},{"match":"\\\\d{1,2}#[0-9@-Z_a-z]+","name":"constant.numeric.other.shell"},{"match":"\\\\d+","name":"constant.numeric.integer.shell"}]},"misc_ranges":{"patterns":[{"include":"#logical_expression_single"},{"include":"#logical_expression_double"},{"include":"#subshell_dollar"},{"begin":"(?<![^\\\\t ])(\\\\{)(?![$\\\\w])","beginCaptures":{"1":{"name":"punctuation.definition.group.shell"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.group.shell"}},"name":"meta.scope.group.shell","patterns":[{"include":"#initial_context"}]}]},"modified_assignment_statement":{"begin":"(?<=^|[\\\\t \\\\&;])(?:readonly|declare|typeset|export|local)(?=[\\\\t \\\\&;]|$)","beginCaptures":{"0":{"name":"storage.modifier.$0.shell"}},"end":"(?=[\\\\n\\\\&);\`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.shell meta.expression.assignment.modified.shell","patterns":[{"match":"(?<!\\\\w)-\\\\w+\\\\b","name":"string.unquoted.argument.shell constant.other.option.shell"},{"include":"#array_value"},{"captures":{"1":{"name":"variable.other.assignment.shell"},"2":{"name":"punctuation.definition.array.access.shell"},"3":{"name":"variable.other.assignment.shell"},"4":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"keyword.operator.assignment.shell"},"7":{"name":"keyword.operator.assignment.compound.shell"},"8":{"name":"keyword.operator.assignment.compound.shell"},"9":{"name":"constant.numeric.shell constant.numeric.hex.shell"},"10":{"name":"constant.numeric.shell constant.numeric.octal.shell"},"11":{"name":"constant.numeric.shell constant.numeric.other.shell"},"12":{"name":"constant.numeric.shell constant.numeric.decimal.shell"},"13":{"name":"constant.numeric.shell constant.numeric.version.shell"},"14":{"name":"constant.numeric.shell constant.numeric.integer.shell"}},"match":"((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(?:(\\\\[)((?:(?:\\\\$?(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)|@)|\\\\*)|(-?\\\\d+))(]))?(?:(?:(=)|(\\\\+=))|(-=))?(?:(?<=[\\\\t =]|^|[(\\\\[{])(?:(?:(?:(?:(?:(0[Xx]\\\\h+)|(0\\\\d+))|(\\\\d{1,2}#[0-9@-Z_a-z]+))|(-?\\\\d+\\\\.\\\\d+))|(-?\\\\d+(?:\\\\.\\\\d+)+))|(-?\\\\d+))(?=[\\\\t ]|$|[);}]))?"},{"include":"#normal_context"}]},"modifiers":{"match":"(?<=^|[\\\\t \\\\&;])(?:readonly|declare|typeset|export|local)(?=[\\\\t \\\\&;]|$)","name":"storage.modifier.$0.shell"},"normal_assignment_statement":{"begin":"[\\\\t ]*+((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(?:(\\\\[)((?:(?:\\\\$?(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)|@)|\\\\*)|(-?\\\\d+))(]))?(?:(?:(=)|(\\\\+=))|(-=))","beginCaptures":{"1":{"name":"variable.other.assignment.shell"},"2":{"name":"punctuation.definition.array.access.shell"},"3":{"name":"variable.other.assignment.shell"},"4":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"keyword.operator.assignment.shell"},"7":{"name":"keyword.operator.assignment.compound.shell"},"8":{"name":"keyword.operator.assignment.compound.shell"}},"end":"(?=[\\\\n\\\\&);\`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.expression.assignment.shell","patterns":[{"include":"#comment"},{"include":"#string"},{"include":"#normal_assignment_statement"},{"begin":"(?<=[\\\\t ])(?![\\\\t ]|\\\\w+=)","beginCaptures":{},"end":"(?=[\\\\n\\\\&);\`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.command.env.shell","patterns":[{"include":"#command_name_range"},{"include":"#line_continuation"},{"include":"#option"},{"include":"#argument"},{"include":"#string"}]},{"include":"#simple_unquoted"},{"include":"#normal_context"}]},"normal_context":{"patterns":[{"include":"#comment"},{"include":"#pipeline"},{"include":"#normal_statement_seperator"},{"include":"#misc_ranges"},{"include":"#boolean"},{"include":"#redirect_number"},{"include":"#numeric_literal"},{"include":"#string"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#redirection"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#support"},{"include":"#parenthese"}]},"normal_statement":{"begin":"(?!^[\\\\t ]*+$)(?:(?<=(?:^until| until|\\\\tuntil|^while| while|\\\\twhile|^elif| elif|\\\\telif|^else| else|\\\\telse|^then| then|\\\\tthen|^do| do|\\\\tdo|^if| if|\\\\tif) )|(?<=^|[!\\\\&(;\`{|]))[\\\\t ]*+(?!nocorrect\\\\W|nocorrect\\\\$|function\\\\W|function\\\\$|foreach\\\\W|foreach\\\\$|repeat\\\\W|repeat\\\\$|logout\\\\W|logout\\\\$|coproc\\\\W|coproc\\\\$|select\\\\W|select\\\\$|while\\\\W|while\\\\$|pushd\\\\W|pushd\\\\$|until\\\\W|until\\\\$|case\\\\W|case\\\\$|done\\\\W|done\\\\$|elif\\\\W|elif\\\\$|else\\\\W|else\\\\$|esac\\\\W|esac\\\\$|popd\\\\W|popd\\\\$|then\\\\W|then\\\\$|time\\\\W|time\\\\$|for\\\\W|for\\\\$|end\\\\W|end\\\\$|fi\\\\W|fi\\\\$|do\\\\W|do\\\\$|in\\\\W|in\\\\$|if\\\\W|if\\\\$)","beginCaptures":{},"end":"(?=[\\\\n\\\\&);\`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.shell","patterns":[{"include":"#typical_statements"}]},"normal_statement_seperator":{"captures":{"1":{"name":"punctuation.terminator.statement.semicolon.shell"},"2":{"name":"punctuation.separator.statement.and.shell"},"3":{"name":"punctuation.separator.statement.or.shell"},"4":{"name":"punctuation.separator.statement.background.shell"}},"match":"(?:(?:(;)|(&&))|(\\\\|\\\\|))|(&)"},"numeric_literal":{"captures":{"1":{"name":"constant.numeric.shell constant.numeric.hex.shell"},"2":{"name":"constant.numeric.shell constant.numeric.octal.shell"},"3":{"name":"constant.numeric.shell constant.numeric.other.shell"},"4":{"name":"constant.numeric.shell constant.numeric.decimal.shell"},"5":{"name":"constant.numeric.shell constant.numeric.version.shell"},"6":{"name":"constant.numeric.shell constant.numeric.integer.shell"}},"match":"(?<=[\\\\t =]|^|[(\\\\[{])(?:(?:(?:(?:(?:(0[Xx]\\\\h+)|(0\\\\d+))|(\\\\d{1,2}#[0-9@-Z_a-z]+))|(-?\\\\d+\\\\.\\\\d+))|(-?\\\\d+(?:\\\\.\\\\d+)+))|(-?\\\\d+))(?=[\\\\t ]|$|[);}])"},"option":{"begin":"[\\\\t ]++(-)((?![\\\\n!#\\\\&()<>\\\\[{|]|$|[\\\\t ;]))","beginCaptures":{"1":{"name":"string.unquoted.argument.shell constant.other.option.dash.shell"},"2":{"name":"string.unquoted.argument.shell constant.other.option.shell"}},"contentName":"string.unquoted.argument constant.other.option","end":"(?=[\\\\t ])|(?=[\\\\n\\\\&);\`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"patterns":[{"include":"#option_context"}]},"option_context":{"patterns":[{"include":"#misc_ranges"},{"include":"#string"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#redirection"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#support"}]},"parenthese":{"patterns":[{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.section.parenthese.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.section.parenthese.shell"}},"name":"meta.parenthese.group.shell","patterns":[{"include":"#initial_context"}]}]},"pathname":{"patterns":[{"match":"(?<=[:=\\\\s]|^)~","name":"keyword.operator.tilde.shell"},{"match":"[*?]","name":"keyword.operator.glob.shell"},{"begin":"([!*+?@])(\\\\()","beginCaptures":{"1":{"name":"keyword.operator.extglob.shell"},"2":{"name":"punctuation.definition.extglob.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.extglob.shell"}},"name":"meta.structure.extglob.shell","patterns":[{"include":"#initial_context"}]}]},"pipeline":{"patterns":[{"match":"(?<=^|[\\\\&;\\\\s])(time)(?=[\\\\&;\\\\s]|$)","name":"keyword.other.shell"},{"match":"[!|]","name":"keyword.operator.pipe.shell"}]},"redirect_fix":{"captures":{"1":{"name":"keyword.operator.redirect.shell"},"2":{"name":"string.unquoted.argument.shell"}},"match":"(>>?)[\\\\t ]*+([^\\\\t\\\\n \\"$\\\\&-);<>\\\\\\\\\`|]+)"},"redirect_number":{"captures":{"1":{"name":"keyword.operator.redirect.stdout.shell"},"2":{"name":"keyword.operator.redirect.stderr.shell"},"3":{"name":"keyword.operator.redirect.$3.shell"}},"match":"(?<=[\\\\t ])(?:(1)|(2)|(\\\\d+))(?=>)"},"redirection":{"patterns":[{"begin":"[<>]\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.interpolated.process-substitution.shell","patterns":[{"include":"#initial_context"}]},{"match":"(?<![<>])(&>|\\\\d*>&\\\\d*|\\\\d*(>>|[<>])|\\\\d*<&|\\\\d*<>)(?![<>])","name":"keyword.operator.redirect.shell"}]},"regex_comparison":{"match":"=~","name":"keyword.operator.logical.regex.shell"},"regexp":{"patterns":[{"match":".+"}]},"simple_options":{"captures":{"0":{"patterns":[{"captures":{"1":{"name":"string.unquoted.argument.shell constant.other.option.dash.shell"},"2":{"name":"string.unquoted.argument.shell constant.other.option.shell"}},"match":"[\\\\t ]++(-)(\\\\w+)"}]}},"match":"(?:[\\\\t ]++-\\\\w+)*"},"simple_unquoted":{"match":"[^\\\\t\\\\n \\"$\\\\&-);<>\\\\\\\\\`|]","name":"string.unquoted.shell"},"special_expansion":{"match":"!|:[-=?]?|[*@]|##?|%%|[%/]","name":"keyword.operator.expansion.shell"},"start_of_command":{"match":"[\\\\t ]*+(?![\\\\n!#\\\\&()<>\\\\[{|]|$|[\\\\t ;])(?!nocorrect |nocorrect\\\\t|nocorrect$|readonly |readonly\\\\t|readonly$|function |function\\\\t|function$|foreach |foreach\\\\t|foreach$|coproc |coproc\\\\t|coproc$|logout |logout\\\\t|logout$|export |export\\\\t|export$|select |select\\\\t|select$|repeat |repeat\\\\t|repeat$|pushd |pushd\\\\t|pushd$|until |until\\\\t|until$|while |while\\\\t|while$|local |local\\\\t|local$|case |case\\\\t|case$|done |done\\\\t|done$|elif |elif\\\\t|elif$|else |else\\\\t|else$|esac |esac\\\\t|esac$|popd |popd\\\\t|popd$|then |then\\\\t|then$|time |time\\\\t|time$|for |for\\\\t|for$|end |end\\\\t|end$|fi |fi\\\\t|fi$|do |do\\\\t|do$|in |in\\\\t|in$|if |if\\\\t|if$)(?!\\\\\\\\\\\\n?$)"},"string":{"patterns":[{"match":"\\\\\\\\.","name":"constant.character.escape.shell"},{"begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"'","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.quoted.single.shell"},{"begin":"\\\\$?\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.quoted.double.shell","patterns":[{"match":"\\\\\\\\[\\\\n\\"$\\\\\\\\\`]","name":"constant.character.escape.shell"},{"include":"#variable"},{"include":"#interpolation"}]},{"begin":"\\\\$'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"'","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.quoted.single.dollar.shell","patterns":[{"match":"\\\\\\\\['\\\\\\\\abefnrtv]","name":"constant.character.escape.ansi-c.shell"},{"match":"\\\\\\\\[0-9]{3}\\"","name":"constant.character.escape.octal.shell"},{"match":"\\\\\\\\x\\\\h{2}\\"","name":"constant.character.escape.hex.shell"},{"match":"\\\\\\\\c.\\"","name":"constant.character.escape.control-char.shell"}]}]},"subshell_dollar":{"patterns":[{"begin":"\\\\$\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.subshell.single.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.subshell.single.shell"}},"name":"meta.scope.subshell","patterns":[{"include":"#parenthese"},{"include":"#initial_context"}]}]},"support":{"patterns":[{"match":"(?<=^|[\\\\&;\\\\s])[.:](?=[\\\\&;\\\\s]|$)","name":"support.function.builtin.shell"}]},"typical_statements":{"patterns":[{"include":"#assignment_statement"},{"include":"#case_statement"},{"include":"#for_statement"},{"include":"#while_statement"},{"include":"#function_definition"},{"include":"#command_statement"},{"include":"#line_continuation"},{"include":"#arithmetic_double"},{"include":"#normal_context"}]},"variable":{"patterns":[{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.parameter.positional.all.shell"},"2":{"name":"variable.parameter.positional.all.shell"}},"match":"(\\\\$)(@(?!\\\\w))"},{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.parameter.positional.shell"},"2":{"name":"variable.parameter.positional.shell"}},"match":"(\\\\$)([0-9](?!\\\\w))"},{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.language.special.shell"},"2":{"name":"variable.language.special.shell"}},"match":"(\\\\$)([-!#$*0?_](?!\\\\w))"},{"begin":"(\\\\$)(\\\\{)[\\\\t ]*+(?=\\\\d)","beginCaptures":{"1":{"name":"punctuation.definition.variable.shell variable.parameter.positional.shell"},"2":{"name":"punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell variable.parameter.positional.shell"}},"contentName":"meta.parameter-expansion","end":"}","endCaptures":{"0":{"name":"punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell variable.parameter.positional.shell"}},"patterns":[{"include":"#special_expansion"},{"include":"#array_access_inline"},{"match":"[0-9]+","name":"variable.parameter.positional.shell"},{"match":"(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)","name":"variable.other.normal.shell"},{"include":"#variable"},{"include":"#string"}]},{"begin":"(\\\\$)(\\\\{)","beginCaptures":{"1":{"name":"punctuation.definition.variable.shell"},"2":{"name":"punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell"}},"contentName":"meta.parameter-expansion","end":"}","endCaptures":{"0":{"name":"punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell"}},"patterns":[{"include":"#special_expansion"},{"include":"#array_access_inline"},{"match":"(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)","name":"variable.other.normal.shell"},{"include":"#variable"},{"include":"#string"}]},{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.other.normal.shell"},"2":{"name":"variable.other.normal.shell"}},"match":"(\\\\$)(\\\\w+(?!\\\\w))"}]},"while_statement":{"patterns":[{"begin":"\\\\b(while)\\\\b","beginCaptures":{"1":{"name":"keyword.control.while.shell"}},"end":"(?=[\\\\n\\\\&);\`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.while.shell","patterns":[{"include":"#line_continuation"},{"include":"#math_operators"},{"include":"#option"},{"include":"#simple_unquoted"},{"include":"#normal_context"},{"include":"#string"}]}]}},"scopeName":"source.shell","aliases":["bash","sh","shell","zsh"]}`)),n=[e];export{n as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{z as c,i as p,c as a,d as l,S as u,j as C,a as A,n as O,t as g,w as $,l as y,k as F,D as S}from"./define-wjHR1MkU.js";import{C as z,u as k}from"./use-card-resolution-DoA2f_EU.js";import{F as U,v as E}from"./form-CQirdC4W.js";import{C as T}from"./confirm-card-B0flE3MN.js";import{T as M}from"./tasks-card-CmZ5xh6v.js";import{C as P}from"./choice-card-D4QUIOWZ.js";import{L as N}from"./link-preview-OQ9IEq0f.js";import{E as B}from"./embed-D3KewsIJ.js";import{A as D}from"./artifact-BkYcfIlZ.js";import{t as j}from"./triangle-alert-F9cyUEyy.js";var R=g('<h3 class="shrink-0 truncate border-b border-border px-3 py-2 text-sm font-medium text-foreground">'),Z=g('<div part=card data-card-type=artifact role=group class="flex w-full flex-col overflow-hidden rounded-xl border border-border bg-card"><div class="min-h-0 flex-1">');const _="420px";function G(e){return typeof e=="number"?`${e}px`:typeof e=="string"&&e.trim()!==""?e:_}function H(e){const r=$(),n=c(()=>e.data.tab),s=c(()=>e.data.activeFile),d=i=>{var o;return(o=e.host)==null?void 0:o.emit({kind:"state",cardId:e.cardId,patch:i})};return(()=>{var i=Z(),o=i.firstChild;return p(i,a(u,{get when(){return e.heading},get children(){var t=R();return l(t,"id",r),p(t,()=>e.heading),t}}),o),p(o,a(D,{get src(){return e.data.src},get files(){return e.data.files},defaultTab:n,activeFile:s,get displayUrl(){return e.data.displayUrl},get iframeTitle(){return C(()=>!!e.heading)()?`${e.heading} preview`:"Artifact preview"},onNavigate:t=>d({src:t}),onTabChange:t=>d({tab:t}),onFileSelect:t=>d({activeFile:t})})),A(t=>{var f=e.cardId,v=e.heading?r:void 0,b=e.heading?void 0:"Artifact",x=G(e.data.height);return f!==t.e&&l(i,"data-card-id",t.e=f),v!==t.t&&l(i,"aria-labelledby",t.t=v),b!==t.a&&l(i,"aria-label",t.a=b),x!==t.o&&O(i,"height",t.o=x),t},{e:void 0,t:void 0,a:void 0,o:void 0}),i})()}const m={form:e=>a(U,{get data(){return e.envelope.data},get cardId(){return e.envelope.id},get heading(){return e.envelope.title},get resolution(){return e.envelope.resolution},get host(){return e.host}}),confirm:e=>a(T,{get data(){return e.envelope.data},get cardId(){return e.envelope.id},get heading(){return e.envelope.title},get resolution(){return e.envelope.resolution},get host(){return e.host}}),tasks:e=>a(M,{get data(){return e.envelope.data},get cardId(){return e.envelope.id},get heading(){return e.envelope.title},get resolution(){return e.envelope.resolution},get host(){return e.host}}),choice:e=>a(P,{get data(){return e.envelope.data},get cardId(){return e.envelope.id},get heading(){return e.envelope.title},get resolution(){return e.envelope.resolution},get host(){return e.host}}),link:e=>a(N,{get data(){return e.envelope.data},get cardId(){return e.envelope.id},onEmit:r=>{var n;return(n=e.host)==null?void 0:n.emit(r)}}),embed:e=>a(B,{get data(){return e.envelope.data},get cardId(){return e.envelope.id},onEmit:r=>{var n;return(n=e.host)==null?void 0:n.emit(r)}}),artifact:e=>a(H,{get data(){return e.envelope.data},get cardId(){return e.envelope.id},get heading(){return e.envelope.title},get host(){return e.host}})};function J(e){return e?{...m,...e}:{...m}}const I={artifact:{type:"object",properties:{src:{type:"string"},files:{type:"array",maxItems:500,items:{type:"object",required:["path"],properties:{path:{type:"string",maxLength:1024},url:{type:"string"},code:{type:"string"},language:{type:"string",maxLength:40},type:{type:"string",enum:["html","pdf","image","other"]},additions:{type:"integer",minimum:0},deletions:{type:"integer",minimum:0},status:{type:"string",enum:["added","modified","deleted","renamed","untracked"]}}}},tab:{type:"string",enum:["preview","code"]},activeFile:{type:"string",maxLength:1024},displayUrl:{type:"string",maxLength:2048}}},choice:{type:"object",required:["options"],properties:{prompt:{type:"string"},submitLabel:{type:"string"},options:{type:"array",minItems:1,items:{type:"object",required:["id","label"],properties:{id:{type:"string",minLength:1},label:{type:"string",minLength:1},description:{type:"string"},media:{type:"object",properties:{image:{type:"string"},imageAlt:{type:"string"},icon:{type:"string"}}},meta:{type:"string"},recommended:{type:"boolean"},disabled:{type:"boolean"}}}},dismissible:{type:"boolean"}}},confirm:{type:"object",required:["actions"],properties:{heading:{type:"string"},body:{type:"string"},tone:{type:"string",enum:["default","warning","danger"]},actions:{type:"array",minItems:1,maxItems:4,items:{type:"object",required:["id","label"],properties:{id:{type:"string",minLength:1},label:{type:"string",minLength:1},style:{type:"string",enum:["primary","default","destructive"]},default:{type:"boolean"}}}},dismissible:{type:"boolean"}}},embed:{type:"object",required:["provider"],properties:{provider:{type:"string",enum:["youtube","vimeo","generic"]},id:{type:"string",maxLength:64,pattern:"^[A-Za-z0-9_-]+$"},url:{type:"string"},title:{type:"string",maxLength:300},poster:{type:"string"},start:{type:"integer",minimum:0},aspectRatio:{type:"string",enum:["16:9","4:3","1:1","9:16"]}}},form:{type:"object",required:["type","properties"],properties:{type:{const:"object"},title:{type:"string"},description:{type:"string"},required:{type:"array",items:{type:"string"}},properties:{type:"object"},"x-kai-order":{type:"array",items:{type:"string"}},"x-kai-inlineMax":{type:"integer",minimum:1},"x-kai-submitLabel":{type:"string"},"x-kai-dismissible":{type:"boolean"},"x-kai-actions":{type:"array",items:{type:"object",required:["id","label"],properties:{id:{type:"string"},label:{type:"string"},variant:{enum:["default","ghost","outline"]}}}}}},link:{type:"object",required:["url"],properties:{url:{type:"string"},title:{type:"string",maxLength:300},description:{type:"string",maxLength:1e3},image:{type:"string"},imageAlt:{type:"string",maxLength:300},favicon:{type:"string"},domain:{type:"string",maxLength:253},siteName:{type:"string",maxLength:200}}},tasks:{type:"object",required:["tasks"],properties:{mode:{type:"string",enum:["select","progress"]},heading:{type:"string"},tasks:{type:"array",minItems:1,items:{type:"object",required:["id","label"],properties:{id:{type:"string",minLength:1},label:{type:"string",minLength:1},description:{type:"string"},checked:{type:"boolean"},disabled:{type:"boolean"}}}},selectAll:{type:"boolean"},confirmLabel:{type:"string"},allowEmpty:{type:"boolean"},min:{type:"integer",minimum:0},max:{type:"integer",minimum:1},dismissible:{type:"boolean"}}}},K=Object.freeze({type:"hard",required:"hard",const:"hard",minItems:"hard",enum:"soft",maxItems:"soft",minLength:"soft",maxLength:"soft",pattern:"soft",minimum:"soft",maximum:"soft",exclusiveMinimum:"soft",exclusiveMaximum:"soft",uniqueItems:"soft"}),Q="soft";function V(e){return Object.prototype.hasOwnProperty.call(I,e)}function W(e,r){if(r&&Object.prototype.hasOwnProperty.call(r,e)){const n=r[e];if(n&&typeof n=="object")return n}return V(e)?I[e]:null}function X(e){const r=e.slice(0,3).map(s=>s.message),n=e.length-r.length;return r.join("; ")+(n>0?`; and ${n} more`:"")}function L(e,r,n){const s=W(e,n);if(s===null)return null;const d=E(s,r);if(d.valid)return{ok:!0,tier:"ok",issues:[],hard:[],summary:""};const i=d.issues.map(t=>({...t,tier:K[t.keyword]??Q})),o=i.filter(t=>t.tier==="hard");return{ok:!1,tier:o.length>0?"hard":"soft",issues:i,hard:o,summary:X(o.length>0?o:i)}}function w(e){return`invalid card data (${e.tier}): ${e.summary}`}var Y=g('<div data-card-fallback role=alert class="flex items-center gap-2 p-4 text-sm text-muted-foreground"><span>Unsupported card type: <code class=font-mono>'),ee=g('<div data-card-fallback data-card-invalid role=alert class="flex items-start gap-2 p-4 text-sm text-muted-foreground"><span class=min-w-0>Invalid <code class=font-mono></code> card: <code data-card-invalid-reason class="font-mono break-words">');function h(e){return a(z,{get children(){return a(u,{get when(){return e.reason},get fallback(){return(()=>{var r=Y(),n=r.firstChild,s=n.firstChild,d=s.nextSibling;return p(r,a(j,{class:"size-4 shrink-0 text-destructive dark:text-red-400","aria-hidden":"true"}),n),p(d,()=>e.type),r})()},children:r=>(()=>{var n=ee(),s=n.firstChild,d=s.firstChild,i=d.nextSibling,o=i.nextSibling,t=o.nextSibling;return p(n,a(j,{class:"size-4 shrink-0 translate-y-0.5 text-destructive dark:text-red-400","aria-hidden":"true"}),s),p(i,()=>e.type),p(t,r),n})()})}})}function q(e,r){if(!e||!Object.prototype.hasOwnProperty.call(e,r))return!1;const n=e[r];return typeof n=="object"&&n!==null}function te(e){const r=k(),n=y(()=>J(e.types)),s=y(()=>n()[e.envelope.type]),d=y(()=>e.validateCards===!1||!q(e.schemas,e.envelope.type)&&s()!==m[e.envelope.type]?null:L(e.envelope.type,e.envelope.data,e.schemas));let i=null;return F(()=>{const o=d();if(!s())return;if(!o||o.ok){i=null;return}const t=w(o);t!==i&&(i=t,r?.emit({kind:"error",cardId:e.envelope.id,message:t}))}),a(u,{get when(){return s()},get fallback(){return a(re,{get envelope(){return e.envelope}})},children:o=>a(u,{get when(){var t;return((t=d())==null?void 0:t.tier)==="hard"},get fallback(){return a(S,{get component(){return o()},get envelope(){return e.envelope},host:r})},get children(){return a(h,{get type(){return e.envelope.type},get cardId(){return e.envelope.id},get reason(){return d().summary}})}})})}function re(e){const r=k();return c(()=>r?.emit({kind:"error",cardId:e.envelope.id,message:`Unsupported card type: ${e.envelope.type}`})),a(h,{get type(){return e.envelope.type},get cardId(){return e.envelope.id}})}export{m as B,h as C,te as a,w as c,q as h,L as v};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const a="kai-card";function i(r,e){r.dispatchEvent(new CustomEvent(a,{detail:e,bubbles:!0,composed:!0}))}const p=["http:","https:","mailto:"],u=["javascript:","vbscript:"];function s(r){try{return new URL(r,"http://_invalid_base").protocol}catch{return}}function c(r){const e=s(r);return e!==void 0&&p.includes(e)}function m(r){const e=s(r);return e!==void 0&&u.includes(e)}function t(r){console.warn(`[kai-card] no policy handler for "${r}"`)}function b(r,e){const n=r??{};switch(e.kind){case"ready":break;case"submit":n.onSubmit?n.onSubmit(e.cardId,e.data):t("submit");break;case"action":n.onAction?n.onAction(e.cardId,e.action,e.payload):t("action");break;case"send-prompt":{const o=e.mode??"compose",d=n.maxSendPromptMode==="send"?o:"compose";n.onSendPrompt?n.onSendPrompt(e.text,{mode:d,context:e.context}):t("send-prompt");break}case"open":{if(!c(e.url)){n.onError?n.onError(e.cardId,`Blocked unsafe url: ${e.url}`):t("open(unsafe)");break}const o=e.target??"tab";n.onOpen?n.onOpen(e.url,o):typeof window<"u"&&window.open(e.url,"_blank","noopener,noreferrer");break}case"state":n.onState?n.onState(e.cardId,e.patch):t("state");break;case"dismiss":n.onDismiss?n.onDismiss(e.cardId):t("dismiss");break;case"reopen":n.onReopen?n.onReopen(e.cardId):t("reopen");break;case"error":n.onError?n.onError(e.cardId,e.message):t("error");break}}export{a as C,c as a,i as e,m as i,b as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as m}from"./Icon--Y8vsFal.js";import{c as o,m as r}from"./define-wjHR1MkU.js";var c=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],e=a=>o(m,r(a,{name:"Check",iconNode:c})),f=e;export{f as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as r}from"./Icon--Y8vsFal.js";import{c as a,m}from"./define-wjHR1MkU.js";var e=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],n=o=>a(r,m(o,{name:"ChevronDown",iconNode:e})),p=n;export{p as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as o}from"./Icon--Y8vsFal.js";import{c as a,m as r}from"./define-wjHR1MkU.js";var t=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],e=m=>a(o,r(m,{name:"ChevronRight",iconNode:t})),h=e;export{h as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as me,s as ve,l as x,g as U,k as G,x as te,o as fe,c,E as he,S as b,i as p,d as m,F as be,a as w,b as M,u as re,t as f,w as ye,y as xe,j as V,e as ke}from"./define-wjHR1MkU.js";import{c as F}from"./cn-CU7UAWzk.js";import{B as ne}from"./button-flUbeufF.js";import{c as we}from"./hover-card-CJJkfHTK.js";import{u as Ie,a as $e,C as J,D as Ae}from"./use-card-resolution-DoA2f_EU.js";import{e as De}from"./card-routing-BK09BdmL.js";import{x as Re}from"./x-B6UnOiLw.js";import{c as Ce}from"./check-B5kBPKeo.js";var Se=f('<p class="text-sm text-foreground">'),je=f("<div role=radiogroup>"),Ee=f('<div class="flex flex-col gap-2"><label class=sr-only></label><input type=text class="w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60">'),Te=f('<div class="flex w-full flex-wrap items-center justify-between gap-2">'),Le=f("<div>"),Me=f('<span class="inline-flex items-center rounded-full bg-[var(--color-primary)] px-1.5 py-0.5 text-[0.625rem] font-medium uppercase leading-none tracking-wide text-[var(--color-primary-foreground,white)]">Recommended'),Ve=f("<img>"),Fe=f('<span aria-hidden=true class="flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-muted text-sm font-medium text-muted-foreground">'),Oe=f('<img class="max-h-80 max-w-80 rounded-md object-contain">'),_e=f('<span class="h-2 w-2 rounded-full bg-[var(--color-primary)]">'),ze=f('<span class="text-xs font-normal text-muted-foreground">'),qe=f('<span class="ml-auto shrink-0 text-xs font-normal text-muted-foreground">'),Pe=f('<div role=radio><span aria-hidden=true></span><span class="flex min-w-0 flex-col gap-0.5"><span class="flex items-center gap-2"><span class=truncate>'),Be=f("<span>"),He=f('<span class="ml-auto text-xs font-normal text-muted-foreground">'),Ue=f('<div class="flex items-center gap-3 rounded-lg border border-input bg-accent px-3 py-2.5 text-sm font-medium text-accent-foreground">'),Ge=f("<span>Other: ");const Je="choice",A="__other__",K="Other\u2026";function Ke(n){if(!Array.isArray(n)||n.length===0)return{options:[],error:"This card couldn't be displayed."};const a=new Set,t=[];for(const l of n){if(!l||typeof l!="object")continue;const o=l;if(typeof o.id!="string"||o.id.length===0||typeof o.label!="string"||o.label.length===0)continue;if(a.has(o.id)){console.warn(`[kai-choice] duplicate option id "${o.id}" ignored`);continue}a.add(o.id);const u=o.media&&typeof o.media=="object"?{image:typeof o.media.image=="string"?o.media.image:void 0,imageAlt:typeof o.media.imageAlt=="string"?o.media.imageAlt:void 0,icon:typeof o.media.icon=="string"?o.media.icon:void 0}:void 0;t.push({id:o.id,label:o.label,description:typeof o.description=="string"?o.description:void 0,media:u,meta:typeof o.meta=="string"?o.meta:void 0,recommended:o.recommended===!0,disabled:o.disabled===!0,payload:o.payload})}return t.length===0?{options:[],error:"This card couldn't be displayed."}:{options:t}}function Ne(n){return n?n===!0?{label:K,placeholder:void 0}:typeof n=="object"?{label:typeof n.label=="string"&&n.label.length>0?n.label:K,placeholder:typeof n.placeholder=="string"?n.placeholder:void 0}:null:null}function oe(n,a,t){const l=n.length;if(l===0)return a;for(let o=1;o<=l;o+=1){const u=((a+t*o)%l+l)%l;if(!n[u].disabled)return u}return a}function ie(n){return n.findIndex(a=>!a.disabled)}function Qe(n){const a=me({cardId:"kai-choice"},n),[t]=ve(a,["data","cardId","heading","host","hostElement","class","resolution","value","defaultValue","disabled","onValueChange","controllerRef"]),l=Ie(),o=ye(),u=e=>{const r=t.host??l;r?r.emit(e):t.hostElement&&De(t.hostElement,e)},d=x(()=>{var e;return Ke((e=t.data)==null?void 0:e.options)}),h=x(()=>d().error===void 0),I=x(()=>d().error??""),k=x(()=>d().options),E=x(()=>{var e;return Ne((e=t.data)==null?void 0:e.allowOther)}),D=x(()=>{const e=E();return e?[...k(),{id:A,label:e.label}]:k()}),v=$e({prop:()=>t.resolution,data:()=>t.data}),O=x(()=>{const e=v.resolution();return e&&e.kind==="action"?e.action:void 0}),[q,R]=U(0),[ae,N]=U(n.defaultValue),L=x(()=>t.value??ae()),de=e=>{var r;L()!==e&&(N(e),(r=t.onValueChange)==null||r.call(t,e))},[P,Q]=U(""),$=()=>t.disabled===!0;let _,T;const W=x(()=>L()===A);G(te(()=>t.data,()=>{N(t.defaultValue),Q(""),R(Math.max(0,ie(D())))}));const le=x(()=>{var e;const r=v.resolution();return!r||r.kind!=="action"?void 0:r.action===A?{other:!0,text:((e=r.payload)==null?void 0:e.text)??""}:{other:!1,opt:k().find(s=>s.id===r.action),id:r.action}});G(te(h,e=>{u(e?{kind:"ready",cardId:t.cardId}:{kind:"error",cardId:t.cardId,message:I()})})),G(()=>{const e=t.hostElement;if(!e)return;const r=O();r!==void 0?e.setAttribute("data-kai-resolved",r):e.removeAttribute("data-kai-resolved")});const se=e=>e.id===A,B=e=>{v.isResolved()||$()||e.disabled||(de(e.id),se(e)&&queueMicrotask(()=>T?.focus()))},ce=x(()=>{if(v.isResolved()||$())return!1;const e=L();return e===void 0?!1:e===A?P().trim().length>0:!0}),ue=()=>{var e;return((e=t.data)==null?void 0:e.submitLabel)??"Submit"},H=()=>{if(v.isResolved()||$())return;const e=L();if(e===void 0)return;if(e===A){const s=P().trim();if(s.length===0)return;u({kind:"action",cardId:t.cardId,action:A,payload:{text:s}}),v.setLocal({kind:"action",action:A,payload:{text:s}});return}const r=k().find(s=>s.id===e);r&&(u({kind:"action",cardId:t.cardId,action:r.id,...r.payload!==void 0?{payload:r.payload}:{}}),v.setLocal({kind:"action",action:r.id,...r.payload!==void 0?{payload:r.payload}:{}}))},X=()=>{v.isResolved()||(u({kind:"dismiss",cardId:t.cardId}),v.setLocal({kind:"dismissed"}))},Y=()=>u({kind:"reopen",cardId:t.cardId}),z=(e,r)=>{var s;const i=_?.querySelectorAll('[role="radio"]');(s=i?.[e])==null||s.focus(r)};fe(()=>{var e;(e=t.controllerRef)==null||e.call(t,{focus:r=>{W()&&T?T.focus(r):z(q(),r)},select:r=>{const s=D(),i=s.findIndex(y=>y.id===r);i!==-1&&(R(i),B(s[i]))},send:()=>H(),dismiss:()=>X(),reopen:()=>Y()})});const pe=e=>{if(v.isResolved()||$())return;const r=D(),s=q();if(e.key==="ArrowDown"||e.key==="ArrowRight"){e.preventDefault();const i=oe(r,s,1);R(i),z(i)}else if(e.key==="ArrowUp"||e.key==="ArrowLeft"){e.preventDefault();const i=oe(r,s,-1);R(i),z(i)}else if(e.key==="Home"){e.preventDefault();const i=Math.max(0,ie(r));R(i),z(i)}else if(e.key===" "||e.key==="Enter"){e.preventDefault();const i=r[s];i&&B(i)}},ge=()=>{var e;return t.heading??((e=t.data)==null?void 0:e.prompt)??"Choose an option"},Z=`kai-choice-prompt-${o}`,ee=`kai-choice-other-${o}`;return c(b,{get when(){return h()},get fallback(){return c(J,{get heading(){return t.heading},get errorMessage(){return I()}})},get children(){return c(he,{fallback:()=>(u({kind:"error",cardId:t.cardId,message:"The card failed to render."}),c(J,{get heading(){return t.heading},errorMessage:"The card failed to render."})),get children(){return c(b,{get when(){return!v.isDeferred()},get fallback(){return c(Ae,{type:Je,get title(){return t.heading},onReopen:Y})},get children(){return c(J,{get heading(){return t.heading},get children(){var e=Le();return p(e,c(b,{get when(){var r;return(r=t.data)==null?void 0:r.prompt},get children(){var r=Se();return m(r,"id",Z),p(r,()=>{var s;return(s=t.data)==null?void 0:s.prompt}),r}}),null),p(e,c(b,{get when(){return!v.isResolved()},get fallback(){return c(et,{get choice(){return le()},get optimistic(){return v.isOptimistic()}})},get children(){return[(()=>{var r=je();r.$$keydown=pe;var s=_;return typeof s=="function"?re(s,r):_=r,p(r,c(be,{get each(){return D()},children:(i,y)=>{const g=()=>L()===i.id,C=()=>!i.disabled&&!$()&&y()===q()&&!v.isResolved(),S=`kai-choice-desc-${o}-${i.id}`,j=()=>!!i.description;return c(Ze,{opt:i,get checked(){return g()},get tabStop(){return C()},descId:S,get hasDesc(){return j()},onPick:()=>{R(y()),B(i)},onFocus:()=>R(y())})}})),w(i=>{var y,g=ge(),C=(y=t.data)!=null&&y.prompt?Z:void 0,S=$()?"true":void 0,j=F("divide-y divide-border overflow-hidden rounded-lg border border-input",$()&&"cursor-not-allowed opacity-60");return g!==i.e&&m(r,"aria-label",i.e=g),C!==i.t&&m(r,"aria-describedby",i.t=C),S!==i.a&&m(r,"aria-disabled",i.a=S),j!==i.o&&M(r,i.o=j),i},{e:void 0,t:void 0,a:void 0,o:void 0}),r})(),c(b,{get when(){return W()},get children(){var r=Ee(),s=r.firstChild,i=s.nextSibling;m(s,"for",ee),p(s,()=>{var g;return((g=E())==null?void 0:g.label)??K}),i.$$keydown=g=>{g.key==="Enter"&&(g.preventDefault(),H())},i.$$input=g=>Q(g.currentTarget.value);var y=T;return typeof y=="function"?re(y,i):T=i,m(i,"id",ee),w(g=>{var C,S=$(),j=(C=E())==null?void 0:C.placeholder;return S!==g.e&&(i.disabled=g.e=S),j!==g.t&&m(i,"placeholder",g.t=j),g},{e:void 0,t:void 0}),w(()=>i.value=P()),r}}),(()=>{var r=Te();return p(r,c(b,{get when(){var s;return((s=t.data)==null?void 0:s.dismissible)===!0},get children(){return c(ne,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:X,get children(){return c(Re,{size:16,"aria-hidden":"true"})}})}}),null),p(r,c(ne,{type:"button",class:"ml-auto",get disabled(){return!ce()},onClick:H,get children(){return ue()}}),null),r})()]}}),null),w(()=>M(e,F("flex flex-col gap-3",t.class))),e}})}})}})}})}function We(){return Me()}function Xe(n){return(()=>{var a=Ve();return w(t=>{var l=n.media.image,o=n.media.imageAlt??"",u=F("shrink-0 rounded-md object-cover",n.class);return l!==t.e&&m(a,"src",t.e=l),o!==t.t&&m(a,"alt",t.t=o),u!==t.a&&M(a,t.a=u),t},{e:void 0,t:void 0,a:void 0}),a})()}function Ye(n){return(()=>{var a=Fe();return p(a,()=>n.name.slice(0,2)),a})()}function Ze(n){return(()=>{var a=Pe(),t=a.firstChild,l=t.nextSibling,o=l.firstChild,u=o.firstChild;return xe(a,"focus",n.onFocus),a.$$click=()=>!n.opt.disabled&&n.onPick(),p(a,c(b,{get when(){var d;return(d=n.opt.media)==null?void 0:d.image},get children(){return c(we,{openDelay:150,class:"p-1 w-auto",placement:"right-start",get trigger(){return c(Xe,{get media(){return n.opt.media},class:"h-9 w-9"})},get children(){var d=Oe();return w(h=>{var I=n.opt.media.image,k=n.opt.media.imageAlt??"";return I!==h.e&&m(d,"src",h.e=I),k!==h.t&&m(d,"alt",h.t=k),h},{e:void 0,t:void 0}),d}})}}),t),p(a,c(b,{get when(){var d;return V(()=>{var h;return!((h=n.opt.media)!=null&&h.image)})()&&((d=n.opt.media)==null?void 0:d.icon)},get children(){return c(Ye,{get name(){return n.opt.media.icon}})}}),t),p(t,c(b,{get when(){return n.checked},get children(){return _e()}})),p(u,()=>n.opt.label),p(o,c(b,{get when(){return n.opt.recommended},get children(){return c(We,{})}}),null),p(l,c(b,{get when(){return n.opt.description},get children(){var d=ze();return p(d,()=>n.opt.description),w(()=>m(d,"id",n.descId)),d}}),null),p(a,c(b,{get when(){return n.opt.meta},get children(){var d=qe();return p(d,()=>n.opt.meta),d}}),null),w(d=>{var h=n.checked,I=n.opt.disabled?"true":void 0,k=n.hasDesc?n.descId:void 0,E=n.opt.id,D=n.opt.disabled?-1:n.tabStop?0:-1,v=F("flex items-center gap-3 px-3 py-2.5 text-sm outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",n.opt.disabled?"cursor-not-allowed opacity-60 text-foreground":"cursor-pointer hover:bg-muted/50",n.checked?"bg-accent font-medium text-accent-foreground":"text-foreground"),O=F("flex h-[1.125rem] w-[1.125rem] shrink-0 items-center justify-center rounded-full border-[1.5px] transition-colors",n.checked?"border-[var(--color-primary)]":"border-input bg-background");return h!==d.e&&m(a,"aria-checked",d.e=h),I!==d.t&&m(a,"aria-disabled",d.t=I),k!==d.a&&m(a,"aria-describedby",d.a=k),E!==d.o&&m(a,"data-option-id",d.o=E),D!==d.i&&m(a,"tabindex",d.i=D),v!==d.n&&M(a,d.n=v),O!==d.s&&M(t,d.s=O),d},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),a})()}function et(n){const a=n.choice;return(()=>{var t=Ue();return p(t,c(Ce,{size:16,"aria-hidden":"true"}),null),p(t,c(b,{get when(){return!a.other},get fallback(){return(()=>{var l=Ge();return l.firstChild,p(l,(()=>{var o=V(()=>!!a.other);return()=>o()?a.text:""})(),null),l})()},get children(){return[(()=>{var l=Be();return p(l,(()=>{var o=V(()=>!a.other);return()=>{var u;return o()?((u=a.opt)==null?void 0:u.label)??a.id:""}})()),l})(),c(b,{get when(){var l;return V(()=>!a.other)()&&((l=a.opt)==null?void 0:l.meta)},get children(){var l=He();return p(l,(()=>{var o=V(()=>!a.other);return()=>{var u;return o()?(u=a.opt)==null?void 0:u.meta:""}})()),l}})]}}),null),w(()=>m(t,"role",n.optimistic?"status":void 0)),t})()}ke(["keydown","input","click"]);export{Qe as C};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as c}from"./Icon--Y8vsFal.js";import{c as m,m as o}from"./define-wjHR1MkU.js";var a=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],e=r=>m(c,o(r,{name:"Circle",iconNode:a})),i=e;export{i as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as c}from"./Icon--Y8vsFal.js";import{c as r,m as a}from"./define-wjHR1MkU.js";var e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],o=m=>r(c,a(m,{name:"CircleCheck",iconNode:e})),i=o;export{i as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as a}from"./Icon--Y8vsFal.js";import{c as m,m as c}from"./define-wjHR1MkU.js";var e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],o=r=>m(a,c(r,{name:"CircleX",iconNode:e})),i=o;export{i as c};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import{g as _,w as Ye,l as J,k as de,o as ue,x as Ae,h as Je,i as A,u as Ne,a as j,d as N,b as V,n as Z,c as O,F as Le,S as P,t as S,e as Ve}from"./define-wjHR1MkU.js";import{c as Q}from"./cn-CU7UAWzk.js";import{u as Ze,c as Qe,a as et}from"./overlay-DuiwdXjm.js";function B(t){if(t==null)return[];if(typeof t=="string")return t.length?[{type:"text",text:t}]:[];const n=[];for(const l of t)if(l.type==="text"){if(!l.text)continue;const i=n[n.length-1];i&&i.type==="text"?n[n.length-1]={type:"text",text:i.text+l.text}:n.push({type:"text",text:l.text})}else n.push({type:"entity",entity:l.entity});return n}function ee(t,n){let l="";for(const i of t)i.type==="text"?l+=i.text:l+=i.entity.promptText??i.entity.label;return l}function pe(t){return t.filter(n=>n.type==="entity").map(n=>n.entity)}function te(t){return t.every(n=>n.type==="text"&&n.text.length===0)}const C="\u200B",fe="data-kai-entity",he=new WeakMap;function z(t){return!!t&&t.nodeType===1&&t.hasAttribute(fe)}function ne(t){return t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode(n){let l=n.parentElement;for(;l&&l!==t;){if(l.hasAttribute(fe))return NodeFilter.FILTER_REJECT;l=l.parentElement}return NodeFilter.FILTER_ACCEPT}})}function tt(t){switch(t){case"skill":return"/";case"agent":return"@";default:return""}}function $e(t){const n=l=>`<svg viewBox="0 0 24 24" width="1em" height="1em" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${l}</svg>`;switch(t){case"agent":return n('<rect x="4" y="8" width="16" height="12" rx="3"/><path d="M12 4.5V8M9.5 13.5v1.5M14.5 13.5v1.5"/><circle cx="12" cy="3" r="1.2"/>');case"plugin":return n('<path d="M9 2v4M15 2v4M6 6h12v5a6 6 0 0 1-12 0zM12 17v5"/>');default:return""}}function Ie(t,n,l){const i=t.createElement("span");i.setAttribute(fe,""),i.setAttribute("contenteditable","false"),i.dataset.kind=n.kind,i.dataset.id=n.id,i.className="kai-composer-pill";const u=tt(n.kind);if(u){const s=t.createElement("span");s.className="kai-composer-pill-sigil",s.setAttribute("aria-hidden","true"),s.textContent=u,i.appendChild(s)}else{const s=n.icon??l?.[n.kind];if(s){const p=t.createElement("img");p.src=s,p.alt="",p.className="kai-composer-pill-icon",i.appendChild(p)}else{const p=$e(n.kind);if(p){const f=t.createElement("span");f.className="kai-composer-pill-icon kai-composer-pill-glyph",f.setAttribute("aria-hidden","true"),f.innerHTML=p,i.appendChild(f)}}}return i.appendChild(t.createTextNode(n.label)),he.set(i,n),i}function L(t){const n=[],l=t.childNodes;return l.forEach((i,u)=>{if(z(i)){const s=he.get(i),p=i;n.push({type:"entity",entity:s??{kind:p.dataset.kind??"",id:p.dataset.id??"",label:p.textContent??""}})}else if(i.nodeType===1&&i.tagName==="BR"){if(u===l.length-1)return;n.push({type:"text",text:`
|
|
2
|
-
`})}else i.nodeType===3&&n.push({type:"text",text:(i.textContent??"").split(C).join("")})}),B(n)}function re(t,n,l=document,i){t.textContent="";for(const u of n)u.type==="text"?t.appendChild(l.createTextNode(u.text)):(t.appendChild(Ie(l,u.entity,i)),t.appendChild(l.createTextNode(C)))}function nt(t,n,l){if(n<0||n>t.length)return null;for(let i=n-1;i>=0;i--){const u=t[i];if(/\s/.test(u))return null;if(l.includes(u))return i===0||/\s/.test(t[i-1])?{char:u,query:t.slice(i+1,n),start:i}:null}return null}function rt(t,n,l){if(!l.length)return null;const i=l.map(p=>p.char),u=nt(t,n,i);if(!u)return null;const s=l.find(p=>p.char===u.char);return s?{def:s,query:u.query,start:u.start}:null}function ot(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function it(t,n){const l=[];for(const s of n){let p,f;typeof s=="string"?(p=new RegExp(ot(s),"gi"),f=void 0):(p=new RegExp(s.pattern,s.flags??"gi"),f=s.class),p.lastIndex=0;let v;for(;(v=p.exec(t))!==null;){const x=v.index,h=x+v[0].length;if(h===x){p.lastIndex=x+1;continue}l.push({start:x,end:h,class:f})}}l.sort((s,p)=>s.start-p.start);const i=[];let u=-1;for(const s of l)s.start>=u&&(i.push(s),u=s.end);return i}function lt(){try{return typeof CSS<"u"&&typeof CSS.highlights<"u"&&typeof Highlight<"u"}catch{return!1}}const at="kai-composer-highlight";function st(t,n,l,i=at){if(!lt())return;const u=CSS.highlights;if(n.length===0){u.delete(i);return}const s=[];let p=0;const f=t.ownerDocument,v=ne(t);let x=v.nextNode();for(;x;){const w=x.textContent??"",g=[];for(let y=0;y<w.length;y++)w[y]!==l&&g.push(y);if(g.length>0){const y=new Int32Array(g.length);for(let m=0;m<g.length;m++)y[m]=g[m];s.push({node:x,strippedStart:p,strippedToRaw:y}),p+=g.length}x=v.nextNode()}function h(w){let g=0,y=s.length-1;for(;g<=y;){const m=g+y>>1,R=s[m],T=R.strippedStart+R.strippedToRaw.length;if(w<R.strippedStart)y=m-1;else if(w>=T)g=m+1;else{const oe=w-R.strippedStart;return{node:R.node,rawOffset:R.strippedToRaw[oe]}}}if(s.length>0){const m=s[s.length-1];if(w-m.strippedStart===m.strippedToRaw.length)return{node:m.node,rawOffset:m.strippedToRaw[m.strippedToRaw.length-1]+1}}return null}const b=[];for(const w of n){const g=h(w.start),y=h(w.end);if(!g||!y)continue;const m=f.createRange();m.setStart(g.node,g.rawOffset),m.setEnd(y.node,y.rawOffset),b.push(m)}if(b.length===0){u.delete(i);return}const $=new Highlight(...b);u.set(i,$)}function ct(t,n=200){let l=[t],i=0;return{record(u,s){if(s&&i===l.length-1){l[i]=u;return}l=l.slice(0,i+1),l.push(u),l.length>n?l.shift():i++},undo(){return i===0?null:(i--,l[i])},redo(){return i>=l.length-1?null:(i++,l[i])},reset(u){l=[u],i=0},canUndo(){return i>0},canRedo(){return i<l.length-1},size(){return l.length}}}var dt=S("<style>"),ut=S(`<style>
|
|
3
|
-
.kai-composer-pill {
|
|
4
|
-
display: inline-flex; align-items: center; gap: 0.2rem;
|
|
5
|
-
/* middle (not baseline): a flex pill's baseline differs with/without an
|
|
6
|
-
icon, which misaligns adjacent pills \u2014 middle aligns them consistently. */
|
|
7
|
-
vertical-align: middle; height: 1.5em;
|
|
8
|
-
/* Asymmetric margin: a roomier trailing gap (so typed text isn't flush
|
|
9
|
-
after a pill) + a smaller leading gap. */
|
|
10
|
-
margin: 0 0.3rem 0 0.1rem;
|
|
11
|
-
border-radius: 0.375rem;
|
|
12
|
-
font-weight: 500; white-space: nowrap; user-select: none; cursor: default;
|
|
13
|
-
box-sizing: border-box; line-height: 1;
|
|
14
|
-
}
|
|
15
|
-
/* Skills + agents: LIGHT \u2014 decorated inline text led by a sigil, NOT a
|
|
16
|
-
chip. A distinct colour per kind (overridable); the sigil is dimmer
|
|
17
|
-
than the label. (A GUI affords this richer-but-light look; a CLI can't.) */
|
|
18
|
-
.kai-composer-pill[data-kind="skill"],
|
|
19
|
-
.kai-composer-pill[data-kind="agent"] {
|
|
20
|
-
padding: 0 0.1rem; background: transparent;
|
|
21
|
-
/* Read like a command, not a title \u2014 lowercase the DISPLAY only; the
|
|
22
|
-
entity label + emitted payload keep the consumer's original casing. */
|
|
23
|
-
text-transform: lowercase;
|
|
24
|
-
}
|
|
25
|
-
.kai-composer-pill[data-kind="skill"] { color: var(--kai-pill-skill, #2563eb); }
|
|
26
|
-
.kai-composer-pill[data-kind="agent"] { color: var(--kai-pill-agent, #7c3aed); }
|
|
27
|
-
/* Brighter hues on dark so they don't muddy against a dark field. The
|
|
28
|
-
consumer's --kai-pill-* override still wins (it's the var value); only
|
|
29
|
-
the FALLBACK shifts per scheme. */
|
|
30
|
-
@media (prefers-color-scheme: dark) {
|
|
31
|
-
.kai-composer-pill[data-kind="skill"] { color: var(--kai-pill-skill, #6ea8fe); }
|
|
32
|
-
.kai-composer-pill[data-kind="agent"] { color: var(--kai-pill-agent, #c4a7fc); }
|
|
33
|
-
}
|
|
34
|
-
.kai-composer-pill-sigil { opacity: 0.6; font-weight: 600; }
|
|
35
|
-
/* Plugins (and any other/unknown kind): the richer CHIP \u2014 background +
|
|
36
|
-
icon \u2014 so a composite bundle reads differently at a glance. */
|
|
37
|
-
.kai-composer-pill:not([data-kind="skill"]):not([data-kind="agent"]) {
|
|
38
|
-
padding: 0 0.4rem;
|
|
39
|
-
background-color: color-mix(in srgb, currentColor 10%, transparent);
|
|
40
|
-
}
|
|
41
|
-
/* Selected (caret arrowed onto the pill): a highlight box, like Claude
|
|
42
|
-
Code web. Tinted by the pill's own colour via currentColor. */
|
|
43
|
-
.kai-composer-pill[data-selected] {
|
|
44
|
-
background-color: color-mix(in srgb, currentColor 18%, transparent);
|
|
45
|
-
box-shadow: 0 0 0 1px color-mix(in srgb, currentColor 30%, transparent);
|
|
46
|
-
}
|
|
47
|
-
/* Fixed height + an icon never taller than the box \u2192 iconed and iconless
|
|
48
|
-
pills are exactly the same height (no baseline shift in the line). */
|
|
49
|
-
.kai-composer-pill-icon { width: 1em; height: 1em; flex-shrink: 0; }
|
|
50
|
-
img.kai-composer-pill-icon { border-radius: 9999px; object-fit: cover; }
|
|
51
|
-
.kai-composer-pill-glyph { display: inline-flex; align-items: center; justify-content: center; opacity: 0.8; }
|
|
52
|
-
.kai-composer-pill-glyph svg { width: 1em; height: 1em; display: block; }
|
|
53
|
-
/* The editable is the containing block for the placeholder pseudo-element. */
|
|
54
|
-
[data-kai-composer-editable] { position: relative; }
|
|
55
|
-
/* While a pill is arrow-selected the pill IS the selection, so hide the text
|
|
56
|
-
caret so a blinking cursor doesn't sit beside the highlight box. Returns
|
|
57
|
-
the moment the pill selection clears (arrow off, type, click, backspace). */
|
|
58
|
-
[data-kai-composer-editable][data-pill-selected] { caret-color: transparent; }
|
|
59
|
-
/* Placeholder via pseudo-element \u2014 exempt from axe color-contrast like a
|
|
60
|
-
native <textarea> placeholder. position:absolute (with auto offsets =
|
|
61
|
-
its static text-origin spot) takes it OUT of flow, so the caret sits at
|
|
62
|
-
the START of the field instead of after the placeholder text. */
|
|
63
|
-
[data-kai-composer-editable].kai-composer-empty::before {
|
|
64
|
-
content: attr(data-placeholder);
|
|
65
|
-
position: absolute;
|
|
66
|
-
color: var(--color-muted-foreground, #9ca3af);
|
|
67
|
-
pointer-events: none;
|
|
68
|
-
}
|
|
69
|
-
`),pt=S("<div class=relative><div data-kai-composer-editable role=textbox aria-multiline=true>"),ft=S("<div role=listbox aria-label=Suggestions style=position:fixed>"),ht=S('<div class="px-3 pt-2 pb-1 text-xs font-medium text-muted-foreground select-none">'),gt=S('<span class="text-muted-foreground truncate min-w-0">'),mt=S('<button role=option><span class="font-medium whitespace-nowrap shrink-0">'),kt=S('<span class="kai-composer-pill-glyph w-4 h-4 shrink-0"aria-hidden=true>'),yt=S('<img alt class="w-4 h-4 rounded object-cover shrink-0">'),vt=S("<div>");function E(t){var n;const l=t.getRootNode();return typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&typeof l.getSelection=="function"?l.getSelection():((n=t.ownerDocument)==null?void 0:n.getSelection())??null}function Oe(t){let n="";const l=ne(t);let i=l.nextNode();for(;i;)n+=(i.textContent??"").split(C).join(""),i=l.nextNode();return n}function ge(t){const n=E(t);if(!n||n.rangeCount===0)return 0;const l=n.getRangeAt(0);if(!l.collapsed)return 0;const{startContainer:i,startOffset:u}=l;let s=0;const p=ne(t);let f=p.nextNode();for(;f;){if(f===i){const v=(f.textContent??"").slice(0,u);return s+=v.split(C).join("").length,s}s+=(f.textContent??"").split(C).join("").length,f=p.nextNode()}return s}function xt(t){const n=t.ownerDocument,l=E(t);if(!l||l.rangeCount===0)return null;const i=l.getRangeAt(0).cloneRange();i.collapse(!0);const u=i.getClientRects();if(u.length>0&&(u[0].width>0||u[0].height>0))return u[0];const s=n.createElement("span");s.textContent="\u200B",s.style.position="absolute",s.style.visibility="hidden",i.insertNode(s);const p=s.getBoundingClientRect();return s.remove(),p.width>0||p.height>0?p:null}function bt(t,n){const l=E(t);if(!l)return;const i=t.ownerDocument.createRange(),u=ne(t);let s=n,p=u.nextNode(),f=!1;for(;p;){const v=p.textContent??"",x=v.split(C).join("").length;if(s<=x){let h=0,b=0;for(;h<v.length&&b<s;)v[h]!==C&&b++,h++;for(;h<v.length&&v[h]===C;)h++;i.setStart(p,h),f=!0;break}s-=x,p=u.nextNode()}f?i.collapse(!0):(i.selectNodeContents(t),i.collapse(!1)),l.removeAllRanges(),l.addRange(i)}function wt(t){let n;const[l,i]=_(),u=`kai-composer-highlight-${Ye()}`,[s,p]=_(te(B(t.value))),[f,v]=_(null),x=e=>{const r=f();r&&r!==e&&r.removeAttribute("data-selected"),e.setAttribute("data-selected",""),v(e)},h=()=>{const e=f();e&&(e.removeAttribute("data-selected"),v(null))},b=ct({doc:B(t.value),caret:0});let $=0;const w=500,[g,y]=_(null),[m,R]=_(0),T=J(()=>{const e=g();if(!(e!=null&&e.def.items))return[];const r=new Set(pe(L(n)).map(o=>`${o.kind}:${o.id}`)),a=e.query.toLowerCase();return e.def.items.filter(o=>{var c;const d=o.kind??e.def.kind;return r.has(`${d}:${o.id}`)?!1:a===""?!0:o.label.toLowerCase().includes(a)||(((c=o.description)==null?void 0:c.toLowerCase().includes(a))??!1)})}),oe=J(()=>{const e=[];return T().forEach((r,a)=>{let o=e.find(c=>c.group===r.group);o||(o={group:r.group,items:[]},e.push(o)),o.items.push({item:r,index:a})}),e}),ie=J(()=>T().length>0),me=e=>{var r;return e.kind??((r=g())==null?void 0:r.def.kind)??""},Be=e=>{var r;return e.icon??((r=t.kindIcons)==null?void 0:r[me(e)])};de(()=>{const e=T().length;m()>=e&&R(Math.max(0,e-1))});const Me=J(()=>{const e=g();if(!e)return;const r=e.caretRect;return{getBoundingClientRect:()=>r}}),{pos:ke,hidden:qe}=Ze(Me,l,{placement:"bottom-start",gutter:4}),{present:Ke,state:je,setRef:Fe}=Qe(ie);et({enabled:ie,onDismiss:()=>M(),refs:()=>[n,l()]});function M(){var e;g()&&(y(null),(e=t.onTriggerClose)==null||e.call(t))}const q=()=>{const e=L(n);return{doc:e,text:ee(e),entities:pe(e)}};function X(){const e=t.highlights,r=e!=null&&e.length?it(Oe(n),e):[];st(n,r,C,u)}ue(()=>{re(n,B(t.value),n.ownerDocument,t.kindIcons),p(te(L(n))),X(),b.reset({doc:L(n),caret:0})}),de(Ae(()=>t.value,e=>{ee(B(e))!==ee(L(n))&&(h(),re(n,B(e),n.ownerDocument,t.kindIcons),p(te(L(n))),X(),b.reset({doc:L(n),caret:0}))},{defer:!0})),de(Ae(()=>t.highlights,()=>X(),{defer:!0}));function ye(){var e;const r=t.triggers;if(!(r!=null&&r.length)){g()&&M();return}const a=Oe(n),o=ge(n),c=rt(a,o,r);if(c){const d=xt(n);if(d){const k=g();y({def:c.def,query:c.query,start:c.start,caretRect:d}),(!k||k.def.char!==c.def.char||k.query!==c.query)&&((e=t.onTrigger)==null||e.call(t,{char:c.def.char,query:c.query,rect:d}))}}else g()&&M()}const U=e=>{var r;p(te(e.doc)),(r=t.onChange)==null||r.call(t,e),ye(),X()},He=()=>{h();const e=q();U(e);const r=Date.now();b.record({doc:e.doc,caret:ge(n)},r-$<w),$=r},ve=()=>{const e=q();U(e),b.record({doc:e.doc,caret:ge(n)},!1),$=0},xe=e=>{h(),re(n,e.doc,n.ownerDocument,t.kindIcons),bt(n,e.caret),U(q()),$=0},_e=()=>{const e=b.undo();e&&xe(e)},be=()=>{const e=b.redo();e&&xe(e)};let le=!1;const Pe=e=>{var r;le=!0,(r=t.onFocus)==null||r.call(t,e)},ze=e=>{var r;le=!1,h(),(r=t.onBlur)==null||r.call(t,e)};ue(()=>{const e=n.ownerDocument,r=()=>{le&&ye()};e.addEventListener("selectionchange",r),Je(()=>e.removeEventListener("selectionchange",r))}),ue(()=>{var e;(e=t.controllerRef)==null||e.call(t,{focus:r=>n.focus(r),blur:()=>n.blur(),clear:()=>{h(),re(n,[],n.ownerDocument,t.kindIcons),U(q()),b.reset({doc:L(n),caret:0}),$=0},send:()=>{var r;return(r=t.onSubmit)==null?void 0:r.call(t,q())},insertEntity:r=>Ce(r)})});function we(e){const r=g();if(!r)return;const a={kind:e.kind??r.def.kind,id:e.id,label:e.label,icon:e.icon,promptText:e.promptText,data:e.data};Ce(a,{deleteBefore:1+r.query.length}),M()}const Ce=(e,r)=>{var a;const o=n.ownerDocument,c=E(n);if(!c||c.rangeCount===0)return;const d=c.getRangeAt(0);if(r!=null&&r.deleteBefore&&d.collapsed){let G=r.deleteBefore,K=d.startContainer,H=d.startOffset;for(;G>0&&K&&K.nodeType===3;){const Ge=K.textContent??"";for(;H>0&&G>0;)H--,Ge[H]!==C&&G--;if(G>0){const Y=K.previousSibling;if(Y&&Y.nodeType===3)K=Y,H=(Y.textContent??"").length;else break}}const ce=o.createRange();ce.setStart(K,H),ce.setEnd(d.startContainer,d.startOffset),ce.deleteContents()}const k=c.getRangeAt(0);k.collapsed||k.deleteContents();const I=Ie(o,e,t.kindIcons),D=o.createTextNode(C);k.insertNode(D),k.insertNode(I);const se=o.createRange();se.setStartAfter(D),se.collapse(!0),c.removeAllRanges(),c.addRange(se),(a=t.onEntityAdd)==null||a.call(t,e),ve()},W=e=>(e??"").split("").every(r=>r===C),F=e=>!!e&&e.nodeType===Node.TEXT_NODE&&W(e.textContent),Re=e=>{const{startContainer:r,startOffset:a}=e;if(r===n){let o=a-1;for(;F(n.childNodes[o]);)o--;const c=n.childNodes[o];return z(c)?c:null}if(r.nodeType===Node.TEXT_NODE){if(!W((r.textContent??"").slice(0,a)))return null;let o=r.previousSibling;for(;F(o);)o=o.previousSibling;return z(o)?o:null}return null},Te=e=>{const{startContainer:r,startOffset:a}=e;if(r===n){let o=a;for(;F(n.childNodes[o]);)o++;const c=n.childNodes[o];return z(c)?c:null}if(r.nodeType===Node.TEXT_NODE){if(!W((r.textContent??"").slice(a)))return null;let o=r.nextSibling;for(;F(o);)o=o.nextSibling;return z(o)?o:null}return null},Se=e=>{var r;const a=he.get(e),o=e.nextSibling;o?.nodeType===Node.TEXT_NODE&&W(o.textContent)&&o.remove(),e.remove(),a&&((r=t.onEntityRemove)==null||r.call(t,a)),ve()},Xe=e=>{const r=E(n);if(!r)return;const a=n.ownerDocument.createRange();a.setStartBefore(e),a.collapse(!0),r.removeAllRanges(),r.addRange(a)},Ee=e=>{const r=E(n);if(!r)return;let a=e;for(;F(a.nextSibling);)a=a.nextSibling;const o=n.ownerDocument.createRange();o.setStartAfter(a),o.collapse(!0),r.removeAllRanges(),r.addRange(o)},Ue=e=>{var r;if((e.metaKey||e.ctrlKey)&&(e.key==="z"||e.key==="Z")){e.preventDefault(),e.shiftKey?be():_e();return}if((e.metaKey||e.ctrlKey)&&(e.key==="y"||e.key==="Y")){e.preventDefault(),be();return}if(ie()&&T().length>0){if(e.key==="ArrowDown"){e.preventDefault(),R(o=>(o+1)%T().length);return}if(e.key==="ArrowUp"){e.preventDefault(),R(o=>(o-1+T().length)%T().length);return}if(e.key==="Enter"||e.key==="Tab"){const o=T();if(o.length>0){e.preventDefault(),e.stopPropagation(),we(o[m()]);return}}if(e.key==="Escape"){e.preventDefault(),M();return}}else if(g()&&e.key==="Escape"){e.preventDefault(),M();return}const a=f();if(a&&a.isConnected){if(e.key==="ArrowLeft"){e.preventDefault(),Xe(a),h();return}if(e.key==="ArrowRight"){e.preventDefault(),Ee(a),h();return}if(e.key==="Backspace"||e.key==="Delete"){e.preventDefault();const o=a.previousSibling;h(),Se(a);const c=E(n);if(c){const d=n.ownerDocument.createRange();o&&o.isConnected?d.setStartAfter(o):d.setStart(n,0),d.collapse(!0),c.removeAllRanges(),c.addRange(d)}return}if(e.key==="Escape"){e.preventDefault(),h();return}if(e.key==="Shift"||e.key==="Meta"||e.key==="Control"||e.key==="Alt")return;Ee(a),h()}if(!f()&&(e.key==="ArrowLeft"||e.key==="ArrowRight")&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey){const o=E(n);if(o&&o.rangeCount>0){const c=o.getRangeAt(0);if(c.collapsed){const d=e.key==="ArrowLeft"?Re(c):Te(c);if(d){e.preventDefault(),x(d);return}}}}if(e.key==="Backspace"||e.key==="Delete"){const o=E(n);if(!o||o.rangeCount===0)return;const c=o.getRangeAt(0);if(!c.collapsed)return;const d=e.key==="Backspace"?Re(c):Te(c);if(d){e.preventDefault(),Se(d);return}}if(e.key==="Enter"&&!e.shiftKey&&t.submitOnEnter!==!1){if(e.preventDefault(),t.disabled||t.loading)return;(r=t.onSubmit)==null||r.call(t,q())}},ae=()=>t.maxHeight??240,We=()=>t.editableClass??"text-foreground min-h-[44px] w-full overflow-y-auto kai-focus-inset whitespace-pre-wrap break-words",De=[(()=>{var e=dt();return A(e,`::highlight(${u}) { background-color: color-mix(in srgb, var(--color-primary, #6366f1) 22%, transparent); }`),e})(),ut(),(()=>{var e=pt(),r=e.firstChild;return r.addEventListener("blur",ze),r.addEventListener("focus",Pe),r.$$mousedown=h,r.$$keydown=Ue,r.$$input=He,Ne(a=>{var o;n=a,(o=t.editableRef)==null||o.call(t,a)},r),j(a=>{var o=f()?"":void 0,c=t.placeholder??"",d=t.disabled?!1:"plaintext-only",k=t.ariaLabel||t.placeholder||"Message input",I=Q(We(),s()&&t.placeholder?"kai-composer-empty":""),D=typeof ae()=="number"?`${ae()}px`:String(ae());return o!==a.e&&N(r,"data-pill-selected",a.e=o),c!==a.t&&N(r,"data-placeholder",a.t=c),d!==a.a&&N(r,"contenteditable",a.a=d),k!==a.o&&N(r,"aria-label",a.o=k),I!==a.i&&V(r,a.i=I),D!==a.n&&Z(r,"max-height",a.n=D),a},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),e})(),O(P,{get when(){return Ke()},get children(){var e=ft();return Ne(r=>{i(r),Fe(r)},e),A(e,O(Le,{get each(){return oe()},children:r=>[O(P,{get when(){return r.group},get children(){var a=ht();return A(a,()=>r.group),a}}),O(Le,{get each(){return r.items},children:a=>(()=>{var o=mt(),c=o.firstChild;return o.$$click=d=>{d.preventDefault(),we(a.item)},o.$$mousedown=d=>d.preventDefault(),o.addEventListener("mouseenter",()=>R(a.index)),A(o,O(P,{get when(){return Be(a.item)},get fallback(){return O(P,{get when(){return $e(me(a.item))},children:d=>(()=>{var k=kt();return j(()=>k.innerHTML=d()),k})()})},children:d=>(()=>{var k=yt();return j(()=>N(k,"src",d())),k})()}),c),A(c,()=>a.item.label),A(o,O(P,{get when(){return a.item.description},get children(){var d=gt();return A(d,()=>a.item.description),d}}),null),j(d=>{var k=m()===a.index,I=a.index,D=Q("w-full flex items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors",m()===a.index?"bg-muted text-foreground":"text-foreground hover:bg-muted");return k!==d.e&&N(o,"aria-selected",d.e=k),I!==d.t&&N(o,"data-index",d.t=I),D!==d.a&&V(o,d.a=D),d},{e:void 0,t:void 0,a:void 0}),o})()})]})),j(r=>{var a=je(),o=Q("absolute z-50 min-w-[240px] max-w-[420px] max-h-[320px] overflow-y-auto rounded-lg bg-card shadow-lg py-1","border border-border"),c=`${ke().x}px`,d=`${ke().y}px`,k=qe()?"hidden":"visible";return a!==r.e&&N(e,"data-state",r.e=a),o!==r.t&&V(e,r.t=o),c!==r.a&&Z(e,"left",r.a=c),d!==r.o&&Z(e,"top",r.o=d),k!==r.i&&Z(e,"visibility",r.i=k),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e}})];return t.bare?De:(()=>{var e=vt();return A(e,De),j(()=>V(e,Q("kai-composer relative rounded-xl bg-surface p-2",t.disabled&&"cursor-not-allowed opacity-60"))),e})()}Ve(["input","keydown","mousedown","click"]);export{wt as C,pe as e,B as n,ee as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as N,s as O,l as v,k as T,x as F,o as H,c as d,E as L,S as f,i as l,a as $,b as U,d as z,F as G,u as A,t as h,e as J}from"./define-wjHR1MkU.js";import{c as K}from"./cn-CU7UAWzk.js";import{B as q}from"./button-flUbeufF.js";import{u as P,a as Q,C as x,D as V}from"./use-card-resolution-DoA2f_EU.js";import{e as W}from"./card-routing-BK09BdmL.js";import{t as X}from"./triangle-alert-F9cyUEyy.js";import{c as Y}from"./check-B5kBPKeo.js";import{x as Z}from"./x-B6UnOiLw.js";var _=h('<div class="flex items-center gap-2 text-sm font-medium text-destructive dark:text-red-400"><span>Heads up'),ee=h('<p class="text-sm font-semibold text-foreground">'),te=h('<p class="text-sm text-foreground">'),re=h("<div>"),ae=h('<div class="flex w-full flex-wrap items-center justify-between gap-2"><div class="ml-auto flex flex-wrap items-center gap-2">'),ne=h('<div class="ml-auto flex items-center gap-2 text-sm font-medium text-foreground"><span>');const ie="confirm",de=new Set(["primary","default","destructive"]);function oe(o){switch(o){case"primary":return"default";case"destructive":return"destructive";case"default":case void 0:return"outline";default:return console.warn(`[kai-confirm] unknown action style "${o}"; using default`),"outline"}}function se(o){if(!Array.isArray(o)||o.length===0)return{actions:[],error:"This card couldn't be displayed."};const c=new Set,r=[];for(const m of o){if(!m||typeof m!="object")continue;const i=m;if(typeof i.id!="string"||i.id.length===0||typeof i.label!="string"||i.label.length===0)continue;if(c.has(i.id)){console.warn(`[kai-confirm] duplicate action id "${i.id}" ignored`);continue}c.add(i.id);const g=de.has(i.style)?i.style:void 0;i.style!==void 0&&g===void 0&&console.warn(`[kai-confirm] unknown action style "${String(i.style)}"; using default`),r.push({id:i.id,label:i.label,style:g,payload:i.payload,default:i.default===!0})}return r.length===0?{actions:[],error:"This card couldn't be displayed."}:{actions:r}}function le(o){var c;return(c=o.find(r=>r.default))==null?void 0:c.id}function ue(o){const c=N({cardId:"kai-confirm",autofocus:!1},o),[r]=O(c,["data","cardId","heading","host","hostElement","autofocus","class","resolution","controllerRef"]),m=P(),i=e=>{const n=r.host??m;n?n.emit(e):r.hostElement&&W(r.hostElement,e)},g=v(()=>{var e;return se((e=r.data)==null?void 0:e.actions)}),I=v(()=>g().error===void 0),C=v(()=>g().error??""),p=v(()=>g().actions),D=()=>{var e;return((e=r.data)==null?void 0:e.tone)??"default"},M=()=>D()==="danger",k=v(()=>le(p())),u=Q({prop:()=>r.resolution,data:()=>r.data}),j=v(()=>{const e=u.resolution();if(!e||e.kind!=="action")return;const n=p().find(t=>t.id===e.action);return{label:n?.label??e.action}});T(F(I,e=>{i(e?{kind:"ready",cardId:r.cardId}:{kind:"error",cardId:r.cardId,message:C()})}));const b=e=>{u.isResolved()||(i({kind:"action",cardId:r.cardId,action:e.id,...e.payload!==void 0?{payload:e.payload}:{}}),u.setLocal({kind:"action",action:e.id,...e.payload!==void 0?{payload:e.payload}:{}}))},E=()=>{u.isResolved()||(i({kind:"dismiss",cardId:r.cardId}),u.setLocal({kind:"dismissed"}))},R=()=>i({kind:"reopen",cardId:r.cardId});let S,y;const B=()=>y?y.querySelector('button[data-kai-default="true"]')??y.querySelector("button[data-action-id]"):null;return H(()=>{var e;(e=r.controllerRef)==null||e.call(r,{focus:n=>{var t;return(t=B())==null?void 0:t.focus(n)},confirm:n=>{const t=p(),a=n??k();if(a===void 0)return;const s=t.find(w=>w.id===a);s&&b(s)},dismiss:()=>E(),reopen:()=>R()})}),T(()=>{const e=r.hostElement;if(!e)return;const n=u.resolution();n&&n.kind==="action"?e.setAttribute("data-kai-resolved",n.action):e.removeAttribute("data-kai-resolved")}),d(f,{get when(){return I()},get fallback(){return d(x,{get heading(){return r.heading},get errorMessage(){return C()}})},get children(){return d(L,{fallback:()=>(i({kind:"error",cardId:r.cardId,message:"The card failed to render."}),d(x,{get heading(){return r.heading},errorMessage:"The card failed to render."})),get children(){return d(f,{get when(){return!u.isDeferred()},get fallback(){return d(V,{type:ie,get title(){return r.heading},onReopen:R})},get children(){return d(x,{get heading(){return r.heading},get actions(){return d(f,{get when(){return!u.isResolved()},get fallback(){return(()=>{var e=ne(),n=e.firstChild;return l(e,d(Y,{size:16,"aria-hidden":"true"}),n),l(n,()=>{var t;return(t=j())==null?void 0:t.label}),$(()=>z(e,"role",u.isOptimistic()?"status":void 0)),e})()},get children(){var e=ae(),n=e.firstChild;l(e,d(f,{get when(){var a;return((a=r.data)==null?void 0:a.dismissible)===!0},get children(){return d(q,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:E,get children(){return d(Z,{size:16,"aria-hidden":"true"})}})}}),n);var t=y;return typeof t=="function"?A(t,n):y=n,l(n,d(G,{get each(){return p()},children:a=>d(q,{type:"button",get variant(){return oe(a.style)},get"data-action-id"(){return a.id},get"data-kai-default"(){return a.default?"true":void 0},ref:s=>{r.autofocus&&a.id===k()&&queueMicrotask(()=>s.focus())},onClick:()=>b(a),get children(){return a.label}})})),e}})},get children(){var e=re();e.$$keydown=t=>{if(t.key!=="Enter"||t.target.tagName==="BUTTON")return;const a=k();if(a===void 0)return;const s=p().find(w=>w.id===a);s&&b(s)};var n=S;return typeof n=="function"?A(n,e):S=e,l(e,d(f,{get when(){return M()},get children(){var t=_(),a=t.firstChild;return l(t,d(X,{size:16,class:"shrink-0","aria-hidden":"true"}),a),t}}),null),l(e,d(f,{get when(){var t;return(t=r.data)==null?void 0:t.heading},get children(){var t=ee();return l(t,()=>{var a;return(a=r.data)==null?void 0:a.heading}),t}}),null),l(e,d(f,{get when(){var t;return(t=r.data)==null?void 0:t.body},get children(){var t=te();return l(t,()=>{var a;return(a=r.data)==null?void 0:a.body}),t}}),null),$(t=>{var a=K("flex flex-col gap-2",r.class),s=k()!==void 0?0:void 0;return a!==t.e&&U(e,t.e=a),s!==t.t&&z(e,"tabindex",t.t=s),t},{e:void 0,t:void 0}),e}})}})}})}})}J(["keydown"]);export{ue as C};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as c}from"./define-wjHR1MkU.js";function i(t,o){const[r,n]=c(o);return[()=>t()??r(),a=>n(a)]}export{i as c};
|