@kitn.ai/ui 0.25.2 → 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 +17 -6
- package/bin/mcp.js +16 -3
- package/bin/route.js +23 -0
- package/bin/route.test.js +58 -0
- package/dist/{elements/chunks/Icon-b5A8hlHs.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/audio-visualizer-B-79y1Tj.js +1 -0
- 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-B9okqG73.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/code-block-CUQ5mtv0.js +1 -0
- package/dist/collapsible-CPJbf6FM.js +1 -0
- package/dist/components/attachment-types.d.ts +53 -1
- package/dist/components/attachments.d.ts +31 -0
- package/dist/components/audio-visualizer/fit-scale.d.ts +50 -0
- package/dist/components/audio-visualizer/index.d.ts +15 -1
- package/dist/components/audio-visualizer/variant-bar.d.ts +24 -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 +49 -42
- package/dist/components/code-block.d.ts +22 -0
- package/dist/components/conversation-item.d.ts +66 -1
- package/dist/components/conversation-list.d.ts +77 -0
- package/dist/components/form-widgets.d.ts +67 -2
- package/dist/components/form.d.ts +89 -0
- package/dist/components/message.d.ts +29 -0
- 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/toast.d.ts +2 -1
- package/dist/components/tool-types.d.ts +9 -0
- package/dist/components/voice-input.d.ts +8 -0
- package/dist/components/voice-output.d.ts +12 -1
- package/dist/components/workspace-shell.d.ts +87 -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/context-BY8V-Nlp.js +1 -0
- 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-CUzOlaMS.js → create-tween-BPzaefTp.js} +1 -1
- package/dist/{create-tween-B5Y4Im8G.js → create-tween-CnMHviKB.js} +1 -1
- package/dist/{create-tween-4z1XYLkR.js → create-tween-D1aiGZZh.js} +1 -1
- package/dist/{elements/chunks/create-tween-CUrM6D_o.js → create-tween-DUSQUKpr.js} +2 -2
- package/dist/css-M7EaDHN_.js +1 -6
- package/dist/custom-elements.json +3468 -1927
- 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/diagnostics/hook.d.ts +81 -0
- package/dist/diagnostics/index.d.ts +7 -0
- package/dist/diagnostics/report-request.d.ts +61 -0
- package/dist/diagnostics.d.ts +5 -0
- package/dist/diagnostics.js +209 -0
- package/dist/disclosure-CbLtajUQ.js +1 -0
- package/dist/dropdown-BwhViJFd.js +1 -0
- 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.d.ts +1 -0
- package/dist/elements/conversation-item.js +1 -0
- package/dist/elements/conversation-list.js +1 -1
- package/dist/elements/default-input.d.ts +3 -3
- package/dist/elements/define-entry.d.ts +12 -0
- package/dist/elements/define.d.ts +27 -0
- package/dist/elements/diagnostic-events.d.ts +74 -0
- package/dist/elements/dialog.js +1 -1
- package/dist/elements/dock.d.ts +1 -0
- package/dist/elements/dock.js +243 -0
- package/dist/elements/dropdown.d.ts +1 -0
- package/dist/elements/dropdown.js +1 -0
- package/dist/elements/editable-label.js +1 -1
- package/dist/elements/element-data-types.d.ts +37 -0
- package/dist/elements/element-diagnostics.d.ts +81 -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/register.d.ts +2 -0
- package/dist/elements/remote.js +1 -1
- package/dist/elements/resizable.js +1 -1
- package/dist/elements/response-stream.js +3 -3
- 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 +36 -4
- 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 +589 -167
- package/dist/{elements/chunks/ellipsis-CVxqfsDZ.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-DG2sRdQL.js → external-link-u9d85ORQ.js} +1 -1
- package/dist/file-text-CX7_x42o.js +1 -0
- package/dist/{elements/chunks/file-tree-yGWNK0Js.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 +3 -1
- package/dist/index.js +8473 -6470
- package/dist/index.server.js +6495 -4958
- 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-provider.es.js +40 -40
- 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-Cf5KOP-i.js → link-preview-DIIbV2Sd.js} +1 -1
- package/dist/loader-YQszHFaW.js +1 -0
- package/dist/{elements/chunks/markdown-DbozyYqa.js → markdown-CVk1MPsj.js} +1 -1
- package/dist/mcp.es.js +3873 -544
- 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-SegJ_oku.js → minimize-2-UEZmP2QT.js} +1 -1
- package/dist/{elements/chunks/model-switcher-D7JrFFHp.js → model-switcher-Kk1jEQ5t.js} +1 -1
- package/dist/{elements/chunks/overlay-CV7z2YuX.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 +23 -0
- package/dist/primitives/use-speech-recognition.d.ts +8 -0
- package/dist/primitives/use-text-stream.d.ts +5 -0
- 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 +306 -283
- package/dist/react.js +309 -247
- package/dist/reasoning-Cackq4Rh.js +1 -0
- package/dist/register-impl-C7rENvPK.js +424 -0
- package/dist/{elements/chunks/resizable-Dpzjlvp4.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/index.d.ts +1 -1
- package/dist/schemas/tool-defs.d.ts +45 -0
- package/dist/schemas.js +398 -305
- 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-DH2r_ZSZ.js → separator-CE6vly6z.js} +1 -1
- package/dist/{elements/chunks/settings-BFMOd6yB.js → settings-CE-78SvZ.js} +1 -1
- package/dist/{elements/chunks/settings-group-B3VZKIcz.js → settings-group-ZFWNxFQR.js} +1 -1
- package/dist/{elements/chunks/skeleton-N8BuWYmf.js → skeleton-BebdP4mf.js} +1 -1
- package/dist/slider-BAKRYUlz.js +1 -0
- package/dist/slots-DaNjX0rc.js +1 -0
- package/dist/{solid-BMuDmFo_.js → solid-BE5ui6sy.js} +10672 -8116
- package/dist/{solid-CGYNdLRR.js → solid-DFhsce3O.js} +8137 -6056
- package/dist/solid.d.ts +15 -0
- package/dist/solid.js +248 -235
- package/dist/solid.server.js +248 -235
- package/dist/source-B0FlguSx.js +1 -0
- package/dist/star-CBMZvLuN.js +1 -0
- package/dist/state/index.d.ts +5 -1
- package/dist/state/mock.d.ts +32 -2
- package/dist/state/persistence.d.ts +51 -0
- package/dist/state/stream.d.ts +50 -0
- package/dist/state/threads.d.ts +71 -0
- package/dist/state.js +297 -172
- package/dist/store-7eoadydQ.js +1 -0
- 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-DQe0hvkZ.js → thumbs-up-DQcu2HMO.js} +1 -1
- package/dist/toast-store-C6yKOhbk.js +1 -0
- package/dist/{elements/chunks/tool-C1YtxwPu.js → tool-BCYNlfKy.js} +1 -1
- package/dist/{elements/chunks/tooltip-BqwnFWhn.js → tooltip-05zI4hjs.js} +1 -1
- package/dist/trash-2-BR1RxGky.js +1 -0
- package/dist/{elements/chunks/triangle-alert-B6or7F5u.js → triangle-alert-DHohDOCy.js} +1 -1
- package/dist/tsx-B8rCNbgL.js +1 -6
- package/dist/types.d.ts +4 -2
- 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 +131 -0
- package/dist/ui/hover-card.d.ts +44 -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-DwSOfraQ.js → variant-aurora-BUOVgPOB.js} +27 -27
- package/dist/{variant-aurora-wKvAQ5wp.js → variant-aurora-CUsUJvFI.js} +28 -28
- package/dist/{variant-aurora-XEkPT0_z.js → variant-aurora-CW2i4bfr.js} +2 -2
- package/dist/{elements/chunks/variant-aurora-QXTZPyST.js → variant-aurora-xiMPty8f.js} +2 -2
- package/dist/variant-custom-BQtOnmeO.js +1 -0
- package/dist/{variant-custom-BhS9wIpU.js → variant-custom-CAm9L-E5.js} +65 -65
- package/dist/{variant-custom-eFIg2XWQ.js → variant-custom-CAnzzppW.js} +40 -40
- package/dist/variant-custom-D91HjAKz.js +1 -0
- package/dist/{variant-wave-CUWGx9Bn.js → variant-wave-Ca1Ls4_y.js} +21 -21
- package/dist/{variant-wave-CbVsmgwT.js → variant-wave-CxX39DKd.js} +25 -25
- package/dist/{variant-wave-BwzrHD1s.js → variant-wave-DYyzIIZv.js} +2 -2
- package/dist/{elements/chunks/variant-wave-DDCwhLas.js → variant-wave-uY5crU_K.js} +2 -2
- package/dist/vue-BmIZj4XD.js +1 -33
- package/dist/wire/chunk.d.ts +47 -0
- package/dist/wire/diagnostics.d.ts +575 -0
- package/dist/wire/encode-probe.d.ts +70 -0
- package/dist/wire/encode.d.ts +24 -0
- package/dist/wire/index.d.ts +2 -0
- package/dist/wire/sse.d.ts +10 -2
- package/dist/wire.js +917 -480
- package/dist/x-C5m1JFgi.js +1 -0
- package/frameworks/react/index.tsx +325 -108
- package/llms-full.txt +1354 -82
- package/llms.txt +6 -3
- package/package.json +39 -6
- package/src/agent-tooling/archetypes.ts +41 -9
- package/src/agent-tooling/catalog/README.md +676 -0
- package/src/agent-tooling/catalog/catalog-types.ts +231 -0
- package/src/agent-tooling/catalog/fabrications.ts +96 -0
- package/src/agent-tooling/catalog/invariants.ts +284 -0
- package/src/agent-tooling/catalog/labs-titles.ts +114 -0
- package/src/agent-tooling/catalog/scenarios.ts +87 -0
- package/src/agent-tooling/catalog/surfaces.ts +347 -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/integrations/anthropic.ts +7 -1
- package/src/agent-tooling/integrations/cloudflare.ts +43 -2
- package/src/agent-tooling/integrations/langgraph.ts +7 -1
- package/src/agent-tooling/integrations/mastra.ts +7 -1
- package/src/agent-tooling/integrations/mock.ts +92 -17
- package/src/agent-tooling/integrations/ollama.ts +7 -1
- package/src/agent-tooling/integrations/openai.ts +7 -1
- package/src/agent-tooling/integrations/openrouter.ts +7 -1
- package/src/agent-tooling/integrations/pi.ts +56 -1
- package/src/agent-tooling/integrations/vercel-ai-sdk.ts +7 -1
- package/src/agent-tooling/mcp/css-raw.d.ts +12 -0
- package/src/agent-tooling/mcp/manifest.ts +100 -1
- package/src/agent-tooling/mcp/server.ts +63 -6
- 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 +542 -5
- package/src/agent-tooling/mcp/tools/scaffold.ts +1834 -307
- package/src/agent-tooling/mcp/tools/theme.ts +146 -30
- package/src/agent-tooling/mcp/validate-args.ts +141 -0
- 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 +24 -7
- package/src/agent-tooling/route-emit.ts +26 -2
- package/src/components/attachment-types.ts +54 -1
- package/src/components/attachments.tsx +169 -22
- package/src/components/audio-visualizer/fit-scale.ts +112 -0
- package/src/components/audio-visualizer/index.tsx +80 -3
- package/src/components/audio-visualizer/variant-aurora.tsx +10 -4
- package/src/components/audio-visualizer/variant-bar.tsx +38 -6
- package/src/components/audio-visualizer/variant-custom.tsx +8 -2
- package/src/components/audio-visualizer/variant-grid.tsx +16 -11
- package/src/components/audio-visualizer/variant-radial.tsx +15 -10
- package/src/components/audio-visualizer/variant-wave.tsx +7 -2
- package/src/components/card-renderer.tsx +39 -8
- package/src/components/card.tsx +10 -2
- package/src/components/chat-container.tsx +4 -1
- package/src/components/chat-scope-picker.tsx +2 -2
- package/src/components/chat-thread.tsx +105 -13
- package/src/components/choice-card.tsx +102 -37
- package/src/components/coachmark.tsx +1 -1
- package/src/components/code-block.tsx +81 -5
- package/src/components/composer.tsx +89 -8
- package/src/components/confirm-card.tsx +20 -4
- package/src/components/conversation-item.tsx +138 -4
- package/src/components/conversation-list.tsx +230 -15
- package/src/components/embed.tsx +4 -0
- 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 +336 -21
- package/src/components/loader.tsx +12 -5
- package/src/components/message-skills.tsx +1 -1
- package/src/components/message.tsx +142 -12
- 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/response-stream.tsx +13 -7
- package/src/components/screen.tsx +5 -0
- package/src/components/scroll-button.tsx +63 -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 +11 -5
- package/src/components/tool-types.ts +9 -0
- package/src/components/voice-input.tsx +35 -3
- package/src/components/voice-output.tsx +46 -6
- package/src/components/workspace-shell.tsx +285 -0
- package/src/diagnostics/hook.ts +352 -0
- package/src/diagnostics/index.ts +82 -0
- package/src/diagnostics/report-request.ts +296 -0
- package/src/elements/attachments.tsx +9 -8
- package/src/elements/audio-visualizer.tsx +48 -4
- package/src/elements/chat-workspace.tsx +159 -287
- package/src/elements/chat.tsx +31 -10
- package/src/elements/checkbox-group.tsx +164 -0
- package/src/elements/checkbox.tsx +134 -0
- package/src/elements/code-block.tsx +19 -1
- package/src/elements/command.tsx +4 -1
- package/src/elements/compiled.css +1 -1
- package/src/elements/composer.tsx +12 -1
- package/src/elements/conversation-item.tsx +120 -0
- package/src/elements/conversation-list.tsx +60 -11
- package/src/elements/default-input.tsx +5 -5
- package/src/elements/define-entry.ts +12 -0
- package/src/elements/define.tsx +168 -8
- package/src/elements/diagnostic-events.ts +114 -0
- package/src/elements/dialog.tsx +47 -0
- package/src/elements/disclosure.ts +34 -12
- package/src/elements/dock.tsx +215 -0
- package/src/elements/dropdown.tsx +123 -0
- package/src/elements/element-data-types.ts +40 -0
- package/src/elements/element-diagnostics.ts +392 -0
- package/src/elements/element-manifest.json +36 -0
- package/src/elements/element-meta.json +1483 -560
- package/src/elements/element-nonscalar.json +185 -0
- package/src/elements/element-types.d.ts +589 -167
- 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/menu.tsx +13 -0
- package/src/elements/message.tsx +2 -0
- package/src/elements/pane-grid.tsx +111 -0
- package/src/elements/prompt-dock.tsx +2 -1
- package/src/elements/prompt-input.tsx +16 -10
- package/src/elements/radio-group.tsx +129 -0
- package/src/elements/register-impl.ts +52 -0
- package/src/elements/register.ts +28 -0
- package/src/elements/resizable.tsx +52 -25
- package/src/elements/scroll-button.tsx +59 -6
- package/src/elements/select.tsx +165 -0
- package/src/elements/slider.tsx +171 -0
- package/src/elements/slots.ts +108 -13
- package/src/elements/styles.css +119 -9
- package/src/elements/thinking-bar.tsx +16 -7
- package/src/elements/thread.tsx +2 -0
- package/src/elements/toast.tsx +17 -1
- package/src/elements/tool.tsx +26 -5
- package/src/elements/voice-input.tsx +11 -2
- package/src/elements/voice-output.tsx +16 -3
- package/src/index.ts +4 -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 +33 -0
- package/src/primitives/use-speech-recognition.ts +12 -1
- package/src/primitives/use-stick-to-bottom.ts +34 -2
- package/src/primitives/use-text-stream.ts +33 -2
- package/src/remote/provider-runtime.ts +6 -3
- package/src/schemas/index.ts +1 -0
- package/src/schemas/tool-defs.ts +307 -6
- package/src/solid.ts +15 -0
- package/src/state/index.ts +13 -1
- package/src/state/mock.ts +92 -6
- package/src/state/persistence.ts +180 -0
- package/src/state/stream.ts +71 -4
- package/src/state/threads.ts +142 -0
- package/src/types.ts +4 -2
- 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/dialog.tsx +6 -0
- package/src/ui/dock.tsx +584 -0
- package/src/ui/dropdown.tsx +67 -23
- package/src/ui/hover-card.tsx +156 -6
- package/src/ui/icon.tsx +53 -0
- package/src/ui/input.tsx +275 -16
- 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/resizable.tsx +11 -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/src/wire/chunk.ts +47 -0
- package/src/wire/consume.ts +185 -26
- package/src/wire/diagnostics.ts +727 -0
- package/src/wire/encode-probe.ts +214 -0
- package/src/wire/encode.ts +267 -14
- package/src/wire/formats/anthropic.ts +8 -1
- package/src/wire/formats/openai.ts +5 -0
- package/src/wire/index.ts +22 -0
- package/src/wire/read.ts +250 -6
- package/src/wire/sse.ts +16 -3
- package/theme.css +84 -13
- package/dist/elements/chunks/action-icons-DW9muWrY.js +0 -1
- package/dist/elements/chunks/arrow-left-iJVnQmxA.js +0 -1
- package/dist/elements/chunks/artifact-BSuPYFHY.js +0 -1
- package/dist/elements/chunks/attachments-CL6TaqIb.js +0 -1
- package/dist/elements/chunks/audio-visualizer-BuUqQmaO.js +0 -1
- package/dist/elements/chunks/badge-TIMiJFKc.js +0 -1
- package/dist/elements/chunks/bash-InADTalH.js +0 -1
- package/dist/elements/chunks/card-renderer-CSoTL_e1.js +0 -1
- package/dist/elements/chunks/card-routing-BK09BdmL.js +0 -1
- package/dist/elements/chunks/chat-thread-DxoKaStk.js +0 -1
- package/dist/elements/chunks/check-MdLzbxrm.js +0 -1
- package/dist/elements/chunks/chevron-down-MK7IzDqe.js +0 -1
- package/dist/elements/chunks/chevron-right-C5jXhmtV.js +0 -1
- package/dist/elements/chunks/choice-card-CGMc3kek.js +0 -1
- package/dist/elements/chunks/circle-BG7VkPep.js +0 -1
- package/dist/elements/chunks/circle-check-GqvO2UBs.js +0 -1
- package/dist/elements/chunks/circle-x-mhH7pOK2.js +0 -1
- package/dist/elements/chunks/code-block-ClhQO9RW.js +0 -1
- package/dist/elements/chunks/collapsible-DBcBkFPh.js +0 -1
- package/dist/elements/chunks/composer-CZZmtYOT.js +0 -69
- package/dist/elements/chunks/confirm-card-BWjf2-xo.js +0 -1
- package/dist/elements/chunks/context-hKjNqiyQ.js +0 -1
- package/dist/elements/chunks/conversation-list-CsGJjSKG.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-B1Mem5wu.js +0 -1
- package/dist/elements/chunks/define-B_tXMYRm.js +0 -1
- package/dist/elements/chunks/disclosure-DAoYOKew.js +0 -1
- package/dist/elements/chunks/download-DnCyWFJE.js +0 -1
- package/dist/elements/chunks/dropdown-CmNna5lT.js +0 -1
- package/dist/elements/chunks/embed-CjAD2jSi.js +0 -1
- package/dist/elements/chunks/engine-javascript-vq0WuIJl.js +0 -141
- package/dist/elements/chunks/file-text-D0J9F6M7.js +0 -1
- package/dist/elements/chunks/folder-NV1pi_ud.js +0 -1
- package/dist/elements/chunks/form-Cp8Y00Wn.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-6KtXpLwT.js +0 -1
- package/dist/elements/chunks/html-CPZ3oZQ7.js +0 -1
- package/dist/elements/chunks/icon-97R8SR2p.js +0 -1
- package/dist/elements/chunks/info-C8r5Q6cc.js +0 -1
- package/dist/elements/chunks/input-DrseEjhp.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-OGJDUT-O.js +0 -1
- package/dist/elements/chunks/link-BdsfLB7b.js +0 -1
- package/dist/elements/chunks/loader-B5QzK_8_.js +0 -1
- package/dist/elements/chunks/message-CE4k-qaj.js +0 -1
- package/dist/elements/chunks/message-DtXKPqiR.js +0 -1
- package/dist/elements/chunks/message-square-C9ovmtOo.js +0 -1
- package/dist/elements/chunks/paperclip-Bg0ITU3b.js +0 -1
- package/dist/elements/chunks/progress-bar-D1_rzt6N.js +0 -1
- package/dist/elements/chunks/prompt-suggestion-D5Sm8xF1.js +0 -1
- package/dist/elements/chunks/reasoning-BrxQfpfI.js +0 -1
- package/dist/elements/chunks/rotate-cw-DzVDJOA1.js +0 -1
- package/dist/elements/chunks/scroll-area-93A1bbeG.js +0 -1
- package/dist/elements/chunks/scroll-button-CrTo7wm4.js +0 -1
- package/dist/elements/chunks/share-DgNbkJKY.js +0 -1
- package/dist/elements/chunks/slots-CIw9RlAe.js +0 -1
- package/dist/elements/chunks/source-w9V0NnBn.js +0 -1
- package/dist/elements/chunks/star-DHvACxtm.js +0 -1
- package/dist/elements/chunks/store-HIPGhNz9.js +0 -1
- package/dist/elements/chunks/svelte--5p79yCD.js +0 -1
- package/dist/elements/chunks/tasks-card-lPxoodlA.js +0 -1
- package/dist/elements/chunks/text-shimmer-BY_rI3s5.js +0 -1
- package/dist/elements/chunks/textarea-DPfuhswM.js +0 -1
- package/dist/elements/chunks/toast-store-VUZZBhzH.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-DJg32jGH.js +0 -1
- package/dist/elements/chunks/variant-custom-D5ZlmziF.js +0 -1
- package/dist/elements/chunks/video-Bb86fVYI.js +0 -1
- package/dist/elements/chunks/vue-BmIZj4XD.js +0 -1
- package/dist/elements/chunks/x-BOhjBeOd.js +0 -1
- package/dist/llms/llms-full.txt +0 -2834
- package/dist/llms/llms.txt +0 -156
- package/dist/primitives/card-validate-generator.testlib.d.ts +0 -20
- package/dist/register-impl-DGmGzrEM.js +0 -145
- package/dist/ui/stat.d.ts +0 -16
- package/dist/variant-custom-MkTNTycd.js +0 -1
- package/src/primitives/card-validate-generator.testlib.ts +0 -38
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as k,h as x,f as K,c as g,j as N,D as P,A as Q,o as H,C as V,S as w,m as T,i as X,a as Y,b as Z,v as $,t as A}from"./define-CGGX-7Vg.js";import{r as ee,M as te}from"./slots-DaNjX0rc.js";import{a as z,M as re,b as ae}from"./message-DS8lzHc1.js";import{t as B}from"./toast-store-C6yKOhbk.js";import{B as O}from"./card-renderer-Cb1gQmth.js";import{m as ne,B as oe}from"./card-tags-D8lZ-C_U.js";function se(e){return e.filter(a=>a.type==="text").map(a=>a.text).join("")}const ie=2e3;function R(e){const[a,c]=k({}),[o,i]=k(new Set),v=e.copiedDuration??ie,n=new Map;x(()=>{n.forEach(r=>clearTimeout(r)),n.clear()});const u=r=>r.feedback??a()[r.id],h=r=>o().has(r),f=r=>{i(d=>{const l=new Set(d);return l.add(r),l});const s=n.get(r);s&&clearTimeout(s),n.set(r,setTimeout(()=>{n.delete(r),i(d=>{if(!d.has(r))return d;const l=new Set(d);return l.delete(r),l})},v))},b=(r,s)=>{c(d=>{const l={...d};return s===void 0?delete l[r]:l[r]=s,l})};return{resolveFeedback:u,isCopied:h,handleAction:(r,s)=>{var d,l,p;if(s==="copy"){try{(d=navigator.clipboard)==null||d.writeText(se(r.parts))}catch{}f(r.id),B("Copied to clipboard",{target:(l=e.target)==null?void 0:l.call(e)}),e.emit({messageId:r.id,action:s});return}if(s==="like"||s==="dislike"){u(r)===s?(b(r.id,void 0),e.emit({messageId:r.id,action:s,state:"off"})):(b(r.id,s),B("Thanks for your feedback",{target:(p=e.target)==null?void 0:p.call(e)}),e.emit({messageId:r.id,action:s,state:"on"}));return}e.emit({messageId:r.id,action:s})}}}function S(e){return!!e&&typeof e=="object"&&Array.isArray(e.parts)}const le="each entry needs a 'parts' array (e.g. parts: [{ type: 'text', text: 'Hi' }]). The 'content' string field was removed in 0.20.0.",ce=[];function de(e){const a=new WeakSet;let c=!1,o=!1;return i=>{if(!Array.isArray(i))return i!=null&&!o&&(o=!0,console.error(`<${e}>: 'messages' must be an array. Ignoring it.`)),ce;if(i.every(S))return i;let v=0,n=0;for(const u of i)if(!S(u)){if(v++,u!==null&&typeof u=="object"){if(a.has(u))continue;a.add(u)}else{if(c)continue;c=!0}n++}return n>0&&console.error(`<${e}>: skipped ${v} of ${i.length} messages: ${le}`),i.filter(S)}}var ue=A("<slot name=before-body>"),ge=A("<slot name=after-body>"),ve=A("<div part=avatar class=shrink-0><slot name=avatar>"),me=A("<div>");function _(e,a="auto"){const c=ne(e),o={};for(const i of Object.keys(c)){const v=c[i];o[i]=v===oe[i]&&O[i]?O[i]:n=>g(fe,{tag:v,get envelope(){return n.envelope},theme:a})}return o}function fe(e){let a;return N(()=>{a&&(a.data=e.envelope.data,a.cardId=e.envelope.id,e.envelope.title!=null&&(a.heading=e.envelope.title),a.resolution=e.envelope.resolution,a.setAttribute("theme",e.theme),a.setAttribute("data-card-id",e.envelope.id))}),g(P,{get component(){return e.tag},ref(c){var o=a;typeof o=="function"?o(c):a=c}})}function D(e){const a=e.getAttribute("role");a!==null&&(e.removeAttribute("role"),e.role=a)}K("kai-message",{message:void 0,role:"assistant",markdown:void 0,proseSize:"sm",codeTheme:"github-dark-dimmed",codeHighlight:!0,actionsReveal:"always",avatarSrc:void 0,avatarFallback:void 0,avatar:void 0,cardTypes:void 0,cardSchemas:void 0},(e,{dispatch:a,flag:c,element:o,expose:i})=>{const v=Q();D(o);const n=()=>e.message??{id:"message",role:e.role??"assistant",parts:[]};let u;const h=()=>{const t=n();return S(t)?!0:(t!==u&&(u=t,console.error("<kai-message>: 'message' must have a 'parts' array. The 'content' string field was removed in 0.20.0.")),!1)},f=R({emit:t=>a("kai-message-action",t)});i({copy:()=>{h()&&f.handleAction(n(),"copy")}});const[b,r]=k([]),[s,d]=k({});H(()=>{const t=()=>{const J=[...o.querySelectorAll("kai-action")];r(J.map(m=>{var j;return{id:m.id||m.getAttribute("action")||"",label:((j=m.textContent)==null?void 0:j.trim())||m.getAttribute("label")||m.id||"",icon:m.getAttribute("icon")??void 0,tooltip:m.getAttribute("tooltip")??void 0}})),d(ee(o,te))};t();const y=new MutationObserver(t);y.observe(o,{childList:!0,attributes:!0,subtree:!0}),x(()=>y.disconnect())}),H(()=>{const t=new MutationObserver(()=>D(o));t.observe(o,{attributes:!0,attributeFilter:["role"]}),x(()=>t.disconnect())});const l=()=>n().role==="user",p=()=>n().avatar??(e.avatarSrc||e.avatarFallback?{src:e.avatarSrc,fallback:e.avatarFallback}:void 0),E=()=>e.avatar==="none",F=()=>!!s().avatar,q=()=>!E()&&(F()||!!p()),M=()=>e.actionsReveal==="hover"?"hover":"always",L=()=>o.hasAttribute("markdown")||e.markdown===!0||e.markdown===!1,U=()=>L()?c("markdown"):!l(),W=()=>[...n().actions??[],...b()],C=()=>g(re,{get parts(){return n().parts},get cardTypes(){return _(e.cardTypes,e.theme)},get cardSchemas(){return e.cardSchemas},cardHostElement:o,get isUser(){return l()},get markdown(){return U()},get actions(){return W()},get actionsReveal(){return M()},get activeFeedback(){return f.resolveFeedback(n())},get copied(){return f.isCopied(n().id)},onAction:t=>f.handleAction(n(),t),get beforeBody(){return T(()=>!!s()["before-body"])()?(()=>{var t=ue();return t._$owner=$(),t})():void 0},get afterBody(){return T(()=>!!s()["after-body"])()?(()=>{var t=ge();return t._$owner=$(),t})():void 0}}),I=()=>M()==="hover"?"group ":"",G=()=>g(w,{get when(){return F()},get fallback(){return g(w,{get when(){return p()},children:t=>g(ae,{get src(){return t().src??""},get alt(){return t().alt??""},get fallback(){return t().fallback}})})},get children(){var t=ve(),y=t.firstChild;return y._$owner=$(),t}});return g(w,{get when(){return h()},get children(){return g(V,{get proseSize(){return e.proseSize},get codeTheme(){return e.codeTheme},get codeHighlight(){return c("codeHighlight")},get portalMount(){return v.portalMount()},get children(){return g(w,{get when(){return q()},get fallback(){return g(z,{get role(){return n().role},get class(){return`${I()}${l()?"flex-col items-end":"flex-col items-start"}`},get children(){return C()}})},get children(){return g(z,{get role(){return n().role},get class(){return I()},get children(){return[T(()=>G()),(()=>{var t=me();return X(t,C),Y(()=>Z(t,`flex min-w-0 flex-1 flex-col ${l()?"items-end":"items-start"}`)),t})()]}})}})}})}})});export{_ as a,de as b,R as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as S,p as A,q as B,m as w,i as g,k as D,c as r,S as c,r as F,M as o,F as z,a as x,d as k,I as E,b as T,t as u,A as H,O as q,e as L}from"./define-CGGX-7Vg.js";import{T as N}from"./tooltip-05zI4hjs.js";import{c as h}from"./cn-DN5AWfiS.js";import{M as P}from"./markdown-CVk1MPsj.js";import{B as _}from"./button-BH6rN0U-.js";import{B as $,a as j}from"./action-icons-CBskfBMz.js";import{R as G,a as J,b as K}from"./reasoning-Cackq4Rh.js";import{L as Q}from"./loader-YQszHFaW.js";import{T as V}from"./tool-BCYNlfKy.js";import{A as W,a as X,b as Y,c as Z,d as ee,e as re,f as te,g as C,h as ne}from"./attachments-C43ZegEq.js";import{S as ae,a as ie,b as le,c as se}from"./source-B0FlguSx.js";import{a as ce}from"./card-renderer-Cb1gQmth.js";import{c as oe}from"./check-DPeeMUYx.js";var ue=u("<div part=row>"),de=u('<img class="h-full w-full object-cover">'),ge=u("<div part=avatar>"),he=u('<div class="flex h-full w-full items-center justify-center bg-muted text-xs font-medium text-muted-foreground">'),R=u("<div>"),me=u('<span class="px-1 text-xs">'),fe=u('<span><span class="min-w-0 overflow-hidden">'),pe=u('<img class="block max-h-64 max-w-xs rounded object-contain">'),ve=u('<div class="text-body font-medium">'),be=u('<div class="text-muted-foreground text-caption">');const ke={user:"User message",assistant:"Assistant message",system:"System message"};function we(e){const[t,n]=S(e,["children","class","role"]);return(()=>{var a=ue();return A(a,B({get class(){return h("flex items-start gap-3",t.class)},get"data-role"(){return t.role},get role(){return t.role?"article":void 0},get"aria-label"(){return w(()=>!!t.role)()?ke[t.role]:void 0}},n),!1,!0),g(a,()=>t.children),a})()}function xe(e){return(()=>{var t=ge();return g(t,r(c,{get when(){return e.src},get fallback(){return r(c,{get when(){return e.fallback},get children(){var n=he();return g(n,()=>e.fallback),n}})},get children(){var n=de();return x(a=>{var i=e.src,l=e.alt??"";return i!==a.e&&k(n,"src",a.e=i),l!==a.t&&k(n,"alt",a.t=l),a},{e:void 0,t:void 0}),n}})),x(()=>T(t,h("h-8 w-8 shrink-0 overflow-hidden rounded-full",e.class))),t})()}function ye(e){const[t,n]=S(e,["children","markdown","class","part"]),a=H(),i=()=>h("min-w-0 rounded-lg p-2 text-foreground bg-secondary max-w-none break-words whitespace-normal",q(a.proseSize()),t.class);return r(c,{get when(){return t.markdown},get fallback(){return(()=>{var l=R();return A(l,B({get part(){return t.part},get class(){return i()}},n),!1,!0),g(l,()=>t.children),l})()},get children(){return r(P,{get part(){return t.part},get content(){return t.children},get class(){return i()}})}})}function Se(e){const[t,n]=S(e,["children","class"]);return(()=>{var a=R();return A(a,B({get class(){return h("flex items-center gap-0.5 mt-0.5",t.class)}},n),!1,!0),g(a,()=>t.children),a})()}function Ae(e){return typeof e=="string"?{id:e,label:$[e],Icon:j(e)}:{id:e.id,label:e.label,Icon:j(e.icon)}}function Be(e){return e==="like"||e==="dislike"?e:void 0}function Fe(e){return r(Se,{part:"actions",get class(){return h("mt-1 flex gap-0",e.reveal==="hover"&&"opacity-0 transition-opacity group-hover:opacity-100",e.class)},get children(){return r(z,{get each(){return e.actions},children:t=>{const n=Ae(t),a=()=>typeof t!="string"&&t.tooltip?t.tooltip:n.label,i=Be(t),l=()=>i!==void 0&&e.activeFeedback===i,d=n.id==="copy",m=()=>d&&e.copied===!0,s=()=>r(_,{variant:"ghost",size:"icon-sm",get class(){return h("rounded-full",l()&&"text-primary")},get"data-action"(){return n.id},get"aria-label"(){return w(()=>!!m())()?"Copied":n.label},get"aria-pressed"(){return i!==void 0?l():void 0},onClick:()=>e.onAction(n.id),get children(){return r(c,{get when(){return m()},get fallback(){return r(c,{get when(){return n.Icon},get fallback(){return(()=>{var f=me();return g(f,()=>n.label),f})()},children:f=>{const p=f();return r(p,{get class(){return h("size-3.5",l()&&"fill-current")}})}})},get children(){return r(oe,{class:"size-3.5 text-emerald-400"})}})}}),v=()=>r(c,{get when(){return n.Icon},get fallback(){return s()},get children(){return r(N,{get content(){return a()},get children(){return s()}})}});return r(c,{when:i!==void 0,get fallback(){return v()},get children(){return(()=>{const f=()=>e.activeFeedback===void 0||e.activeFeedback===i;return(()=>{var p=fe(),U=p.firstChild;return g(U,v),x(b=>{var M=f()?void 0:"",O=h("grid transition-[grid-template-columns,opacity] duration-300 ease-out",f()?"grid-cols-[1fr] opacity-100":"grid-cols-[0fr] opacity-0");return M!==b.e&&k(p,"data-feedback-collapsed",b.e=M),O!==b.t&&T(p,b.t=O),b},{e:void 0,t:void 0}),p})()})()}})}})}})}function ze(e){const t=[];for(const n of e){if(n.type==="file"){const a=t[t.length-1];if(a?.kind==="files"){t[t.length-1]={kind:"files",parts:[...a.parts,n]};continue}t.push({kind:"files",parts:[n]});continue}if(n.type==="source"){const a=t[t.length-1];if(a?.kind==="sources"){t[t.length-1]={kind:"sources",parts:[...a.parts,n]};continue}t.push({kind:"sources",parts:[n]});continue}t.push({kind:"single",part:n})}return t}function Ie(e){if(e.index!==void 0)return e.index;if(!e.url)return e.title||"Source"}function Me(e){return e.title||e.url||"Source"}function I(e,t){return e.kind===t?e:!1}function y(e,t){return e.type===t?e:!1}function Oe(e){const t=D(()=>ze(e.parts));return[r(c,{get when(){return e.beforeBody},get children(){return e.beforeBody}}),r(E,{get each(){return t()},children:n=>r(F,{fallback:null,get children(){return[r(o,{get when(){return I(n(),"files")},children:a=>r(W,{variant:"grid",get class(){return e.isUser?"mb-2 ml-auto":"mb-2"},get children(){return r(z,{get each(){return a().parts},children:i=>r(X,{get data(){return i.attachment},get children(){return r(Y,{get children(){return[r(Z,{class:"block size-full",get children(){return[r(ee,{}),r(re,{})]}}),r(te,{get children(){return r(c,{get when(){return w(()=>ne(i.attachment)==="image"&&i.attachment.type==="file")()&&i.attachment.url},get fallback(){return[(()=>{var l=ve();return g(l,()=>C(i.attachment)),l})(),r(c,{get when(){return i.attachment.mediaType},get children(){var l=be();return g(l,()=>i.attachment.mediaType),l}})]},get children(){var l=pe();return x(d=>{var m=C(i.attachment),s=i.attachment.url;return m!==d.e&&k(l,"alt",d.e=m),s!==d.t&&k(l,"src",d.t=s),d},{e:void 0,t:void 0}),l}})}})]}})}})})}})}),r(o,{get when(){return I(n(),"sources")},children:a=>r(ae,{part:"citations",get class(){return e.isUser?"justify-end":void 0},get children(){return r(z,{get each(){return a().parts},children:i=>r(ie,{get href(){return i.source.url},get children(){return[r(le,{get label(){return Ie(i.source)}}),r(se,{get title(){return Me(i.source)},get description(){return i.source.snippet??""}})]}})})}})}),r(o,{get when(){return I(n(),"single")},children:a=>{const i=()=>a().part,l=()=>y(i(),"reasoning"),d=()=>{const s=l();return s!==!1&&s.text===""},m=()=>{const s=l();return s!==!1&&s.text!==""&&s};return r(F,{fallback:null,get children(){return[r(o,{get when(){return y(i(),"text")},children:s=>r(ye,{part:"bubble content",get markdown(){return e.markdown},get class(){return e.isUser?"bg-muted max-w-[85%] rounded-2xl px-4 py-2":"bg-transparent p-0"},get children(){return s().text}})}),r(o,{get when(){return d()},children:null}),r(o,{get when(){return m()},children:s=>{const v=()=>e.reasoningMode??"full";return r(F,{fallback:null,get children(){return[r(o,{get when(){return v()==="full"},get children(){return r(G,{class:"mb-2 w-full",get isStreaming(){return e.isStreaming},get defaultOpen(){return e.reasoningDefaultOpen},get openOnStream(){return e.reasoningDefaultOpen},get children(){return[r(J,{get children(){return s().label??"Reasoning"}}),r(K,{markdown:!0,get children(){return s().text}})]}})}}),r(o,{get when(){return w(()=>v()==="compact")()&&e.isStreaming},get children(){return r(Q,{variant:"text-shimmer",get text(){return s().label??"Reasoning"},class:"mb-2"})}})]}})}}),r(o,{get when(){return y(i(),"tool")},children:s=>r(V,{get toolPart(){return s().tool},class:"mb-2 w-full"})}),r(o,{get when(){return y(i(),"card")},children:s=>r(ce,{get envelope(){return s().envelope},get types(){return e.cardTypes},get schemas(){return e.cardSchemas},get hostElement(){return e.cardHostElement}})})]}})}})]}})}),r(c,{get when(){var n;return(((n=e.actions)==null?void 0:n.length)??0)>0},get children(){return r(Fe,{get actions(){return e.actions},get reveal(){return e.actionsReveal==="hover"?"hover":"always"},get activeFeedback(){return e.activeFeedback},get copied(){return e.copied},onAction:n=>{var a;return(a=e.onAction)==null?void 0:a.call(e,n)}})}}),r(c,{get when(){return e.afterBody},get children(){return e.afterBody}})]}L(["click"]);export{Oe as M,we as a,xe as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{I as o}from"./Icon-BnFKqqtY.js";import{c as r,q as s}from"./define-CGGX-7Vg.js";var e=[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]],m=a=>r(o,s(a,{name:"MessageCircle",iconNode:e})),i=m;export{i as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{I as e}from"./Icon-BnFKqqtY.js";import{c as o,q as r}from"./define-CGGX-7Vg.js";var m=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]],s=a=>o(e,r(a,{name:"MessageSquare",iconNode:m})),i=s;export{i as m};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as i}from"./Icon-
|
|
1
|
+
import{I as i}from"./Icon-BnFKqqtY.js";import{c as n,q as y}from"./define-CGGX-7Vg.js";var o=[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]],a=e=>n(i,y(e,{name:"Maximize2",iconNode:o})),l=a,m=[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]],p=e=>n(i,y(e,{name:"Minimize2",iconNode:m})),x=p;export{l as a,x as m};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as y,c as n,
|
|
1
|
+
import{s as y,c as n,q as k,m as O,F as h,g as R,i as s,S as p,a as f,d as x,b as B,t as u,e as S}from"./define-CGGX-7Vg.js";import{c as v}from"./cn-DN5AWfiS.js";import{c as j,D as q,a as z,d as D}from"./dropdown-BwhViJFd.js";import{B as F}from"./button-BH6rN0U-.js";var $=u('<svg width=12 height=12 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><polyline points="6 9 12 15 18 9">'),A=u('<span class="text-caption text-muted-foreground">'),E=u('<div class="flex flex-col"><span>'),J=u("<div class=pl-2>"),P=u('<div><button type=button class="flex w-full items-center justify-between rounded-md px-2 py-1.5 text-body outline-none transition-colors hover:bg-muted focus:bg-muted">');const C=o=>(()=>{var e=$();return f(()=>x(e,"class",o.class)),e})();function b(o){const e=()=>o.model.description??o.model.provider,c=()=>o.model.id===o.currentModelId;return n(D,{get checked(){return c()},onSelect:()=>{o.onModelChange(o.model.id),o.onClose()},get children(){var d=E(),a=d.firstChild;return s(a,()=>o.model.name),s(d,n(p,{get when(){return e()},get children(){var i=A();return s(i,e),i}}),null),f(()=>B(a,v("text-body",c()&&"font-medium text-foreground"))),d}})}function _(o){const[e]=y(o,["models","currentModelId","onModelChange","class","defaultOpen","disabled","controllerRef"]),c=()=>e.models.find(r=>r.id===e.currentModelId);let d;const a=()=>d?.setOpen(!1),i=()=>e.models.filter(r=>!r.group),w=()=>{const r=[],t=new Map;for(const l of e.models)l.group&&(t.has(l.group)||(t.set(l.group,[]),r.push(l.group)),t.get(l.group).push(l));return r.map(l=>({name:l,models:t.get(l)}))};return n(p,{get when(){return e.models.length>1},get children(){return n(j,{get defaultOpen(){return e.defaultOpen},get disabled(){return e.disabled},controllerRef:r=>{var t;d=r,(t=e.controllerRef)==null||t.call(e,r)},get children(){return[n(q,{as:r=>n(F,k({variant:"ghost",size:"sm",get class(){return v("gap-1 text-meta text-muted-foreground",e.class)}},r,{get children(){return[O(()=>{var t;return((t=c())==null?void 0:t.name)??e.currentModelId}),n(C,{})]}}))}),n(z,{get children(){return[n(h,{get each(){return i()},children:r=>n(b,{model:r,get currentModelId(){return e.currentModelId},get onModelChange(){return e.onModelChange},onClose:a})}),n(h,{get each(){return w()},children:r=>{const[t,l]=R(!1);return(()=>{var m=P(),g=m.firstChild;return g.$$click=()=>l(!t()),s(g,()=>r.name,null),s(g,n(C,{get class(){return v("transition-transform",t()&&"rotate-180")}}),null),s(m,n(p,{get when(){return t()},get children(){var M=J();return s(M,n(h,{get each(){return r.models},children:I=>n(b,{model:I,get currentModelId(){return e.currentModelId},get onModelChange(){return e.onModelChange},onClose:a})})),M}}),null),f(()=>x(g,"aria-expanded",t())),m})()}})]}})]}})}})}S(["click"]);export{_ as M};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as qt,c as Xt,m as _t,D as jt,g as tt,k as ut,h as dt}from"./define-B_tXMYRm.js";const Yt=["top","right","bottom","left"],_=Math.min,$=Math.max,ot=Math.round,it=Math.floor,A=t=>({x:t,y:t}),Jt={left:"right",right:"left",bottom:"top",top:"bottom"};function mt(t,e,n){return $(t,_(e,n))}function j(t,e){return typeof t=="function"?t(e):t}function I(t){return t.split("-")[0]}function et(t){return t.split("-")[1]}function Et(t){return t==="x"?"y":"x"}function ht(t){return t==="y"?"height":"width"}function M(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function pt(t){return Et(M(t))}function Gt(t,e,n){n===void 0&&(n=!1);const o=et(t),i=pt(t),c=ht(i);let r=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[c]>e.floating[c]&&(r=rt(r)),[r,rt(r)]}function Kt(t){const e=rt(t);return[gt(t),e,gt(e)]}function gt(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Lt=["left","right"],Ot=["right","left"],Ut=["top","bottom"],Qt=["bottom","top"];function Zt(t,e,n){switch(t){case"top":case"bottom":return n?e?Ot:Lt:e?Lt:Ot;case"left":case"right":return e?Ut:Qt;default:return[]}}function te(t,e,n,o){const i=et(t);let c=Zt(I(t),n==="start",o);return i&&(c=c.map(r=>r+"-"+i),e&&(c=c.concat(c.map(gt)))),c}function rt(t){const e=I(t);return Jt[e]+t.slice(e.length)}function ee(t){return{top:0,right:0,bottom:0,left:0,...t}}function Tt(t){return typeof t!="number"?ee(t):{top:t,right:t,bottom:t,left:t}}function ct(t){const{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function Dt(t,e,n){let{reference:o,floating:i}=t;const c=M(e),r=pt(e),s=ht(r),a=I(e),l=c==="y",u=o.x+o.width/2-i.width/2,d=o.y+o.height/2-i.height/2,m=o[s]/2-i[s]/2;let f;switch(a){case"top":f={x:u,y:o.y-i.height};break;case"bottom":f={x:u,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:d};break;case"left":f={x:o.x-i.width,y:d};break;default:f={x:o.x,y:o.y}}switch(et(e)){case"start":f[r]-=m*(n&&l?-1:1);break;case"end":f[r]+=m*(n&&l?-1:1);break}return f}async function ne(t,e){var n;e===void 0&&(e={});const{x:o,y:i,platform:c,rects:r,elements:s,strategy:a}=t,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:m=!1,padding:f=0}=j(e,t),h=Tt(f),p=s[m?d==="floating"?"reference":"floating":d],y=ct(await c.getClippingRect({element:(n=await(c.isElement==null?void 0:c.isElement(p)))==null||n?p:p.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:a})),g=d==="floating"?{x:o,y:i,width:r.floating.width,height:r.floating.height}:r.reference,w=await(c.getOffsetParent==null?void 0:c.getOffsetParent(s.floating)),x=await(c.isElement==null?void 0:c.isElement(w))?await(c.getScale==null?void 0:c.getScale(w))||{x:1,y:1}:{x:1,y:1},v=ct(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:g,offsetParent:w,strategy:a}):g);return{top:(y.top-v.top+h.top)/x.y,bottom:(v.bottom-y.bottom+h.bottom)/x.y,left:(y.left-v.left+h.left)/x.x,right:(v.right-y.right+h.right)/x.x}}const oe=50,ie=async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:c=[],platform:r}=n,s=r.detectOverflow?r:{...r,detectOverflow:ne},a=await(r.isRTL==null?void 0:r.isRTL(e));let l=await r.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:d}=Dt(l,o,a),m=o,f=0;const h={};for(let p=0;p<c.length;p++){const y=c[p];if(!y)continue;const{name:g,fn:w}=y,{x,y:v,data:E,reset:b}=await w({x:u,y:d,initialPlacement:o,placement:m,strategy:i,middlewareData:h,rects:l,platform:s,elements:{reference:t,floating:e}});u=x??u,d=v??d,h[g]={...h[g],...E},b&&f<oe&&(f++,typeof b=="object"&&(b.placement&&(m=b.placement),b.rects&&(l=b.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:i}):b.rects),{x:u,y:d}=Dt(l,m,a)),p=-1)}return{x:u,y:d,placement:m,strategy:i,middlewareData:h}},re=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:i,rects:c,platform:r,elements:s,middlewareData:a}=e,{element:l,padding:u=0}=j(t,e)||{};if(l==null)return{};const d=Tt(u),m={x:n,y:o},f=pt(i),h=ht(f),p=await r.getDimensions(l),y=f==="y",g=y?"top":"left",w=y?"bottom":"right",x=y?"clientHeight":"clientWidth",v=c.reference[h]+c.reference[f]-m[f]-c.floating[h],E=m[f]-c.reference[f],b=await(r.getOffsetParent==null?void 0:r.getOffsetParent(l));let B=b?b[x]:0;(!B||!await(r.isElement==null?void 0:r.isElement(b)))&&(B=s.floating[x]||c.floating[h]);const U=v/2-E/2,N=B/2-p[h]/2-1,S=_(d[g],N),Q=_(d[w],N),V=S,Z=B-p[h]-Q,R=B/2-p[h]/2+U,z=mt(V,R,Z),k=!a.arrow&&et(i)!=null&&R!==z&&c.reference[h]/2-(R<V?S:Q)-p[h]/2<0,L=k?R<V?R-V:R-Z:0;return{[f]:m[f]+L,data:{[f]:z,centerOffset:R-z-L,...k&&{alignmentOffset:L}},reset:k}}}),ce=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:c,rects:r,initialPlacement:s,platform:a,elements:l}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:p=!0,...y}=j(t,e);if((n=c.arrow)!=null&&n.alignmentOffset)return{};const g=I(i),w=M(s),x=I(s)===s,v=await(a.isRTL==null?void 0:a.isRTL(l.floating)),E=m||(x||!p?[rt(s)]:Kt(s)),b=h!=="none";!m&&b&&E.push(...te(s,p,h,v));const B=[s,...E],U=await a.detectOverflow(e,y),N=[];let S=((o=c.flip)==null?void 0:o.overflows)||[];if(u&&N.push(U[g]),d){const R=Gt(i,r,v);N.push(U[R[0]],U[R[1]])}if(S=[...S,{placement:i,overflows:N}],!N.every(R=>R<=0)){var Q,V;const R=(((Q=c.flip)==null?void 0:Q.index)||0)+1,z=B[R];if(z&&(!(d==="alignment"&&w!==M(z))||S.every(L=>M(L.placement)===w?L.overflows[0]>0:!0)))return{data:{index:R,overflows:S},reset:{placement:z}};let k=(V=S.filter(L=>L.overflows[0]<=0).sort((L,P)=>L.overflows[1]-P.overflows[1])[0])==null?void 0:V.placement;if(!k)switch(f){case"bestFit":{var Z;const L=(Z=S.filter(P=>{if(b){const H=M(P.placement);return H===w||H==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(H=>H>0).reduce((H,It)=>H+It,0)]).sort((P,H)=>P[1]-H[1])[0])==null?void 0:Z[0];L&&(k=L);break}case"initialPlacement":k=s;break}if(i!==k)return{reset:{placement:k}}}return{}}}};function At(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Ct(t){return Yt.some(e=>t[e]>=0)}const se=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:o}=e,{strategy:i="referenceHidden",...c}=j(t,e);switch(i){case"referenceHidden":{const r=await o.detectOverflow(e,{...c,elementContext:"reference"}),s=At(r,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Ct(s)}}}case"escaped":{const r=await o.detectOverflow(e,{...c,altBoundary:!0}),s=At(r,n.floating);return{data:{escapedOffsets:s,escaped:Ct(s)}}}default:return{}}}}},le=new Set(["left","top"]);async function ae(t,e){const{placement:n,platform:o,elements:i}=t,c=await(o.isRTL==null?void 0:o.isRTL(i.floating)),r=I(n),s=et(n),a=M(n)==="y",l=le.has(r)?-1:1,u=c&&a?-1:1,d=j(e,t);let{mainAxis:m,crossAxis:f,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof h=="number"&&(f=s==="end"?h*-1:h),a?{x:f*u,y:m*l}:{x:m*l,y:f*u}}const fe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:i,y:c,placement:r,middlewareData:s}=e,a=await ae(e,t);return r===((n=s.offset)==null?void 0:n.placement)&&(o=s.arrow)!=null&&o.alignmentOffset?{}:{x:i+a.x,y:c+a.y,data:{...a,placement:r}}}}},ue=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i,platform:c}=e,{mainAxis:r=!0,crossAxis:s=!1,limiter:a={fn:g=>{let{x:w,y:x}=g;return{x:w,y:x}}},...l}=j(t,e),u={x:n,y:o},d=await c.detectOverflow(e,l),m=M(I(i)),f=Et(m);let h=u[f],p=u[m];if(r){const g=f==="y"?"top":"left",w=f==="y"?"bottom":"right",x=h+d[g],v=h-d[w];h=mt(x,h,v)}if(s){const g=m==="y"?"top":"left",w=m==="y"?"bottom":"right",x=p+d[g],v=p-d[w];p=mt(x,p,v)}const y=a.fn({...e,[f]:h,[m]:p});return{...y,data:{x:y.x-n,y:y.y-o,enabled:{[f]:r,[m]:s}}}}}};function st(){return typeof window<"u"}function Y(t){return St(t)?(t.nodeName||"").toLowerCase():"#document"}function O(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function C(t){var e;return(e=(St(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function St(t){return st()?t instanceof Node||t instanceof O(t).Node:!1}function T(t){return st()?t instanceof Element||t instanceof O(t).Element:!1}function F(t){return st()?t instanceof HTMLElement||t instanceof O(t).HTMLElement:!1}function kt(t){return!st()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof O(t).ShadowRoot}function nt(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=D(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&i!=="inline"&&i!=="contents"}function de(t){return/^(table|td|th)$/.test(Y(t))}function lt(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const me=/transform|translate|scale|rotate|perspective|filter/,he=/paint|layout|strict|content/,q=t=>!!t&&t!=="none";let yt;function wt(t){const e=T(t)?D(t):t;return q(e.transform)||q(e.translate)||q(e.scale)||q(e.rotate)||q(e.perspective)||!xt()&&(q(e.backdropFilter)||q(e.filter))||me.test(e.willChange||"")||he.test(e.contain||"")}function pe(t){let e=W(t);for(;F(e)&&!J(e);){if(wt(e))return e;if(lt(e))return null;e=W(e)}return null}function xt(){return yt==null&&(yt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),yt}function J(t){return/^(html|body|#document)$/.test(Y(t))}function D(t){return O(t).getComputedStyle(t)}function at(t){return T(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function W(t){if(Y(t)==="html")return t;const e=t.assignedSlot||t.parentNode||kt(t)&&t.host||C(t);return kt(e)?e.host:e}function Ft(t){const e=W(t);return J(e)?t.ownerDocument?t.ownerDocument.body:t.body:F(e)&&nt(e)?e:Ft(e)}function G(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=Ft(t),c=i===((o=t.ownerDocument)==null?void 0:o.body),r=O(i);if(c){const s=vt(r);return e.concat(r,r.visualViewport||[],nt(i)?i:[],s&&n?G(s):[])}else return e.concat(i,G(i,[],n))}function vt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Pt(t){const e=D(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=F(t),c=i?t.offsetWidth:n,r=i?t.offsetHeight:o,s=ot(n)!==c||ot(o)!==r;return s&&(n=c,o=r),{width:n,height:o,$:s}}function bt(t){return T(t)?t:t.contextElement}function K(t){const e=bt(t);if(!F(e))return A(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:c}=Pt(e);let r=(c?ot(n.width):n.width)/o,s=(c?ot(n.height):n.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!s||!Number.isFinite(s))&&(s=1),{x:r,y:s}}const ge=A(0);function Ht(t){const e=O(t);return!xt()||!e.visualViewport?ge:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function ye(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==O(t)?!1:e}function X(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),c=bt(t);let r=A(1);e&&(o?T(o)&&(r=K(o)):r=K(t));const s=ye(c,n,o)?Ht(c):A(0);let a=(i.left+s.x)/r.x,l=(i.top+s.y)/r.y,u=i.width/r.x,d=i.height/r.y;if(c){const m=O(c),f=o&&T(o)?O(o):o;let h=m,p=vt(h);for(;p&&o&&f!==h;){const y=K(p),g=p.getBoundingClientRect(),w=D(p),x=g.left+(p.clientLeft+parseFloat(w.paddingLeft))*y.x,v=g.top+(p.clientTop+parseFloat(w.paddingTop))*y.y;a*=y.x,l*=y.y,u*=y.x,d*=y.y,a+=x,l+=v,h=O(p),p=vt(h)}}return ct({width:u,height:d,x:a,y:l})}function ft(t,e){const n=at(t).scrollLeft;return e?e.left+n:X(C(t)).left+n}function Mt(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-ft(t,n),i=n.top+e.scrollTop;return{x:o,y:i}}function we(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const c=i==="fixed",r=C(o),s=e?lt(e.floating):!1;if(o===r||s&&c)return n;let a={scrollLeft:0,scrollTop:0},l=A(1);const u=A(0),d=F(o);if((d||!d&&!c)&&((Y(o)!=="body"||nt(r))&&(a=at(o)),d)){const f=X(o);l=K(o),u.x=f.x+o.clientLeft,u.y=f.y+o.clientTop}const m=r&&!d&&!c?Mt(r,a):A(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-a.scrollLeft*l.x+u.x+m.x,y:n.y*l.y-a.scrollTop*l.y+u.y+m.y}}function xe(t){return Array.from(t.getClientRects())}function ve(t){const e=C(t),n=at(t),o=t.ownerDocument.body,i=$(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),c=$(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+ft(t);const s=-n.scrollTop;return D(o).direction==="rtl"&&(r+=$(e.clientWidth,o.clientWidth)-i),{width:i,height:c,x:r,y:s}}const Wt=25;function be(t,e){const n=O(t),o=C(t),i=n.visualViewport;let c=o.clientWidth,r=o.clientHeight,s=0,a=0;if(i){c=i.width,r=i.height;const u=xt();(!u||u&&e==="fixed")&&(s=i.offsetLeft,a=i.offsetTop)}const l=ft(o);if(l<=0){const u=o.ownerDocument,d=u.body,m=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,h=Math.abs(o.clientWidth-d.clientWidth-f);h<=Wt&&(c-=h)}else l<=Wt&&(c+=l);return{width:c,height:r,x:s,y:a}}function Re(t,e){const n=X(t,!0,e==="fixed"),o=n.top+t.clientTop,i=n.left+t.clientLeft,c=F(t)?K(t):A(1),r=t.clientWidth*c.x,s=t.clientHeight*c.y,a=i*c.x,l=o*c.y;return{width:r,height:s,x:a,y:l}}function Bt(t,e,n){let o;if(e==="viewport")o=be(t,n);else if(e==="document")o=ve(C(t));else if(T(e))o=Re(e,n);else{const i=Ht(t);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return ct(o)}function Nt(t,e){const n=W(t);return n===e||!T(n)||J(n)?!1:D(n).position==="fixed"||Nt(n,e)}function Ee(t,e){const n=e.get(t);if(n)return n;let o=G(t,[],!1).filter(s=>T(s)&&Y(s)!=="body"),i=null;const c=D(t).position==="fixed";let r=c?W(t):t;for(;T(r)&&!J(r);){const s=D(r),a=wt(r);!a&&s.position==="fixed"&&(i=null),(c?!a&&!i:!a&&s.position==="static"&&i&&(i.position==="absolute"||i.position==="fixed")||nt(r)&&!a&&Nt(t,r))?o=o.filter(l=>l!==r):i=s,r=W(r)}return e.set(t,o),o}function Le(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const c=[...n==="clippingAncestors"?lt(e)?[]:Ee(e,this._c):[].concat(n),o],r=Bt(e,c[0],i);let s=r.top,a=r.right,l=r.bottom,u=r.left;for(let d=1;d<c.length;d++){const m=Bt(e,c[d],i);s=$(m.top,s),a=_(m.right,a),l=_(m.bottom,l),u=$(m.left,u)}return{width:a-u,height:l-s,x:u,y:s}}function Oe(t){const{width:e,height:n}=Pt(t);return{width:e,height:n}}function Te(t,e,n){const o=F(e),i=C(e),c=n==="fixed",r=X(t,!0,c,e);let s={scrollLeft:0,scrollTop:0};const a=A(0);function l(){a.x=ft(i)}if(o||!o&&!c)if((Y(e)!=="body"||nt(i))&&(s=at(e)),o){const f=X(e,!0,c,e);a.x=f.x+e.clientLeft,a.y=f.y+e.clientTop}else i&&l();c&&!o&&i&&l();const u=i&&!o&&!c?Mt(i,s):A(0),d=r.left+s.scrollLeft-a.x-u.x,m=r.top+s.scrollTop-a.y-u.y;return{x:d,y:m,width:r.width,height:r.height}}function Rt(t){return D(t).position==="static"}function Vt(t,e){if(!F(t)||D(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return C(t)===n&&(n=n.ownerDocument.body),n}function zt(t,e){const n=O(t);if(lt(t))return n;if(!F(t)){let i=W(t);for(;i&&!J(i);){if(T(i)&&!Rt(i))return i;i=W(i)}return n}let o=Vt(t,e);for(;o&&de(o)&&Rt(o);)o=Vt(o,e);return o&&J(o)&&Rt(o)&&!wt(o)?n:o||pe(t)||n}const De=async function(t){const e=this.getOffsetParent||zt,n=this.getDimensions,o=await n(t.floating);return{reference:Te(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Ae(t){return D(t).direction==="rtl"}const Ce={convertOffsetParentRelativeRectToViewportRelativeRect:we,getDocumentElement:C,getClippingRect:Le,getOffsetParent:zt,getElementRects:De,getClientRects:xe,getDimensions:Oe,getScale:K,isElement:T,isRTL:Ae};function $t(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Se(t,e){let n=null,o;const i=C(t);function c(){var s;clearTimeout(o),(s=n)==null||s.disconnect(),n=null}function r(s,a){s===void 0&&(s=!1),a===void 0&&(a=1),c();const l=t.getBoundingClientRect(),{left:u,top:d,width:m,height:f}=l;if(s||e(),!m||!f)return;const h=it(d),p=it(i.clientWidth-(u+m)),y=it(i.clientHeight-(d+f)),g=it(u),w={rootMargin:-h+"px "+-p+"px "+-y+"px "+-g+"px",threshold:$(0,_(1,a))||1};let x=!0;function v(E){const b=E[0].intersectionRatio;if(b!==a){if(!x)return r();b?r(!1,b):o=setTimeout(()=>{r(!1,1e-7)},1e3)}b===1&&!$t(l,t.getBoundingClientRect())&&r(),x=!1}try{n=new IntersectionObserver(v,{...w,root:i.ownerDocument})}catch{n=new IntersectionObserver(v,w)}n.observe(t)}return r(!0),c}function ke(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:c=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,l=bt(t),u=i||c?[...l?G(l):[],...e?G(e):[]]:[];u.forEach(g=>{i&&g.addEventListener("scroll",n,{passive:!0}),c&&g.addEventListener("resize",n)});const d=l&&s?Se(l,n):null;let m=-1,f=null;r&&(f=new ResizeObserver(g=>{let[w]=g;w&&w.target===l&&f&&e&&(f.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=f)==null||x.observe(e)})),n()}),l&&!a&&f.observe(l),e&&f.observe(e));let h,p=a?X(t):null;a&&y();function y(){const g=X(t);p&&!$t(p,g)&&n(),p=g,h=requestAnimationFrame(y)}return n(),()=>{var g;u.forEach(w=>{i&&w.removeEventListener("scroll",n),c&&w.removeEventListener("resize",n)}),d?.(),(g=f)==null||g.disconnect(),f=null,a&&cancelAnimationFrame(h)}}const Fe=fe,Pe=ue,He=ce,Me=se,We=re,Be=(t,e,n)=>{const o=new Map,i={platform:Ce,...n},c={...i.platform,_c:o};return ie(t,e,{...i,platform:c})};function Ne(t){const[e,n]=tt(t()),[o,i]=tt(t()?"open":"closed");let c,r=0;const s=a=>{c=a};return ut(a=>{const l=t();if(l)r++,n(!0),i("open");else if(a){i("closed");const u=c,d=u&&(()=>{const h=getComputedStyle(u);return h.animationName!=="none"&&parseFloat(h.animationDuration||"0")>0})();if(!u||!d){const h=++r;return queueMicrotask(()=>{h===r&&n(!1)}),l}const m=u,f=h=>{h.target===m&&(m.removeEventListener("animationend",f),n(!1))};m.addEventListener("animationend",f),dt(()=>m.removeEventListener("animationend",f))}return l}),{present:e,state:o,setRef:s}}function Ve(t){const[e,n]=qt(t,["as"]);return typeof e.as=="function"?e.as(n):Xt(jt,_t({get component(){return e.as??"span"}},n))}function ze(t){let e=t;for(;e;){if(e instanceof Element&&e.closest("[inert]"))return!0;const n=e.getRootNode();e=n instanceof ShadowRoot?n.host:null}return!1}function $e(t,e){if(typeof MutationObserver!="function")return()=>{};let n=!1;const o=()=>t.isConnected&&!ze(t);let i=o();const c=()=>{if(!n){if(o()){i=!0;return}i&&(n=!0,r.disconnect(),e())}},r=new MutationObserver(c),s=new Set;typeof document<"u"&&s.add(document);const a=t.getRootNode();a&&s.add(a);for(const l of s)try{r.observe(l,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["inert"]})}catch{}return()=>r.disconnect()}function Ie(t,e,n={}){const[o,i]=tt({x:0,y:0,placement:n.placement??"bottom"}),[c,r]=tt({}),[s,a]=tt(!1);return ut(()=>{const l=t(),u=e();if(!l||!u)return;const d=()=>{var p;const y=[Fe(n.gutter??8),He(),Pe({padding:8})],g=(p=n.arrowEl)==null?void 0:p.call(n);g&&y.push(We({element:g})),y.push(Me()),Be(l,u,{placement:n.placement??"bottom",strategy:"fixed",middleware:y}).then(({x:w,y:x,placement:v,middlewareData:E})=>{var b;i({x:w,y:x,placement:v}),E.arrow&&r({x:E.arrow.x,y:E.arrow.y}),a(!!((b=E.hide)!=null&&b.referenceHidden))})},m=ke(l,u,d);let f;if(typeof ResizeObserver=="function"&&l instanceof Element){f=new ResizeObserver(d),f.observe(l);for(const p of G(l))p instanceof Element&&f.observe(p)}const h=n.onDisconnect?$e(l,n.onDisconnect):void 0;dt(()=>{m(),f?.disconnect(),h?.()})}),{pos:o,arrowPos:c,hidden:s}}function qe(t){ut(()=>{if(!t.enabled())return;const e=i=>{i.key==="Escape"&&t.onDismiss("escape")},n=i=>{const c=i.target;t.refs().some(r=>r&&r.contains(c))||t.onDismiss("outside")},o=document;o.addEventListener("keydown",e),o.addEventListener("pointerdown",n,!0),dt(()=>{o.removeEventListener("keydown",e),o.removeEventListener("pointerdown",n,!0)})})}export{Ve as A,qe as a,Ne as c,Ie as u};
|
|
1
|
+
import{s as It,c as jt,q as Xt,D as _t,g as tt,j as ut,h as dt}from"./define-CGGX-7Vg.js";const Yt=["top","right","bottom","left"],X=Math.min,$=Math.max,ot=Math.round,it=Math.floor,A=t=>({x:t,y:t}),Jt={left:"right",right:"left",bottom:"top",top:"bottom"};function mt(t,e,n){return $(t,X(e,n))}function _(t,e){return typeof t=="function"?t(e):t}function q(t){return t.split("-")[0]}function et(t){return t.split("-")[1]}function Et(t){return t==="x"?"y":"x"}function ht(t){return t==="y"?"height":"width"}function M(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function pt(t){return Et(M(t))}function Gt(t,e,n){n===void 0&&(n=!1);const o=et(t),i=pt(t),c=ht(i);let r=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[c]>e.floating[c]&&(r=rt(r)),[r,rt(r)]}function Kt(t){const e=rt(t);return[gt(t),e,gt(e)]}function gt(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Lt=["left","right"],Ot=["right","left"],Ut=["top","bottom"],Qt=["bottom","top"];function Zt(t,e,n){switch(t){case"top":case"bottom":return n?e?Ot:Lt:e?Lt:Ot;case"left":case"right":return e?Ut:Qt;default:return[]}}function te(t,e,n,o){const i=et(t);let c=Zt(q(t),n==="start",o);return i&&(c=c.map(r=>r+"-"+i),e&&(c=c.concat(c.map(gt)))),c}function rt(t){const e=q(t);return Jt[e]+t.slice(e.length)}function ee(t){return{top:0,right:0,bottom:0,left:0,...t}}function Tt(t){return typeof t!="number"?ee(t):{top:t,right:t,bottom:t,left:t}}function ct(t){const{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function Dt(t,e,n){let{reference:o,floating:i}=t;const c=M(e),r=pt(e),s=ht(r),a=q(e),l=c==="y",u=o.x+o.width/2-i.width/2,d=o.y+o.height/2-i.height/2,m=o[s]/2-i[s]/2;let f;switch(a){case"top":f={x:u,y:o.y-i.height};break;case"bottom":f={x:u,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:d};break;case"left":f={x:o.x-i.width,y:d};break;default:f={x:o.x,y:o.y}}switch(et(e)){case"start":f[r]-=m*(n&&l?-1:1);break;case"end":f[r]+=m*(n&&l?-1:1);break}return f}async function ne(t,e){var n;e===void 0&&(e={});const{x:o,y:i,platform:c,rects:r,elements:s,strategy:a}=t,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:m=!1,padding:f=0}=_(e,t),h=Tt(f),p=s[m?d==="floating"?"reference":"floating":d],y=ct(await c.getClippingRect({element:(n=await(c.isElement==null?void 0:c.isElement(p)))==null||n?p:p.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:a})),g=d==="floating"?{x:o,y:i,width:r.floating.width,height:r.floating.height}:r.reference,w=await(c.getOffsetParent==null?void 0:c.getOffsetParent(s.floating)),x=await(c.isElement==null?void 0:c.isElement(w))?await(c.getScale==null?void 0:c.getScale(w))||{x:1,y:1}:{x:1,y:1},v=ct(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:g,offsetParent:w,strategy:a}):g);return{top:(y.top-v.top+h.top)/x.y,bottom:(v.bottom-y.bottom+h.bottom)/x.y,left:(y.left-v.left+h.left)/x.x,right:(v.right-y.right+h.right)/x.x}}const oe=50,ie=async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:c=[],platform:r}=n,s=r.detectOverflow?r:{...r,detectOverflow:ne},a=await(r.isRTL==null?void 0:r.isRTL(e));let l=await r.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:d}=Dt(l,o,a),m=o,f=0;const h={};for(let p=0;p<c.length;p++){const y=c[p];if(!y)continue;const{name:g,fn:w}=y,{x,y:v,data:E,reset:b}=await w({x:u,y:d,initialPlacement:o,placement:m,strategy:i,middlewareData:h,rects:l,platform:s,elements:{reference:t,floating:e}});u=x??u,d=v??d,h[g]={...h[g],...E},b&&f<oe&&(f++,typeof b=="object"&&(b.placement&&(m=b.placement),b.rects&&(l=b.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:i}):b.rects),{x:u,y:d}=Dt(l,m,a)),p=-1)}return{x:u,y:d,placement:m,strategy:i,middlewareData:h}},re=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:i,rects:c,platform:r,elements:s,middlewareData:a}=e,{element:l,padding:u=0}=_(t,e)||{};if(l==null)return{};const d=Tt(u),m={x:n,y:o},f=pt(i),h=ht(f),p=await r.getDimensions(l),y=f==="y",g=y?"top":"left",w=y?"bottom":"right",x=y?"clientHeight":"clientWidth",v=c.reference[h]+c.reference[f]-m[f]-c.floating[h],E=m[f]-c.reference[f],b=await(r.getOffsetParent==null?void 0:r.getOffsetParent(l));let B=b?b[x]:0;(!B||!await(r.isElement==null?void 0:r.isElement(b)))&&(B=s.floating[x]||c.floating[h]);const U=v/2-E/2,N=B/2-p[h]/2-1,S=X(d[g],N),Q=X(d[w],N),V=S,Z=B-p[h]-Q,R=B/2-p[h]/2+U,z=mt(V,R,Z),k=!a.arrow&&et(i)!=null&&R!==z&&c.reference[h]/2-(R<V?S:Q)-p[h]/2<0,L=k?R<V?R-V:R-Z:0;return{[f]:m[f]+L,data:{[f]:z,centerOffset:R-z-L,...k&&{alignmentOffset:L}},reset:k}}}),ce=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:c,rects:r,initialPlacement:s,platform:a,elements:l}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:p=!0,...y}=_(t,e);if((n=c.arrow)!=null&&n.alignmentOffset)return{};const g=q(i),w=M(s),x=q(s)===s,v=await(a.isRTL==null?void 0:a.isRTL(l.floating)),E=m||(x||!p?[rt(s)]:Kt(s)),b=h!=="none";!m&&b&&E.push(...te(s,p,h,v));const B=[s,...E],U=await a.detectOverflow(e,y),N=[];let S=((o=c.flip)==null?void 0:o.overflows)||[];if(u&&N.push(U[g]),d){const R=Gt(i,r,v);N.push(U[R[0]],U[R[1]])}if(S=[...S,{placement:i,overflows:N}],!N.every(R=>R<=0)){var Q,V;const R=(((Q=c.flip)==null?void 0:Q.index)||0)+1,z=B[R];if(z&&(!(d==="alignment"&&w!==M(z))||S.every(L=>M(L.placement)===w?L.overflows[0]>0:!0)))return{data:{index:R,overflows:S},reset:{placement:z}};let k=(V=S.filter(L=>L.overflows[0]<=0).sort((L,P)=>L.overflows[1]-P.overflows[1])[0])==null?void 0:V.placement;if(!k)switch(f){case"bestFit":{var Z;const L=(Z=S.filter(P=>{if(b){const H=M(P.placement);return H===w||H==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(H=>H>0).reduce((H,qt)=>H+qt,0)]).sort((P,H)=>P[1]-H[1])[0])==null?void 0:Z[0];L&&(k=L);break}case"initialPlacement":k=s;break}if(i!==k)return{reset:{placement:k}}}return{}}}};function At(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Ct(t){return Yt.some(e=>t[e]>=0)}const se=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:o}=e,{strategy:i="referenceHidden",...c}=_(t,e);switch(i){case"referenceHidden":{const r=await o.detectOverflow(e,{...c,elementContext:"reference"}),s=At(r,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Ct(s)}}}case"escaped":{const r=await o.detectOverflow(e,{...c,altBoundary:!0}),s=At(r,n.floating);return{data:{escapedOffsets:s,escaped:Ct(s)}}}default:return{}}}}},le=new Set(["left","top"]);async function ae(t,e){const{placement:n,platform:o,elements:i}=t,c=await(o.isRTL==null?void 0:o.isRTL(i.floating)),r=q(n),s=et(n),a=M(n)==="y",l=le.has(r)?-1:1,u=c&&a?-1:1,d=_(e,t);let{mainAxis:m,crossAxis:f,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof h=="number"&&(f=s==="end"?h*-1:h),a?{x:f*u,y:m*l}:{x:m*l,y:f*u}}const fe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:i,y:c,placement:r,middlewareData:s}=e,a=await ae(e,t);return r===((n=s.offset)==null?void 0:n.placement)&&(o=s.arrow)!=null&&o.alignmentOffset?{}:{x:i+a.x,y:c+a.y,data:{...a,placement:r}}}}},ue=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i,platform:c}=e,{mainAxis:r=!0,crossAxis:s=!1,limiter:a={fn:g=>{let{x:w,y:x}=g;return{x:w,y:x}}},...l}=_(t,e),u={x:n,y:o},d=await c.detectOverflow(e,l),m=M(q(i)),f=Et(m);let h=u[f],p=u[m];if(r){const g=f==="y"?"top":"left",w=f==="y"?"bottom":"right",x=h+d[g],v=h-d[w];h=mt(x,h,v)}if(s){const g=m==="y"?"top":"left",w=m==="y"?"bottom":"right",x=p+d[g],v=p-d[w];p=mt(x,p,v)}const y=a.fn({...e,[f]:h,[m]:p});return{...y,data:{x:y.x-n,y:y.y-o,enabled:{[f]:r,[m]:s}}}}}};function st(){return typeof window<"u"}function Y(t){return St(t)?(t.nodeName||"").toLowerCase():"#document"}function O(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function C(t){var e;return(e=(St(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function St(t){return st()?t instanceof Node||t instanceof O(t).Node:!1}function T(t){return st()?t instanceof Element||t instanceof O(t).Element:!1}function F(t){return st()?t instanceof HTMLElement||t instanceof O(t).HTMLElement:!1}function kt(t){return!st()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof O(t).ShadowRoot}function nt(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=D(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&i!=="inline"&&i!=="contents"}function de(t){return/^(table|td|th)$/.test(Y(t))}function lt(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const me=/transform|translate|scale|rotate|perspective|filter/,he=/paint|layout|strict|content/,I=t=>!!t&&t!=="none";let yt;function wt(t){const e=T(t)?D(t):t;return I(e.transform)||I(e.translate)||I(e.scale)||I(e.rotate)||I(e.perspective)||!xt()&&(I(e.backdropFilter)||I(e.filter))||me.test(e.willChange||"")||he.test(e.contain||"")}function pe(t){let e=W(t);for(;F(e)&&!J(e);){if(wt(e))return e;if(lt(e))return null;e=W(e)}return null}function xt(){return yt==null&&(yt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),yt}function J(t){return/^(html|body|#document)$/.test(Y(t))}function D(t){return O(t).getComputedStyle(t)}function at(t){return T(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function W(t){if(Y(t)==="html")return t;const e=t.assignedSlot||t.parentNode||kt(t)&&t.host||C(t);return kt(e)?e.host:e}function Ft(t){const e=W(t);return J(e)?t.ownerDocument?t.ownerDocument.body:t.body:F(e)&&nt(e)?e:Ft(e)}function G(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=Ft(t),c=i===((o=t.ownerDocument)==null?void 0:o.body),r=O(i);if(c){const s=vt(r);return e.concat(r,r.visualViewport||[],nt(i)?i:[],s&&n?G(s):[])}else return e.concat(i,G(i,[],n))}function vt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Pt(t){const e=D(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=F(t),c=i?t.offsetWidth:n,r=i?t.offsetHeight:o,s=ot(n)!==c||ot(o)!==r;return s&&(n=c,o=r),{width:n,height:o,$:s}}function bt(t){return T(t)?t:t.contextElement}function K(t){const e=bt(t);if(!F(e))return A(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:c}=Pt(e);let r=(c?ot(n.width):n.width)/o,s=(c?ot(n.height):n.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!s||!Number.isFinite(s))&&(s=1),{x:r,y:s}}const ge=A(0);function Ht(t){const e=O(t);return!xt()||!e.visualViewport?ge:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function ye(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==O(t)?!1:e}function j(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),c=bt(t);let r=A(1);e&&(o?T(o)&&(r=K(o)):r=K(t));const s=ye(c,n,o)?Ht(c):A(0);let a=(i.left+s.x)/r.x,l=(i.top+s.y)/r.y,u=i.width/r.x,d=i.height/r.y;if(c){const m=O(c),f=o&&T(o)?O(o):o;let h=m,p=vt(h);for(;p&&o&&f!==h;){const y=K(p),g=p.getBoundingClientRect(),w=D(p),x=g.left+(p.clientLeft+parseFloat(w.paddingLeft))*y.x,v=g.top+(p.clientTop+parseFloat(w.paddingTop))*y.y;a*=y.x,l*=y.y,u*=y.x,d*=y.y,a+=x,l+=v,h=O(p),p=vt(h)}}return ct({width:u,height:d,x:a,y:l})}function ft(t,e){const n=at(t).scrollLeft;return e?e.left+n:j(C(t)).left+n}function Mt(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-ft(t,n),i=n.top+e.scrollTop;return{x:o,y:i}}function we(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const c=i==="fixed",r=C(o),s=e?lt(e.floating):!1;if(o===r||s&&c)return n;let a={scrollLeft:0,scrollTop:0},l=A(1);const u=A(0),d=F(o);if((d||!d&&!c)&&((Y(o)!=="body"||nt(r))&&(a=at(o)),d)){const f=j(o);l=K(o),u.x=f.x+o.clientLeft,u.y=f.y+o.clientTop}const m=r&&!d&&!c?Mt(r,a):A(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-a.scrollLeft*l.x+u.x+m.x,y:n.y*l.y-a.scrollTop*l.y+u.y+m.y}}function xe(t){return Array.from(t.getClientRects())}function ve(t){const e=C(t),n=at(t),o=t.ownerDocument.body,i=$(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),c=$(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+ft(t);const s=-n.scrollTop;return D(o).direction==="rtl"&&(r+=$(e.clientWidth,o.clientWidth)-i),{width:i,height:c,x:r,y:s}}const Wt=25;function be(t,e){const n=O(t),o=C(t),i=n.visualViewport;let c=o.clientWidth,r=o.clientHeight,s=0,a=0;if(i){c=i.width,r=i.height;const u=xt();(!u||u&&e==="fixed")&&(s=i.offsetLeft,a=i.offsetTop)}const l=ft(o);if(l<=0){const u=o.ownerDocument,d=u.body,m=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,h=Math.abs(o.clientWidth-d.clientWidth-f);h<=Wt&&(c-=h)}else l<=Wt&&(c+=l);return{width:c,height:r,x:s,y:a}}function Re(t,e){const n=j(t,!0,e==="fixed"),o=n.top+t.clientTop,i=n.left+t.clientLeft,c=F(t)?K(t):A(1),r=t.clientWidth*c.x,s=t.clientHeight*c.y,a=i*c.x,l=o*c.y;return{width:r,height:s,x:a,y:l}}function Bt(t,e,n){let o;if(e==="viewport")o=be(t,n);else if(e==="document")o=ve(C(t));else if(T(e))o=Re(e,n);else{const i=Ht(t);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return ct(o)}function Nt(t,e){const n=W(t);return n===e||!T(n)||J(n)?!1:D(n).position==="fixed"||Nt(n,e)}function Ee(t,e){const n=e.get(t);if(n)return n;let o=G(t,[],!1).filter(s=>T(s)&&Y(s)!=="body"),i=null;const c=D(t).position==="fixed";let r=c?W(t):t;for(;T(r)&&!J(r);){const s=D(r),a=wt(r);!a&&s.position==="fixed"&&(i=null),(c?!a&&!i:!a&&s.position==="static"&&i&&(i.position==="absolute"||i.position==="fixed")||nt(r)&&!a&&Nt(t,r))?o=o.filter(l=>l!==r):i=s,r=W(r)}return e.set(t,o),o}function Le(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const c=[...n==="clippingAncestors"?lt(e)?[]:Ee(e,this._c):[].concat(n),o],r=Bt(e,c[0],i);let s=r.top,a=r.right,l=r.bottom,u=r.left;for(let d=1;d<c.length;d++){const m=Bt(e,c[d],i);s=$(m.top,s),a=X(m.right,a),l=X(m.bottom,l),u=$(m.left,u)}return{width:a-u,height:l-s,x:u,y:s}}function Oe(t){const{width:e,height:n}=Pt(t);return{width:e,height:n}}function Te(t,e,n){const o=F(e),i=C(e),c=n==="fixed",r=j(t,!0,c,e);let s={scrollLeft:0,scrollTop:0};const a=A(0);function l(){a.x=ft(i)}if(o||!o&&!c)if((Y(e)!=="body"||nt(i))&&(s=at(e)),o){const f=j(e,!0,c,e);a.x=f.x+e.clientLeft,a.y=f.y+e.clientTop}else i&&l();c&&!o&&i&&l();const u=i&&!o&&!c?Mt(i,s):A(0),d=r.left+s.scrollLeft-a.x-u.x,m=r.top+s.scrollTop-a.y-u.y;return{x:d,y:m,width:r.width,height:r.height}}function Rt(t){return D(t).position==="static"}function Vt(t,e){if(!F(t)||D(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return C(t)===n&&(n=n.ownerDocument.body),n}function zt(t,e){const n=O(t);if(lt(t))return n;if(!F(t)){let i=W(t);for(;i&&!J(i);){if(T(i)&&!Rt(i))return i;i=W(i)}return n}let o=Vt(t,e);for(;o&&de(o)&&Rt(o);)o=Vt(o,e);return o&&J(o)&&Rt(o)&&!wt(o)?n:o||pe(t)||n}const De=async function(t){const e=this.getOffsetParent||zt,n=this.getDimensions,o=await n(t.floating);return{reference:Te(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Ae(t){return D(t).direction==="rtl"}const Ce={convertOffsetParentRelativeRectToViewportRelativeRect:we,getDocumentElement:C,getClippingRect:Le,getOffsetParent:zt,getElementRects:De,getClientRects:xe,getDimensions:Oe,getScale:K,isElement:T,isRTL:Ae};function $t(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Se(t,e){let n=null,o;const i=C(t);function c(){var s;clearTimeout(o),(s=n)==null||s.disconnect(),n=null}function r(s,a){s===void 0&&(s=!1),a===void 0&&(a=1),c();const l=t.getBoundingClientRect(),{left:u,top:d,width:m,height:f}=l;if(s||e(),!m||!f)return;const h=it(d),p=it(i.clientWidth-(u+m)),y=it(i.clientHeight-(d+f)),g=it(u),w={rootMargin:-h+"px "+-p+"px "+-y+"px "+-g+"px",threshold:$(0,X(1,a))||1};let x=!0;function v(E){const b=E[0].intersectionRatio;if(b!==a){if(!x)return r();b?r(!1,b):o=setTimeout(()=>{r(!1,1e-7)},1e3)}b===1&&!$t(l,t.getBoundingClientRect())&&r(),x=!1}try{n=new IntersectionObserver(v,{...w,root:i.ownerDocument})}catch{n=new IntersectionObserver(v,w)}n.observe(t)}return r(!0),c}function ke(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:c=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,l=bt(t),u=i||c?[...l?G(l):[],...e?G(e):[]]:[];u.forEach(g=>{i&&g.addEventListener("scroll",n,{passive:!0}),c&&g.addEventListener("resize",n)});const d=l&&s?Se(l,n):null;let m=-1,f=null;r&&(f=new ResizeObserver(g=>{let[w]=g;w&&w.target===l&&f&&e&&(f.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=f)==null||x.observe(e)})),n()}),l&&!a&&f.observe(l),e&&f.observe(e));let h,p=a?j(t):null;a&&y();function y(){const g=j(t);p&&!$t(p,g)&&n(),p=g,h=requestAnimationFrame(y)}return n(),()=>{var g;u.forEach(w=>{i&&w.removeEventListener("scroll",n),c&&w.removeEventListener("resize",n)}),d?.(),(g=f)==null||g.disconnect(),f=null,a&&cancelAnimationFrame(h)}}const Fe=fe,Pe=ue,He=ce,Me=se,We=re,Be=(t,e,n)=>{const o=new Map,i={platform:Ce,...n},c={...i.platform,_c:o};return ie(t,e,{...i,platform:c})};function Ne(t){const[e,n]=tt(t()),[o,i]=tt(t()?"open":"closed");let c,r=0;const s=a=>{c=a};return ut(a=>{const l=t();if(l)r++,n(!0),i("open");else if(a){i("closed");const u=c,d=u&&(()=>{const h=getComputedStyle(u);return h.animationName!=="none"&&parseFloat(h.animationDuration||"0")>0})();if(!u||!d){const h=++r;return queueMicrotask(()=>{h===r&&n(!1)}),l}const m=u,f=h=>{h.target===m&&(m.removeEventListener("animationend",f),n(!1))};m.addEventListener("animationend",f),dt(()=>m.removeEventListener("animationend",f))}return l}),{present:e,state:o,setRef:s}}function Ve(t){const[e,n]=It(t,["as"]);return typeof e.as=="function"?e.as(n):jt(_t,Xt({get component(){return e.as??"span"}},n))}function ze(t){let e=t;for(;e;){if(e instanceof Element&&e.closest("[inert]"))return!0;const n=e.getRootNode();e=n instanceof ShadowRoot?n.host:null}return!1}function $e(t,e){if(typeof MutationObserver!="function")return()=>{};let n=!1;const o=()=>t.isConnected&&!ze(t);let i=o();const c=()=>{if(!n){if(o()){i=!0;return}i&&(n=!0,r.disconnect(),e())}},r=new MutationObserver(c),s=new Set;typeof document<"u"&&s.add(document);const a=t.getRootNode();a&&s.add(a);for(const l of s)try{r.observe(l,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["inert"]})}catch{}return()=>r.disconnect()}function qe(t,e,n={}){const[o,i]=tt({x:0,y:0,placement:n.placement??"bottom"}),[c,r]=tt({}),[s,a]=tt(!1);return ut(()=>{const l=t(),u=e();if(!l||!u)return;const d=()=>{var p;const y=[Fe(n.gutter??8),He(),Pe({padding:8})],g=(p=n.arrowEl)==null?void 0:p.call(n);g&&y.push(We({element:g})),y.push(Me()),Be(l,u,{placement:n.placement??"bottom",strategy:"fixed",middleware:y}).then(({x:w,y:x,placement:v,middlewareData:E})=>{var b;i({x:w,y:x,placement:v}),E.arrow&&r({x:E.arrow.x,y:E.arrow.y}),a(!!((b=E.hide)!=null&&b.referenceHidden))})},m=ke(l,u,d);let f;if(typeof ResizeObserver=="function"&&l instanceof Element){f=new ResizeObserver(d),f.observe(l);for(const p of G(l))p instanceof Element&&f.observe(p)}const h=n.onDisconnect?$e(l,n.onDisconnect):void 0;dt(()=>{m(),f?.disconnect(),h?.()})}),{pos:o,arrowPos:c,hidden:s}}function Ie(t){ut(()=>{if(!t.enabled())return;const e=i=>{i.key==="Escape"&&t.onDismiss("escape")},n=i=>{const c=i.target;t.refs().some(r=>r&&r.contains(c))||t.onDismiss("outside")},o=document;o.addEventListener("keydown",e),o.addEventListener("pointerdown",n,!0),dt(()=>{o.removeEventListener("keydown",e),o.removeEventListener("pointerdown",n,!0)})})}export{Ve as A,Ie as a,Ne as c,qe as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{I as t}from"./Icon-BnFKqqtY.js";import{c as r,q as e}from"./define-CGGX-7Vg.js";var i=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],o=a=>r(t,e(a,{name:"PanelRight",iconNode:i})),h=o;export{h as p};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{I as e}from"./Icon-BnFKqqtY.js";import{c,q as r}from"./define-CGGX-7Vg.js";var m=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],o=a=>c(e,r(a,{name:"Globe",iconNode:m})),i=o,p=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],y=a=>c(e,r(a,{name:"Image",iconNode:p})),t=y,l=[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]],d=a=>c(e,r(a,{name:"Paperclip",iconNode:l})),h=d;export{i as g,t as i,h as p};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{I as a}from"./Icon-BnFKqqtY.js";import{c as p,q as r}from"./define-CGGX-7Vg.js";var e=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],m=o=>p(a,r(o,{name:"Play",iconNode:e})),s=m;export{s as p};
|
|
@@ -97,6 +97,55 @@ export type FormField = {
|
|
|
97
97
|
'x-kai-widget'?: 'textarea' | 'slider' | 'rating' | 'radio' | 'select' | 'checkbox' | 'password' | 'switch';
|
|
98
98
|
'x-kai-placeholder'?: string;
|
|
99
99
|
'x-kai-step'?: number;
|
|
100
|
+
/**
|
|
101
|
+
* Display format for a string field. `tel` / `ssn` / `credit-card`
|
|
102
|
+
* apply that type's standard mask and submit digits only; `custom` masks with
|
|
103
|
+
* `x-kai-mask` and submits the formatted value.
|
|
104
|
+
*
|
|
105
|
+
* NOT the JSON Schema `format` keyword, and deliberately not an extension of it:
|
|
106
|
+
* `format` has a registered vocabulary with assertion semantics, `widgetFor()`
|
|
107
|
+
* already switches on it to pick a widget, and `toJsonSchema()` turns it into a
|
|
108
|
+
* validation pattern. This is a UI hint, so it lives in the `x-kai-*` namespace
|
|
109
|
+
* with the other UI hints — and it selects FORMATTING, never a widget.
|
|
110
|
+
*
|
|
111
|
+
* Typed as the semantic-type union for a consumer authoring a form definition by
|
|
112
|
+
* hand. A value arriving from a MODEL is untrusted and may be anything at all;
|
|
113
|
+
* `resolveFieldMask()` degrades an unrecognised one to an unmasked text field with
|
|
114
|
+
* a console warning rather than trusting this declaration.
|
|
115
|
+
*
|
|
116
|
+
* SPELLED OUT HERE RATHER THAN IMPORTED, and that is not laziness. `FieldSemanticType`
|
|
117
|
+
* is declared in `./field-semantics`, which carries the semantics TABLE and its
|
|
118
|
+
* `console.warn` — and this file's whole reason for existing is that a Node/no-DOM
|
|
119
|
+
* backend can name a card payload with `lib: ["ESNext"]` and `types: []`, where
|
|
120
|
+
* `console` does not exist (measured: TS2584, by
|
|
121
|
+
* `tests/schemas/card-data-types-node-safe.test.ts`, which is what caught the import).
|
|
122
|
+
* A type import still has to RESOLVE, so importing the union would drag the engine into
|
|
123
|
+
* the server-safe entry's graph.
|
|
124
|
+
*
|
|
125
|
+
* AN APP CANNOT PIN THIS ON THE MODEL TODAY.
|
|
126
|
+
* `cardTools({ require })` narrows a projected tool schema by dot-path, but there is
|
|
127
|
+
* no path that reaches a form FIELD: a form card's payload is itself a JSON Schema, so
|
|
128
|
+
* `form.schema.json` describes `properties` as a map of field definitions rather than
|
|
129
|
+
* as a node per field, and `require: { form: [{ path: 'properties.ticketId' }] }` is a
|
|
130
|
+
* TypeError naming a path that does not resolve. "Force the model to mask the ticket
|
|
131
|
+
* field" is therefore not expressible; the enum above is what makes it LIKELY, and an
|
|
132
|
+
* app that needs a guarantee validates the arriving envelope itself.
|
|
133
|
+
*
|
|
134
|
+
* It is therefore a REGISTERED COPY of `FIELD_SEMANTIC_TYPES`: the two are pinned
|
|
135
|
+
* mutually assignable at compile time in
|
|
136
|
+
* `tests/components/form-field-formats.test.tsx`, so adding a fifth token to the enum
|
|
137
|
+
* without adding it here fails `nx typecheck ui` rather than shipping a form card that
|
|
138
|
+
* cannot name it.
|
|
139
|
+
*/
|
|
140
|
+
'x-kai-format'?: 'tel' | 'ssn' | 'credit-card' | 'custom';
|
|
141
|
+
/** The mask pattern, read only when `x-kai-format` is `custom`: `#` a digit, `@` an
|
|
142
|
+
* alphanumeric, `*` an obscurable alphanumeric, everything else a literal
|
|
143
|
+
* (`CHG-####`). Capped at the mask engine's own limit; a longer one is refused. */
|
|
144
|
+
'x-kai-mask'?: string;
|
|
145
|
+
/** Placeholder text for the mask's unfilled positions, aligned character for
|
|
146
|
+
* character with the pattern (`mm/dd/yyyy`). Derived from the pattern when absent;
|
|
147
|
+
* a misaligned one is dropped, loudly, and the mask survives. */
|
|
148
|
+
'x-kai-mask-guide'?: string;
|
|
100
149
|
};
|
|
101
150
|
/** The form definition = CardEnvelope.data for type:'form'. */
|
|
102
151
|
export type FormDefinition = {
|
|
@@ -1,43 +1,11 @@
|
|
|
1
1
|
import { CardEvent, CardPolicy } from './card-contract.js';
|
|
2
|
+
export { isSafeUrl, isScriptUrl } from './url-scheme-policy.js';
|
|
2
3
|
/** The single contract event name. */
|
|
3
4
|
export declare const CARD_EVENT_NAME = "kai-card";
|
|
4
5
|
/** Dispatch a CardEvent as the bubbling, composed `kai-card` event a host listener
|
|
5
6
|
* routes. NB: this is deliberately different from defineWebComponent's built-in
|
|
6
7
|
* non-bubbling dispatch. */
|
|
7
8
|
export declare function emitCardEvent(element: HTMLElement, event: CardEvent): void;
|
|
8
|
-
/** True when `url` is safe to put in an href / hand to `window.open`.
|
|
9
|
-
*
|
|
10
|
-
* Exported so the MARKDOWN renderer and the ARTIFACT viewer reuse this exact
|
|
11
|
-
* guard rather than growing a second scheme list that can drift from this one.
|
|
12
|
-
*
|
|
13
|
-
* Resolving against a base is deliberate and is what makes it correct for
|
|
14
|
-
* markdown: a relative or fragment link (`/docs`, `#section`, `./rel`) is
|
|
15
|
-
* ordinary markdown, and resolving it inherits the base's `http:` so it
|
|
16
|
-
* passes, while `javascript:`/`data:`/`vbscript:` keep their own protocol and
|
|
17
|
-
* fail. It is correct for the artifact viewer for the same reason: a file with
|
|
18
|
-
* no `src` to resolve against yields a bare relative path (`docs/report.pdf`),
|
|
19
|
-
* which is a legitimate artifact address. Contrast `isRenderableLink` in
|
|
20
|
-
* `primitives/link-preview.ts`, which takes NO base and so demands an absolute
|
|
21
|
-
* http(s) URL: that is the right guard for a model-supplied citation -- a
|
|
22
|
-
* reference to a page on the public web -- this one for markdown body links and
|
|
23
|
-
* artifact file addresses. */
|
|
24
|
-
export declare function isSafeUrl(url: string): boolean;
|
|
25
|
-
/** True when navigating to `url` would EXECUTE it as script in the initiating
|
|
26
|
-
* document's origin.
|
|
27
|
-
*
|
|
28
|
-
* Strictly narrower than `!isSafeUrl(url)`, and not a competing policy: it
|
|
29
|
-
* answers a different question, for the one sink where the allowlist is the
|
|
30
|
-
* wrong tool. An `<iframe src>` legitimately takes `data:` and `blob:` (a
|
|
31
|
-
* `data:` blob artifact is a documented `<kai-artifact>` use -- it is what
|
|
32
|
-
* `displayUrl` exists for) and both get an OPAQUE origin in every modern
|
|
33
|
-
* browser, so neither can reach the host page. `javascript:`/`vbscript:` are
|
|
34
|
-
* the schemes that run in the EMBEDDER's origin, and they are the whole risk:
|
|
35
|
-
* the default sandbox (no `allow-same-origin`) already makes the browser refuse
|
|
36
|
-
* them, but a consumer who sets `allow-same-origin` turns a model-supplied
|
|
37
|
-
* `src` into host-origin script execution. The artifact viewer used to suggest
|
|
38
|
-
* that setting for "an artifact you trust"; it no longer does, and this guard
|
|
39
|
-
* is what protects the consumers who took the old advice. */
|
|
40
|
-
export declare function isScriptUrl(url: string): boolean;
|
|
41
9
|
/** Apply the contract's policy to one event. The ONE place routing lives. */
|
|
42
10
|
export declare function routeCardEvent(policy: CardPolicy | undefined, event: CardEvent): void;
|
|
43
11
|
/** Attach a host-level `kai-card` listener that routes every bubbling card event
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export interface JsonSchema {
|
|
2
2
|
type?: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object' | 'null';
|
|
3
3
|
const?: unknown;
|
|
4
|
-
enum?: unknown[];
|
|
5
|
-
required?: string[];
|
|
4
|
+
enum?: readonly unknown[];
|
|
5
|
+
required?: readonly string[];
|
|
6
6
|
properties?: Record<string, JsonSchema>;
|
|
7
7
|
items?: JsonSchema;
|
|
8
8
|
minimum?: number;
|
|
@@ -25,7 +25,34 @@ export interface ChatConfigProps {
|
|
|
25
25
|
export declare function ChatConfig(props: ChatConfigProps): JSX.Element;
|
|
26
26
|
/** Read the current chat config. Returns defaults if no provider is present. */
|
|
27
27
|
export declare function useChatConfig(): ChatConfigValue;
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Maps prose size to the Tailwind Typography *size modifier* for consumers who
|
|
30
|
+
* render their own `prose` block.
|
|
31
|
+
*
|
|
32
|
+
* The `prose-*` names are deliberately NOT re-pointed at the --kai-text-* scale.
|
|
33
|
+
* They are not font sizes: each is a plugin-generated bundle of proportional
|
|
34
|
+
* margins, list indents, heading ratios and line-heights for every nested
|
|
35
|
+
* element, keyed to hardcoded rems, and they only do anything alongside `prose`
|
|
36
|
+
* itself. There is no `prose-body` to alias them to, and collapsing them to a
|
|
37
|
+
* bare font-size would throw away the vertical rhythm that is their whole job.
|
|
38
|
+
* The kit's own markdown does not go through them at all — it renders through
|
|
39
|
+
* `.chat-markdown` (theme.css), which is em-relative and therefore already
|
|
40
|
+
* scales off whatever `textClass` sets.
|
|
41
|
+
*
|
|
42
|
+
* The one raw font-size here (`xs`) DOES join the semantic scale, so it stays in
|
|
43
|
+
* step with `textClass('xs')`.
|
|
44
|
+
*/
|
|
29
45
|
export declare function proseClass(size: ProseSize): string;
|
|
30
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Maps prose size to a text class for message content, markdown, and non-prose
|
|
48
|
+
* chrome (sidebar, input).
|
|
49
|
+
*
|
|
50
|
+
* These are the kit's SEMANTIC type-scale utilities, not Tailwind's raw scale:
|
|
51
|
+
* each resolves through a namespaced --kai-text-* token in theme.css, so a
|
|
52
|
+
* consumer setting `--kai-text-body` moves the reading text. The public
|
|
53
|
+
* `proseSize` strings ('xs' | 'sm' | 'base' | 'lg') are unchanged — this is an
|
|
54
|
+
* internal re-point only. Sizes are byte-identical to the Tailwind classes they
|
|
55
|
+
* replace (text-meta ≡ text-xs, text-body ≡ text-sm, text-title ≡ text-base),
|
|
56
|
+
* so nothing moves until a token is actually overridden.
|
|
57
|
+
*/
|
|
31
58
|
export declare function textClass(size: ProseSize): string;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/** How `normalizeToRaw` folds accepted characters. */
|
|
2
|
+
export type CaseMode = 'preserve' | 'upper' | 'lower';
|
|
3
|
+
/** Why an edit was refused. Rejection decides LOUDLY: the stateful layer
|
|
4
|
+
* surfaces this on a callback and, on the element facade, as `kai-input-rejected`. */
|
|
5
|
+
export type RejectReason = 'full' | 'wrong-class' | 'over-capacity';
|
|
6
|
+
/** A compiled `format` + aligned display guide. Fill positions are `#` `@` `*`;
|
|
7
|
+
* every other index is a literal. */
|
|
8
|
+
export interface MaskPattern {
|
|
9
|
+
readonly format: string;
|
|
10
|
+
readonly guide: string;
|
|
11
|
+
readonly fillIndexes: readonly number[];
|
|
12
|
+
readonly capacity: number;
|
|
13
|
+
}
|
|
14
|
+
/** Thrown by `compileMask` only. Every other function in this module is total: it clamps
|
|
15
|
+
* or discards rather than throwing, because it runs on every keystroke. */
|
|
16
|
+
export declare class MaskError extends Error {
|
|
17
|
+
}
|
|
18
|
+
/** Compile a format string, with an optional aligned display guide.
|
|
19
|
+
*
|
|
20
|
+
* Without a guide, one is derived: literals keep their own character and every fill
|
|
21
|
+
* position becomes a space, which is the alignment the display layer needs and is exactly
|
|
22
|
+
* the `V- ` a consumer would have written by hand for `V-***`. */
|
|
23
|
+
export declare function compileMask(format: string, guide?: string): MaskPattern;
|
|
24
|
+
/** True when `ch` may occupy raw position `rawIndex`.
|
|
25
|
+
*
|
|
26
|
+
* `ch` must be exactly one UTF-16 code unit. Astral code points (a lone surrogate half
|
|
27
|
+
* cannot satisfy `\p{L}`) are outside this engine's model: one fill position holds one
|
|
28
|
+
* code unit, which is what keeps `format`, `guide`, the formatted text and the caret
|
|
29
|
+
* offsets a DOM input reports all in the same units. The target field family -- phone,
|
|
30
|
+
* SSN, ticket numbers, names, postal codes -- is BMP. */
|
|
31
|
+
export declare function acceptsAt(p: MaskPattern, rawIndex: number, ch: string): boolean;
|
|
32
|
+
/** Raw (fill-position-only) characters extracted from arbitrary input, with
|
|
33
|
+
* positional literal consumption and case folding: literals are matched leniently.
|
|
34
|
+
*
|
|
35
|
+
* LITERALS ARE MATCHED WHERE THEY SIT -- this is the fix for a real defect, and both halves
|
|
36
|
+
* of it are watched failing in the test file. A strip-then-fill normalizer (drop every
|
|
37
|
+
* non-alphanumeric, then fill positions in order) turns a pasted `V-123` under `V-***` into
|
|
38
|
+
* raw `V12`, rendered `V-V12`: the literal `V` is alphanumeric, survives the strip, is eaten
|
|
39
|
+
* by the first fill position, and the `3` falls off the end -- silently. Consuming only a
|
|
40
|
+
* leading literal RUN fixes that one case and leaves the same shape alive one level deeper:
|
|
41
|
+
* under `*-V-*`, `A-V-B` puts the interior literal `V` into the second fill position and
|
|
42
|
+
* drops the `B`. So the walk below advances over the FORMAT, not over a stripped string,
|
|
43
|
+
* and every literal -- leading, interior or trailing -- gets its chance to claim the input
|
|
44
|
+
* character sitting in front of it.
|
|
45
|
+
*
|
|
46
|
+
* The two branches, and why lenience is safe here:
|
|
47
|
+
* - At a LITERAL, an input character equal to it (case-insensitively) is consumed as that
|
|
48
|
+
* literal. A character that is not equal means the input simply omitted the literal, so
|
|
49
|
+
* the format advances and the input does not -- which is what lets `chg4821`, `v123` and
|
|
50
|
+
* a bare `AB` all normalize correctly.
|
|
51
|
+
* - At a FILL, an input character of the right class is taken (folded per `caseMode`) and
|
|
52
|
+
* both advance. One of the wrong class is discarded and the position WAITS for the next
|
|
53
|
+
* one -- that is what absorbs separators, spaces and the browser's autofill formatting
|
|
54
|
+
* (`chg 4821`, `CHG-4821`, `chg4821` all give the same raw).
|
|
55
|
+
*
|
|
56
|
+
* Every iteration either consumes an input character or advances the format, so it
|
|
57
|
+
* terminates. Input past the last fill position is clipped -- the caller compares lengths
|
|
58
|
+
* to report `over-capacity`. */
|
|
59
|
+
export declare function normalizeToRaw(p: MaskPattern, input: string, caseMode?: CaseMode): string;
|
|
60
|
+
/** Raw formatted for DATA purposes -- the canonical value a `custom` mask submits:
|
|
61
|
+
* formatted, with trailing placeholders trimmed. Literals are re-inserted at their positions
|
|
62
|
+
* and the string is cut at the first UNFILLED position, because that placeholder and
|
|
63
|
+
* everything after it is not yet content.
|
|
64
|
+
*
|
|
65
|
+
* A trailing literal run is NOT a placeholder, so a raw at capacity carries it: `##-END`
|
|
66
|
+
* with raw `12` is `12-END`, the same way the literals of `CHG-4821` are part of the ticket
|
|
67
|
+
* id rather than presentation. Cutting at `raw.length` instead would silently drop a fixed
|
|
68
|
+
* suffix from the submitted datum.
|
|
69
|
+
*
|
|
70
|
+
* Empty raw is `''`, never the bare skeleton (`V-`): an empty field submits `''`, never
|
|
71
|
+
* the bare mask template. `formatForDisplay` is the other call site. */
|
|
72
|
+
export declare function formatRaw(p: MaskPattern, raw: string): string;
|
|
73
|
+
/** Raw formatted for DISPLAY purposes: every unfilled position shows its guide character,
|
|
74
|
+
* so the text is always `format.length` long and stays aligned. Empty raw shows the guide
|
|
75
|
+
* in full (`mm/dd/yyyy`, `V- `). */
|
|
76
|
+
export declare function formatForDisplay(p: MaskPattern, raw: string): string;
|
|
77
|
+
/** Raw read back out of formatted text BY POSITION, which is what makes an alphanumeric
|
|
78
|
+
* literal safe: the `V` of `V-123` sits at a literal index and is never read as content.
|
|
79
|
+
* Stops at the first unfilled position, so a display string's guide characters -- which do
|
|
80
|
+
* not satisfy their position's class -- are not mistaken for input. */
|
|
81
|
+
export declare function rawFromFormatted(p: MaskPattern, formatted: string): string;
|
|
82
|
+
/** Caret position in `formatted` -> caret position in raw: the number of FILLED fill
|
|
83
|
+
* positions strictly before `pos`. */
|
|
84
|
+
export declare function formattedToRawIndex(p: MaskPattern, formatted: string, pos: number): number;
|
|
85
|
+
/** Caret position in raw -> caret position in `formatted`.
|
|
86
|
+
*
|
|
87
|
+
* Raw 0 maps to the FIRST fill index, so the caret never lands inside a leading literal
|
|
88
|
+
* prefix. Otherwise it lands just after the last consumed fill position and is then pulled
|
|
89
|
+
* forward over any literal run that follows, so it rests where the next character will go
|
|
90
|
+
* rather than in front of a separator -- finally clamped to the text that actually exists.
|
|
91
|
+
*
|
|
92
|
+
* The pull-forward is why this is a left inverse of `formattedToRawIndex` on every caret
|
|
93
|
+
* position EXCEPT the one immediately before a literal run: that position and the one after
|
|
94
|
+
* it map to the same raw index by definition, and only one of the two can come back. The
|
|
95
|
+
* post-literal one is canonical: the caret never rests inside a literal run. */
|
|
96
|
+
export declare function rawToFormattedIndex(p: MaskPattern, formatted: string, rawPos: number): number;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { MaskPattern } from './field-mask.js';
|
|
2
|
+
export declare const FIELD_SEMANTIC_TYPES: readonly ["tel", "ssn", "credit-card", "custom"];
|
|
3
|
+
export type FieldSemanticType = (typeof FIELD_SEMANTIC_TYPES)[number];
|
|
4
|
+
/** The tier-1 attribute bag for one semantic type. */
|
|
5
|
+
export interface FieldSemantics {
|
|
6
|
+
readonly inputmode?: 'tel' | 'numeric';
|
|
7
|
+
readonly autocomplete?: string;
|
|
8
|
+
readonly spellcheck: false;
|
|
9
|
+
readonly autocorrect: 'off';
|
|
10
|
+
readonly autocapitalize: 'off';
|
|
11
|
+
/** The default tier-2 mask for this type, resolved only when the consumer opts in
|
|
12
|
+
* (`mask="default"` / the form card's `x-kai-format`) -- NOT applied automatically
|
|
13
|
+
* by a bare semantic type (decision 1). */
|
|
14
|
+
readonly defaultFormat?: string;
|
|
15
|
+
/** What the field submits: digit-only types strip separators, `custom`
|
|
16
|
+
* keeps its formatted/literal value, `as-typed` is the unmasked fallback. */
|
|
17
|
+
readonly canonical: 'digits' | 'formatted' | 'as-typed';
|
|
18
|
+
}
|
|
19
|
+
/** Resolve the tier-1 attribute bag for a semantic type.
|
|
20
|
+
*
|
|
21
|
+
* Passing anything outside `FIELD_SEMANTIC_TYPES` is a TypeScript error at a typed call
|
|
22
|
+
* site; a value crossing an untyped boundary (JSON Schema, model output) that turns out
|
|
23
|
+
* not to be one of the four falls back to plain unmasked-text behavior at runtime, loudly
|
|
24
|
+
* -- `console.warn`, never a silent guess. */
|
|
25
|
+
export declare function fieldSemantics(type: FieldSemanticType): FieldSemantics;
|
|
26
|
+
/** The canonical (submitted) value for a field, given its compiled mask, the current
|
|
27
|
+
* FORMATTED text (`input.value`), and its semantic type.
|
|
28
|
+
*
|
|
29
|
+
* Reads the raw value back out of `formatted` by position first -- an empty field is
|
|
30
|
+
* always `''`, never the bare guide. From there the two canonical shapes are read, not
|
|
31
|
+
* re-derived, per Task 1's handoff: `tel`/`ssn`/`credit-card` want the raw digits
|
|
32
|
+
* directly (their formats carry no letters, so raw IS the digit string); `custom` wants
|
|
33
|
+
* `formatRaw`, because a literal-terminated custom format (`##-END`) only carries its
|
|
34
|
+
* trailing literal once every fill position is full, and `formatRaw` is what tracks that
|
|
35
|
+
* -- `rawFromFormatted` gives raw characters only, with no literal reinsertion. */
|
|
36
|
+
export declare function canonicalize(p: MaskPattern, formatted: string, type: FieldSemanticType): string;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { CaseMode, RejectReason } from './field-mask.js';
|
|
2
|
+
import { FieldSemanticType } from './field-semantics.js';
|
|
3
|
+
/** What a copy or cut puts on the clipboard. A stated policy the consumer selects, NOT a
|
|
4
|
+
* consequence of `obscure`: copying bullets is not a security control -- the
|
|
5
|
+
* value is in the page -- and whether a card number may be copied at all is an app-layer
|
|
6
|
+
* decision (CLAUDE.md: the kit decides HOW, the app decides WHETHER). */
|
|
7
|
+
export type CopyPolicy = 'formatted' | 'canonical' | 'obscured' | 'blocked';
|
|
8
|
+
/** Why an edit or a re-configuration refused, or partly refused, the content it was given.
|
|
9
|
+
*
|
|
10
|
+
* A superset of `field-mask.ts`'s `RejectReason`, widened HERE rather than there because
|
|
11
|
+
* the extra member is not an engine verdict: the engine's three describe one edit failing
|
|
12
|
+
* against one pattern, while `format-change-clipped` describes the PATTERN moving out from
|
|
13
|
+
* under a value that was already accepted. Widening keeps every consumer that narrows on
|
|
14
|
+
* the engine's three compiling unchanged. */
|
|
15
|
+
export type InputMaskRejectReason = RejectReason | 'format-change-clipped';
|
|
16
|
+
export interface InputMaskOptions {
|
|
17
|
+
format: string;
|
|
18
|
+
guide?: string;
|
|
19
|
+
semantic?: FieldSemanticType;
|
|
20
|
+
caseMode?: CaseMode;
|
|
21
|
+
copyPolicy?: CopyPolicy;
|
|
22
|
+
/** Tier 3. Wired -- it selects the default copy policy -- but does NOT yet transform the
|
|
23
|
+
* display; that lands with the obscured rendering in tier 3 (task 10). */
|
|
24
|
+
obscure?: boolean;
|
|
25
|
+
initialValue?: string;
|
|
26
|
+
onInput?: (detail: {
|
|
27
|
+
canonical: string;
|
|
28
|
+
formatted: string;
|
|
29
|
+
}) => void;
|
|
30
|
+
onReject?: (detail: {
|
|
31
|
+
reason: InputMaskRejectReason;
|
|
32
|
+
data: string;
|
|
33
|
+
}) => void;
|
|
34
|
+
}
|
|
35
|
+
export interface InputMask {
|
|
36
|
+
/** Accepts the canonical form or the formatted form; both normalize to the same value. */
|
|
37
|
+
setValue(value: string): void;
|
|
38
|
+
getRawValue(): string;
|
|
39
|
+
getCanonicalValue(): string;
|
|
40
|
+
getFormattedValue(): string;
|
|
41
|
+
setObscure(on: boolean): void;
|
|
42
|
+
/** Re-compiles and preserves the value, re-fitted to the new pattern. */
|
|
43
|
+
update(next: Partial<InputMaskOptions>): void;
|
|
44
|
+
detach(): void;
|
|
45
|
+
}
|
|
46
|
+
export declare function createInputMask(el: HTMLInputElement, options: InputMaskOptions): InputMask;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** True when `url` is safe to put in an href / hand to `window.open` / an `<img src>`.
|
|
2
|
+
*
|
|
3
|
+
* Exported so the MARKDOWN renderer, the ARTIFACT viewer and the construct
|
|
4
|
+
* format's `widget.launcherIcon` reuse this exact guard rather than growing a
|
|
5
|
+
* second scheme list that can drift from this one.
|
|
6
|
+
*
|
|
7
|
+
* Resolving against a base is deliberate and is what makes it correct for
|
|
8
|
+
* markdown: a relative or fragment link (`/docs`, `#section`, `./rel`) is
|
|
9
|
+
* ordinary markdown, and resolving it inherits the base's `http:` so it
|
|
10
|
+
* passes, while `javascript:`/`data:`/`vbscript:` keep their own protocol and
|
|
11
|
+
* fail. It is correct for the artifact viewer for the same reason: a file with
|
|
12
|
+
* no `src` to resolve against yields a bare relative path (`docs/report.pdf`),
|
|
13
|
+
* which is a legitimate artifact address. Contrast `isRenderableLink` in
|
|
14
|
+
* `primitives/link-preview.ts`, which takes NO base and so demands an absolute
|
|
15
|
+
* http(s) URL: that is the right guard for a model-supplied citation -- a
|
|
16
|
+
* reference to a page on the public web -- this one for markdown body links,
|
|
17
|
+
* artifact file addresses, and a construct's launcher icon. */
|
|
18
|
+
export declare function isSafeUrl(url: string): boolean;
|
|
19
|
+
/** True when navigating to `url` would EXECUTE it as script in the initiating
|
|
20
|
+
* document's origin.
|
|
21
|
+
*
|
|
22
|
+
* Strictly narrower than `!isSafeUrl(url)`, and not a competing policy: it
|
|
23
|
+
* answers a different question, for the one sink where the allowlist is the
|
|
24
|
+
* wrong tool. An `<iframe src>` legitimately takes `data:` and `blob:` (a
|
|
25
|
+
* `data:` blob artifact is a documented `<kai-artifact>` use -- it is what
|
|
26
|
+
* `displayUrl` exists for) and both get an OPAQUE origin in every modern
|
|
27
|
+
* browser, so neither can reach the host page. `javascript:`/`vbscript:` are
|
|
28
|
+
* the schemes that run in the EMBEDDER's origin, and they are the whole risk:
|
|
29
|
+
* the default sandbox (no `allow-same-origin`) already makes the browser refuse
|
|
30
|
+
* them, but a consumer who sets `allow-same-origin` turns a model-supplied
|
|
31
|
+
* `src` into host-origin script execution. The artifact viewer used to suggest
|
|
32
|
+
* that setting for "an artifact you trust"; it no longer does, and this guard
|
|
33
|
+
* is what protects the consumers who took the old advice. */
|
|
34
|
+
export declare function isScriptUrl(url: string): boolean;
|
|
@@ -1 +1,24 @@
|
|
|
1
1
|
export declare function observeContentHeight(el: Element, onHeight: (height: number) => void): () => void;
|
|
2
|
+
/** Observe an element's resizes but report the FULL rendered document height (not the
|
|
3
|
+
* observed element's own content-box) — `document.body.scrollHeight`.
|
|
4
|
+
*
|
|
5
|
+
* Used by the remote-card provider runtime to size the host iframe:
|
|
6
|
+
* `observeContentHeight` reports the ResizeObserver content-box of
|
|
7
|
+
* the observed root, which drops that root's OWN padding/border and any ancestor
|
|
8
|
+
* (e.g. `<body>`) padding above it — the host then clips the bottom of the card by
|
|
9
|
+
* exactly those lost pixels. `scrollHeight` is the full padding-box height as actually
|
|
10
|
+
* rendered, so it stays correct no matter which element in the ancestor chain carries
|
|
11
|
+
* the padding/border, including if the provider page's own styles change later —
|
|
12
|
+
* reading contentRect off one fixed element, or hand-summing computed padding/border
|
|
13
|
+
* off a fixed list of ancestors, would both need updating every time that chain does.
|
|
14
|
+
*
|
|
15
|
+
* Deliberately `document.body.scrollHeight`, NOT `document.documentElement.scrollHeight`
|
|
16
|
+
* (N1, task-10-report.md "Fix-wave re-review"): the CSSOM View spec special-cases the
|
|
17
|
+
* scrollHeight of the ROOT element to be `max(viewport scrolling area, viewport
|
|
18
|
+
* height)` — and the host sets the iframe's viewport FROM this very measurement
|
|
19
|
+
* (`host-embed.ts` `sizeIframe`), so `documentElement.scrollHeight` can only grow for
|
|
20
|
+
* the life of the frame: once the iframe is tall, the root's own scrollHeight is
|
|
21
|
+
* floored at that height even after the card's content shrinks. `<body>` carries no
|
|
22
|
+
* such floor — its scrollHeight is a plain padding-box measurement of body's own
|
|
23
|
+
* content, so it shrinks along with the card. */
|
|
24
|
+
export declare function observeDocumentHeight(el: Element, onHeight: (height: number) => void): () => void;
|
|
@@ -7,6 +7,14 @@ export interface SpeechRecognitionStartOptions {
|
|
|
7
7
|
lang?: string;
|
|
8
8
|
/** Called with each interim (non-final) transcript when `interim` is enabled. */
|
|
9
9
|
onInterim?: (text: string) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Called when the recognition session hits a runtime error (`recognition.onerror`),
|
|
12
|
+
* with the platform's error code (`network`, `not-allowed`, `no-speech`, ...) and a
|
|
13
|
+
* human-readable message. The session still ends through `onend`, so `start()` still
|
|
14
|
+
* resolves (with whatever text was captured before the error). Without this callback
|
|
15
|
+
* a runtime failure is invisible: the `error` signal is state, not a notification.
|
|
16
|
+
*/
|
|
17
|
+
onError?: (error: string, message: string) => void;
|
|
10
18
|
}
|
|
11
19
|
/**
|
|
12
20
|
* Wrap the browser's Web Speech `SpeechRecognition` (Chrome/Safari; no Firefox).
|