@inkandswitch/patchwork-pkg-base 0.0.31 → 0.0.33

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkandswitch/patchwork-pkg-base",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "type": "module",
5
5
  "description": "Base packages for the Patchwork system",
6
6
  "repository": {
@@ -1,4 +1,4 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.chat-root{--bg-dark: var(--editor-fill, var(--studio-fill, oklch(.15 .03 270)));--bg-darkest: var(--editor-fill-offset-20, var(--studio-fill-offset-20, oklch(.12 .02 270)));--bg-mid: var(--editor-fill-offset-10, var(--studio-fill-offset-10, oklch(.19 .03 270)));--bg-input: var(--editor-fill, var(--studio-fill, oklch(.17 .03 270)));--bg-hover: var(--editor-fill-offset-20, var(--studio-fill-offset-20, oklch(.22 .04 270)));--border: var(--editor-fill-offset-20, var(--studio-fill-offset-20, oklch(.28 .05 270)));--accent: var(--studio-primary-fill, var(--studio-primary, oklch(.55 .18 270)));--accent-line: var(--studio-primary-line, var(--editor-fill, var(--studio-fill, oklch(1 0 0))));--accent-text: var(--studio-primary-text, var(--accent));--accent-hover: color-mix(in oklch, var(--accent), var(--studio-line, black) 18%);--accent-soft: color-mix(in oklch, var(--accent), transparent 85%);--accent-fg: var(--accent-line);--theme: var(--accent);--text-primary: var(--studio-line, oklch(1 0 0));--text-secondary: var(--studio-line-offset-30, oklch(1 0 0 / .6));--text-muted: var(--studio-line-offset-50, oklch(1 0 0 / .4));--link: var(--studio-link-text, var(--studio-link, oklch(.75 .15 250)))}.chat-root{display:flex;flex-direction:row;position:absolute;inset:0;font-family:var(--studio-family-sans, system-ui,-apple-system,sans-serif);background:var(--bg-dark);color:var(--text-primary);box-sizing:border-box;font-size:var(--studio-font-size, 15px);overflow:hidden;user-select:text;-webkit-user-select:text;height:100%}.chat-context-empty{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;text-align:center;padding:24px;color:var(--text-secondary, #888);font-family:var(--studio-family-sans, system-ui,-apple-system,sans-serif);font-size:var(--studio-font-size, 15px)}.chat-root *,.chat-root *:before,.chat-root *:after{box-sizing:border-box}.chat-root a{color:var(--link);text-decoration:underline}.chat-root a:hover{text-decoration:none}.chat-theme-btn{background:none;border:none;color:var(--text-muted);cursor:pointer;font-size:16px;padding:2px 6px;border-radius:4px;position:relative}.chat-theme-btn:hover,.chat-notify-btn:hover{background:var(--bg-hover);color:var(--text-primary)}.chat-notify-btn{background:none;border:none;color:var(--text-muted);cursor:pointer;padding:2px 4px;border-radius:4px;display:flex;align-items:center;position:relative}.chat-notify-menu{display:none;position:absolute;top:100%;right:0;margin-top:4px;background:var(--bg-darkest);border:1px solid var(--border);border-radius:8px;padding:8px;min-width:180px;z-index:200}.chat-notify-menu.show{display:block}.chat-notify-menu-row{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 4px;font-size:13px;color:var(--text-secondary);cursor:pointer;border-radius:4px}.chat-notify-menu-row:hover{background:var(--bg-hover)}.chat-notify-toggle{width:32px;height:18px;border-radius:9px;border:none;cursor:pointer;background:var(--bg-hover);position:relative;transition:background .15s;flex-shrink:0}.chat-notify-toggle.on{background:var(--accent)}.chat-notify-toggle:after{content:"";position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;background:#fff;transition:transform .15s}.chat-notify-toggle.on:after{transform:translate(14px)}.chat-presence-bar{padding:4px 16px;background:var(--bg-darkest);border-bottom:1px solid var(--border);display:flex;gap:8px;align-items:center;flex-shrink:0;min-height:24px;position:relative;z-index:50;overflow:visible}.chat-presence-user{display:flex;align-items:center;gap:4px;font-size:12px;color:var(--text-secondary);transition:opacity .2s}.chat-presence-user.away{opacity:.9}.chat-presence-avatar{width:18px;height:18px;border-radius:50%;overflow:hidden;flex-shrink:0;background:var(--bg-hover);display:flex;align-items:center;justify-content:center;font-size:10px;color:var(--text-muted)}.chat-presence-avatar img{width:100%;height:100%;object-fit:cover}.chat-messages{flex:1;overflow-y:auto;padding:8px 0;display:flex;flex-direction:column;min-height:0;height:100%;overflow:scroll}.chat-msg-group{padding:2px 16px;display:flex;gap:12px;position:relative}.chat-msg-group:hover{background:var(--bg-hover)}.chat-avatar-col{width:40px;flex-shrink:0;padding-top:2px}.chat-avatar{width:40px;height:40px;border-radius:50%;background:var(--accent);display:flex;align-items:center;justify-content:center;font-size:18px;font-weight:700;color:var(--accent-fg);overflow:hidden;cursor:pointer;position:relative;user-select:none}.chat-avatar img{width:100%;height:100%;object-fit:cover}.chat-avatar-view{display:block;width:100%;height:100%}.chat-avatar-view img{width:100%;height:100%;object-fit:cover}.chat-avatar.gif-selfie,.chat-avatar.gif-selfie img{border-radius:4px}.chat-avatar.cat-ears:before{content:"";position:absolute;top:-6px;left:2px;border-left:8px solid transparent;border-right:8px solid transparent;border-bottom:12px solid var(--accent);z-index:2}.chat-avatar.cat-ears:after{content:"";position:absolute;top:-6px;right:2px;border-left:8px solid transparent;border-right:8px solid transparent;border-bottom:12px solid var(--accent);z-index:2}.chat-msg-body{flex:1;min-width:0}.chat-msg-header{display:flex;align-items:baseline;gap:8px}.chat-msg-name{font-weight:600;font-size:15px;color:var(--text-primary);cursor:pointer}.chat-msg-name:hover{text-decoration:underline}.chat-msg-time{font-size:11px;color:var(--text-muted)}.chat-msg-text{color:var(--text-primary);line-height:1.45;margin-top:2px;white-space:pre-wrap;word-wrap:break-word}.chat-msg-text.emoji-only{font-size:2em;line-height:1.2}.chat-quick-replies{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}.chat-quick-reply{font:inherit;font-size:.9em;cursor:pointer;padding:4px 10px;border-radius:var(--studio-radius-round, 999px);border:1px solid var(--accent-line, currentColor);background:transparent;color:var(--accent-text, var(--text-primary))}.chat-quick-reply:hover:not(:disabled){background:var(--accent);color:var(--accent-fg)}.chat-quick-reply:disabled{opacity:.5;cursor:default}.chat-msg-text.emoji-only .chat-emoticon-inline{height:2em}.chat-msg-text code:not(.shiki code):not(.chat-code-block code){background:var(--bg-hover);padding:1px 4px;border-radius:3px;font-family:ui-monospace,monospace;font-size:.9em}.chat-msg-text a{color:var(--link);text-decoration:underline}.chat-msg-text a:hover{text-decoration:none}.chat-msg-text.streaming:after{content:"";display:inline-block;width:6px;height:1em;background:var(--accent);margin-left:2px;vertical-align:text-bottom;border-radius:1px;animation:blink-cursor .8s step-end infinite}.chat-msg-text.streaming:empty:after{content:"";width:auto;height:auto;background:none;animation:none}.chat-msg-text.streaming:empty:before{content:"• • •";letter-spacing:2px;color:var(--text-muted);font-size:18px;animation:thinking-dots 1.4s ease-in-out infinite}@keyframes thinking-dots{0%,to{opacity:.3}50%{opacity:1}}@keyframes blink-cursor{0%,to{opacity:1}50%{opacity:0}}.chat-streaming-cancel{margin-top:4px;padding:2px 10px;border-radius:4px;border:1px solid var(--border);background:var(--bg-hover);color:var(--text-muted);cursor:pointer;font-size:11px}.chat-streaming-cancel:hover{color:var(--text-primary);background:var(--bg-mid)}.chat-spoiler{background:var(--text-primary);color:transparent;border-radius:3px;padding:0 3px;cursor:pointer;transition:all .2s}.chat-spoiler.revealed{background:var(--bg-hover);color:var(--text-primary)}.chat-inverted{background:var(--text-primary);color:var(--bg-dark);padding:0 3px;border-radius:3px}.chat-underline-em{text-decoration:underline;font-style:italic}.chat-msg-action{padding:4px 16px;font-style:italic;color:var(--text-secondary);font-size:14px;position:relative}.chat-msg-action:hover{background:var(--bg-hover)}.chat-msg-action .chat-msg-action-name{font-weight:600;color:var(--text-primary)}.chat-time-gap{margin-top:16px}.chat-input-wrap{position:relative;flex:1;min-width:0}.chat-input-wrap .cm-editor{background:transparent}.chat-input-wrap .cm-editor .cm-content,.chat-input-wrap .cm-editor .cm-scroller{max-height:120px}.chat-msg-continuation{padding:0 16px 0 68px;position:relative}.chat-msg-continuation.has-gif{padding-left:16px;display:flex;gap:12px;align-items:flex-start}.chat-msg-continuation:hover{background:var(--bg-hover)}.chat-msg-inline-time{font-size:10px;color:var(--text-muted);position:absolute;top:100%;right:0;white-space:nowrap;margin-top:2px;pointer-events:none}.chat-msg-gif-inline{width:40px;height:40px;border-radius:4px;object-fit:cover;border:none;display:block;margin-right:6px;flex-shrink:0}.chat-msg-reply-ref{display:flex;align-items:center;gap:6px;font-size:13px;color:var(--text-muted);margin-bottom:2px;padding-left:36px;cursor:pointer;position:relative}.chat-msg-reply-ref:before{content:"";position:absolute;left:20px;top:50%;width:12px;height:12px;border-left:2px solid var(--border);border-top:2px solid var(--border);border-radius:6px 0 0;transform:translateY(-20%)}.chat-msg-reply-ref:hover{color:var(--text-primary)}.chat-msg-reply-ref-avatar{width:16px;height:16px;border-radius:50%;overflow:hidden;flex-shrink:0}.chat-msg-reply-ref-avatar img{width:100%;height:100%;object-fit:cover}.chat-msg-reply-ref-name{font-weight:600;color:var(--text-primary)}.chat-msg-reply-ref-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:300px}.chat-msg-image-wrap{position:relative;display:inline-block;margin-top:4px;max-width:100%}.chat-msg-image{display:block;border-radius:8px;cursor:pointer;width:100%;height:100%;object-fit:cover}.chat-msg-embed{margin-top:6px;border:1px solid var(--border);border-radius:8px;width:100%;height:300px;position:relative;background:var(--bg-surface);display:flex;flex-direction:column}.chat-msg-embed patchwork-view{width:100%;flex:1;min-height:0;display:block;overflow:hidden}.chat-msg-embed-title{padding:0 8px 0 0;font-weight:500;color:var(--text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex-shrink:1;min-width:0}.chat-embed-infobar{display:flex;align-items:center;gap:4px;padding:3px 6px;background:var(--bg-darkest);border-top:1px solid var(--border);font-size:11px;overflow:hidden;flex-wrap:wrap}.chat-embed-pill{display:inline-flex;align-items:center;gap:3px;background:var(--bg-hover);border:1px solid var(--border);border-radius:10px;padding:1px 8px;font-size:10px;color:var(--text-secondary);white-space:nowrap;cursor:default;max-width:200px;overflow:hidden;text-overflow:ellipsis;flex-shrink:0}.chat-embed-pill.clickable{cursor:pointer}.chat-embed-pill.clickable:hover{color:var(--text-primary);border-color:var(--accent-line);background:var(--bg-input)}.chat-embed-pill-label{opacity:.6;font-size:9px;text-transform:uppercase;letter-spacing:.3px}.chat-embed-tool-input{background:var(--bg-darkest);border:1px solid var(--accent-line);border-radius:10px;color:var(--text-primary);font-size:10px;padding:1px 8px;outline:none;width:120px}.chat-embed-tool-menu{position:absolute;top:100%;left:0;z-index:20;background:var(--bg-surface);border:1px solid var(--border);border-radius:6px;padding:2px;box-shadow:0 2px 8px #0000004d;white-space:nowrap;min-width:140px;max-height:200px;overflow-y:auto}.chat-embed-tool-menu button{display:block;width:100%;text-align:left;background:none;border:none;color:var(--text-secondary);font-size:11px;padding:4px 8px;cursor:pointer;border-radius:4px}.chat-embed-tool-menu button:hover{background:var(--bg-hover);color:var(--text-primary)}.chat-embed-tool-menu button.active{color:var(--accent-text);font-weight:600}.chat-embed-tool-menu .tool-menu-input-row{display:flex;gap:4px;padding:4px;border-top:1px solid var(--border);margin-top:2px}.chat-embed-tool-menu .tool-menu-input-row input{flex:1;background:var(--bg-darkest);border:1px solid var(--border);border-radius:4px;color:var(--text-primary);font-size:10px;padding:2px 6px;outline:none;min-width:0}.chat-embed-tool-menu .tool-menu-input-row input:focus{border-color:var(--accent-line)}.chat-embed-url-menu{position:absolute;top:100%;left:0;z-index:20;background:var(--bg-surface);border:1px solid var(--border);border-radius:6px;padding:2px;box-shadow:0 2px 8px #0000004d;white-space:nowrap}.chat-embed-url-menu button{display:block;width:100%;text-align:left;background:none;border:none;color:var(--text-secondary);font-size:11px;padding:4px 10px;cursor:pointer;border-radius:4px}.chat-embed-url-menu button:hover{background:var(--bg-hover);color:var(--text-primary)}.chat-resize-handle{position:absolute;bottom:0;right:0;width:16px;height:16px;cursor:nwse-resize;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .15s;z-index:5}.chat-msg-image-wrap:hover .chat-resize-handle,.chat-msg-embed:hover .chat-resize-handle{opacity:.6}.chat-resize-handle:hover{opacity:1!important}.chat-resize-handle svg{width:10px;height:10px;color:var(--text-muted)}.chat-rich-blocks{display:flex;flex-direction:column;gap:4px;margin-top:6px}.chat-rich-block{border:1px solid var(--border);border-radius:6px;overflow:hidden;background:var(--bg-darkest);font-size:13px}.chat-rich-block-header{display:flex;align-items:center;gap:6px;padding:5px 10px;cursor:pointer;border:none;background:transparent;color:var(--text-secondary);width:100%;text-align:left;font-size:12px;font-family:monospace}.chat-rich-block-header:hover{background:var(--bg-hover);color:var(--text-primary)}.chat-rich-block-chevron{transition:transform .15s;flex-shrink:0}.chat-rich-block.open .chat-rich-block-chevron{transform:rotate(90deg)}.chat-rich-block-label{opacity:.8}.chat-rich-block-body{border-top:1px solid var(--border);max-height:400px;overflow:auto}.chat-rich-block-code{margin:0;font-size:12px;line-height:1.5}.chat-rich-block-code pre{margin:0;padding:10px;overflow-x:auto}.chat-rich-block-code code{font-family:monospace;white-space:pre}.chat-rich-block-result-label{font-size:11px;color:var(--text-muted);padding:6px 10px 2px;text-transform:uppercase;letter-spacing:.5px;border-top:1px solid var(--border)}.shiki{margin:0!important;padding:10px 12px!important;font-size:13px!important;line-height:1.5!important;overflow-x:auto;border-radius:6px}.shiki code{font-family:ui-monospace,SF Mono,Cascadia Code,Menlo,Consolas,monospace!important}.chat-code-block{background:var(--bg-darkest);border:none;border-radius:6px;padding:0;margin:6px 0;overflow-x:auto;font-size:13px;line-height:1.5}.chat-code-block code{font-family:ui-monospace,SF Mono,Cascadia Code,Menlo,Consolas,monospace;white-space:pre;display:block;padding:10px 12px}.chat-msg-text .shiki{border-radius:6px;border:none;margin:6px 0}.chat-msg-text .shiki code{white-space:pre;display:block}.chat-rich-block-code .shiki{margin:0;border-radius:0}.chat-think-block{background:var(--bg-darkest);border-radius:6px;margin:6px 0;font-size:13px;overflow:hidden}.chat-think-block summary{cursor:pointer;padding:5px 10px;color:var(--text-secondary);font-family:ui-monospace,monospace;font-size:12px;user-select:none;list-style:none}.chat-think-block summary:before{content:"▶ ";display:inline;font-size:10px}.chat-think-block[open] summary:before{content:"▼ "}.chat-think-block summary:hover{background:var(--bg-hover);color:var(--text-primary)}.chat-think-content{padding:8px 12px;white-space:pre-wrap;color:var(--text-secondary);font-family:ui-monospace,monospace;border-top:1px solid var(--bg-hover);max-height:300px;overflow-y:auto}.chat-voice-note{display:flex;align-items:center;gap:8px;margin-top:4px;padding:8px 12px;background:var(--bg-darkest);border-radius:8px;max-width:300px;flex-wrap:wrap}.chat-voice-transcription{width:100%;font-size:13px;color:var(--text-secondary);font-style:italic;padding-left:2px;margin-top:2px}.chat-voice-transcribing{opacity:.5;animation:chat-pulse 1.5s ease-in-out infinite}@keyframes chat-pulse{0%,to{opacity:.5}50%{opacity:.3}}.chat-voice-transcribe-btn{background:none;border:none;color:var(--text-muted);font-size:11px;cursor:pointer;padding:2px 4px;opacity:.6;font-style:italic}.chat-voice-transcribe-btn:hover{opacity:1;text-decoration:underline}.chat-voice-play-btn{width:32px;height:32px;border-radius:50%;background:var(--accent);color:var(--accent-fg);border:none;font-size:14px;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0}.chat-voice-play-btn:hover{background:var(--accent-hover)}.chat-voice-waveform{flex:1;height:24px;display:flex;align-items:center;gap:2px}.chat-voice-bar{width:3px;background:var(--accent);border-radius:2px;min-height:3px}.chat-voice-duration{font-size:12px;color:var(--text-muted);flex-shrink:0}.chat-reactions{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px}.chat-reaction{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:8px;border:1px solid var(--border);background:var(--bg-dark);font-size:15px;cursor:pointer;user-select:none;transition:all .1s}.chat-reaction:hover{border-color:var(--accent-line);background:var(--bg-hover)}.chat-reaction.mine{border-color:var(--accent-line);background:var(--accent-soft)}.chat-reaction-count{font-size:12px;color:var(--text-secondary);font-weight:500}.chat-reaction-add{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:8px;border:1px dashed var(--border);background:transparent;font-size:16px;cursor:pointer;color:var(--text-muted);transition:all .1s}.chat-reaction-add:hover{border-color:var(--accent-line);color:var(--text-primary);background:var(--bg-hover)}.chat-emoticon-tooltip{position:absolute;z-index:200;pointer-events:none;background:var(--bg-darkest);border:1px solid var(--border);border-radius:8px;padding:8px 12px;box-shadow:0 4px 16px #0000004d;display:none;flex-direction:column;align-items:center;gap:4px;max-width:200px}.chat-emoticon-tooltip.show{display:flex;pointer-events:auto}.chat-emoticon-tooltip-preview{font-size:48px;line-height:1}.chat-emoticon-tooltip-preview img{width:48px;height:48px;object-fit:contain}.chat-emoticon-tooltip-name{font-size:12px;color:var(--text-muted)}.chat-emoticon-tooltip-names{font-size:11px;color:var(--text-secondary);text-align:center}.chat-emoticon-tooltip-adopt{background:var(--accent);color:var(--accent-fg);border:none;cursor:pointer;font-size:11px;padding:2px 10px;border-radius:4px;font-weight:600}.chat-emoticon-tooltip-adopt:hover{opacity:.85}.chat-msg-actions{position:absolute;top:-14px;right:16px;display:none;background:var(--bg-darkest);border:1px solid var(--border);border-radius:4px;z-index:10}.chat-msg-group:hover .chat-msg-actions,.chat-msg-continuation:hover .chat-msg-actions,.chat-msg-action:hover .chat-msg-actions{display:flex}.chat-msg-action-btn{background:none;border:none;color:var(--text-secondary);padding:6px 8px;cursor:pointer;font-size:16px}.chat-msg-action-btn:hover{background:var(--bg-hover);color:var(--text-primary)}.chat-emoji-picker-overlay{position:fixed;inset:0;z-index:100;display:none}.chat-emoji-picker-overlay.show{display:block}.chat-emoji-picker{position:absolute;background:var(--bg-darkest);border:1px solid var(--border);border-radius:8px;padding:8px;box-shadow:0 4px 20px #0000004d;z-index:101;max-width:280px;width:280px;display:flex;flex-direction:column;max-height:320px}.chat-emoji-picker-scroll{overflow-y:auto;overscroll-behavior:contain;min-height:0;flex:1}.chat-emoji-grid{display:flex;flex-wrap:wrap;gap:2px}.chat-emoji-grid button{background:none;border:none;font-size:22px;cursor:pointer;padding:4px;border-radius:4px;width:36px;height:36px;display:flex;align-items:center;justify-content:center}.chat-emoji-grid button:hover{background:var(--bg-hover)}.chat-emoji-active{background:var(--accent)!important;outline:2px solid var(--accent-line);outline-offset:-2px;opacity:.8}.chat-emoji-picker-search{width:100%;padding:6px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text-primary);font-size:14px;margin-bottom:6px;outline:none;flex-shrink:0}.chat-emoji-picker-search:focus{border-color:var(--accent-line)}.chat-emoticon-section{border-bottom:1px solid var(--border);padding-bottom:6px;margin-bottom:6px}.chat-emoticon-section-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:4px;font-size:11px;color:var(--text-muted);text-transform:uppercase;letter-spacing:.5px}.chat-emoticon-section-label{font-size:11px;color:var(--text-muted);text-transform:uppercase;letter-spacing:.5px;margin:6px 0 4px;padding:0 2px}.chat-emoticon-btn{position:relative;width:36px;height:36px;display:flex;align-items:center;justify-content:center;border:none;background:transparent;border-radius:4px;cursor:pointer;padding:2px}.chat-emoticon-btn:hover{background:var(--bg-hover)}.chat-emoticon-img{width:28px;height:28px;object-fit:contain}.chat-emoticon-add-btn{background:none;border:1px dashed var(--border);color:var(--text-muted);cursor:pointer;font-size:11px;padding:2px 8px;border-radius:4px}.chat-emoticon-add-btn:hover{border-color:var(--accent-line);color:var(--text-primary)}.chat-emoticon-grid{display:flex;flex-wrap:wrap;gap:2px}.chat-emoticon-grid button{background:none;border:none;cursor:pointer;padding:2px;border-radius:4px;width:36px;height:36px;display:flex;align-items:center;justify-content:center;position:relative}.chat-emoticon-grid button:hover{background:var(--bg-hover)}.chat-emoticon-grid button img{width:28px;height:28px;object-fit:contain}.chat-emoticon-adopt{position:absolute;top:-2px;right:-2px;width:14px;height:14px;border-radius:50%;background:var(--accent);color:var(--accent-fg);border:none;cursor:pointer;font-size:10px;display:none;align-items:center;justify-content:center;line-height:1}.chat-emoticon-grid button:hover .chat-emoticon-adopt{display:flex}.chat-emoticon-remove{position:absolute;top:-4px;right:-4px;width:16px;height:16px;border-radius:50%;background:var(--bg-hover);color:var(--text-muted);border:1px solid var(--border);cursor:pointer;font-size:10px;display:none;align-items:center;justify-content:center;line-height:1}.chat-emoticon-grid button:hover .chat-emoticon-remove{display:flex}.chat-emoticon-remove:hover{background:#ed4245!important;color:#fff!important;border-color:#ed4245!important}.chat-emoticon-remove.confirm{background:#ed4245;color:#fff;border-color:#ed4245;display:flex}.chat-emoticon-inline{height:1.5em;vertical-align:middle;display:inline}.chat-emoticon-dialog{padding:8px;display:flex;flex-direction:column;gap:8px}.chat-emoticon-dialog input[type=text]{width:100%;padding:6px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text-primary);font-size:14px;outline:none}.chat-emoticon-dialog input[type=text]:focus{border-color:var(--accent-line)}.chat-emoticon-dialog-preview{width:80px;height:80px;border-radius:4px;background:var(--bg-hover);display:flex;align-items:center;justify-content:center;overflow:hidden;align-self:center;color:var(--text-muted);font-size:24px}.chat-emoticon-dialog-preview:hover{background:var(--bg-input);border:1px dashed var(--border)}.chat-emoticon-dialog-preview img{width:100%;height:100%;object-fit:contain}.chat-emoticon-dialog-counter{font-size:11px;color:var(--text-muted);text-align:center}.chat-emoticon-dialog-btns{display:flex;gap:6px;justify-content:flex-end}.chat-emoticon-dialog-btns button{padding:4px 12px;border-radius:4px;font-size:13px;cursor:pointer;border:none}.chat-emoticon-dialog .cancel-btn{background:var(--bg-hover);color:var(--text-primary)}.chat-emoticon-dialog .save-btn{background:var(--accent);color:var(--accent-fg);font-weight:600}.chat-emoticon-dialog .save-btn:disabled{opacity:.5;cursor:default}.chat-font-dialog{padding:8px;display:flex;flex-direction:column;gap:8px}.chat-font-dialog input[type=text]{width:100%;padding:6px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text-primary);font-size:14px;outline:none}.chat-font-dialog input[type=text]:focus{border-color:var(--accent-line)}.chat-font-dialog-preview{padding:10px;border-radius:4px;background:var(--bg-hover);text-align:center;font-size:18px;color:var(--text-primary);min-height:48px;display:flex;align-items:center;justify-content:center}.chat-font-dialog-filebtn{background:none;border:1px dashed var(--border);color:var(--text-muted);cursor:pointer;font-size:13px;padding:6px 12px;border-radius:4px;text-align:center}.chat-font-dialog-filebtn:hover{border-color:var(--accent-line);color:var(--text-primary)}.chat-font-dialog-btns{display:flex;gap:6px;justify-content:flex-end}.chat-font-dialog-btns button{padding:4px 12px;border-radius:4px;font-size:13px;cursor:pointer;border:none}.chat-font-dialog .cancel-btn{background:var(--bg-hover);color:var(--text-primary)}.chat-font-dialog .save-btn{background:var(--accent);color:var(--accent-fg);font-weight:600}.chat-font-dialog .save-btn:disabled{opacity:.5;cursor:default}.chat-font-list{display:flex;flex-direction:column;gap:2px;max-height:120px;overflow-y:auto;overscroll-behavior:contain}.chat-font-list-item{display:flex;align-items:center;justify-content:space-between;padding:4px 8px;border-radius:4px;font-size:13px;color:var(--text-primary)}.chat-font-list-item:hover{background:var(--bg-hover)}.chat-font-list-item .font-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-font-list-remove{width:18px;height:18px;border-radius:50%;background:var(--bg-hover);color:var(--text-muted);border:1px solid var(--border);cursor:pointer;font-size:10px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.chat-font-list-remove:hover,.chat-font-list-remove.confirm{background:#ed4245;color:#fff;border-color:#ed4245}.chat-msg-menu-wrap{position:relative}.chat-msg-menu{display:none;position:absolute;top:100%;right:0;margin-top:2px;background:var(--bg-darkest);border:1px solid var(--border);border-radius:6px;padding:4px 0;min-width:120px;z-index:20;box-shadow:0 4px 12px #0000004d}.chat-msg-menu.show{display:block}.chat-msg-menu-item{display:flex;align-items:center;gap:8px;width:100%;padding:6px 12px;background:none;border:none;color:var(--text-primary);font-size:13px;cursor:pointer;text-align:left}.chat-msg-menu-item:hover{background:var(--bg-hover)}.chat-msg-menu-item.danger{color:#ed4245}.chat-msg-menu-item.danger:hover{background:#ed42451a}.chat-typing-bar{padding:0 16px;min-height:22px;font-size:12px;color:var(--text-muted);font-style:italic;flex-shrink:0}.chat-llm-status{padding:0 16px;min-height:22px;font-size:12px;color:var(--text-muted);font-style:italic;flex-shrink:0;font-family:monospace}.chat-stop-btn{display:inline-flex;align-items:center;gap:4px;padding:2px 10px;border:1px solid var(--border);border-radius:4px;background:var(--bg-mid);color:var(--text-secondary);font-size:12px;font-family:inherit;cursor:pointer;font-style:normal}.chat-stop-btn:hover{background:var(--bg-hover);color:var(--text-primary)}.chat-input-wrapper{flex-shrink:0;padding:0 16px 16px;position:relative}.chat-autocomplete{display:none;position:absolute;bottom:100%;left:0;right:0;background:var(--bg-darkest);border:1px solid var(--border);border-radius:8px;max-height:200px;overflow-y:auto;overscroll-behavior:contain;box-shadow:0 -4px 16px #0000004d;z-index:50;margin-bottom:4px}.chat-autocomplete.show{display:block}.chat-autocomplete-item{display:flex;align-items:center;gap:8px;padding:6px 12px;cursor:pointer;font-size:14px;color:var(--text-primary)}.chat-autocomplete-item:hover,.chat-autocomplete-item.active{background:var(--bg-hover)}.chat-autocomplete-item-emoji{font-size:20px;width:28px;text-align:center;flex-shrink:0}.chat-autocomplete-item-emoji img{width:24px;height:24px;object-fit:contain}.chat-autocomplete-item-name{color:var(--text-secondary);font-size:12px}.chat-autocomplete-item-desc{color:var(--text-muted);font-size:11px;margin-left:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:50%}.chat-autocomplete-item-cmd{font-weight:600;font-size:14px;color:var(--text-primary);min-width:0}.chat-autocomplete-pop{position:fixed;z-index:50;min-width:200px;max-width:340px;max-height:200px;overflow-y:auto;overscroll-behavior:contain;background:var(--editor-fill, Canvas);color:var(--editor-line, currentColor);border:1px solid var(--border);border-radius:8px;box-shadow:0 4px 16px #0000004d}.chat-autocomplete-item-icon{width:20px;height:20px;flex-shrink:0;color:var(--text-muted)}.chat-reply-bar{display:none;padding:8px 12px;background:var(--bg-mid);border-radius:8px 8px 0 0;border-left:3px solid var(--accent-line);align-items:center;gap:8px;font-size:13px;color:var(--text-secondary)}.chat-reply-bar.show{display:flex}.chat-reply-bar-text{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-reply-bar-close{background:none;border:none;font-size:16px;cursor:pointer;color:var(--text-secondary)}.chat-reply-bar-close:hover{color:var(--text-primary)}.chat-paste-preview{display:none;padding:8px 12px;background:var(--bg-mid);align-items:center;gap:8px;flex-wrap:wrap}.chat-paste-preview.show{display:flex}.chat-paste-preview img{max-height:50px;border-radius:4px}.chat-paste-preview video{max-height:50px;border-radius:4px}.chat-paste-preview-close{background:none;border:none;font-size:16px;cursor:pointer;color:var(--text-secondary);margin-left:auto}.chat-paste-file{display:flex;align-items:center;gap:6px;background:var(--bg-hover);border-radius:6px;padding:4px 8px;font-size:12px;color:var(--text-secondary);max-width:200px}.chat-paste-file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-paste-file-remove{background:none;border:none;cursor:pointer;color:var(--text-secondary);padding:0;display:flex;align-items:center}.chat-paste-file-remove:hover{color:var(--text-primary)}.chat-paste-embed{display:flex;align-items:center;gap:6px;background:var(--bg-hover);border-radius:6px;padding:4px 8px;font-size:12px;color:var(--text-secondary);max-width:200px}.chat-paste-embed-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-selection-chip{display:inline-flex;align-items:center;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background:var(--bg-hover);color:var(--text-secondary);border-radius:6px;padding:2px 8px;margin:0 4px;font-size:12px}.chat-paste-embed-remove{background:none;border:none;cursor:pointer;color:var(--text-secondary);padding:0;display:flex;align-items:center}.chat-paste-embed-remove:hover{color:var(--text-primary)}.chat-sidebar-pinned-wrap{position:relative}.chat-sidebar-pinned-wrap[data-drop-position=above]:before{content:"";position:absolute;top:-2px;left:4px;right:4px;height:2px;background:var(--accent);border-radius:1px;z-index:10}.chat-sidebar-pinned-wrap[data-drop-position=below]:after{content:"";position:absolute;bottom:-2px;left:4px;right:4px;height:2px;background:var(--accent);border-radius:1px;z-index:10}.chat-sidebar-pinned-wrap.dragging{opacity:.4}.chat-drop-overlay{display:none;position:absolute;inset:0;z-index:100;background:color-mix(in oklch,var(--theme) 20%,black 60%);align-items:center;justify-content:center;font-size:18px;color:var(--text-primary);font-weight:600;border:3px dashed var(--accent-line);border-radius:12px;pointer-events:none}.chat-drop-overlay.show{display:flex}.chat-msg-video-wrap{max-width:350px;border-radius:8px;overflow:hidden;margin-top:4px;position:relative}.chat-msg-video{width:100%;display:block;border-radius:8px;cursor:pointer}.chat-lightbox{display:none;position:absolute;inset:0;z-index:200;background:#000000d9;align-items:center;justify-content:center;cursor:zoom-out}.chat-lightbox.show{display:flex}.chat-lightbox img,.chat-lightbox video{max-width:95%;max-height:95%;object-fit:contain;border-radius:4px;cursor:default}.chat-lightbox video{background:#000}.chat-msg-file{display:inline-flex;align-items:center;gap:6px;background:var(--bg-hover);border-radius:6px;padding:6px 10px;margin-top:4px;font-size:13px;color:var(--text-secondary);cursor:pointer;text-decoration:none}.chat-msg-file:hover{background:var(--bg-input);color:var(--text-primary)}.chat-msg-file-icon{flex-shrink:0}.chat-input-row{display:flex;gap:0;background:var(--bg-input);border-radius:8px;padding:4px;align-items:flex-end}.chat-input{width:100%;padding:8px 12px;border:none;font-size:15px;outline:none;background:transparent;color:var(--text-primary);font-family:inherit;resize:none;max-height:120px;min-height:24px;line-height:1.4;position:relative;z-index:1}.chat-input::placeholder{color:var(--text-muted)}.chat-input-btn{width:36px;height:36px;background:none;border:none;color:var(--text-muted);cursor:pointer;font-size:20px;border-radius:4px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.chat-input-btn:hover{color:var(--text-primary)}.chat-input-btn.recording{color:#ed4245;animation:pulse 1s infinite}@keyframes pulse{0%,to{transform:scale(1)}50%{transform:scale(1.15)}}.chat-recording-bar{display:flex;align-items:center;gap:10px;background:var(--bg-input);border-radius:8px;padding:8px 12px;animation:fadeIn .15s ease}.chat-recording-overlay{position:absolute;inset:0;z-index:3}@keyframes fadeIn{0%{opacity:0;transform:scale(.98)}to{opacity:1;transform:scale(1)}}.chat-recording-dot{width:10px;height:10px;border-radius:50%;background:#ed4245;flex-shrink:0;animation:recPulse 1s ease-in-out infinite}@keyframes recPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.8)}}.chat-recording-time{font-size:14px;color:var(--text-primary);font-variant-numeric:tabular-nums;min-width:40px}.chat-recording-viz{flex:1;height:24px;display:flex;align-items:center;gap:2px;overflow:hidden}.chat-recording-viz-bar{width:3px;border-radius:2px;background:var(--accent);min-height:3px;transition:height .1s ease}.chat-recording-cancel{background:none;border:none;color:var(--text-muted);cursor:pointer;font-size:13px;padding:4px 10px;border-radius:4px}.chat-recording-cancel:hover{color:var(--text-primary);background:var(--bg-hover)}.chat-recording-send{background:var(--accent);color:var(--accent-fg);border:none;cursor:pointer;padding:6px 14px;border-radius:6px;font-size:13px;font-weight:600}.chat-recording-send:hover{background:var(--accent-hover)}.chat-gif-toggle{width:36px;height:36px;border:none;cursor:pointer;border-radius:4px;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:none;color:var(--text-muted);font-size:20px;position:relative;overflow:hidden}.chat-gif-toggle:hover{color:var(--text-primary)}.chat-gif-toggle.active{color:var(--accent-text)}.chat-gif-toggle video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:4px;display:none}.chat-gif-toggle.active video{display:block}.chat-gif-toggle.active .chat-gif-icon{display:none}.chat-gif-toggle.recording{pointer-events:none;position:relative;overflow:visible}.chat-gif-progress{position:absolute;top:-10px;left:-10px;width:calc(100% + 20px);height:calc(100% + 20px);z-index:20;pointer-events:none}.chat-gif-progress circle.chat-gif-progress-bg{fill:none;stroke:#00000026;stroke-width:2}.chat-gif-progress circle.chat-gif-progress-fg{fill:none;stroke:var(--accent-line);stroke-width:2;stroke-linecap:round;transform:rotate(-90deg);transform-origin:center;transition:stroke-dashoffset .1s linear}.chat-input-row.processing .chat-input,.chat-input-row.processing .chat-input-wrap,.chat-input-row.processing .chat-input-btn{opacity:.5;pointer-events:none}.chat-empty{flex:1;display:flex;align-items:center;justify-content:center;color:var(--text-muted);font-size:16px}@keyframes chat-skeleton-pulse{0%,to{opacity:.3}50%{opacity:.6}}.chat-msg-loading{opacity:.5}.chat-skeleton{background:var(--bg-hover);animation:chat-skeleton-pulse 1.5s ease-in-out infinite}.chat-skeleton-line{height:14px;background:var(--bg-hover);border-radius:4px;margin:4px 0;animation:chat-skeleton-pulse 1.5s ease-in-out infinite;width:60%}.chat-skeleton-line.short{width:30%}.chat-main{display:flex;flex-direction:column;flex:1;min-width:0;position:relative;height:100%}.chat-sidebar{display:none;flex-direction:column;width:40%;min-width:15%;border-left:1px solid var(--border);background:var(--bg-darkest);overflow:hidden;position:relative}.chat-sidebar.visible{display:flex}.chat-sidebar.drop-target{display:flex;min-width:60px;width:60px;align-items:center;justify-content:center;border:2px dashed var(--accent-line);background:color-mix(in oklch,var(--accent) 10%,var(--bg-darkest))}.chat-sidebar.drop-target:after{content:"Pin";font-size:11px;color:var(--accent-text);font-weight:600;pointer-events:none}.chat-sidebar.visible.drop-target{width:40%;min-width:15%}.chat-sidebar.visible.drop-target:after{display:none}.chat-sidebar.collapsed{width:0!important;min-width:0!important;border-left:none;overflow:hidden}.chat-root.sidebar-left{flex-direction:row-reverse}.chat-root.sidebar-left .chat-sidebar{border-left:none;border-right:1px solid var(--border)}.chat-root.sidebar-left .chat-sidebar-resize{left:auto;right:-3px}.chat-sidebar-resize{position:absolute;left:-3px;top:0;bottom:0;width:6px;cursor:col-resize;z-index:10}.chat-sidebar-resize:hover,.chat-sidebar-resize.dragging{background:var(--accent);opacity:.3}.chat-sidebar-header{display:flex;align-items:center;justify-content:space-between;padding:4px 6px;border-bottom:1px solid var(--border);flex-shrink:0}.chat-sidebar-header-title{font-size:11px;color:var(--text-muted);text-transform:uppercase;letter-spacing:.5px}.chat-sidebar-collapse-btn{background:none;border:none;cursor:pointer;padding:2px 4px;color:var(--text-muted);display:flex;align-items:center}.chat-sidebar-collapse-btn:hover{color:var(--text-primary)}.chat-sidebar-pinned{flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:0;padding:4px}.chat-sidebar-pinned:empty{display:none}.chat-sidebar-pinned-wrap{position:relative;display:flex;flex-direction:column;flex:1;min-height:200px;border:1px solid var(--border);border-radius:6px;overflow:hidden;margin-bottom:4px;background:var(--bg-mid)}.chat-sidebar-pinned-toolbar{position:absolute;top:4px;right:4px;z-index:10;display:flex;gap:2px;opacity:0;transition:opacity .15s;pointer-events:auto}.chat-sidebar-pinned-wrap:hover .chat-sidebar-pinned-toolbar{opacity:1}.chat-sidebar-pinned-toolbar button{background:var(--bg-darkest);border:1px solid var(--border);border-radius:4px;color:var(--text-muted);cursor:pointer;padding:2px 4px;font-size:10px;display:flex;align-items:center;gap:2px;line-height:1}.chat-sidebar-pinned-toolbar button:hover{color:var(--text-primary);background:var(--bg-mid)}.chat-sidebar-pinned-toolbar button svg{width:12px;height:12px}.chat-sidebar-pinned iframe{width:100%;flex:1;border:none;border-radius:4px;min-height:200px;background:var(--bg-mid)}.chat-sidebar-pinned-info{background:var(--bg-darkest);border-bottom:1px solid var(--border);font-size:11px;color:var(--text-secondary)}.chat-sidebar-pinned-info-main{display:flex;align-items:center;gap:4px;padding:3px 8px;cursor:pointer}.chat-sidebar-pinned-info-main:hover{background:var(--bg-hover)}.chat-sidebar-pinned-info-title{flex:1;font-weight:600;color:var(--text-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}.chat-sidebar-pinned-info-chevron{font-size:10px;transition:transform .15s;flex-shrink:0}.chat-sidebar-pinned-info-chevron.open{transform:rotate(90deg)}.chat-sidebar-pinned-info-details{padding:2px 8px 4px}.chat-sidebar-pinned-info-row{display:flex;align-items:center;gap:4px;padding:1px 0}.chat-sidebar-pinned-info-label{color:var(--text-muted);font-size:10px;min-width:24px;flex-shrink:0}.chat-sidebar-pinned-info-value{font-family:monospace;font-size:10px;color:var(--text-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-sidebar-pinned-info-url{cursor:pointer}.chat-sidebar-pinned-info-url:hover{color:var(--text-primary);text-decoration:underline}.chat-sidebar-pinned-info-editable{cursor:pointer;border-bottom:1px dashed var(--text-muted)}.chat-sidebar-pinned-info-editable:hover{color:var(--text-primary)}.chat-sidebar-pinned-info-input{font-family:monospace;font-size:10px;background:var(--bg-input);border:1px solid var(--border);border-radius:3px;color:var(--text-primary);padding:1px 4px;flex:1;min-width:0}.chat-sidebar-pinned-resize-handle{height:6px;cursor:row-resize;flex-shrink:0;background:transparent;position:relative}.chat-sidebar-pinned-resize-handle:after{content:"";position:absolute;left:20%;right:20%;top:2px;height:2px;border-radius:1px;background:var(--border);opacity:0;transition:opacity .15s}.chat-sidebar-pinned-resize-handle:hover:after,.chat-sidebar-pinned-resize-handle.active:after{opacity:1}.chat-sidebar-pinned-resize-handle.active:after{background:var(--accent)}.chat-sidebar-status{padding:4px 8px;font-size:11px;color:var(--text-muted);text-align:center}.chat-sidebar-toggle-btn{background:none;border:none;color:var(--text-muted);cursor:pointer;padding:2px 4px;border-radius:4px;display:flex;align-items:center}.chat-sidebar-toggle-btn:hover{background:var(--bg-hover);color:var(--text-primary)}.chat-embed-pin{cursor:pointer}.chat-embed-pin.pinned{color:var(--accent-text)}.chat-msg-name-computer{color:var(--accent-text);font-style:italic}.chat-avatar.computer{background:var(--accent-soft);overflow:hidden}.chat-avatar.computer img{width:100%;height:100%;object-fit:cover;display:block}.computer-presence img{width:100%;height:100%;object-fit:cover;display:block;border-radius:50%}.chat-dialog-overlay{position:fixed;inset:0;z-index:100;background:#00000080;display:flex;align-items:center;justify-content:center;animation:fadeIn .15s ease}.chat-emoticon-dialog,.chat-font-dialog{background:var(--bg-dark);border:1px solid var(--border);border-radius:8px;min-width:300px;max-width:400px;box-shadow:0 8px 32px #0006}.chat-plugin-panel{background:var(--bg-dark);border:1px solid var(--border);border-radius:8px;min-width:300px;max-width:420px;max-height:70vh;display:flex;flex-direction:column;box-shadow:0 8px 32px #0006}.chat-plugin-panel-header{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;border-bottom:1px solid var(--border);font-size:14px;font-weight:600}.chat-plugin-panel-close{background:none;border:none;color:var(--text-muted);cursor:pointer;font-size:18px;line-height:1}.chat-plugin-panel-close:hover{color:var(--text-primary)}.chat-plugin-panel-body{padding:6px;overflow-y:auto;display:flex;flex-direction:column;gap:1px}.chat-plugin-section{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--text-muted);padding:10px 6px 4px}.chat-plugin-item{display:flex;align-items:center;gap:8px;padding:5px 6px;border-radius:4px;cursor:pointer;font-size:13px;color:var(--text-primary)}.chat-plugin-item:hover{background:var(--bg-hover)}.chat-plugin-item input{cursor:pointer}.chat-plugin-item-locked,.chat-plugin-item-locked input{cursor:default}.chat-plugin-item-locked{opacity:.55}.chat-plugin-item-locked:hover{background:none}.chat-plugin-id{margin-left:auto;font-family:ui-monospace,monospace;font-size:11px;color:var(--text-muted)}.chat-emoticon-dialog-header,.chat-font-dialog-header{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;border-bottom:1px solid var(--border);font-size:14px;font-weight:600}.chat-emoticon-dialog-close,.chat-font-dialog-close{background:none;border:none;color:var(--text-muted);cursor:pointer;font-size:18px;line-height:1}.chat-emoticon-dialog-close:hover,.chat-font-dialog-close:hover{color:var(--text-primary)}.chat-emoticon-dialog-body,.chat-font-dialog-body{padding:12px;display:flex;flex-direction:column;gap:8px}.chat-emoticon-dialog-footer,.chat-font-dialog-footer{display:flex;gap:6px;justify-content:flex-end;padding:8px 12px;border-top:1px solid var(--border)}.chat-emoticon-dialog-footer button,.chat-font-dialog-footer button{padding:6px 14px;border-radius:6px;font-size:13px;cursor:pointer;border:none}.chat-emoticon-dialog-save,.chat-font-dialog-save{background:var(--accent);color:var(--accent-fg);font-weight:600}.chat-emoticon-dialog-save:disabled,.chat-font-dialog-save:disabled{opacity:.5;cursor:default}.chat-emoticon-dialog-save:not(:disabled):hover,.chat-font-dialog-save:not(:disabled):hover{background:var(--accent-hover)}.chat-emoticon-dialog-nav{display:flex;align-items:center;justify-content:center;gap:8px;font-size:12px;color:var(--text-muted)}.chat-emoticon-dialog-nav button{background:none;border:1px solid var(--border);color:var(--text-secondary);cursor:pointer;padding:2px 8px;border-radius:4px;font-size:12px}.chat-emoticon-dialog-nav button:disabled{opacity:.4;cursor:default}.chat-emoticon-dialog-nav button:not(:disabled):hover{background:var(--bg-hover)}.chat-emoticon-dialog-name,.chat-font-dialog-name{width:100%;padding:6px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text-primary);font-size:14px;outline:none}.chat-emoticon-dialog-name:focus,.chat-font-dialog-name:focus{border-color:var(--accent-line)}.chat-font-dialog-list{display:flex;flex-direction:column;gap:2px;max-height:120px;overflow-y:auto}.chat-font-dialog-item{display:flex;align-items:center;justify-content:space-between;padding:4px 8px;border-radius:4px;font-size:13px}.chat-font-dialog-item:hover{background:var(--bg-hover)}.chat-font-dialog-remove{width:20px;height:20px;border-radius:50%;background:var(--bg-hover);color:var(--text-muted);border:1px solid var(--border);cursor:pointer;font-size:12px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.chat-font-dialog-remove:hover{background:#ed4245;color:#fff;border-color:#ed4245}.chat-font-dialog-choose{background:none;border:1px dashed var(--border);color:var(--text-muted);cursor:pointer;font-size:13px;padding:8px 12px;border-radius:4px;text-align:center;width:100%}.chat-font-dialog-choose:hover{border-color:var(--accent-line);color:var(--text-primary)}.chat-font-dialog-preview{padding:10px;border-radius:4px;background:var(--bg-hover);text-align:center;font-size:16px;color:var(--text-primary)}.chat-gif-toggle .chat-gif-progress{position:absolute;inset:-4px;width:calc(100% + 8px);height:calc(100% + 8px);z-index:20;pointer-events:none}.chat-time-gap{text-align:center;color:var(--text-muted);font-size:11px;padding:8px 0 4px;position:relative}.chat-time-gap:before{content:"";position:absolute;left:20%;right:20%;top:50%;border-top:1px solid var(--border);z-index:0}.chat-time-gap span{position:relative;z-index:1;background:var(--bg-dark);padding:0 8px}.chat-model-dialog{background:var(--bg-mid);border:1px solid var(--border);border-radius:8px;width:420px;max-width:90vw;padding:0;overflow:hidden}.chat-model-dialog-header{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid var(--border);font-weight:600;font-size:14px}.chat-model-dialog-close{background:none;border:none;color:var(--text-muted);cursor:pointer;font-size:20px;padding:0 4px}.chat-model-dialog-close:hover{color:var(--text-primary)}.chat-model-dialog-tabs{display:flex;border-bottom:1px solid var(--border)}.chat-model-dialog-tabs button{flex:1;background:none;border:none;color:var(--text-secondary);padding:8px 12px;cursor:pointer;font-size:13px;border-bottom:2px solid transparent}.chat-model-dialog-tabs button:hover{color:var(--text-primary)}.chat-model-dialog-tabs button.active{color:var(--accent-text);border-bottom-color:var(--accent-line)}.chat-model-dialog-body{padding:12px 16px;min-height:120px}.chat-model-dialog-label{display:block;font-size:12px;color:var(--text-secondary);margin-bottom:10px}.chat-model-dialog-input{display:block;width:100%;margin-top:4px;padding:6px 8px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text-primary);font-size:13px;outline:none}.chat-model-dialog-input:focus{border-color:var(--accent-line)}select.chat-model-dialog-input{flex:1}.chat-model-dialog-btn{background:var(--bg-hover);border:1px solid var(--border);border-radius:4px;color:var(--text-primary);padding:6px 12px;cursor:pointer;font-size:13px}.chat-model-dialog-btn:hover{background:var(--accent-soft)}.chat-model-dialog-btn.primary{background:var(--accent);color:var(--accent-fg);border-color:var(--accent-line)}.chat-model-dialog-btn.primary:hover{opacity:.9}.chat-model-dialog-footer{display:flex;gap:8px;justify-content:flex-end;padding:12px 16px;border-top:1px solid var(--border)}@media (max-width: 600px){.chat-root,.chat-root.sidebar-left{flex-direction:column-reverse!important}.chat-sidebar{width:100%!important;min-width:0!important;border-left:none!important;border-right:none!important;border-bottom:1px solid var(--border);max-height:50%}.chat-sidebar.visible{max-height:50%}.chat-sidebar.drop-target{width:100%!important;min-width:0!important;height:60px}.chat-sidebar.visible.drop-target{width:100%!important}.chat-sidebar-resize{display:none}.chat-msg-group{padding:2px 10px;gap:8px}.chat-msg-continuation{padding:0 10px 0 48px}.chat-msg-continuation.has-gif{padding-left:10px}.chat-msg-action{padding:4px 10px}.chat-avatar-col{width:30px}.chat-avatar{width:30px;height:30px;font-size:14px}.chat-msg-gif-inline{width:30px;height:30px}.chat-presence-bar{padding:4px 10px;gap:6px;flex-wrap:wrap}.chat-input-wrapper{padding:0 8px 8px}.chat-input{padding:6px 8px;font-size:14px}.chat-input-btn,.chat-gif-toggle{width:32px;height:32px;font-size:18px}.chat-reply-bar{padding:6px 8px;font-size:12px}.chat-msg-reply-ref{padding-left:24px;font-size:12px}.chat-msg-reply-ref:before{left:12px}.chat-msg-reply-ref-text{max-width:180px}.chat-voice-note{max-width:100%}.chat-msg-embed{height:200px}.chat-msg-video-wrap,.chat-msg-image-wrap{max-width:100%}.chat-code-block code{font-size:12px}.shiki{font-size:12px!important}.chat-emoji-picker{max-width:260px;width:260px}.chat-emoticon-dialog,.chat-font-dialog{min-width:0;max-width:calc(100vw - 24px);width:calc(100vw - 24px)}.chat-model-dialog{width:calc(100vw - 24px)}.chat-autocomplete-item{padding:6px 8px;font-size:13px}.chat-typing-bar,.chat-llm-status{padding:0 10px}.chat-recording-bar{padding:6px 8px}.chat-sidebar-pinned-wrap{min-height:120px}.chat-sidebar-toggle-btn svg,.chat-sidebar-collapse-btn svg{transform:rotate(90deg)}.chat-time-gap:before{left:10%;right:10%}}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.chat-root{--bg-dark: var(--editor-fill, var(--studio-fill, oklch(.15 .03 270)));--bg-darkest: var(--editor-fill-offset-20, var(--studio-fill-offset-20, oklch(.12 .02 270)));--bg-mid: var(--editor-fill-offset-10, var(--studio-fill-offset-10, oklch(.19 .03 270)));--bg-input: var(--editor-fill, var(--studio-fill, oklch(.17 .03 270)));--bg-hover: var(--editor-fill-offset-20, var(--studio-fill-offset-20, oklch(.22 .04 270)));--border: var(--editor-fill-offset-20, var(--studio-fill-offset-20, oklch(.28 .05 270)));--accent: var(--studio-primary-fill, var(--studio-primary, oklch(.55 .18 270)));--accent-line: var(--studio-primary-line, var(--editor-fill, var(--studio-fill, oklch(1 0 0))));--accent-text: var(--studio-primary-text, var(--accent));--accent-hover: color-mix(in oklch, var(--accent), var(--studio-line, black) 18%);--accent-soft: color-mix(in oklch, var(--accent), transparent 85%);--accent-fg: var(--accent-line);--theme: var(--accent);--text-primary: var(--studio-line, oklch(1 0 0));--text-secondary: var(--studio-line-offset-30, oklch(1 0 0 / .6));--text-muted: var(--studio-line-offset-50, oklch(1 0 0 / .4));--link: var(--studio-link-text, var(--studio-link, oklch(.75 .15 250)))}.chat-root{display:flex;flex-direction:row;position:absolute;inset:0;font-family:var(--studio-family-sans, system-ui,-apple-system,sans-serif);background:var(--bg-dark);color:var(--text-primary);box-sizing:border-box;font-size:var(--studio-font-size, 15px);overflow:hidden;user-select:text;-webkit-user-select:text;height:100%}.chat-context-empty{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;text-align:center;padding:24px;color:var(--text-secondary, #888);font-family:var(--studio-family-sans, system-ui,-apple-system,sans-serif);font-size:var(--studio-font-size, 15px)}.chat-root *,.chat-root *:before,.chat-root *:after{box-sizing:border-box}.chat-root a{color:var(--link);text-decoration:underline}.chat-root a:hover{text-decoration:none}.chat-theme-btn{background:none;border:none;color:var(--text-muted);cursor:pointer;font-size:16px;padding:2px 6px;border-radius:4px;position:relative}.chat-theme-btn:hover,.chat-notify-btn:hover{background:var(--bg-hover);color:var(--text-primary)}.chat-notify-btn{background:none;border:none;color:var(--text-muted);cursor:pointer;padding:2px 4px;border-radius:4px;display:flex;align-items:center;position:relative}.chat-notify-menu{display:none;position:absolute;top:100%;right:0;margin-top:4px;background:var(--bg-darkest);border:1px solid var(--border);border-radius:8px;padding:8px;min-width:180px;z-index:200}.chat-notify-menu.show{display:block}.chat-notify-menu-row{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 4px;font-size:13px;color:var(--text-secondary);cursor:pointer;border-radius:4px}.chat-notify-menu-row:hover{background:var(--bg-hover)}.chat-notify-toggle{width:32px;height:18px;border-radius:9px;border:none;cursor:pointer;background:var(--bg-hover);position:relative;transition:background .15s;flex-shrink:0}.chat-notify-toggle.on{background:var(--accent)}.chat-notify-toggle:after{content:"";position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;background:#fff;transition:transform .15s}.chat-notify-toggle.on:after{transform:translate(14px)}.chat-presence-bar{padding:4px 16px;background:var(--bg-darkest);border-bottom:1px solid var(--border);display:flex;gap:8px;align-items:center;flex-shrink:0;min-height:24px;position:relative;z-index:50;overflow:visible}.chat-presence-user{display:flex;align-items:center;gap:4px;font-size:12px;color:var(--text-secondary);transition:opacity .2s}.chat-presence-user.away{opacity:.9}.chat-presence-avatar{width:18px;height:18px;border-radius:50%;overflow:hidden;flex-shrink:0;background:var(--bg-hover);display:flex;align-items:center;justify-content:center;font-size:10px;color:var(--text-muted)}.chat-presence-avatar img{width:100%;height:100%;object-fit:cover}.chat-messages{flex:1;overflow-y:auto;padding:8px 0;display:flex;flex-direction:column;min-height:0;height:100%;overflow:scroll}.chat-msg-group{padding:2px 16px;display:flex;gap:12px;position:relative}.chat-msg-group:hover{background:var(--bg-hover)}.chat-avatar-col{width:40px;flex-shrink:0;padding-top:2px}.chat-avatar{width:40px;height:40px;border-radius:50%;background:var(--accent);display:flex;align-items:center;justify-content:center;font-size:18px;font-weight:700;color:var(--accent-fg);overflow:hidden;cursor:pointer;position:relative;user-select:none}.chat-avatar img{width:100%;height:100%;object-fit:cover}.chat-avatar-view{display:block;width:100%;height:100%}.chat-avatar-view img{width:100%;height:100%;object-fit:cover}.chat-avatar.gif-selfie,.chat-avatar.gif-selfie img{border-radius:4px}.chat-avatar.cat-ears:before{content:"";position:absolute;top:-6px;left:2px;border-left:8px solid transparent;border-right:8px solid transparent;border-bottom:12px solid var(--accent);z-index:2}.chat-avatar.cat-ears:after{content:"";position:absolute;top:-6px;right:2px;border-left:8px solid transparent;border-right:8px solid transparent;border-bottom:12px solid var(--accent);z-index:2}.chat-msg-body{flex:1;min-width:0}.chat-msg-header{display:flex;align-items:baseline;gap:8px}.chat-msg-name{font-weight:600;font-size:15px;color:var(--text-primary);cursor:pointer}.chat-msg-name:hover{text-decoration:underline}.chat-msg-time{font-size:11px;color:var(--text-muted)}.chat-msg-text{color:var(--text-primary);line-height:1.45;margin-top:2px;white-space:pre-wrap;word-wrap:break-word}.chat-msg-text.emoji-only{font-size:2em;line-height:1.2}.chat-quick-replies{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}.chat-quick-reply{font:inherit;font-size:.9em;cursor:pointer;padding:4px 10px;border-radius:var(--studio-radius-round, 999px);border:1px solid var(--accent-line, currentColor);background:transparent;color:var(--accent-text, var(--text-primary))}.chat-quick-reply:hover:not(:disabled){background:var(--accent);color:var(--accent-fg)}.chat-quick-reply:disabled{opacity:.5;cursor:default}.chat-msg-text.emoji-only .chat-emoticon-inline{height:2em}.chat-msg-text code:not(.shiki code):not(.chat-code-block code){background:var(--bg-hover);padding:1px 4px;border-radius:3px;font-family:ui-monospace,monospace;font-size:.9em}.chat-msg-text a{color:var(--link);text-decoration:underline}.chat-msg-text a:hover{text-decoration:none}.chat-msg-text.streaming:after{content:"";display:inline-block;width:6px;height:1em;background:var(--accent);margin-left:2px;vertical-align:text-bottom;border-radius:1px;animation:blink-cursor .8s step-end infinite}.chat-msg-text.streaming:empty:after{content:"";width:auto;height:auto;background:none;animation:none}.chat-msg-text.streaming:empty:before{content:"• • •";letter-spacing:2px;color:var(--text-muted);font-size:18px;animation:thinking-dots 1.4s ease-in-out infinite}@keyframes thinking-dots{0%,to{opacity:.3}50%{opacity:1}}@keyframes blink-cursor{0%,to{opacity:1}50%{opacity:0}}.chat-streaming-cancel{margin-top:4px;padding:2px 10px;border-radius:4px;border:1px solid var(--border);background:var(--bg-hover);color:var(--text-muted);cursor:pointer;font-size:11px}.chat-streaming-cancel:hover{color:var(--text-primary);background:var(--bg-mid)}.chat-spoiler{background:var(--text-primary);color:transparent;border-radius:3px;padding:0 3px;cursor:pointer;transition:all .2s}.chat-spoiler.revealed{background:var(--bg-hover);color:var(--text-primary)}.chat-inverted{background:var(--text-primary);color:var(--bg-dark);padding:0 3px;border-radius:3px}.chat-underline-em{text-decoration:underline;font-style:italic}.chat-msg-action{padding:4px 16px;font-style:italic;color:var(--text-secondary);font-size:14px;position:relative}.chat-msg-action:hover{background:var(--bg-hover)}.chat-msg-action .chat-msg-action-name{font-weight:600;color:var(--text-primary)}.chat-time-gap{margin-top:16px}.chat-input-wrap{position:relative;flex:1;min-width:0}.chat-input-wrap .cm-editor{background:transparent}.chat-input-wrap .cm-editor .cm-content,.chat-input-wrap .cm-editor .cm-scroller{max-height:120px}.chat-msg-continuation{padding:0 16px 0 68px;position:relative}.chat-msg-continuation.has-gif{padding-left:16px;display:flex;gap:12px;align-items:flex-start}.chat-msg-continuation:hover{background:var(--bg-hover)}.chat-msg-inline-time{font-size:10px;color:var(--text-muted);position:absolute;top:100%;right:0;white-space:nowrap;margin-top:2px;pointer-events:none}.chat-msg-gif-inline{width:40px;height:40px;border-radius:4px;object-fit:cover;border:none;display:block;margin-right:6px;flex-shrink:0}.chat-msg-reply-ref{display:flex;align-items:center;gap:6px;font-size:13px;color:var(--text-muted);margin-bottom:2px;padding-left:36px;cursor:pointer;position:relative}.chat-msg-reply-ref:before{content:"";position:absolute;left:20px;top:50%;width:12px;height:12px;border-left:2px solid var(--border);border-top:2px solid var(--border);border-radius:6px 0 0;transform:translateY(-20%)}.chat-msg-reply-ref:hover{color:var(--text-primary)}.chat-msg-reply-ref-avatar{width:16px;height:16px;border-radius:50%;overflow:hidden;flex-shrink:0}.chat-msg-reply-ref-avatar img{width:100%;height:100%;object-fit:cover}.chat-msg-reply-ref-name{font-weight:600;color:var(--text-primary)}.chat-msg-reply-ref-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:300px}.chat-msg-image-wrap{position:relative;display:inline-block;margin-top:4px;max-width:100%}.chat-msg-image{display:block;border-radius:8px;cursor:pointer;width:100%;height:100%;object-fit:cover}.chat-msg-embed{margin-top:6px;border:1px solid var(--border);border-radius:8px;width:100%;height:300px;position:relative;background:var(--bg-surface);display:flex;flex-direction:column}.chat-msg-embed patchwork-view{width:100%;flex:1;min-height:0;display:block;overflow:hidden}.chat-msg-embed-title{padding:0 8px 0 0;font-weight:500;color:var(--text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex-shrink:1;min-width:0}.chat-embed-infobar{display:flex;align-items:center;gap:4px;padding:3px 6px;background:var(--bg-darkest);border-top:1px solid var(--border);font-size:11px;overflow:hidden;flex-wrap:wrap}.chat-embed-pill{display:inline-flex;align-items:center;gap:3px;background:var(--bg-hover);border:1px solid var(--border);border-radius:10px;padding:1px 8px;font-size:10px;color:var(--text-secondary);white-space:nowrap;cursor:default;max-width:200px;overflow:hidden;text-overflow:ellipsis;flex-shrink:0}.chat-embed-pill.clickable{cursor:pointer}.chat-embed-pill.clickable:hover{color:var(--text-primary);border-color:var(--accent-line);background:var(--bg-input)}.chat-embed-pill-label{opacity:.6;font-size:9px;text-transform:uppercase;letter-spacing:.3px}.chat-embed-tool-input{background:var(--bg-darkest);border:1px solid var(--accent-line);border-radius:10px;color:var(--text-primary);font-size:10px;padding:1px 8px;outline:none;width:120px}.chat-embed-tool-menu{position:absolute;top:100%;left:0;z-index:20;background:var(--bg-surface);border:1px solid var(--border);border-radius:6px;padding:2px;box-shadow:0 2px 8px #0000004d;white-space:nowrap;min-width:140px;max-height:200px;overflow-y:auto}.chat-embed-tool-menu button{display:block;width:100%;text-align:left;background:none;border:none;color:var(--text-secondary);font-size:11px;padding:4px 8px;cursor:pointer;border-radius:4px}.chat-embed-tool-menu button:hover{background:var(--bg-hover);color:var(--text-primary)}.chat-embed-tool-menu button.active{color:var(--accent-text);font-weight:600}.chat-embed-tool-menu .tool-menu-input-row{display:flex;gap:4px;padding:4px;border-top:1px solid var(--border);margin-top:2px}.chat-embed-tool-menu .tool-menu-input-row input{flex:1;background:var(--bg-darkest);border:1px solid var(--border);border-radius:4px;color:var(--text-primary);font-size:10px;padding:2px 6px;outline:none;min-width:0}.chat-embed-tool-menu .tool-menu-input-row input:focus{border-color:var(--accent-line)}.chat-embed-url-menu{position:absolute;top:100%;left:0;z-index:20;background:var(--bg-surface);border:1px solid var(--border);border-radius:6px;padding:2px;box-shadow:0 2px 8px #0000004d;white-space:nowrap}.chat-embed-url-menu button{display:block;width:100%;text-align:left;background:none;border:none;color:var(--text-secondary);font-size:11px;padding:4px 10px;cursor:pointer;border-radius:4px}.chat-embed-url-menu button:hover{background:var(--bg-hover);color:var(--text-primary)}.chat-resize-handle{position:absolute;bottom:0;right:0;width:16px;height:16px;cursor:nwse-resize;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .15s;z-index:5}.chat-msg-image-wrap:hover .chat-resize-handle,.chat-msg-embed:hover .chat-resize-handle{opacity:.6}.chat-resize-handle:hover{opacity:1!important}.chat-resize-handle svg{width:10px;height:10px;color:var(--text-muted)}.chat-rich-blocks{display:flex;flex-direction:column;gap:4px;margin-top:6px}.chat-rich-block{border:1px solid var(--border);border-radius:6px;overflow:hidden;background:var(--bg-darkest);font-size:13px}.chat-rich-block-header{display:flex;align-items:center;gap:6px;padding:5px 10px;cursor:pointer;border:none;background:transparent;color:var(--text-secondary);width:100%;text-align:left;font-size:12px;font-family:monospace}.chat-rich-block-header:hover{background:var(--bg-hover);color:var(--text-primary)}.chat-rich-block-chevron{transition:transform .15s;flex-shrink:0}.chat-rich-block.open .chat-rich-block-chevron{transform:rotate(90deg)}.chat-rich-block-label{opacity:.8}.chat-rich-block-body{border-top:1px solid var(--border);max-height:400px;overflow:auto}.chat-rich-block-code{margin:0;font-size:12px;line-height:1.5}.chat-rich-block-code pre{margin:0;padding:10px;overflow-x:auto}.chat-rich-block-code code{font-family:monospace;white-space:pre}.chat-rich-block-result-label{font-size:11px;color:var(--text-muted);padding:6px 10px 2px;text-transform:uppercase;letter-spacing:.5px;border-top:1px solid var(--border)}.shiki{margin:0!important;padding:10px 12px!important;font-size:13px!important;line-height:1.5!important;overflow-x:auto;border-radius:6px}.shiki code{font-family:ui-monospace,SF Mono,Cascadia Code,Menlo,Consolas,monospace!important}.chat-code-block{background:var(--bg-darkest);border:none;border-radius:6px;padding:0;margin:6px 0;overflow-x:auto;font-size:13px;line-height:1.5}.chat-code-block code{font-family:ui-monospace,SF Mono,Cascadia Code,Menlo,Consolas,monospace;white-space:pre;display:block;padding:10px 12px}.chat-msg-text .shiki{border-radius:6px;border:none;margin:6px 0}.chat-msg-text .shiki code{white-space:pre;display:block}.chat-rich-block-code .shiki{margin:0;border-radius:0}.chat-think-block{background:var(--bg-darkest);border-radius:6px;margin:6px 0;font-size:13px;overflow:hidden}.chat-think-block summary{cursor:pointer;padding:5px 10px;color:var(--text-secondary);font-family:ui-monospace,monospace;font-size:12px;user-select:none;list-style:none}.chat-think-block summary:before{content:"▶ ";display:inline;font-size:10px}.chat-think-block[open] summary:before{content:"▼ "}.chat-think-block summary:hover{background:var(--bg-hover);color:var(--text-primary)}.chat-think-content{padding:8px 12px;white-space:pre-wrap;color:var(--text-secondary);font-family:ui-monospace,monospace;border-top:1px solid var(--bg-hover);max-height:300px;overflow-y:auto}.chat-voice-note{display:flex;align-items:center;gap:8px;margin-top:4px;padding:8px 12px;background:var(--bg-darkest);border-radius:8px;max-width:300px;flex-wrap:wrap}.chat-voice-transcription{width:100%;font-size:13px;color:var(--text-secondary);font-style:italic;padding-left:2px;margin-top:2px}.chat-voice-transcribing{opacity:.5;animation:chat-pulse 1.5s ease-in-out infinite}@keyframes chat-pulse{0%,to{opacity:.5}50%{opacity:.3}}.chat-voice-transcribe-btn{background:none;border:none;color:var(--text-muted);font-size:11px;cursor:pointer;padding:2px 4px;opacity:.6;font-style:italic}.chat-voice-transcribe-btn:hover{opacity:1;text-decoration:underline}.chat-voice-play-btn{width:32px;height:32px;border-radius:50%;background:var(--accent);color:var(--accent-fg);border:none;font-size:14px;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0}.chat-voice-play-btn:hover{background:var(--accent-hover)}.chat-voice-waveform{flex:1;height:24px;display:flex;align-items:center;gap:2px}.chat-voice-bar{width:3px;background:var(--accent);border-radius:2px;min-height:3px}.chat-voice-duration{font-size:12px;color:var(--text-muted);flex-shrink:0}.chat-reactions{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px}.chat-reaction{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:8px;border:1px solid var(--border);background:var(--bg-dark);font-size:15px;cursor:pointer;user-select:none;transition:all .1s}.chat-reaction:hover{border-color:var(--accent-line);background:var(--bg-hover)}.chat-reaction.mine{border-color:var(--accent-line);background:var(--accent-soft)}.chat-reaction-count{font-size:12px;color:var(--text-secondary);font-weight:500}.chat-reaction-add{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:8px;border:1px dashed var(--border);background:transparent;font-size:16px;cursor:pointer;color:var(--text-muted);transition:all .1s}.chat-reaction-add:hover{border-color:var(--accent-line);color:var(--text-primary);background:var(--bg-hover)}.chat-emoticon-tooltip{position:absolute;z-index:200;pointer-events:none;background:var(--bg-darkest);border:1px solid var(--border);border-radius:8px;padding:8px 12px;box-shadow:0 4px 16px #0000004d;display:none;flex-direction:column;align-items:center;gap:4px;max-width:200px}.chat-emoticon-tooltip.show{display:flex;pointer-events:auto}.chat-emoticon-tooltip-preview{font-size:48px;line-height:1}.chat-emoticon-tooltip-preview img{width:48px;height:48px;object-fit:contain}.chat-emoticon-tooltip-name{font-size:12px;color:var(--text-muted)}.chat-emoticon-tooltip-names{font-size:11px;color:var(--text-secondary);text-align:center}.chat-emoticon-tooltip-adopt{background:var(--accent);color:var(--accent-fg);border:none;cursor:pointer;font-size:11px;padding:2px 10px;border-radius:4px;font-weight:600}.chat-emoticon-tooltip-adopt:hover{opacity:.85}.chat-msg-actions{position:absolute;top:-14px;right:16px;display:none;background:var(--bg-darkest);border:1px solid var(--border);border-radius:4px;z-index:10}.chat-msg-group:hover .chat-msg-actions,.chat-msg-continuation:hover .chat-msg-actions,.chat-msg-action:hover .chat-msg-actions{display:flex}.chat-msg-action-btn{background:none;border:none;color:var(--text-secondary);padding:6px 8px;cursor:pointer;font-size:16px}.chat-msg-action-btn:hover{background:var(--bg-hover);color:var(--text-primary)}.chat-emoji-picker-overlay{position:fixed;inset:0;z-index:100;display:none}.chat-emoji-picker-overlay.show{display:block}.chat-emoji-picker{position:absolute;background:var(--bg-darkest);border:1px solid var(--border);border-radius:8px;padding:8px;box-shadow:0 4px 20px #0000004d;z-index:101;max-width:280px;width:280px;display:flex;flex-direction:column;max-height:320px}.chat-emoji-picker-scroll{overflow-y:auto;overscroll-behavior:contain;min-height:0;flex:1}.chat-emoji-grid{display:flex;flex-wrap:wrap;gap:2px}.chat-emoji-grid button{background:none;border:none;font-size:22px;cursor:pointer;padding:4px;border-radius:4px;width:36px;height:36px;display:flex;align-items:center;justify-content:center}.chat-emoji-grid button:hover{background:var(--bg-hover)}.chat-emoji-active{background:var(--accent)!important;outline:2px solid var(--accent-line);outline-offset:-2px;opacity:.8}.chat-emoji-picker-search{width:100%;padding:6px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text-primary);font-size:14px;margin-bottom:6px;outline:none;flex-shrink:0}.chat-emoji-picker-search:focus{border-color:var(--accent-line)}.chat-emoticon-section{border-bottom:1px solid var(--border);padding-bottom:6px;margin-bottom:6px}.chat-emoticon-section-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:4px;font-size:11px;color:var(--text-muted);text-transform:uppercase;letter-spacing:.5px}.chat-emoticon-section-label{font-size:11px;color:var(--text-muted);text-transform:uppercase;letter-spacing:.5px;margin:6px 0 4px;padding:0 2px}.chat-emoticon-btn{position:relative;width:36px;height:36px;display:flex;align-items:center;justify-content:center;border:none;background:transparent;border-radius:4px;cursor:pointer;padding:2px}.chat-emoticon-btn:hover{background:var(--bg-hover)}.chat-emoticon-img{width:28px;height:28px;object-fit:contain}.chat-emoticon-add-btn{background:none;border:1px dashed var(--border);color:var(--text-muted);cursor:pointer;font-size:11px;padding:2px 8px;border-radius:4px}.chat-emoticon-add-btn:hover{border-color:var(--accent-line);color:var(--text-primary)}.chat-emoticon-grid{display:flex;flex-wrap:wrap;gap:2px}.chat-emoticon-grid button{background:none;border:none;cursor:pointer;padding:2px;border-radius:4px;width:36px;height:36px;display:flex;align-items:center;justify-content:center;position:relative}.chat-emoticon-grid button:hover{background:var(--bg-hover)}.chat-emoticon-grid button img{width:28px;height:28px;object-fit:contain}.chat-emoticon-adopt{position:absolute;top:-2px;right:-2px;width:14px;height:14px;border-radius:50%;background:var(--accent);color:var(--accent-fg);border:none;cursor:pointer;font-size:10px;display:none;align-items:center;justify-content:center;line-height:1}.chat-emoticon-grid button:hover .chat-emoticon-adopt{display:flex}.chat-emoticon-remove{position:absolute;top:-4px;right:-4px;width:16px;height:16px;border-radius:50%;background:var(--bg-hover);color:var(--text-muted);border:1px solid var(--border);cursor:pointer;font-size:10px;display:none;align-items:center;justify-content:center;line-height:1}.chat-emoticon-grid button:hover .chat-emoticon-remove{display:flex}.chat-emoticon-remove:hover{background:#ed4245!important;color:#fff!important;border-color:#ed4245!important}.chat-emoticon-remove.confirm{background:#ed4245;color:#fff;border-color:#ed4245;display:flex}.chat-emoticon-inline{height:1.5em;vertical-align:middle;display:inline}.chat-emoticon-dialog{padding:8px;display:flex;flex-direction:column;gap:8px}.chat-emoticon-dialog input[type=text]{width:100%;padding:6px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text-primary);font-size:14px;outline:none}.chat-emoticon-dialog input[type=text]:focus{border-color:var(--accent-line)}.chat-emoticon-dialog-preview{width:80px;height:80px;border-radius:4px;background:var(--bg-hover);display:flex;align-items:center;justify-content:center;overflow:hidden;align-self:center;color:var(--text-muted);font-size:24px}.chat-emoticon-dialog-preview:hover{background:var(--bg-input);border:1px dashed var(--border)}.chat-emoticon-dialog-preview img{width:100%;height:100%;object-fit:contain}.chat-emoticon-dialog-counter{font-size:11px;color:var(--text-muted);text-align:center}.chat-emoticon-dialog-btns{display:flex;gap:6px;justify-content:flex-end}.chat-emoticon-dialog-btns button{padding:4px 12px;border-radius:4px;font-size:13px;cursor:pointer;border:none}.chat-emoticon-dialog .cancel-btn{background:var(--bg-hover);color:var(--text-primary)}.chat-emoticon-dialog .save-btn{background:var(--accent);color:var(--accent-fg);font-weight:600}.chat-emoticon-dialog .save-btn:disabled{opacity:.5;cursor:default}.chat-font-dialog{padding:8px;display:flex;flex-direction:column;gap:8px}.chat-font-dialog input[type=text]{width:100%;padding:6px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text-primary);font-size:14px;outline:none}.chat-font-dialog input[type=text]:focus{border-color:var(--accent-line)}.chat-font-dialog-preview{padding:10px;border-radius:4px;background:var(--bg-hover);text-align:center;font-size:18px;color:var(--text-primary);min-height:48px;display:flex;align-items:center;justify-content:center}.chat-font-dialog-filebtn{background:none;border:1px dashed var(--border);color:var(--text-muted);cursor:pointer;font-size:13px;padding:6px 12px;border-radius:4px;text-align:center}.chat-font-dialog-filebtn:hover{border-color:var(--accent-line);color:var(--text-primary)}.chat-font-dialog-btns{display:flex;gap:6px;justify-content:flex-end}.chat-font-dialog-btns button{padding:4px 12px;border-radius:4px;font-size:13px;cursor:pointer;border:none}.chat-font-dialog .cancel-btn{background:var(--bg-hover);color:var(--text-primary)}.chat-font-dialog .save-btn{background:var(--accent);color:var(--accent-fg);font-weight:600}.chat-font-dialog .save-btn:disabled{opacity:.5;cursor:default}.chat-font-list{display:flex;flex-direction:column;gap:2px;max-height:120px;overflow-y:auto;overscroll-behavior:contain}.chat-font-list-item{display:flex;align-items:center;justify-content:space-between;padding:4px 8px;border-radius:4px;font-size:13px;color:var(--text-primary)}.chat-font-list-item:hover{background:var(--bg-hover)}.chat-font-list-item .font-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-font-list-remove{width:18px;height:18px;border-radius:50%;background:var(--bg-hover);color:var(--text-muted);border:1px solid var(--border);cursor:pointer;font-size:10px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.chat-font-list-remove:hover,.chat-font-list-remove.confirm{background:#ed4245;color:#fff;border-color:#ed4245}.chat-msg-menu-wrap{position:relative}.chat-msg-menu{display:none;position:absolute;top:100%;right:0;margin-top:2px;background:var(--bg-darkest);border:1px solid var(--border);border-radius:6px;padding:4px 0;min-width:120px;z-index:20;box-shadow:0 4px 12px #0000004d}.chat-msg-menu.show{display:block}.chat-msg-menu-item{display:flex;align-items:center;gap:8px;width:100%;padding:6px 12px;background:none;border:none;color:var(--text-primary);font-size:13px;cursor:pointer;text-align:left}.chat-msg-menu-item:hover{background:var(--bg-hover)}.chat-msg-menu-item.danger{color:#ed4245}.chat-msg-menu-item.danger:hover{background:#ed42451a}.chat-typing-bar{padding:0 16px;min-height:22px;font-size:12px;color:var(--text-muted);font-style:italic;flex-shrink:0}.chat-llm-status{padding:0 16px;min-height:22px;font-size:12px;color:var(--text-muted);font-style:italic;flex-shrink:0;font-family:monospace}.chat-stop-btn{display:inline-flex;align-items:center;gap:4px;padding:2px 10px;border:1px solid var(--border);border-radius:4px;background:var(--bg-mid);color:var(--text-secondary);font-size:12px;font-family:inherit;cursor:pointer;font-style:normal}.chat-stop-btn:hover{background:var(--bg-hover);color:var(--text-primary)}.chat-input-wrapper{flex-shrink:0;padding:0 16px 16px;position:relative}.chat-autocomplete{display:none;position:absolute;bottom:100%;left:0;right:0;background:var(--bg-darkest);border:1px solid var(--border);border-radius:8px;max-height:200px;overflow-y:auto;overscroll-behavior:contain;box-shadow:0 -4px 16px #0000004d;z-index:50;margin-bottom:4px}.chat-autocomplete.show{display:block}.chat-autocomplete-item{display:flex;align-items:center;gap:8px;padding:6px 12px;cursor:pointer;font-size:14px;color:var(--text-primary)}.chat-autocomplete-item:hover,.chat-autocomplete-item.active{background:var(--bg-hover)}.chat-autocomplete-item-emoji{font-size:20px;width:28px;text-align:center;flex-shrink:0}.chat-autocomplete-item-emoji img{width:24px;height:24px;object-fit:contain}.chat-autocomplete-item-name{color:var(--text-secondary);font-size:12px}.chat-autocomplete-item-desc{color:var(--text-muted);font-size:11px;margin-left:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:50%}.chat-autocomplete-item-cmd{font-weight:600;font-size:14px;color:var(--text-primary);min-width:0}.chat-autocomplete-pop{position:fixed;z-index:50;min-width:200px;max-width:340px;max-height:200px;overflow-y:auto;overscroll-behavior:contain;background:var(--editor-fill, Canvas);color:var(--editor-line, currentColor);border:1px solid var(--border);border-radius:8px;box-shadow:0 4px 16px #0000004d}.chat-autocomplete-item-icon{width:20px;height:20px;flex-shrink:0;color:var(--text-muted)}.chat-reply-bar{display:none;padding:8px 12px;background:var(--bg-mid);border-radius:8px 8px 0 0;border-left:3px solid var(--accent-line);align-items:center;gap:8px;font-size:13px;color:var(--text-secondary)}.chat-reply-bar.show{display:flex}.chat-reply-bar-text{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-reply-bar-close{background:none;border:none;font-size:16px;cursor:pointer;color:var(--text-secondary)}.chat-reply-bar-close:hover{color:var(--text-primary)}.chat-paste-preview{display:none;padding:8px 12px;background:var(--bg-mid);align-items:center;gap:8px;flex-wrap:wrap}.chat-paste-preview.show{display:flex}.chat-paste-preview img{max-height:50px;border-radius:4px}.chat-paste-preview video{max-height:50px;border-radius:4px}.chat-paste-preview-close{background:none;border:none;font-size:16px;cursor:pointer;color:var(--text-secondary);margin-left:auto}.chat-paste-file{display:flex;align-items:center;gap:6px;background:var(--bg-hover);border-radius:6px;padding:4px 8px;font-size:12px;color:var(--text-secondary);max-width:200px}.chat-paste-file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-paste-file-remove{background:none;border:none;cursor:pointer;color:var(--text-secondary);padding:0;display:flex;align-items:center}.chat-paste-file-remove:hover{color:var(--text-primary)}.chat-paste-embed{display:flex;align-items:center;gap:6px;background:var(--bg-hover);border-radius:6px;padding:4px 8px;font-size:12px;color:var(--text-secondary);max-width:200px}.chat-paste-embed-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-selection-chip{display:inline-flex;align-items:center;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background:var(--bg-hover);color:var(--text-secondary);border-radius:6px;padding:2px 8px;margin:0 4px;font-size:12px}.chat-paste-embed-remove{background:none;border:none;cursor:pointer;color:var(--text-secondary);padding:0;display:flex;align-items:center}.chat-paste-embed-remove:hover{color:var(--text-primary)}.chat-sidebar-pinned-wrap{position:relative}.chat-sidebar-pinned-wrap[data-drop-position=above]:before{content:"";position:absolute;top:-2px;left:4px;right:4px;height:2px;background:var(--accent);border-radius:1px;z-index:10}.chat-sidebar-pinned-wrap[data-drop-position=below]:after{content:"";position:absolute;bottom:-2px;left:4px;right:4px;height:2px;background:var(--accent);border-radius:1px;z-index:10}.chat-sidebar-pinned-wrap.dragging{opacity:.4}.chat-drop-overlay{display:none;position:absolute;inset:0;z-index:100;background:color-mix(in oklch,var(--theme) 20%,black 60%);align-items:center;justify-content:center;font-size:18px;color:var(--text-primary);font-weight:600;border:3px dashed var(--accent-line);border-radius:12px;pointer-events:none}.chat-drop-overlay.show{display:flex}.chat-msg-video-wrap{max-width:350px;border-radius:8px;overflow:hidden;margin-top:4px;position:relative}.chat-msg-video{width:100%;display:block;border-radius:8px;cursor:pointer}.chat-lightbox{display:none;position:absolute;inset:0;z-index:200;background:#000000d9;align-items:center;justify-content:center;cursor:zoom-out}.chat-lightbox.show{display:flex}.chat-lightbox img,.chat-lightbox video{max-width:95%;max-height:95%;object-fit:contain;border-radius:4px;cursor:default}.chat-lightbox video{background:#000}.chat-msg-file{display:inline-flex;align-items:center;gap:6px;background:var(--bg-hover);border-radius:6px;padding:6px 10px;margin-top:4px;font-size:13px;color:var(--text-secondary);cursor:pointer;text-decoration:none}.chat-msg-file:hover{background:var(--bg-input);color:var(--text-primary)}.chat-msg-file-icon{flex-shrink:0}.chat-input-row{display:flex;gap:0;background:var(--bg-mid);border:1px solid var(--border);border-radius:8px;padding:3px;align-items:flex-end}.chat-input{width:100%;padding:8px 12px;border:none;font-size:15px;outline:none;background:transparent;color:var(--text-primary);font-family:inherit;resize:none;max-height:120px;min-height:24px;line-height:1.4;position:relative;z-index:1}.chat-input::placeholder{color:var(--text-muted)}.chat-input-btn{width:36px;height:36px;background:none;border:none;color:var(--text-muted);cursor:pointer;font-size:20px;border-radius:4px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.chat-input-btn:hover{color:var(--text-primary)}.chat-input-btn.recording{color:#ed4245;animation:pulse 1s infinite}@keyframes pulse{0%,to{transform:scale(1)}50%{transform:scale(1.15)}}.chat-recording-bar{display:flex;align-items:center;gap:10px;background:var(--bg-input);border-radius:8px;padding:8px 12px;animation:fadeIn .15s ease}.chat-recording-overlay{position:absolute;inset:0;z-index:3}@keyframes fadeIn{0%{opacity:0;transform:scale(.98)}to{opacity:1;transform:scale(1)}}.chat-recording-dot{width:10px;height:10px;border-radius:50%;background:#ed4245;flex-shrink:0;animation:recPulse 1s ease-in-out infinite}@keyframes recPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.8)}}.chat-recording-time{font-size:14px;color:var(--text-primary);font-variant-numeric:tabular-nums;min-width:40px}.chat-recording-viz{flex:1;height:24px;display:flex;align-items:center;gap:2px;overflow:hidden}.chat-recording-viz-bar{width:3px;border-radius:2px;background:var(--accent);min-height:3px;transition:height .1s ease}.chat-recording-cancel{background:none;border:none;color:var(--text-muted);cursor:pointer;font-size:13px;padding:4px 10px;border-radius:4px}.chat-recording-cancel:hover{color:var(--text-primary);background:var(--bg-hover)}.chat-recording-send{background:var(--accent);color:var(--accent-fg);border:none;cursor:pointer;padding:6px 14px;border-radius:6px;font-size:13px;font-weight:600}.chat-recording-send:hover{background:var(--accent-hover)}.chat-gif-toggle{width:36px;height:36px;border:none;cursor:pointer;border-radius:4px;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:none;color:var(--text-muted);font-size:20px;position:relative;overflow:hidden}.chat-gif-toggle:hover{color:var(--text-primary)}.chat-gif-toggle.active{color:var(--accent-text)}.chat-gif-toggle video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:4px;display:none}.chat-gif-toggle.active video{display:block}.chat-gif-toggle.active .chat-gif-icon{display:none}.chat-gif-toggle.recording{pointer-events:none;position:relative;overflow:visible}.chat-gif-progress{position:absolute;top:-10px;left:-10px;width:calc(100% + 20px);height:calc(100% + 20px);z-index:20;pointer-events:none}.chat-gif-progress circle.chat-gif-progress-bg{fill:none;stroke:#00000026;stroke-width:2}.chat-gif-progress circle.chat-gif-progress-fg{fill:none;stroke:var(--accent-line);stroke-width:2;stroke-linecap:round;transform:rotate(-90deg);transform-origin:center;transition:stroke-dashoffset .1s linear}.chat-input-row.processing .chat-input,.chat-input-row.processing .chat-input-wrap,.chat-input-row.processing .chat-input-btn{opacity:.5;pointer-events:none}.chat-empty{flex:1;display:flex;align-items:center;justify-content:center;color:var(--text-muted);font-size:16px}@keyframes chat-skeleton-pulse{0%,to{opacity:.3}50%{opacity:.6}}.chat-msg-loading{opacity:.5}.chat-skeleton{background:var(--bg-hover);animation:chat-skeleton-pulse 1.5s ease-in-out infinite}.chat-skeleton-line{height:14px;background:var(--bg-hover);border-radius:4px;margin:4px 0;animation:chat-skeleton-pulse 1.5s ease-in-out infinite;width:60%}.chat-skeleton-line.short{width:30%}.chat-main{display:flex;flex-direction:column;flex:1;min-width:0;position:relative;height:100%}.chat-sidebar{display:none;flex-direction:column;width:40%;min-width:15%;border-left:1px solid var(--border);background:var(--bg-darkest);overflow:hidden;position:relative}.chat-sidebar.visible{display:flex}.chat-sidebar.drop-target{display:flex;min-width:60px;width:60px;align-items:center;justify-content:center;border:2px dashed var(--accent-line);background:color-mix(in oklch,var(--accent) 10%,var(--bg-darkest))}.chat-sidebar.drop-target:after{content:"Pin";font-size:11px;color:var(--accent-text);font-weight:600;pointer-events:none}.chat-sidebar.visible.drop-target{width:40%;min-width:15%}.chat-sidebar.visible.drop-target:after{display:none}.chat-sidebar.collapsed{width:0!important;min-width:0!important;border-left:none;overflow:hidden}.chat-root.sidebar-left{flex-direction:row-reverse}.chat-root.sidebar-left .chat-sidebar{border-left:none;border-right:1px solid var(--border)}.chat-root.sidebar-left .chat-sidebar-resize{left:auto;right:-3px}.chat-sidebar-resize{position:absolute;left:-3px;top:0;bottom:0;width:6px;cursor:col-resize;z-index:10}.chat-sidebar-resize:hover,.chat-sidebar-resize.dragging{background:var(--accent);opacity:.3}.chat-sidebar-header{display:flex;align-items:center;justify-content:space-between;padding:4px 6px;border-bottom:1px solid var(--border);flex-shrink:0}.chat-sidebar-header-title{font-size:11px;color:var(--text-muted);text-transform:uppercase;letter-spacing:.5px}.chat-sidebar-collapse-btn{background:none;border:none;cursor:pointer;padding:2px 4px;color:var(--text-muted);display:flex;align-items:center}.chat-sidebar-collapse-btn:hover{color:var(--text-primary)}.chat-sidebar-pinned{flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:0;padding:4px}.chat-sidebar-pinned:empty{display:none}.chat-sidebar-pinned-wrap{position:relative;display:flex;flex-direction:column;flex:1;min-height:200px;border:1px solid var(--border);border-radius:6px;overflow:hidden;margin-bottom:4px;background:var(--bg-mid)}.chat-sidebar-pinned-toolbar{position:absolute;top:4px;right:4px;z-index:10;display:flex;gap:2px;opacity:0;transition:opacity .15s;pointer-events:auto}.chat-sidebar-pinned-wrap:hover .chat-sidebar-pinned-toolbar{opacity:1}.chat-sidebar-pinned-toolbar button{background:var(--bg-darkest);border:1px solid var(--border);border-radius:4px;color:var(--text-muted);cursor:pointer;padding:2px 4px;font-size:10px;display:flex;align-items:center;gap:2px;line-height:1}.chat-sidebar-pinned-toolbar button:hover{color:var(--text-primary);background:var(--bg-mid)}.chat-sidebar-pinned-toolbar button svg{width:12px;height:12px}.chat-sidebar-pinned iframe{width:100%;flex:1;border:none;border-radius:4px;min-height:200px;background:var(--bg-mid)}.chat-sidebar-pinned-info{background:var(--bg-darkest);border-bottom:1px solid var(--border);font-size:11px;color:var(--text-secondary)}.chat-sidebar-pinned-info-main{display:flex;align-items:center;gap:4px;padding:3px 8px;cursor:pointer}.chat-sidebar-pinned-info-main:hover{background:var(--bg-hover)}.chat-sidebar-pinned-info-title{flex:1;font-weight:600;color:var(--text-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}.chat-sidebar-pinned-info-chevron{font-size:10px;transition:transform .15s;flex-shrink:0}.chat-sidebar-pinned-info-chevron.open{transform:rotate(90deg)}.chat-sidebar-pinned-info-details{padding:2px 8px 4px}.chat-sidebar-pinned-info-row{display:flex;align-items:center;gap:4px;padding:1px 0}.chat-sidebar-pinned-info-label{color:var(--text-muted);font-size:10px;min-width:24px;flex-shrink:0}.chat-sidebar-pinned-info-value{font-family:monospace;font-size:10px;color:var(--text-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-sidebar-pinned-info-url{cursor:pointer}.chat-sidebar-pinned-info-url:hover{color:var(--text-primary);text-decoration:underline}.chat-sidebar-pinned-info-editable{cursor:pointer;border-bottom:1px dashed var(--text-muted)}.chat-sidebar-pinned-info-editable:hover{color:var(--text-primary)}.chat-sidebar-pinned-info-input{font-family:monospace;font-size:10px;background:var(--bg-input);border:1px solid var(--border);border-radius:3px;color:var(--text-primary);padding:1px 4px;flex:1;min-width:0}.chat-sidebar-pinned-resize-handle{height:6px;cursor:row-resize;flex-shrink:0;background:transparent;position:relative}.chat-sidebar-pinned-resize-handle:after{content:"";position:absolute;left:20%;right:20%;top:2px;height:2px;border-radius:1px;background:var(--border);opacity:0;transition:opacity .15s}.chat-sidebar-pinned-resize-handle:hover:after,.chat-sidebar-pinned-resize-handle.active:after{opacity:1}.chat-sidebar-pinned-resize-handle.active:after{background:var(--accent)}.chat-sidebar-status{padding:4px 8px;font-size:11px;color:var(--text-muted);text-align:center}.chat-sidebar-toggle-btn{background:none;border:none;color:var(--text-muted);cursor:pointer;padding:2px 4px;border-radius:4px;display:flex;align-items:center}.chat-sidebar-toggle-btn:hover{background:var(--bg-hover);color:var(--text-primary)}.chat-embed-pin{cursor:pointer}.chat-embed-pin.pinned{color:var(--accent-text)}.chat-msg-name-computer{color:var(--accent-text);font-style:italic}.chat-avatar.computer{background:var(--accent-soft);overflow:hidden}.chat-avatar.computer img{width:100%;height:100%;object-fit:cover;display:block}.computer-presence img{width:100%;height:100%;object-fit:cover;display:block;border-radius:50%}.chat-dialog-overlay{position:fixed;inset:0;z-index:100;background:#00000080;display:flex;align-items:center;justify-content:center;animation:fadeIn .15s ease}.chat-emoticon-dialog,.chat-font-dialog{background:var(--bg-dark);border:1px solid var(--border);border-radius:8px;min-width:300px;max-width:400px;box-shadow:0 8px 32px #0006}.chat-plugin-panel{background:var(--bg-dark);border:1px solid var(--border);border-radius:8px;min-width:300px;max-width:420px;max-height:70vh;display:flex;flex-direction:column;box-shadow:0 8px 32px #0006}.chat-plugin-panel-header{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;border-bottom:1px solid var(--border);font-size:14px;font-weight:600}.chat-plugin-panel-close{background:none;border:none;color:var(--text-muted);cursor:pointer;font-size:18px;line-height:1}.chat-plugin-panel-close:hover{color:var(--text-primary)}.chat-plugin-panel-body{padding:6px;overflow-y:auto;display:flex;flex-direction:column;gap:1px}.chat-plugin-section{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--text-muted);padding:10px 6px 4px}.chat-plugin-item{display:flex;align-items:center;gap:8px;padding:5px 6px;border-radius:4px;cursor:pointer;font-size:13px;color:var(--text-primary)}.chat-plugin-item:hover{background:var(--bg-hover)}.chat-plugin-item input{cursor:pointer}.chat-plugin-item-locked,.chat-plugin-item-locked input{cursor:default}.chat-plugin-item-locked{opacity:.55}.chat-plugin-item-locked:hover{background:none}.chat-plugin-id{margin-left:auto;font-family:ui-monospace,monospace;font-size:11px;color:var(--text-muted)}.chat-emoticon-dialog-header,.chat-font-dialog-header{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;border-bottom:1px solid var(--border);font-size:14px;font-weight:600}.chat-emoticon-dialog-close,.chat-font-dialog-close{background:none;border:none;color:var(--text-muted);cursor:pointer;font-size:18px;line-height:1}.chat-emoticon-dialog-close:hover,.chat-font-dialog-close:hover{color:var(--text-primary)}.chat-emoticon-dialog-body,.chat-font-dialog-body{padding:12px;display:flex;flex-direction:column;gap:8px}.chat-emoticon-dialog-footer,.chat-font-dialog-footer{display:flex;gap:6px;justify-content:flex-end;padding:8px 12px;border-top:1px solid var(--border)}.chat-emoticon-dialog-footer button,.chat-font-dialog-footer button{padding:6px 14px;border-radius:6px;font-size:13px;cursor:pointer;border:none}.chat-emoticon-dialog-save,.chat-font-dialog-save{background:var(--accent);color:var(--accent-fg);font-weight:600}.chat-emoticon-dialog-save:disabled,.chat-font-dialog-save:disabled{opacity:.5;cursor:default}.chat-emoticon-dialog-save:not(:disabled):hover,.chat-font-dialog-save:not(:disabled):hover{background:var(--accent-hover)}.chat-emoticon-dialog-nav{display:flex;align-items:center;justify-content:center;gap:8px;font-size:12px;color:var(--text-muted)}.chat-emoticon-dialog-nav button{background:none;border:1px solid var(--border);color:var(--text-secondary);cursor:pointer;padding:2px 8px;border-radius:4px;font-size:12px}.chat-emoticon-dialog-nav button:disabled{opacity:.4;cursor:default}.chat-emoticon-dialog-nav button:not(:disabled):hover{background:var(--bg-hover)}.chat-emoticon-dialog-name,.chat-font-dialog-name{width:100%;padding:6px 10px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text-primary);font-size:14px;outline:none}.chat-emoticon-dialog-name:focus,.chat-font-dialog-name:focus{border-color:var(--accent-line)}.chat-font-dialog-list{display:flex;flex-direction:column;gap:2px;max-height:120px;overflow-y:auto}.chat-font-dialog-item{display:flex;align-items:center;justify-content:space-between;padding:4px 8px;border-radius:4px;font-size:13px}.chat-font-dialog-item:hover{background:var(--bg-hover)}.chat-font-dialog-remove{width:20px;height:20px;border-radius:50%;background:var(--bg-hover);color:var(--text-muted);border:1px solid var(--border);cursor:pointer;font-size:12px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.chat-font-dialog-remove:hover{background:#ed4245;color:#fff;border-color:#ed4245}.chat-font-dialog-choose{background:none;border:1px dashed var(--border);color:var(--text-muted);cursor:pointer;font-size:13px;padding:8px 12px;border-radius:4px;text-align:center;width:100%}.chat-font-dialog-choose:hover{border-color:var(--accent-line);color:var(--text-primary)}.chat-font-dialog-preview{padding:10px;border-radius:4px;background:var(--bg-hover);text-align:center;font-size:16px;color:var(--text-primary)}.chat-gif-toggle .chat-gif-progress{position:absolute;inset:-4px;width:calc(100% + 8px);height:calc(100% + 8px);z-index:20;pointer-events:none}.chat-time-gap{text-align:center;color:var(--text-muted);font-size:11px;padding:8px 0 4px;position:relative}.chat-time-gap:before{content:"";position:absolute;left:20%;right:20%;top:50%;border-top:1px solid var(--border);z-index:0}.chat-time-gap span{position:relative;z-index:1;background:var(--bg-dark);padding:0 8px}.chat-model-dialog{background:var(--bg-mid);border:1px solid var(--border);border-radius:8px;width:420px;max-width:90vw;padding:0;overflow:hidden}.chat-model-dialog-header{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid var(--border);font-weight:600;font-size:14px}.chat-model-dialog-close{background:none;border:none;color:var(--text-muted);cursor:pointer;font-size:20px;padding:0 4px}.chat-model-dialog-close:hover{color:var(--text-primary)}.chat-model-dialog-tabs{display:flex;border-bottom:1px solid var(--border)}.chat-model-dialog-tabs button{flex:1;background:none;border:none;color:var(--text-secondary);padding:8px 12px;cursor:pointer;font-size:13px;border-bottom:2px solid transparent}.chat-model-dialog-tabs button:hover{color:var(--text-primary)}.chat-model-dialog-tabs button.active{color:var(--accent-text);border-bottom-color:var(--accent-line)}.chat-model-dialog-body{padding:12px 16px;min-height:120px}.chat-model-dialog-label{display:block;font-size:12px;color:var(--text-secondary);margin-bottom:10px}.chat-model-dialog-input{display:block;width:100%;margin-top:4px;padding:6px 8px;background:var(--bg-input);border:1px solid var(--border);border-radius:4px;color:var(--text-primary);font-size:13px;outline:none}.chat-model-dialog-input:focus{border-color:var(--accent-line)}select.chat-model-dialog-input{flex:1}.chat-model-dialog-btn{background:var(--bg-hover);border:1px solid var(--border);border-radius:4px;color:var(--text-primary);padding:6px 12px;cursor:pointer;font-size:13px}.chat-model-dialog-btn:hover{background:var(--accent-soft)}.chat-model-dialog-btn.primary{background:var(--accent);color:var(--accent-fg);border-color:var(--accent-line)}.chat-model-dialog-btn.primary:hover{opacity:.9}.chat-model-dialog-footer{display:flex;gap:8px;justify-content:flex-end;padding:12px 16px;border-top:1px solid var(--border)}@media (max-width: 600px){.chat-root,.chat-root.sidebar-left{flex-direction:column-reverse!important}.chat-sidebar{width:100%!important;min-width:0!important;border-left:none!important;border-right:none!important;border-bottom:1px solid var(--border);max-height:50%}.chat-sidebar.visible{max-height:50%}.chat-sidebar.drop-target{width:100%!important;min-width:0!important;height:60px}.chat-sidebar.visible.drop-target{width:100%!important}.chat-sidebar-resize{display:none}.chat-msg-group{padding:2px 10px;gap:8px}.chat-msg-continuation{padding:0 10px 0 48px}.chat-msg-continuation.has-gif{padding-left:10px}.chat-msg-action{padding:4px 10px}.chat-avatar-col{width:30px}.chat-avatar{width:30px;height:30px;font-size:14px}.chat-msg-gif-inline{width:30px;height:30px}.chat-presence-bar{padding:4px 10px;gap:6px;flex-wrap:wrap}.chat-input-wrapper{padding:0 8px 8px}.chat-input{padding:6px 8px;font-size:14px}.chat-input-btn,.chat-gif-toggle{width:32px;height:32px;font-size:18px}.chat-reply-bar{padding:6px 8px;font-size:12px}.chat-msg-reply-ref{padding-left:24px;font-size:12px}.chat-msg-reply-ref:before{left:12px}.chat-msg-reply-ref-text{max-width:180px}.chat-voice-note{max-width:100%}.chat-msg-embed{height:200px}.chat-msg-video-wrap,.chat-msg-image-wrap{max-width:100%}.chat-code-block code{font-size:12px}.shiki{font-size:12px!important}.chat-emoji-picker{max-width:260px;width:260px}.chat-emoticon-dialog,.chat-font-dialog{min-width:0;max-width:calc(100vw - 24px);width:calc(100vw - 24px)}.chat-model-dialog{width:calc(100vw - 24px)}.chat-autocomplete-item{padding:6px 8px;font-size:13px}.chat-typing-bar,.chat-llm-status{padding:0 10px}.chat-recording-bar{padding:6px 8px}.chat-sidebar-pinned-wrap{min-height:120px}.chat-sidebar-toggle-btn svg,.chat-sidebar-collapse-btn svg{transform:rotate(90deg)}.chat-time-gap:before{left:10%;right:10%}}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
2
  import { p as r } from "./index-d8BugVrl.js";
3
3
  export {
4
4
  r as plugins
@@ -9,7 +9,7 @@ import {
9
9
  setThemeForMode,
10
10
  startActiveTheme,
11
11
  startActiveThemeFromProvider
12
- } from "./chunk-K4OOO2TK.js";
12
+ } from "./chunk-UVXMCWBQ.js";
13
13
  import "./chunk-RATW7VZI.js";
14
14
  export {
15
15
  CURRENT_THEME_SELECTOR,
@@ -23,4 +23,4 @@ export {
23
23
  startActiveTheme,
24
24
  startActiveThemeFromProvider
25
25
  };
26
- //# sourceMappingURL=active-theme-K27UXDBG.js.map
26
+ //# sourceMappingURL=active-theme-32OB4CH6.js.map
@@ -11,6 +11,14 @@ var theme_default = "./theme-RC7MV6WP.css";
11
11
 
12
12
  // src/active-theme.ts
13
13
  var CURRENT_THEME_SELECTOR = "patchwork:current-theme";
14
+ var FALLBACK_DEFAULTS = { light: "lychee", dark: "gloom" };
15
+ function defaultThemeIds() {
16
+ const root = document.documentElement;
17
+ return {
18
+ light: root.getAttribute("data-theme-light") || FALLBACK_DEFAULTS.light,
19
+ dark: root.getAttribute("data-theme-dark") || FALLBACK_DEFAULTS.dark
20
+ };
21
+ }
14
22
  var bundledStyleUrls = [theme_default, lychee_default, gloom_default].map(
15
23
  (href) => new URL(href, import.meta.url).href
16
24
  );
@@ -47,16 +55,17 @@ function getMode() {
47
55
  function getPreferredThemeId(prefs) {
48
56
  const mode = getMode();
49
57
  const themeId = prefs ? mode === "dark" ? prefs.dark : prefs.light : void 0;
50
- return themeId || (mode === "dark" ? "gloom" : "lychee");
58
+ return themeId || defaultThemeIds()[mode];
51
59
  }
52
60
  function snapshot() {
53
61
  const prefs = currentPrefsHandle?.doc();
54
62
  const mode = getMode();
63
+ const defaults = defaultThemeIds();
55
64
  return {
56
65
  mode,
57
66
  themeId: getPreferredThemeId(prefs),
58
- light: prefs?.light || "lychee",
59
- dark: prefs?.dark || "gloom",
67
+ light: prefs?.light || defaults.light,
68
+ dark: prefs?.dark || defaults.dark,
60
69
  preferencesUrl: currentPrefsHandle?.url
61
70
  };
62
71
  }
@@ -108,8 +117,6 @@ function subscribeToProvider(element, selector, onValue) {
108
117
  function ensureThemePreferencesShape(prefsHandle) {
109
118
  prefsHandle.change((doc) => {
110
119
  doc["@patchwork"] = { type: "theme-preferences" };
111
- if (!doc.light) doc.light = "lychee";
112
- if (!doc.dark) doc.dark = "gloom";
113
120
  });
114
121
  }
115
122
  async function useThemePreferencesHandle(prefsHandle) {
@@ -278,4 +285,4 @@ export {
278
285
  hasThemePreferences,
279
286
  onActiveThemeChange
280
287
  };
281
- //# sourceMappingURL=chunk-K4OOO2TK.js.map
288
+ //# sourceMappingURL=chunk-UVXMCWBQ.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/active-theme.ts"],
4
+ "sourcesContent": ["import {getRegistry} from \"@inkandswitch/patchwork-plugins\"\nimport themeCssUrl from \"./theme.css\"\nimport lycheeCssUrl from \"./lychee.css\"\nimport gloomCssUrl from \"./gloom.css\"\n\ntype ActiveThemeState = {\n\tmode: \"light\" | \"dark\"\n\tthemeId: string\n\tlight: string\n\tdark: string\n\tpreferencesUrl?: string\n}\n\ntype ThemePreferencesHandle = {\n\turl?: string\n\tdoc(): any\n\tchange(fn: (doc: any) => void): void\n\ton?(event: \"change\", listener: () => void): void\n\toff?(event: \"change\", listener: () => void): void\n\twhenReady?(): Promise<unknown>\n}\n\nexport const CURRENT_THEME_SELECTOR = \"patchwork:current-theme\"\n\n/**\n * Which themes an account that has not chosen one starts on. A site states\n * this on its root element \u2014 `<html data-theme-light=\"warm\" data-theme-dark=\"dark\">`\n * \u2014 so the answer comes from the site itself rather than from whichever\n * module happened to load last. `lychee`/`gloom` apply when it says nothing.\n *\n * Nothing is written to the preferences document: an unset preference resolves\n * through here at read time, so the theme a user picked explicitly is never\n * overwritten, and a site changing its defaults moves everyone who never\n * picked one.\n */\nconst FALLBACK_DEFAULTS = {light: \"lychee\", dark: \"gloom\"}\n\nfunction defaultThemeIds() {\n\tconst root = document.documentElement\n\treturn {\n\t\tlight: root.getAttribute(\"data-theme-light\") || FALLBACK_DEFAULTS.light,\n\t\tdark: root.getAttribute(\"data-theme-dark\") || FALLBACK_DEFAULTS.dark,\n\t}\n}\n\nconst bundledStyleUrls = [themeCssUrl, lycheeCssUrl, gloomCssUrl].map(\n\t(href) => new URL(href, import.meta.url).href\n)\nconst bundledStyles = new Set(bundledStyleUrls)\nconst themeLinks = new Map<string, HTMLLinkElement>()\nconst listeners = new Set<(state: ActiveThemeState) => void>()\n\nlet started = false\nlet stylesBootstrapped = false\nlet currentPrefsHandle: ThemePreferencesHandle | undefined\nlet currentState: ActiveThemeState | undefined\nlet storageStarted = false\nlet storageElement: HTMLElement | undefined\nlet unsubscribeStorage: (() => void) | undefined\nlet unsubscribePrefsChange: (() => void) | undefined\n\nconst TOOL_STORAGE_ID = \"theme-preferences\"\n\nfunction ensureThemeLink(style: string) {\n\tif (themeLinks.has(style)) return\n\tconst link = document.createElement(\"link\")\n\tlink.rel = \"stylesheet\"\n\tlink.href = style\n\tdocument.head.appendChild(link)\n\tthemeLinks.set(style, link)\n}\n\nfunction removeThemeLink(style: string) {\n\tconst link = themeLinks.get(style)\n\tif (link) {\n\t\tlink.remove()\n\t\tthemeLinks.delete(style)\n\t}\n}\n\nfunction getMode(): \"light\" | \"dark\" {\n\treturn window.matchMedia(\"(prefers-color-scheme: dark)\").matches\n\t\t? \"dark\"\n\t\t: \"light\"\n}\n\nfunction getPreferredThemeId(prefs: any): string {\n\tconst mode = getMode()\n\tconst themeId = prefs ? (mode === \"dark\" ? prefs.dark : prefs.light) : undefined\n\treturn themeId || defaultThemeIds()[mode]\n}\n\nfunction snapshot(): ActiveThemeState {\n\tconst prefs = currentPrefsHandle?.doc()\n\tconst mode = getMode()\n\tconst defaults = defaultThemeIds()\n\treturn {\n\t\tmode,\n\t\tthemeId: getPreferredThemeId(prefs),\n\t\tlight: prefs?.light || defaults.light,\n\t\tdark: prefs?.dark || defaults.dark,\n\t\tpreferencesUrl: currentPrefsHandle?.url,\n\t}\n}\n\nfunction emit() {\n\tcurrentState = snapshot()\n\tfor (const listener of listeners) listener(currentState)\n}\n\nfunction applyTheme(themeId: string) {\n\tif (themeId) document.documentElement.setAttribute(\"theme\", themeId)\n}\n\nfunction applyFromPrefs() {\n\tapplyTheme(getPreferredThemeId(currentPrefsHandle?.doc()))\n\temit()\n}\n\nfunction subscribeToProvider<T>(\n\telement: HTMLElement,\n\tselector: Record<string, unknown>,\n\tonValue: (value: T) => void\n) {\n\tconst view = element.closest(\"patchwork-view\")\n\tconst dispatchElement = (view as HTMLElement) ?? element\n\tconst channel = new MessageChannel()\n\tconst port = channel.port2\n\tconst controller = new AbortController()\n\n\tport.addEventListener(\n\t\t\"message\",\n\t\t(event: MessageEvent) => {\n\t\t\tif ((event.data as any)?.type === \"change\") onValue((event.data as any).value as T)\n\t\t},\n\t\t{signal: controller.signal}\n\t)\n\tport.start()\n\n\tdispatchElement.dispatchEvent(\n\t\tnew CustomEvent(\"patchwork:subscribe\", {\n\t\t\tdetail: {selector, port: channel.port1},\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t})\n\t)\n\n\treturn () => {\n\t\tif (controller.signal.aborted) return\n\t\tcontroller.abort()\n\t\ttry {\n\t\t\tport.postMessage({type: \"unsubscribe\"})\n\t\t} catch {}\n\t\ttry {\n\t\t\tport.close()\n\t\t} catch {}\n\t}\n}\n\nfunction ensureThemePreferencesShape(prefsHandle: ThemePreferencesHandle) {\n\tprefsHandle.change((doc: any) => {\n\t\tdoc[\"@patchwork\"] = {type: \"theme-preferences\"}\n\t})\n}\n\nasync function useThemePreferencesHandle(prefsHandle: ThemePreferencesHandle) {\n\tawait prefsHandle.whenReady?.()\n\tensureThemePreferencesShape(prefsHandle)\n\n\tif (currentPrefsHandle === prefsHandle) return\n\tif (\n\t\tcurrentPrefsHandle?.url &&\n\t\tprefsHandle.url &&\n\t\tcurrentPrefsHandle.url === prefsHandle.url\n\t) {\n\t\treturn\n\t}\n\n\tunsubscribePrefsChange?.()\n\tcurrentPrefsHandle = prefsHandle\n\tapplyFromPrefs()\n\n\tprefsHandle.on?.(\"change\", applyFromPrefs)\n\tunsubscribePrefsChange = () => prefsHandle.off?.(\"change\", applyFromPrefs)\n}\n\nasync function useToolStoragePreferences(element: HTMLElement, storageUrl: string) {\n\tconst repo = (element as any).repo ?? (window as any).repo\n\tif (!repo) return\n\n\tconst prefsHandle = await repo.find(storageUrl)\n\tawait useThemePreferencesHandle(prefsHandle)\n}\n\nfunction connectThemePreferences(element: HTMLElement) {\n\tif (currentPrefsHandle) return\n\tif (storageStarted && storageElement === element) return\n\n\tunsubscribeStorage?.()\n\tstorageStarted = true\n\tstorageElement = element\n\n\tlet lastStorageUrl: string | undefined\n\n\tunsubscribeStorage = subscribeToProvider<string | undefined>(\n\t\telement,\n\t\t{type: \"patchwork:tool-storage\", toolId: TOOL_STORAGE_ID},\n\t\t(storageUrl) => {\n\t\t\tif (!storageUrl || storageUrl === lastStorageUrl) return\n\t\t\tlastStorageUrl = storageUrl\n\t\t\tuseToolStoragePreferences(element, storageUrl).catch(() => {\n\t\t\t\t// Theme preferences are best-effort; keep the default theme.\n\t\t\t})\n\t\t}\n\t)\n}\n\nfunction watchThemeRegistry() {\n\tconst themeRegistry = getRegistry(\"patchwork:theme\") as any\n\n\tfor (const theme of themeRegistry.all?.() || []) {\n\t\tif (theme.style) ensureThemeLink(theme.style)\n\t}\n\n\tthemeRegistry.on(\"registered\", (plugin: any) => {\n\t\tif (plugin.style) ensureThemeLink(plugin.style)\n\t})\n\tthemeRegistry.on(\"removed\", () => {\n\t\tconst knownStyles = new Set(\n\t\t\t(themeRegistry.all?.() || [])\n\t\t\t\t.map((t: any) => t.style)\n\t\t\t\t.filter(Boolean)\n\t\t)\n\t\tfor (const [style] of themeLinks) {\n\t\t\tif (!bundledStyles.has(style) && !knownStyles.has(style)) {\n\t\t\t\tremoveThemeLink(style)\n\t\t\t}\n\t\t}\n\t})\n}\n\n// Load the bundled theme stylesheets and keep the registry-provided ones in\n// sync. Idempotent \u2014 safe to call from every entry point. This is the CSS side\n// of theming, independent of where the *active* theme id is sourced from.\nfunction bootstrapThemeStyles() {\n\tif (stylesBootstrapped) return\n\tstylesBootstrapped = true\n\tfor (const href of bundledStyleUrls) ensureThemeLink(href)\n\twatchThemeRegistry()\n}\n\nexport function startActiveTheme(\n\telement?: HTMLElement,\n\tpreferencesHandle?: ThemePreferencesHandle\n) {\n\tif (preferencesHandle) {\n\t\tuseThemePreferencesHandle(preferencesHandle).catch(() => {\n\t\t\t// Theme preferences are best-effort; keep the default theme.\n\t\t})\n\t} else if (element) {\n\t\tconnectThemePreferences(element)\n\t}\n\tif (started) return\n\tstarted = true\n\n\tbootstrapThemeStyles()\n\tapplyFromPrefs()\n\n\twindow\n\t\t.matchMedia(\"(prefers-color-scheme: dark)\")\n\t\t.addEventListener(\"change\", applyFromPrefs)\n}\n\n/**\n * Drive the active theme from a `patchwork:current-theme` provider instead of\n * from local preferences. Used by the titlebar theme tool, which runs isolated\n * and mirrors whatever theme the host is showing: it applies each theme id the\n * provider emits and re-applies whenever that value changes.\n *\n * Stylesheets are still loaded locally so the referenced themes render; only\n * the *choice* of active theme comes from the provider. Deliberately does not\n * wire up preferences or the prefers-color-scheme listener \u2014 those would fight\n * the provider for control of the `theme` attribute.\n *\n * @returns an unsubscribe function.\n */\nexport function startActiveThemeFromProvider(element: HTMLElement) {\n\tbootstrapThemeStyles()\n\n\treturn subscribeToProvider<string | ActiveThemeState | undefined>(\n\t\telement,\n\t\t{type: CURRENT_THEME_SELECTOR},\n\t\t(value) => {\n\t\t\tconst themeId = typeof value === \"string\" ? value : value?.themeId\n\t\t\tif (themeId) applyTheme(themeId)\n\t\t}\n\t)\n}\n\ntype CurrentThemeSubscribeEvent = CustomEvent<{\n\tselector: {type: string; [key: string]: unknown}\n\tport: MessagePort\n}>\n\n/**\n * Answer `patchwork:current-theme` subscriptions with the active theme id,\n * pushing a fresh value whenever the theme changes. This is the host-side\n * counterpart to {@link startActiveThemeFromProvider}: it lets isolated tools\n * (the titlebar theme tool) mirror the host's active theme across the isolation\n * boundary, where the theme is relayed by the providers bridge.\n *\n * The listener is installed on the given root (the theme tray installs it on\n * `document.documentElement`) so that bridged `patchwork:subscribe` events \u2014\n * which bubble up to `<html>` \u2014 reach it. Implements the provider port protocol\n * directly to avoid a dependency on `@inkandswitch/patchwork-providers`.\n *\n * @returns an unsubscribe function that removes the listener and tears down any\n * live subscriptions.\n */\nexport function serveCurrentThemeProvider(root: HTMLElement): () => void {\n\tconst responders = new Set<() => void>()\n\n\tconst onSubscribe = (event: Event) => {\n\t\tconst detail = (event as CurrentThemeSubscribeEvent).detail\n\t\tif (!detail || detail.selector?.type !== CURRENT_THEME_SELECTOR) return\n\t\tevent.stopPropagation()\n\n\t\tconst port = detail.port\n\t\tlet alive = true\n\t\tconst emit = () => {\n\t\t\tif (!alive) return\n\t\t\tport.postMessage({type: \"change\", value: getActiveThemeState().themeId})\n\t\t}\n\t\tconst removeThemeListener = onActiveThemeChange(emit)\n\n\t\tconst stop = () => {\n\t\t\tif (!alive) return\n\t\t\talive = false\n\t\t\tremoveThemeListener()\n\t\t\tresponders.delete(stop)\n\t\t\ttry {\n\t\t\t\tport.close()\n\t\t\t} catch {}\n\t\t}\n\t\tresponders.add(stop)\n\n\t\tport.onmessage = (e: MessageEvent) => {\n\t\t\tif ((e.data as any)?.type === \"unsubscribe\") stop()\n\t\t}\n\t\tport.start?.()\n\t}\n\n\troot.addEventListener(\"patchwork:subscribe\", onSubscribe)\n\n\treturn () => {\n\t\troot.removeEventListener(\"patchwork:subscribe\", onSubscribe)\n\t\tfor (const stop of [...responders]) stop()\n\t}\n}\n\nexport function getActiveThemeState() {\n\treturn currentState || snapshot()\n}\n\n/**\n * Best-effort color scheme for a theme. Prefers the plugin's declared\n * `colorScheme`, otherwise sniffs `color-scheme: light|dark` out of the theme's\n * stylesheet. Returns `undefined` when neither is available (treated as\n * scheme-agnostic by callers). Shared by the theme tray and the theme picker\n * tool so they group light/dark themes the same way.\n */\nexport async function detectColorScheme(theme: {\n\tcolorScheme?: \"light\" | \"dark\"\n\tstyle?: string\n}): Promise<\"light\" | \"dark\" | undefined> {\n\tif (theme.colorScheme) return theme.colorScheme\n\tif (!theme.style) return undefined\n\ttry {\n\t\tconst res = await fetch(theme.style)\n\t\tconst css = await res.text()\n\t\tconst match = css.match(/color-scheme:\\s*(light|dark)/)\n\t\treturn (match?.[1] as \"light\" | \"dark\") ?? undefined\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\nexport function setThemeForCurrentMode(themeId: string) {\n\tconst mode = getMode()\n\tsetThemeForMode(mode, themeId)\n}\n\nexport function setThemeForMode(mode: \"light\" | \"dark\", themeId: string) {\n\tcurrentPrefsHandle?.change((doc: any) => {\n\t\tdoc[mode] = themeId\n\t})\n}\n\nexport function hasThemePreferences() {\n\treturn Boolean(currentPrefsHandle)\n}\n\nexport function onActiveThemeChange(listener: (state: ActiveThemeState) => void) {\n\tlisteners.add(listener)\n\tlistener(getActiveThemeState())\n\treturn () => listeners.delete(listener)\n}\n"],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F;AAEO,SAAS,sBAAsB;AACrC,SAAO,QAAQ,kBAAkB;AAClC;AAEO,SAAS,oBAAoB,UAA6C;AAChF,YAAU,IAAI,QAAQ;AACtB,WAAS,oBAAoB,CAAC;AAC9B,SAAO,MAAM,UAAU,OAAO,QAAQ;AACvC;",
6
+ "names": ["emit"]
7
+ }
@@ -1,8 +1,7 @@
1
1
  // src/datatype.ts
2
2
  var ThemePreferencesDatatype = {
3
3
  init(doc) {
4
- doc.light = "lychee";
5
- doc.dark = "gloom";
4
+ doc["@patchwork"] = { type: "theme-preferences" };
6
5
  },
7
6
  getTitle() {
8
7
  return "Theme Preferences";
@@ -13,4 +12,4 @@ var ThemePreferencesDatatype = {
13
12
  export {
14
13
  ThemePreferencesDatatype
15
14
  };
16
- //# sourceMappingURL=datatype-UUJVIZM7.js.map
15
+ //# sourceMappingURL=datatype-NY2CT6T4.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/datatype.ts"],
4
+ "sourcesContent": ["export const ThemePreferencesDatatype = {\n\tinit(doc: any) {\n\t\tdoc[\"@patchwork\"] = {type: \"theme-preferences\"}\n\t},\n\tgetTitle() {\n\t\treturn \"Theme Preferences\"\n\t},\n\tsetTitle() {\n\t\t// Theme preferences doc title is not user-editable\n\t},\n}\n"],
5
+ "mappings": ";AAAO,IAAM,2BAA2B;AAAA,EACvC,KAAK,KAAU;AACd,QAAI,YAAY,IAAI,EAAC,MAAM,oBAAmB;AAAA,EAC/C;AAAA,EACA,WAAW;AACV,WAAO;AAAA,EACR;AAAA,EACA,WAAW;AAAA,EAEX;AACD;",
6
+ "names": []
7
+ }
@@ -5,7 +5,7 @@ import {
5
5
 
6
6
  // src/main.ts
7
7
  (async function() {
8
- (await import("./active-theme-K27UXDBG.js")).startActiveTheme();
8
+ (await import("./active-theme-32OB4CH6.js")).startActiveTheme();
9
9
  })();
10
10
  var plugins = [
11
11
  {
@@ -43,7 +43,7 @@ var plugins = [
43
43
  icon: "Palette",
44
44
  unlisted: true,
45
45
  async load() {
46
- const { ThemePreferencesDatatype } = await import("./datatype-UUJVIZM7.js");
46
+ const { ThemePreferencesDatatype } = await import("./datatype-NY2CT6T4.js");
47
47
  return ThemePreferencesDatatype;
48
48
  }
49
49
  },
@@ -57,7 +57,7 @@ var plugins = [
57
57
  unlisted: true,
58
58
  forTitleBar: true,
59
59
  async load() {
60
- const { ThemeTitlebarTool } = await import("./theme-titlebar-P2CODQGF.js");
60
+ const { ThemeTitlebarTool } = await import("./theme-titlebar-GZMRTVWM.js");
61
61
  return ThemeTitlebarTool;
62
62
  }
63
63
  },
@@ -68,7 +68,7 @@ var plugins = [
68
68
  icon: "Palette",
69
69
  tags: ["system-tray"],
70
70
  async load() {
71
- const { ThemeTray } = await import("./theme-tray-5L2KGCGD.js");
71
+ const { ThemeTray } = await import("./theme-tray-MSIUUA2I.js");
72
72
  return ThemeTray;
73
73
  }
74
74
  },
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  startActiveThemeFromProvider
3
- } from "./chunk-K4OOO2TK.js";
3
+ } from "./chunk-UVXMCWBQ.js";
4
4
  import "./chunk-RATW7VZI.js";
5
5
 
6
6
  // src/theme-titlebar.ts
@@ -18,4 +18,4 @@ function ThemeTitlebarTool(_handle, element) {
18
18
  export {
19
19
  ThemeTitlebarTool
20
20
  };
21
- //# sourceMappingURL=theme-titlebar-P2CODQGF.js.map
21
+ //# sourceMappingURL=theme-titlebar-GZMRTVWM.js.map
@@ -5,7 +5,7 @@ import {
5
5
  serveCurrentThemeProvider,
6
6
  setThemeForCurrentMode,
7
7
  startActiveTheme
8
- } from "./chunk-K4OOO2TK.js";
8
+ } from "./chunk-UVXMCWBQ.js";
9
9
  import "./chunk-RATW7VZI.js";
10
10
 
11
11
  // src/theme-tray.tsx
@@ -348,4 +348,4 @@ _$delegateEvents(["click", "input"]);
348
348
  export {
349
349
  ThemeTray
350
350
  };
351
- //# sourceMappingURL=theme-tray-5L2KGCGD.js.map
351
+ //# sourceMappingURL=theme-tray-MSIUUA2I.js.map
@@ -4,7 +4,7 @@ import {
4
4
  onActiveThemeChange,
5
5
  setThemeForMode,
6
6
  startActiveTheme
7
- } from "./chunk-K4OOO2TK.js";
7
+ } from "./chunk-UVXMCWBQ.js";
8
8
  import "./chunk-RATW7VZI.js";
9
9
 
10
10
  // src/tool.tsx
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/active-theme.ts"],
4
- "sourcesContent": ["import {getRegistry} from \"@inkandswitch/patchwork-plugins\"\nimport themeCssUrl from \"./theme.css\"\nimport lycheeCssUrl from \"./lychee.css\"\nimport gloomCssUrl from \"./gloom.css\"\n\ntype ActiveThemeState = {\n\tmode: \"light\" | \"dark\"\n\tthemeId: string\n\tlight: string\n\tdark: string\n\tpreferencesUrl?: string\n}\n\ntype ThemePreferencesHandle = {\n\turl?: string\n\tdoc(): any\n\tchange(fn: (doc: any) => void): void\n\ton?(event: \"change\", listener: () => void): void\n\toff?(event: \"change\", listener: () => void): void\n\twhenReady?(): Promise<unknown>\n}\n\nexport const CURRENT_THEME_SELECTOR = \"patchwork:current-theme\"\n\nconst bundledStyleUrls = [themeCssUrl, lycheeCssUrl, gloomCssUrl].map(\n\t(href) => new URL(href, import.meta.url).href\n)\nconst bundledStyles = new Set(bundledStyleUrls)\nconst themeLinks = new Map<string, HTMLLinkElement>()\nconst listeners = new Set<(state: ActiveThemeState) => void>()\n\nlet started = false\nlet stylesBootstrapped = false\nlet currentPrefsHandle: ThemePreferencesHandle | undefined\nlet currentState: ActiveThemeState | undefined\nlet storageStarted = false\nlet storageElement: HTMLElement | undefined\nlet unsubscribeStorage: (() => void) | undefined\nlet unsubscribePrefsChange: (() => void) | undefined\n\nconst TOOL_STORAGE_ID = \"theme-preferences\"\n\nfunction ensureThemeLink(style: string) {\n\tif (themeLinks.has(style)) return\n\tconst link = document.createElement(\"link\")\n\tlink.rel = \"stylesheet\"\n\tlink.href = style\n\tdocument.head.appendChild(link)\n\tthemeLinks.set(style, link)\n}\n\nfunction removeThemeLink(style: string) {\n\tconst link = themeLinks.get(style)\n\tif (link) {\n\t\tlink.remove()\n\t\tthemeLinks.delete(style)\n\t}\n}\n\nfunction getMode(): \"light\" | \"dark\" {\n\treturn window.matchMedia(\"(prefers-color-scheme: dark)\").matches\n\t\t? \"dark\"\n\t\t: \"light\"\n}\n\nfunction getPreferredThemeId(prefs: any): string {\n\tconst mode = getMode()\n\tconst themeId = prefs ? (mode === \"dark\" ? prefs.dark : prefs.light) : undefined\n\treturn themeId || (mode === \"dark\" ? \"gloom\" : \"lychee\")\n}\n\nfunction snapshot(): ActiveThemeState {\n\tconst prefs = currentPrefsHandle?.doc()\n\tconst mode = getMode()\n\treturn {\n\t\tmode,\n\t\tthemeId: getPreferredThemeId(prefs),\n\t\tlight: prefs?.light || \"lychee\",\n\t\tdark: prefs?.dark || \"gloom\",\n\t\tpreferencesUrl: currentPrefsHandle?.url,\n\t}\n}\n\nfunction emit() {\n\tcurrentState = snapshot()\n\tfor (const listener of listeners) listener(currentState)\n}\n\nfunction applyTheme(themeId: string) {\n\tif (themeId) document.documentElement.setAttribute(\"theme\", themeId)\n}\n\nfunction applyFromPrefs() {\n\tapplyTheme(getPreferredThemeId(currentPrefsHandle?.doc()))\n\temit()\n}\n\nfunction subscribeToProvider<T>(\n\telement: HTMLElement,\n\tselector: Record<string, unknown>,\n\tonValue: (value: T) => void\n) {\n\tconst view = element.closest(\"patchwork-view\")\n\tconst dispatchElement = (view as HTMLElement) ?? element\n\tconst channel = new MessageChannel()\n\tconst port = channel.port2\n\tconst controller = new AbortController()\n\n\tport.addEventListener(\n\t\t\"message\",\n\t\t(event: MessageEvent) => {\n\t\t\tif ((event.data as any)?.type === \"change\") onValue((event.data as any).value as T)\n\t\t},\n\t\t{signal: controller.signal}\n\t)\n\tport.start()\n\n\tdispatchElement.dispatchEvent(\n\t\tnew CustomEvent(\"patchwork:subscribe\", {\n\t\t\tdetail: {selector, port: channel.port1},\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t})\n\t)\n\n\treturn () => {\n\t\tif (controller.signal.aborted) return\n\t\tcontroller.abort()\n\t\ttry {\n\t\t\tport.postMessage({type: \"unsubscribe\"})\n\t\t} catch {}\n\t\ttry {\n\t\t\tport.close()\n\t\t} catch {}\n\t}\n}\n\nfunction ensureThemePreferencesShape(prefsHandle: ThemePreferencesHandle) {\n\tprefsHandle.change((doc: any) => {\n\t\tdoc[\"@patchwork\"] = {type: \"theme-preferences\"}\n\t\tif (!doc.light) doc.light = \"lychee\"\n\t\tif (!doc.dark) doc.dark = \"gloom\"\n\t})\n}\n\nasync function useThemePreferencesHandle(prefsHandle: ThemePreferencesHandle) {\n\tawait prefsHandle.whenReady?.()\n\tensureThemePreferencesShape(prefsHandle)\n\n\tif (currentPrefsHandle === prefsHandle) return\n\tif (\n\t\tcurrentPrefsHandle?.url &&\n\t\tprefsHandle.url &&\n\t\tcurrentPrefsHandle.url === prefsHandle.url\n\t) {\n\t\treturn\n\t}\n\n\tunsubscribePrefsChange?.()\n\tcurrentPrefsHandle = prefsHandle\n\tapplyFromPrefs()\n\n\tprefsHandle.on?.(\"change\", applyFromPrefs)\n\tunsubscribePrefsChange = () => prefsHandle.off?.(\"change\", applyFromPrefs)\n}\n\nasync function useToolStoragePreferences(element: HTMLElement, storageUrl: string) {\n\tconst repo = (element as any).repo ?? (window as any).repo\n\tif (!repo) return\n\n\tconst prefsHandle = await repo.find(storageUrl)\n\tawait useThemePreferencesHandle(prefsHandle)\n}\n\nfunction connectThemePreferences(element: HTMLElement) {\n\tif (currentPrefsHandle) return\n\tif (storageStarted && storageElement === element) return\n\n\tunsubscribeStorage?.()\n\tstorageStarted = true\n\tstorageElement = element\n\n\tlet lastStorageUrl: string | undefined\n\n\tunsubscribeStorage = subscribeToProvider<string | undefined>(\n\t\telement,\n\t\t{type: \"patchwork:tool-storage\", toolId: TOOL_STORAGE_ID},\n\t\t(storageUrl) => {\n\t\t\tif (!storageUrl || storageUrl === lastStorageUrl) return\n\t\t\tlastStorageUrl = storageUrl\n\t\t\tuseToolStoragePreferences(element, storageUrl).catch(() => {\n\t\t\t\t// Theme preferences are best-effort; keep the default theme.\n\t\t\t})\n\t\t}\n\t)\n}\n\nfunction watchThemeRegistry() {\n\tconst themeRegistry = getRegistry(\"patchwork:theme\") as any\n\n\tfor (const theme of themeRegistry.all?.() || []) {\n\t\tif (theme.style) ensureThemeLink(theme.style)\n\t}\n\n\tthemeRegistry.on(\"registered\", (plugin: any) => {\n\t\tif (plugin.style) ensureThemeLink(plugin.style)\n\t})\n\tthemeRegistry.on(\"removed\", () => {\n\t\tconst knownStyles = new Set(\n\t\t\t(themeRegistry.all?.() || [])\n\t\t\t\t.map((t: any) => t.style)\n\t\t\t\t.filter(Boolean)\n\t\t)\n\t\tfor (const [style] of themeLinks) {\n\t\t\tif (!bundledStyles.has(style) && !knownStyles.has(style)) {\n\t\t\t\tremoveThemeLink(style)\n\t\t\t}\n\t\t}\n\t})\n}\n\n// Load the bundled theme stylesheets and keep the registry-provided ones in\n// sync. Idempotent \u2014 safe to call from every entry point. This is the CSS side\n// of theming, independent of where the *active* theme id is sourced from.\nfunction bootstrapThemeStyles() {\n\tif (stylesBootstrapped) return\n\tstylesBootstrapped = true\n\tfor (const href of bundledStyleUrls) ensureThemeLink(href)\n\twatchThemeRegistry()\n}\n\nexport function startActiveTheme(\n\telement?: HTMLElement,\n\tpreferencesHandle?: ThemePreferencesHandle\n) {\n\tif (preferencesHandle) {\n\t\tuseThemePreferencesHandle(preferencesHandle).catch(() => {\n\t\t\t// Theme preferences are best-effort; keep the default theme.\n\t\t})\n\t} else if (element) {\n\t\tconnectThemePreferences(element)\n\t}\n\tif (started) return\n\tstarted = true\n\n\tbootstrapThemeStyles()\n\tapplyFromPrefs()\n\n\twindow\n\t\t.matchMedia(\"(prefers-color-scheme: dark)\")\n\t\t.addEventListener(\"change\", applyFromPrefs)\n}\n\n/**\n * Drive the active theme from a `patchwork:current-theme` provider instead of\n * from local preferences. Used by the titlebar theme tool, which runs isolated\n * and mirrors whatever theme the host is showing: it applies each theme id the\n * provider emits and re-applies whenever that value changes.\n *\n * Stylesheets are still loaded locally so the referenced themes render; only\n * the *choice* of active theme comes from the provider. Deliberately does not\n * wire up preferences or the prefers-color-scheme listener \u2014 those would fight\n * the provider for control of the `theme` attribute.\n *\n * @returns an unsubscribe function.\n */\nexport function startActiveThemeFromProvider(element: HTMLElement) {\n\tbootstrapThemeStyles()\n\n\treturn subscribeToProvider<string | ActiveThemeState | undefined>(\n\t\telement,\n\t\t{type: CURRENT_THEME_SELECTOR},\n\t\t(value) => {\n\t\t\tconst themeId = typeof value === \"string\" ? value : value?.themeId\n\t\t\tif (themeId) applyTheme(themeId)\n\t\t}\n\t)\n}\n\ntype CurrentThemeSubscribeEvent = CustomEvent<{\n\tselector: {type: string; [key: string]: unknown}\n\tport: MessagePort\n}>\n\n/**\n * Answer `patchwork:current-theme` subscriptions with the active theme id,\n * pushing a fresh value whenever the theme changes. This is the host-side\n * counterpart to {@link startActiveThemeFromProvider}: it lets isolated tools\n * (the titlebar theme tool) mirror the host's active theme across the isolation\n * boundary, where the theme is relayed by the providers bridge.\n *\n * The listener is installed on the given root (the theme tray installs it on\n * `document.documentElement`) so that bridged `patchwork:subscribe` events \u2014\n * which bubble up to `<html>` \u2014 reach it. Implements the provider port protocol\n * directly to avoid a dependency on `@inkandswitch/patchwork-providers`.\n *\n * @returns an unsubscribe function that removes the listener and tears down any\n * live subscriptions.\n */\nexport function serveCurrentThemeProvider(root: HTMLElement): () => void {\n\tconst responders = new Set<() => void>()\n\n\tconst onSubscribe = (event: Event) => {\n\t\tconst detail = (event as CurrentThemeSubscribeEvent).detail\n\t\tif (!detail || detail.selector?.type !== CURRENT_THEME_SELECTOR) return\n\t\tevent.stopPropagation()\n\n\t\tconst port = detail.port\n\t\tlet alive = true\n\t\tconst emit = () => {\n\t\t\tif (!alive) return\n\t\t\tport.postMessage({type: \"change\", value: getActiveThemeState().themeId})\n\t\t}\n\t\tconst removeThemeListener = onActiveThemeChange(emit)\n\n\t\tconst stop = () => {\n\t\t\tif (!alive) return\n\t\t\talive = false\n\t\t\tremoveThemeListener()\n\t\t\tresponders.delete(stop)\n\t\t\ttry {\n\t\t\t\tport.close()\n\t\t\t} catch {}\n\t\t}\n\t\tresponders.add(stop)\n\n\t\tport.onmessage = (e: MessageEvent) => {\n\t\t\tif ((e.data as any)?.type === \"unsubscribe\") stop()\n\t\t}\n\t\tport.start?.()\n\t}\n\n\troot.addEventListener(\"patchwork:subscribe\", onSubscribe)\n\n\treturn () => {\n\t\troot.removeEventListener(\"patchwork:subscribe\", onSubscribe)\n\t\tfor (const stop of [...responders]) stop()\n\t}\n}\n\nexport function getActiveThemeState() {\n\treturn currentState || snapshot()\n}\n\n/**\n * Best-effort color scheme for a theme. Prefers the plugin's declared\n * `colorScheme`, otherwise sniffs `color-scheme: light|dark` out of the theme's\n * stylesheet. Returns `undefined` when neither is available (treated as\n * scheme-agnostic by callers). Shared by the theme tray and the theme picker\n * tool so they group light/dark themes the same way.\n */\nexport async function detectColorScheme(theme: {\n\tcolorScheme?: \"light\" | \"dark\"\n\tstyle?: string\n}): Promise<\"light\" | \"dark\" | undefined> {\n\tif (theme.colorScheme) return theme.colorScheme\n\tif (!theme.style) return undefined\n\ttry {\n\t\tconst res = await fetch(theme.style)\n\t\tconst css = await res.text()\n\t\tconst match = css.match(/color-scheme:\\s*(light|dark)/)\n\t\treturn (match?.[1] as \"light\" | \"dark\") ?? undefined\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\nexport function setThemeForCurrentMode(themeId: string) {\n\tconst mode = getMode()\n\tsetThemeForMode(mode, themeId)\n}\n\nexport function setThemeForMode(mode: \"light\" | \"dark\", themeId: string) {\n\tcurrentPrefsHandle?.change((doc: any) => {\n\t\tdoc[mode] = themeId\n\t})\n}\n\nexport function hasThemePreferences() {\n\treturn Boolean(currentPrefsHandle)\n}\n\nexport function onActiveThemeChange(listener: (state: Act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AQ;AACtB,WAAS,oBAAoB,CAAC;AAC9B,SAAO,MAAM,UAAU,OAAO,QAAQ;AACvC;",
6
- "names": ["emit"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/datatype.ts"],
4
- "sourcesContent": ["export const ThemePreferencesDatatype = {\n\tinit(doc: any) {\n\t\tdoc.light = \"lychee\"\n\t\tdoc.dark = \"gloom\"\n\t},\n\tgetTitle() {\n\t\treturn \"Theme Preferences\"\n\t},\n\tsetTitle() {\n\t\t// Theme preferences doc title is not user-editable\n\t},\n}\n"],
5
- "mappings": ";AAAO,IAAM,2BAA2B;AAAA,EACvC,KAAK,KAAU;AACd,QAAI,QAAQ;AACZ,QAAI,OAAO;AAAA,EACZ;AAAA,EACA,WAAW;AACV,WAAO;AAAA,EACR;AAAA,EACA,WAAW;AAAA,EAEX;AACD;",
6
- "names": []
7
- }